@lunora/studio 1.0.0-alpha.225 → 1.0.0-alpha.226

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 (59) hide show
  1. package/dist/standalone/{chunk-7JR5NBZT.js → chunk-224DF7HD.js} +1 -1
  2. package/dist/standalone/{chunk-WSZOB3GK.js → chunk-2AGQJ3RT.js} +1 -1
  3. package/dist/standalone/{chunk-NMS7725B.js → chunk-2ZMIQJFC.js} +1 -1
  4. package/dist/standalone/{chunk-B5757NYK.js → chunk-37TUKSUI.js} +1 -1
  5. package/dist/standalone/{chunk-FJ33XGJ2.js → chunk-3KA25M2D.js} +1 -1
  6. package/dist/standalone/{chunk-XUH4K2HN.js → chunk-3WDNFRIY.js} +1 -1
  7. package/dist/standalone/{chunk-WH5TVSUG.js → chunk-56GQC4TY.js} +1 -1
  8. package/dist/standalone/{chunk-IOZMKJXM.js → chunk-5DXMAKEG.js} +1 -1
  9. package/dist/standalone/{chunk-FYTLD6ZB.js → chunk-5TBTVXMF.js} +1 -1
  10. package/dist/standalone/{chunk-T7TBRE7I.js → chunk-6CP4FGVV.js} +1 -1
  11. package/dist/standalone/{chunk-PGX7ADT3.js → chunk-6I6SDCXD.js} +1 -1
  12. package/dist/standalone/{chunk-VELEXXBI.js → chunk-6OQCFS5H.js} +1 -1
  13. package/dist/standalone/{chunk-VCJJ6V4Q.js → chunk-6QBEY5L3.js} +1 -1
  14. package/dist/standalone/{chunk-FZ5ZSUA2.js → chunk-6R3CL5GW.js} +1 -1
  15. package/dist/standalone/{chunk-JBFHGYJ7.js → chunk-AM3Q2SY4.js} +1 -1
  16. package/dist/standalone/{chunk-FFHEYNCC.js → chunk-AOSUYLNV.js} +1 -1
  17. package/dist/standalone/{chunk-NAABU3WM.js → chunk-BDNFSPL2.js} +1 -1
  18. package/dist/standalone/{chunk-43HEY5SJ.js → chunk-IKFXSK5G.js} +1 -1
  19. package/dist/standalone/{chunk-RHCY7FOG.js → chunk-INWZFRAK.js} +1 -1
  20. package/dist/standalone/{chunk-OQQ3KQUW.js → chunk-IU6UCL3Z.js} +1 -1
  21. package/dist/standalone/{chunk-MTPPT5DN.js → chunk-JH4ISCW2.js} +1 -1
  22. package/dist/standalone/{chunk-XEW4IUTU.js → chunk-JJGVOQY3.js} +1 -1
  23. package/dist/standalone/{chunk-LWS3QK2Z.js → chunk-JPQR4RYQ.js} +1 -1
  24. package/dist/standalone/{chunk-5ITJRE7T.js → chunk-JSVP2IDG.js} +1 -1
  25. package/dist/standalone/{chunk-IDGVZH7L.js → chunk-JYEDDOSG.js} +1 -1
  26. package/dist/standalone/{chunk-XBSC4FT4.js → chunk-JYP5EIUU.js} +1 -1
  27. package/dist/standalone/{chunk-6JJLA4DT.js → chunk-KCQSTV6F.js} +1 -1
  28. package/dist/standalone/{chunk-HSWCIY4E.js → chunk-KDBCB6FG.js} +1 -1
  29. package/dist/standalone/{chunk-N3N44LM3.js → chunk-KZW3DDZ5.js} +1 -1
  30. package/dist/standalone/{chunk-X4WJS7OY.js → chunk-LZZWCAZX.js} +1 -1
  31. package/dist/standalone/{chunk-AHIYIRQJ.js → chunk-MZP4J6RB.js} +1 -1
  32. package/dist/standalone/{chunk-RBESZ4U6.js → chunk-NXN6ZECT.js} +1 -1
  33. package/dist/standalone/{chunk-UKEPEJQE.js → chunk-OQWQT3II.js} +1 -1
  34. package/dist/standalone/{chunk-YU2KFHL7.js → chunk-OT2A56S3.js} +1 -1
  35. package/dist/standalone/{chunk-E34I2O2H.js → chunk-P5RFX2G3.js} +1 -1
  36. package/dist/standalone/{chunk-CCHE3AP7.js → chunk-P6ONKKHY.js} +1 -1
  37. package/dist/standalone/{chunk-CGWLZBB7.js → chunk-PITC2AP5.js} +1 -1
  38. package/dist/standalone/{chunk-J7PUQPIK.js → chunk-Q4WSPRIT.js} +1 -1
  39. package/dist/standalone/{chunk-CFZF73E5.js → chunk-QDAW2ZP3.js} +1 -1
  40. package/dist/standalone/chunk-RATPWNIM.js +9 -0
  41. package/dist/standalone/{chunk-4QWQLDFZ.js → chunk-RT6BD4RL.js} +1 -1
  42. package/dist/standalone/{chunk-YQ7E3R3D.js → chunk-RTCWTRPH.js} +1 -1
  43. package/dist/standalone/{chunk-46EQO6E7.js → chunk-S54AMHYS.js} +1 -1
  44. package/dist/standalone/{chunk-OGFGCB3X.js → chunk-SERBKIWI.js} +1 -1
  45. package/dist/standalone/{chunk-OYO24LYQ.js → chunk-TL5ZV6DR.js} +1 -1
  46. package/dist/standalone/{chunk-GC7R2JNV.js → chunk-TP7KHFWY.js} +1 -1
  47. package/dist/standalone/{chunk-7FZPPR6U.js → chunk-VNWWQQJR.js} +1 -1
  48. package/dist/standalone/{chunk-LGHZBMSX.js → chunk-W3A4SIKT.js} +1 -1
  49. package/dist/standalone/{chunk-EN3YBGYA.js → chunk-WGN2KDQO.js} +1 -1
  50. package/dist/standalone/{chunk-CGBR52EF.js → chunk-WTBOHRI6.js} +1 -1
  51. package/dist/standalone/{chunk-RWYC2UZQ.js → chunk-WWH4SBK2.js} +1 -1
  52. package/dist/standalone/{chunk-ZVJOW25X.js → chunk-XBVXA2OK.js} +1 -1
  53. package/dist/standalone/{chunk-SEQJ26SP.js → chunk-XD7F5ZP5.js} +1 -1
  54. package/dist/standalone/{chunk-6SG5Y2X3.js → chunk-XNWVQHXW.js} +1 -1
  55. package/dist/standalone/{chunk-SX43GWLQ.js → chunk-YD77YQGV.js} +1 -1
  56. package/dist/standalone/{chunk-CEWWYWDH.js → chunk-ZA3NKULE.js} +1 -1
  57. package/dist/standalone/studio.js +1 -1
  58. package/package.json +3 -3
  59. package/dist/standalone/chunk-PG7XHMUR.js +0 -9
@@ -1 +1 @@
1
- import{b as me}from"./chunk-QKZ2JCH3.js";import{a as $}from"./chunk-A2XTI2C3.js";import{a as ue}from"./chunk-Z5O2NQAV.js";import"./chunk-Y5PCZUGU.js";import"./chunk-5JDWLCSH.js";import"./chunk-EVTM6Q43.js";import{a as de}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{b as D}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import"./chunk-35DM4JJG.js";import{a as M}from"./chunk-4ZEL6BYL.js";import{c as ce}from"./chunk-FZ5ZSUA2.js";import{f as ne,g as oe}from"./chunk-PG7XHMUR.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as A}from"./chunk-WUWBZPUK.js";import{d as T,f as j,g as Q,h as W,p as _,t as ie}from"./chunk-PTZD7RUZ.js";import{a as h,d as I,e as Ee,f as ae,g as le,i as E}from"./chunk-YKXDMIHQ.js";var Y=I(ae(),1);var f=I(Ee(),1);var fe=I(ae(),1);var B=I(le(),1);var Me={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive",polling:"bg-warning"},pe=h(()=>{let t=(0,fe.c)(18),e=T(),a=oe(),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}case"polling":{let n;t[8]!==e?(n=e("Polling"),t[8]=e,t[9]=n):n=t[9],s=n;break e}default:s=a}let l=Me[a],c;t[10]!==l?(c=E("size-2 rounded-full",l),t[10]=l,t[11]=c):c=t[11];let i;t[12]!==c?(i=(0,B.jsx)("span",{"aria-hidden":"true",className:c}),t[12]=c,t[13]=i):i=t[13];let o;return t[14]!==a||t[15]!==i||t[16]!==s?(o=(0,B.jsxs)("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:[i,s]}),t[14]=a,t[15]=i,t[16]=s,t[17]=o):o=t[17],o},"T");var r=I(le(),1);var Ae={crit:"destructive",ok:"secondary",warn:"default"},U=h((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"P"),X=h((t,e,a)=>Number.isNaN(t)?"ok":t>=a?"crit":t>=e?"warn":"ok","Q"),xe=.01,ve=.05,je=h(t=>{let e=(0,Y.c)(36),{errorCount:a,logsError:s,topErrors:l,worstFunctions:c}=t,i=T(),o;e[0]!==i?(o=i("Functions by error rate"),e[0]=i,e[1]=o):o=e[1];let n;e[2]!==o?(n=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[2]=o,e[3]=n):n=e[3];let p;e[4]!==i||e[5]!==c?(p=c.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:c.map(w=>(0,r.jsxs)("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.jsx)("span",{className:"truncate font-mono text-foreground",children:w.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:w.calls.toString()})}),(0,r.jsx)(D,{variant:Ae[X(w.errors/w.calls,xe,ve)],children:U(w.errors,w.calls)})]})]},w.path))}),e[4]=i,e[5]=c,e[6]=p):p=e[6];let g;e[7]!==n||e[8]!==p?(g=(0,r.jsxs)(A,{className:"gap-0 py-0","data-testid":"hl-functions",children:[n,p]}),e[7]=n,e[8]=p,e[9]=g):g=e[9];let b;e[10]!==i?(b=i("Recent errors"),e[10]=i,e[11]=b):b=e[11];let d;e[12]!==b?(d=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:b}),e[12]=b,e[13]=d):d=e[13];let u=a>0?"destructive":"outline",x;e[14]!==a||e[15]!==u?(x=(0,r.jsx)(D,{"data-testid":"hl-error-count",variant:u,children:a}),e[14]=a,e[15]=u,e[16]=x):x=e[16];let v;e[17]!==d||e[18]!==x?(v=(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[d,x]}),e[17]=d,e[18]=x,e[19]=v):v=e[19];let k;e[20]!==s?(k=s!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:s}),e[20]=s,e[21]=k):k=e[21];let S;e[22]!==s||e[23]!==i||e[24]!==l.length?(S=s===null&&l.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=s,e[23]=i,e[24]=l.length,e[25]=S):S=e[25];let q;e[26]!==l?(q=l.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:l.map(Ce)}),e[26]=l,e[27]=q):q=e[27];let N;e[28]!==k||e[29]!==S||e[30]!==q||e[31]!==v?(N=(0,r.jsxs)(A,{className:"gap-0 py-0",children:[v,k,S,q]}),e[28]=k,e[29]=S,e[30]=q,e[31]=v,e[32]=N):N=e[32];let y;return e[33]!==N||e[34]!==g?(y=(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[g,N]}),e[33]=N,e[34]=g,e[35]=y):y=e[35],y},"ye");function Ce(t,e){return(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ie(t.timestamp)}),t.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}h(Ce,"Te");var he={completed:0,failed:2,in_progress:1},Ie=h(t=>{let e=0,a=0,s=0,l=0,c=!1,i=[];for(let{metrics:o}of t){if(o===null){l+=1;continue}s+=1,e+=o.requests,a+=o.errors,i.push(...o.history??[]),c||=o.historyTruncated===!0}return{errors:a,failed:l,history:i,historyTruncated:c,reachable:s,requests:e}},"Ae"),Te=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()]},"ke"),De=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 c=he[s.status]-he[l.status];(c>0||c===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"Re"),Pe=j(M.getAuthMetrics),Fe=j(M.getFunctionStats),Le=j(M.getLogs),Re=j(M.getMetrics),ze=j(M.migrationStatus),Oe=5,ge=2e3,_e=5,$e=.1,Be=.3,He=1,Ue=50,Ge=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","Pe"),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)}},"Ge"),Ve=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}},"Ve"),Je=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"),"Be"),be={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Qe={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},We=h(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Ke"),H=h(t=>{let e=(0,Y.c)(19),{chart:a,label:s,level:l,testId:c,value:i}=t,o=be[l],n;e[0]!==o?(n=E("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=n):n=e[1];let p;e[2]!==n?(p=(0,r.jsx)("span",{"aria-hidden":"true",className:n}),e[2]=n,e[3]=p):p=e[3];let g;e[4]!==s||e[5]!==p?(g=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[p,s]}),e[4]=s,e[5]=p,e[6]=g):g=e[6];let b=Ne[l],d;e[7]!==b?(d=E("truncate text-2xl font-semibold tabular-nums",b),e[7]=b,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==c||e[11]!==i?(u=(0,r.jsx)("span",{className:d,"data-testid":c,children:i}),e[9]=d,e[10]=c,e[11]=i,e[12]=u):u=e[12];let x;e[13]!==a||e[14]!==u?(x=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,a]}),e[13]=a,e[14]=u,e[15]=x):x=e[15];let v;return e[16]!==g||e[17]!==x?(v=(0,r.jsx)(A,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,x]})}),e[16]=g,e[17]=x,e[18]=v):v=e[18],v},"U"),Xe=h(async(t,e,a)=>{let s=await Promise.all(a.map(d=>{let u=Q(d);return Promise.allSettled([t.query(Re,{},u),t.query(Fe,{},u),t.query(ze,{},u)])})),l=Q(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,o,n]=await Promise.allSettled([t.query(Le,{},l),t.query(Pe,{},l),c]),p=s.map(([d,u,x])=>({functions:u.status==="fulfilled"?u.value.functions:[],metrics:d.status==="fulfilled"?d.value:null,migrations:x.status==="fulfilled"?x.value.migrations:[]})),g=Ie(p),b=s[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:Te(p.map(d=>d.functions)),logsError:i.status==="rejected"?W(i.reason):null,metricsError:g.reachable===0&&b?.status==="rejected"?W(b.reason):null,migrations:De(p.map(d=>d.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:g}},"$e"),Ye=h(t=>{let e=t?.history??[];return{attempts:e.map(a=>a.attempts),failures:e.map(a=>a.failures)}},"ze"),xt=h(({initialShardKey:t})=>{let e=ne(),a=T(),[s,l]=(0,f.useState)([]),[c,i]=(0,f.useState)(null),[o,n]=(0,f.useState)(null),[p,g]=(0,f.useState)(null),[b,d]=(0,f.useState)([]),[u,x]=(0,f.useState)(null),[v,k]=(0,f.useState)(null),[S,q]=(0,f.useState)([]),[N]=(0,f.useState)(de),y=(0,f.useRef)(!1),w=(0,f.useRef)(!0);(0,f.useEffect)(()=>(w.current=!0,()=>{w.current=!1}),[]);let P=t??"",F=(0,f.useCallback)(async()=>{if(y.current)return;y.current=!0;let m=await Xe(e,P,me(P,N));if(!w.current){y.current=!1;return}n(m.totals),g(m.metricsError),d(m.functions),q(m.migrations),l(m.entries),i(m.logsError),x(m.auth),k(m.scheduler),y.current=!1},[e,N,P]);(0,f.useEffect)(()=>{_(F())},[F]);let G=(0,f.useRef)(0),C=(0,f.useRef)(null),we=h(()=>{let m=Date.now()-G.current;if(m>=ge){G.current=Date.now(),_(F());return}C.current===null&&(C.current=setTimeout(()=>{C.current=null,G.current=Date.now(),_(F())},ge-m))},"ue");(0,f.useEffect)(()=>()=>{C.current!==null&&clearTimeout(C.current)},[]);let{data:Z,liveError:ye}=ce(M.getMetrics,{},{live:!0,shardKey:P});(0,f.useEffect)(()=>{Z!==void 0&&we()},[Z]);let ee=s.filter(m=>m.level==="error"),ke=ee.slice(0,Oe),L=Ke(o?.history),te=Ye(u),Se=b.filter(m=>m.calls>0).toSorted((m,J)=>J.errors/J.calls-m.errors/m.calls||J.calls-m.calls).slice(0,_e),K=Ve(S),qe=o===null||o.requests===0?0:o.errors/o.requests,V=X(qe,xe,ve),re=u===null?"ok":X(u.failureRate,$e,Be),se=v===null?"ok":Ge(v.backlog,He,Ue),R=We([V,re,se,K.level]),z,O;return R==="crit"?(z=a("Critical"),O=a("One or more service levels are breached.")):R==="warn"?(z=a("Degraded"),O=a("Some service levels need attention.")):(z=a("All systems healthy"),O=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(A,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:E("flex size-10 shrink-0 items-center justify-center rounded-full",Qe[R]),children:(0,r.jsx)("span",{className:E("size-3 rounded-full",be[R])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:z}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:O})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[L.requests.length>=2&&(0,r.jsx)($,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:L.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(o?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:E("text-lg font-semibold tabular-nums",Ne[V]),"data-testid":"hl-error-rate",children:o===null?"\u2014":U(o.errors,o.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(pe,{}),(0,r.jsx)(ue,{message:ye,prefix:"hl"})]})]})]}),p!==null&&(0,r.jsx)("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}),p===null&&o?.historyTruncated===!0&&(0,r.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:a("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(H,{chart:L.errors.length>=2?(0,r.jsx)($,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:L.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:V,testId:"hl-slo-errorrate",value:o===null?"\u2014":U(o.errors,o.requests)}),(0,r.jsx)(H,{chart:te.failures.length>=2?(0,r.jsx)($,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:te.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:re,testId:"hl-slo-auth",value:u===null?"\u2014":U(u.failures,u.attempts)}),(0,r.jsx)(H,{label:a("Scheduler backlog"),level:se,testId:"hl-slo-backlog",value:v===null?"\u2014":v.backlog.toString()}),(0,r.jsx)(H,{label:a("Migrations"),level:K.level,testId:"hl-slo-migrations",value:Je(K,a)})]}),(0,r.jsx)(je,{errorCount:ee.length,logsError:c,topErrors:ke,worstFunctions:Se}),(0,r.jsxs)(A,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")}),(0,r.jsx)(D,{"data-testid":"hl-shard-count",variant:"outline",children:N.length})]}),N.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:N.map(m=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(D,{variant:"secondary",children:m})},m))})]})]})},"ut");export{xt as HealthPanel};
1
+ import{b as me}from"./chunk-QKZ2JCH3.js";import{a as $}from"./chunk-A2XTI2C3.js";import{a as ue}from"./chunk-Z5O2NQAV.js";import"./chunk-Y5PCZUGU.js";import"./chunk-5JDWLCSH.js";import"./chunk-EVTM6Q43.js";import{a as de}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{b as D}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import"./chunk-35DM4JJG.js";import{a as M}from"./chunk-4ZEL6BYL.js";import{c as ce}from"./chunk-6R3CL5GW.js";import{f as ne,g as oe}from"./chunk-RATPWNIM.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as A}from"./chunk-WUWBZPUK.js";import{d as T,f as j,g as Q,h as W,p as _,t as ie}from"./chunk-PTZD7RUZ.js";import{a as h,d as I,e as Ee,f as ae,g as le,i as E}from"./chunk-YKXDMIHQ.js";var Y=I(ae(),1);var f=I(Ee(),1);var fe=I(ae(),1);var B=I(le(),1);var Me={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive",polling:"bg-warning"},pe=h(()=>{let t=(0,fe.c)(18),e=T(),a=oe(),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}case"polling":{let n;t[8]!==e?(n=e("Polling"),t[8]=e,t[9]=n):n=t[9],s=n;break e}default:s=a}let l=Me[a],c;t[10]!==l?(c=E("size-2 rounded-full",l),t[10]=l,t[11]=c):c=t[11];let i;t[12]!==c?(i=(0,B.jsx)("span",{"aria-hidden":"true",className:c}),t[12]=c,t[13]=i):i=t[13];let o;return t[14]!==a||t[15]!==i||t[16]!==s?(o=(0,B.jsxs)("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:[i,s]}),t[14]=a,t[15]=i,t[16]=s,t[17]=o):o=t[17],o},"T");var r=I(le(),1);var Ae={crit:"destructive",ok:"secondary",warn:"default"},U=h((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"P"),X=h((t,e,a)=>Number.isNaN(t)?"ok":t>=a?"crit":t>=e?"warn":"ok","Q"),xe=.01,ve=.05,je=h(t=>{let e=(0,Y.c)(36),{errorCount:a,logsError:s,topErrors:l,worstFunctions:c}=t,i=T(),o;e[0]!==i?(o=i("Functions by error rate"),e[0]=i,e[1]=o):o=e[1];let n;e[2]!==o?(n=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[2]=o,e[3]=n):n=e[3];let p;e[4]!==i||e[5]!==c?(p=c.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:c.map(w=>(0,r.jsxs)("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.jsx)("span",{className:"truncate font-mono text-foreground",children:w.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:w.calls.toString()})}),(0,r.jsx)(D,{variant:Ae[X(w.errors/w.calls,xe,ve)],children:U(w.errors,w.calls)})]})]},w.path))}),e[4]=i,e[5]=c,e[6]=p):p=e[6];let g;e[7]!==n||e[8]!==p?(g=(0,r.jsxs)(A,{className:"gap-0 py-0","data-testid":"hl-functions",children:[n,p]}),e[7]=n,e[8]=p,e[9]=g):g=e[9];let b;e[10]!==i?(b=i("Recent errors"),e[10]=i,e[11]=b):b=e[11];let d;e[12]!==b?(d=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:b}),e[12]=b,e[13]=d):d=e[13];let u=a>0?"destructive":"outline",x;e[14]!==a||e[15]!==u?(x=(0,r.jsx)(D,{"data-testid":"hl-error-count",variant:u,children:a}),e[14]=a,e[15]=u,e[16]=x):x=e[16];let v;e[17]!==d||e[18]!==x?(v=(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[d,x]}),e[17]=d,e[18]=x,e[19]=v):v=e[19];let k;e[20]!==s?(k=s!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:s}),e[20]=s,e[21]=k):k=e[21];let S;e[22]!==s||e[23]!==i||e[24]!==l.length?(S=s===null&&l.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=s,e[23]=i,e[24]=l.length,e[25]=S):S=e[25];let q;e[26]!==l?(q=l.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:l.map(Ce)}),e[26]=l,e[27]=q):q=e[27];let N;e[28]!==k||e[29]!==S||e[30]!==q||e[31]!==v?(N=(0,r.jsxs)(A,{className:"gap-0 py-0",children:[v,k,S,q]}),e[28]=k,e[29]=S,e[30]=q,e[31]=v,e[32]=N):N=e[32];let y;return e[33]!==N||e[34]!==g?(y=(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[g,N]}),e[33]=N,e[34]=g,e[35]=y):y=e[35],y},"ye");function Ce(t,e){return(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ie(t.timestamp)}),t.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}h(Ce,"Te");var he={completed:0,failed:2,in_progress:1},Ie=h(t=>{let e=0,a=0,s=0,l=0,c=!1,i=[];for(let{metrics:o}of t){if(o===null){l+=1;continue}s+=1,e+=o.requests,a+=o.errors,i.push(...o.history??[]),c||=o.historyTruncated===!0}return{errors:a,failed:l,history:i,historyTruncated:c,reachable:s,requests:e}},"Ae"),Te=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()]},"ke"),De=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 c=he[s.status]-he[l.status];(c>0||c===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"Re"),Pe=j(M.getAuthMetrics),Fe=j(M.getFunctionStats),Le=j(M.getLogs),Re=j(M.getMetrics),ze=j(M.migrationStatus),Oe=5,ge=2e3,_e=5,$e=.1,Be=.3,He=1,Ue=50,Ge=h((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","Pe"),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)}},"Ge"),Ve=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}},"Ve"),Je=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"),"Be"),be={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Qe={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},We=h(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Ke"),H=h(t=>{let e=(0,Y.c)(19),{chart:a,label:s,level:l,testId:c,value:i}=t,o=be[l],n;e[0]!==o?(n=E("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=n):n=e[1];let p;e[2]!==n?(p=(0,r.jsx)("span",{"aria-hidden":"true",className:n}),e[2]=n,e[3]=p):p=e[3];let g;e[4]!==s||e[5]!==p?(g=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[p,s]}),e[4]=s,e[5]=p,e[6]=g):g=e[6];let b=Ne[l],d;e[7]!==b?(d=E("truncate text-2xl font-semibold tabular-nums",b),e[7]=b,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==c||e[11]!==i?(u=(0,r.jsx)("span",{className:d,"data-testid":c,children:i}),e[9]=d,e[10]=c,e[11]=i,e[12]=u):u=e[12];let x;e[13]!==a||e[14]!==u?(x=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,a]}),e[13]=a,e[14]=u,e[15]=x):x=e[15];let v;return e[16]!==g||e[17]!==x?(v=(0,r.jsx)(A,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,x]})}),e[16]=g,e[17]=x,e[18]=v):v=e[18],v},"U"),Xe=h(async(t,e,a)=>{let s=await Promise.all(a.map(d=>{let u=Q(d);return Promise.allSettled([t.query(Re,{},u),t.query(Fe,{},u),t.query(ze,{},u)])})),l=Q(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,o,n]=await Promise.allSettled([t.query(Le,{},l),t.query(Pe,{},l),c]),p=s.map(([d,u,x])=>({functions:u.status==="fulfilled"?u.value.functions:[],metrics:d.status==="fulfilled"?d.value:null,migrations:x.status==="fulfilled"?x.value.migrations:[]})),g=Ie(p),b=s[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:Te(p.map(d=>d.functions)),logsError:i.status==="rejected"?W(i.reason):null,metricsError:g.reachable===0&&b?.status==="rejected"?W(b.reason):null,migrations:De(p.map(d=>d.migrations)),scheduler:n.status==="fulfilled"?n.value:null,totals:g}},"$e"),Ye=h(t=>{let e=t?.history??[];return{attempts:e.map(a=>a.attempts),failures:e.map(a=>a.failures)}},"ze"),xt=h(({initialShardKey:t})=>{let e=ne(),a=T(),[s,l]=(0,f.useState)([]),[c,i]=(0,f.useState)(null),[o,n]=(0,f.useState)(null),[p,g]=(0,f.useState)(null),[b,d]=(0,f.useState)([]),[u,x]=(0,f.useState)(null),[v,k]=(0,f.useState)(null),[S,q]=(0,f.useState)([]),[N]=(0,f.useState)(de),y=(0,f.useRef)(!1),w=(0,f.useRef)(!0);(0,f.useEffect)(()=>(w.current=!0,()=>{w.current=!1}),[]);let P=t??"",F=(0,f.useCallback)(async()=>{if(y.current)return;y.current=!0;let m=await Xe(e,P,me(P,N));if(!w.current){y.current=!1;return}n(m.totals),g(m.metricsError),d(m.functions),q(m.migrations),l(m.entries),i(m.logsError),x(m.auth),k(m.scheduler),y.current=!1},[e,N,P]);(0,f.useEffect)(()=>{_(F())},[F]);let G=(0,f.useRef)(0),C=(0,f.useRef)(null),we=h(()=>{let m=Date.now()-G.current;if(m>=ge){G.current=Date.now(),_(F());return}C.current===null&&(C.current=setTimeout(()=>{C.current=null,G.current=Date.now(),_(F())},ge-m))},"ue");(0,f.useEffect)(()=>()=>{C.current!==null&&clearTimeout(C.current)},[]);let{data:Z,liveError:ye}=ce(M.getMetrics,{},{live:!0,shardKey:P});(0,f.useEffect)(()=>{Z!==void 0&&we()},[Z]);let ee=s.filter(m=>m.level==="error"),ke=ee.slice(0,Oe),L=Ke(o?.history),te=Ye(u),Se=b.filter(m=>m.calls>0).toSorted((m,J)=>J.errors/J.calls-m.errors/m.calls||J.calls-m.calls).slice(0,_e),K=Ve(S),qe=o===null||o.requests===0?0:o.errors/o.requests,V=X(qe,xe,ve),re=u===null?"ok":X(u.failureRate,$e,Be),se=v===null?"ok":Ge(v.backlog,He,Ue),R=We([V,re,se,K.level]),z,O;return R==="crit"?(z=a("Critical"),O=a("One or more service levels are breached.")):R==="warn"?(z=a("Degraded"),O=a("Some service levels need attention.")):(z=a("All systems healthy"),O=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(A,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:E("flex size-10 shrink-0 items-center justify-center rounded-full",Qe[R]),children:(0,r.jsx)("span",{className:E("size-3 rounded-full",be[R])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:z}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:O})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[L.requests.length>=2&&(0,r.jsx)($,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:L.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(o?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:E("text-lg font-semibold tabular-nums",Ne[V]),"data-testid":"hl-error-rate",children:o===null?"\u2014":U(o.errors,o.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(pe,{}),(0,r.jsx)(ue,{message:ye,prefix:"hl"})]})]})]}),p!==null&&(0,r.jsx)("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}),p===null&&o?.historyTruncated===!0&&(0,r.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:a("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(H,{chart:L.errors.length>=2?(0,r.jsx)($,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:L.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:V,testId:"hl-slo-errorrate",value:o===null?"\u2014":U(o.errors,o.requests)}),(0,r.jsx)(H,{chart:te.failures.length>=2?(0,r.jsx)($,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:te.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:re,testId:"hl-slo-auth",value:u===null?"\u2014":U(u.failures,u.attempts)}),(0,r.jsx)(H,{label:a("Scheduler backlog"),level:se,testId:"hl-slo-backlog",value:v===null?"\u2014":v.backlog.toString()}),(0,r.jsx)(H,{label:a("Migrations"),level:K.level,testId:"hl-slo-migrations",value:Je(K,a)})]}),(0,r.jsx)(je,{errorCount:ee.length,logsError:c,topErrors:ke,worstFunctions:Se}),(0,r.jsxs)(A,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")}),(0,r.jsx)(D,{"data-testid":"hl-shard-count",variant:"outline",children:N.length})]}),N.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:N.map(m=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(D,{variant:"secondary",children:m})},m))})]})]})},"ut");export{xt as HealthPanel};
@@ -1,4 +1,4 @@
1
- import{a as fn,b as $e,e as Br,f as Gr}from"./chunk-AANB526D.js";import{a as Hr,b as bt,c as jr,d as pn}from"./chunk-EN3YBGYA.js";import{a as mn}from"./chunk-MXLAOCAN.js";import{b as dn}from"./chunk-CMA4PTV7.js";import{d as qr}from"./chunk-UYEZR3BI.js";import{a as un}from"./chunk-CSUROWL2.js";import"./chunk-RFNGDE33.js";import"./chunk-V3CZW3JB.js";import"./chunk-MU3P2FI7.js";import{a as mo,b as go,c as gn,d as Lr}from"./chunk-YOB2X3FZ.js";import{a as cn}from"./chunk-3FBLWUXD.js";import{a as Bt}from"./chunk-XZMOZFE6.js";import{a as co}from"./chunk-IMOHEGMV.js";import{a as an}from"./chunk-UXXDN6Z3.js";import{a as $r}from"./chunk-66UGPQVC.js";import{b as Mr,c as lo}from"./chunk-6DAD3RFX.js";import"./chunk-YPRQLCKF.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import{a as uo}from"./chunk-QKEJLVC5.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as io}from"./chunk-NFS7FTAR.js";import{a as Tr}from"./chunk-EJSI4PMU.js";import{a as Nr,b as Dr}from"./chunk-OGUKYRFM.js";import{c as vr,d as yr,e as Rr}from"./chunk-6D6Z2KXU.js";import{b as kr,c as Pr,f as so}from"./chunk-OKG3HWSJ.js";import{W as Ir}from"./chunk-PLHA3OWK.js";import{b as vi}from"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as rn}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as _e}from"./chunk-4ZEL6BYL.js";import{b as ro,c as dt}from"./chunk-FZ5ZSUA2.js";import{f as rt}from"./chunk-PG7XHMUR.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as ln}from"./chunk-FKVZRPV5.js";import{a as Ar,b as Or,c as Er,d as ao,e as Vr,f as zr}from"./chunk-HEAQVSNS.js";import{d as oe,f as Ve,g as ze,h as jt,m as oo,n as sn,o as Oe,p as re,t as Fr}from"./chunk-PTZD7RUZ.js";import{a as o,d as Re,e as ut,f as Ht,g as Lt,i as pt}from"./chunk-YKXDMIHQ.js";var Ua=Re(Ht(),1);var Ot=Re(ut(),1);var ht=Re(Ht(),1);var Y=Re(Lt(),1),Le=Re(ut(),1);function We(t){let e=(0,ht.c)(2),n=(0,Le.useRef)(t),l;return e[0]!==t?(l=o(()=>{n.current=t},"r"),e[0]=t,e[1]=l):l=e[1],(0,Le.useEffect)(l),n}o(We,"te");var yi=2166136261,Ri=16777619,Ii=o((t,e=yi)=>{let n=e;for(let l=0;l<t.length;l+=1)n^=t.charCodeAt(l),n=Math.imul(n,Ri);return(n>>>0).toString(16).padStart(8,"0")},"V"),Fi=/([a-z\d])([A-Z])/gu,Mi=/[\s_-]+/u,ki=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),Pi=o(t=>{let e=t.replaceAll(Fi,"$1 $2").split(Mi).map(l=>l.toLowerCase()).filter(l=>l.length>0),n=new Set(e);for(let l=0;l<e.length-1;l+=1){let r=e[l],s=e[l+1];r===void 0||s===void 0||(n.add(`${r}${s}`),n.add(`${r}_${s}`))}return[...n]},"ae"),Kr="\u2022\u2022\u2022",Yr=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:Ii(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):Kr}catch{return Kr}},"W"),Ur=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"z"),Ni=o(t=>{for(let e of Pi(t))if(ki.has(e))return!0;return!1},"ce"),Jr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&Ni(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"B"),Gt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:Yr(t,l)},"Ce"),bn=o((t,e)=>{if(!e.enabled||e.columns.size===0)return t;let n={...t};for(let[l,r]of e.columns)l in n&&(n[l]=Yr(n[l],r));return n},"ie"),hn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>bn(n,e)),"Fe"),Wr=o(t=>t==null?"\u2205":t===""?"(empty)":Oe(t),"P"),Di=o(t=>{let e=(0,ht.c)(32),{column:n,onFacetFilter:l,state:r}=t,s=oe(),a;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(a=o(w=>{let _=Number(w.currentTarget.dataset.index),S=r.result?.values[_];S!==void 0&&l(n,S.value)},"x"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=a):a=e[3];let c=a,u=`db-facet-${n}`,i;e[4]!==n?(i=(0,Y.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=i):i=e[5];let d;e[6]!==r.loading||e[7]!==r.result||e[8]!==s?(d=r.loading&&r.result===null&&(0,Y.jsx)("span",{className:"text-muted-foreground",children:s("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=s,e[9]=d):d=e[9];let m;e[10]!==r.error?(m=r.error!==null&&(0,Y.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=m):m=e[11];let g;e[12]!==r.result?.values?(g=r.result?.values??[],e[12]=r.result?.values,e[13]=g):g=e[13];let b;if(e[14]!==n||e[15]!==c||e[16]!==g){let w;e[18]!==n||e[19]!==c?(w=o((_,S)=>(0,Y.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":S,"data-testid":`db-facet-value-${n}`,onClick:c,type:"button",children:[(0,Y.jsx)("span",{className:"truncate",children:Wr(_.value)}),(0,Y.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},Wr(_.value)),"c"),e[18]=n,e[19]=c,e[20]=w):w=e[20],b=g.map(w),e[14]=n,e[15]=c,e[16]=g,e[17]=b}else b=e[17];let f;e[21]!==n||e[22]!==r.result||e[23]!==s?(f=r.result?.truncated===!0&&(0,Y.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:s("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=s,e[24]=f):f=e[24];let h;return e[25]!==u||e[26]!==i||e[27]!==d||e[28]!==m||e[29]!==b||e[30]!==f?(h=(0,Y.jsxs)("section",{className:"flex flex-col gap-1","data-testid":u,children:[i,d,m,b,f]}),e[25]=u,e[26]=i,e[27]=d,e[28]=m,e[29]=b,e[30]=f,e[31]=h):h=e[31],h},"ue"),wn=o(t=>{let e=(0,ht.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:s,onToggleFacet:a}=t,c=oe(),u;e[0]!==a?(u=o(v=>{let{column:M}=v.currentTarget.dataset;M!==void 0&&a(M)},"o"),e[0]=a,e[1]=u):u=e[1];let i=u,d;e[2]!==r?(d=o(v=>r.enabled&&r.columns.has(v),"a"),e[2]=r,e[3]=d):d=e[3];let m=d,g,b,f,h,w,_,S,y;if(e[4]!==n||e[5]!==l||e[6]!==m||e[7]!==c||e[8]!==i){y=Symbol.for("react.early_return_sentinel");e:{let v;e[17]!==m?(v=o(N=>!m(N),"y"),e[17]=m,e[18]=v):v=e[18];let M=n.filter(v),F;if(e[19]!==l||e[20]!==m?(F=Object.entries(l).filter(N=>{let[T]=N;return!m(T)}),e[19]=l,e[20]=m,e[21]=F):F=e[21],g=F,M.length===0){y=null;break e}_="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",S="db-facets",h="flex flex-col gap-1.5";let P;e[22]!==c?(P=c("Facets"),e[22]=c,e[23]=P):P=e[23],e[24]!==P?(w=(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:P}),e[24]=P,e[25]=w):w=e[25],b="flex flex-wrap gap-1";let k;e[26]!==l||e[27]!==i?(k=o(N=>(0,Y.jsx)("button",{"aria-pressed":N in l,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":N,"data-testid":`db-facet-toggle-${N}`,onClick:i,type:"button",children:N},N),"A"),e[26]=l,e[27]=i,e[28]=k):k=e[28],f=M.map(k)}e[4]=n,e[5]=l,e[6]=m,e[7]=c,e[8]=i,e[9]=g,e[10]=b,e[11]=f,e[12]=h,e[13]=w,e[14]=_,e[15]=S,e[16]=y}else g=e[9],b=e[10],f=e[11],h=e[12],w=e[13],_=e[14],S=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let I;e[29]!==b||e[30]!==f?(I=(0,Y.jsx)("div",{className:b,children:f}),e[29]=b,e[30]=f,e[31]=I):I=e[31];let C;e[32]!==I||e[33]!==h||e[34]!==w?(C=(0,Y.jsxs)("div",{className:h,children:[w,I]}),e[32]=I,e[33]=h,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==s||e[37]!==g?(R=g.map(v=>{let[M,F]=v;return(0,Y.jsx)(Di,{column:M,onFacetFilter:s,state:F},M)}),e[36]=s,e[37]=g,e[38]=R):R=e[38];let x;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==S?(x=(0,Y.jsxs)("aside",{className:_,"data-testid":S,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=S,e[43]=x):x=e[43],x},"_e"),xn=o(()=>{let[t,e]=(0,Le.useState)({}),n=We(t),l=(0,Le.useRef)({}),r=o(async(s,a)=>{let c=(l.current[s]??0)+1;l.current[s]=c,e(u=>s in u?{...u,[s]:{error:null,loading:!0,result:u[s]?.result??null}}:u);try{let u=await a(s);if(l.current[s]!==c)return;e(i=>s in i?{...i,[s]:{error:null,loading:!1,result:u}}:i)}catch(u){if(l.current[s]!==c)return;e(i=>s in i?{...i,[s]:{error:jt(u),loading:!1,result:null}}:i)}},"n");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(s=>{for(let a of Object.keys(n.current))re(r(a,s))},"refetchFacets"),toggleFacet:o((s,a)=>{if(s in n.current){e(c=>Object.fromEntries(Object.entries(c).filter(([u])=>u!==s)));return}e(c=>({...c,[s]:{error:null,loading:!0,result:null}})),a!==null&&re(r(s,a))},"toggleFacet")}},"Me"),Ti=[],Ai=o(()=>{let t=(0,ht.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=dt(_e.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:Ti},"fe"),Sn=o(t=>{let e=(0,ht.c)(16),{columns:n,selectedTable:l}=t,r=Ai(),[s,a]=(0,Le.useState)(!0),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o(()=>{a(Oi)},"g"),e[0]=c):c=e[0];let u=c,i;if(e[1]!==n||e[2]!==r||e[3]!==l){let h=Ur(r,l??"");i=Jr(h,n),e[1]=n,e[2]=r,e[3]=l,e[4]=i}else i=e[4];let d=i,m;e[5]!==s||e[6]!==r?(m=o((h,w)=>({columns:Jr(Ur(r,h),w),enabled:s}),"l"),e[5]=s,e[6]=r,e[7]=m):m=e[7];let g=m,b;e[8]!==d||e[9]!==s?(b={columns:d,enabled:s},e[8]=d,e[9]=s,e[10]=b):b=e[10];let f;return e[11]!==d||e[12]!==s||e[13]!==g||e[14]!==b?(f={maskColumns:d,maskOn:s,maskView:b,maskViewFor:g,onToggleMask:u},e[11]=d,e[12]=s,e[13]=g,e[14]=b,e[15]=f):f=e[15],f},"$e");function Oi(t){return!t}o(Oi,"me");var Qr=34,Xr=600,Ei=o(t=>{let e=(0,ht.c)(21),{item:n,onSelect:l,prefix:r,selected:s,start:a}=t,c;e[0]!==n.name||e[1]!==l?(c=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=c):c=e[2];let u=c,i=`translateY(${String(a)}px)`,d;e[3]!==i?(d={insetInline:0,position:"absolute",top:0,transform:i},e[3]=i,e[4]=d):d=e[4];let m=d,g=s?"bg-accent font-medium text-accent-foreground":"text-foreground",b;e[5]!==g?(b=pt("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",g),e[5]=g,e[6]=b):b=e[6];let f=`${r}-table-${n.name}`,h;e[7]!==n.name?(h=(0,Y.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=h):h=e[8];let w;e[9]!==n.rowCount?(w=(0,Y.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=w):w=e[10];let _;e[11]!==u||e[12]!==s||e[13]!==b||e[14]!==f||e[15]!==h||e[16]!==w?(_=(0,Y.jsxs)("button",{"aria-pressed":s,className:b,"data-testid":f,onClick:u,type:"button",children:[h,w]}),e[11]=u,e[12]=s,e[13]=b,e[14]=f,e[15]=h,e[16]=w,e[17]=_):_=e[17];let S;return e[18]!==m||e[19]!==_?(S=(0,Y.jsx)("li",{style:m,children:_}),e[18]=m,e[19]=_,e[20]=S):S=e[20],S},"ge"),_n=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:s,tables:a})=>{let c=oe(),[u,i]=(0,Le.useState)(""),d=(0,Le.useRef)(null),m=o(h=>{i(h.target.value)},"l"),g=(0,Le.useMemo)(()=>{let h=u.trim().toLowerCase();return h===""?a:a.filter(w=>w.name.toLowerCase().includes(h))},[u,a]),b=dn({count:g.length,estimateSize:o(()=>Qr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:Xr,width:240},observeElementRect:o((h,w)=>mn(h,w,Xr),"observeElementRect"),overscan:12}).getVirtualItems(),f={height:g.length*Qr};return(0,Y.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${l}-table-list`,children:[t,(0,Y.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:c("Tables")}),e!==void 0&&(0,Y.jsx)("button",{"aria-label":r??c("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${l}-load-tables`,onClick:e,title:r??c("Refresh"),type:"button",children:(0,Y.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,Y.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,Y.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,Y.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${l}-table-search`,onChange:m,placeholder:c("search table\u2026"),type:"search",value:u})}),(0,Y.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,Y.jsx)("li",{"aria-hidden":"true",style:f}),b.map(h=>{let w=g[h.index];return w===void 0?null:(0,Y.jsx)(Ei,{item:w,onSelect:n,prefix:l,selected:s===w.name,start:h.start},w.name)})]})]})},"Te");var q=Re(Ht(),1);var D=Re(ut(),1);var p=Re(Lt(),1);var Zr=Re(ut(),1);function Vi(t){return zi(t)||typeof t=="function"||$i(t)}o(Vi,"isReactComponent");function zi(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(zi,"isClassComponent");function $i(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o($i,"isExoticComponent");function wt(t,e){return t==null?null:Vi(t)?Zr.default.createElement(t,e):t}o(wt,"flexRender");function fo(t){if("cell"in t&&t.cell){let e=t.cell,n=e.column.columnDef,l=e,r=n;return l.getIsAggregated?.()?wt(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:wt(n.cell,e.getContext())}return"header"in t&&t.header?wt(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?wt(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(fo,"FlexRender");function el({update:t,notify:e,unwatched:n}){return{link:l,unlink:r,propagate:s,checkDirty:a,shallowPropagate:c};function l(i,d,m){let g=d.depsTail;if(g!==void 0&&g.dep===i)return;let b=g!==void 0?g.nextDep:d.deps;if(b!==void 0&&b.dep===i){b.version=m,d.depsTail=b;return}let f=i.subsTail;if(f!==void 0&&f.version===m&&f.sub===d)return;let h=d.depsTail=i.subsTail={version:m,dep:i,sub:d,prevDep:g,nextDep:b,prevSub:f,nextSub:void 0};b!==void 0&&(b.prevDep=h),g!==void 0?g.nextDep=h:d.deps=h,f!==void 0?f.nextSub=h:i.subs=h}function r(i,d=i.sub){let m=i.dep,g=i.prevDep,b=i.nextDep,f=i.nextSub,h=i.prevSub;return b!==void 0?b.prevDep=g:d.depsTail=g,g!==void 0?g.nextDep=b:d.deps=b,f!==void 0?f.prevSub=h:m.subsTail=h,h!==void 0?h.nextSub=f:(m.subs=f)===void 0&&n(m),b}function s(i){let d=i.nextSub,m;e:do{let g=i.sub,b=g.flags;if(b&60?b&12?b&4?!(b&48)&&u(i,g)?(g.flags=b|40,b&=1):b=0:g.flags=b&-9|32:b=0:g.flags=b|32,b&2&&e(g),b&1){let f=g.subs;if(f!==void 0){let h=(i=f).nextSub;h!==void 0&&(m={value:d,prev:m},d=h);continue}}if((i=d)!==void 0){d=i.nextSub;continue}for(;m!==void 0;)if(i=m.value,m=m.prev,i!==void 0){d=i.nextSub;continue e}break}while(!0)}function a(i,d){let m,g=0,b=!1;e:do{let f=i.dep,h=f.flags;if(d.flags&16)b=!0;else if((h&17)===17){if(t(f)){let w=f.subs;w.nextSub!==void 0&&c(w),b=!0}}else if((h&33)===33){(i.nextSub!==void 0||i.prevSub!==void 0)&&(m={value:i,prev:m}),i=f.deps,d=f,++g;continue}if(!b){let w=i.nextDep;if(w!==void 0){i=w;continue}}for(;g--;){let w=d.subs,_=w.nextSub!==void 0;if(_?(i=m.value,m=m.prev):i=w,b){if(t(d)){_&&c(w),d=i.sub;continue}b=!1}else d.flags&=-33;d=i.sub;let S=i.nextDep;if(S!==void 0){i=S;continue e}}return b}while(!0)}function c(i){do{let d=i.sub,m=d.flags;(m&48)===32&&(d.flags=m|16,(m&6)===2&&e(d))}while((i=i.nextSub)!==void 0)}function u(i,d){let m=d.depsTail;for(;m!==void 0;){if(m===i)return!0;m=m.prevDep}return!1}}o(el,"createReactiveSystem");function ol(t,e,n){let l=typeof t=="object",r=l?t:void 0;return{next:(l?t.next:t)?.bind(r),error:(l?t.error:e)?.bind(r),complete:(l?t.complete:n)?.bind(r)}}o(ol,"toObserver");var po=[],vn=0,{link:tl,unlink:Hi,propagate:Li,checkDirty:rl,shallowPropagate:nl}=el({update(t){return t._update()},notify(t){po[bo++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,yn(t))}}),Cn=0,bo=0,Qe,ho=0;function wo(t){try{++ho,t()}finally{--ho||xo()}}o(wo,"batch");function yn(t){let e=t.depsTail,n=e!==void 0?e.nextDep:t.deps;for(;n!==void 0;)n=Hi(n,t)}o(yn,"purgeDeps");function xo(){if(!(ho>0)){for(;Cn<bo;){let t=po[Cn];po[Cn++]=void 0,t.notify()}Cn=0,bo=0}}o(xo,"flush");function So(t,e){let n=typeof t=="function",l=t,r={_snapshot:n?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?0:1,get(){return Qe!==void 0&&tl(r,Qe,vn),r._snapshot},subscribe(s){let a=ol(s),c={current:!1},u=ji(()=>{r.get(),c.current?a.next?.(r._snapshot):c.current=!0});return{unsubscribe:o(()=>{u.stop()},"unsubscribe")}},_update(s){let a=Qe,c=e?.compare??Object.is;if(n)Qe=r,++vn,r.depsTail=void 0;else if(s===void 0)return!1;n&&(r.flags=5);try{let u=r._snapshot,i=typeof s=="function"?s(u):s===void 0&&n?l(u):s;return u===void 0||!c(u,i)?(r._snapshot=i,!0):!1}finally{Qe=a,n&&(r.flags&=-5),yn(r)}}};return n?(r.flags=17,r.get=function(){let s=r.flags;if(s&16||s&32&&rl(r.deps,r)){if(r._update()){let a=r.subs;a!==void 0&&nl(a)}}else s&32&&(r.flags=s&-33);return Qe!==void 0&&tl(r,Qe,vn),r._snapshot}):r.set=function(s){if(r._update(s)){let a=r.subs;a!==void 0&&(Li(a),nl(a),xo())}},r}o(So,"createAtom");function ji(t){let e=o(()=>{let l=Qe;Qe=n,++vn,n.depsTail=void 0,n.flags=6;try{return t()}finally{Qe=l,n.flags&=-5,yn(n)}},"run"),n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let l=this.flags;l&16||l&32&&rl(this.deps,this)?e():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,yn(this)}};return e(),n}o(ji,"effect");function lt(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(let[l,r]of t)if(!e.has(l)||!Object.is(r,e.get(l)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(let l of t)if(!e.has(l))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();let n=ll(t);if(n.length!==ll(e).length)return!1;for(let l=0;l<n.length;l++)if(!Object.prototype.hasOwnProperty.call(e,n[l])||!Object.is(t[n[l]],e[n[l]]))return!1;return!0}o(lt,"shallow");function ll(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}o(ll,"getOwnKeys");var _o=Re(ut(),1),sl=Re(vi(),1);function Bi(t,e){return t===e}o(Bi,"defaultCompare");function qt(t,e=l=>l,n){let l=n?.compare??Bi,r=(0,_o.useCallback)(a=>{let{unsubscribe:c}=t.subscribe(a);return c},[t]),s=(0,_o.useCallback)(()=>t.get(),[t]);return(0,sl.useSyncExternalStoreWithSelector)(r,s,s,e,l)}o(qt,"useSelector");function al(t){let e=qt(t.source,t.selector,{compare:lt});return typeof t.children=="function"?t.children(e):t.children}o(al,"Subscribe");function il(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(il,"atomToStore");function Co(t){let{createAtom:e,batch:n}=t,l=e(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"addSubscription"),unmount:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"unmount"),schedule:t.schedule??(r=>queueMicrotask(r)),batch:n,untrack:o(r=>r(),"untrack"),createReadonlyAtom:o((r,s)=>{let a=s?.compare??Object.is,c=!1,u,i=o(()=>{let m=r();return(!c||!a(u,m))&&(u=m,c=!0),u},"getSnapshot"),d=e(()=>(l.get(),i()),{compare:a});return{get:i,subscribe:d.subscribe.bind(d)}},"createReadonlyAtom"),createWritableAtom:o((r,s)=>e(r,{compare:s?.compare}),"createWritableAtom"),commit:o(()=>{l.set(r=>r+1)},"commit")}}o(Co,"renderPhaseReactivity");function vo(t,e=Object.is){let n=!1,l;return{get:t.get,markCommitted:o(r=>{l=r,n=!0},"markCommitted"),subscribe:o(r=>t.subscribe(s=>{(!n||!e(l,s))&&r(s)}),"subscribe")}}o(vo,"createRenderPhaseSource");function cl(){return Co({createAtom:So,batch:wo})}o(cl,"reactReactivity");function Ft(t,e){return typeof t=="function"?t(e):t}o(Ft,"functionalUpdate");function ae(t){if(Array.isArray(t))return t.map(ae);if(t&&typeof t=="object"){let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return t;let n=e===null?H():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let s=l[r];Object.defineProperty(n,s,{configurable:!0,enumerable:!0,value:ae(t[s]),writable:!0})}return n}return t}o(ae,"cloneState");function Rn(t,e){let n=Object.keys(e),l=t;for(let r=0;r<n.length;r++){let s=n[r];!s.startsWith("_memo_")&&s!=="_cellsCache"&&(l[s]=e[s])}return t}o(Rn,"copyInstancePropertiesWithoutMemos");function H(){return Object.create(null)}o(H,"makeObjectMap");function je(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(je,"hasOwn");function Be(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>Ft(n,l))}}o(Be,"makeStateUpdater");function ul(t){if(typeof t!="object"||t===null)return!1;if(Array.isArray(t))return!0;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}o(ul,"isPlainContainer");function dl(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(dl,"getEnumerableOwnKeys");var Gi=3;function qi(t,e){return ml(t,e,Gi)}o(qi,"stateSlicesEqual");function ml(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!ul(t)||!ul(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=dl(t),r=dl(e);if(l.length!==r.length)return!1;let s=t,a=e;for(let c=0;c<l.length;c++){let u=l[c];if(!Object.prototype.propertyIsEnumerable.call(e,u)||!ml(s[u],a[u],n-1))return!1}return!0}o(ml,"stateSlicesEqualAtDepth");function He(t,e,n,l=qi){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,s=t.options[r];s&&s(a=>{let c=Ft(n,a);return l(a,c)?a:c})}o(He,"setStateSlice");function gl(t){return t instanceof Function}o(gl,"isFunction");function fl(t,e){let n=[],l=o(r=>{r.forEach(s=>{n.push(s);let a=e(s);a.length&&l(a)})},"recurse");return l(t),n}o(fl,"flattenBy");var Ki=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:s})=>{let a=[],c;return o(i=>{r?.();let d=e?.(i),m=!d||d.length!==a?.length;if(!m&&d){for(let g=0;g<d.length;g++)if(d[g]!==a[g]){m=!0;break}}return n?.(m),m&&(a=d,s?.(),c=t(...d??[]),l?.(c)),c},"memoizedFn")},"memo");function In(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(In,"skipFirstRun");var Ui=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Mt({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...s}){let a,c,u=0,i;function d(b,f){let h=u===0?"(1st run)":f?"(rerun #"+u+")":"(cache)";u++,console.groupCollapsed(`%c\u23F1 ${Ui(`${b.toFixed(1)} ms`,12)} %c${h}%c ${e}%c ${n?`(${e.split(".")[0]}Id: ${n})`:""}`,`font-size: .6rem; font-weight: bold; ${f?`color: hsl(
1
+ import{a as fn,b as $e,e as Br,f as Gr}from"./chunk-AANB526D.js";import{a as Hr,b as bt,c as jr,d as pn}from"./chunk-WGN2KDQO.js";import{a as mn}from"./chunk-MXLAOCAN.js";import{b as dn}from"./chunk-CMA4PTV7.js";import{d as qr}from"./chunk-UYEZR3BI.js";import{a as un}from"./chunk-CSUROWL2.js";import"./chunk-RFNGDE33.js";import"./chunk-V3CZW3JB.js";import"./chunk-MU3P2FI7.js";import{a as mo,b as go,c as gn,d as Lr}from"./chunk-YOB2X3FZ.js";import{a as cn}from"./chunk-3FBLWUXD.js";import{a as Bt}from"./chunk-XZMOZFE6.js";import{a as co}from"./chunk-IMOHEGMV.js";import{a as an}from"./chunk-UXXDN6Z3.js";import{a as $r}from"./chunk-66UGPQVC.js";import{b as Mr,c as lo}from"./chunk-6DAD3RFX.js";import"./chunk-YPRQLCKF.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import{a as uo}from"./chunk-QKEJLVC5.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as io}from"./chunk-NFS7FTAR.js";import{a as Tr}from"./chunk-EJSI4PMU.js";import{a as Nr,b as Dr}from"./chunk-OGUKYRFM.js";import{c as vr,d as yr,e as Rr}from"./chunk-6D6Z2KXU.js";import{b as kr,c as Pr,f as so}from"./chunk-OKG3HWSJ.js";import{W as Ir}from"./chunk-PLHA3OWK.js";import{b as vi}from"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as rn}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as _e}from"./chunk-4ZEL6BYL.js";import{b as ro,c as dt}from"./chunk-6R3CL5GW.js";import{f as rt}from"./chunk-RATPWNIM.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as ln}from"./chunk-FKVZRPV5.js";import{a as Ar,b as Or,c as Er,d as ao,e as Vr,f as zr}from"./chunk-HEAQVSNS.js";import{d as oe,f as Ve,g as ze,h as jt,m as oo,n as sn,o as Oe,p as re,t as Fr}from"./chunk-PTZD7RUZ.js";import{a as o,d as Re,e as ut,f as Ht,g as Lt,i as pt}from"./chunk-YKXDMIHQ.js";var Ua=Re(Ht(),1);var Ot=Re(ut(),1);var ht=Re(Ht(),1);var Y=Re(Lt(),1),Le=Re(ut(),1);function We(t){let e=(0,ht.c)(2),n=(0,Le.useRef)(t),l;return e[0]!==t?(l=o(()=>{n.current=t},"r"),e[0]=t,e[1]=l):l=e[1],(0,Le.useEffect)(l),n}o(We,"te");var yi=2166136261,Ri=16777619,Ii=o((t,e=yi)=>{let n=e;for(let l=0;l<t.length;l+=1)n^=t.charCodeAt(l),n=Math.imul(n,Ri);return(n>>>0).toString(16).padStart(8,"0")},"V"),Fi=/([a-z\d])([A-Z])/gu,Mi=/[\s_-]+/u,ki=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),Pi=o(t=>{let e=t.replaceAll(Fi,"$1 $2").split(Mi).map(l=>l.toLowerCase()).filter(l=>l.length>0),n=new Set(e);for(let l=0;l<e.length-1;l+=1){let r=e[l],s=e[l+1];r===void 0||s===void 0||(n.add(`${r}${s}`),n.add(`${r}_${s}`))}return[...n]},"ae"),Kr="\u2022\u2022\u2022",Yr=o((t,e)=>{try{return e==="redact"?null:e==="hash"?t==null?t:Ii(typeof t=="bigint"?t.toString():typeof t=="string"?t:JSON.stringify(t)):Kr}catch{return Kr}},"W"),Ur=o((t,e)=>{let n=new Map;for(let l of t)l.table===e&&n.set(l.column,l.strategy);return n},"z"),Ni=o(t=>{for(let e of Pi(t))if(ki.has(e))return!0;return!1},"ce"),Jr=o((t,e)=>{let n=e.filter(r=>!t.has(r)&&Ni(r));if(n.length===0)return t;let l=new Map(t);for(let r of n)l.set(r,"redact");return l},"B"),Gt=o((t,e,n)=>{if(!n.enabled)return t;let l=n.columns.get(e);return l===void 0?t:Yr(t,l)},"Ce"),bn=o((t,e)=>{if(!e.enabled||e.columns.size===0)return t;let n={...t};for(let[l,r]of e.columns)l in n&&(n[l]=Yr(n[l],r));return n},"ie"),hn=o((t,e)=>!e.enabled||e.columns.size===0?t:t.map(n=>bn(n,e)),"Fe"),Wr=o(t=>t==null?"\u2205":t===""?"(empty)":Oe(t),"P"),Di=o(t=>{let e=(0,ht.c)(32),{column:n,onFacetFilter:l,state:r}=t,s=oe(),a;e[0]!==n||e[1]!==l||e[2]!==r.result?.values?(a=o(w=>{let _=Number(w.currentTarget.dataset.index),S=r.result?.values[_];S!==void 0&&l(n,S.value)},"x"),e[0]=n,e[1]=l,e[2]=r.result?.values,e[3]=a):a=e[3];let c=a,u=`db-facet-${n}`,i;e[4]!==n?(i=(0,Y.jsx)("span",{className:"font-medium text-foreground",children:n}),e[4]=n,e[5]=i):i=e[5];let d;e[6]!==r.loading||e[7]!==r.result||e[8]!==s?(d=r.loading&&r.result===null&&(0,Y.jsx)("span",{className:"text-muted-foreground",children:s("Loading\u2026")}),e[6]=r.loading,e[7]=r.result,e[8]=s,e[9]=d):d=e[9];let m;e[10]!==r.error?(m=r.error!==null&&(0,Y.jsx)("span",{className:"text-destructive",role:"alert",children:r.error}),e[10]=r.error,e[11]=m):m=e[11];let g;e[12]!==r.result?.values?(g=r.result?.values??[],e[12]=r.result?.values,e[13]=g):g=e[13];let b;if(e[14]!==n||e[15]!==c||e[16]!==g){let w;e[18]!==n||e[19]!==c?(w=o((_,S)=>(0,Y.jsxs)("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":S,"data-testid":`db-facet-value-${n}`,onClick:c,type:"button",children:[(0,Y.jsx)("span",{className:"truncate",children:Wr(_.value)}),(0,Y.jsx)("span",{className:"shrink-0 tabular-nums text-foreground/70",children:_.count})]},Wr(_.value)),"c"),e[18]=n,e[19]=c,e[20]=w):w=e[20],b=g.map(w),e[14]=n,e[15]=c,e[16]=g,e[17]=b}else b=e[17];let f;e[21]!==n||e[22]!==r.result||e[23]!==s?(f=r.result?.truncated===!0&&(0,Y.jsx)("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${n}`,children:s("Showing the {n} most common values.",{n:r.result.values.length})}),e[21]=n,e[22]=r.result,e[23]=s,e[24]=f):f=e[24];let h;return e[25]!==u||e[26]!==i||e[27]!==d||e[28]!==m||e[29]!==b||e[30]!==f?(h=(0,Y.jsxs)("section",{className:"flex flex-col gap-1","data-testid":u,children:[i,d,m,b,f]}),e[25]=u,e[26]=i,e[27]=d,e[28]=m,e[29]=b,e[30]=f,e[31]=h):h=e[31],h},"ue"),wn=o(t=>{let e=(0,ht.c)(44),{columns:n,facets:l,mask:r,onFacetFilter:s,onToggleFacet:a}=t,c=oe(),u;e[0]!==a?(u=o(v=>{let{column:M}=v.currentTarget.dataset;M!==void 0&&a(M)},"o"),e[0]=a,e[1]=u):u=e[1];let i=u,d;e[2]!==r?(d=o(v=>r.enabled&&r.columns.has(v),"a"),e[2]=r,e[3]=d):d=e[3];let m=d,g,b,f,h,w,_,S,y;if(e[4]!==n||e[5]!==l||e[6]!==m||e[7]!==c||e[8]!==i){y=Symbol.for("react.early_return_sentinel");e:{let v;e[17]!==m?(v=o(N=>!m(N),"y"),e[17]=m,e[18]=v):v=e[18];let M=n.filter(v),F;if(e[19]!==l||e[20]!==m?(F=Object.entries(l).filter(N=>{let[T]=N;return!m(T)}),e[19]=l,e[20]=m,e[21]=F):F=e[21],g=F,M.length===0){y=null;break e}_="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",S="db-facets",h="flex flex-col gap-1.5";let P;e[22]!==c?(P=c("Facets"),e[22]=c,e[23]=P):P=e[23],e[24]!==P?(w=(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:P}),e[24]=P,e[25]=w):w=e[25],b="flex flex-wrap gap-1";let k;e[26]!==l||e[27]!==i?(k=o(N=>(0,Y.jsx)("button",{"aria-pressed":N in l,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":N,"data-testid":`db-facet-toggle-${N}`,onClick:i,type:"button",children:N},N),"A"),e[26]=l,e[27]=i,e[28]=k):k=e[28],f=M.map(k)}e[4]=n,e[5]=l,e[6]=m,e[7]=c,e[8]=i,e[9]=g,e[10]=b,e[11]=f,e[12]=h,e[13]=w,e[14]=_,e[15]=S,e[16]=y}else g=e[9],b=e[10],f=e[11],h=e[12],w=e[13],_=e[14],S=e[15],y=e[16];if(y!==Symbol.for("react.early_return_sentinel"))return y;let I;e[29]!==b||e[30]!==f?(I=(0,Y.jsx)("div",{className:b,children:f}),e[29]=b,e[30]=f,e[31]=I):I=e[31];let C;e[32]!==I||e[33]!==h||e[34]!==w?(C=(0,Y.jsxs)("div",{className:h,children:[w,I]}),e[32]=I,e[33]=h,e[34]=w,e[35]=C):C=e[35];let R;e[36]!==s||e[37]!==g?(R=g.map(v=>{let[M,F]=v;return(0,Y.jsx)(Di,{column:M,onFacetFilter:s,state:F},M)}),e[36]=s,e[37]=g,e[38]=R):R=e[38];let x;return e[39]!==C||e[40]!==R||e[41]!==_||e[42]!==S?(x=(0,Y.jsxs)("aside",{className:_,"data-testid":S,children:[C,R]}),e[39]=C,e[40]=R,e[41]=_,e[42]=S,e[43]=x):x=e[43],x},"_e"),xn=o(()=>{let[t,e]=(0,Le.useState)({}),n=We(t),l=(0,Le.useRef)({}),r=o(async(s,a)=>{let c=(l.current[s]??0)+1;l.current[s]=c,e(u=>s in u?{...u,[s]:{error:null,loading:!0,result:u[s]?.result??null}}:u);try{let u=await a(s);if(l.current[s]!==c)return;e(i=>s in i?{...i,[s]:{error:null,loading:!1,result:u}}:i)}catch(u){if(l.current[s]!==c)return;e(i=>s in i?{...i,[s]:{error:jt(u),loading:!1,result:null}}:i)}},"n");return{clearFacets:o(()=>{e({})},"clearFacets"),facets:t,facetsRef:n,refetchFacets:o(s=>{for(let a of Object.keys(n.current))re(r(a,s))},"refetchFacets"),toggleFacet:o((s,a)=>{if(s in n.current){e(c=>Object.fromEntries(Object.entries(c).filter(([u])=>u!==s)));return}e(c=>({...c,[s]:{error:null,loading:!0,result:null}})),a!==null&&re(r(s,a))},"toggleFacet")}},"Me"),Ti=[],Ai=o(()=>{let t=(0,ht.c)(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let{data:n}=dt(_e.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:Ti},"fe"),Sn=o(t=>{let e=(0,ht.c)(16),{columns:n,selectedTable:l}=t,r=Ai(),[s,a]=(0,Le.useState)(!0),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=o(()=>{a(Oi)},"g"),e[0]=c):c=e[0];let u=c,i;if(e[1]!==n||e[2]!==r||e[3]!==l){let h=Ur(r,l??"");i=Jr(h,n),e[1]=n,e[2]=r,e[3]=l,e[4]=i}else i=e[4];let d=i,m;e[5]!==s||e[6]!==r?(m=o((h,w)=>({columns:Jr(Ur(r,h),w),enabled:s}),"l"),e[5]=s,e[6]=r,e[7]=m):m=e[7];let g=m,b;e[8]!==d||e[9]!==s?(b={columns:d,enabled:s},e[8]=d,e[9]=s,e[10]=b):b=e[10];let f;return e[11]!==d||e[12]!==s||e[13]!==g||e[14]!==b?(f={maskColumns:d,maskOn:s,maskView:b,maskViewFor:g,onToggleMask:u},e[11]=d,e[12]=s,e[13]=g,e[14]=b,e[15]=f):f=e[15],f},"$e");function Oi(t){return!t}o(Oi,"me");var Qr=34,Xr=600,Ei=o(t=>{let e=(0,ht.c)(21),{item:n,onSelect:l,prefix:r,selected:s,start:a}=t,c;e[0]!==n.name||e[1]!==l?(c=o(()=>{l(n.name)},"g"),e[0]=n.name,e[1]=l,e[2]=c):c=e[2];let u=c,i=`translateY(${String(a)}px)`,d;e[3]!==i?(d={insetInline:0,position:"absolute",top:0,transform:i},e[3]=i,e[4]=d):d=e[4];let m=d,g=s?"bg-accent font-medium text-accent-foreground":"text-foreground",b;e[5]!==g?(b=pt("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",g),e[5]=g,e[6]=b):b=e[6];let f=`${r}-table-${n.name}`,h;e[7]!==n.name?(h=(0,Y.jsx)("span",{className:"truncate",children:n.name}),e[7]=n.name,e[8]=h):h=e[8];let w;e[9]!==n.rowCount?(w=(0,Y.jsx)("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:n.rowCount}),e[9]=n.rowCount,e[10]=w):w=e[10];let _;e[11]!==u||e[12]!==s||e[13]!==b||e[14]!==f||e[15]!==h||e[16]!==w?(_=(0,Y.jsxs)("button",{"aria-pressed":s,className:b,"data-testid":f,onClick:u,type:"button",children:[h,w]}),e[11]=u,e[12]=s,e[13]=b,e[14]=f,e[15]=h,e[16]=w,e[17]=_):_=e[17];let S;return e[18]!==m||e[19]!==_?(S=(0,Y.jsx)("li",{style:m,children:_}),e[18]=m,e[19]=_,e[20]=S):S=e[20],S},"ge"),_n=o(({header:t,onReload:e,onSelect:n,prefix:l,reloadLabel:r,selected:s,tables:a})=>{let c=oe(),[u,i]=(0,Le.useState)(""),d=(0,Le.useRef)(null),m=o(h=>{i(h.target.value)},"l"),g=(0,Le.useMemo)(()=>{let h=u.trim().toLowerCase();return h===""?a:a.filter(w=>w.name.toLowerCase().includes(h))},[u,a]),b=dn({count:g.length,estimateSize:o(()=>Qr,"estimateSize"),getScrollElement:o(()=>d.current,"getScrollElement"),initialRect:{height:Xr,width:240},observeElementRect:o((h,w)=>mn(h,w,Xr),"observeElementRect"),overscan:12}).getVirtualItems(),f={height:g.length*Qr};return(0,Y.jsxs)("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${l}-table-list`,children:[t,(0,Y.jsxs)("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[(0,Y.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:c("Tables")}),e!==void 0&&(0,Y.jsx)("button",{"aria-label":r??c("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${l}-load-tables`,onClick:e,title:r??c("Refresh"),type:"button",children:(0,Y.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,Y.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),(0,Y.jsx)("div",{className:"shrink-0 border-b border-border p-2",children:(0,Y.jsx)("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${l}-table-search`,onChange:m,placeholder:c("search table\u2026"),type:"search",value:u})}),(0,Y.jsxs)("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${l}-table-list-rows`,ref:d,children:[(0,Y.jsx)("li",{"aria-hidden":"true",style:f}),b.map(h=>{let w=g[h.index];return w===void 0?null:(0,Y.jsx)(Ei,{item:w,onSelect:n,prefix:l,selected:s===w.name,start:h.start},w.name)})]})]})},"Te");var q=Re(Ht(),1);var D=Re(ut(),1);var p=Re(Lt(),1);var Zr=Re(ut(),1);function Vi(t){return zi(t)||typeof t=="function"||$i(t)}o(Vi,"isReactComponent");function zi(t){return typeof t=="function"&&(()=>{let e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}o(zi,"isClassComponent");function $i(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}o($i,"isExoticComponent");function wt(t,e){return t==null?null:Vi(t)?Zr.default.createElement(t,e):t}o(wt,"flexRender");function fo(t){if("cell"in t&&t.cell){let e=t.cell,n=e.column.columnDef,l=e,r=n;return l.getIsAggregated?.()?wt(r.aggregatedCell??n.cell,e.getContext()):l.getIsPlaceholder?.()?null:wt(n.cell,e.getContext())}return"header"in t&&t.header?wt(t.header.column.columnDef.header,t.header.getContext()):"footer"in t&&t.footer?wt(t.footer.column.columnDef.footer,t.footer.getContext()):null}o(fo,"FlexRender");function el({update:t,notify:e,unwatched:n}){return{link:l,unlink:r,propagate:s,checkDirty:a,shallowPropagate:c};function l(i,d,m){let g=d.depsTail;if(g!==void 0&&g.dep===i)return;let b=g!==void 0?g.nextDep:d.deps;if(b!==void 0&&b.dep===i){b.version=m,d.depsTail=b;return}let f=i.subsTail;if(f!==void 0&&f.version===m&&f.sub===d)return;let h=d.depsTail=i.subsTail={version:m,dep:i,sub:d,prevDep:g,nextDep:b,prevSub:f,nextSub:void 0};b!==void 0&&(b.prevDep=h),g!==void 0?g.nextDep=h:d.deps=h,f!==void 0?f.nextSub=h:i.subs=h}function r(i,d=i.sub){let m=i.dep,g=i.prevDep,b=i.nextDep,f=i.nextSub,h=i.prevSub;return b!==void 0?b.prevDep=g:d.depsTail=g,g!==void 0?g.nextDep=b:d.deps=b,f!==void 0?f.prevSub=h:m.subsTail=h,h!==void 0?h.nextSub=f:(m.subs=f)===void 0&&n(m),b}function s(i){let d=i.nextSub,m;e:do{let g=i.sub,b=g.flags;if(b&60?b&12?b&4?!(b&48)&&u(i,g)?(g.flags=b|40,b&=1):b=0:g.flags=b&-9|32:b=0:g.flags=b|32,b&2&&e(g),b&1){let f=g.subs;if(f!==void 0){let h=(i=f).nextSub;h!==void 0&&(m={value:d,prev:m},d=h);continue}}if((i=d)!==void 0){d=i.nextSub;continue}for(;m!==void 0;)if(i=m.value,m=m.prev,i!==void 0){d=i.nextSub;continue e}break}while(!0)}function a(i,d){let m,g=0,b=!1;e:do{let f=i.dep,h=f.flags;if(d.flags&16)b=!0;else if((h&17)===17){if(t(f)){let w=f.subs;w.nextSub!==void 0&&c(w),b=!0}}else if((h&33)===33){(i.nextSub!==void 0||i.prevSub!==void 0)&&(m={value:i,prev:m}),i=f.deps,d=f,++g;continue}if(!b){let w=i.nextDep;if(w!==void 0){i=w;continue}}for(;g--;){let w=d.subs,_=w.nextSub!==void 0;if(_?(i=m.value,m=m.prev):i=w,b){if(t(d)){_&&c(w),d=i.sub;continue}b=!1}else d.flags&=-33;d=i.sub;let S=i.nextDep;if(S!==void 0){i=S;continue e}}return b}while(!0)}function c(i){do{let d=i.sub,m=d.flags;(m&48)===32&&(d.flags=m|16,(m&6)===2&&e(d))}while((i=i.nextSub)!==void 0)}function u(i,d){let m=d.depsTail;for(;m!==void 0;){if(m===i)return!0;m=m.prevDep}return!1}}o(el,"createReactiveSystem");function ol(t,e,n){let l=typeof t=="object",r=l?t:void 0;return{next:(l?t.next:t)?.bind(r),error:(l?t.error:e)?.bind(r),complete:(l?t.complete:n)?.bind(r)}}o(ol,"toObserver");var po=[],vn=0,{link:tl,unlink:Hi,propagate:Li,checkDirty:rl,shallowPropagate:nl}=el({update(t){return t._update()},notify(t){po[bo++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,yn(t))}}),Cn=0,bo=0,Qe,ho=0;function wo(t){try{++ho,t()}finally{--ho||xo()}}o(wo,"batch");function yn(t){let e=t.depsTail,n=e!==void 0?e.nextDep:t.deps;for(;n!==void 0;)n=Hi(n,t)}o(yn,"purgeDeps");function xo(){if(!(ho>0)){for(;Cn<bo;){let t=po[Cn];po[Cn++]=void 0,t.notify()}Cn=0,bo=0}}o(xo,"flush");function So(t,e){let n=typeof t=="function",l=t,r={_snapshot:n?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?0:1,get(){return Qe!==void 0&&tl(r,Qe,vn),r._snapshot},subscribe(s){let a=ol(s),c={current:!1},u=ji(()=>{r.get(),c.current?a.next?.(r._snapshot):c.current=!0});return{unsubscribe:o(()=>{u.stop()},"unsubscribe")}},_update(s){let a=Qe,c=e?.compare??Object.is;if(n)Qe=r,++vn,r.depsTail=void 0;else if(s===void 0)return!1;n&&(r.flags=5);try{let u=r._snapshot,i=typeof s=="function"?s(u):s===void 0&&n?l(u):s;return u===void 0||!c(u,i)?(r._snapshot=i,!0):!1}finally{Qe=a,n&&(r.flags&=-5),yn(r)}}};return n?(r.flags=17,r.get=function(){let s=r.flags;if(s&16||s&32&&rl(r.deps,r)){if(r._update()){let a=r.subs;a!==void 0&&nl(a)}}else s&32&&(r.flags=s&-33);return Qe!==void 0&&tl(r,Qe,vn),r._snapshot}):r.set=function(s){if(r._update(s)){let a=r.subs;a!==void 0&&(Li(a),nl(a),xo())}},r}o(So,"createAtom");function ji(t){let e=o(()=>{let l=Qe;Qe=n,++vn,n.depsTail=void 0,n.flags=6;try{return t()}finally{Qe=l,n.flags&=-5,yn(n)}},"run"),n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let l=this.flags;l&16||l&32&&rl(this.deps,this)?e():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,yn(this)}};return e(),n}o(ji,"effect");function lt(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(let[l,r]of t)if(!e.has(l)||!Object.is(r,e.get(l)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(let l of t)if(!e.has(l))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();let n=ll(t);if(n.length!==ll(e).length)return!1;for(let l=0;l<n.length;l++)if(!Object.prototype.hasOwnProperty.call(e,n[l])||!Object.is(t[n[l]],e[n[l]]))return!1;return!0}o(lt,"shallow");function ll(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}o(ll,"getOwnKeys");var _o=Re(ut(),1),sl=Re(vi(),1);function Bi(t,e){return t===e}o(Bi,"defaultCompare");function qt(t,e=l=>l,n){let l=n?.compare??Bi,r=(0,_o.useCallback)(a=>{let{unsubscribe:c}=t.subscribe(a);return c},[t]),s=(0,_o.useCallback)(()=>t.get(),[t]);return(0,sl.useSyncExternalStoreWithSelector)(r,s,s,e,l)}o(qt,"useSelector");function al(t){let e=qt(t.source,t.selector,{compare:lt});return typeof t.children=="function"?t.children(e):t.children}o(al,"Subscribe");function il(t){let e=t;return Object.defineProperty(t,"state",{get(){return t.get()}}),"set"in t&&(e.setState=t.set.bind(t)),e}o(il,"atomToStore");function Co(t){let{createAtom:e,batch:n}=t,l=e(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"addSubscription"),unmount:o(()=>{throw new Error("Feature not supported in current reactivity implementation")},"unmount"),schedule:t.schedule??(r=>queueMicrotask(r)),batch:n,untrack:o(r=>r(),"untrack"),createReadonlyAtom:o((r,s)=>{let a=s?.compare??Object.is,c=!1,u,i=o(()=>{let m=r();return(!c||!a(u,m))&&(u=m,c=!0),u},"getSnapshot"),d=e(()=>(l.get(),i()),{compare:a});return{get:i,subscribe:d.subscribe.bind(d)}},"createReadonlyAtom"),createWritableAtom:o((r,s)=>e(r,{compare:s?.compare}),"createWritableAtom"),commit:o(()=>{l.set(r=>r+1)},"commit")}}o(Co,"renderPhaseReactivity");function vo(t,e=Object.is){let n=!1,l;return{get:t.get,markCommitted:o(r=>{l=r,n=!0},"markCommitted"),subscribe:o(r=>t.subscribe(s=>{(!n||!e(l,s))&&r(s)}),"subscribe")}}o(vo,"createRenderPhaseSource");function cl(){return Co({createAtom:So,batch:wo})}o(cl,"reactReactivity");function Ft(t,e){return typeof t=="function"?t(e):t}o(Ft,"functionalUpdate");function ae(t){if(Array.isArray(t))return t.map(ae);if(t&&typeof t=="object"){let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)return t;let n=e===null?H():{},l=Object.keys(t);for(let r=0;r<l.length;r++){let s=l[r];Object.defineProperty(n,s,{configurable:!0,enumerable:!0,value:ae(t[s]),writable:!0})}return n}return t}o(ae,"cloneState");function Rn(t,e){let n=Object.keys(e),l=t;for(let r=0;r<n.length;r++){let s=n[r];!s.startsWith("_memo_")&&s!=="_cellsCache"&&(l[s]=e[s])}return t}o(Rn,"copyInstancePropertiesWithoutMemos");function H(){return Object.create(null)}o(H,"makeObjectMap");function je(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(je,"hasOwn");function Be(t,e){return n=>{(e.options.atoms?.[t]??e.baseAtoms[t]).set(l=>Ft(n,l))}}o(Be,"makeStateUpdater");function ul(t){if(typeof t!="object"||t===null)return!1;if(Array.isArray(t))return!0;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}o(ul,"isPlainContainer");function dl(t){return Reflect.ownKeys(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}o(dl,"getEnumerableOwnKeys");var Gi=3;function qi(t,e){return ml(t,e,Gi)}o(qi,"stateSlicesEqual");function ml(t,e,n){if(Object.is(t,e))return!0;if(n<=0||!ul(t)||!ul(e)||(Array.isArray(t)||Array.isArray(e))&&(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length))return!1;let l=dl(t),r=dl(e);if(l.length!==r.length)return!1;let s=t,a=e;for(let c=0;c<l.length;c++){let u=l[c];if(!Object.prototype.propertyIsEnumerable.call(e,u)||!ml(s[u],a[u],n-1))return!1}return!0}o(ml,"stateSlicesEqualAtDepth");function He(t,e,n,l=qi){let r=`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`,s=t.options[r];s&&s(a=>{let c=Ft(n,a);return l(a,c)?a:c})}o(He,"setStateSlice");function gl(t){return t instanceof Function}o(gl,"isFunction");function fl(t,e){let n=[],l=o(r=>{r.forEach(s=>{n.push(s);let a=e(s);a.length&&l(a)})},"recurse");return l(t),n}o(fl,"flattenBy");var Ki=o(({fn:t,memoDeps:e,onAfterCompare:n,onAfterUpdate:l,onBeforeCompare:r,onBeforeUpdate:s})=>{let a=[],c;return o(i=>{r?.();let d=e?.(i),m=!d||d.length!==a?.length;if(!m&&d){for(let g=0;g<d.length;g++)if(d[g]!==a[g]){m=!0;break}}return n?.(m),m&&(a=d,s?.(),c=t(...d??[]),l?.(c)),c},"memoizedFn")},"memo");function In(t){let e=!1;return()=>{if(!e){e=!0;return}t()}}o(In,"skipFirstRun");var Ui=o((t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t},"pad");function Mt({feature:t,fnName:e,objectId:n,onAfterUpdate:l,table:r,...s}){let a,c,u=0,i;function d(b,f){let h=u===0?"(1st run)":f?"(rerun #"+u+")":"(cache)";u++,console.groupCollapsed(`%c\u23F1 ${Ui(`${b.toFixed(1)} ms`,12)} %c${h}%c ${e}%c ${n?`(${e.split(".")[0]}Id: ${n})`:""}`,`font-size: .6rem; font-weight: bold; ${f?`color: hsl(
2
2
  ${Math.max(0,Math.min(120-Math.log10(b)*60,120))}deg 100% 31%);`:""} `,`color: ${u<2?"#FF00FF":"#FF1493"}`,"color: #666","color: #87CEEB"),console.info({feature:t,state:r.store.state,deps:s.memoDeps?.toString()}),console.trace(),console.groupEnd()}o(d,"logTime");let m=o(()=>{if(!l)return;let{schedule:b,untrack:f}=r._reactivity;b(()=>f(()=>l()))},"onAfterUpdateHandler");return Ki({...s,...{onAfterUpdate:o(()=>{m()},"onAfterUpdate")}})}o(Mt,"tableMemo");function pl(t,e="_"){let[n,l]=t.split(e);return{fnKey:l,fnName:`${n}.${l}`,parentName:n}}o(pl,"getFunctionNameInfo");function pe(t,e,n){for(let[l,{fn:r,memoDeps:s}]of Object.entries(n)){let{fnKey:a,fnName:c}=pl(l);e[a]=s?Mt({memoDeps:s,fn:r,fnName:c,table:e,feature:t}):r}}o(pe,"assignTableAPIs");function ue(t,e,n,l){for(let[r,{fn:s,memoDeps:a}]of Object.entries(l)){let{fnKey:c,fnName:u}=pl(r);if(a){let i=`_memo_${c}`;e[c]=function(...d){if(!this[i]){let m=this;this[i]=Mt({memoDeps:o(g=>a(m,g),"memoDeps"),fn:o((...g)=>s(m,...g),"fn"),fnName:u,objectId:m.id,table:n,feature:t})}return this[i](...d)}}else e[c]=function(...i){return s(this,...i)}}}o(ue,"assignPrototypeAPIs");function V(t,e,n,...l){return t[e]?.(...l)??n(t,...l)}o(V,"callMemoOrStaticFn");function bl(t){return t.row.getValue(t.column.id)}o(bl,"cell_getValue");function hl(t){return t.getValue()??t.table.options.renderFallbackValue}o(hl,"cell_renderValue");function wl(t){return{table:t.table,column:t.column,row:t.row,cell:t,getValue:o(()=>t.getValue(),"getValue"),renderValue:o(()=>t.renderValue(),"renderValue")}}o(wl,"cell_getContext");var xl={assignCellPrototype:o((t,e)=>{ue("coreCellsFeature",t,e,{cell_getValue:{fn:o(n=>bl(n),"fn")},cell_renderValue:{fn:o(n=>hl(n),"fn")},cell_getContext:{fn:o(n=>wl(n),"fn"),memoDeps:o(n=>[n],"memoDeps")}})},"assignCellPrototype")};function Ji(t){if(!t._headerPrototype){t._headerPrototype={table:t};let e=Object.values(t._features);for(let n=0;n<e.length;n++)e[n].assignHeaderPrototype?.(t._headerPrototype,t)}return t._headerPrototype}o(Ji,"getHeaderPrototype");function yo(t,e,n){let l=Ji(t),r=Object.create(l);r.colSpan=0,r.column=e,r.depth=n.depth,r.headerGroup=null,r.id=n.id??e.id,r.index=n.index,r.isPlaceholder=!!n.isPlaceholder,r.placeholderId=n.placeholderId,r.rowSpan=0,r.subHeaders=[];let s=t._headerInstanceInitFns;for(let a=0;a<s.length;a++)s[a](r);return r}o(yo,"constructHeader");function Xe(){return{start:[],end:[]}}o(Xe,"getDefaultColumnPinningState");function Sl(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{start:l}=t.atoms.columnPinning?.get()??Xe(),r=[];for(let s=0;s<l.length;s++){let a=n[l[s]];a&&V(a,"getIsVisible",de)&&r.push(a)}return St(e,r,t,"start")}o(Sl,"table_getStartHeaderGroups");function _l(t){let e=t.getAllColumns(),n=t.getAllLeafColumnsById(),{end:l}=t.atoms.columnPinning?.get()??Xe(),r=[];for(let s=0;s<l.length;s++){let a=n[l[s]];a&&V(a,"getIsVisible",de)&&r.push(a)}return St(e,r,t,"end")}o(_l,"table_getEndHeaderGroups");function Cl(t){let e=t.getAllColumns(),n=V(t,"getVisibleLeafColumns",xt),{start:l,end:r}=t.atoms.columnPinning?.get()??Xe();if(l.length||r.length){let s=[...l,...r];n=n.filter(a=>!s.includes(a.id))}return St(e,n,t,"center")}o(Cl,"table_getCenterHeaderGroups");function Wi(t){let{start:e}=t.atoms.columnPinning?.get()??Xe(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let s=n[e[r]];s&&l.push(s)}return l}o(Wi,"table_getStartLeafColumns");function Qi(t){let{end:e}=t.atoms.columnPinning?.get()??Xe(),n=t.getAllLeafColumnsById(),l=[];for(let r=0;r<e.length;r++){let s=n[e[r]];s&&l.push(s)}return l}o(Qi,"table_getEndLeafColumns");function Xi(t){let{start:e,end:n}=t.atoms.columnPinning?.get()??Xe();if(!e.length&&!n.length)return t.getAllLeafColumns();let l=[...e,...n];return t.getAllLeafColumns().filter(r=>!l.includes(r.id))}o(Xi,"table_getCenterLeafColumns");function Yi(t){return V(t,"getStartLeafColumns",Wi).filter(e=>V(e,"getIsVisible",de))}o(Yi,"table_getStartVisibleLeafColumns");function Zi(t){return V(t,"getEndLeafColumns",Qi).filter(e=>V(e,"getIsVisible",de))}o(Zi,"table_getEndVisibleLeafColumns");function ec(t){return V(t,"getCenterLeafColumns",Xi).filter(e=>V(e,"getIsVisible",de))}o(ec,"table_getCenterVisibleLeafColumns");function Ge(t,e){return e?e==="start"?V(t,"getStartVisibleLeafColumns",Yi):e==="end"?V(t,"getEndVisibleLeafColumns",Zi):V(t,"getCenterVisibleLeafColumns",ec):V(t,"getVisibleLeafColumns",xt)}o(Ge,"table_getPinnedVisibleLeafColumns");function vl(){return H()}o(vl,"getDefaultColumnVisibilityState");function Io(t,e){Kt(t)&&Ut(t.table,n=>{let l=Object.assign(H(),n),r=e??!V(t,"getIsVisible",de),s=t.getLeafColumns();for(let a=0;a<s.length;a++){let c=s[a];Kt(c)&&(l[c.id]=r)}return l})}o(Io,"column_toggleVisibility");function de(t){let e=t.table.atoms.columnVisibility?.get();if(!e)return!0;let n=t.columns;return n.length?n.some(l=>V(l,"getIsVisible",de)):(je(e,t.id)?e[t.id]:void 0)??!0}o(de,"column_getIsVisible");function Kt(t){return(t.columnDef.enableHiding??!0)&&(t.table.options.enableHiding??!0)}o(Kt,"column_getCanHide");function yl(t){return e=>{Io(t,e.target.checked)}}o(yl,"column_getToggleVisibilityHandler");function Ro(t){let e=t.getAllCells(),n=[];for(let i=0;i<e.length;i++){let d=e[i];V(d.column,"getIsVisible",de)&&n.push(d)}let{start:l,end:r}=t.table.atoms.columnPinning?.get()??Xe();if(!l.length&&!r.length)return n;let s=V(t,"getVisibleCellsByColumnId",Fn),a=[];for(let i=0;i<l.length;i++){let d=s[l[i]];d&&a.push(d)}let c=[];for(let i=0;i<r.length;i++){let d=s[r[i]];d&&c.push(d)}let u=[];for(let i=0;i<n.length;i++){let d=n[i],m=d.column.id;!l.includes(m)&&!r.includes(m)&&u.push(d)}return[...a,...u,...c]}o(Ro,"row_getVisibleCells");function Fn(t){let e=H(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];V(r.column,"getIsVisible",de)&&(e[r.column.id]=r)}return e}o(Fn,"row_getVisibleCellsByColumnId");function Rl(t){return t.getAllFlatColumns().filter(e=>V(e,"getIsVisible",de))}o(Rl,"table_getVisibleFlatColumns");function xt(t){return t.getAllLeafColumns().filter(e=>V(e,"getIsVisible",de))}o(xt,"table_getVisibleLeafColumns");function Ut(t,e){He(t,"columnVisibility",e)}o(Ut,"table_setColumnVisibility");function Il(t,e){Ut(t,e?H():Object.assign(H(),ae(t.initialState.columnVisibility??{})))}o(Il,"table_resetColumnVisibility");function Fo(t,e){e=e??!Mo(t);let n=H(),l=t.getAllLeafColumns();for(let r=0;r<l.length;r++){let s=l[r];n[s.id]=e||!Kt(s)}Ut(t,n)}o(Fo,"table_toggleAllColumnsVisible");function Mo(t){return!t.getAllLeafColumns().some(e=>!V(e,"getIsVisible",de))}o(Mo,"table_getIsAllColumnsVisible");function Fl(t){return t.getAllLeafColumns().some(e=>V(e,"getIsVisible",de))}o(Fl,"table_getIsSomeColumnsVisible");function Ml(t){return e=>{Fo(t,e.target.checked)}}o(Ml,"table_getToggleAllColumnsVisibilityHandler");function kl(t,e=1){let n=e;for(let l=0;l<t.length;l++){let r=t[l];V(r,"getIsVisible",de)&&r.columns.length&&(n=Math.max(n,kl(r.columns,e+1)))}return n}o(kl,"getMaxHeaderDepth");function tc(t,e){return t?`${t}_${e}`:String(e)}o(tc,"formatHeaderGroupId");function nc(t,e,n,l){let r=t??"";return e&&(r=r?`${r}_${e}`:String(e)),n&&(r=r?`${r}_${n}`:n),l&&(r=r?`${r}_${l}`:l),r}o(nc,"formatHeaderId");function oc(t,e){let n=0;for(let l=0;l<t.length;l++)t[l].column===e&&n++;return n}o(oc,"countPendingHeadersForColumn");function Pl(t,e,n,l,r,s){let a={depth:e,id:tc(l,e),headers:[]},c=[];for(let u=0;u<t.length;u++){if(!(u in t))continue;let i=t[u],d=c[c.length-1],m=i.column.depth===a.depth,g,b=!1;if(m&&i.column.parent?g=i.column.parent:(g=i.column,b=!0),d&&d.column===g)d.subHeaders.push(i);else{let f=yo(n,g,{id:nc(l,e,g.id,i.id),isPlaceholder:b,placeholderId:b?String(oc(c,g)):void 0,depth:e,index:c.length});f.subHeaders.push(i),c.push(f)}a.headers.push(i),i.headerGroup=a}for(let u=0;u<s.length;u++)s[u](a);r.push(a),e>0&&Pl(c,e-1,n,l,r,s)}o(Pl,"constructHeaderGroup");function Nl(t){for(let e=0;e<t.length;e++){let n=t[e];if(!V(n.column,"getIsVisible",de))continue;let l=0;if(n.subHeaders.length){Nl(n.subHeaders);for(let r=0;r<n.subHeaders.length;r++){let s=n.subHeaders[r];V(s.column,"getIsVisible",de)&&(l+=s.colSpan)}}else l=1;if(n.colSpan=l,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let r=1,s=n.subHeaders[0];for(;s;)s.rowSpan=0,r++,s=s.subHeaders.length===1&&s.subHeaders[0].column===n.column?s.subHeaders[0]:void 0;n.rowSpan=r}else n.rowSpan=1}}o(Nl,"updateHeaderSpans");function St(t,e,n,l){let r=kl(t),s=[],a=n._headerGroupInstanceInitFns,c=new Array(e.length);for(let u=0;u<e.length;u++)u in e&&(c[u]=yo(n,e[u],{depth:r,index:u}));return Pl(c,r-1,n,l,s,a),s.reverse(),Nl(s[0]?.headers??[]),s}o(St,"buildHeaderGroups");function rc(t){if(!t._columnPrototype){t._columnPrototype={table:t};let e=Object.values(t._features);for(let n=0;n<e.length;n++)e[n].assignColumnPrototype?.(t._columnPrototype,t)}return t._columnPrototype}o(rc,"getColumnPrototype");function Dl(t,e,n,l){let r={...t.getDefaultColumnDef(),...e},s=r.accessorKey,a=s===void 0?void 0:String(s),c=r.id??a?.replaceAll(".","_")??(typeof r.header=="string"?r.header:void 0),u;if(r.accessorFn)u=r.accessorFn;else if(s!==void 0)if(typeof s=="string"&&s.includes(".")){let g=s.split(".");u=o(b=>{let f=b;for(let h=0;h<g.length;h++){let w=g[h];f=f?.[w]}return f},"accessorFn")}else u=o(g=>g[r.accessorKey],"accessorFn");if(!c)throw new Error;let i=rc(t),d=Object.create(i);d.accessorFn=u,d.columnDef=r,d.columns=[],d.depth=n,d.id=`${String(c)}`,d.parent=l;let m=t._columnInstanceInitFns;for(let g=0;g<m.length;g++)m[g](d);return d}o(Dl,"constructColumn");function Tl(){return[]}o(Tl,"getDefaultColumnOrderState");function ko(t){let e=o(n=>{let l=H();for(let r=0;r<n.length;r++)l[n[r].id]=r;return l},"buildIndexes");return{all:e(Ge(t)),center:e(Ge(t,"center")),start:e(Ge(t,"start")),end:e(Ge(t,"end"))}}o(ko,"table_getColumnIndexes");function Al(t,e){return V(t.table,"getColumnIndexes",ko)[e==="start"?"start":e==="end"?"end":e==="center"?"center":"all"][t.id]??-1}o(Al,"column_getIndex");function Ol(t,e){return Ge(t.table,e)[0]?.id===t.id}o(Ol,"column_getIsFirstColumn");function El(t,e){let n=Ge(t.table,e);return n[n.length-1]?.id===t.id}o(El,"column_getIsLastColumn");function Po(t,e){He(t,"columnOrder",e)}o(Po,"table_setColumnOrder");function Vl(t,e){Po(t,e?[]:ae(t.initialState.columnOrder??[]))}o(Vl,"table_resetColumnOrder");function Jt(t){let e=t.atoms.columnOrder?.get();return n=>{let l=[];if(!e?.length)l=n;else{let r=new Map;for(let s=0;s<n.length;s++){let a=n[s];r.set(a.id,a)}for(let s=0;s<e.length;s++){let a=e[s],c=r.get(a);c&&(l.push(c),r.delete(a))}for(let s=0;s<n.length;s++){let a=n[s];r.has(a.id)&&l.push(a)}}return lc(t,l)}}o(Jt,"table_getOrderColumnsFn");function lc(t,e){let n=t.atoms.grouping?.get()??[],{groupedColumnMode:l}=t.options;if(!n.length||!l)return e;let r=e.filter(c=>!n.includes(c.id));if(l==="remove")return r;let s=new Map;for(let c=0;c<e.length;c++){let u=e[c];s.set(u.id,u)}let a=[];for(let c=0;c<n.length;c++){let u=s.get(n[c]);u&&a.push(u)}return[...a,...r]}o(lc,"orderColumns");function zl(t){return[t,...t.columns.flatMap(e=>e.getFlatColumns())]}o(zl,"column_getFlatColumns");function $l(t){if(t.columns.length){let e=t.columns.flatMap(n=>n.getLeafColumns());return V(t.table,"getOrderColumns",Jt)(e)}return[t]}o($l,"column_getLeafColumns");function Hl(t){return{header:o(e=>{let n=e.header.column.columnDef;return n.accessorKey?n.accessorKey:n.accessorFn?n.id:null},"header"),cell:o(e=>e.renderValue()?.toString?.()??null,"cell"),...Object.values(t._features).reduce((e,n)=>Object.assign(e,n.getDefaultColumnDef?.()),{}),...t.options.defaultColumn}}o(Hl,"table_getDefaultColumnDef");function Ll(t,e,n,l=0){let r=new Array(e.length);for(let s=0;s<e.length;s++){if(!(s in e))continue;let a=e[s],c=Dl(t,a,l,n),u=a;c.columns=u.columns?Ll(t,u.columns,c,l+1):[],r[s]=c}return r}o(Ll,"constructColumns");function jl(t){return Ll(t,t.options.columns)}o(jl,"table_getAllColumns");function Bl(t){return t.getAllColumns().flatMap(e=>e.getFlatColumns())}o(Bl,"table_getAllFlatColumns");function Gl(t){let e=H(),n=t.getAllFlatColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(Gl,"table_getAllFlatColumnsById");function ql(t){let e=t.getAllColumns().flatMap(n=>n.getLeafColumns());return V(t,"getOrderColumns",Jt)(e)}o(ql,"table_getAllLeafColumns");function Kl(t){let e=H(),n=t.getAllLeafColumns();for(let l=0;l<n.length;l++){let r=n[l];e[r.id]=r}return e}o(Kl,"table_getAllLeafColumnsById");function Ul(t,e){return t.getAllFlatColumnsById()[e]}o(Ul,"table_getColumn");var Jl={assignColumnPrototype:o((t,e)=>{ue("coreColumnsFeature",t,e,{column_getFlatColumns:{fn:o(n=>zl(n),"fn"),memoDeps:o(n=>[n.table.options.columns],"memoDeps")},column_getLeafColumns:{fn:o(n=>$l(n),"fn"),memoDeps:o(n=>[n.table.atoms.columnOrder?.get(),n.table.atoms.grouping?.get(),n.table.options.columns,n.table.options.groupedColumnMode],"memoDeps")}})},"assignColumnPrototype"),constructTableAPIs:o(t=>{pe("coreColumnsFeature",t,{table_getDefaultColumnDef:{fn:o(()=>Hl(t),"fn"),memoDeps:o(()=>[t.options.defaultColumn],"memoDeps")},table_getAllColumns:{fn:o(()=>jl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumns:{fn:o(()=>Bl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllFlatColumnsById:{fn:o(()=>Gl(t),"fn"),memoDeps:o(()=>[t.options.columns],"memoDeps")},table_getAllLeafColumns:{fn:o(()=>ql(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_getAllLeafColumnsById:{fn:o(()=>Kl(t),"fn"),memoDeps:o(()=>[t.getAllLeafColumns()],"memoDeps")},table_getColumn:{fn:o(e=>Ul(t,e),"fn")}})},"constructTableAPIs")};function Wl(t,e){for(let n=0;n<t.subHeaders.length;n++)Wl(t.subHeaders[n],e);e.push(t)}o(Wl,"collectLeafHeaders");function Ql(t){let e=[];return Wl(t,e),e}o(Ql,"header_getLeafHeaders");function Xl(t){return{column:t.column,header:t,table:t.column.table}}o(Xl,"header_getContext");function Yl(t){let{start:e,end:n}=t.atoms.columnPinning?.get()??Xe(),l=t.getAllColumns(),r=V(t,"getVisibleLeafColumns",xt);if(!e.length&&!n.length)return St(l,r,t);let s=t.getAllLeafColumnsById(),a=[];for(let i=0;i<e.length;i++){let d=s[e[i]];d&&V(d,"getIsVisible",de)&&a.push(d)}let c=[];for(let i=0;i<n.length;i++){let d=s[n[i]];d&&V(d,"getIsVisible",de)&&c.push(d)}let u=r.filter(i=>!e.includes(i.id)&&!n.includes(i.id));return St(l,[...a,...u,...c],t)}o(Yl,"table_getHeaderGroups");function Zl(t){return[...t.getHeaderGroups()].reverse()}o(Zl,"table_getFooterGroups");function es(t){let e=t.getHeaderGroups(),n=[];for(let l=0;l<e.length;l++){let r=e[l].headers;for(let s=0;s<r.length;s++)n.push(r[s])}return n}o(es,"table_getFlatHeaders");function ts(t){let e=t.getHeaderGroups()[0]?.headers??[],n=[];for(let l=0;l<e.length;l++){let r=e[l].getLeafHeaders();for(let s=0;s<r.length;s++)n.push(r[s])}return n}o(ts,"table_getLeafHeaders");var ns={assignHeaderPrototype:o((t,e)=>{ue("coreHeadersFeature",t,e,{header_getLeafHeaders:{fn:o(n=>Ql(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")},header_getContext:{fn:o(n=>Xl(n),"fn"),memoDeps:o(n=>[n.column.table.options.columns],"memoDeps")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{pe("coreHeadersFeature",t,{table_getHeaderGroups:{fn:o(()=>Yl(t),"fn"),memoDeps:o(()=>[t.options.columns,t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get(),t.options.groupedColumnMode],"memoDeps")},table_getFooterGroups:{fn:o(()=>Zl(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getFlatHeaders:{fn:o(()=>es(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")},table_getLeafHeaders:{fn:o(()=>ts(t),"fn"),memoDeps:o(()=>[t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};function sc(t){if(!t._rowPrototype){t._rowPrototype={table:t};let e=Object.values(t._features);for(let n=0;n<e.length;n++)e[n].assignRowPrototype?.(t._rowPrototype,t)}return t._rowPrototype}o(sc,"getRowPrototype");var os=o((t,e,n,l,r,s,a)=>{let c=sc(t),u=Object.create(c);u._displayIndexCache=-1,u._uniqueValuesCache=H(),u._valuesCache=H(),u.depth=r,u.id=e,u.index=l,u.original=n,u.parentId=a,u.subRows=s??[];let i=t._rowInstanceInitFns;for(let d=0;d<i.length;d++)i[d](u);return u},"constructRow");var Do=/([0-9]+)/gm;function _t(t){let e=Object.assign((n,l,r)=>{let s=n.getValue(r),a=l.getValue(r),c=e.resolveDataValue;return c&&(s=c(s),a=c(a)),e.sort(s,a,n,l,r)},t);return e}o(_t,"constructSortFn");var To=_t({resolveDataValue:o(t=>kn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>ss(t,e),"sort")}),ac=_t({resolveDataValue:o(t=>kn(t),"resolveDataValue"),sort:o((t,e)=>ss(t,e),"sort")}),Ao=_t({resolveDataValue:o(t=>kn(t).toLowerCase(),"resolveDataValue"),sort:o((t,e)=>Eo(t,e),"sort")}),ic=_t({resolveDataValue:o(t=>kn(t),"resolveDataValue"),sort:o((t,e)=>Eo(t,e),"sort")}),Oo=_t({resolveDataValue:o(t=>cc(t),"resolveDataValue"),sort:o((t,e)=>t>e?1:t<e?-1:0,"sort")}),kt=_t({sort:o((t,e)=>Eo(t,e),"sort")});function Eo(t,e){return t===e?0:t>e?1:-1}o(Eo,"compareBasic");function cc(t){return t instanceof Date?t.getTime():t}o(cc,"toDateSortValue");function kn(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}o(kn,"toString");function ss(t,e){let n=0,l=0,r=t.length,s=e.length;for(;n<r&&l<s;){let a=Mn(t.charCodeAt(n)),c=Mn(e.charCodeAt(l)),u=No(t,n,a),i=No(e,l,c);if(!a&&!c){let m=uc(t,n,u,e,l,i);if(m)return m;n=u,l=i;continue}if(a!==c)return a?1:-1;let d=dc(t,n,u,e,l,i);if(d)return d;n=u,l=i}return ls(t,n)-ls(e,l)}o(ss,"compareAlphanumeric");function Mn(t){return t>=48&&t<=57}o(Mn,"isDigit");function No(t,e,n){let l=e+1;for(;l<t.length&&Mn(t.charCodeAt(l))===n;)l++;return l}o(No,"findChunkEnd");function uc(t,e,n,l,r,s){let a=n-e,c=s-r,u=a<c?a:c;for(let i=0;i<u;i++){let d=t.charCodeAt(e+i),m=l.charCodeAt(r+i);if(d>m)return 1;if(m>d)return-1}return a>c?1:c>a?-1:0}o(uc,"compareStringChunks");function dc(t,e,n,l,r,s){let a=e;for(;a<n&&t.charCodeAt(a)===48;)a++;let c=r;for(;c<s&&l.charCodeAt(c)===48;)c++;let u=n-a,i=s-c;if(u===0&&i===0)return 0;if(u<=15&&i<=15){let g=rs(t,a,n),b=rs(l,c,s);return g>b?1:b>g?-1:0}let d=parseInt(t.slice(e,n),10),m=parseInt(l.slice(r,s),10);return d>m?1:m>d?-1:0}o(dc,"compareNumericChunks");function rs(t,e,n){let l=0;for(let r=e;r<n;r++)l=l*10+t.charCodeAt(r)-48;return l}o(rs,"parseSmallInt");function ls(t,e){let n=0,l=e;for(;l<t.length;)n++,l=No(t,l,Mn(t.charCodeAt(l)));return n}o(ls,"countRemainingChunks");function as(){return[]}o(as,"getDefaultCellSelectionState");function mc(t,e){He(t,"cellSelection",e?as():ae(t.initialState.cellSelection)??as())}o(mc,"table_resetCellSelection");function is(t){t.atoms.cellSelection&&(t.options.autoResetAll??t.options.autoResetCellSelection??!0)&&t._reactivity.schedule(()=>mc(t))}o(is,"table_autoResetCellSelection");function cs(t){t.atoms.expanded&&(t.options.autoResetAll??t.options.autoResetExpanded??!t.options.manualExpanding)&&t._reactivity.schedule(()=>gc(t))}o(cs,"table_autoResetExpanded");function gc(t,e){let n=t.initialState.expanded;He(t,"expanded",e?H():n===!0?!0:Object.assign(H(),ae(n??{})))}o(gc,"table_resetExpanded");var Pn=0;function Nn(t){if(t.options.autoResetAll??t.options.autoResetPageIndex??!t.options.manualPagination){if((t.atoms.pagination?.get()?.pageIndex??Pn)===Pn)return;bc(t,!0)}}o(Nn,"table_autoResetPageIndex");function fc(t,e){He(t,"pagination",e)}o(fc,"table_setPagination");function pc(t,e){fc(t,n=>{let l=Ft(e,n.pageIndex),r=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return l=Math.max(0,Math.min(l,r)),{...n,pageIndex:l}})}o(pc,"table_setPageIndex");function bc(t,e){pc(t,e?Pn:t.initialState.pagination?.pageIndex??Pn)}o(bc,"table_resetPageIndex");function us(){return[]}o(us,"getDefaultSortingState");function Qt(t,e){He(t,"sorting",e)}o(Qt,"table_setSorting");function Vo(t,e){Qt(t,e?[]:ae(t.initialState.sorting??[]))}o(Vo,"table_resetSorting");function ds(t){t.atoms.sorting&&(t.options.autoResetAll??t.options.autoResetSorting??!1)&&Vo(t)}o(ds,"table_autoResetSorting");function zo(t){let e=t.table._rowModelFns.sortFns,n=t.table.getFilteredRowModel().flatRows.slice(0,10),l,r=!1;for(let s=0;s<n.length;s++){let a=n[s].getValue(t.id);if(Object.prototype.toString.call(a)==="[object Date]"){l="datetime";break}if(typeof a=="string"&&(r=!0,a.split(Do).length>1)){l="alphanumeric";break}}if(!l&&r&&(l="text"),l){let s=e?.[l];if(s||l==="alphanumeric"&&(s=e?.text),s)return s}return kt}o(zo,"column_getAutoSortFn");function $o(t){let e=t.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n<e.length;n++){let l=e[n].getValue(t.id);if(l!=null)return typeof l=="string"?"asc":"desc"}return"desc"}o($o,"column_getAutoSortDir");function Dn(t){let e=t.table._rowModelFns.sortFns;return gl(t.columnDef.sortFn)?t.columnDef.sortFn:t.columnDef.sortFn==="auto"?zo(t):e?.[t.columnDef.sortFn]??kt}o(Dn,"column_getSortFn");function Ho(t,e,n){let l=jo(t,n&&Wt(t)),r=typeof e<"u";Qt(t.table,s=>{let a=s.findIndex(g=>g.id===t.id),c=a===-1?void 0:s[a],u=[],i,d=r?e:l==="desc",m=!!(s.length&&Wt(t)&&n);return m?c?i="toggle":i="add":c?i="toggle":i="replace",i==="toggle"&&(r||l||(i="remove")),i==="add"?(u=[...s,{id:t.id,desc:d}],u.splice(0,u.length-(t.table.options.maxMultiSortColCount??Number.MAX_SAFE_INTEGER))):i==="toggle"?u=m?s.map(g=>g.id===t.id?{...g,desc:d}:g):[{id:t.id,desc:d}]:i==="remove"?u=m?s.filter(g=>g.id!==t.id):[]:u=[{id:t.id,desc:d}],u})}o(Ho,"column_toggleSorting");function Lo(t){return t.columnDef.sortDescFirst??t.table.options.sortDescFirst??$o(t)==="desc"?"desc":"asc"}o(Lo,"column_getFirstSortDir");function jo(t,e){let n=Lo(t),l=Bo(t);return l?l!==n&&(t.table.options.enableSortingRemoval??!0)&&(!e||(t.table.options.enableMultiRemove??!0))?!1:l==="desc"?"asc":"desc":n}o(jo,"column_getNextSortingOrder");function Xt(t){return(t.columnDef.enableSorting??!0)&&(t.table.options.enableSorting??!0)&&!!t.accessorFn}o(Xt,"column_getCanSort");function Wt(t){return t.columnDef.enableMultiSort??t.table.options.enableMultiSort??!!t.accessorFn}o(Wt,"column_getCanMultiSort");function Bo(t){let e=t.table.atoms.sorting?.get()?.find(n=>n.id===t.id);return e?e.desc?"desc":"asc":!1}o(Bo,"column_getIsSorted");function ms(t){return t.table.atoms.sorting?.get()?.findIndex(e=>e.id===t.id)??-1}o(ms,"column_getSortIndex");function gs(t){Qt(t.table,e=>e.length?e.filter(n=>n.id!==t.id):[])}o(gs,"column_clearSorting");function fs(t){let e=Xt(t);return n=>{e&&Ho(t,void 0,Wt(t)?t.table.options.isMultiSortEvent?.(n):!1)}}o(fs,"column_getToggleSortingHandler");function ps(){return t=>Mt({feature:"coreRowModelsFeature",table:t,fnName:"table.getCoreRowModel",memoDeps:o(()=>[t.options.data],"memoDeps"),fn:o(()=>hc(t,t.options.data),"fn"),onAfterUpdate:In(()=>{cs(t),Nn(t),ds(t),is(t)})})}o(ps,"createCoreRowModel");function bs(t,e,n,l=0,r){let s=[];for(let a=0;a<n.length;a++){let c=n[a],u=os(t,t.getRowId(c,a,r),c,a,l,void 0,r?.id);e.flatRows.push(u),e.rowsById[u.id]=u,s.push(u),t.options.getSubRows&&(u.originalSubRows=t.options.getSubRows(c,a),u.originalSubRows?.length&&(u.subRows=bs(t,e,u.originalSubRows,l+1,u)))}return s}o(bs,"accessRows");function hc(t,e){let n={rows:[],flatRows:[],rowsById:H()};return n.rows=bs(t,n,e),n}o(hc,"_createCoreRowModel");function hs(t){return t._rowModels.coreRowModel||(t._rowModels.coreRowModel=t.options.features.coreRowModel?.(t)??ps()(t)),t._rowModels.coreRowModel()}o(hs,"table_getCoreRowModel");function ws(t){return t.getCoreRowModel()}o(ws,"table_getPreFilteredRowModel");function xs(t){return t._rowModels.filteredRowModel||(t._rowModels.filteredRowModel=t.options.features.filteredRowModel?.(t)),t.options.manualFiltering||!t._rowModels.filteredRowModel?t.getPreFilteredRowModel():t._rowModels.filteredRowModel()}o(xs,"table_getFilteredRowModel");function Ss(t){return t.getFilteredRowModel()}o(Ss,"table_getPreGroupedRowModel");function _s(t){return t._rowModels.groupedRowModel||(t._rowModels.groupedRowModel=t.options.features.groupedRowModel?.(t)),t.options.manualGrouping||!t._rowModels.groupedRowModel?t.getPreGroupedRowModel():t._rowModels.groupedRowModel()}o(_s,"table_getGroupedRowModel");function Cs(t){return t.getGroupedRowModel()}o(Cs,"table_getPreSortedRowModel");function vs(t){return t._rowModels.sortedRowModel||(t._rowModels.sortedRowModel=t.options.features.sortedRowModel?.(t)),t.options.manualSorting||!t._rowModels.sortedRowModel?t.getPreSortedRowModel():t._rowModels.sortedRowModel()}o(vs,"table_getSortedRowModel");function ys(t){return t.getSortedRowModel()}o(ys,"table_getPreExpandedRowModel");function Rs(t){return t._rowModels.expandedRowModel||(t._rowModels.expandedRowModel=t.options.features.expandedRowModel?.(t)),t.options.manualExpanding||!t._rowModels.expandedRowModel?t.getPreExpandedRowModel():t._rowModels.expandedRowModel()}o(Rs,"table_getExpandedRowModel");function Is(t){return t.getExpandedRowModel()}o(Is,"table_getPrePaginatedRowModel");function Fs(t){return t._rowModels.paginatedRowModel||(t._rowModels.paginatedRowModel=t.options.features.paginatedRowModel?.(t)),t.options.manualPagination||!t._rowModels.paginatedRowModel?t.getPrePaginatedRowModel():t._rowModels.paginatedRowModel()}o(Fs,"table_getPaginatedRowModel");function Ms(t){return t.getPaginatedRowModel()}o(Ms,"table_getRowModel");var ks={constructTableAPIs:o(t=>{pe("coreRowModelsFeature",t,{table_getCoreRowModel:{fn:o(()=>hs(t),"fn")},table_getPreFilteredRowModel:{fn:o(()=>ws(t),"fn")},table_getFilteredRowModel:{fn:o(()=>xs(t),"fn")},table_getPreGroupedRowModel:{fn:o(()=>Ss(t),"fn")},table_getGroupedRowModel:{fn:o(()=>_s(t),"fn")},table_getPreSortedRowModel:{fn:o(()=>Cs(t),"fn")},table_getSortedRowModel:{fn:o(()=>vs(t),"fn")},table_getPreExpandedRowModel:{fn:o(()=>ys(t),"fn")},table_getExpandedRowModel:{fn:o(()=>Rs(t),"fn")},table_getPrePaginatedRowModel:{fn:o(()=>Is(t),"fn")},table_getPaginatedRowModel:{fn:o(()=>Fs(t),"fn")},table_getRowModel:{fn:o(()=>Ms(t),"fn")}})},"constructTableAPIs")};function wc(t){if(!t._cellPrototype){t._cellPrototype={table:t};let e=Object.values(t._features);for(let n=0;n<e.length;n++)e[n].assignCellPrototype?.(t._cellPrototype,t)}return t._cellPrototype}o(wc,"getCellPrototype");function Ps(t,e,n){let l=wc(n),r=Object.create(l);r.column=t,r.id=`${e.id}_${t.id}`,r.row=e;let s=n._cellInstanceInitFns;for(let a=0;a<s.length;a++)s[a](r);return r}o(Ps,"constructCell");function Ns(t){let e=t.table.getRowsInDisplayOrder(),n=t._displayIndexCache;return e[n]===t?n:-1}o(Ns,"row_getDisplayIndex");function Ds(t){let e=t.getPrePaginatedRowModel().rows;if(t.options.paginateExpandedRows===!1){let n=[],l=o(r=>{r._displayIndexCache=n.length,n.push(r),r.subRows.length&&r.getIsExpanded?.()&&r.subRows.forEach(l)},"handleRow");return e.forEach(l),n}for(let n=0;n<e.length;n++)e[n]._displayIndexCache=n;return e}o(Ds,"table_getRowsInDisplayOrder");function Ts(t,e){if(je(t._valuesCache,e))return t._valuesCache[e];let n=t.table.getColumn(e);if(n?.accessorFn)return t._valuesCache[e]=n.accessorFn(t.original,t.index),t._valuesCache[e]}o(Ts,"row_getValue");function As(t,e){if(je(t._uniqueValuesCache,e))return t._uniqueValuesCache[e];let n=t.table.getColumn(e);if(n?.accessorFn)return n.columnDef.getUniqueValues?(t._uniqueValuesCache[e]=n.columnDef.getUniqueValues(t.original,t.index),t._uniqueValuesCache[e]):(t._uniqueValuesCache[e]=[t.getValue(e)],t._uniqueValuesCache[e])}o(As,"row_getUniqueValues");function Os(t,e){return t.getValue(e)??t.table.options.renderFallbackValue}o(Os,"row_renderValue");function Es(t){return fl(t.subRows,e=>e.subRows)}o(Es,"row_getLeafRows");function Vs(t){let e=t.getCoreRowModel().flatRows,n=0;for(let l=0;l<e.length;l++)n=Math.max(n,e[l].depth);return n}o(Vs,"table_getMaxSubRowDepth");function zs(t){if(t.parentId)return t.table.getCoreRowModel().rowsById[t.parentId]??t.table.getRow(t.parentId,!0)}o(zs,"row_getParentRow");function $s(t){let e=[],n=t;for(;;){let l=n.getParentRow();if(!l)break;e.push(l),n=l}return e.reverse()}o($s,"row_getParentRows");function Hs(t){let e=t.table.getAllLeafColumns(),n=t._cellsCache;n||(n=t._cellsCache=new WeakMap);let l=new Array(e.length);for(let r=0;r<e.length;r++){let s=e[r],a=n.get(s);a||(a=Ps(s,t,t.table),n.set(s,a)),l[r]=a}return l}o(Hs,"row_getAllCells");function Ls(t){let e=H(),n=t.getAllCells();for(let l=0;l<n.length;l++){let r=n[l];e[r.column.id]=r}return e}o(Ls,"row_getAllCellsByColumnId");function js(t,e,n,l){return e.options.getRowId?.(t,n,l)??(l?`${l.id}.${n}`:String(n))}o(js,"table_getRowId");function Bs(t,e,n){let l=(n?t.getPrePaginatedRowModel():t.getRowModel()).rowsById[e];if(!l&&(l=t.getCoreRowModel().rowsById[e],!l))throw new Error;return l}o(Bs,"table_getRow");var Gs={assignRowPrototype:o((t,e)=>{ue("coreRowsFeature",t,e,{row_getDisplayIndex:{fn:o(n=>Ns(n),"fn")},row_getAllCellsByColumnId:{fn:o(n=>Ls(n),"fn"),memoDeps:o(n=>[n.getAllCells()],"memoDeps")},row_getAllCells:{fn:o(n=>Hs(n),"fn"),memoDeps:o(n=>[n.table.getAllLeafColumns()],"memoDeps")},row_getLeafRows:{fn:o(n=>Es(n),"fn"),memoDeps:o(n=>[n.subRows],"memoDeps")},row_getParentRow:{fn:o(n=>zs(n),"fn")},row_getParentRows:{fn:o(n=>$s(n),"fn")},row_getUniqueValues:{fn:o((n,l)=>As(n,l),"fn")},row_getValue:{fn:o((n,l)=>Ts(n,l),"fn")},row_renderValue:{fn:o((n,l)=>Os(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{pe("coreRowsFeature",t,{table_getRowsInDisplayOrder:{fn:o(()=>Ds(t),"fn"),memoDeps:o(()=>[t.getPrePaginatedRowModel().rows,t.options.paginateExpandedRows,t.options.paginateExpandedRows===!1?t.atoms.expanded?.get():void 0],"memoDeps")},table_getRowId:{fn:o((e,n,l)=>js(e,t,n,l),"fn")},table_getRow:{fn:o((e,n)=>Bs(t,e,n),"fn")},table_getMaxSubRowDepth:{fn:o(()=>Vs(t),"fn"),memoDeps:o(()=>[t.getCoreRowModel()],"memoDeps")}})},"constructTableAPIs")};function Tn(t,e,n=(l,r)=>l===r){let l=e===void 0?t.options.state:e;t._reactivity.batch(()=>{if(l)for(let r in l){let s=t.baseAtoms[r];if(!s)continue;let a=l[r],c=a===void 0?t.initialState[r]:a;n(t._reactivity.untrack(()=>s.get()),c)||s.set(()=>c)}})}o(Tn,"table_syncExternalStateToBaseAtoms");function An(t,e,n=(l,r)=>l===r){t._reactivity.batch(()=>{Tn(t,e,n),t._reactivity.commit?.()})}o(An,"table_publishExternalState");function Go(t){let e=ae(t.initialState);t._reactivity.batch(()=>{let l=Object.keys(e);for(let r=0;r<l.length;r++){let s=l[r];t.baseAtoms[s].set(e[s])}});let n=Object.values(t._features);for(let l=0;l<n.length;l++)n[l].resetTableInstanceData?.(t)}o(Go,"table_reset");function qs(t,e){let{features:n,atoms:l,initialState:r}=t.options;if(!t.options.mergeOptions)return{...t.options,...e,features:n,atoms:l,initialState:r};let s=t.options.mergeOptions(t.options,e),a={...Object.getOwnPropertyDescriptors(s)};return Object.defineProperties(Object.create(Object.getPrototypeOf(s)),{...a,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:l,enumerable:!0,configurable:!0,writable:!0},initialState:{value:r,enumerable:!0,configurable:!0,writable:!0}})}o(qs,"table_mergeOptions");function Yt(t,e,n){let l=qs(t,Ft(e,t.options));t.optionsStore?t.optionsStore.set(()=>l):t.options=l,n?.syncExternalState!==!1&&An(t,l.state??null)}o(Yt,"table_setOptions");var Ks={constructTableAPIs:o(t=>{pe("coreTablesFeature",t,{table_reset:{fn:o(()=>Go(t),"fn")},table_setOptions:{fn:o(e=>Yt(t,e),"fn")}})},"constructTableAPIs")};var Us={coreCellsFeature:xl,coreColumnsFeature:Jl,coreHeadersFeature:ns,coreRowModelsFeature:ks,coreRowsFeature:Gs,coreTablesFeature:Ks};function Js(t,e={}){return Object.values(t).forEach(n=>{e=n.getInitialState?.(e)??e}),ae(e)}o(Js,"getInitialTableState");function qo(t){let e=t.features.coreReactivityFeature,{aggregationFns:n,columnMeta:l,coreRowModel:r,expandedRowModel:s,facetedMinMaxValues:a,facetedRowModel:c,facetedUniqueValues:u,filterFns:i,filterMeta:d,filteredRowModel:m,groupedRowModel:g,paginatedRowModel:b,sortFns:f,sortedRowModel:h,tableMeta:w,..._}=t.features,S={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...Us,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:e,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:i,sortFns:f},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(S._features),I={...y.reduce((R,x)=>Object.assign(R,x.getDefaultTableOptions?.(S)),{}),...t};if(e.wrapExternalAtoms&&I.atoms)for(let[R,x]of Object.entries(I.atoms)){let v=x,M=e.createWritableAtom(v.get(),{debugName:`externalAtom/${R}`});I.atoms[R]=M;let F=!1,P=v.subscribe(N=>{F||M.set(N)}),k=M.subscribe(N=>{F=!0,v.set(N),F=!1});e.addSubscription(P),e.addSubscription(k)}e.createOptionsStore?(S.optionsStore=e.createWritableAtom(I,{debugName:"table/optionsStore"}),Object.defineProperty(S,"options",{configurable:!0,enumerable:!0,get(){return S.optionsStore.get()},set(R){S.optionsStore.set(()=>R)}})):S.options=I,S.initialState=Js(S._features,S.options.initialState);let C=Object.keys(S.initialState);for(let R=0;R<C.length;R++){let x=C[R];S.baseAtoms[x]=e.createWritableAtom(S.initialState[x],{debugName:`table/baseAtoms/${x}`}),S.atoms[x]=e.createReadonlyAtom(()=>{let v=S.options,M=v.atoms?.[x],F=M?M.get():S.baseAtoms[x].get();if(M)return F;let P=v.state;if(P&&je(P,x)){let k=P[x];return k===void 0?S.initialState[x]:k}return F},{debugName:`table/atoms/${x}`})}Tn(S),S.store=il(e.createReadonlyAtom(()=>{let R={};for(let x=0;x<C.length;x++){let v=C[x];R[v]=S.atoms[v].get()}return R},{compare:lt,debugName:"table/store"}));for(let R=0;R<y.length;R++){let x=y[R];x.initTableInstanceData?.(S),x.initCellInstanceData&&S._cellInstanceInitFns.push(x.initCellInstanceData.bind(x)),x.initColumnInstanceData&&S._columnInstanceInitFns.push(x.initColumnInstanceData.bind(x)),x.initHeaderGroupInstanceData&&S._headerGroupInstanceInitFns.push(x.initHeaderGroupInstanceData.bind(x)),x.initHeaderInstanceData&&S._headerInstanceInitFns.push(x.initHeaderInstanceData.bind(x)),x.initRowInstanceData&&S._rowInstanceInitFns.push(x.initRowInstanceData.bind(x)),x.constructTableAPIs?.(S)}return S}o(qo,"constructTable");var Ko={getInitialState:o(t=>({columnOrder:Tl(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnOrderChange:Be("columnOrder",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ue("columnOrderingFeature",t,e,{column_getIndex:{fn:o((n,l)=>Al(n,l),"fn")},column_getIsFirstColumn:{fn:o((n,l)=>Ol(n,l),"fn")},column_getIsLastColumn:{fn:o((n,l)=>El(n,l),"fn")}})},"assignColumnPrototype"),constructTableAPIs:o(t=>{pe("columnOrderingFeature",t,{table_getColumnIndexes:{fn:o(()=>ko(t),"fn"),memoDeps:o(()=>[t.options.columns,t.atoms.columnOrder?.get(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")},table_setColumnOrder:{fn:o(e=>Po(t,e),"fn")},table_resetColumnOrder:{fn:o(e=>Vl(t,e),"fn")},table_getOrderColumnsFn:{fn:o(()=>Jt(t),"fn"),memoDeps:o(()=>[t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")}})},"constructTableAPIs")};function Ws(){return H()}o(Ws,"getDefaultColumnSizingState");function Uo(){return{size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER}}o(Uo,"getDefaultColumnSizingColumnDef");function Pt(t){let e=Uo(),n=t.table.atoms.columnSizing?.get(),l=n&&je(n,t.id)?n[t.id]:void 0;return Math.min(Math.max(t.columnDef.minSize??e.minSize,l??t.columnDef.size??e.size),t.columnDef.maxSize??e.maxSize)}o(Pt,"column_getSize");function On(t){let e=H(),n=H(),l=new Array(t.length),r=0;for(let a=0;a<t.length;a++){let c=t[a],u=V(c,"getSize",Pt);l[a]=u,e[c.id]=r,r+=u}let s=0;for(let a=t.length-1;a>=0;a--)n[t[a].id]=s,s+=l[a];return{starts:e,afters:n}}o(On,"buildColumnOffsets");function En(t){return{all:On(Ge(t)),center:On(Ge(t,"center")),start:On(Ge(t,"start")),end:On(Ge(t,"end"))}}o(En,"table_getColumnOffsets");function Qs(t){return t==="start"?"start":t==="end"?"end":t==="center"?"center":"all"}o(Qs,"toOffsetsKey");function Xs(t,e){return V(t.table,"getColumnOffsets",En)[Qs(e)].starts[t.id]??0}o(Xs,"column_getStart");function Ys(t,e){return V(t.table,"getColumnOffsets",En)[Qs(e)].afters[t.id]??0}o(Ys,"column_getAfter");function Zs(t){Nt(t.table,e=>{let n=H(),l=Object.keys(e);for(let r=0;r<l.length;r++){let s=l[r];s!==t.id&&(n[s]=e[s])}return n})}o(Zs,"column_resetSize");function ea(t){if(!t.subHeaders.length)return Pt(t.column);let e=0;for(let n=0;n<t.subHeaders.length;n++)e+=ea(t.subHeaders[n]);return e}o(ea,"sumHeaderSize");function st(t){return ea(t)}o(st,"header_getSize");function Jo(t){if(t.index>0){let e=t.headerGroup?.headers[t.index-1];if(e)return V(e,"getStart",Jo)+V(e,"getSize",st)}return 0}o(Jo,"header_getStart");function Nt(t,e){t.options.onColumnSizingChange?.(e)}o(Nt,"table_setColumnSizing");function ta(t,e){Nt(t,e?H():Object.assign(H(),ae(t.initialState.columnSizing??{})))}o(ta,"table_resetColumnSizing");function na(t){return t.getHeaderGroups()[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(na,"table_getTotalSize");function oa(t){return V(t,"getStartHeaderGroups",Sl)[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(oa,"table_getStartTotalSize");function ra(t){return V(t,"getCenterHeaderGroups",Cl)[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(ra,"table_getCenterTotalSize");function la(t){return V(t,"getEndHeaderGroups",_l)[0]?.headers.reduce((e,n)=>e+st(n),0)??0}o(la,"table_getEndTotalSize");function zn(){return{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}}o(zn,"getDefaultColumnResizingState");function Qo(t){return(t.columnDef.enableResizing??!0)&&(t.table.options.enableColumnResizing??!0)}o(Qo,"column_getCanResize");function sa(t){return t.table.atoms.columnResizing?.get()?.isResizingColumn===t.id}o(sa,"column_getIsResizing");function aa(t,e){let n=t.table.getColumn(t.column.id),l=Qo(n);return r=>{if(!l||Wo(r)&&r.touches.length>1)return;let s=st(t),a=t.getLeafHeaders().map(C=>[C.column.id,Pt(C.column)]),c=Wo(r)?Math.round(r.touches[0].clientX):r.clientX,u=H(),i=o((C,R)=>{if(typeof R!="number")return;let x=n.table,v=x.options.columnResizeMode==="onChange"||C==="end";x._reactivity.batch(()=>{Dt(x,M=>{let F=x.options.columnResizeDirection==="rtl"?-1:1,P=(R-(M.startOffset??0))*F,k=M.startSize??0,N=Math.max(k>0?P/k:0,-.999999);if(v){let T=M.columnSizingStart;for(let z=0;z<T.length;z++){let A=T[z],$=A[1];u[A[0]]=Math.round(Math.max($>0?$+$*N:P/T.length,0)*100)/100}}return{...M,deltaOffset:P,deltaPercentage:N}}),v&&Nt(x,M=>Object.assign(H(),M,u))})},"updateOffset"),d=null,m=!1,g,b=o(()=>{m?(m=!1,i("move",g),d=requestAnimationFrame(b)):d=null},"flushMove"),f=o(C=>{if(g=C,typeof requestAnimationFrame!="function"){i("move",C);return}if(d!==null){m=!0;return}i("move",C),d=requestAnimationFrame(b)},"onMove"),h=o(C=>{d!==null&&(cancelAnimationFrame(d),d=null,m=!1),n.table._reactivity.batch(()=>{i("end",C??g),Dt(n.table,R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))})},"onEnd"),w=e||(typeof document<"u"?document:null),_={moveHandler:o(C=>f(C.clientX),"moveHandler"),upHandler:o(C=>{w?.removeEventListener("mousemove",_.moveHandler),w?.removeEventListener("mouseup",_.upHandler),h(C.clientX)},"upHandler")},S={moveHandler:o(C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),f(C.touches[0].clientX),!1),"moveHandler"),upHandler:o(C=>{y(),C.cancelable&&(C.preventDefault(),C.stopPropagation()),h(C.touches[0]?.clientX)},"upHandler"),cancelHandler:o(()=>{y(),h()},"cancelHandler")},y=o(()=>{w?.removeEventListener("touchmove",S.moveHandler),w?.removeEventListener("touchend",S.upHandler),w?.removeEventListener("touchcancel",S.cancelHandler)},"removeTouchEvents"),I=xc()?{passive:!1}:!1;Wo(r)?(w?.addEventListener("touchmove",S.moveHandler,I),w?.addEventListener("touchend",S.upHandler,I),w?.addEventListener("touchcancel",S.cancelHandler,I)):(w?.addEventListener("mousemove",_.moveHandler,I),w?.addEventListener("mouseup",_.upHandler,I)),Dt(n.table,C=>({...C,startOffset:c,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:n.id}))}}o(aa,"header_getResizeHandler");function Dt(t,e){t.options.onColumnResizingChange?.(e)}o(Dt,"table_setColumnResizing");function ia(t,e){Dt(t,e?zn():ae(t.initialState.columnResizing??zn()))}o(ia,"table_resetHeaderSizeInfo");var Vn=null;function xc(){if(typeof Vn=="boolean")return Vn;let t=!1;try{let e={get passive(){return t=!0,!1}},n=o(()=>{},"noop");window.addEventListener("test",n,e),window.removeEventListener("test",n)}catch{t=!1}return Vn=t,Vn}o(xc,"passiveEventSupported");function Wo(t){return t.type==="touchstart"}o(Wo,"isTouchStartEvent");var Xo={getInitialState:o(t=>({columnResizing:zn(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnResizingChange:Be("columnResizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ue("columnResizingFeature",t,e,{column_getCanResize:{fn:o(n=>Qo(n),"fn")},column_getIsResizing:{fn:o(n=>sa(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{ue("columnResizingFeature",t,e,{header_getResizeHandler:{fn:o((n,l)=>aa(n,l),"fn")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{pe("columnResizingFeature",t,{table_setColumnResizing:{fn:o(e=>Dt(t,e),"fn")},table_resetHeaderSizeInfo:{fn:o(e=>ia(t,e),"fn")}})},"constructTableAPIs")};var Yo={getInitialState:o(t=>({columnSizing:Ws(),...t}),"getInitialState"),getDefaultColumnDef:o(()=>Uo(),"getDefaultColumnDef"),getDefaultTableOptions:o(t=>({onColumnSizingChange:Be("columnSizing",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ue("columnSizingFeature",t,e,{column_getSize:{fn:o(n=>Pt(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnSizing?.get()?.[n.id]],"memoDeps")},column_getStart:{fn:o((n,l)=>Xs(n,l),"fn")},column_getAfter:{fn:o((n,l)=>Ys(n,l),"fn")},column_resetSize:{fn:o(n=>Zs(n),"fn")}})},"assignColumnPrototype"),assignHeaderPrototype:o((t,e)=>{ue("columnSizingFeature",t,e,{header_getSize:{fn:o(n=>st(n),"fn"),memoDeps:o(n=>[e.options.columns,n.column.columns.length>0?e.atoms.columnSizing?.get():e.atoms.columnSizing?.get()?.[n.column.id]],"memoDeps")},header_getStart:{fn:o(n=>Jo(n),"fn"),memoDeps:o(()=>[e.options.columns,e.atoms.columnSizing?.get(),e.atoms.columnOrder?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.atoms.grouping?.get(),e.options.groupedColumnMode],"memoDeps")}})},"assignHeaderPrototype"),constructTableAPIs:o(t=>{pe("columnSizingFeature",t,{table_getColumnOffsets:{fn:o(()=>En(t),"fn"),memoDeps:o(()=>[t.options.columns,t.atoms.columnSizing?.get(),t.atoms.columnOrder?.get(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode],"memoDeps")},table_setColumnSizing:{fn:o(e=>Nt(t,e),"fn")},table_resetColumnSizing:{fn:o(e=>ta(t,e),"fn")},table_getTotalSize:{fn:o(()=>na(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getStartTotalSize:{fn:o(()=>oa(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getCenterTotalSize:{fn:o(()=>ra(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")},table_getEndTotalSize:{fn:o(()=>la(t),"fn"),memoDeps:o(()=>[t.atoms.columnSizing?.get(),t.getHeaderGroups()],"memoDeps")}})},"constructTableAPIs")};var Zo={getInitialState:o(t=>({columnVisibility:vl(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onColumnVisibilityChange:Be("columnVisibility",t)}),"getDefaultTableOptions"),assignColumnPrototype:o((t,e)=>{ue("columnVisibilityFeature",t,e,{column_getIsVisible:{fn:o(n=>de(n),"fn"),memoDeps:o(n=>[e.options.columns,e.atoms.columnVisibility?.get(),n.columns],"memoDeps")},column_getCanHide:{fn:o(n=>Kt(n),"fn")},column_getToggleVisibilityHandler:{fn:o(n=>yl(n),"fn")},column_toggleVisibility:{fn:o((n,l)=>Io(n,l),"fn")}})},"assignColumnPrototype"),assignRowPrototype:o((t,e)=>{ue("columnVisibilityFeature",t,e,{row_getVisibleCells:{fn:o(n=>Ro(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get()],"memoDeps")},row_getVisibleCellsByColumnId:{fn:o(n=>Fn(n),"fn"),memoDeps:o(n=>[n.getAllCells(),e.atoms.columnVisibility?.get()],"memoDeps")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{pe("columnVisibilityFeature",t,{table_getVisibleFlatColumns:{fn:o(()=>Rl(t),"fn"),memoDeps:o(()=>[t.atoms.columnVisibility?.get(),t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_getVisibleLeafColumns:{fn:o(()=>xt(t),"fn"),memoDeps:o(()=>[t.atoms.columnVisibility?.get(),t.atoms.columnOrder?.get(),t.atoms.grouping?.get(),t.options.columns,t.options.groupedColumnMode],"memoDeps")},table_setColumnVisibility:{fn:o(e=>Ut(t,e),"fn")},table_resetColumnVisibility:{fn:o(e=>Il(t,e),"fn")},table_toggleAllColumnsVisible:{fn:o(e=>Fo(t,e),"fn")},table_getIsAllColumnsVisible:{fn:o(()=>Mo(t),"fn")},table_getIsSomeColumnsVisible:{fn:o(()=>Fl(t),"fn")},table_getToggleAllColumnsVisibilityHandler:{fn:o(()=>Ml(t),"fn")}})},"constructTableAPIs")};function ca(){return H()}o(ca,"getDefaultRowSelectionState");function Ct(t,e){t.options.onRowSelectionChange?.(e)}o(Ct,"table_setRowSelection");function ua(t,e){t._lastSelectedRowId=null,Ct(t,e?H():Object.assign(H(),ae(t.initialState.rowSelection??{})))}o(ua,"table_resetRowSelection");function er(t,e,n){t._lastSelectedRowId=null,Ct(t,l=>{if(e=typeof e<"u"?e:!V(t,"getIsAllRowsSelected",or),n?.deselectAll&&!e)return H();let r=Object.assign(H(),l),s=t.getPreGroupedRowModel().flatRows;if(e){let a=new Map;s.forEach(c=>{$n(c,a)&&(r[c.id]=!0)})}else s.forEach(a=>{Ye(a)&&delete r[a.id]});return r})}o(er,"table_toggleAllRowsSelected");function tr(t,e,n){t._lastSelectedRowId=null,Ct(t,l=>{let r=typeof e<"u"?e:!V(t,"getIsAllPageRowsSelected",rr);if(n?.deselectAll&&!r)return H();let s=Object.assign(H(),l);return t.getRowModel().rows.forEach(a=>{jn(s,a.id,r,!0,t,!0)}),s})}o(tr,"table_toggleAllPageRowsSelected");function da(t){return t.getCoreRowModel()}o(da,"table_getPreSelectedRowModel");function ma(t){let e=t.getCoreRowModel();return V(t,"getIsSomeRowsSelected",Zt)?ar(e,t):{rows:[],flatRows:[],rowsById:H()}}o(ma,"table_getSelectedRowModel");function ga(t){let e=t.getFilteredRowModel();return V(t,"getIsSomeRowsSelected",Zt)?ar(e,t):{rows:[],flatRows:[],rowsById:H()}}o(ga,"table_getFilteredSelectedRowModel");function fa(t){let e=t.getSortedRowModel();return V(t,"getIsSomeRowsSelected",Zt)?ar(e,t):{rows:[],flatRows:[],rowsById:H()}}o(fa,"table_getGroupedSelectedRowModel");function nr(t){return Object.keys(t.atoms.rowSelection?.get()??{})}o(nr,"table_getSelectedRowIds");function or(t){let e=t.getFilteredRowModel().flatRows,n=t.atoms.rowSelection?.get()??{},l=!!(e.length&&Object.keys(n).length);if(l){let r=new Map;e.some(s=>!en(s,n)&&$n(s,r))&&(l=!1)}return l}o(or,"table_getIsAllRowsSelected");function rr(t){let e=t.getPaginatedRowModel().flatRows,n=t.atoms.rowSelection?.get()??{},l=new Map,r=!1;for(let s=0;s<e.length;s++){let a=e[s];if(en(a,n))!r&&$n(a,l)&&(r=!0);else if($n(a,l))return!1}return r}o(rr,"table_getIsAllPageRowsSelected");function Zt(t){return V(t,"getSelectedRowIds",nr).length>0}o(Zt,"table_getIsSomeRowsSelected");function pa(t){return t.getPaginatedRowModel().flatRows.filter(e=>Ye(e)).some(e=>Hn(e)||V(e,"getIsSomeSelected",sr))}o(pa,"table_getIsSomePageRowsSelected");function ba(t){return e=>{er(t,e.target.checked)}}o(ba,"table_getToggleAllRowsSelectedHandler");function ha(t){return e=>{tr(t,e.target.checked)}}o(ha,"table_getToggleAllPageRowsSelectedHandler");function lr(t,e,n){let l=Hn(t);Ct(t.table,r=>{e=typeof e<"u"?e:!l;let s=Object.assign(H(),r);return jn(s,t.id,e,(n?.selectChildren??!0)&&mt(t),t.table),!e&&n?.deselectParents&&Sa(s,t),s})}o(lr,"row_toggleSelected");function Hn(t){return en(t,t.table.atoms.rowSelection?.get()??{})}o(Hn,"row_getIsSelected");function sr(t){return ir(t)==="some"}o(sr,"row_getIsSomeSelected");function wa(t){return ir(t)==="all"}o(wa,"row_getIsAllSubRowsSelected");function Ye(t){let e=t.table.options;return typeof e.enableRowSelection=="function"?e.enableRowSelection(t):e.enableRowSelection??!0}o(Ye,"row_getCanSelect");function Ln(t){let e=t.table.options;return typeof e.enableSubRowSelection=="function"?e.enableSubRowSelection(t):e.enableSubRowSelection??!0}o(Ln,"row_getCanSelectSubRows");function mt(t){let e=t.table.options;return typeof e.enableMultiRowSelection=="function"?e.enableMultiRowSelection(t):e.enableMultiRowSelection??!0}o(mt,"row_getCanMultiSelect");function xa(t,e){let n=Ye(t);return l=>{if(!n)return;let r=l,s=t.table,a=r.target.checked,c=s._lastSelectedRowId;(!(s.options.enableRowRangeSelection!==!1&&c!==null&&mt(t)&&(s.options.isRowRangeSelectionEvent?.(l)??!1))||!Sc(t,c,a,e))&&lr(t,a,e),s._lastSelectedRowId=t.id}}o(xa,"row_getToggleSelectedHandler");function Sc(t,e,n,l){let r=l?.selectChildren??!0,s=t.table,a=s.getRowsInDisplayOrder(),c=s.getPrePaginatedRowModel().rowsById[e]??s.getCoreRowModel().rowsById[e];if(!c)return!1;let u=c.getDisplayIndex(),i=t.getDisplayIndex(),d=a[u],m=a[i];if(u<0||i<0||u>=a.length||i>=a.length||d?.id!==c.id||m?.id!==t.id||!mt(c)||!mt(t))return!1;let g=Math.min(u,i),b=Math.max(u,i);return Ct(s,f=>{let h=Object.assign(H(),f);for(let w=g;w<=b;w++){let _=a[w];!Ye(_)||!mt(_)||(jn(h,_.id,n,r,s),!n&&l?.deselectParents&&Sa(h,_))}return h}),!0}o(Sc,"selectRowRange");function jn(t,e,n,l,r,s){let a=r.getRow(e,!0);n?(mt(a)||Object.keys(t).forEach(c=>delete t[c]),Ye(a)&&(t[e]=!0)):(!s||Ye(a))&&delete t[e],l&&a.subRows.length&&Ln(a)&&a.subRows.forEach(c=>jn(t,c.id,n,l,r,s))}o(jn,"mutateRowIsSelected");function $n(t,e){if(!Ye(t))return!1;let n=t.table;if(n.options.enableSubRowSelection===!0)return!0;let l=t.parentId;if(l===void 0)return!0;let r=e.get(l);if(r!==void 0)return r;let s=n.getCoreRowModel().rowsById,a=[],c=!0,u=l;for(;u!==void 0;){let i=e.get(u);if(i!==void 0){c=i;break}a.push(u);let d=s[u]??n.getRow(u,!0);if(!Ln(d)){c=!1;break}u=d.parentId}return a.forEach(i=>e.set(i,c)),c}o($n,"isRowSelectableInSelectAll");function Sa(t,e){let n=e.table.getCoreRowModel().rowsById,l=e.parentId;for(;l!==void 0;)delete t[l],l=(n[l]??e.table.getRow(l,!0)).parentId}o(Sa,"pruneAncestorRowIds");function _a(t,e,n,l){let r=[];for(let s=0;s<t.length;s++){let a=t[s],c=en(a,e);if(c&&(n.push(a),l[a.id]=a),a.subRows.length){let u=_a(a.subRows,e,n,l);if(c){let i=Object.create(Object.getPrototypeOf(a));Rn(i,a),i.subRows=u,r.push(i)}}else c&&r.push(a)}return r}o(_a,"selectRowsRecursively");function ar(t,e){let n=[],l=H(),r=e.atoms.rowSelection?.get()??{};return{rows:_a(t.rows,r,n,l),flatRows:n,rowsById:l}}o(ar,"selectRowsFn");function en(t,e){return!!(je(e,t.id)&&e[t.id])}o(en,"isRowSelected");function ir(t){if(!t.subRows.length)return!1;let e=t.table.atoms.rowSelection?.get()??{},n=!1,l=!0,r=!1;for(let s=0;s<t.subRows.length;s++){let a=t.subRows[s];if(n&&!l)break;if(Ye(a)&&(r=!0,en(a,e)?n=!0:l=!1),a.subRows.length){let c=ir(a);c==="all"?(n=!0,r=!0):c==="some"?(n=!0,l=!1,r=!0):l=!1}}return r?l?"all":n?"some":!1:!1}o(ir,"isSubRowSelected");var cr={initTableInstanceData:o(t=>{t._lastSelectedRowId=null},"initTableInstanceData"),resetTableInstanceData:o(t=>{t._lastSelectedRowId=null},"resetTableInstanceData"),getInitialState:o(t=>({rowSelection:ca(),...t}),"getInitialState"),getDefaultTableOptions:o(t=>({onRowSelectionChange:Be("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableRowRangeSelection:!0,enableSubRowSelection:!0,isRowRangeSelectionEvent:o(e=>{let n=e;return!!(n.shiftKey||n.nativeEvent?.shiftKey)},"isRowRangeSelectionEvent")}),"getDefaultTableOptions"),assignRowPrototype:o((t,e)=>{ue("rowSelectionFeature",t,e,{row_toggleSelected:{fn:o((n,l,r)=>lr(n,l,r),"fn")},row_getIsSelected:{fn:o(n=>Hn(n),"fn")},row_getIsSomeSelected:{fn:o(n=>sr(n),"fn"),memoDeps:o(n=>[n.subRows,n.table.atoms.rowSelection?.get(),n.table.options.enableRowSelection],"memoDeps")},row_getIsAllSubRowsSelected:{fn:o(n=>wa(n),"fn"),memoDeps:o(n=>[n.subRows,n.table.atoms.rowSelection?.get(),n.table.options.enableRowSelection],"memoDeps")},row_getCanSelect:{fn:o(n=>Ye(n),"fn")},row_getCanSelectSubRows:{fn:o(n=>Ln(n),"fn")},row_getCanMultiSelect:{fn:o(n=>mt(n),"fn")},row_getToggleSelectedHandler:{fn:o((n,l)=>xa(n,l),"fn")}})},"assignRowPrototype"),constructTableAPIs:o(t=>{pe("rowSelectionFeature",t,{table_setRowSelection:{fn:o(e=>Ct(t,e),"fn")},table_resetRowSelection:{fn:o(e=>ua(t,e),"fn")},table_toggleAllRowsSelected:{fn:o((e,n)=>er(t,e,n),"fn")},table_toggleAllPageRowsSelected:{fn:o((e,n)=>tr(t,e,n),"fn")},table_getPreSelectedRowModel:{fn:o(()=>da(t),"fn")},table_getSelectedRowModel:{fn:o(()=>ma(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getCoreRowModel()],"memoDeps")},table_getFilteredSelectedRowModel:{fn:o(()=>ga(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel()],"memoDeps")},table_getGroupedSelectedRowModel:{fn:o(()=>fa(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getSortedRowModel()],"memoDeps")},table_getSelectedRowIds:{fn:o(()=>nr(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsAllRowsSelected:{fn:o(()=>or(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getFilteredRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsAllPageRowsSelected:{fn:o(()=>rr(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection,t.options.enableSubRowSelection],"memoDeps")},table_getIsSomeRowsSelected:{fn:o(()=>Zt(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get()],"memoDeps")},table_getIsSomePageRowsSelected:{fn:o(()=>pa(t),"fn"),memoDeps:o(()=>[t.atoms.rowSelection?.get(),t.getPaginatedRowModel(),t.options.enableRowSelection],"memoDeps")},table_getToggleAllRowsSelectedHandler:{fn:o(()=>ba(t),"fn")},table_getToggleAllPageRowsSelectedHandler:{fn:o(()=>ha(t),"fn")}})},"constructTableAPIs")};var ur={getInitialState(t){return{sorting:us(),...t}},getDefaultColumnDef(){return{sortFn:"auto",sortUndefined:1}},getDefaultTableOptions(t){return{autoResetSorting:!1,onSortingChange:Be("sorting",t),isMultiSortEvent:o(e=>e.shiftKey,"isMultiSortEvent")}},assignColumnPrototype(t,e){ue("rowSortingFeature",t,e,{column_getAutoSortFn:{fn:o(n=>zo(n),"fn")},column_getAutoSortDir:{fn:o(n=>$o(n),"fn")},column_getSortFn:{fn:o(n=>Dn(n),"fn")},column_toggleSorting:{fn:o((n,l,r)=>Ho(n,l,r),"fn")},column_getFirstSortDir:{fn:o(n=>Lo(n),"fn")},column_getNextSortingOrder:{fn:o((n,l)=>jo(n,l),"fn")},column_getCanSort:{fn:o(n=>Xt(n),"fn")},column_getCanMultiSort:{fn:o(n=>Wt(n),"fn")},column_getIsSorted:{fn:o(n=>Bo(n),"fn")},column_getSortIndex:{fn:o(n=>ms(n),"fn")},column_clearSorting:{fn:o(n=>gs(n),"fn")},column_getToggleSortingHandler:{fn:o(n=>fs(n),"fn")}})},constructTableAPIs(t){pe("rowSortingFeature",t,{table_setSorting:{fn:o(e=>Qt(t,e),"fn")},table_resetSorting:{fn:o(e=>Vo(t,e),"fn")}})}};function dr(){return t=>{let e=t;return Mt({feature:"rowSortingFeature",table:e,fnName:"table.getSortedRowModel",memoDeps:o(()=>[e.atoms.sorting?.get(),e.getPreSortedRowModel()],"memoDeps"),fn:o(()=>_c(e),"fn"),onAfterUpdate:In(()=>Nn(e))})}}o(dr,"createSortedRowModel");function _c(t){let e=t.getPreSortedRowModel(),n=t.atoms.sorting?.get();if(!e.rows.length||!n?.length)return e;let l=[],r=n.filter(u=>{let i=t.getColumn(u.id);return i?Xt(i):!1});if(!r.length)return e;let s=[];for(let u=0;u<r.length;u++){let i=r[u],d=t.getColumn(i.id);d&&s.push({id:i.id,desc:i.desc,sortUndefined:d.columnDef.sortUndefined,invertSorting:d.columnDef.invertSorting,sortFn:Dn(d)})}let a=o((u,i)=>{for(let d=0;d<s.length;d++){let m=s[d],g=m.sortUndefined,b=m.desc,f=0;if(g){let h=u.getValue(m.id),w=i.getValue(m.id),_=h===void 0,S=w===void 0;if(_&&S)continue;if(_||S){if(g==="first")return _?-1:1;if(g==="last")return _?1:-1;f=_?g:-g}}if(f===0&&(f=m.sortFn(u,i,m.id)),f!==0)return b&&(f*=-1),m.invertSorting&&(f*=-1),f}return u.index-i.index},"compareRows"),c=o(u=>{let i=u.slice();i.sort(a);let d=!1;for(let m=0;m<i.length;m++){let g=i[m];g!==u[m]&&(d=!0);let b=l.length;if(l.push(g),g.subRows.length){let f=c(g.subRows);if(f.changed){let h=Object.create(Object.getPrototypeOf(g));Rn(h,g),h.subRows=f.rows,i[m]=h,l[b]=h,d=!0}}}return{rows:i,changed:d}},"sortData");return{rows:c(e.rows).rows,flatRows:l,rowsById:e.rowsById}}o(_c,"_createSortedRowModel");var gt=Re(ut(),1);var Cc=typeof window>"u"?gt.useEffect:gt.useLayoutEffect;function mr(t,e){let[{table:n,rootSource:l}]=(0,gt.useState)(()=>{let u=qo({...t,features:{coreReactivityFeature:cl(),...t.features}});return u.Subscribe=(i=>al({...i,source:i.source??u.store})),u.FlexRender=fo,{table:u,rootSource:vo(u.store,lt)}}),r=n;Yt(r,u=>({...u,...t}),{syncExternalState:!1});let s=r.options.state,a=l.get(),c=qt(l,e,{compare:lt});return Cc(()=>{l.markCommitted(a),An(r,s??null,lt)}),(0,gt.useMemo)(()=>({...n,options:t,state:c}),[n,t,c])}o(mr,"useTable");var va=Re(Ht(),1),ya=Re(ut(),1),Ie=Re(Lt(),1);var vc=[{label:"=",value:"eq"},{label:"\u2260",value:"ne"},{label:"<",value:"lt"},{label:"\u2264",value:"lte"},{label:">",value:"gt"},{label:"\u2265",value:"gte"},{label:"contains",value:"contains"}],yc=o(t=>{let e=t.trim(),n=Number(e);return e!==""&&Number.isFinite(n)&&String(n)===e?n:t},"$"),Rc=o(t=>t.operator==="contains"?t.value==="":t.operator!=="eq"&&t.operator!=="ne"&&t.literal===void 0&&t.value.trim()==="","z"),Ze=o(t=>t.filter(e=>e.column!==""&&!Rc(e)).map(e=>e.operator==="contains"?{column:e.column,operator:e.operator,value:e.value}:{column:e.column,operator:e.operator,value:e.literal===void 0?yc(e.value):e.literal[0]}),"L"),Ca=o((t,e)=>({column:t.column,operator:t.operator,value:t.value,...e}),"P"),Ra=o(t=>{let e=(0,va.c)(44),{columns:n,filters:l,onAskAi:r,onFiltersChange:s,onSearchChange:a,search:c}=t,[u,i]=(0,ya.useState)(""),d;e[0]!==n[0]||e[1]!==l||e[2]!==s?(d=o(()=>{s([...l,{column:n[0]??"",operator:"eq",value:""}])},"N"),e[0]=n[0],e[1]=l,e[2]=s,e[3]=d):d=e[3];let m=d,g;e[4]!==l||e[5]!==s?(g=o(F=>{let P=Number(F.currentTarget.dataset.index);s(l.filter((k,N)=>N!==P))},"T"),e[4]=l,e[5]=s,e[6]=g):g=e[6];let b=g,f;e[7]!==l||e[8]!==s?(f=o(F=>{let P=Number(F.currentTarget.dataset.index),k=F.currentTarget.value;s(l.map((N,T)=>T===P?Ca(N,{column:k}):N))},"y"),e[7]=l,e[8]=s,e[9]=f):f=e[9];let h=f,w;e[10]!==l||e[11]!==s?(w=o(F=>{let P=Number(F.currentTarget.dataset.index),k=F.currentTarget.value;s(l.map((N,T)=>T===P?{...N,operator:k}:N))},"S"),e[10]=l,e[11]=s,e[12]=w):w=e[12];let _=w,S;e[13]!==l||e[14]!==s?(S=o(F=>{let P=Number(F.currentTarget.dataset.index),k=F.currentTarget.value;s(l.map((N,T)=>T===P?Ca(N,{value:k}):N))},"k"),e[13]=l,e[14]=s,e[15]=S):S=e[15];let y=S,I;e[16]!==a||e[17]!==c?(I=(0,Ie.jsx)("input",{"aria-label":"Search rows","data-testid":"db-filter",onChange:a,placeholder:"search table\u2026",value:c}),e[16]=a,e[17]=c,e[18]=I):I=e[18];let C;e[19]!==m?(C=(0,Ie.jsx)("button",{"data-testid":"db-add-filter",onClick:m,type:"button",children:"Add filter"}),e[19]=m,e[20]=C):C=e[20];let R;e[21]!==u||e[22]!==r?(R=r!==void 0&&(0,Ie.jsxs)(Ie.Fragment,{children:[(0,Ie.jsx)("input",{"aria-label":"Describe a filter","data-testid":"db-ai-prompt",onChange:o(F=>{i(F.target.value)},"onChange"),onKeyDown:o(F=>{F.key==="Enter"&&u.trim()!==""&&(F.preventDefault(),r(u.trim()))},"onKeyDown"),placeholder:"describe a filter\u2026",value:u}),(0,Ie.jsx)("button",{"data-testid":"db-ai-filter",disabled:u.trim()==="",onClick:o(()=>{r(u.trim())},"onClick"),type:"button",children:"Suggest"})]}),e[21]=u,e[22]=r,e[23]=R):R=e[23];let x;e[24]!==I||e[25]!==C||e[26]!==R?(x=(0,Ie.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[I,C,R]}),e[24]=I,e[25]=C,e[26]=R,e[27]=x):x=e[27];let v;if(e[28]!==h||e[29]!==_||e[30]!==y||e[31]!==n||e[32]!==l||e[33]!==b){let F;e[35]!==h||e[36]!==_||e[37]!==y||e[38]!==n||e[39]!==b?(F=o((P,k)=>(0,Ie.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-filter-row",children:[(0,Ie.jsx)("select",{"aria-label":"Filter column","data-index":k,"data-testid":"db-filter-column",onChange:h,value:P.column,children:n.map(Ic)}),(0,Ie.jsx)("select",{"aria-label":"Filter operator","data-index":k,"data-testid":"db-filter-operator",onChange:_,value:P.operator,children:vc.map(Fc)}),(0,Ie.jsx)("input",{"aria-label":"Filter value","data-index":k,"data-testid":"db-filter-value",onChange:y,placeholder:"value",value:P.value}),(0,Ie.jsx)("button",{"aria-label":"Remove filter","data-index":k,"data-testid":"db-filter-remove",onClick:b,type:"button",children:"\u2715"})]},k),"a"),e[35]=h,e[36]=_,e[37]=y,e[38]=n,e[39]=b,e[40]=F):F=e[40],v=l.map(F),e[28]=h,e[29]=_,e[30]=y,e[31]=n,e[32]=l,e[33]=b,e[34]=v}else v=e[34];let M;return e[41]!==v||e[42]!==x?(M=(0,Ie.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"db-filters",children:[x,v]}),e[41]=v,e[42]=x,e[43]=M):M=e[43],M},"M");function Ic(t){return(0,Ie.jsx)("option",{value:t,children:t},t)}o(Ic,"B");function Fc(t){return(0,Ie.jsx)("option",{value:t.value,children:t.label},t.value)}o(Fc,"G");var Mc=o(t=>({tables:Object.entries(t).map(([e,n])=>({fields:n.map(l=>l.name),indexes:[],name:e,relations:n.filter(l=>l.ref!==void 0).map(l=>({field:l.name,kind:"one",name:l.name,onDelete:l.onDelete,references:l.ref,table:e}))}))}),"No"),kc=o(t=>{let e=new Map,n=new Set;for(let l of t.tables)for(let r of l.relations){if(r.kind!=="one"||r.onDelete==="set null")continue;let s=r.references,a=`${s}\0${l.name}\0${r.field}`;if(n.has(a))continue;n.add(a);let c=e.get(s)??[];c.push({...r,table:l.name}),e.set(s,c)}return e},"So"),Pc=o((t,e)=>{let n=[],l=[t];for(;l.length>0;){let r=l.shift();if(r===void 0)break;e(r)&&n.push(r);for(let s of r.children)l.push(s)}return n},"ko"),Ia=o((t,e)=>{let n=[];for(let[l,r]of Object.entries(e))for(let s of r)s.ref===t&&n.push({column:s.name,table:l});return n.sort((l,r)=>l.table.localeCompare(r.table)||l.column.localeCompare(r.column)),n},"qt"),hr=o(t=>`${t.table}.${t.column}`,"It"),Nc=o(t=>{let e=(0,q.c)(111),{columns:n,onApply:l,onClose:r,shardKey:s,table:a,total:c,uniqueColumns:u}=t,i=oe(),[d,m]=(0,D.useState)(n[0]??""),[g,b]=(0,D.useState)(""),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=o(ye=>{m(ye.target.value)},"u"),e[0]=f):f=e[0];let h=f,w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=o(ye=>{b(ye.target.value)},"h"),e[1]=w):w=e[1];let _=w,S;e[2]!==g?(S=g.trim(),e[2]=g,e[3]=S):S=e[3];let y=S==="",I,C;if(e[4]!==y||e[5]!==i||e[6]!==g){if(!y)try{C=gn(JSON.parse(g))}catch(ye){I=i("Invalid JSON: {message}",{message:ye.message})}e[4]=y,e[5]=i,e[6]=g,e[7]=I,e[8]=C}else I=e[7],C=e[8];let R;e[9]!==d||e[10]!==c||e[11]!==u?(R=u.has(d)&&c>1,e[9]=d,e[10]=c,e[11]=u,e[12]=R):R=e[12];let x=R,v=d!==""&&!y&&I===void 0&&!x,M;e[13]!==v||e[14]!==d||e[15]!==l||e[16]!==r||e[17]!==C?(M=o(()=>{v&&(l({[d]:C}),r())},"T"),e[13]=v,e[14]=d,e[15]=l,e[16]=r,e[17]=C,e[18]=M):M=e[18];let F=M,P;e[19]!==i?(P=i("Set a column on matching rows"),e[19]=i,e[20]=P):P=e[20];let k;e[21]!==i?(k=i("Set a column on matching rows"),e[21]=i,e[22]=k):k=e[22];let N;e[23]!==k?(N=(0,p.jsx)("h3",{className:"text-base text-foreground","data-testid":"bulk-patch-title",children:k}),e[23]=k,e[24]=N):N=e[24];let T;e[25]!==i||e[26]!==a||e[27]!==c?(T=i("Writes {total} rows of {table} through the schema-aware writer \u2014 validators and indexes apply, exactly like a mutation.",{table:a,total:c.toString()}),e[25]=i,e[26]=a,e[27]=c,e[28]=T):T=e[28];let z;e[29]!==T?(z=(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-desc",children:T}),e[29]=T,e[30]=z):z=e[30];let A;e[31]!==s||e[32]!==i?(A=s===""?i("Shard: root"):i("Shard: {shardKey} \u2014 rows in other shards are not touched.",{shardKey:s}),e[31]=s,e[32]=i,e[33]=A):A=e[33];let $;e[34]!==A?($=(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-shard",children:A}),e[34]=A,e[35]=$):$=e[35];let K;e[36]!==z||e[37]!==$||e[38]!==N?(K=(0,p.jsxs)("div",{className:"flex flex-col gap-0.5",children:[N,z,$]}),e[36]=z,e[37]=$,e[38]=N,e[39]=K):K=e[39];let U;e[40]!==i?(U=i("Close"),e[40]=i,e[41]=U):U=e[41];let O;e[42]!==r||e[43]!==U?(O=(0,p.jsx)(rn,{"data-testid":"bulk-patch-close",onClick:r,size:"xs",variant:"ghost",children:U}),e[42]=r,e[43]=U,e[44]=O):O=e[44];let Q;e[45]!==K||e[46]!==O?(Q=(0,p.jsxs)("div",{className:"flex items-start justify-between",children:[K,O]}),e[45]=K,e[46]=O,e[47]=Q):Q=e[47];let J;e[48]!==i?(J=i("Column"),e[48]=i,e[49]=J):J=e[49];let Z;e[50]!==J?(Z=(0,p.jsx)(co,{htmlFor:"bulk-patch-column",children:J}),e[50]=J,e[51]=Z):Z=e[51];let ne;e[52]!==i?(ne=i("Column"),e[52]=i,e[53]=ne):ne=e[53];let te;e[54]!==n?(te=n.map(Dc),e[54]=n,e[55]=te):te=e[55];let se;e[56]!==d||e[57]!==ne||e[58]!==te?(se=(0,p.jsx)("select",{"aria-label":ne,className:"h-8 rounded-md border border-input bg-transparent px-2 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"bulk-patch-column",id:"bulk-patch-column",onChange:h,value:d,children:te}),e[56]=d,e[57]=ne,e[58]=te,e[59]=se):se=e[59];let me;e[60]!==i?(me=i("Value"),e[60]=i,e[61]=me):me=e[61];let be;e[62]!==me?(be=(0,p.jsx)(co,{htmlFor:"bulk-patch-value",children:me}),e[62]=me,e[63]=be):be=e[63];let Ce;e[64]!==g?(Ce=(0,p.jsx)(Ir,{className:"flex-1 font-mono","data-testid":"bulk-patch-value",id:"bulk-patch-value",onChange:_,placeholder:"true",value:g}),e[64]=g,e[65]=Ce):Ce=e[65];let xe;e[66]!==Z||e[67]!==se||e[68]!==be||e[69]!==Ce?(xe=(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[Z,se,be,Ce]}),e[66]=Z,e[67]=se,e[68]=be,e[69]=Ce,e[70]=xe):xe=e[70];let Se;e[71]!==I?(Se=I!==void 0&&(0,p.jsx)("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-error",role:"alert",children:I}),e[71]=I,e[72]=Se):Se=e[72];let ve;e[73]!==d||e[74]!==i||e[75]!==c||e[76]!==x?(ve=x&&(0,p.jsx)("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-unique",role:"alert",children:i("{column} has a unique index \u2014 the same value cannot be set on {total} rows.",{column:d,total:c.toString()})}),e[73]=d,e[74]=i,e[75]=c,e[76]=x,e[77]=ve):ve=e[77];let L;e[78]!==y||e[79]!==i||e[80]!==x?(L=y&&!x&&(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-hint",children:i('Enter a JSON value \u2014 for example true, 0, null, or "done".')}),e[78]=y,e[79]=i,e[80]=x,e[81]=L):L=e[81];let X;e[82]!==v||e[83]!==d||e[84]!==g?(X=v&&(0,p.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"bulk-patch-preview",children:`${d} = ${g.trim()}`}),e[82]=v,e[83]=d,e[84]=g,e[85]=X):X=e[85];let le;e[86]!==i?(le=i("Cancel"),e[86]=i,e[87]=le):le=e[87];let Fe;e[88]!==r||e[89]!==le?(Fe=(0,p.jsx)(rn,{"data-testid":"bulk-patch-cancel",onClick:r,size:"xs",variant:"outline",children:le}),e[88]=r,e[89]=le,e[90]=Fe):Fe=e[90];let De=!v,ge;e[91]!==i||e[92]!==c?(ge=i("Set on {total} rows",{total:c.toString()}),e[91]=i,e[92]=c,e[93]=ge):ge=e[93];let ee;e[94]!==F||e[95]!==De||e[96]!==ge?(ee=(0,p.jsx)(rn,{"data-testid":"bulk-patch-apply",disabled:De,onClick:F,size:"xs",children:ge}),e[94]=F,e[95]=De,e[96]=ge,e[97]=ee):ee=e[97];let B;e[98]!==Fe||e[99]!==ee?(B=(0,p.jsxs)("div",{className:"flex justify-end gap-2",children:[Fe,ee]}),e[98]=Fe,e[99]=ee,e[100]=B):B=e[100];let Te;return e[101]!==r||e[102]!==Q||e[103]!==xe||e[104]!==Se||e[105]!==ve||e[106]!==L||e[107]!==X||e[108]!==B||e[109]!==P?(Te=(0,p.jsxs)(Bt,{label:P,onClose:r,panelTestId:"bulk-patch-panel",testId:"bulk-patch-overlay",variant:"dialog",children:[Q,xe,Se,ve,L,X,B]}),e[101]=r,e[102]=Q,e[103]=xe,e[104]=Se,e[105]=ve,e[106]=L,e[107]=X,e[108]=B,e[109]=P,e[110]=Te):Te=e[110],Te},"To");function Dc(t){return(0,p.jsx)("option",{value:t,children:t},t)}o(Dc,"Eo");var Fa=6,Gn=100,Tc=o(t=>({paddingLeft:t*16}),"_o"),Ac=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-restrict-${n}`,r;return e[0]!==l?(r=(0,p.jsx)("span",{className:"rounded bg-destructive/10 px-1 text-destructive","data-testid":l,children:"restrict \u2014 will block delete"}),e[0]=l,e[1]=r):r=e[1],r},"Ro"),Oc=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-cascade-${n}`,r;return e[0]!==l?(r=(0,p.jsx)("span",{className:"rounded bg-warning/10 px-1 text-warning","data-testid":l,children:"cascade"}),e[0]=l,e[1]=r):r=e[1],r},"$o"),Ec=o(t=>{let e=(0,q.c)(2),{table:n}=t,l=`cascade-undeclared-${n}`,r;return e[0]!==l?(r=(0,p.jsx)("span",{className:"rounded bg-muted px-1 text-muted-foreground","data-testid":l,children:"references \u2014 no delete action declared"}),e[0]=l,e[1]=r):r=e[1],r},"Do"),Vc=o(t=>t.relation===void 0||t.relation.onDelete==="cascade"?(0,p.jsx)(Oc,{table:t.table}):t.isRestrict?(0,p.jsx)(Ac,{table:t.table}):(0,p.jsx)(Ec,{table:t.table}),"Po"),Ea=o(t=>{let e=(0,q.c)(35),{depth:n,node:l}=t,r=`cascade-row-${l.table}`,s;e[0]!==n?(s=Tc(n),e[0]=n,e[1]=s):s=e[1];let a;e[2]!==n?(a=n>0&&(0,p.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2514"}),e[2]=n,e[3]=a):a=e[3];let c;e[4]!==l.table?(c=(0,p.jsx)("span",{className:"font-medium text-foreground",children:l.table}),e[4]=l.table,e[5]=c):c=e[5];let u;e[6]!==l.relation||e[7]!==l.table?(u=l.relation!==void 0&&(0,p.jsxs)("span",{className:"text-muted-foreground","data-testid":`cascade-col-${l.table}-${l.relation.field}`,children:["via ",l.relation.field]}),e[6]=l.relation,e[7]=l.table,e[8]=u):u=e[8];let i;e[9]!==l.rowCount?(i=l.rowCount.toString(),e[9]=l.rowCount,e[10]=i):i=e[10];let d;e[11]!==i?(d=(0,p.jsxs)("span",{className:"text-muted-foreground",children:["(",i," rows)"]}),e[11]=i,e[12]=d):d=e[12];let m;e[13]!==l?(m=Vc(l),e[13]=l,e[14]=m):m=e[14];let g;e[15]!==l.capNote||e[16]!==l.table?(g=l.capNote!==void 0&&(0,p.jsxs)("span",{className:"italic text-muted-foreground","data-testid":`cascade-cap-${l.table}`,children:["(",l.capNote,")"]}),e[15]=l.capNote,e[16]=l.table,e[17]=g):g=e[17];let b;e[18]!==r||e[19]!==s||e[20]!==a||e[21]!==c||e[22]!==u||e[23]!==d||e[24]!==m||e[25]!==g?(b=(0,p.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 py-1 font-mono text-xs","data-testid":r,style:s,children:[a,c,u,d,m,g]}),e[18]=r,e[19]=s,e[20]=a,e[21]=c,e[22]=u,e[23]=d,e[24]=m,e[25]=g,e[26]=b):b=e[26];let f;if(e[27]!==n||e[28]!==l.children){let w;e[30]!==n?(w=o((_,S)=>(0,p.jsx)(Ea,{depth:n+1,node:_},`${_.table}-${_.relation?.field??"root"}-${S.toString()}`),"h"),e[30]=n,e[31]=w):w=e[31],f=l.children.map(w),e[27]=n,e[28]=l.children,e[29]=f}else f=e[29];let h;return e[32]!==b||e[33]!==f?(h=(0,p.jsxs)(p.Fragment,{children:[b,f]}),e[32]=b,e[33]=f,e[34]=h):h=e[34],h},"sn"),zc=o(t=>{let e=t._id??t.id??t.__id__??"";return typeof e=="string"?e:typeof e=="number"?e.toString():""},"Ao"),$c=o(async(t,e,n,l)=>{try{let r=await l(t,e,n),s=r.rows.flatMap(c=>zc(c)||[]).slice(0,Gn),a=r.total??0;return{capNote:a>Gn?`showing first ${Gn.toString()} of ${a.toString()}`:void 0,rowCount:a,rowIds:s}}catch{return{capNote:"count unavailable",rowCount:0,rowIds:[]}}},"Io"),Va=o(async(t,e,n,l,r,s,a)=>{let{capNote:c,rowCount:u,rowIds:i}=n===void 0?{capNote:void 0,rowCount:1,rowIds:[e]}:await $c(t,n.field,e,a),d=n?.onDelete==="restrict",m=[],g=`${t}:${e}`,b=s>=Fa;if(!r.has(g)&&!b){r.add(g);let h=l.get(t)??[];for(let w of h)for(let _ of i.slice(0,10)){let S=await Va(w.table,_,w,l,r,s+1,a);(S.rowCount>0||s===0)&&m.push(S)}r.delete(g)}let f=c;if(b){let h=`depth capped at ${Fa.toString()}`;f=c===void 0?h:`${c}; ${h}`}return{capNote:f,children:m,isRestrict:d,relation:n,rowCount:u,rowIds:i,table:t}},"ln"),Hc=o(({onClose:t,onConfirm:e,readPage:n,rowId:l,schema:r,table:s})=>{let a=oe(),[c,u]=(0,D.useState)(!0),[i,d]=(0,D.useState)(null),[m,g]=(0,D.useState)(null);(0,D.useEffect)(()=>{let h=!1;return re((async()=>{try{u(!0),g(null);let w=kc(r);if(!((w.get(s)??[]).length>0)){h||(d({capNote:void 0,children:[],isRestrict:!1,relation:void 0,rowCount:1,rowIds:[l],table:s}),u(!1));return}let _=await Va(s,l,void 0,w,new Set,0,n);h||(d(_),u(!1))}catch(w){h||(g(w.message),u(!1))}})()),()=>{h=!0}},[l,s]);let b=i!==null&&Pc(i,h=>h.isRestrict).length>0,f=o(()=>{e(),t()},"u");return(0,p.jsxs)(Bt,{label:"Cascade impact preview",onClose:t,panelTestId:"cascade-panel",testId:"cascade-overlay",variant:"dialog",children:[(0,p.jsxs)("div",{className:"flex items-start justify-between",children:[(0,p.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,p.jsx)("h3",{className:"text-base text-foreground","data-testid":"cascade-title",children:a("Cascade impact")}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-desc",children:a("Delete preview \u2014 rows that would cascade or be blocked")})]}),(0,p.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"cascade-close",onClick:t,type:"button",children:a("Close")})]}),c&&(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-loading",children:a("Loading\u2026")}),m!==null&&(0,p.jsx)("p",{className:"text-xs text-destructive","data-testid":"cascade-error",role:"alert",children:m}),!c&&i!==null&&(0,p.jsx)("ul",{className:"flex flex-col","data-testid":"cascade-tree",children:(0,p.jsx)(Ea,{depth:0,node:i})}),!c&&i!==null&&i.children.length===0&&(0,p.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-no-impact",children:a("No related rows found.")}),b&&(0,p.jsx)("p",{className:"text-sm font-medium text-destructive","data-testid":"cascade-blocker-warning",role:"alert",children:a("Restrict relations will block this delete.")}),(0,p.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,p.jsx)("button",{className:"rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cascade-cancel",onClick:t,type:"button",children:a("Cancel")}),(0,p.jsx)("button",{className:"rounded-md bg-destructive px-3 py-1.5 text-xs font-medium text-destructive-foreground outline-none transition-colors hover:bg-destructive/90 focus-visible:bg-destructive/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"cascade-confirm",disabled:c,onClick:f,type:"button",children:a("Delete")})]})]})},"Fo"),Lc=o((t,e,n,l,r=300)=>{if(l<=0)return{ids:new Set(t.map(m=>m.id)),leadPx:0,tailPx:0};let s=n-r,a=n+l+r,c=new Set,u=0,i=0,d=0;for(let m of t){let g=m.getSize(),b=e.has(m.id),f=u+g>s&&u<a;b||f?c.add(m.id):u<s?i+=g:d+=g,u+=g}return{ids:c,leadPx:i,tailPx:d}},"Oo"),jc=o((t,e)=>{let n=new Map,l=0;for(let r of t)e.has(r.id)&&(n.set(r.id,l),l+=r.getSize());return n},"Mo"),Bc={columnOrderingFeature:Ko,columnResizingFeature:Xo,columnSizingFeature:Yo,columnVisibilityFeature:Zo,rowSelectionFeature:cr,rowSortingFeature:ur,sortedRowModel:dr(),sortFns:{alphanumeric:To,basic:kt,datetime:Oo,text:Ao}},Gc=o(()=>{let t=(0,q.c)(12),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={},t[0]=e):e=t[0];let[n,l]=(0,D.useState)(e),r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=o((h,w,_)=>{l(S=>({...S,[h]:{...S[h],[w]:_}}))},"t"),t[1]=r):r=t[1];let s=r,a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=o(()=>{l({})},"l"),t[2]=a):a=t[2];let c=a,u;t[3]===Symbol.for("react.memo_cache_sentinel")?(u=o((h,w)=>{l(_=>{let S=_[h];if(S===void 0)return _;let y=Object.fromEntries(Object.entries(S).filter(I=>{let[C,R]=I;return!(C in w)||!Object.is(R,w[C])}));return Object.keys(y).length===0?Object.fromEntries(Object.entries(_).filter(I=>{let[C]=I;return C!==h})):{..._,[h]:y}})},"a"),t[3]=u):u=t[3];let i=u,d;t[4]!==n?(d=o((h,w)=>{let _=n[h];return _!==void 0&&w in _?{value:_[w]}:void 0},"f"),t[4]=n,t[5]=d):d=t[5];let m=d,g;t[6]!==n?(g=Object.values(n).reduce(Kc,0),t[6]=n,t[7]=g):g=t[7];let b=g,f;return t[8]!==b||t[9]!==n||t[10]!==m?(f={clear:c,count:b,drop:i,stage:s,staged:n,stagedValue:m},t[8]=b,t[9]=n,t[10]=m,t[11]=f):f=t[11],f},"Vo"),za=o((t,e)=>{if(typeof e=="number"){let n=Number(t);return t.trim()===""||Number.isNaN(n)?t:n}if(typeof e=="boolean"){if(t==="true")return!0;if(t==="false")return!1}return t},"rn"),qc=o(t=>{let e=(0,q.c)(29),{changes:n,committing:l,onCommit:r,onDiscard:s}=t,a=oe(),c;e[0]!==n.length||e[1]!==a?(c=a("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=a,e[2]=c):c=e[2];let u;e[3]!==c?(u=(0,p.jsx)("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:c}),e[3]=c,e[4]=u):u=e[4];let i;e[5]!==l||e[6]!==a?(i=a(l?"Committing\u2026":"Commit"),e[5]=l,e[6]=a,e[7]=i):i=e[7];let d;e[8]!==l||e[9]!==r||e[10]!==i?(d=(0,p.jsx)("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:l,onClick:r,type:"button",children:i}),e[8]=l,e[9]=r,e[10]=i,e[11]=d):d=e[11];let m;e[12]!==a?(m=a("Discard"),e[12]=a,e[13]=m):m=e[13];let g;e[14]!==l||e[15]!==s||e[16]!==m?(g=(0,p.jsx)("button",{className:"rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-discard",disabled:l,onClick:s,type:"button",children:m}),e[14]=l,e[15]=s,e[16]=m,e[17]=g):g=e[17];let b;e[18]!==u||e[19]!==d||e[20]!==g?(b=(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,d,g]}),e[18]=u,e[19]=d,e[20]=g,e[21]=b):b=e[21];let f;e[22]!==n?(f=n.map(Uc),e[22]=n,e[23]=f):f=e[23];let h;e[24]!==f?(h=(0,p.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:f}),e[24]=f,e[25]=h):h=e[25];let w;return e[26]!==b||e[27]!==h?(w=(0,p.jsxs)("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[b,h]}),e[26]=b,e[27]=h,e[28]=w):w=e[28],w},"Bo");function Kc(t,e){return t+Object.keys(e).length}o(Kc,"jo");function Uc(t){return(0,p.jsxs)("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[(0,p.jsxs)("span",{className:"text-muted-foreground",children:[t.rowId,".",t.column]}),(0,p.jsx)("span",{className:"text-destructive line-through",children:Oe(t.oldValue)}),(0,p.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2192"}),(0,p.jsx)("span",{className:"text-foreground",children:Oe(t.newValue)})]},`${t.rowId}:${t.column}`)}o(Uc,"zo");var Ma=400,Jc=36,Wc={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},Qc={width:"100%"},Xc=/\n$/u,Yc={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Zc={display:"flex",width:"100%"},ka={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},eu="2.5rem",$a={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},wr=o(t=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${t.toString()}px`}),"Ft"),Ha=o((t,e)=>({...wr(t),left:`calc(${eu} + ${e.toString()}px)`,position:"sticky",zIndex:2}),"cn"),gr="rounded-md px-2 py-0.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",tu=o((t,e,n)=>e.enabled&&e.columns.has(n)?void 0:t,"Qo"),br="__back__:",nu=o(t=>`${br}${t.table}.${t.column}`,"Yo"),ou=o(t=>{let e=(0,q.c)(3),{counts:n,rowId:l}=t;if(n===void 0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,p.jsx)("span",{className:"text-muted-foreground/50",children:"\u2014"}),e[0]=a):a=e[0],a}let r=n[l]??0,s;return e[1]!==r?(s=(0,p.jsx)("span",{className:"tabular-nums",children:r}),e[1]=r,e[2]=s):s=e[2],s},"Xo"),et=o(t=>{for(let e of["id","__id__","_id"]){let n=t[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},"Pe"),ru=o((t,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(t)||t===""&&e.nullable===!0?{value:t===""?null:t}:void 0;if(e.type==="boolean")return t==="true"||t==="false"?{value:t==="true"}:void 0;if(e.type==="number"){let n=Number(t);return t.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:t}},"Zo"),lu=o((t,e,n)=>{if(n!==void 0&&n.type!=="any")return ru(t,n);let l=za(t,e);return typeof e=="number"&&typeof l!="number"?void 0:{value:l}},"es"),su=o(({anchor:t,columnIds:e,columnMeta:n,editableColumn:l,rows:r,text:s})=>{let a=s.replaceAll(`\r
3
3
  `,`
4
4
  `).replace(Xc,"").split(`
@@ -1 +1 @@
1
- import{W as k}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as q}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as j}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as U}from"./chunk-ZVJOW25X.js";import"./chunk-ULIQFBZU.js";import"./chunk-46EQO6E7.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as P}from"./chunk-FZ5ZSUA2.js";import"./chunk-PG7XHMUR.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as M}from"./chunk-FKVZRPV5.js";import{a as G,b as H,c as J,d as B,e as x,f as N}from"./chunk-HEAQVSNS.js";import{a as z,e as D}from"./chunk-WUWBZPUK.js";import{d as F,t as O}from"./chunk-PTZD7RUZ.js";import{a as A,d as T,e as $,f as X,g as Y}from"./chunk-YKXDMIHQ.js";var K=T(X(),1),Q=T($(),1);var t=T(Y(),1);var de=A(()=>{let e=(0,K.c)(39),a=F(),[s,V]=(0,Q.useState)(""),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:C,error:l,errorSource:S,isLoading:E,refetch:_}=P(R.getAuthAuditLog,y),I;if(e[1]!==C?.entries||e[2]!==s){let r=C?.entries??[],v=s.trim().toLowerCase();I=v===""?r:r.filter(w=>w.event.toLowerCase().includes(v)||(w.actorId??"").toLowerCase().includes(v)||(w.actorEmail??"").toLowerCase().includes(v)||(w.ip??"").toLowerCase().includes(v)||w.outcome.toLowerCase().includes(v)),e[1]=C?.entries,e[2]=s,e[3]=I}else I=e[3];let o=I,L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A(r=>{V(r.target.value)},"I"),e[4]=L):L=e[4];let W=L,i;e[5]!==a?(i=a("Filter security events"),e[5]=a,e[6]=i):i=e[6];let n;e[7]!==a?(n=a("filter event, actor, IP"),e[7]=a,e[8]=n):n=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==n?(c=(0,t.jsx)(k,{"aria-label":i,className:"h-8 w-56","data-testid":"aa-search",onChange:W,placeholder:n,value:s}),e[9]=s,e[10]=i,e[11]=n,e[12]=c):c=e[12];let d;e[13]!==_?(d=A(()=>{_()},"m"),e[13]=_,e[14]=d):d=e[14];let m;e[15]!==a?(m=a("Refresh"),e[15]=a,e[16]=m):m=e[16];let u;e[17]!==d||e[18]!==m?(u=(0,t.jsx)(q,{"data-testid":"aa-refresh",onClick:d,size:"xs",type:"button",variant:"ghost",children:m}),e[17]=d,e[18]=m,e[19]=u):u=e[19];let h;e[20]!==c||e[21]!==u?(h=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u]}),e[20]=c,e[21]=u,e[22]=h):h=e[22];let f;e[23]!==l||e[24]!==S?(f=l!==null&&(0,t.jsx)(U,{error:S,testId:"aa-error"}),e[23]=l,e[24]=S,e[25]=f):f=e[25];let p;e[26]!==l||e[27]!==o.length||e[28]!==E||e[29]!==a?(p=l===null&&!E&&o.length===0&&(0,t.jsx)(M,{description:a("Authentication and security events are recorded here."),testId:"aa-empty",title:a("No security events.")}),e[26]=l,e[27]=o.length,e[28]=E,e[29]=a,e[30]=p):p=e[30];let g;e[31]!==o||e[32]!==a?(g=o.length>0&&(0,t.jsx)(z,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"aa-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(x,{children:a("time")}),(0,t.jsx)(x,{children:a("event")}),(0,t.jsx)(x,{children:a("actor")}),(0,t.jsx)(x,{children:a("ip / user agent")}),(0,t.jsx)(x,{children:a("outcome")})]})}),(0,t.jsx)(J,{children:o.map(r=>(0,t.jsxs)(B,{"data-testid":"aa-row",children:[(0,t.jsx)(N,{className:"text-muted-foreground tabular-nums",children:O(r.ts,"\u2014")}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:"secondary",children:r.event})}),(0,t.jsx)(N,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsxs)(N,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),r.userAgent!==void 0&&(0,t.jsxs)("span",{className:"ml-1 opacity-70",children:["\xB7 ",r.userAgent]})]}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:r.outcome==="failure"?"destructive":"outline",children:a(r.outcome)})})]},r.seq))})]})})}),e[31]=o,e[32]=a,e[33]=g):g=e[33];let b;return e[34]!==f||e[35]!==p||e[36]!==g||e[37]!==h?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[h,f,p,g]}),e[34]=f,e[35]=p,e[36]=g,e[37]=h,e[38]=b):b=e[38],b},"ne");export{de as default};
1
+ import{W as k}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as q}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as j}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as U}from"./chunk-XBVXA2OK.js";import"./chunk-ULIQFBZU.js";import"./chunk-S54AMHYS.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as P}from"./chunk-6R3CL5GW.js";import"./chunk-RATPWNIM.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as M}from"./chunk-FKVZRPV5.js";import{a as G,b as H,c as J,d as B,e as x,f as N}from"./chunk-HEAQVSNS.js";import{a as z,e as D}from"./chunk-WUWBZPUK.js";import{d as F,t as O}from"./chunk-PTZD7RUZ.js";import{a as A,d as T,e as $,f as X,g as Y}from"./chunk-YKXDMIHQ.js";var K=T(X(),1),Q=T($(),1);var t=T(Y(),1);var de=A(()=>{let e=(0,K.c)(39),a=F(),[s,V]=(0,Q.useState)(""),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:C,error:l,errorSource:S,isLoading:E,refetch:_}=P(R.getAuthAuditLog,y),I;if(e[1]!==C?.entries||e[2]!==s){let r=C?.entries??[],v=s.trim().toLowerCase();I=v===""?r:r.filter(w=>w.event.toLowerCase().includes(v)||(w.actorId??"").toLowerCase().includes(v)||(w.actorEmail??"").toLowerCase().includes(v)||(w.ip??"").toLowerCase().includes(v)||w.outcome.toLowerCase().includes(v)),e[1]=C?.entries,e[2]=s,e[3]=I}else I=e[3];let o=I,L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A(r=>{V(r.target.value)},"I"),e[4]=L):L=e[4];let W=L,i;e[5]!==a?(i=a("Filter security events"),e[5]=a,e[6]=i):i=e[6];let n;e[7]!==a?(n=a("filter event, actor, IP"),e[7]=a,e[8]=n):n=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==n?(c=(0,t.jsx)(k,{"aria-label":i,className:"h-8 w-56","data-testid":"aa-search",onChange:W,placeholder:n,value:s}),e[9]=s,e[10]=i,e[11]=n,e[12]=c):c=e[12];let d;e[13]!==_?(d=A(()=>{_()},"m"),e[13]=_,e[14]=d):d=e[14];let m;e[15]!==a?(m=a("Refresh"),e[15]=a,e[16]=m):m=e[16];let u;e[17]!==d||e[18]!==m?(u=(0,t.jsx)(q,{"data-testid":"aa-refresh",onClick:d,size:"xs",type:"button",variant:"ghost",children:m}),e[17]=d,e[18]=m,e[19]=u):u=e[19];let h;e[20]!==c||e[21]!==u?(h=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u]}),e[20]=c,e[21]=u,e[22]=h):h=e[22];let f;e[23]!==l||e[24]!==S?(f=l!==null&&(0,t.jsx)(U,{error:S,testId:"aa-error"}),e[23]=l,e[24]=S,e[25]=f):f=e[25];let p;e[26]!==l||e[27]!==o.length||e[28]!==E||e[29]!==a?(p=l===null&&!E&&o.length===0&&(0,t.jsx)(M,{description:a("Authentication and security events are recorded here."),testId:"aa-empty",title:a("No security events.")}),e[26]=l,e[27]=o.length,e[28]=E,e[29]=a,e[30]=p):p=e[30];let g;e[31]!==o||e[32]!==a?(g=o.length>0&&(0,t.jsx)(z,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"aa-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(x,{children:a("time")}),(0,t.jsx)(x,{children:a("event")}),(0,t.jsx)(x,{children:a("actor")}),(0,t.jsx)(x,{children:a("ip / user agent")}),(0,t.jsx)(x,{children:a("outcome")})]})}),(0,t.jsx)(J,{children:o.map(r=>(0,t.jsxs)(B,{"data-testid":"aa-row",children:[(0,t.jsx)(N,{className:"text-muted-foreground tabular-nums",children:O(r.ts,"\u2014")}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:"secondary",children:r.event})}),(0,t.jsx)(N,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsxs)(N,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),r.userAgent!==void 0&&(0,t.jsxs)("span",{className:"ml-1 opacity-70",children:["\xB7 ",r.userAgent]})]}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:r.outcome==="failure"?"destructive":"outline",children:a(r.outcome)})})]},r.seq))})]})})}),e[31]=o,e[32]=a,e[33]=g):g=e[33];let b;return e[34]!==f||e[35]!==p||e[36]!==g||e[37]!==h?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[h,f,p,g]}),e[34]=f,e[35]=p,e[36]=g,e[37]=h,e[38]=b):b=e[38],b},"ne");export{de as default};
@@ -1 +1 @@
1
- import{d as C}from"./chunk-YOB2X3FZ.js";import{a as B}from"./chunk-66UGPQVC.js";import{a as R}from"./chunk-LGHZBMSX.js";import"./chunk-K7AJEMKE.js";import"./chunk-6D6Z2KXU.js";import"./chunk-Y6CXU7T4.js";import"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as N}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as j}from"./chunk-ZVJOW25X.js";import"./chunk-ULIQFBZU.js";import"./chunk-46EQO6E7.js";import"./chunk-35DM4JJG.js";import{a as u}from"./chunk-4ZEL6BYL.js";import{c as p}from"./chunk-FZ5ZSUA2.js";import"./chunk-PG7XHMUR.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as S}from"./chunk-FKVZRPV5.js";import{a as A,b as k,c as P,d as y,e as l,f as i}from"./chunk-HEAQVSNS.js";import{a as v,e as w}from"./chunk-WUWBZPUK.js";import{d as E,t as I}from"./chunk-PTZD7RUZ.js";import{a as m,d as G,g as H}from"./chunk-YKXDMIHQ.js";var e=G(H(),1);var Q=["subscriptions","events"],V={},T=new Set(["active","trialing"]),q=new Set(["past_due","unpaid"]),n=m((a,t)=>{if(a[t]!==void 0)return a[t];let h=a.__doc__;return typeof h=="string"?C(h)?.[t]:void 0},"a"),s=m(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","n"),z=m(a=>T.has(a)?"default":q.has(a)?"destructive":"outline","U"),se=m(({limit:a=100})=>{let t=E(),h=R(),{data:x}=p(u.listTables,V,{live:!0}),D=x!==void 0,O=Array.isArray(x)&&Q.every(r=>x.some(d=>d.name===r)),c=h.payments&&O,o=p(u.readTablePage,{filters:[],limit:a,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:"subscriptions"},{enabled:c}),f=p(u.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:"events"},{enabled:c}),g=p(u.facetColumn,{column:"state",table:"subscriptions"},{enabled:c});B(()=>{c&&(o.refetch(),f.refetch(),g.refetch())},!0);let b=o.data?.rows??[],F=f.data?.rows??[],L=o.error??f.error,M=o.error===null?f.errorSource:o.errorSource,U=o.data?.total??b.length,_=g.data?.values===void 0?b.filter(r=>T.has(s(n(r,"state")))).length:g.data.values.reduce((r,d)=>r+(T.has(s(d.value))?d.count:0),0);return D&&!c?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(S,{description:t("No @lunora/payment tables found in this deployment. Declare the store tables (subscriptions, events, \u2026) in lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(v,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:_}),(0,e.jsx)(N,{variant:"default",children:t("{count} active",{count:_})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:U})})]})}),L===null?void 0:(0,e.jsx)(j,{error:M}),b.length===0&&!o.isLoading?(0,e.jsx)(S,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(v,{className:"overflow-hidden py-0",children:(0,e.jsx)(w,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(k,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(P,{children:b.map(r=>{let d=s(n(r,"state"));return(0,e.jsxs)(y,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(i,{children:s(n(r,"provider"))}),(0,e.jsx)(i,{children:s(n(r,"referenceId"))}),(0,e.jsx)(i,{children:s(n(r,"priceId"))}),(0,e.jsx)(i,{children:(0,e.jsx)(N,{variant:z(d),children:d})}),(0,e.jsx)(i,{children:I(n(r,"currentPeriodEnd"))})]},s(n(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(v,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(w,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(P,{children:F.map(r=>(0,e.jsxs)(y,{"data-testid":"payment-event-row",children:[(0,e.jsx)(i,{children:s(n(r,"provider"))}),(0,e.jsx)(i,{className:"font-medium",children:s(n(r,"type"))}),(0,e.jsx)(i,{className:"text-muted-foreground",children:s(n(r,"providerEventId"))}),(0,e.jsx)(i,{children:I(n(r,"processedAt"))})]},s(n(r,"providerEventId"))))})})})]})]})},"ae");export{se as PaymentsPanel};
1
+ import{d as C}from"./chunk-YOB2X3FZ.js";import{a as B}from"./chunk-66UGPQVC.js";import{a as R}from"./chunk-W3A4SIKT.js";import"./chunk-K7AJEMKE.js";import"./chunk-6D6Z2KXU.js";import"./chunk-Y6CXU7T4.js";import"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as N}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as j}from"./chunk-XBVXA2OK.js";import"./chunk-ULIQFBZU.js";import"./chunk-S54AMHYS.js";import"./chunk-35DM4JJG.js";import{a as u}from"./chunk-4ZEL6BYL.js";import{c as p}from"./chunk-6R3CL5GW.js";import"./chunk-RATPWNIM.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as S}from"./chunk-FKVZRPV5.js";import{a as A,b as k,c as P,d as y,e as l,f as i}from"./chunk-HEAQVSNS.js";import{a as v,e as w}from"./chunk-WUWBZPUK.js";import{d as E,t as I}from"./chunk-PTZD7RUZ.js";import{a as m,d as G,g as H}from"./chunk-YKXDMIHQ.js";var e=G(H(),1);var Q=["subscriptions","events"],V={},T=new Set(["active","trialing"]),q=new Set(["past_due","unpaid"]),n=m((a,t)=>{if(a[t]!==void 0)return a[t];let h=a.__doc__;return typeof h=="string"?C(h)?.[t]:void 0},"a"),s=m(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","n"),z=m(a=>T.has(a)?"default":q.has(a)?"destructive":"outline","U"),se=m(({limit:a=100})=>{let t=E(),h=R(),{data:x}=p(u.listTables,V,{live:!0}),D=x!==void 0,O=Array.isArray(x)&&Q.every(r=>x.some(d=>d.name===r)),c=h.payments&&O,o=p(u.readTablePage,{filters:[],limit:a,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:"subscriptions"},{enabled:c}),f=p(u.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:"events"},{enabled:c}),g=p(u.facetColumn,{column:"state",table:"subscriptions"},{enabled:c});B(()=>{c&&(o.refetch(),f.refetch(),g.refetch())},!0);let b=o.data?.rows??[],F=f.data?.rows??[],L=o.error??f.error,M=o.error===null?f.errorSource:o.errorSource,U=o.data?.total??b.length,_=g.data?.values===void 0?b.filter(r=>T.has(s(n(r,"state")))).length:g.data.values.reduce((r,d)=>r+(T.has(s(d.value))?d.count:0),0);return D&&!c?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(S,{description:t("No @lunora/payment tables found in this deployment. Declare the store tables (subscriptions, events, \u2026) in lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(v,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:_}),(0,e.jsx)(N,{variant:"default",children:t("{count} active",{count:_})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:U})})]})}),L===null?void 0:(0,e.jsx)(j,{error:M}),b.length===0&&!o.isLoading?(0,e.jsx)(S,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(v,{className:"overflow-hidden py-0",children:(0,e.jsx)(w,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(k,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(P,{children:b.map(r=>{let d=s(n(r,"state"));return(0,e.jsxs)(y,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(i,{children:s(n(r,"provider"))}),(0,e.jsx)(i,{children:s(n(r,"referenceId"))}),(0,e.jsx)(i,{children:s(n(r,"priceId"))}),(0,e.jsx)(i,{children:(0,e.jsx)(N,{variant:z(d),children:d})}),(0,e.jsx)(i,{children:I(n(r,"currentPeriodEnd"))})]},s(n(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(v,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(w,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(P,{children:F.map(r=>(0,e.jsxs)(y,{"data-testid":"payment-event-row",children:[(0,e.jsx)(i,{children:s(n(r,"provider"))}),(0,e.jsx)(i,{className:"font-medium",children:s(n(r,"type"))}),(0,e.jsx)(i,{className:"text-muted-foreground",children:s(n(r,"providerEventId"))}),(0,e.jsx)(i,{children:I(n(r,"processedAt"))})]},s(n(r,"providerEventId"))))})})})]})]})},"ae");export{se as PaymentsPanel};
@@ -1,3 +1,3 @@
1
- import{b as Se,c as Ie}from"./chunk-YOB2X3FZ.js";import{a as we}from"./chunk-EA2JKR5D.js";import{a as ye}from"./chunk-NFS7FTAR.js";import{a as Ne}from"./chunk-EJSI4PMU.js";import{b as pe}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as he}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{d as ge}from"./chunk-FZ5ZSUA2.js";import{f as xe}from"./chunk-PG7XHMUR.js";import"./chunk-FSRSK4LY.js";import{d as se}from"./chunk-5ICUJ4IA.js";import{a as ne,e as ie}from"./chunk-WUWBZPUK.js";import{d as be,f as ce,g as de,h as ee,p as me}from"./chunk-PTZD7RUZ.js";import{a as s,d as le,e as Ce,f as Te,g as Ee}from"./chunk-YKXDMIHQ.js";var ve=le(Te(),1);var g=le(Ce(),1);var r=le(Ee(),1);var Ae=ce(H.exportShard),Oe=ce(H.importShard),Le=s(x=>x.map(e=>JSON.stringify(Se(e))).join(`
1
+ import{b as Se,c as Ie}from"./chunk-YOB2X3FZ.js";import{a as we}from"./chunk-EA2JKR5D.js";import{a as ye}from"./chunk-NFS7FTAR.js";import{a as Ne}from"./chunk-EJSI4PMU.js";import{b as pe}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as he}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{d as ge}from"./chunk-6R3CL5GW.js";import{f as xe}from"./chunk-RATPWNIM.js";import"./chunk-FSRSK4LY.js";import{d as se}from"./chunk-5ICUJ4IA.js";import{a as ne,e as ie}from"./chunk-WUWBZPUK.js";import{d as be,f as ce,g as de,h as ee,p as me}from"./chunk-PTZD7RUZ.js";import{a as s,d as le,e as Ce,f as Te,g as Ee}from"./chunk-YKXDMIHQ.js";var ve=le(Te(),1);var g=le(Ce(),1);var r=le(Ee(),1);var Ae=ce(H.exportShard),Oe=ce(H.importShard),Le=s(x=>x.map(e=>JSON.stringify(Se(e))).join(`
2
2
  `),"Ce"),Je=s(x=>{let e=[],te=x.split(`
3
3
  `);for(let[n,N]of te.entries()){let t=N.trim();if(t==="")continue;let o=Ie(JSON.parse(t));if(typeof o!="object"||o===null)throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);let b=o;if(typeof b.table!="string"||typeof b.doc!="object"||b.doc===null||Array.isArray(b.doc))throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);e.push(b)}return e},"Te"),He=s(x=>{let e=(0,ve.c)(94),{initialShardKey:te}=x,n=xe(),N=ge(),t=be(),[o,b]=(0,g.useState)(te??""),[a,fe]=(0,g.useState)(""),[d,K]=(0,g.useState)(!1),[Q,M]=(0,g.useState)(null),[i,re]=(0,g.useState)(null),[y,ue]=(0,g.useState)(null),V;e[0]!==n||e[1]!==o?(V=s(async()=>{K(!0),M(null),re(null);try{let c=await n.query(Ae,{},de(o));pe(o),fe(Le(c.rows)),ue(c.rows.length)}catch(c){M(ee(c))}K(!1)},"G"),e[0]=n,e[1]=o,e[2]=V):V=e[2];let z=V,W;e[3]!==n||e[4]!==N||e[5]!==a||e[6]!==o||e[7]!==t?(W=s(async()=>{K(!0),M(null),re(null),ue(null);let c;try{c=Je(a)}catch(l){M(t("Invalid NDJSON: {message}",{message:ee(l)})),K(!1);return}try{let l=await n.query(Oe,{rows:c},de(o));pe(o),re(l),N(H.readTablePage),N(H.listTables)}catch(l){M(ee(l))}K(!1)},"Q"),e[3]=n,e[4]=N,e[5]=a,e[6]=o,e[7]=t,e[8]=W):W=e[8];let G=W,w,S,I,m,v,p,f,j,C,u,T;if(e[9]!==d||e[10]!==y||e[11]!==z||e[12]!==i||e[13]!==G||e[14]!==a||e[15]!==o||e[16]!==t){let c=i===null?0:Object.values(i.inserted).reduce(_e,0),l;e[28]!==z?(l=s(()=>{me(z())},"o"),e[28]=z,e[29]=l):l=e[29];let oe=l,Y;e[30]!==G?(Y=s(()=>{me(G())},"Y"),e[30]=G,e[31]=Y):Y=e[31];let ae=Y,Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=s(h=>{fe(h.target.value)},"Z"),e[32]=Z):Z=e[32];let je=Z;T="flex flex-col gap-4",I="lunora-export-import";let L;e[33]!==t?(L=t("Export"),e[33]=t,e[34]=L):L=e[34];let J;e[35]!==L?(J=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:L})}),e[35]=L,e[36]=J):J=e[36];let _;e[37]!==o?(_=(0,r.jsx)(Ne,{onChange:b,testId:"ei-shard-input",value:o}),e[37]=o,e[38]=_):_=e[38];let $;e[39]!==t?($=t("Export"),e[39]=t,e[40]=$):$=e[40];let k;e[41]!==d||e[42]!==oe||e[43]!==$?(k=(0,r.jsx)(he,{"data-testid":"ei-export",disabled:d,onClick:oe,type:"button",children:$}),e[41]=d,e[42]=oe,e[43]=$,e[44]=k):k=e[44];let D;e[45]!==_||e[46]!==k?(D=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,k]}),e[45]=_,e[46]=k,e[47]=D):D=e[47];let q;e[48]!==y||e[49]!==t?(q=y!==null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:t("Exported {count} rows.",{count:y})}),e[48]=y,e[49]=t,e[50]=q):q=e[50];let B;e[51]!==D||e[52]!==q?(B=(0,r.jsxs)(ie,{className:"flex flex-col gap-3 p-4",children:[D,q]}),e[51]=D,e[52]=q,e[53]=B):B=e[53],e[54]!==J||e[55]!==B?(m=(0,r.jsxs)(ne,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[J,B]}),e[54]=J,e[55]=B,e[56]=m):m=e[56],S=ne,C="gap-0 py-0 rounded-xl border border-border bg-card shadow-xs";let P;e[57]!==t?(P=t("Import"),e[57]=t,e[58]=P):P=e[58],e[59]!==P?(u=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:P})}),e[59]=P,e[60]=u):u=e[60],w=ie,v="flex flex-col gap-3 p-4",e[61]!==a?(p=(0,r.jsx)(we,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:je,placeholder:'{"table":"messages","doc":{\u2026}}',value:a}),e[61]=a,e[62]=p):p=e[62];let R;e[63]!==t?(R=t("Import (writes rows)?"),e[63]=t,e[64]=R):R=e[64];let U;e[65]!==d||e[66]!==a?(U=d||a.trim()==="",e[65]=d,e[66]=a,e[67]=U):U=e[67];let F;e[68]!==t?(F=t("Import"),e[68]=t,e[69]=F):F=e[69],e[70]!==ae||e[71]!==R||e[72]!==U||e[73]!==F?(f=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,r.jsx)(ye,{confirmLabel:R,disabled:U,onConfirm:ae,testId:"ei-import",children:F})}),e[70]=ae,e[71]=R,e[72]=U,e[73]=F,e[74]=f):f=e[74],j=i!==null&&(0,r.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:c})}),i.errors.length>0&&(0,r.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(h=>(0,r.jsx)("li",{className:"text-xs text-destructive",children:t("line {line} ({table}): {message}",{line:h.line,message:h.message,table:h.table})},`${h.table}-${h.line.toString()}`))})]}),e[9]=d,e[10]=y,e[11]=z,e[12]=i,e[13]=G,e[14]=a,e[15]=o,e[16]=t,e[17]=w,e[18]=S,e[19]=I,e[20]=m,e[21]=v,e[22]=p,e[23]=f,e[24]=j,e[25]=C,e[26]=u,e[27]=T}else w=e[17],S=e[18],I=e[19],m=e[20],v=e[21],p=e[22],f=e[23],j=e[24],C=e[25],u=e[26],T=e[27];let E;e[75]!==w||e[76]!==v||e[77]!==p||e[78]!==f||e[79]!==j?(E=(0,r.jsxs)(w,{className:v,children:[p,f,j]}),e[75]=w,e[76]=v,e[77]=p,e[78]=f,e[79]=j,e[80]=E):E=e[80];let A;e[81]!==S||e[82]!==E||e[83]!==C||e[84]!==u?(A=(0,r.jsxs)(S,{className:C,children:[u,E]}),e[81]=S,e[82]=E,e[83]=C,e[84]=u,e[85]=A):A=e[85];let O;e[86]!==Q?(O=Q!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:Q}),e[86]=Q,e[87]=O):O=e[87];let X;return e[88]!==I||e[89]!==m||e[90]!==A||e[91]!==O||e[92]!==T?(X=(0,r.jsxs)("div",{className:T,"data-testid":I,children:[m,A,O]}),e[88]=I,e[89]=m,e[90]=A,e[91]=O,e[92]=T,e[93]=X):X=e[93],X},"Ue");function _e(x,e){return x+e}s(_e,"Ae");export{He as ExportImportPanel};
@@ -1 +1 @@
1
- import{a as C}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as v}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as j}from"./chunk-ZVJOW25X.js";import"./chunk-ULIQFBZU.js";import"./chunk-46EQO6E7.js";import"./chunk-35DM4JJG.js";import{a as g}from"./chunk-4ZEL6BYL.js";import{c as h}from"./chunk-FZ5ZSUA2.js";import"./chunk-PG7XHMUR.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as $}from"./chunk-FKVZRPV5.js";import{a as I,b as _,c as q,d as p,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as S,e as K}from"./chunk-WUWBZPUK.js";import{d as T,t as F}from"./chunk-PTZD7RUZ.js";import{a as d,d as k,e as ne,f as oe,g as ie}from"./chunk-YKXDMIHQ.js";var Q=k(oe(),1),G=k(ne(),1);var e=k(ie(),1);var H="agent_threads",de="agent_messages",L="agent_run_queue",J=100,N=250,le={},ce={filters:[],limit:J,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:H},c=d((s,t)=>{let a=s[t];return typeof a=="string"?a:void 0},"c"),B=d((s,t)=>{let a=s[t];return typeof a=="number"?a:void 0},"E"),O=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"H"),me=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"de"),ue=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"le"),he=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"ie"),ge=d(s=>{let t=(0,Q.c)(3),{fetched:a}=s,m=T(),l;return t[0]!==a||t[1]!==m?(l=a<=N?null:(0,e.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"agents-messages-truncated",children:m("Showing the latest {count} messages; older ones are not shown.",{count:N})}),t[0]=a,t[1]=m,t[2]=l):l=t[2],l},"ce"),Te=d(({initialShardKey:s=""})=>{let t=T(),[a,m]=(0,G.useState)(void 0),{data:l}=h(g.listTables,le,{live:!0,shardKey:s}),V=l!==void 0,f=Array.isArray(l)&&l.some(r=>r.name===H),W=Array.isArray(l)&&l.some(r=>r.name===L),{data:E,error:X,errorSource:Y,liveError:Z}=h(g.readTablePage,ce,{enabled:f,live:!0,shardKey:s}),ee={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:N+1,offset:0,orderBy:{column:"seq",direction:"desc"},skipCount:!0,table:de},{data:P}=h(g.readTablePage,{limit:J,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:L},{enabled:W,live:!0,shardKey:s}),{data:U,error:te,errorSource:ae}=h(g.readTablePage,ee,{enabled:f&&a!==void 0,live:!0,shardKey:s}),b=Array.isArray(E?.rows)?E.rows:[],re=Array.isArray(P?.rows)?P.rows:[],z=d(r=>re.filter(n=>c(n,"threadKey")===r).length,"C"),M=Array.isArray(U?.rows)?U.rows:[],R=M.slice(0,N).toReversed(),D=b.find(r=>c(r,"key")===a),x;return V&&!f?x=(0,e.jsx)($,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):f&&b.length===0?x=(0,e.jsx)($,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):x=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(S,{className:"overflow-hidden py-0",children:(0,e.jsx)(K,{className:"px-0",children:(0,e.jsxs)(I,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Agent")}),(0,e.jsx)(o,{children:t("Key")}),(0,e.jsx)(o,{children:t("Status")}),(0,e.jsx)(o,{children:t("Queued")}),(0,e.jsx)(o,{children:t("Messages")}),(0,e.jsx)(o,{children:t("Tokens")}),(0,e.jsx)(o,{children:t("Updated")}),(0,e.jsx)(o,{"aria-label":t("Actions")})]})}),(0,e.jsx)(q,{children:b.map(r=>{let n=c(r,"key")??"",u=c(r,"status"),y=O(r);return(0,e.jsxs)(p,{"data-active":n===a?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:c(r,"agent")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(i,{children:(0,e.jsx)(v,{"data-testid":`agents-thread-status-${n}`,variant:ue(u),children:u??"\u2014"})}),(0,e.jsx)(i,{className:"tabular-nums",children:z(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:z(n)})}),(0,e.jsx)(i,{className:"tabular-nums",children:B(r,"messageCount")??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums text-muted-foreground",children:y??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:F(B(r,"updatedAt"),"\u2014")}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsx)(C,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{m(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),te!==null&&(0,e.jsx)(j,{error:ae,testId:"agents-messages-error"}),a!==void 0&&(0,e.jsx)(S,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(K,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,D!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",O(D)??0," ",t("Tokens")]})]}),(0,e.jsx)(C,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{m(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),(0,e.jsx)(ge,{fetched:M.length}),R.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(I,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Role")}),(0,e.jsx)(o,{children:t("Content")}),(0,e.jsx)(o,{children:t("Tool")}),(0,e.jsx)(o,{children:t("Approval")})]})}),(0,e.jsx)(q,{children:R.map((r,n)=>{let u=c(r,"role")??"\u2014",y=me(r),se=c(r,"toolName"),w=c(r,"status"),A=B(r,"seq")??n;return(0,e.jsxs)(p,{"data-testid":`agents-message-${String(A)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:u}),(0,e.jsx)(i,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:c(r,"content")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:se??(y.length>0?y.join(", "):"\u2014")}),(0,e.jsx)(i,{className:"align-top",children:w===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-message-approval-${String(A)}`,variant:he(w),children:w})})]},c(r,"messageKey")??`${u}:${String(A)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[X!==null&&(0,e.jsx)(j,{error:Y,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),Z!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),x]})},"Ee");export{Te as default};
1
+ import{a as C}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as v}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as j}from"./chunk-XBVXA2OK.js";import"./chunk-ULIQFBZU.js";import"./chunk-S54AMHYS.js";import"./chunk-35DM4JJG.js";import{a as g}from"./chunk-4ZEL6BYL.js";import{c as h}from"./chunk-6R3CL5GW.js";import"./chunk-RATPWNIM.js";import"./chunk-FSRSK4LY.js";import"./chunk-5ICUJ4IA.js";import{a as $}from"./chunk-FKVZRPV5.js";import{a as I,b as _,c as q,d as p,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as S,e as K}from"./chunk-WUWBZPUK.js";import{d as T,t as F}from"./chunk-PTZD7RUZ.js";import{a as d,d as k,e as ne,f as oe,g as ie}from"./chunk-YKXDMIHQ.js";var Q=k(oe(),1),G=k(ne(),1);var e=k(ie(),1);var H="agent_threads",de="agent_messages",L="agent_run_queue",J=100,N=250,le={},ce={filters:[],limit:J,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:H},c=d((s,t)=>{let a=s[t];return typeof a=="string"?a:void 0},"c"),B=d((s,t)=>{let a=s[t];return typeof a=="number"?a:void 0},"E"),O=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"H"),me=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"de"),ue=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"le"),he=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"ie"),ge=d(s=>{let t=(0,Q.c)(3),{fetched:a}=s,m=T(),l;return t[0]!==a||t[1]!==m?(l=a<=N?null:(0,e.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"agents-messages-truncated",children:m("Showing the latest {count} messages; older ones are not shown.",{count:N})}),t[0]=a,t[1]=m,t[2]=l):l=t[2],l},"ce"),Te=d(({initialShardKey:s=""})=>{let t=T(),[a,m]=(0,G.useState)(void 0),{data:l}=h(g.listTables,le,{live:!0,shardKey:s}),V=l!==void 0,f=Array.isArray(l)&&l.some(r=>r.name===H),W=Array.isArray(l)&&l.some(r=>r.name===L),{data:E,error:X,errorSource:Y,liveError:Z}=h(g.readTablePage,ce,{enabled:f,live:!0,shardKey:s}),ee={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:N+1,offset:0,orderBy:{column:"seq",direction:"desc"},skipCount:!0,table:de},{data:P}=h(g.readTablePage,{limit:J,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:L},{enabled:W,live:!0,shardKey:s}),{data:U,error:te,errorSource:ae}=h(g.readTablePage,ee,{enabled:f&&a!==void 0,live:!0,shardKey:s}),b=Array.isArray(E?.rows)?E.rows:[],re=Array.isArray(P?.rows)?P.rows:[],z=d(r=>re.filter(n=>c(n,"threadKey")===r).length,"C"),M=Array.isArray(U?.rows)?U.rows:[],R=M.slice(0,N).toReversed(),D=b.find(r=>c(r,"key")===a),x;return V&&!f?x=(0,e.jsx)($,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):f&&b.length===0?x=(0,e.jsx)($,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):x=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(S,{className:"overflow-hidden py-0",children:(0,e.jsx)(K,{className:"px-0",children:(0,e.jsxs)(I,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Agent")}),(0,e.jsx)(o,{children:t("Key")}),(0,e.jsx)(o,{children:t("Status")}),(0,e.jsx)(o,{children:t("Queued")}),(0,e.jsx)(o,{children:t("Messages")}),(0,e.jsx)(o,{children:t("Tokens")}),(0,e.jsx)(o,{children:t("Updated")}),(0,e.jsx)(o,{"aria-label":t("Actions")})]})}),(0,e.jsx)(q,{children:b.map(r=>{let n=c(r,"key")??"",u=c(r,"status"),y=O(r);return(0,e.jsxs)(p,{"data-active":n===a?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:c(r,"agent")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(i,{children:(0,e.jsx)(v,{"data-testid":`agents-thread-status-${n}`,variant:ue(u),children:u??"\u2014"})}),(0,e.jsx)(i,{className:"tabular-nums",children:z(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:z(n)})}),(0,e.jsx)(i,{className:"tabular-nums",children:B(r,"messageCount")??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums text-muted-foreground",children:y??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:F(B(r,"updatedAt"),"\u2014")}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsx)(C,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{m(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),te!==null&&(0,e.jsx)(j,{error:ae,testId:"agents-messages-error"}),a!==void 0&&(0,e.jsx)(S,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(K,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,D!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",O(D)??0," ",t("Tokens")]})]}),(0,e.jsx)(C,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{m(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),(0,e.jsx)(ge,{fetched:M.length}),R.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(I,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Role")}),(0,e.jsx)(o,{children:t("Content")}),(0,e.jsx)(o,{children:t("Tool")}),(0,e.jsx)(o,{children:t("Approval")})]})}),(0,e.jsx)(q,{children:R.map((r,n)=>{let u=c(r,"role")??"\u2014",y=me(r),se=c(r,"toolName"),w=c(r,"status"),A=B(r,"seq")??n;return(0,e.jsxs)(p,{"data-testid":`agents-message-${String(A)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:u}),(0,e.jsx)(i,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:c(r,"content")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:se??(y.length>0?y.join(", "):"\u2014")}),(0,e.jsx)(i,{className:"align-top",children:w===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-message-approval-${String(A)}`,variant:he(w),children:w})})]},c(r,"messageKey")??`${u}:${String(A)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[X!==null&&(0,e.jsx)(j,{error:Y,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),Z!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),x]})},"Ee");export{Te as default};