@lunora/studio 1.0.0-alpha.78 → 1.0.0-alpha.79

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 (119) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +1 -1
  3. package/dist/mount.js +1 -1
  4. package/dist/packem_chunks/ApiTab.js +1 -1
  5. package/dist/packem_chunks/AuditPanel.js +1 -1
  6. package/dist/packem_chunks/ExportImportPanel.js +1 -1
  7. package/dist/packem_chunks/FileBrowser.js +1 -1
  8. package/dist/packem_chunks/FunctionRunner.js +1 -1
  9. package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
  10. package/dist/packem_chunks/HealthPanel.js +1 -1
  11. package/dist/packem_chunks/InsightsPanel.js +1 -1
  12. package/dist/packem_chunks/LogsPanel.js +1 -1
  13. package/dist/packem_chunks/MailPanel.js +1 -1
  14. package/dist/packem_chunks/MetricsPanel.js +1 -1
  15. package/dist/packem_chunks/MigrationsPanel.js +1 -1
  16. package/dist/packem_chunks/NotificationsPanel.js +1 -1
  17. package/dist/packem_chunks/PitrPanel.js +1 -1
  18. package/dist/packem_chunks/SchemaViewer.js +1 -1
  19. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
  20. package/dist/packem_chunks/SettingsPanel.js +1 -1
  21. package/dist/packem_chunks/SqlEditorPanel.js +1 -1
  22. package/dist/packem_chunks/TableEditor.js +1 -1
  23. package/dist/packem_chunks/agents-panel.js +1 -1
  24. package/dist/packem_chunks/auth-audit-panel.js +1 -1
  25. package/dist/packem_chunks/containers-panel.js +1 -1
  26. package/dist/packem_chunks/dashboards-panel.js +1 -1
  27. package/dist/packem_chunks/fanout-panel.js +1 -1
  28. package/dist/packem_chunks/flags-panel.js +1 -1
  29. package/dist/packem_chunks/issues-panel.js +1 -1
  30. package/dist/packem_chunks/kv-browser.js +1 -1
  31. package/dist/packem_chunks/organizations-panel.js +1 -1
  32. package/dist/packem_chunks/payments-panel.js +1 -1
  33. package/dist/packem_chunks/permissions-panel.js +1 -1
  34. package/dist/packem_chunks/queues-panel.js +1 -1
  35. package/dist/packem_chunks/rls-panel.js +1 -1
  36. package/dist/packem_chunks/storage-rules-panel.js +1 -1
  37. package/dist/packem_chunks/subscriptions-panel.js +1 -1
  38. package/dist/packem_chunks/traces-panel.js +1 -1
  39. package/dist/packem_chunks/users-panel.js +1 -1
  40. package/dist/packem_chunks/workflows-panel.js +1 -1
  41. package/dist/packem_shared/ADMIN_FUNCTIONS-CpgIo9pj.js +1 -0
  42. package/dist/packem_shared/{ApiDocsPanel-eJYZlylw.js → ApiDocsPanel-CjdsxN1t.js} +1 -1
  43. package/dist/packem_shared/{DataBrowser-B8J5lHjP.js → DataBrowser-Bfstz_au.js} +1 -1
  44. package/dist/packem_shared/{HomePanel-DL1HupAN.js → HomePanel-B8EFM4u3.js} +1 -1
  45. package/dist/packem_shared/{Studio-BWBclm_C.js → Studio-BDtS9C5g.js} +1 -1
  46. package/dist/packem_shared/{StudioApp-BFm73yVr.js → StudioApp-DjLzIO9E.js} +1 -1
  47. package/dist/packem_shared/{home-panel-B-8BCffw.js → home-panel-Cm88Nvqh.js} +1 -1
  48. package/dist/packem_shared/{studio-BHA7hnI3.js → studio-BmWFd-Rz.js} +1 -1
  49. package/dist/packem_shared/use-async-submit-DLNCqLFq.js +1 -0
  50. package/dist/packem_shared/use-auth-config-9S_K_W-G.js +1 -0
  51. package/dist/standalone/{chunk-EVN46TVV.js → chunk-2SHUN7KF.js} +1 -1
  52. package/dist/standalone/{chunk-C43X4M5U.js → chunk-3EXLKL6V.js} +1 -1
  53. package/dist/standalone/{chunk-KDOC2DP5.js → chunk-3KAERFMC.js} +1 -1
  54. package/dist/standalone/{chunk-GSPTEMYN.js → chunk-4XDMVUS5.js} +1 -1
  55. package/dist/standalone/{chunk-YD5NF6UT.js → chunk-5YWJNF5X.js} +1 -1
  56. package/dist/standalone/chunk-66YJ3IOZ.js +1 -0
  57. package/dist/standalone/{chunk-2F7G7IWQ.js → chunk-6CULAILE.js} +1 -1
  58. package/dist/standalone/{chunk-D7XXWV4E.js → chunk-6KHEBRBB.js} +1 -1
  59. package/dist/standalone/{chunk-4WLYA3XE.js → chunk-6WCIFGDW.js} +1 -1
  60. package/dist/standalone/{chunk-OHKRN65U.js → chunk-7RG3AKPY.js} +1 -1
  61. package/dist/standalone/{chunk-65OTWFS3.js → chunk-A2FPLOMJ.js} +1 -1
  62. package/dist/standalone/chunk-AADILRJW.js +14 -0
  63. package/dist/standalone/chunk-AADXUXZO.js +1 -0
  64. package/dist/standalone/{chunk-L7N7F3DA.js → chunk-ARI4JTIH.js} +1 -1
  65. package/dist/standalone/chunk-AVZGVZZ7.js +1 -0
  66. package/dist/standalone/{chunk-5U2THBI7.js → chunk-BDO4J5AP.js} +1 -1
  67. package/dist/standalone/{chunk-XSD4Y6SQ.js → chunk-BMQJ4CAO.js} +1 -1
  68. package/dist/standalone/{chunk-5L2MD6F6.js → chunk-CMUP7HPS.js} +1 -1
  69. package/dist/standalone/{chunk-QGKAJTQQ.js → chunk-CP7AUUOU.js} +1 -1
  70. package/dist/standalone/{chunk-UIS34ZPB.js → chunk-DX3RMFQU.js} +1 -1
  71. package/dist/standalone/{chunk-5OWIOACV.js → chunk-E2CJUP53.js} +1 -1
  72. package/dist/standalone/{chunk-FGTK44LR.js → chunk-EIT7ERYE.js} +1 -1
  73. package/dist/standalone/{chunk-35II7U25.js → chunk-EN2QAEO4.js} +1 -1
  74. package/dist/standalone/{chunk-QVEHPYA5.js → chunk-FLYO3XY5.js} +1 -1
  75. package/dist/standalone/{chunk-DVOBKIUX.js → chunk-FWCKM2CU.js} +1 -1
  76. package/dist/standalone/{chunk-VPAXCQ2Y.js → chunk-GITJXQOS.js} +1 -1
  77. package/dist/standalone/{chunk-SA3MDZC3.js → chunk-GP6IRITM.js} +1 -1
  78. package/dist/standalone/{chunk-VGHSEUEX.js → chunk-GXU3ATKS.js} +1 -1
  79. package/dist/standalone/{chunk-FPLGBHY4.js → chunk-H5Y5NQPL.js} +1 -1
  80. package/dist/standalone/{chunk-34UVAASH.js → chunk-HALNNKTC.js} +1 -1
  81. package/dist/standalone/{chunk-UNUU7CJJ.js → chunk-HK4OVYG3.js} +1 -1
  82. package/dist/standalone/{chunk-ZNNAGR6N.js → chunk-HQEMYD2K.js} +1 -1
  83. package/dist/standalone/{chunk-F6GOKFMU.js → chunk-HYT2ZUNP.js} +2 -2
  84. package/dist/standalone/{chunk-7RXOPYR5.js → chunk-I4WGRDL2.js} +1 -1
  85. package/dist/standalone/{chunk-P24JBHEZ.js → chunk-ISZSYNTI.js} +1 -1
  86. package/dist/standalone/chunk-JWG3VRGB.js +1 -0
  87. package/dist/standalone/{chunk-RAA2RGG6.js → chunk-KDYNM3GV.js} +1 -1
  88. package/dist/standalone/{chunk-T2JIUFOD.js → chunk-KP6JQSH2.js} +1 -1
  89. package/dist/standalone/{chunk-IDNNI63H.js → chunk-LSEZN2ZL.js} +1 -1
  90. package/dist/standalone/{chunk-LJDP7NRB.js → chunk-LU3GW7HI.js} +1 -1
  91. package/dist/standalone/chunk-MVGE3JJN.js +1 -0
  92. package/dist/standalone/chunk-MXSHWB3M.js +1 -0
  93. package/dist/standalone/{chunk-BEH5N5ZA.js → chunk-NG6LYBPJ.js} +1 -1
  94. package/dist/standalone/{chunk-HP2UCWND.js → chunk-NL2DZKFI.js} +1 -1
  95. package/dist/standalone/{chunk-EXFBIISG.js → chunk-OGVCXKRL.js} +1 -1
  96. package/dist/standalone/{chunk-EKRN4ZQM.js → chunk-OPC233PZ.js} +1 -1
  97. package/dist/standalone/{chunk-TLHJRWNK.js → chunk-P4CWOYFL.js} +1 -1
  98. package/dist/standalone/{chunk-QLJJ5YYZ.js → chunk-PRJ4RJDU.js} +1 -1
  99. package/dist/standalone/{chunk-XEDU5FO4.js → chunk-PUY3YDXI.js} +1 -1
  100. package/dist/standalone/{chunk-FGTABSAK.js → chunk-QZMR6MUG.js} +1 -1
  101. package/dist/standalone/{chunk-F5QWLENA.js → chunk-W6TE2I2D.js} +1 -1
  102. package/dist/standalone/{chunk-PF7V3G2Z.js → chunk-WCWYSOCN.js} +1 -1
  103. package/dist/standalone/{chunk-BNUJ7QMG.js → chunk-WEO3YVP6.js} +1 -1
  104. package/dist/standalone/{chunk-6DWCIIHE.js → chunk-XIZNYKOD.js} +1 -1
  105. package/dist/standalone/{chunk-3FUFEZ65.js → chunk-XS6Q6GGV.js} +1 -1
  106. package/dist/standalone/{chunk-XQBTNJUQ.js → chunk-Y3CQDULJ.js} +1 -1
  107. package/dist/standalone/{chunk-7J5N6DGQ.js → chunk-YCRMVBPW.js} +1 -1
  108. package/dist/standalone/{chunk-H7NIIBHH.js → chunk-Z2JPEI2V.js} +1 -1
  109. package/dist/standalone/studio.js +1 -1
  110. package/dist/styles.css +1 -1
  111. package/package.json +6 -6
  112. package/dist/packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js +0 -1
  113. package/dist/packem_shared/use-async-submit-H68GHPz8.js +0 -1
  114. package/dist/standalone/chunk-3QRTYSSX.js +0 -1
  115. package/dist/standalone/chunk-B43FTQJ7.js +0 -1
  116. package/dist/standalone/chunk-GXZAXNZI.js +0 -1
  117. package/dist/standalone/chunk-LE56LPNH.js +0 -13
  118. package/dist/standalone/chunk-PWWHP76O.js +0 -1
  119. package/dist/standalone/chunk-YI3WYUXK.js +0 -1
@@ -1 +1 @@
1
- import{a as wt}from"./chunk-KUVMORDQ.js";import{a as bt,b as vt,c as Nt,d as yt,e as Ve}from"./chunk-5L2MD6F6.js";import{a as pt}from"./chunk-QWGT25SE.js";import{a as ht,b as gt,c as ft,d as xt,e as je}from"./chunk-3RTTXLMU.js";import"./chunk-2PJNAWB3.js";import{a as mt}from"./chunk-X2FQ6B5V.js";import{e as ut}from"./chunk-SKHEGARW.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import"./chunk-7YEFOSPH.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-PF7V3G2Z.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import{e as tt}from"./chunk-SMIESS7P.js";import{a as dt}from"./chunk-LFKCLLPT.js";import"./chunk-T6VMSOBB.js";import{b as Le}from"./chunk-XSD4Y6SQ.js";import{a as We,b as Be,c as Ge,d as Re,e as se,f as E}from"./chunk-MIQTKZAR.js";import{a as he,b as Oe,c as Ce,d as rt,e as fe}from"./chunk-UZERI5YC.js";import"./chunk-QBWRC5YX.js";import{a as ct}from"./chunk-LFXFP4IF.js";import{a as it,b as ot}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as Ue}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Qe}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as De}from"./chunk-GXZAXNZI.js";import{f as et}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{d as Te,f as at,g as lt,h as st,i as nt,m as He,p as Ke}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as o,e as Je,f as $t,g as kt,h as _t}from"./chunk-3XIESWL4.js";var Fe=Je(kt(),1);var O=Je($t(),1);var t=Je(_t(),1);var It=o((s,e)=>s<e?-1:s>e?1:0,"Mt"),Ze=o(s=>{if(s===void 0)return"null";if(typeof s=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s))return`[${s.map(p=>Ze(p)).join(",")}]`;let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let p=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${p} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let l=s,r=Object.keys(l).toSorted(It),a=[];for(let p of r){let b=l[p];b!==void 0&&a.push(`${JSON.stringify(p)}:${Ze(b)}`)}return`{${a.join(",")}}`},"We"),St=o((s,e,l)=>`${s}:${e}:${Ze(l??{})}`,"rt"),qt=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"at"),Mt=o((s,e)=>qt(s,e),"It"),Ft=o(s=>qt(s.kind,s),"Ft"),Xe=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"Je"),Tt=o(s=>Array.isArray(s?.series)?s.series:[],"Ct"),Ot="FUNCTION_NOT_FOUND",Ct=o(s=>{let e=new Map;if(!Array.isArray(s?.series))return e;for(let l of s.series)e.set(St(l.kind,l.name,l.attributes),l.points);return e},"Tt"),Dt={counter:"secondary",gauge:"default",histogram:"outline"},Rt=o(s=>{let e=(0,Fe.c)(18),{name:l,onOpenTrace:r,traceId:a}=s,p=Te();if(a===void 0){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=m):m=e[0],m}let b;e[1]!==a?(b=a.slice(0,8),e[1]=a,e[2]=b):b=e[2];let f=b;if(r===void 0){let m=`mt-instrument-trace-${l}`,N;return e[3]!==f||e[4]!==m||e[5]!==a?(N=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":m,title:a,children:f}),e[3]=f,e[4]=m,e[5]=a,e[6]=N):N=e[6],N}let h=`mt-instrument-trace-${l}`,g;e[7]!==r||e[8]!==a?(g=o(()=>{r(a)},"g"),e[7]=r,e[8]=a,e[9]=g):g=e[9];let v;e[10]!==p||e[11]!==a?(v=p("Open the exemplar trace {trace}",{trace:a}),e[10]=p,e[11]=a,e[12]=v):v=e[12];let u;return e[13]!==f||e[14]!==h||e[15]!==g||e[16]!==v?(u=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":h,onClick:g,title:v,type:"button",children:f}),e[13]=f,e[14]=h,e[15]=g,e[16]=v,e[17]=u):u=e[17],u},"Dt"),jt=o(s=>{let e=(0,Fe.c)(105),{onOpenTrace:l,shardKey:r}=s,a=Te(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let b;e[1]!==r?(b={live:!0,shardKey:r},e[1]=r,e[2]=b):b=e[2];let{data:f,error:h,errorSource:g}=Le(De.getMetricSeries,p,b),v;e[3]===Symbol.for("react.memo_cache_sentinel")?(v={},e[3]=v):v=e[3];let u;e[4]!==r?(u={live:!0,shardKey:r},e[4]=r,e[5]=u):u=e[5];let{data:m}=Le(De.getMetricHistory,v,u),N,ne,C,P,J,c,q,ie,D,R,M,x,j;if(e[6]!==f||e[7]!==h||e[8]!==g||e[9]!==m||e[10]!==l||e[11]!==a){ie=Symbol.for("react.early_return_sentinel");e:{let ce=Tt(f),me=nt(g)===Ot;if(h!==null&&!me){let i;e[25]!==a?(i=a("Instruments"),e[25]=a,e[26]=i):i=e[26];let F;e[27]!==i?(F=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:i}),e[27]=i,e[28]=F):F=e[28];let A;e[29]!==h||e[30]!==a?(A=a("Instruments unavailable: {error}",{error:h}),e[29]=h,e[30]=a,e[31]=A):A=e[31];let K;e[32]!==A?(K=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:A}),e[32]=A,e[33]=K):K=e[33];let le;e[34]!==F||e[35]!==K?(le=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[F,K]}),e[34]=F,e[35]=K,e[36]=le):le=e[36],ie=le;break e}if(ce.length===0){ie=null;break e}let ue=Ct(m),Q;e[37]!==a?(Q=o(i=>a(i==="counter"?"Counter":i==="gauge"?"Gauge":"Histogram"),"P"),e[37]=a,e[38]=Q):Q=e[38];let n=Q;J="flex flex-col gap-2",c="mt-instruments";let k;e[39]!==a?(k=a("Instruments"),e[39]=a,e[40]=k):k=e[40],e[41]!==k?(q=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:k}),e[41]=k,e[42]=q):q=e[42],P=he,j="overflow-hidden py-0",C=fe,x="px-0",ne=We,R="mt-instruments-table";let y;e[43]!==a?(y=a("name"),e[43]=a,e[44]=y):y=e[44];let S;e[45]!==y?(S=(0,t.jsx)(se,{children:y}),e[45]=y,e[46]=S):S=e[46];let U;e[47]!==a?(U=a("kind"),e[47]=a,e[48]=U):U=e[48];let H;e[49]!==U?(H=(0,t.jsx)(se,{children:U}),e[49]=U,e[50]=H):H=e[50];let W;e[51]!==a?(W=a("value"),e[51]=a,e[52]=W):W=e[52];let B;e[53]!==W?(B=(0,t.jsx)(se,{className:"text-right",children:W}),e[53]=W,e[54]=B):B=e[54];let G;e[55]!==a?(G=a("count"),e[55]=a,e[56]=G):G=e[56];let V;e[57]!==G?(V=(0,t.jsx)(se,{className:"text-right",children:G}),e[57]=G,e[58]=V):V=e[58];let X;e[59]!==a?(X=a("range"),e[59]=a,e[60]=X):X=e[60];let Y;e[61]!==X?(Y=(0,t.jsx)(se,{className:"text-right",children:X}),e[61]=X,e[62]=Y):Y=e[62];let Z;e[63]!==a?(Z=a("trend"),e[63]=a,e[64]=Z):Z=e[64];let ee;e[65]!==Z?(ee=(0,t.jsx)(se,{children:Z}),e[65]=Z,e[66]=ee):ee=e[66];let te;e[67]!==a?(te=a("trace"),e[67]=a,e[68]=te):te=e[68];let re;e[69]!==te?(re=(0,t.jsx)(se,{children:te}),e[69]=te,e[70]=re):re=e[70];let de;e[71]!==a?(de=a("dimensions"),e[71]=a,e[72]=de):de=e[72];let ae;e[73]!==de?(ae=(0,t.jsx)(se,{children:de}),e[73]=de,e[74]=ae):ae=e[74],e[75]!==S||e[76]!==H||e[77]!==B||e[78]!==V||e[79]!==Y||e[80]!==ee||e[81]!==re||e[82]!==ae?(M=(0,t.jsx)(Be,{children:(0,t.jsxs)(Re,{children:[S,H,B,V,Y,ee,re,ae]})}),e[75]=S,e[76]=H,e[77]=B,e[78]=V,e[79]=Y,e[80]=ee,e[81]=re,e[82]=ae,e[83]=M):M=e[83],N=Ge,D=ce.map(i=>{let F=pt(i.attributes),A=St(i.kind,i.name,i.attributes),K=(ue.get(A)??[]).map(le=>Mt(i.kind,le));return(0,t.jsxs)(Re,{"data-testid":`mt-instrument-${i.name}`,children:[(0,t.jsx)(E,{className:"font-mono text-xs",title:i.functionPath,children:i.name}),(0,t.jsx)(E,{children:(0,t.jsx)(Qe,{variant:Dt[i.kind],children:n(i.kind)})}),(0,t.jsx)(E,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${i.name}`,children:Xe(Ft(i))}),(0,t.jsx)(E,{className:"text-right tabular-nums text-muted-foreground",children:i.count.toLocaleString()}),(0,t.jsx)(E,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:i.min===i.max?"\u2014":`${Xe(i.min)}\u2013${Xe(i.max)}`}),(0,t.jsx)(E,{children:K.length>=2?(0,t.jsx)(Ve,{ariaLabel:a("{name} trend",{name:i.name}),className:"h-6 w-24 text-foreground",series:K,testId:`mt-instrument-trend-${i.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(E,{className:"font-mono text-xs",children:(0,t.jsx)(Rt,{name:i.name,onOpenTrace:l,traceId:i.exemplarTraceId})}),(0,t.jsx)(E,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:F,children:F===""?"\u2014":F})]},A)})}e[6]=f,e[7]=h,e[8]=g,e[9]=m,e[10]=l,e[11]=a,e[12]=N,e[13]=ne,e[14]=C,e[15]=P,e[16]=J,e[17]=c,e[18]=q,e[19]=ie,e[20]=D,e[21]=R,e[22]=M,e[23]=x,e[24]=j}else N=e[12],ne=e[13],C=e[14],P=e[15],J=e[16],c=e[17],q=e[18],ie=e[19],D=e[20],R=e[21],M=e[22],x=e[23],j=e[24];if(ie!==Symbol.for("react.early_return_sentinel"))return ie;let L;e[84]!==N||e[85]!==D?(L=(0,t.jsx)(N,{children:D}),e[84]=N,e[85]=D,e[86]=L):L=e[86];let I;e[87]!==ne||e[88]!==L||e[89]!==R||e[90]!==M?(I=(0,t.jsxs)(ne,{"data-testid":R,children:[M,L]}),e[87]=ne,e[88]=L,e[89]=R,e[90]=M,e[91]=I):I=e[91];let z;e[92]!==C||e[93]!==I||e[94]!==x?(z=(0,t.jsx)(C,{className:x,children:I}),e[92]=C,e[93]=I,e[94]=x,e[95]=z):z=e[95];let w;e[96]!==P||e[97]!==z||e[98]!==j?(w=(0,t.jsx)(P,{className:j,children:z}),e[96]=P,e[97]=z,e[98]=j,e[99]=w):w=e[99];let $;return e[100]!==J||e[101]!==c||e[102]!==q||e[103]!==w?($=(0,t.jsxs)("section",{className:J,"data-testid":c,children:[q,w]}),e[100]=J,e[101]=c,e[102]=q,e[103]=w,e[104]=$):$=e[104],$},"Lt"),Pe=o(s=>s>=100?"critical":s>=50?"warning":"good","je"),Ye=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Qe"),Ee=o(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"Le"),zt=o(s=>{let e=(0,Fe.c)(3),{level:l}=s;if(l==="critical"){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(Qe,{variant:"destructive",children:"Slow"}),e[0]=a):a=e[0],a}if(l==="warning"){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"}),e[1]=a):a=e[1],a}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"}),e[2]=r):r=e[2],r},"At"),At=o(s=>{let e=(0,Fe.c)(152),{queryStats:l}=s,r=Te(),[a,p]=(0,O.useState)("totalTime"),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=new Set,e[0]=b):b=e[0];let[f,h]=(0,O.useState)(b),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=o(d=>{d!==null&&p(d)},"g"),e[1]=g):g=e[1];let v=g,u;if(e[2]!==l||e[3]!==a){u=[...l];let d;e[5]!==a?(d=o((T,_)=>{switch(a){case"avgTime":return _.avgDurationMs-T.avgDurationMs;case"execCount":return _.execCount-T.execCount;case"rowsRead":return _.rowsRead-T.rowsRead;default:return _.totalDurationMs-T.totalDurationMs}},"d"),e[5]=a,e[6]=d):d=e[6],u.sort(d),e[2]=l,e[3]=a,e[4]=u}else u=e[4];let m=u,N;e[7]!==l?(N=l.filter(Kt),e[7]=l,e[8]=N):N=e[8];let ne=N.length,C;e[9]!==l?(C=l.filter(Lt),e[9]=l,e[10]=C):C=e[10];let P=C.length,J;e[11]!==l?(J=l.filter(Et),e[11]=l,e[12]=J):J=e[12];let c=J.length,q;e[13]===Symbol.for("react.memo_cache_sentinel")?(q=o(d=>{h(T=>{let _=new Set(T);return _.has(d)?_.delete(d):_.add(d),_})},"S"),e[13]=q):q=e[13];let ie=q;if(l.length===0){let d;e[14]!==r?(d=r("No query insights yet"),e[14]=r,e[15]=d):d=e[15];let T;e[16]!==d?(T=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:d}),e[16]=d,e[17]=T):T=e[17];let _;e[18]!==r?(_=r("Query insights appear once statements are executed against this shard."),e[18]=r,e[19]=_):_=e[19];let ge;e[20]!==_?(ge=(0,t.jsx)("p",{className:"mt-1 text-sm",children:_}),e[20]=_,e[21]=ge):ge=e[21];let Ae;return e[22]!==ge||e[23]!==T?(Ae=(0,t.jsx)(he,{children:(0,t.jsx)(fe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[T,ge]})})}),e[22]=ge,e[23]=T,e[24]=Ae):Ae=e[24],Ae}let D;e[25]!==r?(D=r("Critical queries"),e[25]=r,e[26]=D):D=e[26];let R;e[27]!==D?(R=(0,t.jsx)(Oe,{className:"pb-2",children:(0,t.jsx)(Ce,{className:"text-sm font-medium",children:D})}),e[27]=D,e[28]=R):R=e[28];let M;e[29]!==ne?(M=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:ne}),e[29]=ne,e[30]=M):M=e[30];let x;e[31]!==r?(x=r(">100ms avg execution"),e[31]=r,e[32]=x):x=e[32];let j;e[33]!==x?(j=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x}),e[33]=x,e[34]=j):j=e[34];let L;e[35]!==j||e[36]!==M?(L=(0,t.jsxs)(fe,{children:[M,j]}),e[35]=j,e[36]=M,e[37]=L):L=e[37];let I;e[38]!==L||e[39]!==R?(I=(0,t.jsxs)(he,{children:[R,L]}),e[38]=L,e[39]=R,e[40]=I):I=e[40];let z;e[41]!==r?(z=r("Moderate queries"),e[41]=r,e[42]=z):z=e[42];let w;e[43]!==z?(w=(0,t.jsx)(Oe,{className:"pb-2",children:(0,t.jsx)(Ce,{className:"text-sm font-medium",children:z})}),e[43]=z,e[44]=w):w=e[44];let $;e[45]!==P?($=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:P}),e[45]=P,e[46]=$):$=e[46];let ce;e[47]!==r?(ce=r("50\u2013100ms avg execution"),e[47]=r,e[48]=ce):ce=e[48];let me;e[49]!==ce?(me=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ce}),e[49]=ce,e[50]=me):me=e[50];let ue;e[51]!==$||e[52]!==me?(ue=(0,t.jsxs)(fe,{children:[$,me]}),e[51]=$,e[52]=me,e[53]=ue):ue=e[53];let Q;e[54]!==w||e[55]!==ue?(Q=(0,t.jsxs)(he,{children:[w,ue]}),e[54]=w,e[55]=ue,e[56]=Q):Q=e[56];let n;e[57]!==r?(n=r("Fast queries"),e[57]=r,e[58]=n):n=e[58];let k;e[59]!==n?(k=(0,t.jsx)(Oe,{className:"pb-2",children:(0,t.jsx)(Ce,{className:"text-sm font-medium",children:n})}),e[59]=n,e[60]=k):k=e[60];let y;e[61]!==c?(y=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:c}),e[61]=c,e[62]=y):y=e[62];let S;e[63]!==r?(S=r("<50ms avg execution"),e[63]=r,e[64]=S):S=e[64];let U;e[65]!==S?(U=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:S}),e[65]=S,e[66]=U):U=e[66];let H;e[67]!==y||e[68]!==U?(H=(0,t.jsxs)(fe,{children:[y,U]}),e[67]=y,e[68]=U,e[69]=H):H=e[69];let W;e[70]!==k||e[71]!==H?(W=(0,t.jsxs)(he,{children:[k,H]}),e[70]=k,e[71]=H,e[72]=W):W=e[72];let B;e[73]!==I||e[74]!==Q||e[75]!==W?(B=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[I,Q,W]}),e[73]=I,e[74]=Q,e[75]=W,e[76]=B):B=e[76];let G;e[77]!==r?(G=r("Query leaderboard"),e[77]=r,e[78]=G):G=e[78];let V;e[79]!==G?(V=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:G}),e[79]=G,e[80]=V):V=e[80];let X;e[81]!==a||e[82]!==r?(X=r("Slow queries sorted by {sortField}",{sortField:r(a)}),e[81]=a,e[82]=r,e[83]=X):X=e[83];let Y;e[84]!==X?(Y=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:X}),e[84]=X,e[85]=Y):Y=e[85];let Z;e[86]!==V||e[87]!==Y?(Z=(0,t.jsxs)("div",{children:[V,Y]}),e[86]=V,e[87]=Y,e[88]=Z):Z=e[88];let ee;e[89]!==r?(ee=r("Sort by"),e[89]=r,e[90]=ee):ee=e[90];let te;e[91]!==ee?(te=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ee}),e[91]=ee,e[92]=te):te=e[92];let re;e[93]!==r?(re=r("Sort queries by"),e[93]=r,e[94]=re):re=e[94];let de;e[95]===Symbol.for("react.memo_cache_sentinel")?(de=(0,t.jsx)(gt,{}),e[95]=de):de=e[95];let ae;e[96]!==re?(ae=(0,t.jsx)(ft,{"aria-label":re,className:"w-[140px]","data-testid":"qi-sort",children:de}),e[96]=re,e[97]=ae):ae=e[97];let i;e[98]!==r?(i=r("Total time"),e[98]=r,e[99]=i):i=e[99];let F;e[100]!==i?(F=(0,t.jsx)(je,{value:"totalTime",children:i}),e[100]=i,e[101]=F):F=e[101];let A;e[102]!==r?(A=r("Avg time"),e[102]=r,e[103]=A):A=e[103];let K;e[104]!==A?(K=(0,t.jsx)(je,{value:"avgTime",children:A}),e[104]=A,e[105]=K):K=e[105];let le;e[106]!==r?(le=r("Execution count"),e[106]=r,e[107]=le):le=e[107];let xe;e[108]!==le?(xe=(0,t.jsx)(je,{value:"execCount",children:le}),e[108]=le,e[109]=xe):xe=e[109];let pe;e[110]!==r?(pe=r("Rows read"),e[110]=r,e[111]=pe):pe=e[111];let be;e[112]!==pe?(be=(0,t.jsx)(je,{value:"rowsRead",children:pe}),e[112]=pe,e[113]=be):be=e[113];let ve;e[114]!==F||e[115]!==K||e[116]!==xe||e[117]!==be?(ve=(0,t.jsxs)(xt,{children:[F,K,xe,be]}),e[114]=F,e[115]=K,e[116]=xe,e[117]=be,e[118]=ve):ve=e[118];let Ne;e[119]!==a||e[120]!==ae||e[121]!==ve?(Ne=(0,t.jsxs)(ht,{onValueChange:v,value:a,children:[ae,ve]}),e[119]=a,e[120]=ae,e[121]=ve,e[122]=Ne):Ne=e[122];let ye;e[123]!==te||e[124]!==Ne?(ye=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[te,Ne]}),e[123]=te,e[124]=Ne,e[125]=ye):ye=e[125];let we;e[126]!==Z||e[127]!==ye?(we=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[Z,ye]}),e[126]=Z,e[127]=ye,e[128]=we):we=e[128];let Se;e[129]!==r?(Se=r("Statements"),e[129]=r,e[130]=Se):Se=e[130];let qe;e[131]!==Se?(qe=(0,t.jsx)(Ce,{children:Se}),e[131]=Se,e[132]=qe):qe=e[132];let $e;e[133]!==m.length||e[134]!==r?($e=r("{count} tracked statements",{count:m.length}),e[133]=m.length,e[134]=r,e[135]=$e):$e=e[135];let ke;e[136]!==$e?(ke=(0,t.jsx)(rt,{children:$e}),e[136]=$e,e[137]=ke):ke=e[137];let _e;e[138]!==qe||e[139]!==ke?(_e=(0,t.jsxs)(Oe,{children:[qe,ke]}),e[138]=qe,e[139]=ke,e[140]=_e):_e=e[140];let Ie;e[141]!==f||e[142]!==m||e[143]!==r?(Ie=(0,t.jsx)(fe,{children:(0,t.jsx)("div",{className:"space-y-2",children:m.map(d=>{let T=d.normalizedSql,_=f.has(T),ge=Pe(d.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":_,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{ie(T)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(zt,{level:ge}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:d.normalizedSql})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ye(d.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:r("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ye(d.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:r("avg")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ee(d.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:r("calls")})]})]})]}),_&&(0,t.jsxs)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-medium",children:r("Full statement")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:d.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ee(d.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ye(d.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ee(d.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ee(d.rowsWritten)})]})]})]})]},T)})})}),e[141]=f,e[142]=m,e[143]=r,e[144]=Ie):Ie=e[144];let Me;e[145]!==_e||e[146]!==Ie?(Me=(0,t.jsxs)(he,{children:[_e,Ie]}),e[145]=_e,e[146]=Ie,e[147]=Me):Me=e[147];let ze;return e[148]!==B||e[149]!==we||e[150]!==Me?(ze=(0,t.jsxs)("div",{className:"space-y-4","data-testid":"qi-root",children:[B,we,Me]}),e[148]=B,e[149]=we,e[150]=Me,e[151]=ze):ze=e[151],ze},"zt");function Kt(s){return Pe(s.avgDurationMs)==="critical"}o(Kt,"Et");function Lt(s){return Pe(s.avgDurationMs)==="warning"}o(Lt,"jt");function Et(s){return Pe(s.avgDurationMs)==="good"}o(Et,"Kt");var Pt=at(De.getMetrics),Jt=o(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return l>0?`${l.toString()}h ${r.toString()}m`:r>0?`${r.toString()}m ${a.toString()}s`:`${a.toString()}s`},"Ut"),Qt=o((s,e)=>s?e:"overview","Jt"),Ut=o((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"Qt"),oe=o(s=>{let e=(0,Fe.c)(16),{chart:l,footer:r,label:a,testId:p,value:b}=s,f;e[0]!==a?(f=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=f):f=e[1];let h;e[2]!==p||e[3]!==b?(h=(0,t.jsx)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":p,children:b}),e[2]=p,e[3]=b,e[4]=h):h=e[4];let g;e[5]!==l||e[6]!==h?(g=(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[h,l]}),e[5]=l,e[6]=h,e[7]=g):g=e[7];let v;e[8]!==f||e[9]!==g?(v=(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[f,g]}),e[8]=f,e[9]=g,e[10]=v):v=e[10];let u;e[11]!==r?(u=r!=null&&(0,t.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:r}),e[11]=r,e[12]=u):u=e[12];let m;return e[13]!==v||e[14]!==u?(m=(0,t.jsxs)(he,{className:"justify-between gap-0 py-0",children:[v,u]}),e[13]=v,e[14]=u,e[15]=m):m=e[15],m},"ne"),ur=o(({initialShardKey:s})=>{let e=et(),l=Te(),r=tt(),[a,p]=(0,O.useState)(s??""),[b,f]=(0,O.useState)("overview"),[h,g]=(0,O.useState)([]),v=(0,O.useRef)(null),u=(0,O.useRef)(null),m=(0,O.useRef)(!0);(0,O.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let N=dt(a.trim(),400),ne=o(n=>{wt({shardKey:N,traceId:n}),He(r({to:"/traces"}))},"le"),{data:C,error:P,liveError:J}=Le(De.getMetrics,{},{live:!0,shardKey:N}),c=C??null;(0,O.useEffect)(()=>{if(C===void 0)return;ot(N);let n=C,k=v.current,y=u.current!==null&&u.current!==n.shard;if(u.current=n.shard,v.current=n.requests,y){g([]);return}k!==null&&n.requests>=k&&g(S=>[...S,n.requests-k].slice(-30))},[C,N]);let[q,ie]=(0,O.useState)(null),[D,R]=(0,O.useState)(!1),M=o(async()=>{R(!0);let n=vt(a,it());try{let k=await Promise.all(n.map(async y=>{try{let S=await e.query(Pt,{},lt(y));return{error:null,metrics:S,shard:y===""?S.shard:y}}catch(S){return{error:st(S),metrics:null,shard:y===""?"__root__":y}}}));m.current&&ie(k)}finally{m.current&&R(!1)}},"I"),x=q===null?null:bt(q),j=c===null||c.requests===0?"\u2014":`${(c.errors/c.requests*100).toFixed(1)}%`,L=h.length>0?h.at(-1):0,I=c?Nt(c):{p90:0,p95:0},z=o(n=>n<=0?"\u2014":n<1?`${(n*1e3).toFixed(0)}\u03BCs`:n<1e3?`${n.toFixed(1)}ms`:`${(n/1e3).toFixed(2)}s`,"L"),w=(0,O.useMemo)(()=>{if(!c||!("queryStats"in c))return;let n=c.queryStats;if(!(!n||!Array.isArray(n)))return yt(n)},[c]),$=Qt(w!==void 0,b),ce=o(()=>{He(M())},"oe"),me=o(()=>{ie(null)},"de"),ue=o(()=>{f("overview")},"me"),Q=o(()=>{f("query-insights")},"P");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(ct,{onChange:p,testId:"mt-shard-input",value:a}),(0,t.jsx)(mt,{message:J,prefix:"mt"}),(0,t.jsx)(Ue,{"data-testid":"mt-aggregate",disabled:D,onClick:ce,size:"sm",type:"button",variant:"secondary",children:l(D?"Aggregating\u2026":"All shards")}),q!==null&&(0,t.jsx)(Ue,{"data-testid":"mt-aggregate-clear",onClick:me,size:"sm",type:"button",variant:"ghost",children:l("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:ut,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")})]}),P!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:P}),w!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("button",{className:`pb-2 text-sm font-medium transition-colors ${$==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:ue,type:"button",children:l("Overview")}),(0,t.jsxs)("button",{className:`pb-2 text-sm font-medium transition-colors ${$==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:Q,type:"button",children:[l("Query insights"),w.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:w.length})]})]}),$==="query-insights"&&w!==void 0&&(0,t.jsx)(At,{queryStats:w}),$==="overview"&&c!==null&&(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[(0,t.jsx)(oe,{chart:h.length>=2?(0,t.jsx)(Ve,{ariaLabel:l("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:h,testId:"mt-sparkline"}):void 0,footer:h.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${L.toLocaleString()}`})," ",l("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:l("collecting samples\u2026")}),label:l("Requests"),testId:"mt-requests",value:c.requests}),(0,t.jsx)(oe,{footer:l("{rate} error rate",{rate:j}),label:l("Errors"),testId:"mt-errors",value:(0,t.jsxs)(t.Fragment,{children:[c.errors," (",j,")"]})}),(0,t.jsx)(oe,{footer:I.p90>0?`P90 ${z(I.p90)}`:void 0,label:l("P95 latency"),testId:"mt-p95",value:I.p95>0?z(I.p95):"\u2014"}),(0,t.jsx)(oe,{footer:c.cache===null?void 0:`${c.cache.entries.toLocaleString()} ${l("cache entries")}`,label:l("Database size"),testId:"mt-db-size",value:Ke(c.databaseSize)}),(0,t.jsx)(oe,{label:l("Shard"),testId:"mt-shard",value:c.shard}),(0,t.jsx)(oe,{label:l("Uptime"),testId:"mt-uptime",value:Jt(c.uptimeMs)}),(0,t.jsx)(oe,{label:l("Cache hit rate"),testId:"mt-cache",value:c.cache===null?l("no cache configured"):l("{rate} ({count} entries)",{count:c.cache.entries,rate:Ut(c.cache.hits,c.cache.misses)})})]}),$==="overview"&&c===null&&null,$==="overview"&&(0,t.jsx)(jt,{onOpenTrace:ne,shardKey:N}),$==="overview"&&x!==null&&q!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[(0,t.jsx)(oe,{label:l("Shards"),testId:"mt-agg-shards",value:x.failed>0?l("{reachable} reachable, {failed} unreachable",{failed:x.failed,reachable:x.reachable}):l("{reachable} reachable",{reachable:x.reachable})}),(0,t.jsx)(oe,{label:l("Total requests"),testId:"mt-agg-requests",value:x.totalRequests}),(0,t.jsx)(oe,{label:l("Total errors"),testId:"mt-agg-errors",value:x.totalErrors}),(0,t.jsx)(oe,{label:l("Total database size"),testId:"mt-agg-db-size",value:Ke(x.totalDatabaseSize)}),(0,t.jsx)(oe,{label:l("Combined cache hit rate"),testId:"mt-agg-cache",value:x.hitRate===null?l("no cache configured"):`${(x.hitRate*100).toFixed(1)}%`})]}),(0,t.jsx)(he,{className:"overflow-hidden py-0",children:(0,t.jsx)(fe,{className:"px-0",children:(0,t.jsxs)(We,{"data-testid":"mt-agg-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(Re,{children:[(0,t.jsx)(se,{children:l("shard")}),(0,t.jsx)(se,{children:l("requests")}),(0,t.jsx)(se,{children:l("errors")}),(0,t.jsx)(se,{children:l("db size")})]})}),(0,t.jsx)(Ge,{children:q.map(n=>(0,t.jsxs)(Re,{"data-testid":`mt-agg-row-${n.shard}`,children:[(0,t.jsx)(E,{children:n.shard}),n.metrics===null?(0,t.jsx)(E,{className:"text-destructive",colSpan:3,children:n.error??l("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E,{className:"tabular-nums",children:n.metrics.requests}),(0,t.jsx)(E,{className:"tabular-nums",children:n.metrics.errors}),(0,t.jsx)(E,{className:"tabular-nums",children:Ke(n.metrics.databaseSize)})]})]},n.shard))})]})})})]})]})},"fr");export{ur as MetricsPanel};
1
+ import{a as wt}from"./chunk-KUVMORDQ.js";import{a as bt,b as vt,c as Nt,d as yt,e as Ve}from"./chunk-CMUP7HPS.js";import{a as pt}from"./chunk-QWGT25SE.js";import{a as ht,b as gt,c as ft,d as xt,e as je}from"./chunk-3RTTXLMU.js";import"./chunk-2PJNAWB3.js";import{a as mt}from"./chunk-X2FQ6B5V.js";import{e as ut}from"./chunk-SKHEGARW.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import"./chunk-7YEFOSPH.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-WCWYSOCN.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import{e as tt}from"./chunk-SMIESS7P.js";import{a as dt}from"./chunk-LFKCLLPT.js";import"./chunk-T6VMSOBB.js";import{b as Le}from"./chunk-BMQJ4CAO.js";import{a as We,b as Be,c as Ge,d as Re,e as se,f as E}from"./chunk-MIQTKZAR.js";import{a as he,b as Oe,c as Ce,d as rt,e as fe}from"./chunk-UZERI5YC.js";import"./chunk-QBWRC5YX.js";import{a as ct}from"./chunk-LFXFP4IF.js";import{a as it,b as ot}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as Ue}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Qe}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as De}from"./chunk-AADXUXZO.js";import{f as et}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{d as Te,f as at,g as lt,h as st,i as nt,m as He,p as Ke}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as o,e as Je,f as $t,g as kt,h as _t}from"./chunk-3XIESWL4.js";var Fe=Je(kt(),1);var O=Je($t(),1);var t=Je(_t(),1);var It=o((s,e)=>s<e?-1:s>e?1:0,"Mt"),Ze=o(s=>{if(s===void 0)return"null";if(typeof s=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s))return`[${s.map(p=>Ze(p)).join(",")}]`;let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let p=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${p} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let l=s,r=Object.keys(l).toSorted(It),a=[];for(let p of r){let b=l[p];b!==void 0&&a.push(`${JSON.stringify(p)}:${Ze(b)}`)}return`{${a.join(",")}}`},"We"),St=o((s,e,l)=>`${s}:${e}:${Ze(l??{})}`,"rt"),qt=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"at"),Mt=o((s,e)=>qt(s,e),"It"),Ft=o(s=>qt(s.kind,s),"Ft"),Xe=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"Je"),Tt=o(s=>Array.isArray(s?.series)?s.series:[],"Ct"),Ot="FUNCTION_NOT_FOUND",Ct=o(s=>{let e=new Map;if(!Array.isArray(s?.series))return e;for(let l of s.series)e.set(St(l.kind,l.name,l.attributes),l.points);return e},"Tt"),Dt={counter:"secondary",gauge:"default",histogram:"outline"},Rt=o(s=>{let e=(0,Fe.c)(18),{name:l,onOpenTrace:r,traceId:a}=s,p=Te();if(a===void 0){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=m):m=e[0],m}let b;e[1]!==a?(b=a.slice(0,8),e[1]=a,e[2]=b):b=e[2];let f=b;if(r===void 0){let m=`mt-instrument-trace-${l}`,N;return e[3]!==f||e[4]!==m||e[5]!==a?(N=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":m,title:a,children:f}),e[3]=f,e[4]=m,e[5]=a,e[6]=N):N=e[6],N}let h=`mt-instrument-trace-${l}`,g;e[7]!==r||e[8]!==a?(g=o(()=>{r(a)},"g"),e[7]=r,e[8]=a,e[9]=g):g=e[9];let v;e[10]!==p||e[11]!==a?(v=p("Open the exemplar trace {trace}",{trace:a}),e[10]=p,e[11]=a,e[12]=v):v=e[12];let u;return e[13]!==f||e[14]!==h||e[15]!==g||e[16]!==v?(u=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":h,onClick:g,title:v,type:"button",children:f}),e[13]=f,e[14]=h,e[15]=g,e[16]=v,e[17]=u):u=e[17],u},"Dt"),jt=o(s=>{let e=(0,Fe.c)(105),{onOpenTrace:l,shardKey:r}=s,a=Te(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let b;e[1]!==r?(b={live:!0,shardKey:r},e[1]=r,e[2]=b):b=e[2];let{data:f,error:h,errorSource:g}=Le(De.getMetricSeries,p,b),v;e[3]===Symbol.for("react.memo_cache_sentinel")?(v={},e[3]=v):v=e[3];let u;e[4]!==r?(u={live:!0,shardKey:r},e[4]=r,e[5]=u):u=e[5];let{data:m}=Le(De.getMetricHistory,v,u),N,ne,C,P,J,c,q,ie,D,R,M,x,j;if(e[6]!==f||e[7]!==h||e[8]!==g||e[9]!==m||e[10]!==l||e[11]!==a){ie=Symbol.for("react.early_return_sentinel");e:{let ce=Tt(f),me=nt(g)===Ot;if(h!==null&&!me){let i;e[25]!==a?(i=a("Instruments"),e[25]=a,e[26]=i):i=e[26];let F;e[27]!==i?(F=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:i}),e[27]=i,e[28]=F):F=e[28];let A;e[29]!==h||e[30]!==a?(A=a("Instruments unavailable: {error}",{error:h}),e[29]=h,e[30]=a,e[31]=A):A=e[31];let K;e[32]!==A?(K=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:A}),e[32]=A,e[33]=K):K=e[33];let le;e[34]!==F||e[35]!==K?(le=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[F,K]}),e[34]=F,e[35]=K,e[36]=le):le=e[36],ie=le;break e}if(ce.length===0){ie=null;break e}let ue=Ct(m),Q;e[37]!==a?(Q=o(i=>a(i==="counter"?"Counter":i==="gauge"?"Gauge":"Histogram"),"P"),e[37]=a,e[38]=Q):Q=e[38];let n=Q;J="flex flex-col gap-2",c="mt-instruments";let k;e[39]!==a?(k=a("Instruments"),e[39]=a,e[40]=k):k=e[40],e[41]!==k?(q=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:k}),e[41]=k,e[42]=q):q=e[42],P=he,j="overflow-hidden py-0",C=fe,x="px-0",ne=We,R="mt-instruments-table";let y;e[43]!==a?(y=a("name"),e[43]=a,e[44]=y):y=e[44];let S;e[45]!==y?(S=(0,t.jsx)(se,{children:y}),e[45]=y,e[46]=S):S=e[46];let U;e[47]!==a?(U=a("kind"),e[47]=a,e[48]=U):U=e[48];let H;e[49]!==U?(H=(0,t.jsx)(se,{children:U}),e[49]=U,e[50]=H):H=e[50];let W;e[51]!==a?(W=a("value"),e[51]=a,e[52]=W):W=e[52];let B;e[53]!==W?(B=(0,t.jsx)(se,{className:"text-right",children:W}),e[53]=W,e[54]=B):B=e[54];let G;e[55]!==a?(G=a("count"),e[55]=a,e[56]=G):G=e[56];let V;e[57]!==G?(V=(0,t.jsx)(se,{className:"text-right",children:G}),e[57]=G,e[58]=V):V=e[58];let X;e[59]!==a?(X=a("range"),e[59]=a,e[60]=X):X=e[60];let Y;e[61]!==X?(Y=(0,t.jsx)(se,{className:"text-right",children:X}),e[61]=X,e[62]=Y):Y=e[62];let Z;e[63]!==a?(Z=a("trend"),e[63]=a,e[64]=Z):Z=e[64];let ee;e[65]!==Z?(ee=(0,t.jsx)(se,{children:Z}),e[65]=Z,e[66]=ee):ee=e[66];let te;e[67]!==a?(te=a("trace"),e[67]=a,e[68]=te):te=e[68];let re;e[69]!==te?(re=(0,t.jsx)(se,{children:te}),e[69]=te,e[70]=re):re=e[70];let de;e[71]!==a?(de=a("dimensions"),e[71]=a,e[72]=de):de=e[72];let ae;e[73]!==de?(ae=(0,t.jsx)(se,{children:de}),e[73]=de,e[74]=ae):ae=e[74],e[75]!==S||e[76]!==H||e[77]!==B||e[78]!==V||e[79]!==Y||e[80]!==ee||e[81]!==re||e[82]!==ae?(M=(0,t.jsx)(Be,{children:(0,t.jsxs)(Re,{children:[S,H,B,V,Y,ee,re,ae]})}),e[75]=S,e[76]=H,e[77]=B,e[78]=V,e[79]=Y,e[80]=ee,e[81]=re,e[82]=ae,e[83]=M):M=e[83],N=Ge,D=ce.map(i=>{let F=pt(i.attributes),A=St(i.kind,i.name,i.attributes),K=(ue.get(A)??[]).map(le=>Mt(i.kind,le));return(0,t.jsxs)(Re,{"data-testid":`mt-instrument-${i.name}`,children:[(0,t.jsx)(E,{className:"font-mono text-xs",title:i.functionPath,children:i.name}),(0,t.jsx)(E,{children:(0,t.jsx)(Qe,{variant:Dt[i.kind],children:n(i.kind)})}),(0,t.jsx)(E,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${i.name}`,children:Xe(Ft(i))}),(0,t.jsx)(E,{className:"text-right tabular-nums text-muted-foreground",children:i.count.toLocaleString()}),(0,t.jsx)(E,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:i.min===i.max?"\u2014":`${Xe(i.min)}\u2013${Xe(i.max)}`}),(0,t.jsx)(E,{children:K.length>=2?(0,t.jsx)(Ve,{ariaLabel:a("{name} trend",{name:i.name}),className:"h-6 w-24 text-foreground",series:K,testId:`mt-instrument-trend-${i.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(E,{className:"font-mono text-xs",children:(0,t.jsx)(Rt,{name:i.name,onOpenTrace:l,traceId:i.exemplarTraceId})}),(0,t.jsx)(E,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:F,children:F===""?"\u2014":F})]},A)})}e[6]=f,e[7]=h,e[8]=g,e[9]=m,e[10]=l,e[11]=a,e[12]=N,e[13]=ne,e[14]=C,e[15]=P,e[16]=J,e[17]=c,e[18]=q,e[19]=ie,e[20]=D,e[21]=R,e[22]=M,e[23]=x,e[24]=j}else N=e[12],ne=e[13],C=e[14],P=e[15],J=e[16],c=e[17],q=e[18],ie=e[19],D=e[20],R=e[21],M=e[22],x=e[23],j=e[24];if(ie!==Symbol.for("react.early_return_sentinel"))return ie;let L;e[84]!==N||e[85]!==D?(L=(0,t.jsx)(N,{children:D}),e[84]=N,e[85]=D,e[86]=L):L=e[86];let I;e[87]!==ne||e[88]!==L||e[89]!==R||e[90]!==M?(I=(0,t.jsxs)(ne,{"data-testid":R,children:[M,L]}),e[87]=ne,e[88]=L,e[89]=R,e[90]=M,e[91]=I):I=e[91];let z;e[92]!==C||e[93]!==I||e[94]!==x?(z=(0,t.jsx)(C,{className:x,children:I}),e[92]=C,e[93]=I,e[94]=x,e[95]=z):z=e[95];let w;e[96]!==P||e[97]!==z||e[98]!==j?(w=(0,t.jsx)(P,{className:j,children:z}),e[96]=P,e[97]=z,e[98]=j,e[99]=w):w=e[99];let $;return e[100]!==J||e[101]!==c||e[102]!==q||e[103]!==w?($=(0,t.jsxs)("section",{className:J,"data-testid":c,children:[q,w]}),e[100]=J,e[101]=c,e[102]=q,e[103]=w,e[104]=$):$=e[104],$},"Lt"),Pe=o(s=>s>=100?"critical":s>=50?"warning":"good","je"),Ye=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Qe"),Ee=o(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"Le"),zt=o(s=>{let e=(0,Fe.c)(3),{level:l}=s;if(l==="critical"){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)(Qe,{variant:"destructive",children:"Slow"}),e[0]=a):a=e[0],a}if(l==="warning"){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"}),e[1]=a):a=e[1],a}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"}),e[2]=r):r=e[2],r},"At"),At=o(s=>{let e=(0,Fe.c)(152),{queryStats:l}=s,r=Te(),[a,p]=(0,O.useState)("totalTime"),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=new Set,e[0]=b):b=e[0];let[f,h]=(0,O.useState)(b),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=o(d=>{d!==null&&p(d)},"g"),e[1]=g):g=e[1];let v=g,u;if(e[2]!==l||e[3]!==a){u=[...l];let d;e[5]!==a?(d=o((T,_)=>{switch(a){case"avgTime":return _.avgDurationMs-T.avgDurationMs;case"execCount":return _.execCount-T.execCount;case"rowsRead":return _.rowsRead-T.rowsRead;default:return _.totalDurationMs-T.totalDurationMs}},"d"),e[5]=a,e[6]=d):d=e[6],u.sort(d),e[2]=l,e[3]=a,e[4]=u}else u=e[4];let m=u,N;e[7]!==l?(N=l.filter(Kt),e[7]=l,e[8]=N):N=e[8];let ne=N.length,C;e[9]!==l?(C=l.filter(Lt),e[9]=l,e[10]=C):C=e[10];let P=C.length,J;e[11]!==l?(J=l.filter(Et),e[11]=l,e[12]=J):J=e[12];let c=J.length,q;e[13]===Symbol.for("react.memo_cache_sentinel")?(q=o(d=>{h(T=>{let _=new Set(T);return _.has(d)?_.delete(d):_.add(d),_})},"S"),e[13]=q):q=e[13];let ie=q;if(l.length===0){let d;e[14]!==r?(d=r("No query insights yet"),e[14]=r,e[15]=d):d=e[15];let T;e[16]!==d?(T=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:d}),e[16]=d,e[17]=T):T=e[17];let _;e[18]!==r?(_=r("Query insights appear once statements are executed against this shard."),e[18]=r,e[19]=_):_=e[19];let ge;e[20]!==_?(ge=(0,t.jsx)("p",{className:"mt-1 text-sm",children:_}),e[20]=_,e[21]=ge):ge=e[21];let Ae;return e[22]!==ge||e[23]!==T?(Ae=(0,t.jsx)(he,{children:(0,t.jsx)(fe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[T,ge]})})}),e[22]=ge,e[23]=T,e[24]=Ae):Ae=e[24],Ae}let D;e[25]!==r?(D=r("Critical queries"),e[25]=r,e[26]=D):D=e[26];let R;e[27]!==D?(R=(0,t.jsx)(Oe,{className:"pb-2",children:(0,t.jsx)(Ce,{className:"text-sm font-medium",children:D})}),e[27]=D,e[28]=R):R=e[28];let M;e[29]!==ne?(M=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:ne}),e[29]=ne,e[30]=M):M=e[30];let x;e[31]!==r?(x=r(">100ms avg execution"),e[31]=r,e[32]=x):x=e[32];let j;e[33]!==x?(j=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x}),e[33]=x,e[34]=j):j=e[34];let L;e[35]!==j||e[36]!==M?(L=(0,t.jsxs)(fe,{children:[M,j]}),e[35]=j,e[36]=M,e[37]=L):L=e[37];let I;e[38]!==L||e[39]!==R?(I=(0,t.jsxs)(he,{children:[R,L]}),e[38]=L,e[39]=R,e[40]=I):I=e[40];let z;e[41]!==r?(z=r("Moderate queries"),e[41]=r,e[42]=z):z=e[42];let w;e[43]!==z?(w=(0,t.jsx)(Oe,{className:"pb-2",children:(0,t.jsx)(Ce,{className:"text-sm font-medium",children:z})}),e[43]=z,e[44]=w):w=e[44];let $;e[45]!==P?($=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:P}),e[45]=P,e[46]=$):$=e[46];let ce;e[47]!==r?(ce=r("50\u2013100ms avg execution"),e[47]=r,e[48]=ce):ce=e[48];let me;e[49]!==ce?(me=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ce}),e[49]=ce,e[50]=me):me=e[50];let ue;e[51]!==$||e[52]!==me?(ue=(0,t.jsxs)(fe,{children:[$,me]}),e[51]=$,e[52]=me,e[53]=ue):ue=e[53];let Q;e[54]!==w||e[55]!==ue?(Q=(0,t.jsxs)(he,{children:[w,ue]}),e[54]=w,e[55]=ue,e[56]=Q):Q=e[56];let n;e[57]!==r?(n=r("Fast queries"),e[57]=r,e[58]=n):n=e[58];let k;e[59]!==n?(k=(0,t.jsx)(Oe,{className:"pb-2",children:(0,t.jsx)(Ce,{className:"text-sm font-medium",children:n})}),e[59]=n,e[60]=k):k=e[60];let y;e[61]!==c?(y=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:c}),e[61]=c,e[62]=y):y=e[62];let S;e[63]!==r?(S=r("<50ms avg execution"),e[63]=r,e[64]=S):S=e[64];let U;e[65]!==S?(U=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:S}),e[65]=S,e[66]=U):U=e[66];let H;e[67]!==y||e[68]!==U?(H=(0,t.jsxs)(fe,{children:[y,U]}),e[67]=y,e[68]=U,e[69]=H):H=e[69];let W;e[70]!==k||e[71]!==H?(W=(0,t.jsxs)(he,{children:[k,H]}),e[70]=k,e[71]=H,e[72]=W):W=e[72];let B;e[73]!==I||e[74]!==Q||e[75]!==W?(B=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[I,Q,W]}),e[73]=I,e[74]=Q,e[75]=W,e[76]=B):B=e[76];let G;e[77]!==r?(G=r("Query leaderboard"),e[77]=r,e[78]=G):G=e[78];let V;e[79]!==G?(V=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:G}),e[79]=G,e[80]=V):V=e[80];let X;e[81]!==a||e[82]!==r?(X=r("Slow queries sorted by {sortField}",{sortField:r(a)}),e[81]=a,e[82]=r,e[83]=X):X=e[83];let Y;e[84]!==X?(Y=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:X}),e[84]=X,e[85]=Y):Y=e[85];let Z;e[86]!==V||e[87]!==Y?(Z=(0,t.jsxs)("div",{children:[V,Y]}),e[86]=V,e[87]=Y,e[88]=Z):Z=e[88];let ee;e[89]!==r?(ee=r("Sort by"),e[89]=r,e[90]=ee):ee=e[90];let te;e[91]!==ee?(te=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ee}),e[91]=ee,e[92]=te):te=e[92];let re;e[93]!==r?(re=r("Sort queries by"),e[93]=r,e[94]=re):re=e[94];let de;e[95]===Symbol.for("react.memo_cache_sentinel")?(de=(0,t.jsx)(gt,{}),e[95]=de):de=e[95];let ae;e[96]!==re?(ae=(0,t.jsx)(ft,{"aria-label":re,className:"w-[140px]","data-testid":"qi-sort",children:de}),e[96]=re,e[97]=ae):ae=e[97];let i;e[98]!==r?(i=r("Total time"),e[98]=r,e[99]=i):i=e[99];let F;e[100]!==i?(F=(0,t.jsx)(je,{value:"totalTime",children:i}),e[100]=i,e[101]=F):F=e[101];let A;e[102]!==r?(A=r("Avg time"),e[102]=r,e[103]=A):A=e[103];let K;e[104]!==A?(K=(0,t.jsx)(je,{value:"avgTime",children:A}),e[104]=A,e[105]=K):K=e[105];let le;e[106]!==r?(le=r("Execution count"),e[106]=r,e[107]=le):le=e[107];let xe;e[108]!==le?(xe=(0,t.jsx)(je,{value:"execCount",children:le}),e[108]=le,e[109]=xe):xe=e[109];let pe;e[110]!==r?(pe=r("Rows read"),e[110]=r,e[111]=pe):pe=e[111];let be;e[112]!==pe?(be=(0,t.jsx)(je,{value:"rowsRead",children:pe}),e[112]=pe,e[113]=be):be=e[113];let ve;e[114]!==F||e[115]!==K||e[116]!==xe||e[117]!==be?(ve=(0,t.jsxs)(xt,{children:[F,K,xe,be]}),e[114]=F,e[115]=K,e[116]=xe,e[117]=be,e[118]=ve):ve=e[118];let Ne;e[119]!==a||e[120]!==ae||e[121]!==ve?(Ne=(0,t.jsxs)(ht,{onValueChange:v,value:a,children:[ae,ve]}),e[119]=a,e[120]=ae,e[121]=ve,e[122]=Ne):Ne=e[122];let ye;e[123]!==te||e[124]!==Ne?(ye=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[te,Ne]}),e[123]=te,e[124]=Ne,e[125]=ye):ye=e[125];let we;e[126]!==Z||e[127]!==ye?(we=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[Z,ye]}),e[126]=Z,e[127]=ye,e[128]=we):we=e[128];let Se;e[129]!==r?(Se=r("Statements"),e[129]=r,e[130]=Se):Se=e[130];let qe;e[131]!==Se?(qe=(0,t.jsx)(Ce,{children:Se}),e[131]=Se,e[132]=qe):qe=e[132];let $e;e[133]!==m.length||e[134]!==r?($e=r("{count} tracked statements",{count:m.length}),e[133]=m.length,e[134]=r,e[135]=$e):$e=e[135];let ke;e[136]!==$e?(ke=(0,t.jsx)(rt,{children:$e}),e[136]=$e,e[137]=ke):ke=e[137];let _e;e[138]!==qe||e[139]!==ke?(_e=(0,t.jsxs)(Oe,{children:[qe,ke]}),e[138]=qe,e[139]=ke,e[140]=_e):_e=e[140];let Ie;e[141]!==f||e[142]!==m||e[143]!==r?(Ie=(0,t.jsx)(fe,{children:(0,t.jsx)("div",{className:"space-y-2",children:m.map(d=>{let T=d.normalizedSql,_=f.has(T),ge=Pe(d.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":_,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{ie(T)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(zt,{level:ge}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:d.normalizedSql})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ye(d.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:r("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ye(d.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:r("avg")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ee(d.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:r("calls")})]})]})]}),_&&(0,t.jsxs)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-medium",children:r("Full statement")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:d.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ee(d.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ye(d.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ee(d.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:r("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ee(d.rowsWritten)})]})]})]})]},T)})})}),e[141]=f,e[142]=m,e[143]=r,e[144]=Ie):Ie=e[144];let Me;e[145]!==_e||e[146]!==Ie?(Me=(0,t.jsxs)(he,{children:[_e,Ie]}),e[145]=_e,e[146]=Ie,e[147]=Me):Me=e[147];let ze;return e[148]!==B||e[149]!==we||e[150]!==Me?(ze=(0,t.jsxs)("div",{className:"space-y-4","data-testid":"qi-root",children:[B,we,Me]}),e[148]=B,e[149]=we,e[150]=Me,e[151]=ze):ze=e[151],ze},"zt");function Kt(s){return Pe(s.avgDurationMs)==="critical"}o(Kt,"Et");function Lt(s){return Pe(s.avgDurationMs)==="warning"}o(Lt,"jt");function Et(s){return Pe(s.avgDurationMs)==="good"}o(Et,"Kt");var Pt=at(De.getMetrics),Jt=o(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return l>0?`${l.toString()}h ${r.toString()}m`:r>0?`${r.toString()}m ${a.toString()}s`:`${a.toString()}s`},"Ut"),Qt=o((s,e)=>s?e:"overview","Jt"),Ut=o((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"Qt"),oe=o(s=>{let e=(0,Fe.c)(16),{chart:l,footer:r,label:a,testId:p,value:b}=s,f;e[0]!==a?(f=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=f):f=e[1];let h;e[2]!==p||e[3]!==b?(h=(0,t.jsx)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":p,children:b}),e[2]=p,e[3]=b,e[4]=h):h=e[4];let g;e[5]!==l||e[6]!==h?(g=(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[h,l]}),e[5]=l,e[6]=h,e[7]=g):g=e[7];let v;e[8]!==f||e[9]!==g?(v=(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[f,g]}),e[8]=f,e[9]=g,e[10]=v):v=e[10];let u;e[11]!==r?(u=r!=null&&(0,t.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:r}),e[11]=r,e[12]=u):u=e[12];let m;return e[13]!==v||e[14]!==u?(m=(0,t.jsxs)(he,{className:"justify-between gap-0 py-0",children:[v,u]}),e[13]=v,e[14]=u,e[15]=m):m=e[15],m},"ne"),ur=o(({initialShardKey:s})=>{let e=et(),l=Te(),r=tt(),[a,p]=(0,O.useState)(s??""),[b,f]=(0,O.useState)("overview"),[h,g]=(0,O.useState)([]),v=(0,O.useRef)(null),u=(0,O.useRef)(null),m=(0,O.useRef)(!0);(0,O.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let N=dt(a.trim(),400),ne=o(n=>{wt({shardKey:N,traceId:n}),He(r({to:"/traces"}))},"le"),{data:C,error:P,liveError:J}=Le(De.getMetrics,{},{live:!0,shardKey:N}),c=C??null;(0,O.useEffect)(()=>{if(C===void 0)return;ot(N);let n=C,k=v.current,y=u.current!==null&&u.current!==n.shard;if(u.current=n.shard,v.current=n.requests,y){g([]);return}k!==null&&n.requests>=k&&g(S=>[...S,n.requests-k].slice(-30))},[C,N]);let[q,ie]=(0,O.useState)(null),[D,R]=(0,O.useState)(!1),M=o(async()=>{R(!0);let n=vt(a,it());try{let k=await Promise.all(n.map(async y=>{try{let S=await e.query(Pt,{},lt(y));return{error:null,metrics:S,shard:y===""?S.shard:y}}catch(S){return{error:st(S),metrics:null,shard:y===""?"__root__":y}}}));m.current&&ie(k)}finally{m.current&&R(!1)}},"I"),x=q===null?null:bt(q),j=c===null||c.requests===0?"\u2014":`${(c.errors/c.requests*100).toFixed(1)}%`,L=h.length>0?h.at(-1):0,I=c?Nt(c):{p90:0,p95:0},z=o(n=>n<=0?"\u2014":n<1?`${(n*1e3).toFixed(0)}\u03BCs`:n<1e3?`${n.toFixed(1)}ms`:`${(n/1e3).toFixed(2)}s`,"L"),w=(0,O.useMemo)(()=>{if(!c||!("queryStats"in c))return;let n=c.queryStats;if(!(!n||!Array.isArray(n)))return yt(n)},[c]),$=Qt(w!==void 0,b),ce=o(()=>{He(M())},"oe"),me=o(()=>{ie(null)},"de"),ue=o(()=>{f("overview")},"me"),Q=o(()=>{f("query-insights")},"P");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(ct,{onChange:p,testId:"mt-shard-input",value:a}),(0,t.jsx)(mt,{message:J,prefix:"mt"}),(0,t.jsx)(Ue,{"data-testid":"mt-aggregate",disabled:D,onClick:ce,size:"sm",type:"button",variant:"secondary",children:l(D?"Aggregating\u2026":"All shards")}),q!==null&&(0,t.jsx)(Ue,{"data-testid":"mt-aggregate-clear",onClick:me,size:"sm",type:"button",variant:"ghost",children:l("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:ut,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")})]}),P!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:P}),w!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("button",{className:`pb-2 text-sm font-medium transition-colors ${$==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:ue,type:"button",children:l("Overview")}),(0,t.jsxs)("button",{className:`pb-2 text-sm font-medium transition-colors ${$==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:Q,type:"button",children:[l("Query insights"),w.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:w.length})]})]}),$==="query-insights"&&w!==void 0&&(0,t.jsx)(At,{queryStats:w}),$==="overview"&&c!==null&&(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[(0,t.jsx)(oe,{chart:h.length>=2?(0,t.jsx)(Ve,{ariaLabel:l("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:h,testId:"mt-sparkline"}):void 0,footer:h.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${L.toLocaleString()}`})," ",l("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:l("collecting samples\u2026")}),label:l("Requests"),testId:"mt-requests",value:c.requests}),(0,t.jsx)(oe,{footer:l("{rate} error rate",{rate:j}),label:l("Errors"),testId:"mt-errors",value:(0,t.jsxs)(t.Fragment,{children:[c.errors," (",j,")"]})}),(0,t.jsx)(oe,{footer:I.p90>0?`P90 ${z(I.p90)}`:void 0,label:l("P95 latency"),testId:"mt-p95",value:I.p95>0?z(I.p95):"\u2014"}),(0,t.jsx)(oe,{footer:c.cache===null?void 0:`${c.cache.entries.toLocaleString()} ${l("cache entries")}`,label:l("Database size"),testId:"mt-db-size",value:Ke(c.databaseSize)}),(0,t.jsx)(oe,{label:l("Shard"),testId:"mt-shard",value:c.shard}),(0,t.jsx)(oe,{label:l("Uptime"),testId:"mt-uptime",value:Jt(c.uptimeMs)}),(0,t.jsx)(oe,{label:l("Cache hit rate"),testId:"mt-cache",value:c.cache===null?l("no cache configured"):l("{rate} ({count} entries)",{count:c.cache.entries,rate:Ut(c.cache.hits,c.cache.misses)})})]}),$==="overview"&&c===null&&null,$==="overview"&&(0,t.jsx)(jt,{onOpenTrace:ne,shardKey:N}),$==="overview"&&x!==null&&q!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[(0,t.jsx)(oe,{label:l("Shards"),testId:"mt-agg-shards",value:x.failed>0?l("{reachable} reachable, {failed} unreachable",{failed:x.failed,reachable:x.reachable}):l("{reachable} reachable",{reachable:x.reachable})}),(0,t.jsx)(oe,{label:l("Total requests"),testId:"mt-agg-requests",value:x.totalRequests}),(0,t.jsx)(oe,{label:l("Total errors"),testId:"mt-agg-errors",value:x.totalErrors}),(0,t.jsx)(oe,{label:l("Total database size"),testId:"mt-agg-db-size",value:Ke(x.totalDatabaseSize)}),(0,t.jsx)(oe,{label:l("Combined cache hit rate"),testId:"mt-agg-cache",value:x.hitRate===null?l("no cache configured"):`${(x.hitRate*100).toFixed(1)}%`})]}),(0,t.jsx)(he,{className:"overflow-hidden py-0",children:(0,t.jsx)(fe,{className:"px-0",children:(0,t.jsxs)(We,{"data-testid":"mt-agg-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(Re,{children:[(0,t.jsx)(se,{children:l("shard")}),(0,t.jsx)(se,{children:l("requests")}),(0,t.jsx)(se,{children:l("errors")}),(0,t.jsx)(se,{children:l("db size")})]})}),(0,t.jsx)(Ge,{children:q.map(n=>(0,t.jsxs)(Re,{"data-testid":`mt-agg-row-${n.shard}`,children:[(0,t.jsx)(E,{children:n.shard}),n.metrics===null?(0,t.jsx)(E,{className:"text-destructive",colSpan:3,children:n.error??l("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E,{className:"tabular-nums",children:n.metrics.requests}),(0,t.jsx)(E,{className:"tabular-nums",children:n.metrics.errors}),(0,t.jsx)(E,{className:"tabular-nums",children:Ke(n.metrics.databaseSize)})]})]},n.shard))})]})})})]})]})},"fr");export{ur as MetricsPanel};
@@ -1 +1 @@
1
- import{b as de,c as ce}from"./chunk-KUVMORDQ.js";import{a as ie}from"./chunk-QWGT25SE.js";import{a as le}from"./chunk-X2FQ6B5V.js";import{a as ne}from"./chunk-LFKCLLPT.js";import{a as oe}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as te}from"./chunk-XSD4Y6SQ.js";import{a as se}from"./chunk-LFXFP4IF.js";import{b as ae}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as Z}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as Y}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as re}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as X}from"./chunk-XQCVZAGU.js";import{d as z,q as ee}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as M,e as Q,f as he,g as fe,h as pe,j as V}from"./chunk-3XIESWL4.js";var H=Q(fe(),1),F=Q(he(),1);var a=Q(pe(),1);var me=M(o=>Math.min(100,Math.max(0,o)),"V"),ge=M((o,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=me(o.offsetMs/e*100),s=o.durationMs/e*100,r=Math.max(.5,Math.min(me(s),100-t));return{leftPercent:t,widthPercent:r}},"he"),xe=M((o,e)=>{let t=e.trim().toLowerCase();return t===""?[...o]:o.filter(s=>s.rootName.toLowerCase().includes(t)||s.functionPath.toLowerCase().includes(t)||s.traceId.toLowerCase().includes(t))},"fe"),G=M(o=>Number.isFinite(o)?o>0&&o<1?`${o.toFixed(2)}ms`:`${String(Math.round(o))}ms`:"\u2014","U"),be=14,we=M(o=>Array.isArray(o?.traces)?o.traces:[],"ge"),Ne=M(o=>{let e=(0,H.c)(50),{span:t,traceDurationMs:s}=o,r=z(),n;e[0]!==t||e[1]!==s?(n=ge(t,s),e[0]=t,e[1]=s,e[2]=n):n=e[2];let{leftPercent:P,widthPercent:x}=n,L;e[3]!==t.attributes?(L=ie(t.attributes),e[3]=t.attributes,e[4]=L):L=e[4];let k=L,C=t.depth*be,y;e[5]!==C?(y={paddingLeft:C},e[5]=C,e[6]=y):y=e[6];let b=y,c=`${String(P)}%`,w=`${String(x)}%`,p;e[7]!==c||e[8]!==w?(p={left:c,width:w},e[7]=c,e[8]=w,e[9]=p):p=e[9];let l=p,f=t.depth,i;e[10]!==t.ok||e[11]!==r?(i=t.ok?null:(0,a.jsx)("span",{"aria-label":r("Errored span"),className:"mr-1 text-destructive","data-testid":"tr-span-error",role:"img",children:"\u25CF"}),e[10]=t.ok,e[11]=r,e[12]=i):i=e[12];let v;e[13]!==b||e[14]!==t.name||e[15]!==i?(v=(0,a.jsxs)("span",{className:"w-56 shrink-0 truncate",role:"gridcell",style:b,title:t.name,children:[i,t.name]}),e[13]=b,e[14]=t.name,e[15]=i,e[16]=v):v=e[16];let d;e[17]!==t.durationMs||e[18]!==t.offsetMs||e[19]!==r?(d=r("starts {offset} in, runs {duration}",{duration:G(t.durationMs),offset:G(t.offsetMs)}),e[17]=t.durationMs,e[18]=t.offsetMs,e[19]=r,e[20]=d):d=e[20];let N=t.ok?"bg-primary/70":"bg-destructive",m;e[21]!==N?(m=V("absolute inset-y-0 rounded-sm",N),e[21]=N,e[22]=m):m=e[22];let u;e[23]!==l||e[24]!==P||e[25]!==m||e[26]!==x?(u=(0,a.jsx)("span",{className:m,"data-left":P,"data-testid":"tr-span-bar","data-width":x,style:l}),e[23]=l,e[24]=P,e[25]=m,e[26]=x,e[27]=u):u=e[27];let h;e[28]!==d||e[29]!==u?(h=(0,a.jsx)("span",{"aria-label":d,className:"relative h-3 flex-1 overflow-hidden rounded-sm bg-muted",role:"gridcell",children:u}),e[28]=d,e[29]=u,e[30]=h):h=e[30];let g;e[31]!==t.durationMs?(g=G(t.durationMs),e[31]=t.durationMs,e[32]=g):g=e[32];let I;e[33]!==g?(I=(0,a.jsx)("span",{className:"w-16 shrink-0 text-right tabular-nums text-muted-foreground",role:"gridcell",children:g}),e[33]=g,e[34]=I):I=e[34];let S;e[35]!==t.error?(S=t.error===void 0?null:(0,a.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=S):S=e[36];let T;e[37]!==S?(T=(0,a.jsx)("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:S}),e[37]=S,e[38]=T):T=e[38];let E;e[39]!==k?(E=k===""?null:(0,a.jsx)("span",{"data-testid":"tr-span-attributes",title:k,children:k}),e[39]=k,e[40]=E):E=e[40];let $;e[41]!==E?($=(0,a.jsx)("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:E}),e[41]=E,e[42]=$):$=e[42];let _;return e[43]!==t.depth||e[44]!==v||e[45]!==h||e[46]!==I||e[47]!==T||e[48]!==$?(_=(0,a.jsxs)("div",{className:"flex items-center gap-2 border-b border-border px-3 py-1.5 font-mono text-xs last:border-b-0 hover:bg-muted/50","data-depth":f,"data-testid":"tr-span-row",role:"row",children:[v,h,I,T,$]}),e[43]=t.depth,e[44]=v,e[45]=h,e[46]=I,e[47]=T,e[48]=$,e[49]=_):_=e[49],_},"xe"),Me=M(o=>{let e=(0,H.c)(50),{expanded:t,onToggle:s,trace:r}=o,n=z(),P;e[0]!==s||e[1]!==r.traceId?(P=M(()=>{s(r.traceId)},"S"),e[0]=s,e[1]=r.traceId,e[2]=P):P=e[2];let x=P,L=`tr-row-${r.traceId}`,k=`tr-waterfall-${r.traceId}`,C=`tr-toggle-${r.traceId}`,y=t?"\u25BE":"\u25B8",b;e[3]!==y?(b=(0,a.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:y}),e[3]=y,e[4]=b):b=e[4];let c;e[5]!==r.rootName?(c=(0,a.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=c):c=e[6];let w;e[7]!==r.functionPath?(w=(0,a.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let p;e[9]!==r.durationMs?(p=G(r.durationMs),e[9]=r.durationMs,e[10]=p):p=e[10];let l;e[11]!==p?(l=(0,a.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:p}),e[11]=p,e[12]=l):l=e[12];let f;e[13]!==n||e[14]!==r.spans.length?(f=n("{count} spans",{count:r.spans.length}),e[13]=n,e[14]=r.spans.length,e[15]=f):f=e[15];let i;e[16]!==f?(i=(0,a.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:f}),e[16]=f,e[17]=i):i=e[17];let v=r.ok?"secondary":"destructive",d;e[18]!==n||e[19]!==r.ok?(d=r.ok?n("ok"):n("error"),e[18]=n,e[19]=r.ok,e[20]=d):d=e[20];let N;e[21]!==v||e[22]!==d?(N=(0,a.jsx)("span",{className:"shrink-0",children:(0,a.jsx)(Y,{variant:v,children:d})}),e[21]=v,e[22]=d,e[23]=N):N=e[23];let m;e[24]!==r.startTs?(m=ee(r.startTs),e[24]=r.startTs,e[25]=m):m=e[25];let u;e[26]!==m?(u=(0,a.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:m}),e[26]=m,e[27]=u):u=e[27];let h;e[28]!==t||e[29]!==x||e[30]!==l||e[31]!==i||e[32]!==N||e[33]!==u||e[34]!==k||e[35]!==C||e[36]!==b||e[37]!==c||e[38]!==w?(h=(0,a.jsxs)("button",{"aria-controls":k,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":C,onClick:x,type:"button",children:[b,c,w,l,i,N,u]}),e[28]=t,e[29]=x,e[30]=l,e[31]=i,e[32]=N,e[33]=u,e[34]=k,e[35]=C,e[36]=b,e[37]=c,e[38]=w,e[39]=h):h=e[39];let g;e[40]!==t||e[41]!==n||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(g=t&&(0,a.jsx)("div",{"aria-label":n("Trace waterfall"),className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,role:"grid",children:r.spans.map(S=>(0,a.jsx)(Ne,{span:S,traceDurationMs:r.durationMs},S.spanId))}),e[40]=t,e[41]=n,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=g):g=e[45];let I;return e[46]!==h||e[47]!==g||e[48]!==L?(I=(0,a.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":L,children:[h,g]}),e[46]=h,e[47]=g,e[48]=L,e[49]=I):I=e[49],I},"be"),Be=M(o=>{let e=(0,H.c)(44),{initialShardKey:t}=o,s=z(),[r]=(0,F.useState)(de),[n,P]=(0,F.useState)(r?.shardKey!==void 0&&r.shardKey!==""?r.shardKey:t??""),[x,L]=(0,F.useState)(r?.traceId??""),[k,C]=(0,F.useState)(ve),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,F.useEffect)(ke,y);let b;e[1]!==n?(b=n.trim(),e[1]=n,e[2]=b):b=e[2];let c=ne(b,400),w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let p;e[4]!==c?(p={live:!0,shardKey:c},e[4]=c,e[5]=p):p=e[5];let{data:l,error:f,errorSource:i,isLoading:v,liveError:d}=te(re.getTraces,w,p),N,m;e[6]!==l||e[7]!==c?(N=M(()=>{l!==void 0&&ae(c)},"N"),m=[l,c],e[6]=l,e[7]=c,e[8]=N,e[9]=m):(N=e[8],m=e[9]),(0,F.useEffect)(N,m);let u;if(e[10]!==l||e[11]!==f||e[12]!==i||e[13]!==k||e[14]!==v||e[15]!==d||e[16]!==x||e[17]!==n||e[18]!==s){let h=we(l),g=l?.total??h.length,I=g>h.length,S=xe(h,x),T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=M(K=>{L(K.target.value)},"T"),e[20]=T):T=e[20];let E=T,$;e[21]===Symbol.for("react.memo_cache_sentinel")?($=M(K=>{C(ue=>{let q=new Set(ue);return q.has(K)?q.delete(K):q.add(K),q})},"$"),e[21]=$):$=e[21];let _=$,J=f===null&&S.length===0&&!v,j;e[22]!==n?(j=(0,a.jsx)(se,{onChange:P,testId:"tr-shard-input",value:n}),e[22]=n,e[23]=j):j=e[23];let A;e[24]!==s?(A=s("Search traces"),e[24]=s,e[25]=A):A=e[25];let D;e[26]!==s?(D=s("search trace or function"),e[26]=s,e[27]=D):D=e[27];let B;e[28]!==x||e[29]!==A||e[30]!==D?(B=(0,a.jsx)(Z,{"aria-label":A,className:"h-8 w-56","data-testid":"tr-search",onChange:E,placeholder:D,value:x}),e[28]=x,e[29]=A,e[30]=D,e[31]=B):B=e[31];let O;e[32]!==d?(O=(0,a.jsx)(le,{message:d,prefix:"tr"}),e[32]=d,e[33]=O):O=e[33];let R;e[34]!==j||e[35]!==B||e[36]!==O?(R=(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[j,B,O]}),e[34]=j,e[35]=B,e[36]=O,e[37]=R):R=e[37];let U;e[38]!==f||e[39]!==i?(U=f!==null&&(0,a.jsx)(oe,{error:i,testId:"tr-error"}),e[38]=f,e[39]=i,e[40]=U):U=e[40];let W;e[41]!==J||e[42]!==s?(W=J&&(0,a.jsx)(X,{description:s("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:s("No traces")}),e[41]=J,e[42]=s,e[43]=W):W=e[43],u=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[R,U,W,f===null&&I&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:s("Showing the {shown} most recent of {total} traces in the buffer.",{shown:h.length,total:g})}),f===null&&S.length>0&&(0,a.jsx)("div",{"aria-label":s("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:S.map(K=>(0,a.jsx)(Me,{expanded:k.has(K.traceId),onToggle:_,trace:K},K.traceId))})]}),e[10]=l,e[11]=f,e[12]=i,e[13]=k,e[14]=v,e[15]=d,e[16]=x,e[17]=n,e[18]=s,e[19]=u}else u=e[19];return u},"Be");function ve(){return new Set}M(ve,"we");function ke(){ce()}M(ke,"Ne");export{Be as TracesPanel};
1
+ import{b as de,c as ce}from"./chunk-KUVMORDQ.js";import{a as ie}from"./chunk-QWGT25SE.js";import{a as le}from"./chunk-X2FQ6B5V.js";import{a as ne}from"./chunk-LFKCLLPT.js";import{a as oe}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b as te}from"./chunk-BMQJ4CAO.js";import{a as se}from"./chunk-LFXFP4IF.js";import{b as ae}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as Z}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as Y}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as re}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as X}from"./chunk-XQCVZAGU.js";import{d as z,q as ee}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as M,e as Q,f as he,g as fe,h as pe,j as V}from"./chunk-3XIESWL4.js";var H=Q(fe(),1),F=Q(he(),1);var a=Q(pe(),1);var me=M(o=>Math.min(100,Math.max(0,o)),"V"),ge=M((o,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=me(o.offsetMs/e*100),s=o.durationMs/e*100,r=Math.max(.5,Math.min(me(s),100-t));return{leftPercent:t,widthPercent:r}},"he"),xe=M((o,e)=>{let t=e.trim().toLowerCase();return t===""?[...o]:o.filter(s=>s.rootName.toLowerCase().includes(t)||s.functionPath.toLowerCase().includes(t)||s.traceId.toLowerCase().includes(t))},"fe"),G=M(o=>Number.isFinite(o)?o>0&&o<1?`${o.toFixed(2)}ms`:`${String(Math.round(o))}ms`:"\u2014","U"),be=14,we=M(o=>Array.isArray(o?.traces)?o.traces:[],"ge"),Ne=M(o=>{let e=(0,H.c)(50),{span:t,traceDurationMs:s}=o,r=z(),n;e[0]!==t||e[1]!==s?(n=ge(t,s),e[0]=t,e[1]=s,e[2]=n):n=e[2];let{leftPercent:P,widthPercent:x}=n,L;e[3]!==t.attributes?(L=ie(t.attributes),e[3]=t.attributes,e[4]=L):L=e[4];let k=L,C=t.depth*be,y;e[5]!==C?(y={paddingLeft:C},e[5]=C,e[6]=y):y=e[6];let b=y,c=`${String(P)}%`,w=`${String(x)}%`,p;e[7]!==c||e[8]!==w?(p={left:c,width:w},e[7]=c,e[8]=w,e[9]=p):p=e[9];let l=p,f=t.depth,i;e[10]!==t.ok||e[11]!==r?(i=t.ok?null:(0,a.jsx)("span",{"aria-label":r("Errored span"),className:"mr-1 text-destructive","data-testid":"tr-span-error",role:"img",children:"\u25CF"}),e[10]=t.ok,e[11]=r,e[12]=i):i=e[12];let v;e[13]!==b||e[14]!==t.name||e[15]!==i?(v=(0,a.jsxs)("span",{className:"w-56 shrink-0 truncate",role:"gridcell",style:b,title:t.name,children:[i,t.name]}),e[13]=b,e[14]=t.name,e[15]=i,e[16]=v):v=e[16];let d;e[17]!==t.durationMs||e[18]!==t.offsetMs||e[19]!==r?(d=r("starts {offset} in, runs {duration}",{duration:G(t.durationMs),offset:G(t.offsetMs)}),e[17]=t.durationMs,e[18]=t.offsetMs,e[19]=r,e[20]=d):d=e[20];let N=t.ok?"bg-primary/70":"bg-destructive",m;e[21]!==N?(m=V("absolute inset-y-0 rounded-sm",N),e[21]=N,e[22]=m):m=e[22];let u;e[23]!==l||e[24]!==P||e[25]!==m||e[26]!==x?(u=(0,a.jsx)("span",{className:m,"data-left":P,"data-testid":"tr-span-bar","data-width":x,style:l}),e[23]=l,e[24]=P,e[25]=m,e[26]=x,e[27]=u):u=e[27];let h;e[28]!==d||e[29]!==u?(h=(0,a.jsx)("span",{"aria-label":d,className:"relative h-3 flex-1 overflow-hidden rounded-sm bg-muted",role:"gridcell",children:u}),e[28]=d,e[29]=u,e[30]=h):h=e[30];let g;e[31]!==t.durationMs?(g=G(t.durationMs),e[31]=t.durationMs,e[32]=g):g=e[32];let I;e[33]!==g?(I=(0,a.jsx)("span",{className:"w-16 shrink-0 text-right tabular-nums text-muted-foreground",role:"gridcell",children:g}),e[33]=g,e[34]=I):I=e[34];let S;e[35]!==t.error?(S=t.error===void 0?null:(0,a.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=S):S=e[36];let T;e[37]!==S?(T=(0,a.jsx)("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:S}),e[37]=S,e[38]=T):T=e[38];let E;e[39]!==k?(E=k===""?null:(0,a.jsx)("span",{"data-testid":"tr-span-attributes",title:k,children:k}),e[39]=k,e[40]=E):E=e[40];let $;e[41]!==E?($=(0,a.jsx)("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:E}),e[41]=E,e[42]=$):$=e[42];let _;return e[43]!==t.depth||e[44]!==v||e[45]!==h||e[46]!==I||e[47]!==T||e[48]!==$?(_=(0,a.jsxs)("div",{className:"flex items-center gap-2 border-b border-border px-3 py-1.5 font-mono text-xs last:border-b-0 hover:bg-muted/50","data-depth":f,"data-testid":"tr-span-row",role:"row",children:[v,h,I,T,$]}),e[43]=t.depth,e[44]=v,e[45]=h,e[46]=I,e[47]=T,e[48]=$,e[49]=_):_=e[49],_},"xe"),Me=M(o=>{let e=(0,H.c)(50),{expanded:t,onToggle:s,trace:r}=o,n=z(),P;e[0]!==s||e[1]!==r.traceId?(P=M(()=>{s(r.traceId)},"S"),e[0]=s,e[1]=r.traceId,e[2]=P):P=e[2];let x=P,L=`tr-row-${r.traceId}`,k=`tr-waterfall-${r.traceId}`,C=`tr-toggle-${r.traceId}`,y=t?"\u25BE":"\u25B8",b;e[3]!==y?(b=(0,a.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:y}),e[3]=y,e[4]=b):b=e[4];let c;e[5]!==r.rootName?(c=(0,a.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=c):c=e[6];let w;e[7]!==r.functionPath?(w=(0,a.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let p;e[9]!==r.durationMs?(p=G(r.durationMs),e[9]=r.durationMs,e[10]=p):p=e[10];let l;e[11]!==p?(l=(0,a.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:p}),e[11]=p,e[12]=l):l=e[12];let f;e[13]!==n||e[14]!==r.spans.length?(f=n("{count} spans",{count:r.spans.length}),e[13]=n,e[14]=r.spans.length,e[15]=f):f=e[15];let i;e[16]!==f?(i=(0,a.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:f}),e[16]=f,e[17]=i):i=e[17];let v=r.ok?"secondary":"destructive",d;e[18]!==n||e[19]!==r.ok?(d=r.ok?n("ok"):n("error"),e[18]=n,e[19]=r.ok,e[20]=d):d=e[20];let N;e[21]!==v||e[22]!==d?(N=(0,a.jsx)("span",{className:"shrink-0",children:(0,a.jsx)(Y,{variant:v,children:d})}),e[21]=v,e[22]=d,e[23]=N):N=e[23];let m;e[24]!==r.startTs?(m=ee(r.startTs),e[24]=r.startTs,e[25]=m):m=e[25];let u;e[26]!==m?(u=(0,a.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:m}),e[26]=m,e[27]=u):u=e[27];let h;e[28]!==t||e[29]!==x||e[30]!==l||e[31]!==i||e[32]!==N||e[33]!==u||e[34]!==k||e[35]!==C||e[36]!==b||e[37]!==c||e[38]!==w?(h=(0,a.jsxs)("button",{"aria-controls":k,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":C,onClick:x,type:"button",children:[b,c,w,l,i,N,u]}),e[28]=t,e[29]=x,e[30]=l,e[31]=i,e[32]=N,e[33]=u,e[34]=k,e[35]=C,e[36]=b,e[37]=c,e[38]=w,e[39]=h):h=e[39];let g;e[40]!==t||e[41]!==n||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(g=t&&(0,a.jsx)("div",{"aria-label":n("Trace waterfall"),className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,role:"grid",children:r.spans.map(S=>(0,a.jsx)(Ne,{span:S,traceDurationMs:r.durationMs},S.spanId))}),e[40]=t,e[41]=n,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=g):g=e[45];let I;return e[46]!==h||e[47]!==g||e[48]!==L?(I=(0,a.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":L,children:[h,g]}),e[46]=h,e[47]=g,e[48]=L,e[49]=I):I=e[49],I},"be"),Be=M(o=>{let e=(0,H.c)(44),{initialShardKey:t}=o,s=z(),[r]=(0,F.useState)(de),[n,P]=(0,F.useState)(r?.shardKey!==void 0&&r.shardKey!==""?r.shardKey:t??""),[x,L]=(0,F.useState)(r?.traceId??""),[k,C]=(0,F.useState)(ve),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,F.useEffect)(ke,y);let b;e[1]!==n?(b=n.trim(),e[1]=n,e[2]=b):b=e[2];let c=ne(b,400),w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let p;e[4]!==c?(p={live:!0,shardKey:c},e[4]=c,e[5]=p):p=e[5];let{data:l,error:f,errorSource:i,isLoading:v,liveError:d}=te(re.getTraces,w,p),N,m;e[6]!==l||e[7]!==c?(N=M(()=>{l!==void 0&&ae(c)},"N"),m=[l,c],e[6]=l,e[7]=c,e[8]=N,e[9]=m):(N=e[8],m=e[9]),(0,F.useEffect)(N,m);let u;if(e[10]!==l||e[11]!==f||e[12]!==i||e[13]!==k||e[14]!==v||e[15]!==d||e[16]!==x||e[17]!==n||e[18]!==s){let h=we(l),g=l?.total??h.length,I=g>h.length,S=xe(h,x),T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=M(K=>{L(K.target.value)},"T"),e[20]=T):T=e[20];let E=T,$;e[21]===Symbol.for("react.memo_cache_sentinel")?($=M(K=>{C(ue=>{let q=new Set(ue);return q.has(K)?q.delete(K):q.add(K),q})},"$"),e[21]=$):$=e[21];let _=$,J=f===null&&S.length===0&&!v,j;e[22]!==n?(j=(0,a.jsx)(se,{onChange:P,testId:"tr-shard-input",value:n}),e[22]=n,e[23]=j):j=e[23];let A;e[24]!==s?(A=s("Search traces"),e[24]=s,e[25]=A):A=e[25];let D;e[26]!==s?(D=s("search trace or function"),e[26]=s,e[27]=D):D=e[27];let B;e[28]!==x||e[29]!==A||e[30]!==D?(B=(0,a.jsx)(Z,{"aria-label":A,className:"h-8 w-56","data-testid":"tr-search",onChange:E,placeholder:D,value:x}),e[28]=x,e[29]=A,e[30]=D,e[31]=B):B=e[31];let O;e[32]!==d?(O=(0,a.jsx)(le,{message:d,prefix:"tr"}),e[32]=d,e[33]=O):O=e[33];let R;e[34]!==j||e[35]!==B||e[36]!==O?(R=(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[j,B,O]}),e[34]=j,e[35]=B,e[36]=O,e[37]=R):R=e[37];let U;e[38]!==f||e[39]!==i?(U=f!==null&&(0,a.jsx)(oe,{error:i,testId:"tr-error"}),e[38]=f,e[39]=i,e[40]=U):U=e[40];let W;e[41]!==J||e[42]!==s?(W=J&&(0,a.jsx)(X,{description:s("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:s("No traces")}),e[41]=J,e[42]=s,e[43]=W):W=e[43],u=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[R,U,W,f===null&&I&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:s("Showing the {shown} most recent of {total} traces in the buffer.",{shown:h.length,total:g})}),f===null&&S.length>0&&(0,a.jsx)("div",{"aria-label":s("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:S.map(K=>(0,a.jsx)(Me,{expanded:k.has(K.traceId),onToggle:_,trace:K},K.traceId))})]}),e[10]=l,e[11]=f,e[12]=i,e[13]=k,e[14]=v,e[15]=d,e[16]=x,e[17]=n,e[18]=s,e[19]=u}else u=e[19];return u},"Be");function ve(){return new Set}M(ve,"we");function ke(){ce()}M(ke,"Ne");export{Be as TracesPanel};
@@ -1 +1 @@
1
- import{a as O}from"./chunk-X2FQ6B5V.js";import{a as q,b as B}from"./chunk-AVAC26HJ.js";import{a as z}from"./chunk-LFKCLLPT.js";import{a as A}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as R}from"./chunk-XSD4Y6SQ.js";import{a as K,b as T,c as F,d as p,e as l,f as d}from"./chunk-MIQTKZAR.js";import{a as I,e as E}from"./chunk-UZERI5YC.js";import{a as j}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as C}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as y}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as V}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as k}from"./chunk-XQCVZAGU.js";import{d as L,q as M}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as o,e as b,f as ee,h as te}from"./chunk-3XIESWL4.js";var i=b(ee(),1);var e=b(te(),1);var D=80,re=o(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>D?`${t.slice(0,D)}\u2026`:t},"te"),ae=41,J=480,H=5,ie=o((s,t)=>q(s,n=>{t(n.height>0?n:{height:J,width:n.width})}),"ae"),Ne=o(({initialShardKey:s})=>{let t=L(),[n,P]=(0,i.useState)(s??""),[c,U]=(0,i.useState)(""),W=z(n.trim(),400),{data:f,error:g,errorSource:Z,isLoading:_,liveError:$}=R(V.getAuditLog,{},{live:!0,shardKey:W}),h=(0,i.useMemo)(()=>f?.entries??[],[f]),m=(0,i.useMemo)(()=>{let a=c.trim().toLowerCase();return a===""?h:h.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[h,c]),x=(0,i.useRef)(null),v=B({count:m.length,estimateSize:o(()=>ae,"estimateSize"),getScrollElement:o(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),G=v.getTotalSize(),N=u[0]?.start??0,w=G-(u.at(-1)?.end??0),Q={height:N},X={height:w},Y=o(a=>{U(a.target.value)},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(j,{onChange:P,testId:"au-shard-input",value:n}),(0,e.jsx)(O,{message:$,prefix:"au"}),(0,e.jsx)(C,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:c})]}),g!==null&&(0,e.jsx)(A,{error:Z,testId:"au-error"}),g===null&&!_&&m.length===0&&(0,e.jsx)(k,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),m.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(K,{"data-testid":"au-table",children:[(0,e.jsx)(T,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(l,{children:t("time")}),(0,e.jsx)(l,{children:t("op")}),(0,e.jsx)(l,{children:t("table")}),(0,e.jsx)(l,{children:t("id")}),(0,e.jsx)(l,{children:t("detail")})]})}),(0,e.jsxs)(F,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Q})}),u.map(a=>{let r=m[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:M(r.ts,"\u2014")}),(0,e.jsx)(d,{children:(0,e.jsx)(y,{variant:"secondary",children:r.op})}),(0,e.jsx)(d,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})})]})]})})})]})},"we");export{Ne as AuditPanel};
1
+ import{a as O}from"./chunk-X2FQ6B5V.js";import{a as q,b as B}from"./chunk-AVAC26HJ.js";import{a as z}from"./chunk-LFKCLLPT.js";import{a as A}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b as R}from"./chunk-BMQJ4CAO.js";import{a as K,b as T,c as F,d as p,e as l,f as d}from"./chunk-MIQTKZAR.js";import{a as I,e as E}from"./chunk-UZERI5YC.js";import{a as j}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as C}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as y}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as V}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as k}from"./chunk-XQCVZAGU.js";import{d as L,q as M}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as o,e as b,f as ee,h as te}from"./chunk-3XIESWL4.js";var i=b(ee(),1);var e=b(te(),1);var D=80,re=o(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>D?`${t.slice(0,D)}\u2026`:t},"te"),ae=41,J=480,H=5,ie=o((s,t)=>q(s,n=>{t(n.height>0?n:{height:J,width:n.width})}),"ae"),Ne=o(({initialShardKey:s})=>{let t=L(),[n,P]=(0,i.useState)(s??""),[c,U]=(0,i.useState)(""),W=z(n.trim(),400),{data:f,error:g,errorSource:Z,isLoading:_,liveError:$}=R(V.getAuditLog,{},{live:!0,shardKey:W}),h=(0,i.useMemo)(()=>f?.entries??[],[f]),m=(0,i.useMemo)(()=>{let a=c.trim().toLowerCase();return a===""?h:h.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[h,c]),x=(0,i.useRef)(null),v=B({count:m.length,estimateSize:o(()=>ae,"estimateSize"),getScrollElement:o(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),G=v.getTotalSize(),N=u[0]?.start??0,w=G-(u.at(-1)?.end??0),Q={height:N},X={height:w},Y=o(a=>{U(a.target.value)},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(j,{onChange:P,testId:"au-shard-input",value:n}),(0,e.jsx)(O,{message:$,prefix:"au"}),(0,e.jsx)(C,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:c})]}),g!==null&&(0,e.jsx)(A,{error:Z,testId:"au-error"}),g===null&&!_&&m.length===0&&(0,e.jsx)(k,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),m.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(K,{"data-testid":"au-table",children:[(0,e.jsx)(T,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(l,{children:t("time")}),(0,e.jsx)(l,{children:t("op")}),(0,e.jsx)(l,{children:t("table")}),(0,e.jsx)(l,{children:t("id")}),(0,e.jsx)(l,{children:t("detail")})]})}),(0,e.jsxs)(F,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Q})}),u.map(a=>{let r=m[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:M(r.ts,"\u2014")}),(0,e.jsx)(d,{children:(0,e.jsx)(y,{variant:"secondary",children:r.op})}),(0,e.jsx)(d,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})})]})]})})})]})},"we");export{Ne as AuditPanel};
@@ -1 +1 @@
1
- import{a as S}from"./chunk-XSD4Y6SQ.js";import{a as y,e as A}from"./chunk-UZERI5YC.js";import{b as h}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{f as k}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{d as I}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as u,e as w,g as $,h as j}from"./chunk-3XIESWL4.js";var N=w($(),1);var a=w(j(),1);var z=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),g=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:r}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let n;i[2]!==t?(n=(0,a.jsx)(A,{className:"p-3",children:t}),i[2]=t,i[3]=n):n=i[3];let c;return i[4]!==l||i[5]!==n||i[6]!==r?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":r,children:[l,n]}),i[4]=l,i[5]=n,i[6]=r,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,r;i[0]!==t?(r=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=r):r=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let n;return i[4]!==r||i[5]!==l?(n=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[r,l]}),i[4]=r,i[5]=l,i[6]=n):n=i[6],n},"c"),O=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let r;e[1]!==i?(r=u(()=>i.getAuthConfig(),"s"),e[1]=i,e[2]=r):r=e[2];let{data:l,error:n}=S(d,r),c;e[3]!==t?(c=u(s=>(0,a.jsx)(h,{variant:s?"success":"outline",children:t(s?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,p;e[5]!==n?(p=n!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:n}),e[5]=n,e[6]=p):p=e[6];let f;e[7]!==l||e[8]!==n||e[9]!==t?(f=n===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=n,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==n||e[13]!==m||e[14]!==t?(x=n===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:z.map(s=>{let P=l.capabilities[s.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${s.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(s.label)}),m(P)]},s.key)})})}),(0,a.jsx)(g,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(L)})}),(0,a.jsx)(g,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(q)})})]})}),l.organization.enabled&&(0,a.jsx)(g,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(g,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(g,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(g,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(s=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${s.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:s.name}),s.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:s.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:s.type}),s.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),s.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},s.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=n,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==p||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[p,f,x]}),e[16]=p,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"M");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(L,"P");function q(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(q,"z");export{O as AuthConfigPanel};
1
+ import{a as S}from"./chunk-BMQJ4CAO.js";import{a as y,e as A}from"./chunk-UZERI5YC.js";import{b as h}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{f as k}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{d as I}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as u,e as w,g as $,h as j}from"./chunk-3XIESWL4.js";var N=w($(),1);var a=w(j(),1);var z=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),g=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:r}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let n;i[2]!==t?(n=(0,a.jsx)(A,{className:"p-3",children:t}),i[2]=t,i[3]=n):n=i[3];let c;return i[4]!==l||i[5]!==n||i[6]!==r?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":r,children:[l,n]}),i[4]=l,i[5]=n,i[6]=r,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,r;i[0]!==t?(r=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=r):r=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let n;return i[4]!==r||i[5]!==l?(n=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[r,l]}),i[4]=r,i[5]=l,i[6]=n):n=i[6],n},"c"),O=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let r;e[1]!==i?(r=u(()=>i.getAuthConfig(),"s"),e[1]=i,e[2]=r):r=e[2];let{data:l,error:n}=S(d,r),c;e[3]!==t?(c=u(s=>(0,a.jsx)(h,{variant:s?"success":"outline",children:t(s?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,p;e[5]!==n?(p=n!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:n}),e[5]=n,e[6]=p):p=e[6];let f;e[7]!==l||e[8]!==n||e[9]!==t?(f=n===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=n,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==n||e[13]!==m||e[14]!==t?(x=n===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:z.map(s=>{let P=l.capabilities[s.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${s.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(s.label)}),m(P)]},s.key)})})}),(0,a.jsx)(g,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(L)})}),(0,a.jsx)(g,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(q)})})]})}),l.organization.enabled&&(0,a.jsx)(g,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(g,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(g,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(g,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(s=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${s.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:s.name}),s.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:s.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:s.type}),s.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),s.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},s.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=n,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==p||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[p,f,x]}),e[16]=p,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"M");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(L,"P");function q(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(q,"z");export{O as AuthConfigPanel};
@@ -1 +1 @@
1
- import{a as v}from"./chunk-UNUU7CJJ.js";import{a as w,b as y,c as $,d,e as c,f as i}from"./chunk-MIQTKZAR.js";import{a as b,e as N}from"./chunk-UZERI5YC.js";import{d as x}from"./chunk-4CGALXS3.js";import{a as s,e as g,f as T,h as O,j as h}from"./chunk-3XIESWL4.js";var m=g(T(),1);var e=g(O(),1);var S={ERROR:"error",INFO:"info",WARN:"warning"},M=s(r=>{let n=typeof r.metadata.table=="string"?r.metadata.table:void 0;return{description:`${r.detail} ${r.remediation}`,entity:n,issueType:r.title,key:r.cacheKey,level:S[r.level]}},"q"),j=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},C=s((r,n)=>({error:r("Errors"),info:r("Info"),warning:r("Warnings")})[n],"S"),W=s((r,n,o)=>({error:r("{count} errors",{count:o}),info:r("{count} suggestions",{count:o}),warning:r("{count} warnings",{count:o})})[n],"j"),q=s((r,n)=>({error:r("No errors detected"),info:r("No suggestions"),warning:r("No warnings detected")})[n],"C"),G=s(({error:r=null,errorSource:n,rows:o,testId:l,toolbar:f})=>{let a=x(),[u,k]=(0,m.useState)("error"),I=(0,m.useMemo)(()=>{let t={error:0,info:0,warning:0};for(let R of o??[])t[R.level]+=1;return t},[o]),p=(o??[]).filter(t=>t.level===u),E=s(t=>{k(t.currentTarget.dataset.level)},"h");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":l,children:[(0,e.jsx)("div",{className:"flex border-b border-border",role:"tablist",children:j.map(t=>(0,e.jsxs)("button",{"aria-selected":u===t,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":t,"data-testid":`${l}-tab-${t}`,onClick:E,role:"tab",type:"button",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:h("size-2 rounded-sm",A[t])}),C(a,t)]}),(0,e.jsx)("span",{className:"ps-4 text-xs text-muted-foreground",children:W(a,t,I[t])})]},t))}),f!==void 0&&(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:f}),r!==null&&(0,e.jsx)(v,{error:n??r,testId:`${l}-error`}),(0,e.jsx)(b,{className:"overflow-hidden py-0",children:(0,e.jsx)(N,{className:"px-0",children:(0,e.jsxs)(w,{children:[(0,e.jsx)(y,{children:(0,e.jsxs)(d,{children:[(0,e.jsx)(c,{children:a("Issue type")}),(0,e.jsx)(c,{children:a("Entity/item")}),(0,e.jsx)(c,{children:a("Description")})]})}),(0,e.jsx)($,{children:p.length===0?(0,e.jsx)(d,{children:(0,e.jsxs)(i,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${l}-empty`,children:[(0,e.jsx)("span",{className:"block text-sm font-medium text-foreground",children:q(a,u)}),(0,e.jsx)("span",{className:"block text-sm",children:a("Nothing to report for this deployment.")})]})}):p.map(t=>(0,e.jsxs)(d,{children:[(0,e.jsx)(i,{className:"font-medium text-foreground",children:t.issueType}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.entity??"\u2014"}),(0,e.jsxs)(i,{className:"text-muted-foreground",children:[(0,e.jsx)("span",{children:t.description}),t.action!==void 0&&(0,e.jsx)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:t.action})]})]},t.key))})]})})})]})},"B");export{M as a,G as b};
1
+ import{a as v}from"./chunk-HK4OVYG3.js";import{a as w,b as y,c as $,d,e as c,f as i}from"./chunk-MIQTKZAR.js";import{a as b,e as N}from"./chunk-UZERI5YC.js";import{d as x}from"./chunk-4CGALXS3.js";import{a as s,e as g,f as T,h as O,j as h}from"./chunk-3XIESWL4.js";var m=g(T(),1);var e=g(O(),1);var S={ERROR:"error",INFO:"info",WARN:"warning"},M=s(r=>{let n=typeof r.metadata.table=="string"?r.metadata.table:void 0;return{description:`${r.detail} ${r.remediation}`,entity:n,issueType:r.title,key:r.cacheKey,level:S[r.level]}},"q"),j=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},C=s((r,n)=>({error:r("Errors"),info:r("Info"),warning:r("Warnings")})[n],"S"),W=s((r,n,o)=>({error:r("{count} errors",{count:o}),info:r("{count} suggestions",{count:o}),warning:r("{count} warnings",{count:o})})[n],"j"),q=s((r,n)=>({error:r("No errors detected"),info:r("No suggestions"),warning:r("No warnings detected")})[n],"C"),G=s(({error:r=null,errorSource:n,rows:o,testId:l,toolbar:f})=>{let a=x(),[u,k]=(0,m.useState)("error"),I=(0,m.useMemo)(()=>{let t={error:0,info:0,warning:0};for(let R of o??[])t[R.level]+=1;return t},[o]),p=(o??[]).filter(t=>t.level===u),E=s(t=>{k(t.currentTarget.dataset.level)},"h");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":l,children:[(0,e.jsx)("div",{className:"flex border-b border-border",role:"tablist",children:j.map(t=>(0,e.jsxs)("button",{"aria-selected":u===t,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":t,"data-testid":`${l}-tab-${t}`,onClick:E,role:"tab",type:"button",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:h("size-2 rounded-sm",A[t])}),C(a,t)]}),(0,e.jsx)("span",{className:"ps-4 text-xs text-muted-foreground",children:W(a,t,I[t])})]},t))}),f!==void 0&&(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:f}),r!==null&&(0,e.jsx)(v,{error:n??r,testId:`${l}-error`}),(0,e.jsx)(b,{className:"overflow-hidden py-0",children:(0,e.jsx)(N,{className:"px-0",children:(0,e.jsxs)(w,{children:[(0,e.jsx)(y,{children:(0,e.jsxs)(d,{children:[(0,e.jsx)(c,{children:a("Issue type")}),(0,e.jsx)(c,{children:a("Entity/item")}),(0,e.jsx)(c,{children:a("Description")})]})}),(0,e.jsx)($,{children:p.length===0?(0,e.jsx)(d,{children:(0,e.jsxs)(i,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${l}-empty`,children:[(0,e.jsx)("span",{className:"block text-sm font-medium text-foreground",children:q(a,u)}),(0,e.jsx)("span",{className:"block text-sm",children:a("Nothing to report for this deployment.")})]})}):p.map(t=>(0,e.jsxs)(d,{children:[(0,e.jsx)(i,{className:"font-medium text-foreground",children:t.issueType}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.entity??"\u2014"}),(0,e.jsxs)(i,{className:"text-muted-foreground",children:[(0,e.jsx)("span",{children:t.description}),t.action!==void 0&&(0,e.jsx)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:t.action})]})]},t.key))})]})})})]})},"B");export{M as a,G as b};
@@ -1,4 +1,4 @@
1
- import{a as Bi,b as je,c as pi,d as Le,e as Ci,f as Ri,k as Zi}from"./chunk-FPLGBHY4.js";import"./chunk-F6GOKFMU.js";import"./chunk-M536Y2KX.js";import"./chunk-KYF2E5CJ.js";import"./chunk-7YEFOSPH.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-ILNELDFC.js";import"./chunk-SFDOII3B.js";import"./chunk-SMIESS7P.js";import{a as Gi}from"./chunk-LFKCLLPT.js";import"./chunk-T6VMSOBB.js";import"./chunk-XSD4Y6SQ.js";import"./chunk-UZERI5YC.js";import"./chunk-HPFLBYRI.js";import"./chunk-QBWRC5YX.js";import{a as Ve}from"./chunk-7T7UOTYK.js";import{R as Yi}from"./chunk-CFPZYHPY.js";import{a as bd}from"./chunk-7QIFDWQV.js";import{c as Qi}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import"./chunk-GXZAXNZI.js";import{a as _i,e as Hi}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import"./chunk-XQCVZAGU.js";import{a as qi,d as xe,n as Xi}from"./chunk-4CGALXS3.js";import{b as Ui}from"./chunk-LE56LPNH.js";import{a as c,c as vn,e as cu,f as Di,g as sd,h as Ni,j as Ze}from"./chunk-3XIESWL4.js";var $i=vn(w=>{"use strict";function we(l,t){var a=l.length;l.push(t);l:for(;0<a;){var u=a-1>>>1,n=l[u];if(0<dn(n,t))l[u]=t,l[a]=n,a=u;else break l}}c(we,"push");function wl(l){return l.length===0?null:l[0]}c(wl,"peek");function hn(l){if(l.length===0)return null;var t=l[0],a=l.pop();if(a!==t){l[0]=a;l:for(var u=0,n=l.length,e=n>>>1;u<e;){var f=2*(u+1)-1,i=l[f],m=f+1,y=l[m];if(0>dn(i,a))m<n&&0>dn(y,i)?(l[u]=y,l[m]=a,u=m):(l[u]=i,l[f]=a,u=f);else if(m<n&&0>dn(y,a))l[u]=y,l[m]=a,u=m;else break l}}return t}c(hn,"pop");function dn(l,t){var a=l.sortIndex-t.sortIndex;return a!==0?a:l.id-t.id}c(dn,"compare");w.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(xi=performance,w.unstable_now=function(){return xi.now()}):(Ke=Date,ji=Ke.now(),w.unstable_now=function(){return Ke.now()-ji});var xi,Ke,ji,lt=[],Tt=[],zd=1,Ql=null,Sl=3,Fe=!1,fu=!1,iu=!1,$e=!1,Ki=typeof setTimeout=="function"?setTimeout:null,Ji=typeof clearTimeout=="function"?clearTimeout:null,Vi=typeof setImmediate<"u"?setImmediate:null;function yn(l){for(var t=wl(Tt);t!==null;){if(t.callback===null)hn(Tt);else if(t.startTime<=l)hn(Tt),t.sortIndex=t.expirationTime,we(lt,t);else break;t=wl(Tt)}}c(yn,"advanceTimers");function ke(l){if(iu=!1,yn(l),!fu)if(wl(lt)!==null)fu=!0,ga||(ga=!0,Sa());else{var t=wl(Tt);t!==null&&re(ke,t.startTime-l)}}c(ke,"handleTimeout");var ga=!1,mu=-1,Wi=5,wi=-1;function Fi(){return $e?!0:!(w.unstable_now()-wi<Wi)}c(Fi,"shouldYieldToHost");function Je(){if($e=!1,ga){var l=w.unstable_now();wi=l;var t=!0;try{l:{fu=!1,iu&&(iu=!1,Ji(mu),mu=-1),Fe=!0;var a=Sl;try{t:{for(yn(l),Ql=wl(lt);Ql!==null&&!(Ql.expirationTime>l&&Fi());){var u=Ql.callback;if(typeof u=="function"){Ql.callback=null,Sl=Ql.priorityLevel;var n=u(Ql.expirationTime<=l);if(l=w.unstable_now(),typeof n=="function"){Ql.callback=n,yn(l),t=!0;break t}Ql===wl(lt)&&hn(lt),yn(l)}else hn(lt);Ql=wl(lt)}if(Ql!==null)t=!0;else{var e=wl(Tt);e!==null&&re(ke,e.startTime-l),t=!1}}break l}finally{Ql=null,Sl=a,Fe=!1}t=void 0}}finally{t?Sa():ga=!1}}}c(Je,"performWorkUntilDeadline");var Sa;typeof Vi=="function"?Sa=c(function(){Vi(Je)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(We=new MessageChannel,Li=We.port2,We.port1.onmessage=Je,Sa=c(function(){Li.postMessage(null)},"schedulePerformWorkUntilDeadline")):Sa=c(function(){Ki(Je,0)},"schedulePerformWorkUntilDeadline");var We,Li;function re(l,t){mu=Ki(function(){l(w.unstable_now())},t)}c(re,"requestHostTimeout");w.unstable_IdlePriority=5;w.unstable_ImmediatePriority=1;w.unstable_LowPriority=4;w.unstable_NormalPriority=3;w.unstable_Profiling=null;w.unstable_UserBlockingPriority=2;w.unstable_cancelCallback=function(l){l.callback=null};w.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Wi=0<l?Math.floor(1e3/l):5};w.unstable_getCurrentPriorityLevel=function(){return Sl};w.unstable_next=function(l){switch(Sl){case 1:case 2:case 3:var t=3;break;default:t=Sl}var a=Sl;Sl=t;try{return l()}finally{Sl=a}};w.unstable_requestPaint=function(){$e=!0};w.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var a=Sl;Sl=l;try{return t()}finally{Sl=a}};w.unstable_scheduleCallback=function(l,t,a){var u=w.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?u+a:u):a=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,l={id:zd++,callback:t,priorityLevel:l,startTime:a,expirationTime:n,sortIndex:-1},a>u?(l.sortIndex=a,we(Tt,l),wl(lt)===null&&l===wl(Tt)&&(iu?(Ji(mu),mu=-1):iu=!0,re(ke,a-u))):(l.sortIndex=n,we(lt,l),fu||Fe||(fu=!0,ga||(ga=!0,Sa()))),l};w.unstable_shouldYield=Fi;w.unstable_wrapCallback=function(l){var t=Sl;return function(){var a=Sl;Sl=t;try{return l.apply(this,arguments)}finally{Sl=a}}}});var ri=vn((a2,ki)=>{"use strict";ki.exports=$i()});var md=vn(Re=>{"use strict";var el=ri(),M1=Di(),Ad=bd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}c(z,"formatProdErrorMessage");function O1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}c(O1,"isValidContainer");function $u(l){var t=l,a=l;if(l.alternate)for(;t.return;)t=t.return;else{l=t;do t=l,(t.flags&4098)!==0&&(a=t.return),l=t.return;while(l)}return t.tag===3?a:null}c($u,"getNearestMountedFiber");function U1(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(U1,"getSuspenseInstanceFromFiber");function D1(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(D1,"getActivityInstanceFromFiber");function Ii(l){if($u(l)!==l)throw Error(z(188))}c(Ii,"assertIsMounted");function Td(l){var t=l.alternate;if(!t){if(t=$u(l),t===null)throw Error(z(188));return t!==l?null:l}for(var a=l,u=t;;){var n=a.return;if(n===null)break;var e=n.alternate;if(e===null){if(u=n.return,u!==null){a=u;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===a)return Ii(n),l;if(e===u)return Ii(n),t;e=e.sibling}throw Error(z(188))}if(a.return!==u.return)a=n,u=e;else{for(var f=!1,i=n.child;i;){if(i===a){f=!0,a=n,u=e;break}if(i===u){f=!0,u=n,a=e;break}i=i.sibling}if(!f){for(i=e.child;i;){if(i===a){f=!0,a=e,u=n;break}if(i===u){f=!0,u=e,a=n;break}i=i.sibling}if(!f)throw Error(z(189))}}if(a.alternate!==u)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?l:t}c(Td,"findCurrentFiberUsingSlowPath");function _1(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=_1(l),t!==null)return t;l=l.sibling}return null}c(_1,"findCurrentHostFiberImpl");var W=Object.assign,Ed=Symbol.for("react.element"),Sn=Symbol.for("react.transitional.element"),bu=Symbol.for("react.portal"),Ta=Symbol.for("react.fragment"),N1=Symbol.for("react.strict_mode"),qc=Symbol.for("react.profiler"),H1=Symbol.for("react.consumer"),it=Symbol.for("react.context"),_f=Symbol.for("react.forward_ref"),Yc=Symbol.for("react.suspense"),Qc=Symbol.for("react.suspense_list"),Nf=Symbol.for("react.memo"),Et=Symbol.for("react.lazy"),Xc=Symbol.for("react.activity"),Md=Symbol.for("react.memo_cache_sentinel"),Pi=Symbol.iterator;function vu(l){return l===null||typeof l!="object"?null:(l=Pi&&l[Pi]||l["@@iterator"],typeof l=="function"?l:null)}c(vu,"getIteratorFn");var Od=Symbol.for("react.client.reference");function Gc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Od?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Ta:return"Fragment";case qc:return"Profiler";case N1:return"StrictMode";case Yc:return"Suspense";case Qc:return"SuspenseList";case Xc:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case bu:return"Portal";case it:return l.displayName||"Context";case H1:return(l._context.displayName||"Context")+".Consumer";case _f:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Nf:return t=l.displayName||null,t!==null?t:Gc(l.type)||"Memo";case Et:t=l._payload,l=l._init;try{return Gc(l(t))}catch{}}return null}c(Gc,"getComponentNameFromType");var su=Array.isArray,_=M1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,p=Ad.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Pt={pending:!1,data:null,method:null,action:null},pc=[],Ea=-1;function Il(l){return{current:l}}c(Il,"createCursor");function il(l){0>Ea||(l.current=pc[Ea],pc[Ea]=null,Ea--)}c(il,"pop");function L(l,t){Ea++,pc[Ea]=l.current,l.current=t}c(L,"push");var rl=Il(null),Gu=Il(null),Qt=Il(null),wn=Il(null);function Fn(l,t){switch(L(Qt,t),L(Gu,l),L(rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?c1(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=c1(t),l=$v(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}il(rl),L(rl,l)}c(Fn,"pushHostContainer");function xa(){il(rl),il(Gu),il(Qt)}c(xa,"popHostContainer");function Cc(l){l.memoizedState!==null&&L(wn,l);var t=rl.current,a=$v(t,l.type);t!==a&&(L(Gu,l),L(rl,a))}c(Cc,"pushHostContext");function $n(l){Gu.current===l&&(il(rl),il(Gu)),wn.current===l&&(il(wn),Wu._currentValue=Pt)}c($n,"popHostContext");var Ie,l0;function $t(l){if(Ie===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||"",l0=-1<a.stack.indexOf(`
1
+ import{a as Bi,b as je,c as pi,d as Le,e as Ci,f as Ri,k as Zi}from"./chunk-H5Y5NQPL.js";import"./chunk-HYT2ZUNP.js";import"./chunk-M536Y2KX.js";import"./chunk-KYF2E5CJ.js";import"./chunk-7YEFOSPH.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-ILNELDFC.js";import"./chunk-SFDOII3B.js";import"./chunk-SMIESS7P.js";import{a as Gi}from"./chunk-LFKCLLPT.js";import"./chunk-T6VMSOBB.js";import"./chunk-BMQJ4CAO.js";import"./chunk-UZERI5YC.js";import"./chunk-HPFLBYRI.js";import"./chunk-QBWRC5YX.js";import{a as Ve}from"./chunk-7T7UOTYK.js";import{R as Yi}from"./chunk-CFPZYHPY.js";import{a as bd}from"./chunk-7QIFDWQV.js";import{c as Qi}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import"./chunk-AADXUXZO.js";import{a as _i,e as Hi}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import"./chunk-XQCVZAGU.js";import{a as qi,d as xe,n as Xi}from"./chunk-4CGALXS3.js";import{c as Ui}from"./chunk-AADILRJW.js";import{a as c,c as vn,e as cu,f as Di,g as sd,h as Ni,j as Ze}from"./chunk-3XIESWL4.js";var $i=vn(w=>{"use strict";function we(l,t){var a=l.length;l.push(t);l:for(;0<a;){var u=a-1>>>1,n=l[u];if(0<dn(n,t))l[u]=t,l[a]=n,a=u;else break l}}c(we,"push");function wl(l){return l.length===0?null:l[0]}c(wl,"peek");function hn(l){if(l.length===0)return null;var t=l[0],a=l.pop();if(a!==t){l[0]=a;l:for(var u=0,n=l.length,e=n>>>1;u<e;){var f=2*(u+1)-1,i=l[f],m=f+1,y=l[m];if(0>dn(i,a))m<n&&0>dn(y,i)?(l[u]=y,l[m]=a,u=m):(l[u]=i,l[f]=a,u=f);else if(m<n&&0>dn(y,a))l[u]=y,l[m]=a,u=m;else break l}}return t}c(hn,"pop");function dn(l,t){var a=l.sortIndex-t.sortIndex;return a!==0?a:l.id-t.id}c(dn,"compare");w.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(xi=performance,w.unstable_now=function(){return xi.now()}):(Ke=Date,ji=Ke.now(),w.unstable_now=function(){return Ke.now()-ji});var xi,Ke,ji,lt=[],Tt=[],zd=1,Ql=null,Sl=3,Fe=!1,fu=!1,iu=!1,$e=!1,Ki=typeof setTimeout=="function"?setTimeout:null,Ji=typeof clearTimeout=="function"?clearTimeout:null,Vi=typeof setImmediate<"u"?setImmediate:null;function yn(l){for(var t=wl(Tt);t!==null;){if(t.callback===null)hn(Tt);else if(t.startTime<=l)hn(Tt),t.sortIndex=t.expirationTime,we(lt,t);else break;t=wl(Tt)}}c(yn,"advanceTimers");function ke(l){if(iu=!1,yn(l),!fu)if(wl(lt)!==null)fu=!0,ga||(ga=!0,Sa());else{var t=wl(Tt);t!==null&&re(ke,t.startTime-l)}}c(ke,"handleTimeout");var ga=!1,mu=-1,Wi=5,wi=-1;function Fi(){return $e?!0:!(w.unstable_now()-wi<Wi)}c(Fi,"shouldYieldToHost");function Je(){if($e=!1,ga){var l=w.unstable_now();wi=l;var t=!0;try{l:{fu=!1,iu&&(iu=!1,Ji(mu),mu=-1),Fe=!0;var a=Sl;try{t:{for(yn(l),Ql=wl(lt);Ql!==null&&!(Ql.expirationTime>l&&Fi());){var u=Ql.callback;if(typeof u=="function"){Ql.callback=null,Sl=Ql.priorityLevel;var n=u(Ql.expirationTime<=l);if(l=w.unstable_now(),typeof n=="function"){Ql.callback=n,yn(l),t=!0;break t}Ql===wl(lt)&&hn(lt),yn(l)}else hn(lt);Ql=wl(lt)}if(Ql!==null)t=!0;else{var e=wl(Tt);e!==null&&re(ke,e.startTime-l),t=!1}}break l}finally{Ql=null,Sl=a,Fe=!1}t=void 0}}finally{t?Sa():ga=!1}}}c(Je,"performWorkUntilDeadline");var Sa;typeof Vi=="function"?Sa=c(function(){Vi(Je)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(We=new MessageChannel,Li=We.port2,We.port1.onmessage=Je,Sa=c(function(){Li.postMessage(null)},"schedulePerformWorkUntilDeadline")):Sa=c(function(){Ki(Je,0)},"schedulePerformWorkUntilDeadline");var We,Li;function re(l,t){mu=Ki(function(){l(w.unstable_now())},t)}c(re,"requestHostTimeout");w.unstable_IdlePriority=5;w.unstable_ImmediatePriority=1;w.unstable_LowPriority=4;w.unstable_NormalPriority=3;w.unstable_Profiling=null;w.unstable_UserBlockingPriority=2;w.unstable_cancelCallback=function(l){l.callback=null};w.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Wi=0<l?Math.floor(1e3/l):5};w.unstable_getCurrentPriorityLevel=function(){return Sl};w.unstable_next=function(l){switch(Sl){case 1:case 2:case 3:var t=3;break;default:t=Sl}var a=Sl;Sl=t;try{return l()}finally{Sl=a}};w.unstable_requestPaint=function(){$e=!0};w.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var a=Sl;Sl=l;try{return t()}finally{Sl=a}};w.unstable_scheduleCallback=function(l,t,a){var u=w.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?u+a:u):a=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,l={id:zd++,callback:t,priorityLevel:l,startTime:a,expirationTime:n,sortIndex:-1},a>u?(l.sortIndex=a,we(Tt,l),wl(lt)===null&&l===wl(Tt)&&(iu?(Ji(mu),mu=-1):iu=!0,re(ke,a-u))):(l.sortIndex=n,we(lt,l),fu||Fe||(fu=!0,ga||(ga=!0,Sa()))),l};w.unstable_shouldYield=Fi;w.unstable_wrapCallback=function(l){var t=Sl;return function(){var a=Sl;Sl=t;try{return l.apply(this,arguments)}finally{Sl=a}}}});var ri=vn((a2,ki)=>{"use strict";ki.exports=$i()});var md=vn(Re=>{"use strict";var el=ri(),M1=Di(),Ad=bd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}c(z,"formatProdErrorMessage");function O1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}c(O1,"isValidContainer");function $u(l){var t=l,a=l;if(l.alternate)for(;t.return;)t=t.return;else{l=t;do t=l,(t.flags&4098)!==0&&(a=t.return),l=t.return;while(l)}return t.tag===3?a:null}c($u,"getNearestMountedFiber");function U1(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(U1,"getSuspenseInstanceFromFiber");function D1(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(D1,"getActivityInstanceFromFiber");function Ii(l){if($u(l)!==l)throw Error(z(188))}c(Ii,"assertIsMounted");function Td(l){var t=l.alternate;if(!t){if(t=$u(l),t===null)throw Error(z(188));return t!==l?null:l}for(var a=l,u=t;;){var n=a.return;if(n===null)break;var e=n.alternate;if(e===null){if(u=n.return,u!==null){a=u;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===a)return Ii(n),l;if(e===u)return Ii(n),t;e=e.sibling}throw Error(z(188))}if(a.return!==u.return)a=n,u=e;else{for(var f=!1,i=n.child;i;){if(i===a){f=!0,a=n,u=e;break}if(i===u){f=!0,u=n,a=e;break}i=i.sibling}if(!f){for(i=e.child;i;){if(i===a){f=!0,a=e,u=n;break}if(i===u){f=!0,u=e,a=n;break}i=i.sibling}if(!f)throw Error(z(189))}}if(a.alternate!==u)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?l:t}c(Td,"findCurrentFiberUsingSlowPath");function _1(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=_1(l),t!==null)return t;l=l.sibling}return null}c(_1,"findCurrentHostFiberImpl");var W=Object.assign,Ed=Symbol.for("react.element"),Sn=Symbol.for("react.transitional.element"),bu=Symbol.for("react.portal"),Ta=Symbol.for("react.fragment"),N1=Symbol.for("react.strict_mode"),qc=Symbol.for("react.profiler"),H1=Symbol.for("react.consumer"),it=Symbol.for("react.context"),_f=Symbol.for("react.forward_ref"),Yc=Symbol.for("react.suspense"),Qc=Symbol.for("react.suspense_list"),Nf=Symbol.for("react.memo"),Et=Symbol.for("react.lazy"),Xc=Symbol.for("react.activity"),Md=Symbol.for("react.memo_cache_sentinel"),Pi=Symbol.iterator;function vu(l){return l===null||typeof l!="object"?null:(l=Pi&&l[Pi]||l["@@iterator"],typeof l=="function"?l:null)}c(vu,"getIteratorFn");var Od=Symbol.for("react.client.reference");function Gc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Od?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Ta:return"Fragment";case qc:return"Profiler";case N1:return"StrictMode";case Yc:return"Suspense";case Qc:return"SuspenseList";case Xc:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case bu:return"Portal";case it:return l.displayName||"Context";case H1:return(l._context.displayName||"Context")+".Consumer";case _f:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Nf:return t=l.displayName||null,t!==null?t:Gc(l.type)||"Memo";case Et:t=l._payload,l=l._init;try{return Gc(l(t))}catch{}}return null}c(Gc,"getComponentNameFromType");var su=Array.isArray,_=M1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,p=Ad.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Pt={pending:!1,data:null,method:null,action:null},pc=[],Ea=-1;function Il(l){return{current:l}}c(Il,"createCursor");function il(l){0>Ea||(l.current=pc[Ea],pc[Ea]=null,Ea--)}c(il,"pop");function L(l,t){Ea++,pc[Ea]=l.current,l.current=t}c(L,"push");var rl=Il(null),Gu=Il(null),Qt=Il(null),wn=Il(null);function Fn(l,t){switch(L(Qt,t),L(Gu,l),L(rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?c1(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=c1(t),l=$v(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}il(rl),L(rl,l)}c(Fn,"pushHostContainer");function xa(){il(rl),il(Gu),il(Qt)}c(xa,"popHostContainer");function Cc(l){l.memoizedState!==null&&L(wn,l);var t=rl.current,a=$v(t,l.type);t!==a&&(L(Gu,l),L(rl,a))}c(Cc,"pushHostContext");function $n(l){Gu.current===l&&(il(rl),il(Gu)),wn.current===l&&(il(wn),Wu._currentValue=Pt)}c($n,"popHostContext");var Ie,l0;function $t(l){if(Ie===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||"",l0=-1<a.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
3
  `+Ie+l+l0}c($t,"describeBuiltInComponentFrame");var Pe=!1;function lc(l,t){if(!l||Pe)return"";Pe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:c(function(){try{if(t){var b=c(function(){throw Error()},"Fake");if(Object.defineProperty(b.prototype,"props",{set:c(function(){throw Error()},"set")}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(g){var S=g}Reflect.construct(l,[],b)}else{try{b.call()}catch(g){S=g}l.call(b.prototype)}}else{try{throw Error()}catch(g){S=g}(b=l())&&typeof b.catch=="function"&&b.catch(function(){})}}catch(g){if(g&&S&&typeof g.stack=="string")return[g.stack,S.stack]}return[null,null]},"DetermineComponentFrameRoot")};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var e=u.DetermineComponentFrameRoot(),f=e[0],i=e[1];if(f&&i){var m=f.split(`
4
4
  `),y=i.split(`