@lunora/studio 1.0.0-alpha.37 → 1.0.0-alpha.38

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 (67) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/packem_chunks/auth-config-panel.js +290 -104
  3. package/dist/packem_chunks/organizations-panel.js +3002 -494
  4. package/dist/packem_chunks/users-panel.js +576 -110
  5. package/dist/packem_shared/use-async-submit-BWMDwRa4.js +91 -0
  6. package/dist/standalone/{chunk-PACH5AHG.js → chunk-2F4VYKM6.js} +1 -1
  7. package/dist/standalone/{chunk-OIZ4CHPN.js → chunk-2GFAOIC3.js} +1 -1
  8. package/dist/standalone/{chunk-OY3GVYS7.js → chunk-2SAZ5BZ5.js} +1 -1
  9. package/dist/standalone/chunk-2SE7II7A.js +1 -0
  10. package/dist/standalone/{chunk-5OH3VPZF.js → chunk-34OQUHSV.js} +1 -1
  11. package/dist/standalone/{chunk-2THHW7BC.js → chunk-3DBG4RIV.js} +1 -1
  12. package/dist/standalone/{chunk-EUIHTPKI.js → chunk-3UFZCRWL.js} +1 -1
  13. package/dist/standalone/{chunk-QLM6FYZW.js → chunk-4FL3EDN5.js} +1 -1
  14. package/dist/standalone/{chunk-ILCTSAOB.js → chunk-4JOKDSPU.js} +1 -1
  15. package/dist/standalone/{chunk-BQUQS7QN.js → chunk-7FF76BYY.js} +1 -1
  16. package/dist/standalone/chunk-7YXOPTWI.js +1 -0
  17. package/dist/standalone/chunk-AJKR6PY7.js +1 -0
  18. package/dist/standalone/{chunk-TOJ3TC35.js → chunk-FA3CCTXK.js} +1 -1
  19. package/dist/standalone/chunk-GLUNBZRI.js +1 -0
  20. package/dist/standalone/chunk-GM4NPF3W.js +1 -0
  21. package/dist/standalone/{chunk-XLQ4BHBD.js → chunk-HLZ4YLRK.js} +1 -1
  22. package/dist/standalone/{chunk-RRAFQ5G2.js → chunk-I3VXCZZL.js} +1 -1
  23. package/dist/standalone/{chunk-7VF3IAAW.js → chunk-IJPFHUJK.js} +1 -1
  24. package/dist/standalone/chunk-IQ466Q6W.js +1 -0
  25. package/dist/standalone/{chunk-LD2R263D.js → chunk-IU6GTBPD.js} +1 -1
  26. package/dist/standalone/{chunk-764T6X6X.js → chunk-IXDH4GL5.js} +1 -1
  27. package/dist/standalone/{chunk-6WRZP62V.js → chunk-JTTVXBLU.js} +1 -1
  28. package/dist/standalone/{chunk-7SLSB2TS.js → chunk-KQTCLPLO.js} +2 -2
  29. package/dist/standalone/chunk-KSKXW5PX.js +1 -0
  30. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  31. package/dist/standalone/{chunk-BI35RXKQ.js → chunk-LEHGGJP2.js} +1 -1
  32. package/dist/standalone/chunk-LNZIB2MD.js +1 -0
  33. package/dist/standalone/{chunk-OCHNCAXJ.js → chunk-MZ756AFF.js} +1 -1
  34. package/dist/standalone/chunk-N7G5I47W.js +1 -0
  35. package/dist/standalone/{chunk-TO4JQX7W.js → chunk-NV6RHG5L.js} +1 -1
  36. package/dist/standalone/chunk-O3I57FXK.js +1 -0
  37. package/dist/standalone/{chunk-YEVCU7TB.js → chunk-OES45DFG.js} +1 -1
  38. package/dist/standalone/{chunk-DVKPRFIJ.js → chunk-OIC7EJWI.js} +1 -1
  39. package/dist/standalone/{chunk-ZU4DZ6NK.js → chunk-OLE2AYTD.js} +1 -1
  40. package/dist/standalone/{chunk-U4OAQPBT.js → chunk-P3ZMBPCY.js} +1 -1
  41. package/dist/standalone/{chunk-VTGBPW24.js → chunk-P5JW7HKP.js} +1 -1
  42. package/dist/standalone/{chunk-MPTM7ZU3.js → chunk-Q3PTSVVU.js} +1 -1
  43. package/dist/standalone/chunk-QKQABJBE.js +1 -0
  44. package/dist/standalone/{chunk-JE2YOAB7.js → chunk-R5OQZYSW.js} +1 -1
  45. package/dist/standalone/{chunk-ATYUMPDM.js → chunk-SE2TQAHJ.js} +1 -1
  46. package/dist/standalone/{chunk-DVC6YWVP.js → chunk-TI7SE33D.js} +1 -1
  47. package/dist/standalone/{chunk-DWTBY343.js → chunk-VFJPO4UO.js} +1 -1
  48. package/dist/standalone/chunk-VON7JUPG.js +1 -0
  49. package/dist/standalone/{chunk-46K3NKPA.js → chunk-X7RPB4K4.js} +1 -1
  50. package/dist/standalone/{chunk-X5P2WRYI.js → chunk-XFSUINL3.js} +1 -1
  51. package/dist/standalone/{chunk-SLKF2L74.js → chunk-XGUOXHX4.js} +1 -1
  52. package/dist/standalone/{chunk-M55U7NHO.js → chunk-ZL4E2WVF.js} +1 -1
  53. package/dist/standalone/studio.js +1 -1
  54. package/package.json +3 -3
  55. package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
  56. package/dist/standalone/chunk-22W5VKZ6.js +0 -1
  57. package/dist/standalone/chunk-2GGMGPEP.js +0 -1
  58. package/dist/standalone/chunk-BACPICH6.js +0 -1
  59. package/dist/standalone/chunk-DORBUITF.js +0 -1
  60. package/dist/standalone/chunk-IOFMK4D7.js +0 -1
  61. package/dist/standalone/chunk-LI43EKM6.js +0 -1
  62. package/dist/standalone/chunk-MPYFGAOW.js +0 -1
  63. package/dist/standalone/chunk-NKJDGOM3.js +0 -1
  64. package/dist/standalone/chunk-PN5NCZDX.js +0 -1
  65. package/dist/standalone/chunk-RSEEHNFI.js +0 -1
  66. package/dist/standalone/chunk-X7MMBSNW.js +0 -1
  67. package/dist/standalone/chunk-XUGSA2NG.js +0 -1
@@ -1 +1 @@
1
- import{b as de,e as j}from"./chunk-SG3ALJJU.js";import{a as ce}from"./chunk-WXPWVBIY.js";import"./chunk-DC72CQY4.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-KEGAWN6Y.js";import{a as ie}from"./chunk-TBMYIZIO.js";import"./chunk-HV7G6DFP.js";import{a as E}from"./chunk-BOXSWNXZ.js";import{b as ne}from"./chunk-DVKPRFIJ.js";import{a as S}from"./chunk-SEU5V7I6.js";import{b as A}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as ae,g as le}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as D,e as T,f as H,g as Q,k as F,n as oe}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as h,e as k,f as ke,g as re,h as se,j as w}from"./chunk-RRCPZMC2.js";var ve=k(re(),1);var c=k(ke(),1);var ue=k(re(),1);var W=k(se(),1);var Ae={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},fe=h(()=>{let t=(0,ue.c)(16),e=D(),a=le(),s;e:switch(a){case"connected":{let n;t[0]!==e?(n=e("Connected"),t[0]=e,t[1]=n):n=t[1],s=n;break e}case"connecting":{let n;t[2]!==e?(n=e("Connecting\u2026"),t[2]=e,t[3]=n):n=t[3],s=n;break e}case"idle":{let n;t[4]!==e?(n=e("Idle"),t[4]=e,t[5]=n):n=t[5],s=n;break e}case"offline":{let n;t[6]!==e?(n=e("Offline"),t[6]=e,t[7]=n):n=t[7],s=n;break e}default:s=a}let l=Ae[a],d;t[8]!==l?(d=w("size-2 rounded-full",l),t[8]=l,t[9]=d):d=t[9];let u;t[10]!==d?(u=(0,W.jsxDEV)("span",{"aria-hidden":"true",className:d},void 0,!1),t[10]=d,t[11]=u):u=t[11];let i;return t[12]!==a||t[13]!==u||t[14]!==s?(i=(0,W.jsxDEV)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[u,s]},void 0,!0),t[12]=a,t[13]=u,t[14]=s,t[15]=i):i=t[15],i},"ConnectionBadge");var r=k(se(),1);var me={completed:0,failed:2,in_progress:1},Re=h(t=>{let e=0,a=0,s=0,l=0,d=[];for(let{metrics:u}of t){if(u===null){l+=1;continue}s+=1,e+=u.requests,a+=u.errors,d.push(...u.history??[])}return{errors:a,failed:l,history:d,reachable:s,requests:e}},"sumShardMetrics"),Me=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"mergeFunctionStats"),_e=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let d=me[s.status]-me[l.status];(d>0||d===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"dedupeMigrations"),Ie=T(E.getAuthMetrics),Le=T(E.getFunctionStats),Ce=T(E.getLogs),Oe=T(E.getMetrics),qe=T(E.migrationStatus),De=5,he=2e3,Fe=5,pe=.01,ge=.05,je=.1,Ue=.3,Pe=1,Ge=50,X=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","rateLevel"),Ve=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","countLevel"),Be={crit:"destructive",ok:"secondary",warn:"default"},U=h((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"ratePercent"),Ke=h(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"requestErrorSeries"),$e=h(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"migrationSummary"),ze=h((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"migrationTileValue"),xe={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},He={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Qe=h(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","worstLevel"),P=h(t=>{let e=(0,ve.c)(19),{chart:a,label:s,level:l,testId:d,value:u}=t,i=xe[l],n;e[0]!==i?(n=w("size-1.5 shrink-0 rounded-full",i),e[0]=i,e[1]=n):n=e[1];let p;e[2]!==n?(p=(0,r.jsxDEV)("span",{"aria-hidden":"true",className:n},void 0,!1),e[2]=n,e[3]=p):p=e[3];let g;e[4]!==s||e[5]!==p?(g=(0,r.jsxDEV)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[p,s]},void 0,!0),e[4]=s,e[5]=p,e[6]=g):g=e[6];let b=Ne[l],m;e[7]!==b?(m=w("truncate text-2xl font-semibold tabular-nums",b),e[7]=b,e[8]=m):m=e[8];let f;e[9]!==m||e[10]!==d||e[11]!==u?(f=(0,r.jsxDEV)("span",{className:m,"data-testid":d,children:u},void 0,!1),e[9]=m,e[10]=d,e[11]=u,e[12]=f):f=e[12];let v;e[13]!==a||e[14]!==f?(v=(0,r.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[f,a]},void 0,!0),e[13]=a,e[14]=f,e[15]=v):v=e[15];let x;return e[16]!==g||e[17]!==v?(x=(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:(0,r.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,v]},void 0,!0)},void 0,!1),e[16]=g,e[17]=v,e[18]=x):x=e[18],x},"SloCard"),We=h(async(t,e,a)=>{let s=await Promise.all(a.map(m=>{let f=H(m);return Promise.allSettled([t.query(Oe,{},f),t.query(Le,{},f),t.query(qe,{},f)])})),l=H(e),d=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[u,i,n]=await Promise.allSettled([t.query(Ce,{},l),t.query(Ie,{},l),d]),p=s.map(([m,f,v])=>({functions:f.status==="fulfilled"?f.value.functions:[],metrics:m.status==="fulfilled"?m.value:null,migrations:v.status==="fulfilled"?v.value.migrations:[]})),g=Re(p),b=s[0]?.[0];return{auth:i.status==="fulfilled"?i.value:null,entries:u.status==="fulfilled"?u.value.entries:[],functions:Me(p.map(m=>m.functions)),logsError:u.status==="rejected"?Q(u.reason):null,metricsError:g.reachable===0&&b?.status==="rejected"?Q(b.reason):null,migrations:_e(p.map(m=>m.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:g}},"loadSloData"),ht=h(({initialShardKey:t})=>{let e=ae(),a=D(),[s,l]=(0,c.useState)([]),[d,u]=(0,c.useState)(null),[i,n]=(0,c.useState)(null),[p,g]=(0,c.useState)(null),[b,m]=(0,c.useState)([]),[f,v]=(0,c.useState)(null),[x,be]=(0,c.useState)(null),[we,Ee]=(0,c.useState)([]),[y]=(0,c.useState)(ie),R=(0,c.useRef)(!1),G=(0,c.useRef)(!0);(0,c.useEffect)(()=>(G.current=!0,()=>{G.current=!1}),[]);let M=t??"",_=(0,c.useCallback)(async()=>{if(R.current)return;R.current=!0;let o=await We(e,M,de(M,y));if(!G.current){R.current=!1;return}n(o.totals),g(o.metricsError),m(o.functions),Ee(o.migrations),l(o.entries),u(o.logsError),v(o.auth),be(o.scheduler),R.current=!1},[e,y,M]);(0,c.useEffect)(()=>{F(_())},[_]);let V=(0,c.useRef)(0),I=(0,c.useRef)(null),Se=h(()=>{let o=Date.now()-V.current;if(o>=he){V.current=Date.now(),F(_());return}I.current??=setTimeout(()=>{I.current=null,V.current=Date.now(),F(_())},he-o)},"scheduleFanOut");(0,c.useEffect)(()=>()=>{I.current!==null&&clearTimeout(I.current)},[]);let{data:J,liveError:Te}=ne(E.getMetrics,{},{live:!0,shardKey:M});(0,c.useEffect)(()=>{J!==void 0&&Se()},[J]);let B=s.filter(o=>o.level==="error"),K=B.slice(0,De),L=Ke(i?.history),Y=(0,c.useMemo)(()=>{let o=f?.history??[];return{attempts:o.map(N=>N.attempts),failures:o.map(N=>N.failures)}},[f?.history]),Z=b.filter(o=>o.calls>0).toSorted((o,N)=>N.errors/N.calls-o.errors/o.calls||N.calls-o.calls).slice(0,Fe),$=$e(we),ye=i===null||i.requests===0?0:i.errors/i.requests,z=X(ye,pe,ge),ee=f===null?"ok":X(f.failureRate,je,Ue),te=x===null?"ok":Ve(x.backlog,Pe,Ge),C=Qe([z,ee,te,$.level]),O,q;return C==="crit"?(O=a("Critical"),q=a("One or more service levels are breached.")):C==="warn"?(O=a("Degraded"),q=a("Some service levels need attention.")):(O=a("All systems healthy"),q=a("All service levels are within target.")),(0,r.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxDEV)("div",{className:"flex items-center gap-3",children:[(0,r.jsxDEV)("span",{"aria-hidden":"true",className:w("flex size-10 shrink-0 items-center justify-center rounded-full",He[C]),children:(0,r.jsxDEV)("span",{className:w("size-3 rounded-full",xe[C])},void 0,!1)},void 0,!1),(0,r.jsxDEV)("div",{className:"grid leading-tight",children:[(0,r.jsxDEV)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O},void 0,!1),(0,r.jsxDEV)("span",{className:"text-[13px] text-muted-foreground",children:q},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[L.requests.length>=2&&(0,r.jsxDEV)(j,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:L.requests,testId:"hl-spark-requests"},void 0,!1),(0,r.jsxDEV)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(i?.requests??0).toString()},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")},void 0,!1),(0,r.jsxDEV)("div",{className:w("text-lg font-semibold tabular-nums",Ne[z]),"data-testid":"hl-error-rate",children:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)(fe,{},void 0,!1),(0,r.jsxDEV)(ce,{message:Te,prefix:"hl"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),p!==null&&(0,r.jsxDEV)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:p},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsxDEV)(P,{chart:L.errors.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:L.errors,testId:"hl-spark-errors"},void 0,!1):void 0,label:a("Error rate"),level:z,testId:"hl-slo-errorrate",value:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1),(0,r.jsxDEV)(P,{chart:Y.failures.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:Y.failures,testId:"hl-spark-auth"},void 0,!1):void 0,label:a("Auth failures"),level:ee,testId:"hl-slo-auth",value:f===null?"\u2014":U(f.failures,f.attempts)},void 0,!1),(0,r.jsxDEV)(P,{label:a("Scheduler backlog"),level:te,testId:"hl-slo-backlog",value:x===null?"\u2014":x.backlog.toString()},void 0,!1),(0,r.jsxDEV)(P,{label:a("Migrations"),level:$.level,testId:"hl-slo-migrations",value:ze($,a)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0","data-testid":"hl-functions",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Functions by error rate")},void 0,!1)},void 0,!1),Z.length===0?(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:a("No function activity yet.")},void 0,!1):(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:Z.map(o=>(0,r.jsxDEV)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.path},void 0,!1),(0,r.jsxDEV)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsxDEV)("span",{className:"tabular-nums text-muted-foreground",children:a("{count} calls",{count:o.calls.toString()})},void 0,!1),(0,r.jsxDEV)(A,{variant:Be[X(o.errors/o.calls,pe,ge)],children:U(o.errors,o.calls)},void 0,!1)]},void 0,!0)]},o.path,!0))},void 0,!1)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Recent errors")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-error-count",variant:B.length>0?"destructive":"outline",children:B.length},void 0,!1)]},void 0,!0),d!==null&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:d},void 0,!1),d===null&&K.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:a("No recent errors.")},void 0,!1),K.length>0&&(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:K.map((o,N)=>(0,r.jsxDEV)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxDEV)("span",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)("time",{className:"shrink-0 text-muted-foreground",children:oe(o.timestamp)},void 0,!1),o.functionPath!==void 0&&(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.functionPath},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{className:"text-destructive",children:o.message},void 0,!1)]},`${o.timestamp.toString()}-${N.toString()}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-shard-count",variant:"outline",children:y.length},void 0,!1)]},void 0,!0),y.length>0&&(0,r.jsxDEV)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:y.map(o=>(0,r.jsxDEV)("li",{"data-testid":"hl-shard",children:(0,r.jsxDEV)(A,{variant:"secondary",children:o},void 0,!1)},o,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)},"HealthPanel");export{ht as HealthPanel};
1
+ import{b as de,e as j}from"./chunk-SG3ALJJU.js";import{a as ce}from"./chunk-WXPWVBIY.js";import"./chunk-DC72CQY4.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-KEGAWN6Y.js";import{a as ie}from"./chunk-TBMYIZIO.js";import"./chunk-HV7G6DFP.js";import{a as E}from"./chunk-BOXSWNXZ.js";import{b as ne}from"./chunk-OIC7EJWI.js";import{a as S}from"./chunk-SEU5V7I6.js";import{b as A}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as ae,g as le}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as D,e as T,f as H,g as Q,k as F,n as oe}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as h,e as k,f as ke,g as re,h as se,j as w}from"./chunk-RRCPZMC2.js";var ve=k(re(),1);var c=k(ke(),1);var ue=k(re(),1);var W=k(se(),1);var Ae={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},fe=h(()=>{let t=(0,ue.c)(16),e=D(),a=le(),s;e:switch(a){case"connected":{let n;t[0]!==e?(n=e("Connected"),t[0]=e,t[1]=n):n=t[1],s=n;break e}case"connecting":{let n;t[2]!==e?(n=e("Connecting\u2026"),t[2]=e,t[3]=n):n=t[3],s=n;break e}case"idle":{let n;t[4]!==e?(n=e("Idle"),t[4]=e,t[5]=n):n=t[5],s=n;break e}case"offline":{let n;t[6]!==e?(n=e("Offline"),t[6]=e,t[7]=n):n=t[7],s=n;break e}default:s=a}let l=Ae[a],d;t[8]!==l?(d=w("size-2 rounded-full",l),t[8]=l,t[9]=d):d=t[9];let u;t[10]!==d?(u=(0,W.jsxDEV)("span",{"aria-hidden":"true",className:d},void 0,!1),t[10]=d,t[11]=u):u=t[11];let i;return t[12]!==a||t[13]!==u||t[14]!==s?(i=(0,W.jsxDEV)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[u,s]},void 0,!0),t[12]=a,t[13]=u,t[14]=s,t[15]=i):i=t[15],i},"ConnectionBadge");var r=k(se(),1);var me={completed:0,failed:2,in_progress:1},Re=h(t=>{let e=0,a=0,s=0,l=0,d=[];for(let{metrics:u}of t){if(u===null){l+=1;continue}s+=1,e+=u.requests,a+=u.errors,d.push(...u.history??[])}return{errors:a,failed:l,history:d,reachable:s,requests:e}},"sumShardMetrics"),Me=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"mergeFunctionStats"),_e=h(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let d=me[s.status]-me[l.status];(d>0||d===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"dedupeMigrations"),Ie=T(E.getAuthMetrics),Le=T(E.getFunctionStats),Ce=T(E.getLogs),Oe=T(E.getMetrics),qe=T(E.migrationStatus),De=5,he=2e3,Fe=5,pe=.01,ge=.05,je=.1,Ue=.3,Pe=1,Ge=50,X=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","rateLevel"),Ve=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","countLevel"),Be={crit:"destructive",ok:"secondary",warn:"default"},U=h((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"ratePercent"),Ke=h(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"requestErrorSeries"),$e=h(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"migrationSummary"),ze=h((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"migrationTileValue"),xe={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},He={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Qe=h(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","worstLevel"),P=h(t=>{let e=(0,ve.c)(19),{chart:a,label:s,level:l,testId:d,value:u}=t,i=xe[l],n;e[0]!==i?(n=w("size-1.5 shrink-0 rounded-full",i),e[0]=i,e[1]=n):n=e[1];let p;e[2]!==n?(p=(0,r.jsxDEV)("span",{"aria-hidden":"true",className:n},void 0,!1),e[2]=n,e[3]=p):p=e[3];let g;e[4]!==s||e[5]!==p?(g=(0,r.jsxDEV)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[p,s]},void 0,!0),e[4]=s,e[5]=p,e[6]=g):g=e[6];let b=Ne[l],m;e[7]!==b?(m=w("truncate text-2xl font-semibold tabular-nums",b),e[7]=b,e[8]=m):m=e[8];let f;e[9]!==m||e[10]!==d||e[11]!==u?(f=(0,r.jsxDEV)("span",{className:m,"data-testid":d,children:u},void 0,!1),e[9]=m,e[10]=d,e[11]=u,e[12]=f):f=e[12];let v;e[13]!==a||e[14]!==f?(v=(0,r.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[f,a]},void 0,!0),e[13]=a,e[14]=f,e[15]=v):v=e[15];let x;return e[16]!==g||e[17]!==v?(x=(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:(0,r.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,v]},void 0,!0)},void 0,!1),e[16]=g,e[17]=v,e[18]=x):x=e[18],x},"SloCard"),We=h(async(t,e,a)=>{let s=await Promise.all(a.map(m=>{let f=H(m);return Promise.allSettled([t.query(Oe,{},f),t.query(Le,{},f),t.query(qe,{},f)])})),l=H(e),d=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[u,i,n]=await Promise.allSettled([t.query(Ce,{},l),t.query(Ie,{},l),d]),p=s.map(([m,f,v])=>({functions:f.status==="fulfilled"?f.value.functions:[],metrics:m.status==="fulfilled"?m.value:null,migrations:v.status==="fulfilled"?v.value.migrations:[]})),g=Re(p),b=s[0]?.[0];return{auth:i.status==="fulfilled"?i.value:null,entries:u.status==="fulfilled"?u.value.entries:[],functions:Me(p.map(m=>m.functions)),logsError:u.status==="rejected"?Q(u.reason):null,metricsError:g.reachable===0&&b?.status==="rejected"?Q(b.reason):null,migrations:_e(p.map(m=>m.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:g}},"loadSloData"),ht=h(({initialShardKey:t})=>{let e=ae(),a=D(),[s,l]=(0,c.useState)([]),[d,u]=(0,c.useState)(null),[i,n]=(0,c.useState)(null),[p,g]=(0,c.useState)(null),[b,m]=(0,c.useState)([]),[f,v]=(0,c.useState)(null),[x,be]=(0,c.useState)(null),[we,Ee]=(0,c.useState)([]),[y]=(0,c.useState)(ie),R=(0,c.useRef)(!1),G=(0,c.useRef)(!0);(0,c.useEffect)(()=>(G.current=!0,()=>{G.current=!1}),[]);let M=t??"",_=(0,c.useCallback)(async()=>{if(R.current)return;R.current=!0;let o=await We(e,M,de(M,y));if(!G.current){R.current=!1;return}n(o.totals),g(o.metricsError),m(o.functions),Ee(o.migrations),l(o.entries),u(o.logsError),v(o.auth),be(o.scheduler),R.current=!1},[e,y,M]);(0,c.useEffect)(()=>{F(_())},[_]);let V=(0,c.useRef)(0),I=(0,c.useRef)(null),Se=h(()=>{let o=Date.now()-V.current;if(o>=he){V.current=Date.now(),F(_());return}I.current??=setTimeout(()=>{I.current=null,V.current=Date.now(),F(_())},he-o)},"scheduleFanOut");(0,c.useEffect)(()=>()=>{I.current!==null&&clearTimeout(I.current)},[]);let{data:J,liveError:Te}=ne(E.getMetrics,{},{live:!0,shardKey:M});(0,c.useEffect)(()=>{J!==void 0&&Se()},[J]);let B=s.filter(o=>o.level==="error"),K=B.slice(0,De),L=Ke(i?.history),Y=(0,c.useMemo)(()=>{let o=f?.history??[];return{attempts:o.map(N=>N.attempts),failures:o.map(N=>N.failures)}},[f?.history]),Z=b.filter(o=>o.calls>0).toSorted((o,N)=>N.errors/N.calls-o.errors/o.calls||N.calls-o.calls).slice(0,Fe),$=$e(we),ye=i===null||i.requests===0?0:i.errors/i.requests,z=X(ye,pe,ge),ee=f===null?"ok":X(f.failureRate,je,Ue),te=x===null?"ok":Ve(x.backlog,Pe,Ge),C=Qe([z,ee,te,$.level]),O,q;return C==="crit"?(O=a("Critical"),q=a("One or more service levels are breached.")):C==="warn"?(O=a("Degraded"),q=a("Some service levels need attention.")):(O=a("All systems healthy"),q=a("All service levels are within target.")),(0,r.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxDEV)("div",{className:"flex items-center gap-3",children:[(0,r.jsxDEV)("span",{"aria-hidden":"true",className:w("flex size-10 shrink-0 items-center justify-center rounded-full",He[C]),children:(0,r.jsxDEV)("span",{className:w("size-3 rounded-full",xe[C])},void 0,!1)},void 0,!1),(0,r.jsxDEV)("div",{className:"grid leading-tight",children:[(0,r.jsxDEV)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O},void 0,!1),(0,r.jsxDEV)("span",{className:"text-[13px] text-muted-foreground",children:q},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[L.requests.length>=2&&(0,r.jsxDEV)(j,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:L.requests,testId:"hl-spark-requests"},void 0,!1),(0,r.jsxDEV)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(i?.requests??0).toString()},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"text-end",children:[(0,r.jsxDEV)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")},void 0,!1),(0,r.jsxDEV)("div",{className:w("text-lg font-semibold tabular-nums",Ne[z]),"data-testid":"hl-error-rate",children:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"},void 0,!1),(0,r.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)(fe,{},void 0,!1),(0,r.jsxDEV)(ce,{message:Te,prefix:"hl"},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),p!==null&&(0,r.jsxDEV)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:p},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsxDEV)(P,{chart:L.errors.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:L.errors,testId:"hl-spark-errors"},void 0,!1):void 0,label:a("Error rate"),level:z,testId:"hl-slo-errorrate",value:i===null?"\u2014":U(i.errors,i.requests)},void 0,!1),(0,r.jsxDEV)(P,{chart:Y.failures.length>=2?(0,r.jsxDEV)(j,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:Y.failures,testId:"hl-spark-auth"},void 0,!1):void 0,label:a("Auth failures"),level:ee,testId:"hl-slo-auth",value:f===null?"\u2014":U(f.failures,f.attempts)},void 0,!1),(0,r.jsxDEV)(P,{label:a("Scheduler backlog"),level:te,testId:"hl-slo-backlog",value:x===null?"\u2014":x.backlog.toString()},void 0,!1),(0,r.jsxDEV)(P,{label:a("Migrations"),level:$.level,testId:"hl-slo-migrations",value:ze($,a)},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,r.jsxDEV)(S,{className:"gap-0 py-0","data-testid":"hl-functions",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Functions by error rate")},void 0,!1)},void 0,!1),Z.length===0?(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:a("No function activity yet.")},void 0,!1):(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:Z.map(o=>(0,r.jsxDEV)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.path},void 0,!1),(0,r.jsxDEV)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsxDEV)("span",{className:"tabular-nums text-muted-foreground",children:a("{count} calls",{count:o.calls.toString()})},void 0,!1),(0,r.jsxDEV)(A,{variant:Be[X(o.errors/o.calls,pe,ge)],children:U(o.errors,o.calls)},void 0,!1)]},void 0,!0)]},o.path,!0))},void 0,!1)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Recent errors")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-error-count",variant:B.length>0?"destructive":"outline",children:B.length},void 0,!1)]},void 0,!0),d!==null&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:d},void 0,!1),d===null&&K.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:a("No recent errors.")},void 0,!1),K.length>0&&(0,r.jsxDEV)("ul",{className:"divide-y divide-border",children:K.map((o,N)=>(0,r.jsxDEV)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxDEV)("span",{className:"flex items-center gap-2",children:[(0,r.jsxDEV)("time",{className:"shrink-0 text-muted-foreground",children:oe(o.timestamp)},void 0,!1),o.functionPath!==void 0&&(0,r.jsxDEV)("span",{className:"truncate font-mono text-foreground",children:o.functionPath},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("span",{className:"text-destructive",children:o.message},void 0,!1)]},`${o.timestamp.toString()}-${N.toString()}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0),(0,r.jsxDEV)(S,{className:"gap-0 py-0",children:[(0,r.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")},void 0,!1),(0,r.jsxDEV)(A,{"data-testid":"hl-shard-count",variant:"outline",children:y.length},void 0,!1)]},void 0,!0),y.length>0&&(0,r.jsxDEV)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:y.map(o=>(0,r.jsxDEV)("li",{"data-testid":"hl-shard",children:(0,r.jsxDEV)(A,{variant:"secondary",children:o},void 0,!1)},o,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)},"HealthPanel");export{ht as HealthPanel};
@@ -1 +1 @@
1
- import{a as He}from"./chunk-YAECF5LW.js";import"./chunk-DWDILV2E.js";import{a as Ve}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as Ge}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as Re,b as $e,c as Oe,d as Y,e as q,f as T}from"./chunk-GTM65MVX.js";import{a as Pe}from"./chunk-VLXV72QE.js";import{R as Fe}from"./chunk-3CJW6NWG.js";import{c as H}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as G}from"./chunk-BOXSWNXZ.js";import{a as ue}from"./chunk-TAD43CG5.js";import{b as Le}from"./chunk-DVKPRFIJ.js";import{a as De,e as Be}from"./chunk-SEU5V7I6.js";import{b as ce}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as Je}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as z,e as me,f as fe,g as he,k as pe,n as ze}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as p,e as we,f as Ke,g as Ze,h as et}from"./chunk-RRCPZMC2.js";var P=we(Ze(),1);var D=we(Ke(),1);var t=we(et(),1);var tt=200,st=me(G.sendQueueMessage),at=me(G.replayQueueMessage),ot=me(G.clearQueueMessages),Ye=96,rt=p(r=>{if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"[unserializable]"}},"formatBody"),lt=p(r=>r.length>Ye?`${r.slice(0,Ye)}\u2026`:r,"truncate"),nt=p(r=>r==="error"?"destructive":r==="retry"?"outline":"secondary","outcomeVariant"),dt=p((r,e)=>e(r==="messages"?"Messages":r==="send"?"Send":"Declared"),"tabLabel"),it=p(r=>{let e=(0,P.c)(11),{loaded:s,queues:m}=r,l=z(),n;e[0]!==l?(n=l("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=l,e[1]=n):n=e[1];let o;e[2]!==n?(o=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n},void 0,!1),e[2]=n,e[3]=o):o=e[3];let a;e[4]!==s||e[5]!==m||e[6]!==l?(a=s&&m.length===0?(0,t.jsxDEV)(ue,{description:l("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:l("No queues defined")},void 0,!1):(0,t.jsxDEV)(De,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Be,{className:"px-0",children:(0,t.jsxDEV)(Re,{"data-testid":"queues-table",children:[(0,t.jsxDEV)($e,{children:(0,t.jsxDEV)(Y,{children:[(0,t.jsxDEV)(q,{children:l("Export")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Queue")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Mode")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Binding")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Oe,{children:m.map(ft)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[4]=s,e[5]=m,e[6]=l,e[7]=a):a=e[7];let h;return e[8]!==o||e[9]!==a?(h=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,a]},void 0,!0),e[8]=o,e[9]=a,e[10]=h):h=e[10],h},"QueuesDeclaredTab"),ct=p(r=>{let e=(0,P.c)(67),{message:s,onReplay:m,replayingId:l}=r,n=z(),o,a,h,c,y,g,x,d,u,f;if(e[0]!==s.attempts||e[1]!==s.body||e[2]!==s.deadLettered||e[3]!==s.exportName||e[4]!==s.id||e[5]!==s.messageId||e[6]!==s.outcome||e[7]!==s.queue||e[8]!==n){let w=rt(s.body);a=Y,g=`queues-message-${s.id}`;let R=s.exportName??s.queue;e[19]!==R?(x=(0,t.jsxDEV)(T,{className:"font-mono text-xs",children:R},void 0,!1),e[19]=R,e[20]=x):x=e[20],e[21]!==s.messageId?(d=(0,t.jsxDEV)(T,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:s.messageId,children:s.messageId},void 0,!1),e[21]=s.messageId,e[22]=d):d=e[22],e[23]!==s.attempts?(u=(0,t.jsxDEV)(T,{className:"font-mono text-xs tabular-nums",children:s.attempts},void 0,!1),e[23]=s.attempts,e[24]=u):u=e[24];let A=`queues-outcome-${s.id}`,Q;e[25]!==s.outcome?(Q=nt(s.outcome),e[25]=s.outcome,e[26]=Q):Q=e[26];let E;e[27]!==s.outcome||e[28]!==A||e[29]!==Q?(E=(0,t.jsxDEV)(ce,{"data-testid":A,variant:Q,children:s.outcome},void 0,!1),e[27]=s.outcome,e[28]=A,e[29]=Q,e[30]=E):E=e[30];let M;e[31]!==s.deadLettered||e[32]!==s.id||e[33]!==n?(M=s.deadLettered&&(0,t.jsxDEV)(ce,{"data-testid":`queues-dlq-${s.id}`,variant:"destructive",children:n("DLQ")},void 0,!1),e[31]=s.deadLettered,e[32]=s.id,e[33]=n,e[34]=M):M=e[34],e[35]!==E||e[36]!==M?(f=(0,t.jsxDEV)(T,{children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:[E,M]},void 0,!0)},void 0,!1),e[35]=E,e[36]=M,e[37]=f):f=e[37],o=T,h="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=w,y=lt(w),e[0]=s.attempts,e[1]=s.body,e[2]=s.deadLettered,e[3]=s.exportName,e[4]=s.id,e[5]=s.messageId,e[6]=s.outcome,e[7]=s.queue,e[8]=n,e[9]=o,e[10]=a,e[11]=h,e[12]=c,e[13]=y,e[14]=g,e[15]=x,e[16]=d,e[17]=u,e[18]=f}else o=e[9],a=e[10],h=e[11],c=e[12],y=e[13],g=e[14],x=e[15],d=e[16],u=e[17],f=e[18];let v;e[38]!==o||e[39]!==h||e[40]!==c||e[41]!==y?(v=(0,t.jsxDEV)(o,{className:h,title:c,children:y},void 0,!1),e[38]=o,e[39]=h,e[40]=c,e[41]=y,e[42]=v):v=e[42];let N;e[43]!==s.capturedAt?(N=ze(s.capturedAt,"\u2014"),e[43]=s.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=(0,t.jsxDEV)(T,{className:"text-xs text-muted-foreground tabular-nums",children:N},void 0,!1),e[45]=N,e[46]=b):b=e[46];let C=`queues-replay-${s.id}`,B=l!==null,_;e[47]!==s.id||e[48]!==l||e[49]!==n?(_=l===s.id?n("Replaying\u2026"):n("Replay"),e[47]=s.id,e[48]=l,e[49]=n,e[50]=_):_=e[50];let I;e[51]!==s.id||e[52]!==m||e[53]!==C||e[54]!==B||e[55]!==_?(I=(0,t.jsxDEV)(T,{children:(0,t.jsxDEV)(H,{"data-id":s.id,"data-testid":C,disabled:B,onClick:m,size:"xs",type:"button",variant:"outline",children:_},void 0,!1)},void 0,!1),e[51]=s.id,e[52]=m,e[53]=C,e[54]=B,e[55]=_,e[56]=I):I=e[56];let L;return e[57]!==a||e[58]!==b||e[59]!==I||e[60]!==g||e[61]!==x||e[62]!==d||e[63]!==u||e[64]!==f||e[65]!==v?(L=(0,t.jsxDEV)(a,{"data-testid":g,children:[x,d,u,f,v,b,I]},void 0,!0),e[57]=a,e[58]=b,e[59]=I,e[60]=g,e[61]=x,e[62]=d,e[63]=u,e[64]=f,e[65]=v,e[66]=L):L=e[66],L},"QueueLogRow"),ut=p(r=>{let e=(0,P.c)(26),{hasError:s,messages:m,onClear:l,onReplay:n,replayingId:o}=r,a=z(),h;e[0]!==a?(h=a("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=a,e[1]=h):h=e[1];let c;e[2]!==h?(c=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:h},void 0,!1),e[2]=h,e[3]=c):c=e[3];let y=m.length===0,g;e[4]!==a?(g=a("Clear log"),e[4]=a,e[5]=g):g=e[5];let x;e[6]!==l||e[7]!==y||e[8]!==g?(x=(0,t.jsxDEV)(H,{className:"ml-auto","data-testid":"queues-clear",disabled:y,onClick:l,size:"sm",type:"button",variant:"outline",children:g},void 0,!1),e[6]=l,e[7]=y,e[8]=g,e[9]=x):x=e[9];let d;e[10]!==m.length||e[11]!==a?(d=m.length>0&&(0,t.jsxDEV)(ce,{"data-testid":"queues-count",variant:"secondary",children:a("{count} messages",{count:m.length})},void 0,!1),e[10]=m.length,e[11]=a,e[12]=d):d=e[12];let u;e[13]!==c||e[14]!==x||e[15]!==d?(u=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[c,x,d]},void 0,!0),e[13]=c,e[14]=x,e[15]=d,e[16]=u):u=e[16];let f;e[17]!==s||e[18]!==m||e[19]!==n||e[20]!==o||e[21]!==a?(f=!s&&m.length===0?(0,t.jsxDEV)(ue,{description:a("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:a("No consumed messages yet.")},void 0,!1):(0,t.jsxDEV)(De,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Be,{className:"px-0",children:(0,t.jsxDEV)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxDEV)(Re,{"data-testid":"queues-messages-table",children:[(0,t.jsxDEV)($e,{children:(0,t.jsxDEV)(Y,{children:[(0,t.jsxDEV)(q,{children:a("Export")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Message")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Attempts")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Outcome")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Body")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Captured")},void 0,!1),(0,t.jsxDEV)(q,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Oe,{children:m.map(N=>(0,t.jsxDEV)(ct,{message:N,onReplay:n,replayingId:o},N.id,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)},void 0,!1),e[17]=s,e[18]=m,e[19]=n,e[20]=o,e[21]=a,e[22]=f):f=e[22];let v;return e[23]!==u||e[24]!==f?(v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[u,f]},void 0,!0),e[23]=u,e[24]=f,e[25]=v):v=e[25],v},"QueuesMessagesTab"),mt=p(r=>{let e=(0,P.c)(20),{batchMode:s,bodyText:m,delayText:l,onBatchModeChange:n,onBodyChange:o,onDelayChange:a,onSelectExport:h,onSend:c,queues:y,selectedExportName:g,sending:x}=r,d=z(),u;e[0]!==d?(u=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=u):u=e[1];let f;e[2]!==u?(f=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:u},void 0,!1),e[2]=u,e[3]=f):f=e[3];let v;e[4]!==s||e[5]!==m||e[6]!==l||e[7]!==n||e[8]!==o||e[9]!==a||e[10]!==h||e[11]!==c||e[12]!==y||e[13]!==g||e[14]!==x||e[15]!==d?(v=y.length===0?(0,t.jsxDEV)(ue,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)("select",{"aria-label":d("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:h,value:g,children:y.map(ht)},void 0,!1),(0,t.jsxDEV)(Fe,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:a,placeholder:d("Delay (s)"),type:"number",value:l},void 0,!1),(0,t.jsxDEV)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsxDEV)("input",{checked:s,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:n,type:"checkbox"},void 0,!1),d("Send as batch (JSON array)")]},void 0,!0),(0,t.jsxDEV)(H,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||g==="",onClick:c,type:"button",children:d(x?"Sending\u2026":"Send message")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(Pe,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:s?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:m},void 0,!1)]},void 0,!0),e[4]=s,e[5]=m,e[6]=l,e[7]=n,e[8]=o,e[9]=a,e[10]=h,e[11]=c,e[12]=y,e[13]=g,e[14]=x,e[15]=d,e[16]=v):v=e[16];let N;return e[17]!==f||e[18]!==v?(N=(0,t.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,v]},void 0,!0),e[17]=f,e[18]=v,e[19]=N):N=e[19],N},"QueuesSendTab"),wt=p(r=>{let e=(0,P.c)(74),{limit:s}=r,m=s??tt,l=Je(),n=z(),[o,a]=(0,D.useState)("declared"),[h,c]=(0,D.useState)(null),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:g,error:x,errorSource:d}=Le(G.listQueues,y),u;e[1]!==m?(u={limit:m},e[1]=m,e[2]=u):u=e[2];let{data:f,error:v,errorSource:N,refetch:b}=Le(G.getQueueMessages,u),C=Array.isArray(g?.queues)?[...g.queues].toSorted(pt):[],B;e[3]!==f?.entries?(B=f?.entries??[],e[3]=f?.entries,e[4]=B):B=e[4];let _=B,[I,L]=(0,D.useState)(""),[w,R]=(0,D.useState)(""),[A,Q]=(0,D.useState)(""),[E,M]=(0,D.useState)(!1),[ge,j]=(0,D.useState)(!1),[ve,W]=(0,D.useState)(null),$=C.some(i=>i.exportName===I)?I:C[0]?.exportName??"",ke=o==="messages"?v:x,je=o==="messages"?N:d,xe=ke??h,ye=ke===null?h:je,X;e[5]!==b?(X=p(()=>{b()},"t4"),e[5]=b,e[6]=X):X=e[6],Ve(X,o==="messages");let K;e[7]!==E||e[8]!==w||e[9]!==l||e[10]!==A||e[11]!==b||e[12]!==$||e[13]!==j||e[14]!==n?(K=p(async()=>{c(null);let i=$;if(i==="")return;let S=null,Me=w.trim();if(Me!=="")try{S=JSON.parse(Me)}catch{c(n("Body must be valid JSON."));return}let Ie,Ue=A.trim();if(Ue!==""){let V=Number(Ue);if(!Number.isFinite(V)||V<0){c(n("Delay must be a non-negative number of seconds."));return}Ie=V}if(E&&!Array.isArray(S)){c(n("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}j(!0);let Xe=E?{batch:S,delaySeconds:Ie,exportName:i}:{body:S,delaySeconds:Ie,exportName:i};try{await l.query(st,Xe,fe("")),b()}catch(V){c(he(V))}j(!1)},"t5"),e[7]=E,e[8]=w,e[9]=l,e[10]=A,e[11]=b,e[12]=$,e[13]=j,e[14]=n,e[15]=K):K=e[15];let be=K,Z;e[16]!==l||e[17]!==b||e[18]!==W?(Z=p(async i=>{c(null),W(i);try{await l.query(at,{id:i},fe("")),b()}catch(S){c(he(S))}W(null)},"t6"),e[16]=l,e[17]=b,e[18]=W,e[19]=Z):Z=e[19];let Ne=Z,ee;e[20]!==l||e[21]!==b?(ee=p(async()=>{c(null);try{await l.query(ot,{},fe("")),b()}catch(i){c(he(i))}},"t7"),e[20]=l,e[21]=b,e[22]=ee):ee=e[22];let Se=ee,te;e[23]===Symbol.for("react.memo_cache_sentinel")?(te=p(i=>{let S=i.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&a(S)},"t8"),e[23]=te):te=e[23];let We=te,se;e[24]!==L?(se=p(i=>{L(i.currentTarget.value)},"t9"),e[24]=L,e[25]=se):se=e[25];let Ee=se,ae;e[26]!==R?(ae=p(i=>{R(i.currentTarget.value)},"t10"),e[26]=R,e[27]=ae):ae=e[27];let qe=ae,oe;e[28]!==Q?(oe=p(i=>{Q(i.currentTarget.value)},"t11"),e[28]=Q,e[29]=oe):oe=e[29];let Te=oe,re;e[30]!==M?(re=p(i=>{M(i.currentTarget.checked)},"t12"),e[30]=M,e[31]=re):re=e[31];let Ce=re,le;e[32]!==be?(le=p(()=>{pe(be())},"t13"),e[32]=be,e[33]=le):le=e[33];let _e=le,ne;e[34]!==Ne?(ne=p(i=>{let{id:S}=i.currentTarget.dataset;S!==void 0&&pe(Ne(S))},"t14"),e[34]=Ne,e[35]=ne):ne=e[35];let Ae=ne,de;e[36]!==Se?(de=p(()=>{pe(Se())},"t15"),e[36]=Se,e[37]=de):de=e[37];let Qe=de,O;e[38]!==n||e[39]!==o?(O=(0,t.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsxDEV)(H,{"aria-selected":o===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:We,role:"tab",size:"sm",type:"button",variant:o===i?"secondary":"ghost",children:dt(i,n)},i,!1))},void 0,!1),e[38]=n,e[39]=o,e[40]=O):O=e[40];let k;e[41]!==xe||e[42]!==ye?(k=xe!==null&&(0,t.jsxDEV)(Ge,{error:ye,testId:"queues-error"},void 0,!1),e[41]=xe,e[42]=ye,e[43]=k):k=e[43];let U;e[44]!==C||e[45]!==g||e[46]!==o?(U=o==="declared"&&(0,t.jsxDEV)(it,{loaded:g!==void 0,queues:C},void 0,!1),e[44]=C,e[45]=g,e[46]=o,e[47]=U):U=e[47];let J;e[48]!==_||e[49]!==v||e[50]!==Qe||e[51]!==Ae||e[52]!==ve||e[53]!==o?(J=o==="messages"&&(0,t.jsxDEV)(ut,{hasError:v!==null,messages:_,onClear:Qe,onReplay:Ae,replayingId:ve},void 0,!1),e[48]=_,e[49]=v,e[50]=Qe,e[51]=Ae,e[52]=ve,e[53]=o,e[54]=J):J=e[54];let F;e[55]!==E||e[56]!==w||e[57]!==A||e[58]!==Ce||e[59]!==qe||e[60]!==Te||e[61]!==Ee||e[62]!==_e||e[63]!==C||e[64]!==$||e[65]!==ge||e[66]!==o?(F=o==="send"&&(0,t.jsxDEV)(mt,{batchMode:E,bodyText:w,delayText:A,onBatchModeChange:Ce,onBodyChange:qe,onDelayChange:Te,onSelectExport:Ee,onSend:_e,queues:C,selectedExportName:$,sending:ge},void 0,!1),e[55]=E,e[56]=w,e[57]=A,e[58]=Ce,e[59]=qe,e[60]=Te,e[61]=Ee,e[62]=_e,e[63]=C,e[64]=$,e[65]=ge,e[66]=o,e[67]=F):F=e[67];let ie;return e[68]!==O||e[69]!==k||e[70]!==U||e[71]!==J||e[72]!==F?(ie=(0,t.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[O,k,U,J,F]},void 0,!0),e[68]=O,e[69]=k,e[70]=U,e[71]=J,e[72]=F,e[73]=ie):ie=e[73],ie},"QueuesPanel");function ft(r){return(0,t.jsxDEV)(Y,{"data-testid":`queues-row-${r.exportName}`,children:[(0,t.jsxDEV)(T,{className:"font-mono text-xs",children:r.exportName},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.name},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.mode},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.binding},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.deadLetterQueue??"\u2014"},void 0,!1)]},r.exportName,!0)}p(ft,"_temp");function ht(r){return(0,t.jsxDEV)("option",{value:r.exportName,children:r.exportName},r.exportName,!1)}p(ht,"_temp2");function pt(r,e){return r.exportName.localeCompare(e.exportName)}p(pt,"_temp3");export{wt as default};
1
+ import{a as He}from"./chunk-YAECF5LW.js";import"./chunk-DWDILV2E.js";import{a as Ve}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as Ge}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as Re,b as $e,c as Oe,d as Y,e as q,f as T}from"./chunk-GTM65MVX.js";import{a as Pe}from"./chunk-VLXV72QE.js";import{R as Fe}from"./chunk-3CJW6NWG.js";import{c as H}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as G}from"./chunk-BOXSWNXZ.js";import{a as ue}from"./chunk-TAD43CG5.js";import{b as Le}from"./chunk-OIC7EJWI.js";import{a as De,e as Be}from"./chunk-SEU5V7I6.js";import{b as ce}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as Je}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as z,e as me,f as fe,g as he,k as pe,n as ze}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as p,e as we,f as Ke,g as Ze,h as et}from"./chunk-RRCPZMC2.js";var P=we(Ze(),1);var D=we(Ke(),1);var t=we(et(),1);var tt=200,st=me(G.sendQueueMessage),at=me(G.replayQueueMessage),ot=me(G.clearQueueMessages),Ye=96,rt=p(r=>{if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"[unserializable]"}},"formatBody"),lt=p(r=>r.length>Ye?`${r.slice(0,Ye)}\u2026`:r,"truncate"),nt=p(r=>r==="error"?"destructive":r==="retry"?"outline":"secondary","outcomeVariant"),dt=p((r,e)=>e(r==="messages"?"Messages":r==="send"?"Send":"Declared"),"tabLabel"),it=p(r=>{let e=(0,P.c)(11),{loaded:s,queues:m}=r,l=z(),n;e[0]!==l?(n=l("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=l,e[1]=n):n=e[1];let o;e[2]!==n?(o=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:n},void 0,!1),e[2]=n,e[3]=o):o=e[3];let a;e[4]!==s||e[5]!==m||e[6]!==l?(a=s&&m.length===0?(0,t.jsxDEV)(ue,{description:l("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:l("No queues defined")},void 0,!1):(0,t.jsxDEV)(De,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Be,{className:"px-0",children:(0,t.jsxDEV)(Re,{"data-testid":"queues-table",children:[(0,t.jsxDEV)($e,{children:(0,t.jsxDEV)(Y,{children:[(0,t.jsxDEV)(q,{children:l("Export")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Queue")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Mode")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Binding")},void 0,!1),(0,t.jsxDEV)(q,{children:l("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Oe,{children:m.map(ft)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[4]=s,e[5]=m,e[6]=l,e[7]=a):a=e[7];let h;return e[8]!==o||e[9]!==a?(h=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,a]},void 0,!0),e[8]=o,e[9]=a,e[10]=h):h=e[10],h},"QueuesDeclaredTab"),ct=p(r=>{let e=(0,P.c)(67),{message:s,onReplay:m,replayingId:l}=r,n=z(),o,a,h,c,y,g,x,d,u,f;if(e[0]!==s.attempts||e[1]!==s.body||e[2]!==s.deadLettered||e[3]!==s.exportName||e[4]!==s.id||e[5]!==s.messageId||e[6]!==s.outcome||e[7]!==s.queue||e[8]!==n){let w=rt(s.body);a=Y,g=`queues-message-${s.id}`;let R=s.exportName??s.queue;e[19]!==R?(x=(0,t.jsxDEV)(T,{className:"font-mono text-xs",children:R},void 0,!1),e[19]=R,e[20]=x):x=e[20],e[21]!==s.messageId?(d=(0,t.jsxDEV)(T,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:s.messageId,children:s.messageId},void 0,!1),e[21]=s.messageId,e[22]=d):d=e[22],e[23]!==s.attempts?(u=(0,t.jsxDEV)(T,{className:"font-mono text-xs tabular-nums",children:s.attempts},void 0,!1),e[23]=s.attempts,e[24]=u):u=e[24];let A=`queues-outcome-${s.id}`,Q;e[25]!==s.outcome?(Q=nt(s.outcome),e[25]=s.outcome,e[26]=Q):Q=e[26];let E;e[27]!==s.outcome||e[28]!==A||e[29]!==Q?(E=(0,t.jsxDEV)(ce,{"data-testid":A,variant:Q,children:s.outcome},void 0,!1),e[27]=s.outcome,e[28]=A,e[29]=Q,e[30]=E):E=e[30];let M;e[31]!==s.deadLettered||e[32]!==s.id||e[33]!==n?(M=s.deadLettered&&(0,t.jsxDEV)(ce,{"data-testid":`queues-dlq-${s.id}`,variant:"destructive",children:n("DLQ")},void 0,!1),e[31]=s.deadLettered,e[32]=s.id,e[33]=n,e[34]=M):M=e[34],e[35]!==E||e[36]!==M?(f=(0,t.jsxDEV)(T,{children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:[E,M]},void 0,!0)},void 0,!1),e[35]=E,e[36]=M,e[37]=f):f=e[37],o=T,h="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=w,y=lt(w),e[0]=s.attempts,e[1]=s.body,e[2]=s.deadLettered,e[3]=s.exportName,e[4]=s.id,e[5]=s.messageId,e[6]=s.outcome,e[7]=s.queue,e[8]=n,e[9]=o,e[10]=a,e[11]=h,e[12]=c,e[13]=y,e[14]=g,e[15]=x,e[16]=d,e[17]=u,e[18]=f}else o=e[9],a=e[10],h=e[11],c=e[12],y=e[13],g=e[14],x=e[15],d=e[16],u=e[17],f=e[18];let v;e[38]!==o||e[39]!==h||e[40]!==c||e[41]!==y?(v=(0,t.jsxDEV)(o,{className:h,title:c,children:y},void 0,!1),e[38]=o,e[39]=h,e[40]=c,e[41]=y,e[42]=v):v=e[42];let N;e[43]!==s.capturedAt?(N=ze(s.capturedAt,"\u2014"),e[43]=s.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=(0,t.jsxDEV)(T,{className:"text-xs text-muted-foreground tabular-nums",children:N},void 0,!1),e[45]=N,e[46]=b):b=e[46];let C=`queues-replay-${s.id}`,B=l!==null,_;e[47]!==s.id||e[48]!==l||e[49]!==n?(_=l===s.id?n("Replaying\u2026"):n("Replay"),e[47]=s.id,e[48]=l,e[49]=n,e[50]=_):_=e[50];let I;e[51]!==s.id||e[52]!==m||e[53]!==C||e[54]!==B||e[55]!==_?(I=(0,t.jsxDEV)(T,{children:(0,t.jsxDEV)(H,{"data-id":s.id,"data-testid":C,disabled:B,onClick:m,size:"xs",type:"button",variant:"outline",children:_},void 0,!1)},void 0,!1),e[51]=s.id,e[52]=m,e[53]=C,e[54]=B,e[55]=_,e[56]=I):I=e[56];let L;return e[57]!==a||e[58]!==b||e[59]!==I||e[60]!==g||e[61]!==x||e[62]!==d||e[63]!==u||e[64]!==f||e[65]!==v?(L=(0,t.jsxDEV)(a,{"data-testid":g,children:[x,d,u,f,v,b,I]},void 0,!0),e[57]=a,e[58]=b,e[59]=I,e[60]=g,e[61]=x,e[62]=d,e[63]=u,e[64]=f,e[65]=v,e[66]=L):L=e[66],L},"QueueLogRow"),ut=p(r=>{let e=(0,P.c)(26),{hasError:s,messages:m,onClear:l,onReplay:n,replayingId:o}=r,a=z(),h;e[0]!==a?(h=a("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=a,e[1]=h):h=e[1];let c;e[2]!==h?(c=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:h},void 0,!1),e[2]=h,e[3]=c):c=e[3];let y=m.length===0,g;e[4]!==a?(g=a("Clear log"),e[4]=a,e[5]=g):g=e[5];let x;e[6]!==l||e[7]!==y||e[8]!==g?(x=(0,t.jsxDEV)(H,{className:"ml-auto","data-testid":"queues-clear",disabled:y,onClick:l,size:"sm",type:"button",variant:"outline",children:g},void 0,!1),e[6]=l,e[7]=y,e[8]=g,e[9]=x):x=e[9];let d;e[10]!==m.length||e[11]!==a?(d=m.length>0&&(0,t.jsxDEV)(ce,{"data-testid":"queues-count",variant:"secondary",children:a("{count} messages",{count:m.length})},void 0,!1),e[10]=m.length,e[11]=a,e[12]=d):d=e[12];let u;e[13]!==c||e[14]!==x||e[15]!==d?(u=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[c,x,d]},void 0,!0),e[13]=c,e[14]=x,e[15]=d,e[16]=u):u=e[16];let f;e[17]!==s||e[18]!==m||e[19]!==n||e[20]!==o||e[21]!==a?(f=!s&&m.length===0?(0,t.jsxDEV)(ue,{description:a("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:a("No consumed messages yet.")},void 0,!1):(0,t.jsxDEV)(De,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Be,{className:"px-0",children:(0,t.jsxDEV)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxDEV)(Re,{"data-testid":"queues-messages-table",children:[(0,t.jsxDEV)($e,{children:(0,t.jsxDEV)(Y,{children:[(0,t.jsxDEV)(q,{children:a("Export")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Message")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Attempts")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Outcome")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Body")},void 0,!1),(0,t.jsxDEV)(q,{children:a("Captured")},void 0,!1),(0,t.jsxDEV)(q,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Oe,{children:m.map(N=>(0,t.jsxDEV)(ct,{message:N,onReplay:n,replayingId:o},N.id,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)},void 0,!1),e[17]=s,e[18]=m,e[19]=n,e[20]=o,e[21]=a,e[22]=f):f=e[22];let v;return e[23]!==u||e[24]!==f?(v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[u,f]},void 0,!0),e[23]=u,e[24]=f,e[25]=v):v=e[25],v},"QueuesMessagesTab"),mt=p(r=>{let e=(0,P.c)(20),{batchMode:s,bodyText:m,delayText:l,onBatchModeChange:n,onBodyChange:o,onDelayChange:a,onSelectExport:h,onSend:c,queues:y,selectedExportName:g,sending:x}=r,d=z(),u;e[0]!==d?(u=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=u):u=e[1];let f;e[2]!==u?(f=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:u},void 0,!1),e[2]=u,e[3]=f):f=e[3];let v;e[4]!==s||e[5]!==m||e[6]!==l||e[7]!==n||e[8]!==o||e[9]!==a||e[10]!==h||e[11]!==c||e[12]!==y||e[13]!==g||e[14]!==x||e[15]!==d?(v=y.length===0?(0,t.jsxDEV)(ue,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)("select",{"aria-label":d("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:h,value:g,children:y.map(ht)},void 0,!1),(0,t.jsxDEV)(Fe,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:a,placeholder:d("Delay (s)"),type:"number",value:l},void 0,!1),(0,t.jsxDEV)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsxDEV)("input",{checked:s,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:n,type:"checkbox"},void 0,!1),d("Send as batch (JSON array)")]},void 0,!0),(0,t.jsxDEV)(H,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||g==="",onClick:c,type:"button",children:d(x?"Sending\u2026":"Send message")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(Pe,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:s?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:m},void 0,!1)]},void 0,!0),e[4]=s,e[5]=m,e[6]=l,e[7]=n,e[8]=o,e[9]=a,e[10]=h,e[11]=c,e[12]=y,e[13]=g,e[14]=x,e[15]=d,e[16]=v):v=e[16];let N;return e[17]!==f||e[18]!==v?(N=(0,t.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,v]},void 0,!0),e[17]=f,e[18]=v,e[19]=N):N=e[19],N},"QueuesSendTab"),wt=p(r=>{let e=(0,P.c)(74),{limit:s}=r,m=s??tt,l=Je(),n=z(),[o,a]=(0,D.useState)("declared"),[h,c]=(0,D.useState)(null),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:g,error:x,errorSource:d}=Le(G.listQueues,y),u;e[1]!==m?(u={limit:m},e[1]=m,e[2]=u):u=e[2];let{data:f,error:v,errorSource:N,refetch:b}=Le(G.getQueueMessages,u),C=Array.isArray(g?.queues)?[...g.queues].toSorted(pt):[],B;e[3]!==f?.entries?(B=f?.entries??[],e[3]=f?.entries,e[4]=B):B=e[4];let _=B,[I,L]=(0,D.useState)(""),[w,R]=(0,D.useState)(""),[A,Q]=(0,D.useState)(""),[E,M]=(0,D.useState)(!1),[ge,j]=(0,D.useState)(!1),[ve,W]=(0,D.useState)(null),$=C.some(i=>i.exportName===I)?I:C[0]?.exportName??"",ke=o==="messages"?v:x,je=o==="messages"?N:d,xe=ke??h,ye=ke===null?h:je,X;e[5]!==b?(X=p(()=>{b()},"t4"),e[5]=b,e[6]=X):X=e[6],Ve(X,o==="messages");let K;e[7]!==E||e[8]!==w||e[9]!==l||e[10]!==A||e[11]!==b||e[12]!==$||e[13]!==j||e[14]!==n?(K=p(async()=>{c(null);let i=$;if(i==="")return;let S=null,Me=w.trim();if(Me!=="")try{S=JSON.parse(Me)}catch{c(n("Body must be valid JSON."));return}let Ie,Ue=A.trim();if(Ue!==""){let V=Number(Ue);if(!Number.isFinite(V)||V<0){c(n("Delay must be a non-negative number of seconds."));return}Ie=V}if(E&&!Array.isArray(S)){c(n("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}j(!0);let Xe=E?{batch:S,delaySeconds:Ie,exportName:i}:{body:S,delaySeconds:Ie,exportName:i};try{await l.query(st,Xe,fe("")),b()}catch(V){c(he(V))}j(!1)},"t5"),e[7]=E,e[8]=w,e[9]=l,e[10]=A,e[11]=b,e[12]=$,e[13]=j,e[14]=n,e[15]=K):K=e[15];let be=K,Z;e[16]!==l||e[17]!==b||e[18]!==W?(Z=p(async i=>{c(null),W(i);try{await l.query(at,{id:i},fe("")),b()}catch(S){c(he(S))}W(null)},"t6"),e[16]=l,e[17]=b,e[18]=W,e[19]=Z):Z=e[19];let Ne=Z,ee;e[20]!==l||e[21]!==b?(ee=p(async()=>{c(null);try{await l.query(ot,{},fe("")),b()}catch(i){c(he(i))}},"t7"),e[20]=l,e[21]=b,e[22]=ee):ee=e[22];let Se=ee,te;e[23]===Symbol.for("react.memo_cache_sentinel")?(te=p(i=>{let S=i.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&a(S)},"t8"),e[23]=te):te=e[23];let We=te,se;e[24]!==L?(se=p(i=>{L(i.currentTarget.value)},"t9"),e[24]=L,e[25]=se):se=e[25];let Ee=se,ae;e[26]!==R?(ae=p(i=>{R(i.currentTarget.value)},"t10"),e[26]=R,e[27]=ae):ae=e[27];let qe=ae,oe;e[28]!==Q?(oe=p(i=>{Q(i.currentTarget.value)},"t11"),e[28]=Q,e[29]=oe):oe=e[29];let Te=oe,re;e[30]!==M?(re=p(i=>{M(i.currentTarget.checked)},"t12"),e[30]=M,e[31]=re):re=e[31];let Ce=re,le;e[32]!==be?(le=p(()=>{pe(be())},"t13"),e[32]=be,e[33]=le):le=e[33];let _e=le,ne;e[34]!==Ne?(ne=p(i=>{let{id:S}=i.currentTarget.dataset;S!==void 0&&pe(Ne(S))},"t14"),e[34]=Ne,e[35]=ne):ne=e[35];let Ae=ne,de;e[36]!==Se?(de=p(()=>{pe(Se())},"t15"),e[36]=Se,e[37]=de):de=e[37];let Qe=de,O;e[38]!==n||e[39]!==o?(O=(0,t.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsxDEV)(H,{"aria-selected":o===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:We,role:"tab",size:"sm",type:"button",variant:o===i?"secondary":"ghost",children:dt(i,n)},i,!1))},void 0,!1),e[38]=n,e[39]=o,e[40]=O):O=e[40];let k;e[41]!==xe||e[42]!==ye?(k=xe!==null&&(0,t.jsxDEV)(Ge,{error:ye,testId:"queues-error"},void 0,!1),e[41]=xe,e[42]=ye,e[43]=k):k=e[43];let U;e[44]!==C||e[45]!==g||e[46]!==o?(U=o==="declared"&&(0,t.jsxDEV)(it,{loaded:g!==void 0,queues:C},void 0,!1),e[44]=C,e[45]=g,e[46]=o,e[47]=U):U=e[47];let J;e[48]!==_||e[49]!==v||e[50]!==Qe||e[51]!==Ae||e[52]!==ve||e[53]!==o?(J=o==="messages"&&(0,t.jsxDEV)(ut,{hasError:v!==null,messages:_,onClear:Qe,onReplay:Ae,replayingId:ve},void 0,!1),e[48]=_,e[49]=v,e[50]=Qe,e[51]=Ae,e[52]=ve,e[53]=o,e[54]=J):J=e[54];let F;e[55]!==E||e[56]!==w||e[57]!==A||e[58]!==Ce||e[59]!==qe||e[60]!==Te||e[61]!==Ee||e[62]!==_e||e[63]!==C||e[64]!==$||e[65]!==ge||e[66]!==o?(F=o==="send"&&(0,t.jsxDEV)(mt,{batchMode:E,bodyText:w,delayText:A,onBatchModeChange:Ce,onBodyChange:qe,onDelayChange:Te,onSelectExport:Ee,onSend:_e,queues:C,selectedExportName:$,sending:ge},void 0,!1),e[55]=E,e[56]=w,e[57]=A,e[58]=Ce,e[59]=qe,e[60]=Te,e[61]=Ee,e[62]=_e,e[63]=C,e[64]=$,e[65]=ge,e[66]=o,e[67]=F):F=e[67];let ie;return e[68]!==O||e[69]!==k||e[70]!==U||e[71]!==J||e[72]!==F?(ie=(0,t.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[O,k,U,J,F]},void 0,!0),e[68]=O,e[69]=k,e[70]=U,e[71]=J,e[72]=F,e[73]=ie):ie=e[73],ie},"QueuesPanel");function ft(r){return(0,t.jsxDEV)(Y,{"data-testid":`queues-row-${r.exportName}`,children:[(0,t.jsxDEV)(T,{className:"font-mono text-xs",children:r.exportName},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.name},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.mode},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.binding},void 0,!1),(0,t.jsxDEV)(T,{className:"font-mono text-xs text-muted-foreground",children:r.deadLetterQueue??"\u2014"},void 0,!1)]},r.exportName,!0)}p(ft,"_temp");function ht(r){return(0,t.jsxDEV)("option",{value:r.exportName,children:r.exportName},r.exportName,!1)}p(ht,"_temp2");function pt(r,e){return r.exportName.localeCompare(e.exportName)}p(pt,"_temp3");export{wt as default};
@@ -1,2 +1,2 @@
1
- import{a as q}from"./chunk-YAECF5LW.js";import"./chunk-DWDILV2E.js";import{a as T}from"./chunk-QAFAJBAW.js";import{a as H}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as D}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{R as F}from"./chunk-3CJW6NWG.js";import{c}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as p}from"./chunk-BOXSWNXZ.js";import{a as O}from"./chunk-TAD43CG5.js";import{b as B}from"./chunk-DVKPRFIJ.js";import{b as P}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as j}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as $,e as g,f as N,g as w,k as y,l as R,n as C}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as o,e as M,f as oe,h as se,j as z}from"./chunk-RRCPZMC2.js";var d=M(oe(),1);var e=M(se(),1);function de({className:r,orientation:m="horizontal",...a}){return(0,e.jsxDEV)(T,{"data-slot":"separator",orientation:m,className:z("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",r),...a},void 0,!1)}o(de,"Separator");var le=g(p.clearCapturedMail),ne=g(p.sendTestMail),ce=/https?:\/\/[^\s"'<>)]+/i,_=o(r=>r===void 0?void 0:ce.exec(r)?.[0],"firstLink"),me=o(r=>{if(r!==void 0)return _(r.html)??_(r.text)},"selectedLink"),ue=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,fe=o(r=>`${ue}${r}`,"withPreviewCsp"),v=o(r=>r===void 0?"":Array.isArray(r)?r.join(", "):r,"recipientText"),Ie=o(({limit:r=100})=>{let m=j(),a=$(),{data:S,error:k,errorSource:U,isLoading:V,refetch:x}=B(p.getCapturedMail,{limit:r}),[E,h]=(0,d.useState)(null),[A,L]=(0,d.useState)(null),[u,W]=(0,d.useState)("html"),[b,K]=(0,d.useState)(""),l=(0,d.useMemo)(()=>S?.entries??[],[S]),I=k??E,Q=k===null?E:U,G=o(async()=>{h(null);try{await m.query(le,{},N("")),L(null),x()}catch(t){h(w(t))}},"clearInbox"),J=o(async()=>{h(null);try{await m.query(ne,{},N("")),x()}catch(t){h(w(t))}},"sendTest");H(()=>{x()},!0);let X=o(()=>{y(G())},"onClear"),Y=o(()=>{y(J())},"onSendTest"),Z=o(t=>{K(t.currentTarget.value)},"onFilterChange"),ee=o(t=>{let{id:s}=t.currentTarget.dataset;s!==void 0&&L(s)},"onSelectMessage"),te=o(t=>{let s=t.currentTarget.dataset.tab;(s==="headers"||s==="html"||s==="text")&&W(s)},"onSelectTab"),ae=o(t=>a(t==="html"?"HTML":t==="text"?"Plain text":"Headers"),"tabTitle"),f=(0,d.useMemo)(()=>{let t=b.trim().toLowerCase();return t===""?l:l.filter(s=>`${s.subject} ${v(s.to)}`.toLowerCase().includes(t))},[l,b]),i=(0,d.useMemo)(()=>{if(f.length!==0)return f.find(t=>t.id===A)??f[0]},[f,A]),n=me(i),re=o(()=>{n!==void 0&&R(n)},"onCopyLink"),ie=o(()=>{n!==void 0&&"window"in globalThis&&globalThis.window.open(n,"_blank","noopener")},"onOpenLink");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(c,{"data-testid":"mail-send-test",onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Send test")},void 0,!1),(0,e.jsxDEV)(c,{"data-testid":"mail-clear",disabled:l.length===0,onClick:X,size:"sm",type:"button",variant:"outline",children:a("Clear inbox")},void 0,!1),l.length>0&&(0,e.jsxDEV)(P,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:a("{count} messages",{count:l.length})},void 0,!1)]},void 0,!0),I!==null&&(0,e.jsxDEV)(D,{error:Q,testId:"mail-error"},void 0,!1),I===null&&!V&&l.length===0&&(0,e.jsxDEV)(O,{description:a("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,e.jsxDEV)("path",{d:"M4 5h16v14H4z"},void 0,!1),(0,e.jsxDEV)("path",{d:"m4 6 8 6 8-6"},void 0,!1)]},void 0,!0),testId:"mail-empty",title:a("No captured email.")},void 0,!1),l.length>0&&(0,e.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,e.jsxDEV)(F,{"aria-label":a("Search messages"),"data-testid":"mail-search",onChange:Z,placeholder:a("Filter messages"),type:"search",value:b},void 0,!1),(0,e.jsxDEV)(q,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,e.jsxDEV)("ul",{className:"divide-y",children:f.map(t=>{let s=t.id===i?.id;return(0,e.jsxDEV)("li",{children:(0,e.jsxDEV)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${s?"bg-muted":""}`,"data-active":s,"data-id":t.id,"data-testid":"mail-list-item",onClick:ee,type:"button",children:[(0,e.jsxDEV)("span",{className:"w-full truncate font-medium",children:t.subject||a("(no subject)")},void 0,!1),(0,e.jsxDEV)("span",{className:"w-full truncate text-xs text-muted-foreground",children:v(t.to)},void 0,!1),(0,e.jsxDEV)("span",{className:"text-xs text-muted-foreground tabular-nums",children:C(t.capturedAt,"\u2014")},void 0,!1)]},void 0,!0)},t.id,!1)})},void 0,!1)},void 0,!1)]},void 0,!0),i!==void 0&&(0,e.jsxDEV)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxDEV)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||a("(no subject)")},void 0,!1),(0,e.jsxDEV)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,e.jsxDEV)("dt",{children:a("From")},void 0,!1),(0,e.jsxDEV)("dd",{className:"truncate font-mono",children:i.from??"\u2014"},void 0,!1),(0,e.jsxDEV)("dt",{children:a("To")},void 0,!1),(0,e.jsxDEV)("dd",{className:"truncate font-mono",children:v(i.to)},void 0,!1),i.cc!==void 0&&i.cc.length>0&&(0,e.jsxDEV)(e.Fragment,{children:[(0,e.jsxDEV)("dt",{children:a("Cc")},void 0,!1),(0,e.jsxDEV)("dd",{className:"truncate font-mono",children:v(i.cc)},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("dt",{children:a("Sent")},void 0,!1),(0,e.jsxDEV)("dd",{className:"tabular-nums",children:C(i.capturedAt,"\u2014")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,e.jsxDEV)(c,{"data-testid":"mail-copy-link",disabled:n===void 0,onClick:re,size:"sm",type:"button",variant:"outline",children:a("Copy link")},void 0,!1),(0,e.jsxDEV)(c,{"data-testid":"mail-open-link",disabled:n===void 0,onClick:ie,size:"sm",type:"button",variant:"outline",children:a("Open in new tab")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(de,{},void 0,!1),(0,e.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(t=>(0,e.jsxDEV)(c,{"aria-selected":u===t,"data-tab":t,"data-testid":`mail-tab-${t}`,onClick:te,role:"tab",size:"sm",type:"button",variant:u===t?"secondary":"ghost",children:ae(t)},t,!1))},void 0,!1),(0,e.jsxDEV)("div",{className:"min-h-[12rem]",children:[u==="html"&&(i.html===void 0?(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a("No HTML body.")},void 0,!1):(0,e.jsxDEV)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:fe(i.html),title:a("Email preview")},void 0,!1)),u==="text"&&(i.text===void 0?(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a("No text body.")},void 0,!1):(0,e.jsxDEV)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:i.text},void 0,!1)),u==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a("No headers.")},void 0,!1):(0,e.jsxDEV)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(i.headers).map(([t,s])=>`${t}: ${s}`).join(`
1
+ import{a as q}from"./chunk-YAECF5LW.js";import"./chunk-DWDILV2E.js";import{a as T}from"./chunk-QAFAJBAW.js";import{a as H}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as D}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{R as F}from"./chunk-3CJW6NWG.js";import{c}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as p}from"./chunk-BOXSWNXZ.js";import{a as O}from"./chunk-TAD43CG5.js";import{b as B}from"./chunk-OIC7EJWI.js";import{b as P}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as j}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as $,e as g,f as N,g as w,k as y,l as R,n as C}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as o,e as M,f as oe,h as se,j as z}from"./chunk-RRCPZMC2.js";var d=M(oe(),1);var e=M(se(),1);function de({className:r,orientation:m="horizontal",...a}){return(0,e.jsxDEV)(T,{"data-slot":"separator",orientation:m,className:z("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",r),...a},void 0,!1)}o(de,"Separator");var le=g(p.clearCapturedMail),ne=g(p.sendTestMail),ce=/https?:\/\/[^\s"'<>)]+/i,_=o(r=>r===void 0?void 0:ce.exec(r)?.[0],"firstLink"),me=o(r=>{if(r!==void 0)return _(r.html)??_(r.text)},"selectedLink"),ue=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,fe=o(r=>`${ue}${r}`,"withPreviewCsp"),v=o(r=>r===void 0?"":Array.isArray(r)?r.join(", "):r,"recipientText"),Ie=o(({limit:r=100})=>{let m=j(),a=$(),{data:S,error:k,errorSource:U,isLoading:V,refetch:x}=B(p.getCapturedMail,{limit:r}),[E,h]=(0,d.useState)(null),[A,L]=(0,d.useState)(null),[u,W]=(0,d.useState)("html"),[b,K]=(0,d.useState)(""),l=(0,d.useMemo)(()=>S?.entries??[],[S]),I=k??E,Q=k===null?E:U,G=o(async()=>{h(null);try{await m.query(le,{},N("")),L(null),x()}catch(t){h(w(t))}},"clearInbox"),J=o(async()=>{h(null);try{await m.query(ne,{},N("")),x()}catch(t){h(w(t))}},"sendTest");H(()=>{x()},!0);let X=o(()=>{y(G())},"onClear"),Y=o(()=>{y(J())},"onSendTest"),Z=o(t=>{K(t.currentTarget.value)},"onFilterChange"),ee=o(t=>{let{id:s}=t.currentTarget.dataset;s!==void 0&&L(s)},"onSelectMessage"),te=o(t=>{let s=t.currentTarget.dataset.tab;(s==="headers"||s==="html"||s==="text")&&W(s)},"onSelectTab"),ae=o(t=>a(t==="html"?"HTML":t==="text"?"Plain text":"Headers"),"tabTitle"),f=(0,d.useMemo)(()=>{let t=b.trim().toLowerCase();return t===""?l:l.filter(s=>`${s.subject} ${v(s.to)}`.toLowerCase().includes(t))},[l,b]),i=(0,d.useMemo)(()=>{if(f.length!==0)return f.find(t=>t.id===A)??f[0]},[f,A]),n=me(i),re=o(()=>{n!==void 0&&R(n)},"onCopyLink"),ie=o(()=>{n!==void 0&&"window"in globalThis&&globalThis.window.open(n,"_blank","noopener")},"onOpenLink");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(c,{"data-testid":"mail-send-test",onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Send test")},void 0,!1),(0,e.jsxDEV)(c,{"data-testid":"mail-clear",disabled:l.length===0,onClick:X,size:"sm",type:"button",variant:"outline",children:a("Clear inbox")},void 0,!1),l.length>0&&(0,e.jsxDEV)(P,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:a("{count} messages",{count:l.length})},void 0,!1)]},void 0,!0),I!==null&&(0,e.jsxDEV)(D,{error:Q,testId:"mail-error"},void 0,!1),I===null&&!V&&l.length===0&&(0,e.jsxDEV)(O,{description:a("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,e.jsxDEV)("path",{d:"M4 5h16v14H4z"},void 0,!1),(0,e.jsxDEV)("path",{d:"m4 6 8 6 8-6"},void 0,!1)]},void 0,!0),testId:"mail-empty",title:a("No captured email.")},void 0,!1),l.length>0&&(0,e.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,e.jsxDEV)(F,{"aria-label":a("Search messages"),"data-testid":"mail-search",onChange:Z,placeholder:a("Filter messages"),type:"search",value:b},void 0,!1),(0,e.jsxDEV)(q,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,e.jsxDEV)("ul",{className:"divide-y",children:f.map(t=>{let s=t.id===i?.id;return(0,e.jsxDEV)("li",{children:(0,e.jsxDEV)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${s?"bg-muted":""}`,"data-active":s,"data-id":t.id,"data-testid":"mail-list-item",onClick:ee,type:"button",children:[(0,e.jsxDEV)("span",{className:"w-full truncate font-medium",children:t.subject||a("(no subject)")},void 0,!1),(0,e.jsxDEV)("span",{className:"w-full truncate text-xs text-muted-foreground",children:v(t.to)},void 0,!1),(0,e.jsxDEV)("span",{className:"text-xs text-muted-foreground tabular-nums",children:C(t.capturedAt,"\u2014")},void 0,!1)]},void 0,!0)},t.id,!1)})},void 0,!1)},void 0,!1)]},void 0,!0),i!==void 0&&(0,e.jsxDEV)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxDEV)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||a("(no subject)")},void 0,!1),(0,e.jsxDEV)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,e.jsxDEV)("dt",{children:a("From")},void 0,!1),(0,e.jsxDEV)("dd",{className:"truncate font-mono",children:i.from??"\u2014"},void 0,!1),(0,e.jsxDEV)("dt",{children:a("To")},void 0,!1),(0,e.jsxDEV)("dd",{className:"truncate font-mono",children:v(i.to)},void 0,!1),i.cc!==void 0&&i.cc.length>0&&(0,e.jsxDEV)(e.Fragment,{children:[(0,e.jsxDEV)("dt",{children:a("Cc")},void 0,!1),(0,e.jsxDEV)("dd",{className:"truncate font-mono",children:v(i.cc)},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("dt",{children:a("Sent")},void 0,!1),(0,e.jsxDEV)("dd",{className:"tabular-nums",children:C(i.capturedAt,"\u2014")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,e.jsxDEV)(c,{"data-testid":"mail-copy-link",disabled:n===void 0,onClick:re,size:"sm",type:"button",variant:"outline",children:a("Copy link")},void 0,!1),(0,e.jsxDEV)(c,{"data-testid":"mail-open-link",disabled:n===void 0,onClick:ie,size:"sm",type:"button",variant:"outline",children:a("Open in new tab")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(de,{},void 0,!1),(0,e.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(t=>(0,e.jsxDEV)(c,{"aria-selected":u===t,"data-tab":t,"data-testid":`mail-tab-${t}`,onClick:te,role:"tab",size:"sm",type:"button",variant:u===t?"secondary":"ghost",children:ae(t)},t,!1))},void 0,!1),(0,e.jsxDEV)("div",{className:"min-h-[12rem]",children:[u==="html"&&(i.html===void 0?(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a("No HTML body.")},void 0,!1):(0,e.jsxDEV)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:fe(i.html),title:a("Email preview")},void 0,!1)),u==="text"&&(i.text===void 0?(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a("No text body.")},void 0,!1):(0,e.jsxDEV)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:i.text},void 0,!1)),u==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a("No headers.")},void 0,!1):(0,e.jsxDEV)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(i.headers).map(([t,s])=>`${t}: ${s}`).join(`
2
2
  `)},void 0,!1))]},void 0,!0)]},void 0,!0)]},void 0,!0)]},void 0,!0)},"MailPanel");export{Ie as MailPanel};
@@ -1 +1 @@
1
- import{b as $}from"./chunk-TQ36RWOP.js";import{a as M}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as P,b as Q,c as W,d as V,e as C,f as E}from"./chunk-GTM65MVX.js";import{a as j}from"./chunk-BOXSWNXZ.js";import{b as H}from"./chunk-DVKPRFIJ.js";import{a as K,e as O}from"./chunk-SEU5V7I6.js";import{b as F}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as B}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as U,e as L,f as G,g as J,h as X}from"./chunk-RRCPZMC2.js";var q=L(J(),1),te=L(G(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=U(a=>{let e=(0,q.c)(68),{initialShardKey:z}=a,t=B(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let R=z??"",T;e[1]!==R?(T={shardKey:R},e[1]=R,e[2]=T):T=e[2];let{data:k,error:d,errorSource:S,isLoading:A}=H(j.getSettings,N,T),D;e:{let s=k?.deploy;if(s===void 0){let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3],D=l;break e}let o;if(e[4]!==s.deploymentId||e[5]!==s.environment||e[6]!==s.versionTag||e[7]!==s.workerUrl||e[8]!==t){if(o=[],s.workerUrl!==void 0){let l;e[10]!==t?(l=t("URL"),e[10]=t,e[11]=l):l=e[11];let i;e[12]!==s.workerUrl||e[13]!==l?(i={label:l,value:s.workerUrl},e[12]=s.workerUrl,e[13]=l,e[14]=i):i=e[14],o.push(i)}if(s.environment!==void 0){let l;e[15]!==t?(l=t("Environment"),e[15]=t,e[16]=l):l=e[16];let i;e[17]!==s.environment||e[18]!==l?(i={label:l,value:s.environment},e[17]=s.environment,e[18]=l,e[19]=i):i=e[19],o.push(i)}if(s.deploymentId!==void 0){let l;e[20]!==t?(l=t("Deployment"),e[20]=t,e[21]=l):l=e[21];let i;e[22]!==s.deploymentId||e[23]!==l?(i={label:l,value:s.deploymentId},e[22]=s.deploymentId,e[23]=l,e[24]=i):i=e[24],o.push(i)}if(s.versionTag!==void 0){let l;e[25]!==t?(l=t("Version"),e[25]=t,e[26]=l):l=e[26];let i;e[27]!==s.versionTag||e[28]!==l?(i={label:l,value:s.versionTag},e[27]=s.versionTag,e[28]=l,e[29]=i):i=e[29],o.push(i)}e[4]=s.deploymentId,e[5]=s.environment,e[6]=s.versionTag,e[7]=s.workerUrl,e[8]=t,e[9]=o}else o=e[9];D=o}let w=D,_;e[30]!==k?.settings?(_=k?.settings??[],e[30]=k?.settings,e[31]=_):_=e[31];let n=_,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let f;e[34]!==m?(f=(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:$,rel:"noreferrer",target:"_blank",children:m},void 0,!1)},void 0,!1),e[34]=m,e[35]=f):f=e[35];let c;e[36]!==t?(c=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=c):c=e[37];let v;e[38]!==c?(v=(0,r.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:c},void 0,!1),e[38]=c,e[39]=v):v=e[39];let p;e[40]!==d||e[41]!==S?(p=d!==null&&(0,r.jsxDEV)(M,{error:S,testId:"set-error"},void 0,!1),e[40]=d,e[41]=S,e[42]=p):p=e[42];let u;e[43]!==w||e[44]!==t?(u=w.length>0&&(0,r.jsxDEV)(K,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{className:"py-3",children:(0,r.jsxDEV)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:w.map(Z)},void 0,!1)},void 0,!1)]},void 0,!0),e[43]=w,e[44]=t,e[45]=u):u=e[45];let h;e[46]!==t?(h=t("Environment & bindings"),e[46]=t,e[47]=h):h=e[47];let g;e[48]!==h?(g=(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h},void 0,!1)},void 0,!1),e[48]=h,e[49]=g):g=e[49];let x;e[50]!==d||e[51]!==A||e[52]!==n.length||e[53]!==t?(x=d===null&&!A&&n.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")},void 0,!1),e[50]=d,e[51]=A,e[52]=n.length,e[53]=t,e[54]=x):x=e[54];let b;e[55]!==n||e[56]!==t?(b=n.length>0&&(0,r.jsxDEV)(O,{className:"px-0 py-0",children:(0,r.jsxDEV)(P,{"data-testid":"set-table",children:[(0,r.jsxDEV)(Q,{children:(0,r.jsxDEV)(V,{children:[(0,r.jsxDEV)(C,{children:t("name")},void 0,!1),(0,r.jsxDEV)(C,{children:t("kind")},void 0,!1),(0,r.jsxDEV)(C,{children:t("value")},void 0,!1)]},void 0,!0)},void 0,!1),(0,r.jsxDEV)(W,{children:n.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1),e[55]=n,e[56]=t,e[57]=b):b=e[57];let y;e[58]!==g||e[59]!==x||e[60]!==b?(y=(0,r.jsxDEV)(K,{className:"py-0",children:[g,x,b]},void 0,!0),e[58]=g,e[59]=x,e[60]=b,e[61]=y):y=e[61];let I;return e[62]!==p||e[63]!==u||e[64]!==y||e[65]!==f||e[66]!==v?(I=(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[f,v,p,u,y]},void 0,!0),e[62]=p,e[63]=u,e[64]=y,e[65]=f,e[66]=v,e[67]=I):I=e[67],I},"SettingsPanel");function Z(a){return(0,r.jsxDEV)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsxDEV)("dt",{className:"text-muted-foreground",children:a.label},void 0,!1),(0,r.jsxDEV)("dd",{className:"truncate font-mono text-xs",title:a.value,children:a.value},void 0,!1)]},a.label,!0)}U(Z,"_temp");function ee(a){return(0,r.jsxDEV)(V,{"data-testid":"set-row",children:[(0,r.jsxDEV)(E,{className:"font-mono text-xs font-medium",children:a.name},void 0,!1),(0,r.jsxDEV)(E,{children:(0,r.jsxDEV)(F,{variant:Y[a.kind],children:a.bindingType??a.kind},void 0,!1)},void 0,!1),(0,r.jsxDEV)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:a.value??(0,r.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.name,!0)}U(ee,"_temp2");export{me as SettingsPanel};
1
+ import{b as $}from"./chunk-TQ36RWOP.js";import{a as M}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as P,b as Q,c as W,d as V,e as C,f as E}from"./chunk-GTM65MVX.js";import{a as j}from"./chunk-BOXSWNXZ.js";import{b as H}from"./chunk-OIC7EJWI.js";import{a as K,e as O}from"./chunk-SEU5V7I6.js";import{b as F}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as B}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as U,e as L,f as G,g as J,h as X}from"./chunk-RRCPZMC2.js";var q=L(J(),1),te=L(G(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=U(a=>{let e=(0,q.c)(68),{initialShardKey:z}=a,t=B(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let R=z??"",T;e[1]!==R?(T={shardKey:R},e[1]=R,e[2]=T):T=e[2];let{data:k,error:d,errorSource:S,isLoading:A}=H(j.getSettings,N,T),D;e:{let s=k?.deploy;if(s===void 0){let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3],D=l;break e}let o;if(e[4]!==s.deploymentId||e[5]!==s.environment||e[6]!==s.versionTag||e[7]!==s.workerUrl||e[8]!==t){if(o=[],s.workerUrl!==void 0){let l;e[10]!==t?(l=t("URL"),e[10]=t,e[11]=l):l=e[11];let i;e[12]!==s.workerUrl||e[13]!==l?(i={label:l,value:s.workerUrl},e[12]=s.workerUrl,e[13]=l,e[14]=i):i=e[14],o.push(i)}if(s.environment!==void 0){let l;e[15]!==t?(l=t("Environment"),e[15]=t,e[16]=l):l=e[16];let i;e[17]!==s.environment||e[18]!==l?(i={label:l,value:s.environment},e[17]=s.environment,e[18]=l,e[19]=i):i=e[19],o.push(i)}if(s.deploymentId!==void 0){let l;e[20]!==t?(l=t("Deployment"),e[20]=t,e[21]=l):l=e[21];let i;e[22]!==s.deploymentId||e[23]!==l?(i={label:l,value:s.deploymentId},e[22]=s.deploymentId,e[23]=l,e[24]=i):i=e[24],o.push(i)}if(s.versionTag!==void 0){let l;e[25]!==t?(l=t("Version"),e[25]=t,e[26]=l):l=e[26];let i;e[27]!==s.versionTag||e[28]!==l?(i={label:l,value:s.versionTag},e[27]=s.versionTag,e[28]=l,e[29]=i):i=e[29],o.push(i)}e[4]=s.deploymentId,e[5]=s.environment,e[6]=s.versionTag,e[7]=s.workerUrl,e[8]=t,e[9]=o}else o=e[9];D=o}let w=D,_;e[30]!==k?.settings?(_=k?.settings??[],e[30]=k?.settings,e[31]=_):_=e[31];let n=_,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let f;e[34]!==m?(f=(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:$,rel:"noreferrer",target:"_blank",children:m},void 0,!1)},void 0,!1),e[34]=m,e[35]=f):f=e[35];let c;e[36]!==t?(c=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=c):c=e[37];let v;e[38]!==c?(v=(0,r.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:c},void 0,!1),e[38]=c,e[39]=v):v=e[39];let p;e[40]!==d||e[41]!==S?(p=d!==null&&(0,r.jsxDEV)(M,{error:S,testId:"set-error"},void 0,!1),e[40]=d,e[41]=S,e[42]=p):p=e[42];let u;e[43]!==w||e[44]!==t?(u=w.length>0&&(0,r.jsxDEV)(K,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{className:"py-3",children:(0,r.jsxDEV)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:w.map(Z)},void 0,!1)},void 0,!1)]},void 0,!0),e[43]=w,e[44]=t,e[45]=u):u=e[45];let h;e[46]!==t?(h=t("Environment & bindings"),e[46]=t,e[47]=h):h=e[47];let g;e[48]!==h?(g=(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h},void 0,!1)},void 0,!1),e[48]=h,e[49]=g):g=e[49];let x;e[50]!==d||e[51]!==A||e[52]!==n.length||e[53]!==t?(x=d===null&&!A&&n.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")},void 0,!1),e[50]=d,e[51]=A,e[52]=n.length,e[53]=t,e[54]=x):x=e[54];let b;e[55]!==n||e[56]!==t?(b=n.length>0&&(0,r.jsxDEV)(O,{className:"px-0 py-0",children:(0,r.jsxDEV)(P,{"data-testid":"set-table",children:[(0,r.jsxDEV)(Q,{children:(0,r.jsxDEV)(V,{children:[(0,r.jsxDEV)(C,{children:t("name")},void 0,!1),(0,r.jsxDEV)(C,{children:t("kind")},void 0,!1),(0,r.jsxDEV)(C,{children:t("value")},void 0,!1)]},void 0,!0)},void 0,!1),(0,r.jsxDEV)(W,{children:n.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1),e[55]=n,e[56]=t,e[57]=b):b=e[57];let y;e[58]!==g||e[59]!==x||e[60]!==b?(y=(0,r.jsxDEV)(K,{className:"py-0",children:[g,x,b]},void 0,!0),e[58]=g,e[59]=x,e[60]=b,e[61]=y):y=e[61];let I;return e[62]!==p||e[63]!==u||e[64]!==y||e[65]!==f||e[66]!==v?(I=(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[f,v,p,u,y]},void 0,!0),e[62]=p,e[63]=u,e[64]=y,e[65]=f,e[66]=v,e[67]=I):I=e[67],I},"SettingsPanel");function Z(a){return(0,r.jsxDEV)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsxDEV)("dt",{className:"text-muted-foreground",children:a.label},void 0,!1),(0,r.jsxDEV)("dd",{className:"truncate font-mono text-xs",title:a.value,children:a.value},void 0,!1)]},a.label,!0)}U(Z,"_temp");function ee(a){return(0,r.jsxDEV)(V,{"data-testid":"set-row",children:[(0,r.jsxDEV)(E,{className:"font-mono text-xs font-medium",children:a.name},void 0,!1),(0,r.jsxDEV)(E,{children:(0,r.jsxDEV)(F,{variant:Y[a.kind],children:a.bindingType??a.kind},void 0,!1)},void 0,!1),(0,r.jsxDEV)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:a.value??(0,r.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.name,!0)}U(ee,"_temp2");export{me as SettingsPanel};
@@ -1 +1 @@
1
- import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{R as $}from"./chunk-3CJW6NWG.js";import{c as A}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-TAD43CG5.js";import{a as S,e as k}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as F}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as Q,g as E,j as K,k as I}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as f,e as C,f as Z,g as G,h as J}from"./chunk-RRCPZMC2.js";var z=C(G(),1);var s=C(Z(),1);var e=C(J(),1);var X=10,g=f(x=>{let l=(0,z.c)(7),{label:m,value:a}=x,r;l[0]!==m?(r=(0,e.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m},void 0,!1),l[0]=m,l[1]=r):r=l[1];let v=a??"\u2014",o;l[2]!==v?(o=(0,e.jsxDEV)("span",{className:"font-mono text-sm",children:v},void 0,!1),l[2]=v,l[3]=o):o=l[3];let u;return l[4]!==r||l[5]!==o?(u=(0,e.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[r,o]},void 0,!0),l[4]=r,l[5]=o,l[6]=u):u=l[6],u},"Detail"),oe=f(({loadIndexes:x,runQuery:l}={})=>{let m=F(),a=Q(),[r,v]=(0,s.useState)(null),[o,u]=(0,s.useState)(null),[b,L]=(0,s.useState)(null),[N,O]=(0,s.useState)(""),[h,y]=(0,s.useState)(null),[M,w]=(0,s.useState)(null),[j,D]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let t={cancelled:!1};return I((async()=>{try{let c=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(v(c),u(null),L(T=>T??c[0]?.name??null))}catch(c){t.cancelled||(v(null),u(E(c)))}})()),()=>{t.cancelled=!0}},[m,x]);let i=r?.find(t=>t.name===b)??null,P=f(t=>{L(t.currentTarget.dataset.index??null),y(null),w(null)},"onSelect"),R=f(t=>{O(t.target.value)},"onQueryTextChange"),U=f(async()=>{let t=N.trim();if(!(b===null||t==="")){D(!0),w(null);try{let c=await(l??(T=>m.queryVectorIndex(T)))({name:b,text:t,topK:X});y(c)}catch(c){y(null),w(E(c))}finally{D(!1)}}},"search"),W=f(()=>{I(U())},"onSearch");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[o!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:o},void 0,!1),r!==null&&r.length===0&&(0,e.jsxDEV)(H,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:a("No vector indexes.")},void 0,!1),r!==null&&r.length>0&&(0,e.jsxDEV)(S,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-table",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("name")},void 0,!1),(0,e.jsxDEV)(d,{children:a("table")},void 0,!1),(0,e.jsxDEV)(d,{children:a("dimensions")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metric")},void 0,!1),(0,e.jsxDEV)(d,{children:a("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:r.map(t=>(0,e.jsxDEV)(p,{className:t.name===b?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:P,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.table},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.dimensions??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{children:t.metric??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.vectorsCount??"\u2014"},void 0,!1)]},t.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsxDEV)(g,{label:a("field"),value:i.field},void 0,!1),(0,e.jsxDEV)(g,{label:a("dimensions"),value:i.dimensions},void 0,!1),(0,e.jsxDEV)(g,{label:a("metric"),value:i.metric},void 0,!1),(0,e.jsxDEV)(g,{label:a("vectors"),value:i.vectorsCount},void 0,!1)]},void 0,!0),i.metadata!==void 0&&i.metadata.length>0&&(0,e.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsxDEV)("span",{className:"font-mono",children:i.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)($,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:R,placeholder:a("Search by similarity\u2026"),value:N},void 0,!1),(0,e.jsxDEV)(A,{"data-testid":"vector-search",disabled:j||N.trim()==="",onClick:W,children:a(j?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),M!==null&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M},void 0,!1),h!==null&&h.length===0&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,e.jsxDEV)(S,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-matches",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("id")},void 0,!1),(0,e.jsxDEV)(d,{children:a("score")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.id},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.score.toFixed(4)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":K(t.metadata)},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser");export{oe as VectorBrowser};
1
+ import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{R as $}from"./chunk-3CJW6NWG.js";import{c as A}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-TAD43CG5.js";import{a as S,e as k}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as F}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as Q,g as E,j as K,k as I}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as f,e as C,f as Z,g as G,h as J}from"./chunk-RRCPZMC2.js";var z=C(G(),1);var s=C(Z(),1);var e=C(J(),1);var X=10,g=f(x=>{let l=(0,z.c)(7),{label:m,value:a}=x,r;l[0]!==m?(r=(0,e.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m},void 0,!1),l[0]=m,l[1]=r):r=l[1];let v=a??"\u2014",o;l[2]!==v?(o=(0,e.jsxDEV)("span",{className:"font-mono text-sm",children:v},void 0,!1),l[2]=v,l[3]=o):o=l[3];let u;return l[4]!==r||l[5]!==o?(u=(0,e.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[r,o]},void 0,!0),l[4]=r,l[5]=o,l[6]=u):u=l[6],u},"Detail"),oe=f(({loadIndexes:x,runQuery:l}={})=>{let m=F(),a=Q(),[r,v]=(0,s.useState)(null),[o,u]=(0,s.useState)(null),[b,L]=(0,s.useState)(null),[N,O]=(0,s.useState)(""),[h,y]=(0,s.useState)(null),[M,w]=(0,s.useState)(null),[j,D]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let t={cancelled:!1};return I((async()=>{try{let c=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(v(c),u(null),L(T=>T??c[0]?.name??null))}catch(c){t.cancelled||(v(null),u(E(c)))}})()),()=>{t.cancelled=!0}},[m,x]);let i=r?.find(t=>t.name===b)??null,P=f(t=>{L(t.currentTarget.dataset.index??null),y(null),w(null)},"onSelect"),R=f(t=>{O(t.target.value)},"onQueryTextChange"),U=f(async()=>{let t=N.trim();if(!(b===null||t==="")){D(!0),w(null);try{let c=await(l??(T=>m.queryVectorIndex(T)))({name:b,text:t,topK:X});y(c)}catch(c){y(null),w(E(c))}finally{D(!1)}}},"search"),W=f(()=>{I(U())},"onSearch");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[o!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:o},void 0,!1),r!==null&&r.length===0&&(0,e.jsxDEV)(H,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:a("No vector indexes.")},void 0,!1),r!==null&&r.length>0&&(0,e.jsxDEV)(S,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-table",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("name")},void 0,!1),(0,e.jsxDEV)(d,{children:a("table")},void 0,!1),(0,e.jsxDEV)(d,{children:a("dimensions")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metric")},void 0,!1),(0,e.jsxDEV)(d,{children:a("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:r.map(t=>(0,e.jsxDEV)(p,{className:t.name===b?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:P,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.table},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.dimensions??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{children:t.metric??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.vectorsCount??"\u2014"},void 0,!1)]},t.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsxDEV)(g,{label:a("field"),value:i.field},void 0,!1),(0,e.jsxDEV)(g,{label:a("dimensions"),value:i.dimensions},void 0,!1),(0,e.jsxDEV)(g,{label:a("metric"),value:i.metric},void 0,!1),(0,e.jsxDEV)(g,{label:a("vectors"),value:i.vectorsCount},void 0,!1)]},void 0,!0),i.metadata!==void 0&&i.metadata.length>0&&(0,e.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsxDEV)("span",{className:"font-mono",children:i.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)($,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:R,placeholder:a("Search by similarity\u2026"),value:N},void 0,!1),(0,e.jsxDEV)(A,{"data-testid":"vector-search",disabled:j||N.trim()==="",onClick:W,children:a(j?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),M!==null&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M},void 0,!1),h!==null&&h.length===0&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,e.jsxDEV)(S,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-matches",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("id")},void 0,!1),(0,e.jsxDEV)(d,{children:a("score")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.id},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.score.toFixed(4)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":K(t.metadata)},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser");export{oe as VectorBrowser};
@@ -0,0 +1 @@
1
+ import{a as we,b as Ke,c as je}from"./chunk-L7SK4ZZD.js";import{i as Ge,k as He}from"./chunk-4QHKBC77.js";import{D as Me,I as Se,K as Ve,L as De,M as Le,N as Oe,O as Te,P as Fe,Q as _e,a as $,b as Ie,c as Ne,e as F,f as Be}from"./chunk-3CJW6NWG.js";import{b as Ae}from"./chunk-UK64ZSUW.js";import{a as T,e as ce}from"./chunk-O3NAGRTR.js";import{a as ve,c as Re,d as Ee,g as de,i as Pe,j as W}from"./chunk-CKSHCYGC.js";import{a as vt}from"./chunk-3OA7PECS.js";import{a as i,d as Ct,e as k,f as O,g as yt,h as Rt,j as ye}from"./chunk-RRCPZMC2.js";var Je=k(yt(),1);var w={};Ct(w,{Indicator:()=>fe,Root:()=>ue});var u=k(O(),1);function Ue(t){if(!t)return null;for(let e of t.elements){let n=e.tagName;if(n==="BUTTON"||n==="INPUT"){let o=e;if(o.type==="submit")return o}}return null}i(Ue,"getDefaultFormSubmitter");var qe=k(O(),1);var le=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.indeterminate="data-indeterminate",t.disabled="data-disabled",t.readonly="data-readonly",t.required="data-required",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});function z(t){return qe.useMemo(()=>({checked(e){return t.indeterminate?{}:e?{[le.checked]:""}:{[le.unchecked]:""}},...$}),[t.indeterminate])}i(z,"useStateAttributesMapping");var We=k(O(),1);function $e(t,e,n,o=!0,a){let[f,p]=We.useState(),M=F(a?`${a}-label`:void 0),b=t??e??f;return T(()=>{let g=t||e||!o?void 0:Et(n.current,M);f!==g&&p(g)}),b}i($e,"useAriaLabelledBy");function Et(t,e){let n=Pt(t);if(n)return!n.id&&e&&(n.id=e),n.id||void 0}i(Et,"getAriaLabelledBy");function Pt(t){if(!t)return;let e=t.parentElement;if(e&&e.tagName==="LABEL")return e;let n=t.id;if(n){let a=t.nextElementSibling;if(a&&a.htmlFor===n)return a}let o=t.labels;return o&&o[0]}i(Pt,"findAssociatedLabel");var J=k(O(),1);var X=J.createContext(void 0);X.displayName="CheckboxRootContext";function ze(){let t=J.useContext(X);if(t===void 0)throw new Error("Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.");return t}i(ze,"useCheckboxRootContext");var _=k(vt(),1);var It="data-parent",ue=u.forwardRef(i(function(e,n){let{checked:o,className:a,defaultChecked:f=!1,"aria-labelledby":p,disabled:M=!1,form:b,id:g,indeterminate:S=!1,inputRef:Z,name:K,onCheckedChange:A,parent:m=!1,readOnly:R=!1,render:pe,required:E=!1,uncheckedValue:j,value:G,nativeButton:H=!1,style:Nt,...Xe}=e,{clearErrors:Ye}=Ne(),{disabled:Qe,name:Ze,setDirty:et,setFilled:ee,setFocused:me,setTouched:tt,state:he,validationMode:rt,validityData:nt,validation:ot}=Ie(),it=Me(),{labelId:at,controlId:st,registerControlId:P,getDescriptionProps:be}=Be(),s=_e(),V=s?.parent,D=V&&s.allValues,c=Qe||it.disabled||s?.disabled||M,I=Ze??K,d=G??I,ge=F(),dt=F(),x=st;D?x=m?dt:`${V.id}-${d}`:g&&(x=g);let te={};D&&(m?te=s.parent.getParentProps():d&&(te=s.parent.getChildProps(d)));let{checked:ke=o,indeterminate:ct=S,onCheckedChange:lt,...ut}=te,N=s?.value,xe=s?.setValue,Ce=s?.defaultValue,re=u.useRef(null),U=Re(()=>Symbol("checkbox-control")),ne=u.useRef(!1),{getButtonProps:ft,buttonRef:pt}=Ae({disabled:c,native:H}),B=s?.validation??ot,[l,mt]=Le({controlled:d&&N&&!m?N.includes(d):ke,default:d&&Ce&&!m?Ce.includes(d):f,name:"Checkbox",state:"checked"}),oe=D?!!ke:l,L=D&&ct||S;T(()=>{P!==de&&(ne.current=!0,P(U.current,x))},[x,P,U]),u.useEffect(()=>{let r=U.current;return()=>{!ne.current||P===de||(ne.current=!1,P(r,void 0))}},[P,U]),Oe(re,ge,l,void 0,!s&&!c,K);let C=u.useRef(null),ht=Ee(Z,C,B.inputRef,B.registerInput),bt=$e(p,at,C,!H,x??void 0);T(()=>{C.current&&(C.current.indeterminate=L,l&&ee(!0))},[l,L,ee]),je(l,()=>{s||(Ye(I),ee(l),et(l!==nt.initialValue),B.change(l))});let gt=ve({checked:l,disabled:c,form:b,name:m?void 0:I,id:H?void 0:x??void 0,required:E,ref:ht,style:I?Ke:we,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(r){if(r.nativeEvent.defaultPrevented)return;if(R){r.preventDefault();return}let h=r.currentTarget.checked,y=Fe(Te.none,r.nativeEvent);if(A?.(h,y),!y.isCanceled&&(lt?.(h,y),!y.isCanceled&&(mt(h),d&&N&&xe&&!m&&!D))){let v=h?[...N,d]:N.filter(q=>q!==d);xe(v,y)}},onFocus(){re.current?.focus()}},G!==void 0?{value:(s?l&&G:G)||""}:Pe,be,r=>B.getValidationProps(c,r));u.useEffect(()=>{if(!V||!d)return;let r=V.disabledStatesRef.current;return r.set(d,c),()=>{r.delete(d)}},[V,c,d]);let ie=u.useMemo(()=>({...he,checked:oe,disabled:c,readOnly:R,required:E,indeterminate:L}),[he,oe,c,R,E,L]),kt=z(ie),xt=W("span",e,{state:ie,ref:[pt,re,n,s?.registerControlRef],props:[{id:H?x??void 0:ge,role:"checkbox","aria-checked":L?"mixed":oe,"aria-readonly":R||void 0,"aria-required":E||void 0,"aria-labelledby":bt,[It]:m?"":void 0,onFocus(){c||me(!0)},onBlur(){let r=C.current;r&&(tt(!0),me(!1),rt==="onBlur"&&B.commit(s?N:r.checked))},onKeyDown(r){if(r.key!=="Enter"||(r.preventBaseUIHandler(),r.defaultPrevented))return;let h=C.current?.form??null,y=r.currentTarget,v=r.nativeEvent,q=r.preventDefault,ae=v.preventDefault,se=!1;r.preventDefault=()=>{se=!0,q.call(r)},v.preventDefault=()=>{se=!0,ae.call(v)},ae.call(v),ce(y).queueMicrotask(()=>{r.preventDefault=q,v.preventDefault=ae,se||Ue(h)?.click()})},onClick(r){if(R||c)return;r.preventDefault();let h=C.current;h&&h.dispatchEvent(new(ce(h)).PointerEvent("click",{bubbles:!0,shiftKey:r.shiftKey,ctrlKey:r.ctrlKey,altKey:r.altKey,metaKey:r.metaKey}))}},Xe,ut,ft,be,r=>B.getValidationProps(c,r)],stateAttributesMapping:kt});return(0,_.jsxs)(X.Provider,{value:ie,children:[xt,!l&&!s&&I&&!m&&j!==void 0&&(0,_.jsx)("input",{type:"hidden",form:b,name:I,value:j,disabled:c}),(0,_.jsx)("input",{...gt,suppressHydrationWarning:!0})]})},"CheckboxRoot"));ue.displayName="CheckboxRoot";var Y=k(O(),1);var fe=Y.forwardRef(i(function(e,n){let{render:o,className:a,style:f,keepMounted:p=!1,...M}=e,b=ze(),g=b.checked||b.indeterminate,{mounted:S,transitionStatus:Z,setMounted:K}=De(g),A=Y.useRef(null),m={...b,transitionStatus:Z};Ve({open:g,ref:A,onComplete(){g||K(!1)}});let pe={...z(b),...Se,...$},E=p||S,j=W("span",e,{ref:[n,A],state:m,stateAttributesMapping:pe,props:M});return E?j:null},"CheckboxIndicator"));fe.displayName="CheckboxIndicator";var Q=k(Rt(),1);function Sr(t){let e=(0,Je.c)(9),n,o;e[0]!==t?({className:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let a;e[3]!==n?(a=ye("peer relative flex size-4 shrink-0 items-center justify-center rounded-md border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",n),e[3]=n,e[4]=a):a=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(0,Q.jsxDEV)(w.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:(0,Q.jsxDEV)(He,{icon:Ge,strokeWidth:2},void 0,!1)},void 0,!1),e[5]=f):f=e[5];let p;return e[6]!==o||e[7]!==a?(p=(0,Q.jsxDEV)(w.Root,{"data-slot":"checkbox",className:a,...o,children:f},void 0,!1),e[6]=o,e[7]=a,e[8]=p):p=e[8],p}i(Sr,"Checkbox");export{Sr as a};
@@ -0,0 +1 @@
1
+ import{a as A}from"./chunk-OIC7EJWI.js";import{a as y,e as I}from"./chunk-SEU5V7I6.js";import{b as m}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as k}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as u,e as w,g as S,h as P}from"./chunk-RRCPZMC2.js";var N=w(S(),1);var a=w(P(),1);var z=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],b=u(e=>{if(e===void 0)return"\u2014";let l=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,o]of l)if(e>=t&&e%t===0)return`${String(e/t)}${o}`;return`${String(e)}s`},"formatDuration"),h=u(e=>{let l=(0,N.c)(8),{children:t,heading:o,testId:r}=e,i;l[0]!==o?(i=(0,a.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1)},void 0,!1),l[0]=o,l[1]=i):i=l[1];let s;l[2]!==t?(s=(0,a.jsxDEV)(I,{className:"p-3",children:t},void 0,!1),l[2]=t,l[3]=s):s=l[3];let c;return l[4]!==i||l[5]!==s||l[6]!==r?(c=(0,a.jsxDEV)(y,{className:"gap-0 py-0","data-testid":r,children:[i,s]},void 0,!0),l[4]=i,l[5]=s,l[6]=r,l[7]=c):c=l[7],c},"ConfigCard"),d=u(e=>{let l=(0,N.c)(7),{label:t,value:o}=e,r;l[0]!==t?(r=(0,a.jsxDEV)("span",{className:"text-sm",children:t},void 0,!1),l[0]=t,l[1]=r):r=l[1];let i;l[2]!==o?(i=(0,a.jsxDEV)("span",{className:"text-sm text-muted-foreground tabular-nums",children:o},void 0,!1),l[2]=o,l[3]=i):i=l[3];let s;return l[4]!==r||l[5]!==i?(s=(0,a.jsxDEV)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[r,i]},void 0,!0),l[4]=r,l[5]=i,l[6]=s):s=l[6],s},"KeyValue"),O=u(()=>{let e=(0,N.c)(20),l=k(),t=C(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-auth-config"],e[0]=o):o=e[0];let r;e[1]!==l?(r=u(()=>l.getAuthConfig(),"t1"),e[1]=l,e[2]=r):r=e[2];let{data:i,error:s}=A(o,r),c;e[3]!==t?(c=u(n=>(0,a.jsxDEV)(m,{variant:n?"success":"outline",children:t(n?"Enabled":"Disabled")},void 0,!1),"t2"),e[3]=t,e[4]=c):c=e[4];let f=c,g;e[5]!==s?(g=s!==null&&(0,a.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s},void 0,!1),e[5]=s,e[6]=g):g=e[6];let p;e[7]!==i||e[8]!==s||e[9]!==t?(p=s===null&&i===void 0&&(0,a.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")},void 0,!1),e[7]=i,e[8]=s,e[9]=t,e[10]=p):p=e[10];let v;e[11]!==i||e[12]!==s||e[13]!==f||e[14]!==t?(v=s===null&&i!==void 0&&(0,a.jsxDEV)(a.Fragment,{children:[(0,a.jsxDEV)(h,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsxDEV)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:z.map(n=>{let $=i.capabilities[n.key];return(0,a.jsxDEV)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${n.key}`,children:[(0,a.jsxDEV)("span",{className:"text-sm",children:t(n.label)},void 0,!1),f($)]},n.key,!0)})},void 0,!1)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Plugins"),testId:"auth-config-plugins",children:i.plugins.length===0?(0,a.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")},void 0,!1):(0,a.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:i.plugins.map(L)},void 0,!1)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Email & password"),value:f(i.emailAndPassword)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Social providers"),value:i.socialProviders.length===0?t("None"):(0,a.jsxDEV)("span",{className:"flex flex-wrap justify-end gap-1",children:i.socialProviders.map(j)},void 0,!1)},void 0,!1)]},void 0,!0)},void 0,!1),i.organization.enabled&&(0,a.jsxDEV)(h,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Teams"),value:f(i.organization.teams)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Custom roles"),value:f(i.organization.roles)},void 0,!1)]},void 0,!0)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Expires in"),value:b(i.session.expiresIn)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Refresh after"),value:b(i.session.updateAge)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Fresh window"),value:b(i.session.freshAge)},void 0,!1),(0,a.jsxDEV)(d,{label:t("Cookie cache"),value:f(i.session.cookieCache===!0)},void 0,!1)]},void 0,!0)},void 0,!1),(0,a.jsxDEV)(h,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxDEV)(d,{label:t("Status"),value:f(i.rateLimit.enabled)},void 0,!1),i.rateLimit.enabled&&(0,a.jsxDEV)(a.Fragment,{children:[(0,a.jsxDEV)(d,{label:t("Max requests"),value:i.rateLimit.max??"\u2014"},void 0,!1),(0,a.jsxDEV)(d,{label:t("Window"),value:b(i.rateLimit.window)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1),i.userFields.length>0&&(0,a.jsxDEV)(h,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsxDEV)("ul",{className:"flex flex-col gap-2",children:i.userFields.map(n=>(0,a.jsxDEV)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${n.name}`,children:[(0,a.jsxDEV)("span",{className:"flex flex-col",children:[(0,a.jsxDEV)("span",{className:"font-mono text-xs",children:n.name},void 0,!1),n.plugin!==void 0&&(0,a.jsxDEV)("span",{className:"text-[11px] text-muted-foreground",children:n.plugin},void 0,!1)]},void 0,!0),(0,a.jsxDEV)("span",{className:"flex items-center gap-1",children:[(0,a.jsxDEV)(m,{variant:"outline",children:n.type},void 0,!1),n.required&&(0,a.jsxDEV)(m,{variant:"secondary",children:t("required")},void 0,!1),n.unique&&(0,a.jsxDEV)(m,{variant:"secondary",children:t("unique")},void 0,!1)]},void 0,!0)]},n.name,!0))},void 0,!1)},void 0,!1),(0,a.jsxDEV)(y,{className:"gap-0 py-0",children:(0,a.jsxDEV)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")},void 0,!1)},void 0,!1)]},void 0,!0),e[11]=i,e[12]=s,e[13]=f,e[14]=t,e[15]=v):v=e[15];let x;return e[16]!==g||e[17]!==p||e[18]!==v?(x=(0,a.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,p,v]},void 0,!0),e[16]=g,e[17]=p,e[18]=v,e[19]=x):x=e[19],x},"AuthConfigPanel");function L(e){return(0,a.jsxDEV)(m,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e,!1)}u(L,"_temp");function j(e){return(0,a.jsxDEV)(m,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e,!1)}u(j,"_temp2");export{O as AuthConfigPanel};
@@ -1 +1 @@
1
- import{a as k,b as j}from"./chunk-KJJ3WM6H.js";import{a as D}from"./chunk-WXPWVBIY.js";import{a as O}from"./chunk-2K47A3P6.js";import{a as V}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as _,b as z,c as B,d as f,e as l,f as n}from"./chunk-GTM65MVX.js";import{a as M}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as L}from"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-BOXSWNXZ.js";import{a as I}from"./chunk-TAD43CG5.js";import{b as A}from"./chunk-DVKPRFIJ.js";import{a as y,e as E}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C,n as R}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as i,e as w,f as ee,h as te}from"./chunk-RRCPZMC2.js";var o=w(ee(),1);var e=w(te(),1);var K=80,ae=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>K?`${t.slice(0,K)}\u2026`:t},"formatDetail"),re=41,F=480,U=5,oe=i((s,t)=>k(s,d=>{t(d.height>0?d:{height:F,width:d.width})}),"observeViewportRect"),Se=i(({initialShardKey:s})=>{let t=C(),[d,G]=(0,o.useState)(s??""),[m,W]=(0,o.useState)(""),q=O(d.trim(),400),{data:v,error:p,errorSource:J,isLoading:P,liveError:Q}=A(H.getAuditLog,{},{live:!0,shardKey:q}),u=(0,o.useMemo)(()=>v?.entries??[],[v]),c=(0,o.useMemo)(()=>{let r=m.trim().toLowerCase();return r===""?u:u.filter(a=>a.op.toLowerCase().includes(r)||(a.table??"").toLowerCase().includes(r)||(a.id??"").toLowerCase().includes(r))},[u,m]),g=(0,o.useRef)(null),x=j({count:c.length,estimateSize:i(()=>re,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:F,width:800},observeElementRect:oe,overscan:8}),h=x.getVirtualItems(),X=x.getTotalSize(),S=h[0]?.start??0,b=X-(h.at(-1)?.end??0),Z={height:S},$={height:b},Y=i(r=>{W(r.target.value)},"onSearchChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(M,{onChange:G,testId:"au-shard-input",value:d},void 0,!1),(0,e.jsxDEV)(D,{message:Q,prefix:"au"},void 0,!1),(0,e.jsxDEV)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m},void 0,!1)]},void 0,!0),p!==null&&(0,e.jsxDEV)(V,{error:J,testId:"au-error"},void 0,!1),p===null&&!P&&c.length===0&&(0,e.jsxDEV)(I,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"},void 0,!1)},void 0,!1),testId:"au-empty",title:t("No audit entries.")},void 0,!1),c.length>0&&(0,e.jsxDEV)(y,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:g,children:(0,e.jsxDEV)(_,{"data-testid":"au-table",children:[(0,e.jsxDEV)(z,{children:(0,e.jsxDEV)(f,{children:[(0,e.jsxDEV)(l,{children:t("time")},void 0,!1),(0,e.jsxDEV)(l,{children:t("op")},void 0,!1),(0,e.jsxDEV)(l,{children:t("table")},void 0,!1),(0,e.jsxDEV)(l,{children:t("id")},void 0,!1),(0,e.jsxDEV)(l,{children:t("detail")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(B,{children:[S>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:Z},void 0,!1)},void 0,!1),h.map(r=>{let a=c[r.index],N=ae(a.detail);return(0,e.jsxDEV)(f,{"data-testid":"au-row",children:[(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:R(a.ts,"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:a.op},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"font-medium",children:a.table??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[20ch] truncate font-mono text-xs",children:a.id??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:N||void 0,children:N||(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.seq,!0)}),b>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:$},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AuditPanel");export{Se as AuditPanel};
1
+ import{a as k,b as j}from"./chunk-KJJ3WM6H.js";import{a as D}from"./chunk-WXPWVBIY.js";import{a as O}from"./chunk-2K47A3P6.js";import{a as V}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as _,b as z,c as B,d as f,e as l,f as n}from"./chunk-GTM65MVX.js";import{a as M}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as L}from"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-BOXSWNXZ.js";import{a as I}from"./chunk-TAD43CG5.js";import{b as A}from"./chunk-OIC7EJWI.js";import{a as y,e as E}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C,n as R}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as i,e as w,f as ee,h as te}from"./chunk-RRCPZMC2.js";var o=w(ee(),1);var e=w(te(),1);var K=80,ae=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>K?`${t.slice(0,K)}\u2026`:t},"formatDetail"),re=41,F=480,U=5,oe=i((s,t)=>k(s,d=>{t(d.height>0?d:{height:F,width:d.width})}),"observeViewportRect"),Se=i(({initialShardKey:s})=>{let t=C(),[d,G]=(0,o.useState)(s??""),[m,W]=(0,o.useState)(""),q=O(d.trim(),400),{data:v,error:p,errorSource:J,isLoading:P,liveError:Q}=A(H.getAuditLog,{},{live:!0,shardKey:q}),u=(0,o.useMemo)(()=>v?.entries??[],[v]),c=(0,o.useMemo)(()=>{let r=m.trim().toLowerCase();return r===""?u:u.filter(a=>a.op.toLowerCase().includes(r)||(a.table??"").toLowerCase().includes(r)||(a.id??"").toLowerCase().includes(r))},[u,m]),g=(0,o.useRef)(null),x=j({count:c.length,estimateSize:i(()=>re,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:F,width:800},observeElementRect:oe,overscan:8}),h=x.getVirtualItems(),X=x.getTotalSize(),S=h[0]?.start??0,b=X-(h.at(-1)?.end??0),Z={height:S},$={height:b},Y=i(r=>{W(r.target.value)},"onSearchChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(M,{onChange:G,testId:"au-shard-input",value:d},void 0,!1),(0,e.jsxDEV)(D,{message:Q,prefix:"au"},void 0,!1),(0,e.jsxDEV)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m},void 0,!1)]},void 0,!0),p!==null&&(0,e.jsxDEV)(V,{error:J,testId:"au-error"},void 0,!1),p===null&&!P&&c.length===0&&(0,e.jsxDEV)(I,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"},void 0,!1)},void 0,!1),testId:"au-empty",title:t("No audit entries.")},void 0,!1),c.length>0&&(0,e.jsxDEV)(y,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:g,children:(0,e.jsxDEV)(_,{"data-testid":"au-table",children:[(0,e.jsxDEV)(z,{children:(0,e.jsxDEV)(f,{children:[(0,e.jsxDEV)(l,{children:t("time")},void 0,!1),(0,e.jsxDEV)(l,{children:t("op")},void 0,!1),(0,e.jsxDEV)(l,{children:t("table")},void 0,!1),(0,e.jsxDEV)(l,{children:t("id")},void 0,!1),(0,e.jsxDEV)(l,{children:t("detail")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(B,{children:[S>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:Z},void 0,!1)},void 0,!1),h.map(r=>{let a=c[r.index],N=ae(a.detail);return(0,e.jsxDEV)(f,{"data-testid":"au-row",children:[(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:R(a.ts,"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:a.op},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"font-medium",children:a.table??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[20ch] truncate font-mono text-xs",children:a.id??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:N||void 0,children:N||(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.seq,!0)}),b>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:$},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AuditPanel");export{Se as AuditPanel};