@lunora/studio 1.0.0-alpha.382 → 1.0.0-alpha.384

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 (111) hide show
  1. package/dist/index.d.mts +2 -2
  2. package/dist/index.d.ts +2 -2
  3. package/dist/mount.d.mts +1 -1
  4. package/dist/mount.d.ts +1 -1
  5. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  6. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
  7. package/dist/packem_shared/{app.d-DpxFQ0qO.d.mts → app.d-QqDN78r1.d.mts} +1 -1
  8. package/dist/packem_shared/{app.d-DpxFQ0qO.d.ts → app.d-QqDN78r1.d.ts} +1 -1
  9. package/dist/standalone/{chunk-VX6ZBLXB.js → chunk-2G5OZPH5.js} +1 -1
  10. package/dist/standalone/{chunk-3JLFCEXX.js → chunk-2HJOQZQ5.js} +1 -1
  11. package/dist/standalone/{chunk-LAQNOLYC.js → chunk-2LKJSQKF.js} +1 -1
  12. package/dist/standalone/{chunk-NLRCYQUM.js → chunk-3MU55LYE.js} +1 -1
  13. package/dist/standalone/{chunk-6XU2QUI3.js → chunk-3O5KRHWI.js} +1 -1
  14. package/dist/standalone/{chunk-3CHHMX6A.js → chunk-42U2JUGB.js} +1 -1
  15. package/dist/standalone/{chunk-Z7HICJ3Z.js → chunk-4AGOKKRZ.js} +1 -1
  16. package/dist/standalone/chunk-4JR7B43V.js +1 -0
  17. package/dist/standalone/{chunk-CLZSERWW.js → chunk-4KVCH3A4.js} +1 -1
  18. package/dist/standalone/{chunk-2DDDI4IG.js → chunk-4VF4BIOZ.js} +1 -1
  19. package/dist/standalone/{chunk-QKWIY6JW.js → chunk-54X7HWI6.js} +1 -1
  20. package/dist/standalone/{chunk-75LZZADZ.js → chunk-5LJYJ5SF.js} +1 -1
  21. package/dist/standalone/{chunk-NCDS5OJ4.js → chunk-6U3PB43O.js} +1 -1
  22. package/dist/standalone/{chunk-XEZ7LEII.js → chunk-6WNYDTK5.js} +1 -1
  23. package/dist/standalone/{chunk-S63YTOR5.js → chunk-76CCNRPQ.js} +1 -1
  24. package/dist/standalone/{chunk-NIHVUGDE.js → chunk-7MPWIS3R.js} +1 -1
  25. package/dist/standalone/{chunk-F7SJ4DOF.js → chunk-7QZQZYJT.js} +1 -1
  26. package/dist/standalone/{chunk-DLF6VPZK.js → chunk-7THIXUEZ.js} +1 -1
  27. package/dist/standalone/{chunk-N36AT4CI.js → chunk-B2EUIUL5.js} +1 -1
  28. package/dist/standalone/{chunk-57JJA4FO.js → chunk-B2QIV4WC.js} +1 -1
  29. package/dist/standalone/{chunk-JNB2EV3N.js → chunk-BN6JGS64.js} +1 -1
  30. package/dist/standalone/{chunk-NX6JHCY5.js → chunk-BWS7JUQV.js} +1 -1
  31. package/dist/standalone/{chunk-SOKPPTFJ.js → chunk-BZ6CJVEW.js} +1 -1
  32. package/dist/standalone/{chunk-AMX5BC24.js → chunk-C56YDP56.js} +1 -1
  33. package/dist/standalone/{chunk-A27GQYC7.js → chunk-CJ2V577P.js} +1 -1
  34. package/dist/standalone/{chunk-D57SW6H5.js → chunk-CSDAZN5R.js} +1 -1
  35. package/dist/standalone/chunk-DJNEJ3BZ.js +1 -0
  36. package/dist/standalone/{chunk-KS2ZCKZ2.js → chunk-DVTU6UE5.js} +1 -1
  37. package/dist/standalone/{chunk-2AKEF2E6.js → chunk-DWNWEMQK.js} +1 -1
  38. package/dist/standalone/{chunk-YIVDW4BV.js → chunk-DZZ3N75F.js} +1 -1
  39. package/dist/standalone/{chunk-EFJ5SREG.js → chunk-E6KWXZCK.js} +1 -1
  40. package/dist/standalone/{chunk-JEYIP5MS.js → chunk-EFTLHOFA.js} +1 -1
  41. package/dist/standalone/{chunk-OKDHAG2Y.js → chunk-EZ2K57JT.js} +1 -1
  42. package/dist/standalone/{chunk-QLMDHJMC.js → chunk-FFECJKHB.js} +1 -1
  43. package/dist/standalone/{chunk-PBHKQULL.js → chunk-FJ43BFJ4.js} +1 -1
  44. package/dist/standalone/{chunk-HVKGOO4E.js → chunk-FQRAKX6V.js} +1 -1
  45. package/dist/standalone/{chunk-FNWWGQVC.js → chunk-FUPX23QR.js} +1 -1
  46. package/dist/standalone/{chunk-WD6TOMHJ.js → chunk-G7KYDZGL.js} +1 -1
  47. package/dist/standalone/{chunk-6HVMODID.js → chunk-GX2UAEGW.js} +1 -1
  48. package/dist/standalone/{chunk-G62WODKV.js → chunk-H2ZCM66S.js} +1 -1
  49. package/dist/standalone/{chunk-SGIW3B4R.js → chunk-HB2FLDDU.js} +1 -1
  50. package/dist/standalone/{chunk-4UDH2YI4.js → chunk-HFPX37U7.js} +1 -1
  51. package/dist/standalone/{chunk-OYO74NM4.js → chunk-HJ7QDXCT.js} +1 -1
  52. package/dist/standalone/{chunk-YFZFL4XI.js → chunk-I37NPLQI.js} +1 -1
  53. package/dist/standalone/{chunk-PSPK6BZ2.js → chunk-ILPLYMU4.js} +1 -1
  54. package/dist/standalone/{chunk-3SRQFKDT.js → chunk-IR2MDKXQ.js} +1 -1
  55. package/dist/standalone/{chunk-SOTNC2VE.js → chunk-ISTQIPTN.js} +1 -1
  56. package/dist/standalone/{chunk-D3YEERHT.js → chunk-IUUXVNAP.js} +1 -1
  57. package/dist/standalone/{chunk-7MM2SI65.js → chunk-J3ZEO3PJ.js} +1 -1
  58. package/dist/standalone/{chunk-GWJ57WD2.js → chunk-KCSVWLPM.js} +1 -1
  59. package/dist/standalone/{chunk-3CUQWI5A.js → chunk-KE7ZGUGO.js} +1 -1
  60. package/dist/standalone/{chunk-HFDKQBIZ.js → chunk-KSATOQ6G.js} +1 -1
  61. package/dist/standalone/{chunk-CAEQ6OOD.js → chunk-L34AGC7Z.js} +1 -1
  62. package/dist/standalone/{chunk-WHIWJD5H.js → chunk-LLSKRNQ5.js} +1 -1
  63. package/dist/standalone/{chunk-I4EVK4EW.js → chunk-LQJQDJNH.js} +1 -1
  64. package/dist/standalone/{chunk-3CDQYHJX.js → chunk-LVU6W6MM.js} +1 -1
  65. package/dist/standalone/{chunk-RQHLJCG7.js → chunk-MBCU5GIY.js} +1 -1
  66. package/dist/standalone/{chunk-4EZ3YMBU.js → chunk-MCDKIVLH.js} +1 -1
  67. package/dist/standalone/{chunk-WUK2O2KI.js → chunk-MIDNWFNN.js} +1 -1
  68. package/dist/standalone/{chunk-JI4WZ5K5.js → chunk-MMLEHOX7.js} +1 -1
  69. package/dist/standalone/{chunk-QQ4LEH7V.js → chunk-MMRSSV2C.js} +1 -1
  70. package/dist/standalone/{chunk-QTG3KGNJ.js → chunk-MVRBX7HB.js} +1 -1
  71. package/dist/standalone/{chunk-EG45XFL3.js → chunk-NVMQPIRS.js} +1 -1
  72. package/dist/standalone/{chunk-2YQF4QCI.js → chunk-O2HPBDEC.js} +1 -1
  73. package/dist/standalone/{chunk-ZBXY4FVL.js → chunk-O4BQMWIN.js} +1 -1
  74. package/dist/standalone/{chunk-GTW3JPQQ.js → chunk-OKZINWBB.js} +1 -1
  75. package/dist/standalone/{chunk-EI2FSTI3.js → chunk-PAFHBQFL.js} +1 -1
  76. package/dist/standalone/{chunk-ITS5LMYJ.js → chunk-PN7JHEYW.js} +1 -1
  77. package/dist/standalone/{chunk-RY6I3E2K.js → chunk-PSBRO6JX.js} +1 -1
  78. package/dist/standalone/{chunk-PFIATRRO.js → chunk-QAETUNZX.js} +1 -1
  79. package/dist/standalone/{chunk-TY5MXKUY.js → chunk-QK4NIT57.js} +1 -1
  80. package/dist/standalone/{chunk-QT3W5POL.js → chunk-R6ZR7FZZ.js} +1 -1
  81. package/dist/standalone/{chunk-GMKV6EAQ.js → chunk-RAJO2KOX.js} +1 -1
  82. package/dist/standalone/{chunk-RWEEBORY.js → chunk-RDYGUTWW.js} +1 -1
  83. package/dist/standalone/{chunk-FOXLEMWC.js → chunk-S3TDGFRE.js} +1 -1
  84. package/dist/standalone/{chunk-CHYLD556.js → chunk-S7NFUY75.js} +1 -1
  85. package/dist/standalone/{chunk-M2X2UFAA.js → chunk-SM3PFHGD.js} +1 -1
  86. package/dist/standalone/{chunk-CNPADLAP.js → chunk-SNJ3ZOV2.js} +1 -1
  87. package/dist/standalone/{chunk-RRDXY56O.js → chunk-SRNRWSMY.js} +1 -1
  88. package/dist/standalone/{chunk-L645XKP6.js → chunk-SSFKYC7M.js} +1 -1
  89. package/dist/standalone/{chunk-4NRWZ3IK.js → chunk-SYOJ4TRA.js} +1 -1
  90. package/dist/standalone/{chunk-3DIKPPNZ.js → chunk-THRRRMIZ.js} +1 -1
  91. package/dist/standalone/{chunk-QQENKHRS.js → chunk-TN4Z3P6S.js} +1 -1
  92. package/dist/standalone/{chunk-I4AZTCAA.js → chunk-U5YP7MSK.js} +1 -1
  93. package/dist/standalone/{chunk-ROHVLVGW.js → chunk-UDBPUH63.js} +1 -1
  94. package/dist/standalone/chunk-UK5OOCLQ.js +7 -0
  95. package/dist/standalone/{chunk-26XOFIV4.js → chunk-UV6GPH2E.js} +1 -1
  96. package/dist/standalone/{chunk-KB75JASP.js → chunk-V6JMOE7W.js} +1 -1
  97. package/dist/standalone/{chunk-S3LW4HCF.js → chunk-V7W37FDL.js} +1 -1
  98. package/dist/standalone/chunk-VEKOLZ4X.js +1 -0
  99. package/dist/standalone/{chunk-MSW4QPCU.js → chunk-VLAEMGPY.js} +1 -1
  100. package/dist/standalone/{chunk-TMIYU26C.js → chunk-WSYQMHC4.js} +1 -1
  101. package/dist/standalone/{chunk-VTAHI7AZ.js → chunk-WXV3KCFJ.js} +1 -1
  102. package/dist/standalone/{chunk-2BX4MJK6.js → chunk-XD5CKMBE.js} +1 -1
  103. package/dist/standalone/{chunk-JR66YIA4.js → chunk-XWEMSCUN.js} +1 -1
  104. package/dist/standalone/{chunk-73WXN7SZ.js → chunk-YGSVIF7L.js} +1 -1
  105. package/dist/standalone/{chunk-CCJUOPWR.js → chunk-ZYQQJ5FK.js} +1 -1
  106. package/dist/standalone/studio.js +1 -1
  107. package/package.json +2 -2
  108. package/dist/standalone/chunk-7VZFX5O4.js +0 -1
  109. package/dist/standalone/chunk-AE4LQOKG.js +0 -1
  110. package/dist/standalone/chunk-F4ZN2DRL.js +0 -7
  111. package/dist/standalone/chunk-KNZGU3CE.js +0 -1
@@ -1 +1 @@
1
- import{a as Pt,b as Qt,c as ot}from"./chunk-FWM5Z6CH.js";import{a as de}from"./chunk-4UDH2YI4.js";import{a as Et,b as Ot,c as Dt,d as Ft}from"./chunk-RIAOZECW.js";import{a as it}from"./chunk-RWEEBORY.js";import{a as rt,b as at,c as st,d as At,e as zt,f as lt,g as nt,h as Kt,i as Lt}from"./chunk-ROHVLVGW.js";import{c as Rt}from"./chunk-LJLNIVUA.js";import{a as $t}from"./chunk-RRDXY56O.js";import"./chunk-QLZGKBOW.js";import{e as _t}from"./chunk-R6NJ4ER6.js";import{a as kt,b as Ct,c as Mt,d as It,e as Qe}from"./chunk-QKWIY6JW.js";import"./chunk-T7UKRA6J.js";import{a as qt}from"./chunk-LAQNOLYC.js";import"./chunk-Y2YLTUMD.js";import"./chunk-QF743FSL.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import"./chunk-R3RIZDUS.js";import{a as wt}from"./chunk-2KTN53PK.js";import{a as St}from"./chunk-EI2FSTI3.js";import{a as yt,b as Nt}from"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import"./chunk-GTW3JPQQ.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as Ye}from"./chunk-EG45XFL3.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as vt}from"./chunk-FOXLEMWC.js";import{b as Je}from"./chunk-26XOFIV4.js";import"./chunk-L27FKJTG.js";import{a as Ze,b as et,c as tt,d as Pe,e as oe,f as B}from"./chunk-7MM2SI65.js";import"./chunk-EOFWXI3T.js";import{a as Ee}from"./chunk-LYVYUTQY.js";import{c as Oe}from"./chunk-3CUQWI5A.js";import{a as fe,b as De,c as Fe,d as bt,e as xe}from"./chunk-QQENKHRS.js";import{a as ct,n as ft}from"./chunk-F4ZN2DRL.js";import"./chunk-ZPQBVYNN.js";import{B as he,h as mt,i as ut,j as ht,k as gt,o as Ge,s as pt,x as xt}from"./chunk-ITS5LMYJ.js";import"./chunk-PDBW6GTJ.js";import{a as Ht}from"./chunk-A6TVTNKO.js";import{a as Ut,b as Gt}from"./chunk-ADABTCDI.js";import{a as b,d as Xe}from"./chunk-5PEAXTYQ.js";var me=Xe(Ht(),1),Q=Xe(Ut(),1);var t=Xe(Gt(),1);var Bt=b((l,e,s)=>`${l}:${e}:${ct(s??{})}`,"ut"),Tt=b((l,e)=>l==="gauge"?e.last:l==="histogram"?e.sum/Math.max(1,e.count):e.sum,"ht"),Jt=b((l,e)=>Tt(l,e),"jt"),Vt=b(l=>Tt(l.kind,l),"Gt"),dt=b(l=>Number.isInteger(l)?l.toLocaleString():l.toLocaleString(void 0,{maximumFractionDigits:2}),"Ye"),Wt=b(l=>Array.isArray(l?.series)?l.series:[],"Yt"),Xt="FUNCTION_NOT_FOUND",Yt=b(l=>{let e=new Map;if(!Array.isArray(l?.series))return e;for(let s of l.series)e.set(Bt(s.kind,s.name,s.attributes),s.points);return e},"Wt"),Zt={counter:"secondary",gauge:"default",histogram:"outline"},er=b(l=>{let e=(0,me.c)(18),{name:s,onOpenTrace:a,traceId:r}=l,o=he();if(r===void 0){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=c):c=e[0],c}let i;e[1]!==r?(i=r.slice(0,8),e[1]=r,e[2]=i):i=e[2];let n=i;if(a===void 0){let c=`mt-instrument-trace-${s}`,d;return e[3]!==n||e[4]!==c||e[5]!==r?(d=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":c,title:r,children:n}),e[3]=n,e[4]=c,e[5]=r,e[6]=d):d=e[6],d}let m=`mt-instrument-trace-${s}`,p;e[7]!==a||e[8]!==r?(p=b(()=>{a(r)},"p"),e[7]=a,e[8]=r,e[9]=p):p=e[9];let h;e[10]!==o||e[11]!==r?(h=o("Open the exemplar trace {trace}",{trace:r}),e[10]=o,e[11]=r,e[12]=h):h=e[12];let u;return e[13]!==n||e[14]!==m||e[15]!==p||e[16]!==h?(u=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":m,onClick:p,title:h,type:"button",children:n}),e[13]=n,e[14]=m,e[15]=p,e[16]=h,e[17]=u):u=e[17],u},"Zt"),tr=b(l=>{let e=(0,me.c)(105),{onOpenTrace:s,shardKey:a}=l,r=he(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==a?(i={live:!0,shardKey:a},e[1]=a,e[2]=i):i=e[2];let{data:n,error:m,errorSource:p}=Oe(Ee.getMetricSeries,o,i),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let u;e[4]!==a?(u={live:!0,shardKey:a},e[4]=a,e[5]=u):u=e[5];let{data:c}=Oe(Ee.getMetricHistory,h,u),d,f,g,v,x,S,y,w,I,k,N,z,_;if(e[6]!==n||e[7]!==m||e[8]!==p||e[9]!==c||e[10]!==s||e[11]!==r){w=Symbol.for("react.early_return_sentinel");e:{let L=Wt(n),E=gt(p)===Xt;if(m!==null&&!E){let q;e[25]!==r?(q=r("Instruments"),e[25]=r,e[26]=q):q=e[26];let D;e[27]!==q?(D=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:q}),e[27]=q,e[28]=D):D=e[28];let F;e[29]!==m||e[30]!==r?(F=r("Instruments unavailable: {error}",{error:m}),e[29]=m,e[30]=r,e[31]=F):F=e[31];let P;e[32]!==F?(P=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:F}),e[32]=F,e[33]=P):P=e[33];let ie;e[34]!==D||e[35]!==P?(ie=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[D,P]}),e[34]=D,e[35]=P,e[36]=ie):ie=e[36],w=ie;break e}if(L.length===0){w=null;break e}let O=Yt(c),ue;e[37]!==r?(ue=b(q=>r(q==="counter"?"Counter":q==="gauge"?"Gauge":"Histogram"),"de"),e[37]=r,e[38]=ue):ue=e[38];let ge=ue;x="flex flex-col gap-2",S="mt-instruments";let T;e[39]!==r?(T=r("Instruments"),e[39]=r,e[40]=T):T=e[40],e[41]!==T?(y=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:T}),e[41]=T,e[42]=y):y=e[42],v=fe,_="overflow-hidden py-0",g=xe,z="px-0",f=Ze,k="mt-instruments-table";let U;e[43]!==r?(U=r("name"),e[43]=r,e[44]=U):U=e[44];let H;e[45]!==U?(H=(0,t.jsx)(oe,{children:U}),e[45]=U,e[46]=H):H=e[46];let G;e[47]!==r?(G=r("kind"),e[47]=r,e[48]=G):G=e[48];let J;e[49]!==G?(J=(0,t.jsx)(oe,{children:G}),e[49]=G,e[50]=J):J=e[50];let V;e[51]!==r?(V=r("value"),e[51]=r,e[52]=V):V=e[52];let W;e[53]!==V?(W=(0,t.jsx)(oe,{className:"text-right",children:V}),e[53]=V,e[54]=W):W=e[54];let X;e[55]!==r?(X=r("count"),e[55]=r,e[56]=X):X=e[56];let Y;e[57]!==X?(Y=(0,t.jsx)(oe,{className:"text-right",children:X}),e[57]=X,e[58]=Y):Y=e[58];let Z;e[59]!==r?(Z=r("range"),e[59]=r,e[60]=Z):Z=e[60];let ee;e[61]!==Z?(ee=(0,t.jsx)(oe,{className:"text-right",children:Z}),e[61]=Z,e[62]=ee):ee=e[62];let te;e[63]!==r?(te=r("trend"),e[63]=r,e[64]=te):te=e[64];let re;e[65]!==te?(re=(0,t.jsx)(oe,{children:te}),e[65]=te,e[66]=re):re=e[66];let ae;e[67]!==r?(ae=r("trace"),e[67]=r,e[68]=ae):ae=e[68];let se;e[69]!==ae?(se=(0,t.jsx)(oe,{children:ae}),e[69]=ae,e[70]=se):se=e[70];let le;e[71]!==r?(le=r("dimensions"),e[71]=r,e[72]=le):le=e[72];let ne;e[73]!==le?(ne=(0,t.jsx)(oe,{children:le}),e[73]=le,e[74]=ne):ne=e[74],e[75]!==H||e[76]!==J||e[77]!==W||e[78]!==Y||e[79]!==ee||e[80]!==re||e[81]!==se||e[82]!==ne?(N=(0,t.jsx)(et,{children:(0,t.jsxs)(Pe,{children:[H,J,W,Y,ee,re,se,ne]})}),e[75]=H,e[76]=J,e[77]=W,e[78]=Y,e[79]=ee,e[80]=re,e[81]=se,e[82]=ne,e[83]=N):N=e[83],d=tt,I=L.map(q=>{let D=Rt(q.attributes),F=Bt(q.kind,q.name,q.attributes),P=(O.get(F)??[]).map(ie=>Jt(q.kind,ie));return(0,t.jsxs)(Pe,{"data-testid":`mt-instrument-${q.name}`,children:[(0,t.jsx)(B,{className:"font-mono text-xs",title:q.functionPath,children:q.name}),(0,t.jsx)(B,{children:(0,t.jsx)(Je,{variant:Zt[q.kind],children:ge(q.kind)})}),(0,t.jsx)(B,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${q.name}`,children:dt(Vt(q))}),(0,t.jsx)(B,{className:"text-right tabular-nums text-muted-foreground",children:q.count.toLocaleString()}),(0,t.jsx)(B,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:q.min===q.max?"\u2014":`${dt(q.min)}\u2013${dt(q.max)}`}),(0,t.jsx)(B,{children:P.length>=2?(0,t.jsx)(it,{ariaLabel:r("{name} trend",{name:q.name}),className:"h-6 w-24 text-foreground",series:P,testId:`mt-instrument-trend-${q.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(B,{className:"font-mono text-xs",children:(0,t.jsx)(er,{name:q.name,onOpenTrace:s,traceId:q.exemplarTraceId})}),(0,t.jsx)(B,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:D,children:D===""?"\u2014":D})]},F)})}e[6]=n,e[7]=m,e[8]=p,e[9]=c,e[10]=s,e[11]=r,e[12]=d,e[13]=f,e[14]=g,e[15]=v,e[16]=x,e[17]=S,e[18]=y,e[19]=w,e[20]=I,e[21]=k,e[22]=N,e[23]=z,e[24]=_}else d=e[12],f=e[13],g=e[14],v=e[15],x=e[16],S=e[17],y=e[18],w=e[19],I=e[20],k=e[21],N=e[22],z=e[23],_=e[24];if(w!==Symbol.for("react.early_return_sentinel"))return w;let C;e[84]!==d||e[85]!==I?(C=(0,t.jsx)(d,{children:I}),e[84]=d,e[85]=I,e[86]=C):C=e[86];let R;e[87]!==f||e[88]!==C||e[89]!==k||e[90]!==N?(R=(0,t.jsxs)(f,{"data-testid":k,children:[N,C]}),e[87]=f,e[88]=C,e[89]=k,e[90]=N,e[91]=R):R=e[91];let M;e[92]!==g||e[93]!==R||e[94]!==z?(M=(0,t.jsx)(g,{className:z,children:R}),e[92]=g,e[93]=R,e[94]=z,e[95]=M):M=e[95];let $;e[96]!==v||e[97]!==M||e[98]!==_?($=(0,t.jsx)(v,{className:_,children:M}),e[96]=v,e[97]=M,e[98]=_,e[99]=$):$=e[99];let A;return e[100]!==x||e[101]!==S||e[102]!==y||e[103]!==$?(A=(0,t.jsxs)("section",{className:x,"data-testid":S,children:[y,$]}),e[100]=x,e[101]=S,e[102]=y,e[103]=$,e[104]=A):A=e[104],A},"es"),rr=b(l=>{let e=(0,me.c)(74),{aggregate:s,shardResults:a}=l,r=he(),o;e[0]!==r?(o=r("Shards"),e[0]=r,e[1]=o):o=e[1];let i;e[2]!==s.failed||e[3]!==s.reachable||e[4]!==r?(i=s.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:s.failed,reachable:s.reachable}):r("{reachable} reachable",{reachable:s.reachable}),e[2]=s.failed,e[3]=s.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==o||e[7]!==i?(n=(0,t.jsx)(de,{label:o,testId:"mt-agg-shards",value:i}),e[6]=o,e[7]=i,e[8]=n):n=e[8];let m;e[9]!==r?(m=r("Total requests"),e[9]=r,e[10]=m):m=e[10];let p;e[11]!==s.totalRequests||e[12]!==m?(p=(0,t.jsx)(de,{label:m,testId:"mt-agg-requests",value:s.totalRequests}),e[11]=s.totalRequests,e[12]=m,e[13]=p):p=e[13];let h;e[14]!==r?(h=r("Total errors"),e[14]=r,e[15]=h):h=e[15];let u;e[16]!==s.totalErrors||e[17]!==h?(u=(0,t.jsx)(de,{label:h,testId:"mt-agg-errors",value:s.totalErrors}),e[16]=s.totalErrors,e[17]=h,e[18]=u):u=e[18];let c;e[19]!==r?(c=r("Total database size"),e[19]=r,e[20]=c):c=e[20];let d;e[21]!==s.totalDatabaseSize?(d=Ge(s.totalDatabaseSize),e[21]=s.totalDatabaseSize,e[22]=d):d=e[22];let f;e[23]!==c||e[24]!==d?(f=(0,t.jsx)(de,{label:c,testId:"mt-agg-db-size",value:d}),e[23]=c,e[24]=d,e[25]=f):f=e[25];let g;e[26]!==r?(g=r("Combined cache hit rate"),e[26]=r,e[27]=g):g=e[27];let v;e[28]!==s.hitRate||e[29]!==r?(v=s.hitRate===null?r("no cache configured"):`${(s.hitRate*100).toFixed(1)}%`,e[28]=s.hitRate,e[29]=r,e[30]=v):v=e[30];let x;e[31]!==g||e[32]!==v?(x=(0,t.jsx)(de,{label:g,testId:"mt-agg-cache",value:v}),e[31]=g,e[32]=v,e[33]=x):x=e[33];let S;e[34]!==f||e[35]!==x||e[36]!==n||e[37]!==p||e[38]!==u?(S=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,p,u,f,x]}),e[34]=f,e[35]=x,e[36]=n,e[37]=p,e[38]=u,e[39]=S):S=e[39];let y;e[40]!==r?(y=r("shard"),e[40]=r,e[41]=y):y=e[41];let w;e[42]!==y?(w=(0,t.jsx)(oe,{children:y}),e[42]=y,e[43]=w):w=e[43];let I;e[44]!==r?(I=r("requests"),e[44]=r,e[45]=I):I=e[45];let k;e[46]!==I?(k=(0,t.jsx)(oe,{children:I}),e[46]=I,e[47]=k):k=e[47];let N;e[48]!==r?(N=r("errors"),e[48]=r,e[49]=N):N=e[49];let z;e[50]!==N?(z=(0,t.jsx)(oe,{children:N}),e[50]=N,e[51]=z):z=e[51];let _;e[52]!==r?(_=r("db size"),e[52]=r,e[53]=_):_=e[53];let C;e[54]!==_?(C=(0,t.jsx)(oe,{children:_}),e[54]=_,e[55]=C):C=e[55];let R;e[56]!==w||e[57]!==k||e[58]!==z||e[59]!==C?(R=(0,t.jsx)(et,{children:(0,t.jsxs)(Pe,{children:[w,k,z,C]})}),e[56]=w,e[57]=k,e[58]=z,e[59]=C,e[60]=R):R=e[60];let M;if(e[61]!==a||e[62]!==r){let E;e[64]!==r?(E=b(O=>(0,t.jsxs)(Pe,{"data-testid":`mt-agg-row-${O.shard}`,children:[(0,t.jsx)(B,{children:O.shard}),O.metrics===null?(0,t.jsx)(B,{className:"text-destructive",colSpan:3,children:O.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{className:"tabular-nums",children:O.metrics.requests}),(0,t.jsx)(B,{className:"tabular-nums",children:O.metrics.errors}),(0,t.jsx)(B,{className:"tabular-nums",children:Ge(O.metrics.databaseSize)})]})]},O.shard),"L"),e[64]=r,e[65]=E):E=e[65],M=a.map(E),e[61]=a,e[62]=r,e[63]=M}else M=e[63];let $;e[66]!==M?($=(0,t.jsx)(tt,{children:M}),e[66]=M,e[67]=$):$=e[67];let A;e[68]!==R||e[69]!==$?(A=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(xe,{className:"px-0",children:(0,t.jsxs)(Ze,{"data-testid":"mt-agg-table",children:[R,$]})})}),e[68]=R,e[69]=$,e[70]=A):A=e[70];let L;return e[71]!==S||e[72]!==A?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[S,A]}),e[71]=S,e[72]=A,e[73]=L):L=e[73],L},"ts"),ar=b(l=>{let e=(0,me.c)(75),{currentDelta:s,errorRate:a,history:r,latencyPercentiles:o,metrics:i}=l,n=he(),{cache:m}=i,p;e[0]!==r||e[1]!==n?(p=r.length>=2?(0,t.jsx)(it,{ariaLabel:n("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=n,e[2]=p):p=e[2];let h;e[3]!==s||e[4]!==r.length||e[5]!==n?(h=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${s.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=s,e[4]=r.length,e[5]=n,e[6]=h):h=e[6];let u;e[7]!==n?(u=n("Requests"),e[7]=n,e[8]=u):u=e[8];let c;e[9]!==i.requests||e[10]!==p||e[11]!==h||e[12]!==u?(c=(0,t.jsx)(de,{chart:p,footer:h,label:u,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=p,e[11]=h,e[12]=u,e[13]=c):c=e[13];let d;e[14]!==a||e[15]!==n?(d=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=d):d=e[16];let f;e[17]!==n?(f=n("Errors"),e[17]=n,e[18]=f):f=e[18];let g;e[19]!==a||e[20]!==i.errors?(g=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=g):g=e[21];let v;e[22]!==d||e[23]!==f||e[24]!==g?(v=(0,t.jsx)(de,{footer:d,label:f,testId:"mt-errors",value:g}),e[22]=d,e[23]=f,e[24]=g,e[25]=v):v=e[25];let x;e[26]!==o.p90?(x=o.p90>0?`P90 ${ot(o.p90)}`:void 0,e[26]=o.p90,e[27]=x):x=e[27];let S;e[28]!==n?(S=n("P95 latency"),e[28]=n,e[29]=S):S=e[29];let y;e[30]!==o.p95?(y=o.p95>0?ot(o.p95):"\u2014",e[30]=o.p95,e[31]=y):y=e[31];let w;e[32]!==S||e[33]!==y||e[34]!==x?(w=(0,t.jsx)(de,{footer:x,label:S,testId:"mt-p95",value:y}),e[32]=S,e[33]=y,e[34]=x,e[35]=w):w=e[35];let I;e[36]!==m||e[37]!==n?(I=m?`${m.entries.toLocaleString()} ${n("cache entries")}`:void 0,e[36]=m,e[37]=n,e[38]=I):I=e[38];let k;e[39]!==n?(k=n("Database size"),e[39]=n,e[40]=k):k=e[40];let N;e[41]!==i.databaseSize?(N=Ge(i.databaseSize),e[41]=i.databaseSize,e[42]=N):N=e[42];let z;e[43]!==I||e[44]!==k||e[45]!==N?(z=(0,t.jsx)(de,{footer:I,label:k,testId:"mt-db-size",value:N}),e[43]=I,e[44]=k,e[45]=N,e[46]=z):z=e[46];let _;e[47]!==n?(_=n("Shard"),e[47]=n,e[48]=_):_=e[48];let C;e[49]!==i.shard||e[50]!==_?(C=(0,t.jsx)(de,{label:_,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=_,e[51]=C):C=e[51];let R;e[52]!==n?(R=n("Uptime"),e[52]=n,e[53]=R):R=e[53];let M;e[54]!==i.uptimeMs?(M=Pt(i.uptimeMs),e[54]=i.uptimeMs,e[55]=M):M=e[55];let $;e[56]!==R||e[57]!==M?($=(0,t.jsx)(de,{label:R,testId:"mt-uptime",value:M}),e[56]=R,e[57]=M,e[58]=$):$=e[58];let A;e[59]!==n?(A=n("Cache hit rate"),e[59]=n,e[60]=A):A=e[60];let L;e[61]!==m||e[62]!==n?(L=m?n("{rate} ({count} entries)",{count:m.entries,rate:Qt(m.hits,m.misses)}):n("no cache configured"),e[61]=m,e[62]=n,e[63]=L):L=e[63];let E;e[64]!==A||e[65]!==L?(E=(0,t.jsx)(de,{label:A,testId:"mt-cache",value:L}),e[64]=A,e[65]=L,e[66]=E):E=e[66];let O;return e[67]!==w||e[68]!==z||e[69]!==C||e[70]!==$||e[71]!==E||e[72]!==c||e[73]!==v?(O=(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:[c,v,w,z,C,$,E]}),e[67]=w,e[68]=z,e[69]=C,e[70]=$,e[71]=E,e[72]=c,e[73]=v,e[74]=O):O=e[74],O},"ss"),We=b(l=>l>=100?"critical":l>=50?"warning":"good","Ge"),je=b(l=>l<1?`${(l*1e3).toFixed(0)}\u03BCs`:l<1e3?`${l.toFixed(1)}ms`:`${(l/1e3).toFixed(2)}s`,"Le"),Ve=b(l=>l>=1e9?`${(l/1e9).toFixed(1)}B`:l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:l.toLocaleString(),"Ue"),sr=b(l=>{let e=(0,me.c)(3),{level:s}=l;if(s==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Je,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(s==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=(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]=r):r=e[1],r}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(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]=a):a=e[2],a},"rs"),lr=b((l,e)=>{let s=[...l];return s.sort((a,r)=>{switch(e){case"avgTime":return r.avgDurationMs-a.avgDurationMs;case"execCount":return r.execCount-a.execCount;case"rowsRead":return r.rowsRead-a.rowsRead;default:return r.totalDurationMs-a.totalDurationMs}}),s},"ls"),nr=b(l=>{let e=(0,me.c)(161),{queryStats:s}=l,a=he(),[r,o]=(0,Q.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,m]=(0,Q.useState)(i),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=b(_=>{_!==null&&o(_)},"p"),e[1]=p):p=e[1];let h=p,u,c,d,f,g,v,x,S,y,w;if(e[2]!==n||e[3]!==s||e[4]!==r||e[5]!==a){d=Symbol.for("react.early_return_sentinel");e:{let _=lr(s,r),C;e[16]!==s?(C=s.filter(ir),e[16]=s,e[17]=C):C=e[17];let R=C.length,M;e[18]!==s?(M=s.filter(or),e[18]=s,e[19]=M):M=e[19];let $=M.length,A;e[20]!==s?(A=s.filter(dr),e[20]=s,e[21]=A):A=e[21];let L=A.length,E;e[22]===Symbol.for("react.memo_cache_sentinel")?(E=b(K=>{m(ce=>{let j=new Set(ce);return j.has(K)?j.delete(K):j.add(K),j})},"L"),e[22]=E):E=e[22];let O=E;if(s.length===0){let K;e[23]!==a?(K=a("No query insights yet"),e[23]=a,e[24]=K):K=e[24];let ce;e[25]!==K?(ce=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:K}),e[25]=K,e[26]=ce):ce=e[26];let j;e[27]!==a?(j=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=j):j=e[28];let pe;e[29]!==j?(pe=(0,t.jsx)("p",{className:"mt-1 text-sm",children:j}),e[29]=j,e[30]=pe):pe=e[30];let He;e[31]!==ce||e[32]!==pe?(He=(0,t.jsx)(fe,{children:(0,t.jsx)(xe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ce,pe]})})}),e[31]=ce,e[32]=pe,e[33]=He):He=e[33],d=He;break e}x="space-y-4",S="qi-root";let ue;e[34]!==a?(ue=a("Critical queries"),e[34]=a,e[35]=ue):ue=e[35];let ge;e[36]!==ue?(ge=(0,t.jsx)(De,{className:"pb-2",children:(0,t.jsx)(Fe,{className:"text-sm font-medium",children:ue})}),e[36]=ue,e[37]=ge):ge=e[37];let T;e[38]!==R?(T=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:R}),e[38]=R,e[39]=T):T=e[39];let U;e[40]!==a?(U=a(">100ms avg execution"),e[40]=a,e[41]=U):U=e[41];let H;e[42]!==U?(H=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:U}),e[42]=U,e[43]=H):H=e[43];let G;e[44]!==T||e[45]!==H?(G=(0,t.jsxs)(xe,{children:[T,H]}),e[44]=T,e[45]=H,e[46]=G):G=e[46];let J;e[47]!==ge||e[48]!==G?(J=(0,t.jsxs)(fe,{children:[ge,G]}),e[47]=ge,e[48]=G,e[49]=J):J=e[49];let V;e[50]!==a?(V=a("Moderate queries"),e[50]=a,e[51]=V):V=e[51];let W;e[52]!==V?(W=(0,t.jsx)(De,{className:"pb-2",children:(0,t.jsx)(Fe,{className:"text-sm font-medium",children:V})}),e[52]=V,e[53]=W):W=e[53];let X;e[54]!==$?(X=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:$}),e[54]=$,e[55]=X):X=e[55];let Y;e[56]!==a?(Y=a("50\u2013100ms avg execution"),e[56]=a,e[57]=Y):Y=e[57];let Z;e[58]!==Y?(Z=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:Y}),e[58]=Y,e[59]=Z):Z=e[59];let ee;e[60]!==X||e[61]!==Z?(ee=(0,t.jsxs)(xe,{children:[X,Z]}),e[60]=X,e[61]=Z,e[62]=ee):ee=e[62];let te;e[63]!==W||e[64]!==ee?(te=(0,t.jsxs)(fe,{children:[W,ee]}),e[63]=W,e[64]=ee,e[65]=te):te=e[65];let re;e[66]!==a?(re=a("Fast queries"),e[66]=a,e[67]=re):re=e[67];let ae;e[68]!==re?(ae=(0,t.jsx)(De,{className:"pb-2",children:(0,t.jsx)(Fe,{className:"text-sm font-medium",children:re})}),e[68]=re,e[69]=ae):ae=e[69];let se;e[70]!==L?(se=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:L}),e[70]=L,e[71]=se):se=e[71];let le;e[72]!==a?(le=a("<50ms avg execution"),e[72]=a,e[73]=le):le=e[73];let ne;e[74]!==le?(ne=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:le}),e[74]=le,e[75]=ne):ne=e[75];let q;e[76]!==se||e[77]!==ne?(q=(0,t.jsxs)(xe,{children:[se,ne]}),e[76]=se,e[77]=ne,e[78]=q):q=e[78];let D;e[79]!==ae||e[80]!==q?(D=(0,t.jsxs)(fe,{children:[ae,q]}),e[79]=ae,e[80]=q,e[81]=D):D=e[81],e[82]!==J||e[83]!==te||e[84]!==D?(y=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[J,te,D]}),e[82]=J,e[83]=te,e[84]=D,e[85]=y):y=e[85];let F;e[86]!==a?(F=a("Query leaderboard"),e[86]=a,e[87]=F):F=e[87];let P;e[88]!==F?(P=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:F}),e[88]=F,e[89]=P):P=e[89];let ie;e[90]!==r||e[91]!==a?(ie=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=ie):ie=e[92];let be;e[93]!==ie?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:ie}),e[93]=ie,e[94]=be):be=e[94];let ve;e[95]!==P||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[P,be]}),e[95]=P,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Be;e[104]===Symbol.for("react.memo_cache_sentinel")?(Be=(0,t.jsx)(Ct,{}),e[104]=Be):Be=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Mt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Be}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let _e;e[109]!==qe?(_e=(0,t.jsx)(Qe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=_e):_e=e[110];let ke;e[111]!==a?(ke=a("Avg time"),e[111]=a,e[112]=ke):ke=e[112];let Ce;e[113]!==ke?(Ce=(0,t.jsx)(Qe,{value:"avgTime",children:ke}),e[113]=ke,e[114]=Ce):Ce=e[114];let Me;e[115]!==a?(Me=a("Execution count"),e[115]=a,e[116]=Me):Me=e[116];let Ie;e[117]!==Me?(Ie=(0,t.jsx)(Qe,{value:"execCount",children:Me}),e[117]=Me,e[118]=Ie):Ie=e[118];let Re;e[119]!==a?(Re=a("Rows read"),e[119]=a,e[120]=Re):Re=e[120];let $e;e[121]!==Re?($e=(0,t.jsx)(Qe,{value:"rowsRead",children:Re}),e[121]=Re,e[122]=$e):$e=e[122];let Ae;e[123]!==_e||e[124]!==Ce||e[125]!==Ie||e[126]!==$e?(Ae=(0,t.jsxs)(It,{children:[_e,Ce,Ie,$e]}),e[123]=_e,e[124]=Ce,e[125]=Ie,e[126]=$e,e[127]=Ae):Ae=e[127];let ze;e[128]!==r||e[129]!==we||e[130]!==Ae?(ze=(0,t.jsxs)(kt,{onValueChange:h,value:r,children:[we,Ae]}),e[128]=r,e[129]=we,e[130]=Ae,e[131]=ze):ze=e[131];let Ke;e[132]!==Ne||e[133]!==ze?(Ke=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,ze]}),e[132]=Ne,e[133]=ze,e[134]=Ke):Ke=e[134],e[135]!==ve||e[136]!==Ke?(w=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,Ke]}),e[135]=ve,e[136]=Ke,e[137]=w):w=e[137],c=fe;let Le;e[138]!==a?(Le=a("Statements"),e[138]=a,e[139]=Le):Le=e[139];let Te;e[140]!==Le?(Te=(0,t.jsx)(Fe,{children:Le}),e[140]=Le,e[141]=Te):Te=e[141],v=(0,t.jsxs)(De,{children:[Te,(0,t.jsx)(bt,{children:a("{count} tracked statements",{count:_.length})})]}),u=xe,f="space-y-2";let Ue;e[142]!==n||e[143]!==a?(Ue=b(K=>{let ce=K.normalizedSql,j=n.has(ce),pe=We(K.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":j,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:b(()=>{O(ce)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(sr,{level:pe}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:K.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:je(K.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(K.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),K.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(K.p95DurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("p95")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ve(K.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),j&&(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:a("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:K.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[K.p50DurationMs!==void 0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("p50")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:je(K.p50DurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(K.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:je(K.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(K.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(K.rowsWritten)})]})]})]})]},ce)},"Ke"),e[142]=n,e[143]=a,e[144]=Ue):Ue=e[144],g=_.map(Ue)}e[2]=n,e[3]=s,e[4]=r,e[5]=a,e[6]=u,e[7]=c,e[8]=d,e[9]=f,e[10]=g,e[11]=v,e[12]=x,e[13]=S,e[14]=y,e[15]=w}else u=e[6],c=e[7],d=e[8],f=e[9],g=e[10],v=e[11],x=e[12],S=e[13],y=e[14],w=e[15];if(d!==Symbol.for("react.early_return_sentinel"))return d;let I;e[145]!==f||e[146]!==g?(I=(0,t.jsx)("div",{className:f,children:g}),e[145]=f,e[146]=g,e[147]=I):I=e[147];let k;e[148]!==u||e[149]!==I?(k=(0,t.jsx)(u,{children:I}),e[148]=u,e[149]=I,e[150]=k):k=e[150];let N;e[151]!==c||e[152]!==k||e[153]!==v?(N=(0,t.jsxs)(c,{children:[v,k]}),e[151]=c,e[152]=k,e[153]=v,e[154]=N):N=e[154];let z;return e[155]!==N||e[156]!==x||e[157]!==S||e[158]!==y||e[159]!==w?(z=(0,t.jsxs)("div",{className:x,"data-testid":S,children:[y,w,N]}),e[155]=N,e[156]=x,e[157]=S,e[158]=y,e[159]=w,e[160]=z):z=e[160],z},"as");function ir(l){return We(l.avgDurationMs)==="critical"}b(ir,"is");function or(l){return We(l.avgDurationMs)==="warning"}b(or,"ns");function dr(l){return We(l.avgDurationMs)==="good"}b(dr,"os");var cr=["1m","5m","15m","1h"],mr=b(l=>new Date(l).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ds"),ur=b(l=>l.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:mr(e.bucketMs)})),"ms"),hr=b(({shardKey:l=""})=>{let e=he(),[s,a]=(0,Q.useState)("15m"),r=Oe(Ee.getQueryInsights,{range:s},{live:!0,shardKey:l}).data,o=ur(r?.buckets??[]);return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:cr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===s,className:xt("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===s&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:b(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Je,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),o.length===0?(0,t.jsx)(vt,{description:e("Statements executed in the selected window appear here, with throughput and latency over time."),testId:"qi-empty",title:e("No queries in this window.")}):(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),(0,t.jsx)(rt,{height:140,width:"100%",children:(0,t.jsxs)(Lt,{data:o,children:[(0,t.jsx)(st,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(lt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(nt,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(at,{}),(0,t.jsx)(zt,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),(0,t.jsx)(rt,{height:140,width:"100%",children:(0,t.jsxs)(Kt,{data:o,children:[(0,t.jsx)(st,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(lt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(nt,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(at,{}),(0,t.jsx)(At,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(nr,{queryStats:r?.entries??[]})]})},"fs"),gr=mt(Ee.getMetrics),pr=[],fr=b((l,e)=>l?e:"overview","gs"),xr=b(l=>{let e=(0,me.c)(14),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={},e[0]=s):s=e[0];let a;e[1]!==l?(a={live:!0,shardKey:l},e[1]=l,e[2]=a):a=e[2];let r=Oe(Ee.getMetrics,s,a),{data:o}=r,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={points:[],shard:null},e[3]=i):i=e[3];let[n,m]=(0,Q.useState)(i),p=(0,Q.useRef)(null),h=(0,Q.useRef)(null),u,c;e[4]!==o||e[5]!==l?(u=b(()=>{o!==void 0&&Nt(l)},"u"),c=[o,l],e[4]=o,e[5]=l,e[6]=u,e[7]=c):(u=e[6],c=e[7]),(0,Q.useEffect)(u,c);let d,f;e[8]!==o?(d=b(()=>{if(o===void 0)return;let x=o,S=h.current!==null&&h.current!==x.shard,y=h.current===x.shard?p.current:null;if(h.current=x.shard,p.current=x.requests,S){m({points:[],shard:x.shard});return}y!==null&&x.requests>=y&&m(w=>({points:[...w.shard===x.shard?w.points:[],x.requests-y].slice(-30),shard:x.shard}))},"c"),f=[o],e[8]=o,e[9]=d,e[10]=f):(d=e[9],f=e[10]),(0,Q.useEffect)(d,f);let g=n.shard!==null&&n.shard===o?.shard?n.points:pr,v;return e[11]!==r||e[12]!==g?(v={...r,history:g},e[11]=r,e[12]=g,e[13]=v):v=e[13],v},"ps"),br=b(l=>{let e=ft(),s=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let[a,r]=(0,Q.useState)(null),[o,i]=(0,Q.useState)(!1),n=b(async()=>{i(!0);let p=l,h=Ot(p,yt());try{let u=await Promise.all(h.map(async c=>{try{let d=await e.query(gr,{},ut(c));return{error:null,metrics:d,shard:c===""?d.shard:c}}catch(d){return{error:ht(d),metrics:null,shard:c===""?"__root__":c}}}));s.current&&r({results:u,shard:p})}finally{s.current&&i(!1)}},"a"),m=a?.shard===l?a.results:null;return{aggregate:m===null?null:Et(m),aggregating:o,clearAggregate:b(()=>{r(null)},"clearAggregate"),runAggregate:b(()=>{pt(n())},"runAggregate"),shardResults:m}},"xs"),vr=b(l=>{if(!l||!("queryStats"in l))return;let e=l.queryStats;if(!(!e||!Array.isArray(e)))return Ft(e)},"bs"),jt=b(l=>`pb-2 text-sm font-medium transition-colors ${l?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"ot"),yr=b(l=>{let e=(0,me.c)(26),{activeTab:s,onSelect:a,queryCount:r}=l,o=he(),i;e[0]!==a?(i=b(()=>{a("overview")},"n"),e[0]=a,e[1]=i):i=e[1];let n=i,m;e[2]!==a?(m=b(()=>{a("query-insights")},"m"),e[2]=a,e[3]=m):m=e[3];let p=m,h=s==="overview",u;e[4]!==h?(u=jt(h),e[4]=h,e[5]=u):u=e[5];let c;e[6]!==o?(c=o("Overview"),e[6]=o,e[7]=c):c=e[7];let d;e[8]!==n||e[9]!==u||e[10]!==c?(d=(0,t.jsx)("button",{className:u,"data-testid":"mt-tab-overview",onClick:n,type:"button",children:c}),e[8]=n,e[9]=u,e[10]=c,e[11]=d):d=e[11];let f=s==="query-insights",g;e[12]!==f?(g=jt(f),e[12]=f,e[13]=g):g=e[13];let v;e[14]!==o?(v=o("Query insights"),e[14]=o,e[15]=v):v=e[15];let x;e[16]!==r?(x=r>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:r}),e[16]=r,e[17]=x):x=e[17];let S;e[18]!==p||e[19]!==x||e[20]!==g||e[21]!==v?(S=(0,t.jsxs)("button",{className:g,"data-testid":"mt-tab-query-insights",onClick:p,type:"button",children:[v,x]}),e[18]=p,e[19]=x,e[20]=g,e[21]=v,e[22]=S):S=e[22];let y;return e[23]!==S||e[24]!==d?(y=(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[d,S]}),e[23]=S,e[24]=d,e[25]=y):y=e[25],y},"vs"),Nr=b(l=>{let e=(0,me.c)(13),{history:s,metrics:a}=l,r;e[0]!==s?(r=s.at(-1)??0,e[0]=s,e[1]=r):r=e[1];let o;e[2]!==a.errors||e[3]!==a.requests?(o=a.requests===0?"\u2014":`${(a.errors/a.requests*100).toFixed(1)}%`,e[2]=a.errors,e[3]=a.requests,e[4]=o):o=e[4];let i;e[5]!==a?(i=Dt(a),e[5]=a,e[6]=i):i=e[6];let n;return e[7]!==s||e[8]!==a||e[9]!==r||e[10]!==o||e[11]!==i?(n=(0,t.jsx)(ar,{currentDelta:r,errorRate:o,history:s,latencyPercentiles:i,metrics:a}),e[7]=s,e[8]=a,e[9]=r,e[10]=o,e[11]=i,e[12]=n):n=e[12],n},"ys"),Sr=b(l=>{let e=(0,me.c)(25),{aggregating:s,liveError:a,onAggregate:r,onClearAggregate:o,onShardKeyChange:i,shardKey:n}=l,m=he(),p;e[0]!==i||e[1]!==n?(p=(0,t.jsx)(St,{onChange:i,testId:"mt-shard-input",value:n}),e[0]=i,e[1]=n,e[2]=p):p=e[2];let h;e[3]!==a?(h=(0,t.jsx)(qt,{message:a,prefix:"mt"}),e[3]=a,e[4]=h):h=e[4];let u;e[5]!==s||e[6]!==m?(u=m(s?"Aggregating\u2026":"All shards"),e[5]=s,e[6]=m,e[7]=u):u=e[7];let c;e[8]!==s||e[9]!==r||e[10]!==u?(c=(0,t.jsx)(Ye,{"data-testid":"mt-aggregate",disabled:s,onClick:r,size:"sm",type:"button",variant:"secondary",children:u}),e[8]=s,e[9]=r,e[10]=u,e[11]=c):c=e[11];let d;e[12]!==o||e[13]!==m?(d=o!==void 0&&(0,t.jsx)(Ye,{"data-testid":"mt-aggregate-clear",onClick:o,size:"sm",type:"button",variant:"ghost",children:m("Hide")}),e[12]=o,e[13]=m,e[14]=d):d=e[14];let f;e[15]!==m?(f=m("Open in Cloudflare"),e[15]=m,e[16]=f):f=e[16];let g;e[17]!==f?(g=(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:_t,rel:"noreferrer",target:"_blank",children:f}),e[17]=f,e[18]=g):g=e[18];let v;return e[19]!==p||e[20]!==h||e[21]!==c||e[22]!==d||e[23]!==g?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,h,c,d,g]}),e[19]=p,e[20]=h,e[21]=c,e[22]=d,e[23]=g,e[24]=v):v=e[24],v},"Ns"),Jr=b(l=>{let e=(0,me.c)(41),{initialShardKey:s}=l,{queryShardKey:a,setShardKey:r,shardKey:o}=wt(s),[i,n]=(0,Q.useState)("overview"),m=$t(a),{data:p,error:h,history:u,liveError:c}=xr(a),d=p??null,{aggregate:f,aggregating:g,clearAggregate:v,runAggregate:x,shardResults:S}=br(o),y;e[0]!==d?(y=vr(d),e[0]=d,e[1]=y):y=e[1];let w=y,I=w!==void 0,k;e[2]!==i||e[3]!==I?(k=fr(I,i),e[2]=i,e[3]=I,e[4]=k):k=e[4];let N=k,z=S===null?void 0:v,_;e[5]!==g||e[6]!==c||e[7]!==x||e[8]!==r||e[9]!==o||e[10]!==z?(_=(0,t.jsx)(Sr,{aggregating:g,liveError:c,onAggregate:x,onClearAggregate:z,onShardKeyChange:r,shardKey:o}),e[5]=g,e[6]=c,e[7]=x,e[8]=r,e[9]=o,e[10]=z,e[11]=_):_=e[11];let C;e[12]!==h?(C=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:h}),e[12]=h,e[13]=C):C=e[13];let R;e[14]!==N||e[15]!==w?(R=w!==void 0&&(0,t.jsx)(yr,{activeTab:N,onSelect:n,queryCount:w.length}),e[14]=N,e[15]=w,e[16]=R):R=e[16];let M;e[17]!==N||e[18]!==a||e[19]!==w?(M=N==="query-insights"&&w!==void 0&&(0,t.jsx)(hr,{shardKey:a}),e[17]=N,e[18]=a,e[19]=w,e[20]=M):M=e[20];let $;e[21]!==N||e[22]!==u||e[23]!==d?($=N==="overview"&&d!==null&&(0,t.jsx)(Nr,{history:u,metrics:d}),e[21]=N,e[22]=u,e[23]=d,e[24]=$):$=e[24];let A;e[25]!==N||e[26]!==m||e[27]!==a?(A=N==="overview"&&(0,t.jsx)(tr,{onOpenTrace:m,shardKey:a}),e[25]=N,e[26]=m,e[27]=a,e[28]=A):A=e[28];let L;e[29]!==f||e[30]!==N||e[31]!==S?(L=N==="overview"&&f!==null&&S!==null&&(0,t.jsx)(rr,{aggregate:f,shardResults:S}),e[29]=f,e[30]=N,e[31]=S,e[32]=L):L=e[32];let E;return e[33]!==A||e[34]!==L||e[35]!==_||e[36]!==C||e[37]!==R||e[38]!==M||e[39]!==$?(E=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[_,C,R,M,$,A,L]}),e[33]=A,e[34]=L,e[35]=_,e[36]=C,e[37]=R,e[38]=M,e[39]=$,e[40]=E):E=e[40],E},"Js");export{Jr as MetricsPanel};
1
+ import{a as Pt,b as Qt,c as ot}from"./chunk-FWM5Z6CH.js";import{a as de}from"./chunk-HFPX37U7.js";import{a as Et,b as Ot,c as Dt,d as Ft}from"./chunk-RIAOZECW.js";import{a as it}from"./chunk-RDYGUTWW.js";import{a as rt,b as at,c as st,d as At,e as zt,f as lt,g as nt,h as Kt,i as Lt}from"./chunk-UDBPUH63.js";import{c as Rt}from"./chunk-LJLNIVUA.js";import{a as $t}from"./chunk-SRNRWSMY.js";import"./chunk-QLZGKBOW.js";import{e as _t}from"./chunk-R6NJ4ER6.js";import{a as kt,b as Ct,c as Mt,d as It,e as Qe}from"./chunk-54X7HWI6.js";import"./chunk-T7UKRA6J.js";import{a as qt}from"./chunk-2LKJSQKF.js";import"./chunk-Y2YLTUMD.js";import"./chunk-QF743FSL.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import"./chunk-R3RIZDUS.js";import{a as wt}from"./chunk-2KTN53PK.js";import{a as St}from"./chunk-PAFHBQFL.js";import{a as yt,b as Nt}from"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import"./chunk-OKZINWBB.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as Ye}from"./chunk-NVMQPIRS.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as vt}from"./chunk-S3TDGFRE.js";import{b as Je}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as Ze,b as et,c as tt,d as Pe,e as oe,f as B}from"./chunk-J3ZEO3PJ.js";import"./chunk-EOFWXI3T.js";import{a as Ee}from"./chunk-LYVYUTQY.js";import{c as Oe}from"./chunk-KE7ZGUGO.js";import{a as fe,b as De,c as Fe,d as bt,e as xe}from"./chunk-TN4Z3P6S.js";import{a as ct,n as ft}from"./chunk-UK5OOCLQ.js";import"./chunk-ZPQBVYNN.js";import{B as he,h as mt,i as ut,j as ht,k as gt,o as Ge,s as pt,x as xt}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as Ht}from"./chunk-A6TVTNKO.js";import{a as Ut,b as Gt}from"./chunk-ADABTCDI.js";import{a as b,d as Xe}from"./chunk-5PEAXTYQ.js";var me=Xe(Ht(),1),Q=Xe(Ut(),1);var t=Xe(Gt(),1);var Bt=b((l,e,s)=>`${l}:${e}:${ct(s??{})}`,"ut"),Tt=b((l,e)=>l==="gauge"?e.last:l==="histogram"?e.sum/Math.max(1,e.count):e.sum,"ht"),Jt=b((l,e)=>Tt(l,e),"jt"),Vt=b(l=>Tt(l.kind,l),"Gt"),dt=b(l=>Number.isInteger(l)?l.toLocaleString():l.toLocaleString(void 0,{maximumFractionDigits:2}),"Ye"),Wt=b(l=>Array.isArray(l?.series)?l.series:[],"Yt"),Xt="FUNCTION_NOT_FOUND",Yt=b(l=>{let e=new Map;if(!Array.isArray(l?.series))return e;for(let s of l.series)e.set(Bt(s.kind,s.name,s.attributes),s.points);return e},"Wt"),Zt={counter:"secondary",gauge:"default",histogram:"outline"},er=b(l=>{let e=(0,me.c)(18),{name:s,onOpenTrace:a,traceId:r}=l,o=he();if(r===void 0){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=c):c=e[0],c}let i;e[1]!==r?(i=r.slice(0,8),e[1]=r,e[2]=i):i=e[2];let n=i;if(a===void 0){let c=`mt-instrument-trace-${s}`,d;return e[3]!==n||e[4]!==c||e[5]!==r?(d=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":c,title:r,children:n}),e[3]=n,e[4]=c,e[5]=r,e[6]=d):d=e[6],d}let m=`mt-instrument-trace-${s}`,p;e[7]!==a||e[8]!==r?(p=b(()=>{a(r)},"p"),e[7]=a,e[8]=r,e[9]=p):p=e[9];let h;e[10]!==o||e[11]!==r?(h=o("Open the exemplar trace {trace}",{trace:r}),e[10]=o,e[11]=r,e[12]=h):h=e[12];let u;return e[13]!==n||e[14]!==m||e[15]!==p||e[16]!==h?(u=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":m,onClick:p,title:h,type:"button",children:n}),e[13]=n,e[14]=m,e[15]=p,e[16]=h,e[17]=u):u=e[17],u},"Zt"),tr=b(l=>{let e=(0,me.c)(105),{onOpenTrace:s,shardKey:a}=l,r=he(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==a?(i={live:!0,shardKey:a},e[1]=a,e[2]=i):i=e[2];let{data:n,error:m,errorSource:p}=Oe(Ee.getMetricSeries,o,i),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let u;e[4]!==a?(u={live:!0,shardKey:a},e[4]=a,e[5]=u):u=e[5];let{data:c}=Oe(Ee.getMetricHistory,h,u),d,f,g,v,x,S,y,w,I,k,N,z,_;if(e[6]!==n||e[7]!==m||e[8]!==p||e[9]!==c||e[10]!==s||e[11]!==r){w=Symbol.for("react.early_return_sentinel");e:{let L=Wt(n),E=gt(p)===Xt;if(m!==null&&!E){let q;e[25]!==r?(q=r("Instruments"),e[25]=r,e[26]=q):q=e[26];let D;e[27]!==q?(D=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:q}),e[27]=q,e[28]=D):D=e[28];let F;e[29]!==m||e[30]!==r?(F=r("Instruments unavailable: {error}",{error:m}),e[29]=m,e[30]=r,e[31]=F):F=e[31];let P;e[32]!==F?(P=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:F}),e[32]=F,e[33]=P):P=e[33];let ie;e[34]!==D||e[35]!==P?(ie=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[D,P]}),e[34]=D,e[35]=P,e[36]=ie):ie=e[36],w=ie;break e}if(L.length===0){w=null;break e}let O=Yt(c),ue;e[37]!==r?(ue=b(q=>r(q==="counter"?"Counter":q==="gauge"?"Gauge":"Histogram"),"de"),e[37]=r,e[38]=ue):ue=e[38];let ge=ue;x="flex flex-col gap-2",S="mt-instruments";let T;e[39]!==r?(T=r("Instruments"),e[39]=r,e[40]=T):T=e[40],e[41]!==T?(y=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:T}),e[41]=T,e[42]=y):y=e[42],v=fe,_="overflow-hidden py-0",g=xe,z="px-0",f=Ze,k="mt-instruments-table";let U;e[43]!==r?(U=r("name"),e[43]=r,e[44]=U):U=e[44];let H;e[45]!==U?(H=(0,t.jsx)(oe,{children:U}),e[45]=U,e[46]=H):H=e[46];let G;e[47]!==r?(G=r("kind"),e[47]=r,e[48]=G):G=e[48];let J;e[49]!==G?(J=(0,t.jsx)(oe,{children:G}),e[49]=G,e[50]=J):J=e[50];let V;e[51]!==r?(V=r("value"),e[51]=r,e[52]=V):V=e[52];let W;e[53]!==V?(W=(0,t.jsx)(oe,{className:"text-right",children:V}),e[53]=V,e[54]=W):W=e[54];let X;e[55]!==r?(X=r("count"),e[55]=r,e[56]=X):X=e[56];let Y;e[57]!==X?(Y=(0,t.jsx)(oe,{className:"text-right",children:X}),e[57]=X,e[58]=Y):Y=e[58];let Z;e[59]!==r?(Z=r("range"),e[59]=r,e[60]=Z):Z=e[60];let ee;e[61]!==Z?(ee=(0,t.jsx)(oe,{className:"text-right",children:Z}),e[61]=Z,e[62]=ee):ee=e[62];let te;e[63]!==r?(te=r("trend"),e[63]=r,e[64]=te):te=e[64];let re;e[65]!==te?(re=(0,t.jsx)(oe,{children:te}),e[65]=te,e[66]=re):re=e[66];let ae;e[67]!==r?(ae=r("trace"),e[67]=r,e[68]=ae):ae=e[68];let se;e[69]!==ae?(se=(0,t.jsx)(oe,{children:ae}),e[69]=ae,e[70]=se):se=e[70];let le;e[71]!==r?(le=r("dimensions"),e[71]=r,e[72]=le):le=e[72];let ne;e[73]!==le?(ne=(0,t.jsx)(oe,{children:le}),e[73]=le,e[74]=ne):ne=e[74],e[75]!==H||e[76]!==J||e[77]!==W||e[78]!==Y||e[79]!==ee||e[80]!==re||e[81]!==se||e[82]!==ne?(N=(0,t.jsx)(et,{children:(0,t.jsxs)(Pe,{children:[H,J,W,Y,ee,re,se,ne]})}),e[75]=H,e[76]=J,e[77]=W,e[78]=Y,e[79]=ee,e[80]=re,e[81]=se,e[82]=ne,e[83]=N):N=e[83],d=tt,I=L.map(q=>{let D=Rt(q.attributes),F=Bt(q.kind,q.name,q.attributes),P=(O.get(F)??[]).map(ie=>Jt(q.kind,ie));return(0,t.jsxs)(Pe,{"data-testid":`mt-instrument-${q.name}`,children:[(0,t.jsx)(B,{className:"font-mono text-xs",title:q.functionPath,children:q.name}),(0,t.jsx)(B,{children:(0,t.jsx)(Je,{variant:Zt[q.kind],children:ge(q.kind)})}),(0,t.jsx)(B,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${q.name}`,children:dt(Vt(q))}),(0,t.jsx)(B,{className:"text-right tabular-nums text-muted-foreground",children:q.count.toLocaleString()}),(0,t.jsx)(B,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:q.min===q.max?"\u2014":`${dt(q.min)}\u2013${dt(q.max)}`}),(0,t.jsx)(B,{children:P.length>=2?(0,t.jsx)(it,{ariaLabel:r("{name} trend",{name:q.name}),className:"h-6 w-24 text-foreground",series:P,testId:`mt-instrument-trend-${q.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(B,{className:"font-mono text-xs",children:(0,t.jsx)(er,{name:q.name,onOpenTrace:s,traceId:q.exemplarTraceId})}),(0,t.jsx)(B,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:D,children:D===""?"\u2014":D})]},F)})}e[6]=n,e[7]=m,e[8]=p,e[9]=c,e[10]=s,e[11]=r,e[12]=d,e[13]=f,e[14]=g,e[15]=v,e[16]=x,e[17]=S,e[18]=y,e[19]=w,e[20]=I,e[21]=k,e[22]=N,e[23]=z,e[24]=_}else d=e[12],f=e[13],g=e[14],v=e[15],x=e[16],S=e[17],y=e[18],w=e[19],I=e[20],k=e[21],N=e[22],z=e[23],_=e[24];if(w!==Symbol.for("react.early_return_sentinel"))return w;let C;e[84]!==d||e[85]!==I?(C=(0,t.jsx)(d,{children:I}),e[84]=d,e[85]=I,e[86]=C):C=e[86];let R;e[87]!==f||e[88]!==C||e[89]!==k||e[90]!==N?(R=(0,t.jsxs)(f,{"data-testid":k,children:[N,C]}),e[87]=f,e[88]=C,e[89]=k,e[90]=N,e[91]=R):R=e[91];let M;e[92]!==g||e[93]!==R||e[94]!==z?(M=(0,t.jsx)(g,{className:z,children:R}),e[92]=g,e[93]=R,e[94]=z,e[95]=M):M=e[95];let $;e[96]!==v||e[97]!==M||e[98]!==_?($=(0,t.jsx)(v,{className:_,children:M}),e[96]=v,e[97]=M,e[98]=_,e[99]=$):$=e[99];let A;return e[100]!==x||e[101]!==S||e[102]!==y||e[103]!==$?(A=(0,t.jsxs)("section",{className:x,"data-testid":S,children:[y,$]}),e[100]=x,e[101]=S,e[102]=y,e[103]=$,e[104]=A):A=e[104],A},"es"),rr=b(l=>{let e=(0,me.c)(74),{aggregate:s,shardResults:a}=l,r=he(),o;e[0]!==r?(o=r("Shards"),e[0]=r,e[1]=o):o=e[1];let i;e[2]!==s.failed||e[3]!==s.reachable||e[4]!==r?(i=s.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:s.failed,reachable:s.reachable}):r("{reachable} reachable",{reachable:s.reachable}),e[2]=s.failed,e[3]=s.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==o||e[7]!==i?(n=(0,t.jsx)(de,{label:o,testId:"mt-agg-shards",value:i}),e[6]=o,e[7]=i,e[8]=n):n=e[8];let m;e[9]!==r?(m=r("Total requests"),e[9]=r,e[10]=m):m=e[10];let p;e[11]!==s.totalRequests||e[12]!==m?(p=(0,t.jsx)(de,{label:m,testId:"mt-agg-requests",value:s.totalRequests}),e[11]=s.totalRequests,e[12]=m,e[13]=p):p=e[13];let h;e[14]!==r?(h=r("Total errors"),e[14]=r,e[15]=h):h=e[15];let u;e[16]!==s.totalErrors||e[17]!==h?(u=(0,t.jsx)(de,{label:h,testId:"mt-agg-errors",value:s.totalErrors}),e[16]=s.totalErrors,e[17]=h,e[18]=u):u=e[18];let c;e[19]!==r?(c=r("Total database size"),e[19]=r,e[20]=c):c=e[20];let d;e[21]!==s.totalDatabaseSize?(d=Ge(s.totalDatabaseSize),e[21]=s.totalDatabaseSize,e[22]=d):d=e[22];let f;e[23]!==c||e[24]!==d?(f=(0,t.jsx)(de,{label:c,testId:"mt-agg-db-size",value:d}),e[23]=c,e[24]=d,e[25]=f):f=e[25];let g;e[26]!==r?(g=r("Combined cache hit rate"),e[26]=r,e[27]=g):g=e[27];let v;e[28]!==s.hitRate||e[29]!==r?(v=s.hitRate===null?r("no cache configured"):`${(s.hitRate*100).toFixed(1)}%`,e[28]=s.hitRate,e[29]=r,e[30]=v):v=e[30];let x;e[31]!==g||e[32]!==v?(x=(0,t.jsx)(de,{label:g,testId:"mt-agg-cache",value:v}),e[31]=g,e[32]=v,e[33]=x):x=e[33];let S;e[34]!==f||e[35]!==x||e[36]!==n||e[37]!==p||e[38]!==u?(S=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,p,u,f,x]}),e[34]=f,e[35]=x,e[36]=n,e[37]=p,e[38]=u,e[39]=S):S=e[39];let y;e[40]!==r?(y=r("shard"),e[40]=r,e[41]=y):y=e[41];let w;e[42]!==y?(w=(0,t.jsx)(oe,{children:y}),e[42]=y,e[43]=w):w=e[43];let I;e[44]!==r?(I=r("requests"),e[44]=r,e[45]=I):I=e[45];let k;e[46]!==I?(k=(0,t.jsx)(oe,{children:I}),e[46]=I,e[47]=k):k=e[47];let N;e[48]!==r?(N=r("errors"),e[48]=r,e[49]=N):N=e[49];let z;e[50]!==N?(z=(0,t.jsx)(oe,{children:N}),e[50]=N,e[51]=z):z=e[51];let _;e[52]!==r?(_=r("db size"),e[52]=r,e[53]=_):_=e[53];let C;e[54]!==_?(C=(0,t.jsx)(oe,{children:_}),e[54]=_,e[55]=C):C=e[55];let R;e[56]!==w||e[57]!==k||e[58]!==z||e[59]!==C?(R=(0,t.jsx)(et,{children:(0,t.jsxs)(Pe,{children:[w,k,z,C]})}),e[56]=w,e[57]=k,e[58]=z,e[59]=C,e[60]=R):R=e[60];let M;if(e[61]!==a||e[62]!==r){let E;e[64]!==r?(E=b(O=>(0,t.jsxs)(Pe,{"data-testid":`mt-agg-row-${O.shard}`,children:[(0,t.jsx)(B,{children:O.shard}),O.metrics===null?(0,t.jsx)(B,{className:"text-destructive",colSpan:3,children:O.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{className:"tabular-nums",children:O.metrics.requests}),(0,t.jsx)(B,{className:"tabular-nums",children:O.metrics.errors}),(0,t.jsx)(B,{className:"tabular-nums",children:Ge(O.metrics.databaseSize)})]})]},O.shard),"L"),e[64]=r,e[65]=E):E=e[65],M=a.map(E),e[61]=a,e[62]=r,e[63]=M}else M=e[63];let $;e[66]!==M?($=(0,t.jsx)(tt,{children:M}),e[66]=M,e[67]=$):$=e[67];let A;e[68]!==R||e[69]!==$?(A=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(xe,{className:"px-0",children:(0,t.jsxs)(Ze,{"data-testid":"mt-agg-table",children:[R,$]})})}),e[68]=R,e[69]=$,e[70]=A):A=e[70];let L;return e[71]!==S||e[72]!==A?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[S,A]}),e[71]=S,e[72]=A,e[73]=L):L=e[73],L},"ts"),ar=b(l=>{let e=(0,me.c)(75),{currentDelta:s,errorRate:a,history:r,latencyPercentiles:o,metrics:i}=l,n=he(),{cache:m}=i,p;e[0]!==r||e[1]!==n?(p=r.length>=2?(0,t.jsx)(it,{ariaLabel:n("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=n,e[2]=p):p=e[2];let h;e[3]!==s||e[4]!==r.length||e[5]!==n?(h=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${s.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=s,e[4]=r.length,e[5]=n,e[6]=h):h=e[6];let u;e[7]!==n?(u=n("Requests"),e[7]=n,e[8]=u):u=e[8];let c;e[9]!==i.requests||e[10]!==p||e[11]!==h||e[12]!==u?(c=(0,t.jsx)(de,{chart:p,footer:h,label:u,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=p,e[11]=h,e[12]=u,e[13]=c):c=e[13];let d;e[14]!==a||e[15]!==n?(d=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=d):d=e[16];let f;e[17]!==n?(f=n("Errors"),e[17]=n,e[18]=f):f=e[18];let g;e[19]!==a||e[20]!==i.errors?(g=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=g):g=e[21];let v;e[22]!==d||e[23]!==f||e[24]!==g?(v=(0,t.jsx)(de,{footer:d,label:f,testId:"mt-errors",value:g}),e[22]=d,e[23]=f,e[24]=g,e[25]=v):v=e[25];let x;e[26]!==o.p90?(x=o.p90>0?`P90 ${ot(o.p90)}`:void 0,e[26]=o.p90,e[27]=x):x=e[27];let S;e[28]!==n?(S=n("P95 latency"),e[28]=n,e[29]=S):S=e[29];let y;e[30]!==o.p95?(y=o.p95>0?ot(o.p95):"\u2014",e[30]=o.p95,e[31]=y):y=e[31];let w;e[32]!==S||e[33]!==y||e[34]!==x?(w=(0,t.jsx)(de,{footer:x,label:S,testId:"mt-p95",value:y}),e[32]=S,e[33]=y,e[34]=x,e[35]=w):w=e[35];let I;e[36]!==m||e[37]!==n?(I=m?`${m.entries.toLocaleString()} ${n("cache entries")}`:void 0,e[36]=m,e[37]=n,e[38]=I):I=e[38];let k;e[39]!==n?(k=n("Database size"),e[39]=n,e[40]=k):k=e[40];let N;e[41]!==i.databaseSize?(N=Ge(i.databaseSize),e[41]=i.databaseSize,e[42]=N):N=e[42];let z;e[43]!==I||e[44]!==k||e[45]!==N?(z=(0,t.jsx)(de,{footer:I,label:k,testId:"mt-db-size",value:N}),e[43]=I,e[44]=k,e[45]=N,e[46]=z):z=e[46];let _;e[47]!==n?(_=n("Shard"),e[47]=n,e[48]=_):_=e[48];let C;e[49]!==i.shard||e[50]!==_?(C=(0,t.jsx)(de,{label:_,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=_,e[51]=C):C=e[51];let R;e[52]!==n?(R=n("Uptime"),e[52]=n,e[53]=R):R=e[53];let M;e[54]!==i.uptimeMs?(M=Pt(i.uptimeMs),e[54]=i.uptimeMs,e[55]=M):M=e[55];let $;e[56]!==R||e[57]!==M?($=(0,t.jsx)(de,{label:R,testId:"mt-uptime",value:M}),e[56]=R,e[57]=M,e[58]=$):$=e[58];let A;e[59]!==n?(A=n("Cache hit rate"),e[59]=n,e[60]=A):A=e[60];let L;e[61]!==m||e[62]!==n?(L=m?n("{rate} ({count} entries)",{count:m.entries,rate:Qt(m.hits,m.misses)}):n("no cache configured"),e[61]=m,e[62]=n,e[63]=L):L=e[63];let E;e[64]!==A||e[65]!==L?(E=(0,t.jsx)(de,{label:A,testId:"mt-cache",value:L}),e[64]=A,e[65]=L,e[66]=E):E=e[66];let O;return e[67]!==w||e[68]!==z||e[69]!==C||e[70]!==$||e[71]!==E||e[72]!==c||e[73]!==v?(O=(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:[c,v,w,z,C,$,E]}),e[67]=w,e[68]=z,e[69]=C,e[70]=$,e[71]=E,e[72]=c,e[73]=v,e[74]=O):O=e[74],O},"ss"),We=b(l=>l>=100?"critical":l>=50?"warning":"good","Ge"),je=b(l=>l<1?`${(l*1e3).toFixed(0)}\u03BCs`:l<1e3?`${l.toFixed(1)}ms`:`${(l/1e3).toFixed(2)}s`,"Le"),Ve=b(l=>l>=1e9?`${(l/1e9).toFixed(1)}B`:l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:l.toLocaleString(),"Ue"),sr=b(l=>{let e=(0,me.c)(3),{level:s}=l;if(s==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Je,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(s==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=(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]=r):r=e[1],r}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(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]=a):a=e[2],a},"rs"),lr=b((l,e)=>{let s=[...l];return s.sort((a,r)=>{switch(e){case"avgTime":return r.avgDurationMs-a.avgDurationMs;case"execCount":return r.execCount-a.execCount;case"rowsRead":return r.rowsRead-a.rowsRead;default:return r.totalDurationMs-a.totalDurationMs}}),s},"ls"),nr=b(l=>{let e=(0,me.c)(161),{queryStats:s}=l,a=he(),[r,o]=(0,Q.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,m]=(0,Q.useState)(i),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=b(_=>{_!==null&&o(_)},"p"),e[1]=p):p=e[1];let h=p,u,c,d,f,g,v,x,S,y,w;if(e[2]!==n||e[3]!==s||e[4]!==r||e[5]!==a){d=Symbol.for("react.early_return_sentinel");e:{let _=lr(s,r),C;e[16]!==s?(C=s.filter(ir),e[16]=s,e[17]=C):C=e[17];let R=C.length,M;e[18]!==s?(M=s.filter(or),e[18]=s,e[19]=M):M=e[19];let $=M.length,A;e[20]!==s?(A=s.filter(dr),e[20]=s,e[21]=A):A=e[21];let L=A.length,E;e[22]===Symbol.for("react.memo_cache_sentinel")?(E=b(K=>{m(ce=>{let j=new Set(ce);return j.has(K)?j.delete(K):j.add(K),j})},"L"),e[22]=E):E=e[22];let O=E;if(s.length===0){let K;e[23]!==a?(K=a("No query insights yet"),e[23]=a,e[24]=K):K=e[24];let ce;e[25]!==K?(ce=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:K}),e[25]=K,e[26]=ce):ce=e[26];let j;e[27]!==a?(j=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=j):j=e[28];let pe;e[29]!==j?(pe=(0,t.jsx)("p",{className:"mt-1 text-sm",children:j}),e[29]=j,e[30]=pe):pe=e[30];let He;e[31]!==ce||e[32]!==pe?(He=(0,t.jsx)(fe,{children:(0,t.jsx)(xe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ce,pe]})})}),e[31]=ce,e[32]=pe,e[33]=He):He=e[33],d=He;break e}x="space-y-4",S="qi-root";let ue;e[34]!==a?(ue=a("Critical queries"),e[34]=a,e[35]=ue):ue=e[35];let ge;e[36]!==ue?(ge=(0,t.jsx)(De,{className:"pb-2",children:(0,t.jsx)(Fe,{className:"text-sm font-medium",children:ue})}),e[36]=ue,e[37]=ge):ge=e[37];let T;e[38]!==R?(T=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:R}),e[38]=R,e[39]=T):T=e[39];let U;e[40]!==a?(U=a(">100ms avg execution"),e[40]=a,e[41]=U):U=e[41];let H;e[42]!==U?(H=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:U}),e[42]=U,e[43]=H):H=e[43];let G;e[44]!==T||e[45]!==H?(G=(0,t.jsxs)(xe,{children:[T,H]}),e[44]=T,e[45]=H,e[46]=G):G=e[46];let J;e[47]!==ge||e[48]!==G?(J=(0,t.jsxs)(fe,{children:[ge,G]}),e[47]=ge,e[48]=G,e[49]=J):J=e[49];let V;e[50]!==a?(V=a("Moderate queries"),e[50]=a,e[51]=V):V=e[51];let W;e[52]!==V?(W=(0,t.jsx)(De,{className:"pb-2",children:(0,t.jsx)(Fe,{className:"text-sm font-medium",children:V})}),e[52]=V,e[53]=W):W=e[53];let X;e[54]!==$?(X=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:$}),e[54]=$,e[55]=X):X=e[55];let Y;e[56]!==a?(Y=a("50\u2013100ms avg execution"),e[56]=a,e[57]=Y):Y=e[57];let Z;e[58]!==Y?(Z=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:Y}),e[58]=Y,e[59]=Z):Z=e[59];let ee;e[60]!==X||e[61]!==Z?(ee=(0,t.jsxs)(xe,{children:[X,Z]}),e[60]=X,e[61]=Z,e[62]=ee):ee=e[62];let te;e[63]!==W||e[64]!==ee?(te=(0,t.jsxs)(fe,{children:[W,ee]}),e[63]=W,e[64]=ee,e[65]=te):te=e[65];let re;e[66]!==a?(re=a("Fast queries"),e[66]=a,e[67]=re):re=e[67];let ae;e[68]!==re?(ae=(0,t.jsx)(De,{className:"pb-2",children:(0,t.jsx)(Fe,{className:"text-sm font-medium",children:re})}),e[68]=re,e[69]=ae):ae=e[69];let se;e[70]!==L?(se=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:L}),e[70]=L,e[71]=se):se=e[71];let le;e[72]!==a?(le=a("<50ms avg execution"),e[72]=a,e[73]=le):le=e[73];let ne;e[74]!==le?(ne=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:le}),e[74]=le,e[75]=ne):ne=e[75];let q;e[76]!==se||e[77]!==ne?(q=(0,t.jsxs)(xe,{children:[se,ne]}),e[76]=se,e[77]=ne,e[78]=q):q=e[78];let D;e[79]!==ae||e[80]!==q?(D=(0,t.jsxs)(fe,{children:[ae,q]}),e[79]=ae,e[80]=q,e[81]=D):D=e[81],e[82]!==J||e[83]!==te||e[84]!==D?(y=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[J,te,D]}),e[82]=J,e[83]=te,e[84]=D,e[85]=y):y=e[85];let F;e[86]!==a?(F=a("Query leaderboard"),e[86]=a,e[87]=F):F=e[87];let P;e[88]!==F?(P=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:F}),e[88]=F,e[89]=P):P=e[89];let ie;e[90]!==r||e[91]!==a?(ie=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=ie):ie=e[92];let be;e[93]!==ie?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:ie}),e[93]=ie,e[94]=be):be=e[94];let ve;e[95]!==P||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[P,be]}),e[95]=P,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Be;e[104]===Symbol.for("react.memo_cache_sentinel")?(Be=(0,t.jsx)(Ct,{}),e[104]=Be):Be=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Mt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Be}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let _e;e[109]!==qe?(_e=(0,t.jsx)(Qe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=_e):_e=e[110];let ke;e[111]!==a?(ke=a("Avg time"),e[111]=a,e[112]=ke):ke=e[112];let Ce;e[113]!==ke?(Ce=(0,t.jsx)(Qe,{value:"avgTime",children:ke}),e[113]=ke,e[114]=Ce):Ce=e[114];let Me;e[115]!==a?(Me=a("Execution count"),e[115]=a,e[116]=Me):Me=e[116];let Ie;e[117]!==Me?(Ie=(0,t.jsx)(Qe,{value:"execCount",children:Me}),e[117]=Me,e[118]=Ie):Ie=e[118];let Re;e[119]!==a?(Re=a("Rows read"),e[119]=a,e[120]=Re):Re=e[120];let $e;e[121]!==Re?($e=(0,t.jsx)(Qe,{value:"rowsRead",children:Re}),e[121]=Re,e[122]=$e):$e=e[122];let Ae;e[123]!==_e||e[124]!==Ce||e[125]!==Ie||e[126]!==$e?(Ae=(0,t.jsxs)(It,{children:[_e,Ce,Ie,$e]}),e[123]=_e,e[124]=Ce,e[125]=Ie,e[126]=$e,e[127]=Ae):Ae=e[127];let ze;e[128]!==r||e[129]!==we||e[130]!==Ae?(ze=(0,t.jsxs)(kt,{onValueChange:h,value:r,children:[we,Ae]}),e[128]=r,e[129]=we,e[130]=Ae,e[131]=ze):ze=e[131];let Ke;e[132]!==Ne||e[133]!==ze?(Ke=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,ze]}),e[132]=Ne,e[133]=ze,e[134]=Ke):Ke=e[134],e[135]!==ve||e[136]!==Ke?(w=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,Ke]}),e[135]=ve,e[136]=Ke,e[137]=w):w=e[137],c=fe;let Le;e[138]!==a?(Le=a("Statements"),e[138]=a,e[139]=Le):Le=e[139];let Te;e[140]!==Le?(Te=(0,t.jsx)(Fe,{children:Le}),e[140]=Le,e[141]=Te):Te=e[141],v=(0,t.jsxs)(De,{children:[Te,(0,t.jsx)(bt,{children:a("{count} tracked statements",{count:_.length})})]}),u=xe,f="space-y-2";let Ue;e[142]!==n||e[143]!==a?(Ue=b(K=>{let ce=K.normalizedSql,j=n.has(ce),pe=We(K.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":j,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:b(()=>{O(ce)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(sr,{level:pe}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:K.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:je(K.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(K.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),K.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(K.p95DurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("p95")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ve(K.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),j&&(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:a("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:K.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[K.p50DurationMs!==void 0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("p50")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:je(K.p50DurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(K.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:je(K.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(K.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(K.rowsWritten)})]})]})]})]},ce)},"Ke"),e[142]=n,e[143]=a,e[144]=Ue):Ue=e[144],g=_.map(Ue)}e[2]=n,e[3]=s,e[4]=r,e[5]=a,e[6]=u,e[7]=c,e[8]=d,e[9]=f,e[10]=g,e[11]=v,e[12]=x,e[13]=S,e[14]=y,e[15]=w}else u=e[6],c=e[7],d=e[8],f=e[9],g=e[10],v=e[11],x=e[12],S=e[13],y=e[14],w=e[15];if(d!==Symbol.for("react.early_return_sentinel"))return d;let I;e[145]!==f||e[146]!==g?(I=(0,t.jsx)("div",{className:f,children:g}),e[145]=f,e[146]=g,e[147]=I):I=e[147];let k;e[148]!==u||e[149]!==I?(k=(0,t.jsx)(u,{children:I}),e[148]=u,e[149]=I,e[150]=k):k=e[150];let N;e[151]!==c||e[152]!==k||e[153]!==v?(N=(0,t.jsxs)(c,{children:[v,k]}),e[151]=c,e[152]=k,e[153]=v,e[154]=N):N=e[154];let z;return e[155]!==N||e[156]!==x||e[157]!==S||e[158]!==y||e[159]!==w?(z=(0,t.jsxs)("div",{className:x,"data-testid":S,children:[y,w,N]}),e[155]=N,e[156]=x,e[157]=S,e[158]=y,e[159]=w,e[160]=z):z=e[160],z},"as");function ir(l){return We(l.avgDurationMs)==="critical"}b(ir,"is");function or(l){return We(l.avgDurationMs)==="warning"}b(or,"ns");function dr(l){return We(l.avgDurationMs)==="good"}b(dr,"os");var cr=["1m","5m","15m","1h"],mr=b(l=>new Date(l).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ds"),ur=b(l=>l.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:mr(e.bucketMs)})),"ms"),hr=b(({shardKey:l=""})=>{let e=he(),[s,a]=(0,Q.useState)("15m"),r=Oe(Ee.getQueryInsights,{range:s},{live:!0,shardKey:l}).data,o=ur(r?.buckets??[]);return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:cr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===s,className:xt("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===s&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:b(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Je,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),o.length===0?(0,t.jsx)(vt,{description:e("Statements executed in the selected window appear here, with throughput and latency over time."),testId:"qi-empty",title:e("No queries in this window.")}):(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),(0,t.jsx)(rt,{height:140,width:"100%",children:(0,t.jsxs)(Lt,{data:o,children:[(0,t.jsx)(st,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(lt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(nt,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(at,{}),(0,t.jsx)(zt,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),(0,t.jsx)(rt,{height:140,width:"100%",children:(0,t.jsxs)(Kt,{data:o,children:[(0,t.jsx)(st,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(lt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(nt,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(at,{}),(0,t.jsx)(At,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(nr,{queryStats:r?.entries??[]})]})},"fs"),gr=mt(Ee.getMetrics),pr=[],fr=b((l,e)=>l?e:"overview","gs"),xr=b(l=>{let e=(0,me.c)(14),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={},e[0]=s):s=e[0];let a;e[1]!==l?(a={live:!0,shardKey:l},e[1]=l,e[2]=a):a=e[2];let r=Oe(Ee.getMetrics,s,a),{data:o}=r,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i={points:[],shard:null},e[3]=i):i=e[3];let[n,m]=(0,Q.useState)(i),p=(0,Q.useRef)(null),h=(0,Q.useRef)(null),u,c;e[4]!==o||e[5]!==l?(u=b(()=>{o!==void 0&&Nt(l)},"u"),c=[o,l],e[4]=o,e[5]=l,e[6]=u,e[7]=c):(u=e[6],c=e[7]),(0,Q.useEffect)(u,c);let d,f;e[8]!==o?(d=b(()=>{if(o===void 0)return;let x=o,S=h.current!==null&&h.current!==x.shard,y=h.current===x.shard?p.current:null;if(h.current=x.shard,p.current=x.requests,S){m({points:[],shard:x.shard});return}y!==null&&x.requests>=y&&m(w=>({points:[...w.shard===x.shard?w.points:[],x.requests-y].slice(-30),shard:x.shard}))},"c"),f=[o],e[8]=o,e[9]=d,e[10]=f):(d=e[9],f=e[10]),(0,Q.useEffect)(d,f);let g=n.shard!==null&&n.shard===o?.shard?n.points:pr,v;return e[11]!==r||e[12]!==g?(v={...r,history:g},e[11]=r,e[12]=g,e[13]=v):v=e[13],v},"ps"),br=b(l=>{let e=ft(),s=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let[a,r]=(0,Q.useState)(null),[o,i]=(0,Q.useState)(!1),n=b(async()=>{i(!0);let p=l,h=Ot(p,yt());try{let u=await Promise.all(h.map(async c=>{try{let d=await e.query(gr,{},ut(c));return{error:null,metrics:d,shard:c===""?d.shard:c}}catch(d){return{error:ht(d),metrics:null,shard:c===""?"__root__":c}}}));s.current&&r({results:u,shard:p})}finally{s.current&&i(!1)}},"a"),m=a?.shard===l?a.results:null;return{aggregate:m===null?null:Et(m),aggregating:o,clearAggregate:b(()=>{r(null)},"clearAggregate"),runAggregate:b(()=>{pt(n())},"runAggregate"),shardResults:m}},"xs"),vr=b(l=>{if(!l||!("queryStats"in l))return;let e=l.queryStats;if(!(!e||!Array.isArray(e)))return Ft(e)},"bs"),jt=b(l=>`pb-2 text-sm font-medium transition-colors ${l?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"ot"),yr=b(l=>{let e=(0,me.c)(26),{activeTab:s,onSelect:a,queryCount:r}=l,o=he(),i;e[0]!==a?(i=b(()=>{a("overview")},"n"),e[0]=a,e[1]=i):i=e[1];let n=i,m;e[2]!==a?(m=b(()=>{a("query-insights")},"m"),e[2]=a,e[3]=m):m=e[3];let p=m,h=s==="overview",u;e[4]!==h?(u=jt(h),e[4]=h,e[5]=u):u=e[5];let c;e[6]!==o?(c=o("Overview"),e[6]=o,e[7]=c):c=e[7];let d;e[8]!==n||e[9]!==u||e[10]!==c?(d=(0,t.jsx)("button",{className:u,"data-testid":"mt-tab-overview",onClick:n,type:"button",children:c}),e[8]=n,e[9]=u,e[10]=c,e[11]=d):d=e[11];let f=s==="query-insights",g;e[12]!==f?(g=jt(f),e[12]=f,e[13]=g):g=e[13];let v;e[14]!==o?(v=o("Query insights"),e[14]=o,e[15]=v):v=e[15];let x;e[16]!==r?(x=r>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:r}),e[16]=r,e[17]=x):x=e[17];let S;e[18]!==p||e[19]!==x||e[20]!==g||e[21]!==v?(S=(0,t.jsxs)("button",{className:g,"data-testid":"mt-tab-query-insights",onClick:p,type:"button",children:[v,x]}),e[18]=p,e[19]=x,e[20]=g,e[21]=v,e[22]=S):S=e[22];let y;return e[23]!==S||e[24]!==d?(y=(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[d,S]}),e[23]=S,e[24]=d,e[25]=y):y=e[25],y},"vs"),Nr=b(l=>{let e=(0,me.c)(13),{history:s,metrics:a}=l,r;e[0]!==s?(r=s.at(-1)??0,e[0]=s,e[1]=r):r=e[1];let o;e[2]!==a.errors||e[3]!==a.requests?(o=a.requests===0?"\u2014":`${(a.errors/a.requests*100).toFixed(1)}%`,e[2]=a.errors,e[3]=a.requests,e[4]=o):o=e[4];let i;e[5]!==a?(i=Dt(a),e[5]=a,e[6]=i):i=e[6];let n;return e[7]!==s||e[8]!==a||e[9]!==r||e[10]!==o||e[11]!==i?(n=(0,t.jsx)(ar,{currentDelta:r,errorRate:o,history:s,latencyPercentiles:i,metrics:a}),e[7]=s,e[8]=a,e[9]=r,e[10]=o,e[11]=i,e[12]=n):n=e[12],n},"ys"),Sr=b(l=>{let e=(0,me.c)(25),{aggregating:s,liveError:a,onAggregate:r,onClearAggregate:o,onShardKeyChange:i,shardKey:n}=l,m=he(),p;e[0]!==i||e[1]!==n?(p=(0,t.jsx)(St,{onChange:i,testId:"mt-shard-input",value:n}),e[0]=i,e[1]=n,e[2]=p):p=e[2];let h;e[3]!==a?(h=(0,t.jsx)(qt,{message:a,prefix:"mt"}),e[3]=a,e[4]=h):h=e[4];let u;e[5]!==s||e[6]!==m?(u=m(s?"Aggregating\u2026":"All shards"),e[5]=s,e[6]=m,e[7]=u):u=e[7];let c;e[8]!==s||e[9]!==r||e[10]!==u?(c=(0,t.jsx)(Ye,{"data-testid":"mt-aggregate",disabled:s,onClick:r,size:"sm",type:"button",variant:"secondary",children:u}),e[8]=s,e[9]=r,e[10]=u,e[11]=c):c=e[11];let d;e[12]!==o||e[13]!==m?(d=o!==void 0&&(0,t.jsx)(Ye,{"data-testid":"mt-aggregate-clear",onClick:o,size:"sm",type:"button",variant:"ghost",children:m("Hide")}),e[12]=o,e[13]=m,e[14]=d):d=e[14];let f;e[15]!==m?(f=m("Open in Cloudflare"),e[15]=m,e[16]=f):f=e[16];let g;e[17]!==f?(g=(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:_t,rel:"noreferrer",target:"_blank",children:f}),e[17]=f,e[18]=g):g=e[18];let v;return e[19]!==p||e[20]!==h||e[21]!==c||e[22]!==d||e[23]!==g?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,h,c,d,g]}),e[19]=p,e[20]=h,e[21]=c,e[22]=d,e[23]=g,e[24]=v):v=e[24],v},"Ns"),Jr=b(l=>{let e=(0,me.c)(41),{initialShardKey:s}=l,{queryShardKey:a,setShardKey:r,shardKey:o}=wt(s),[i,n]=(0,Q.useState)("overview"),m=$t(a),{data:p,error:h,history:u,liveError:c}=xr(a),d=p??null,{aggregate:f,aggregating:g,clearAggregate:v,runAggregate:x,shardResults:S}=br(o),y;e[0]!==d?(y=vr(d),e[0]=d,e[1]=y):y=e[1];let w=y,I=w!==void 0,k;e[2]!==i||e[3]!==I?(k=fr(I,i),e[2]=i,e[3]=I,e[4]=k):k=e[4];let N=k,z=S===null?void 0:v,_;e[5]!==g||e[6]!==c||e[7]!==x||e[8]!==r||e[9]!==o||e[10]!==z?(_=(0,t.jsx)(Sr,{aggregating:g,liveError:c,onAggregate:x,onClearAggregate:z,onShardKeyChange:r,shardKey:o}),e[5]=g,e[6]=c,e[7]=x,e[8]=r,e[9]=o,e[10]=z,e[11]=_):_=e[11];let C;e[12]!==h?(C=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:h}),e[12]=h,e[13]=C):C=e[13];let R;e[14]!==N||e[15]!==w?(R=w!==void 0&&(0,t.jsx)(yr,{activeTab:N,onSelect:n,queryCount:w.length}),e[14]=N,e[15]=w,e[16]=R):R=e[16];let M;e[17]!==N||e[18]!==a||e[19]!==w?(M=N==="query-insights"&&w!==void 0&&(0,t.jsx)(hr,{shardKey:a}),e[17]=N,e[18]=a,e[19]=w,e[20]=M):M=e[20];let $;e[21]!==N||e[22]!==u||e[23]!==d?($=N==="overview"&&d!==null&&(0,t.jsx)(Nr,{history:u,metrics:d}),e[21]=N,e[22]=u,e[23]=d,e[24]=$):$=e[24];let A;e[25]!==N||e[26]!==m||e[27]!==a?(A=N==="overview"&&(0,t.jsx)(tr,{onOpenTrace:m,shardKey:a}),e[25]=N,e[26]=m,e[27]=a,e[28]=A):A=e[28];let L;e[29]!==f||e[30]!==N||e[31]!==S?(L=N==="overview"&&f!==null&&S!==null&&(0,t.jsx)(rr,{aggregate:f,shardResults:S}),e[29]=f,e[30]=N,e[31]=S,e[32]=L):L=e[32];let E;return e[33]!==A||e[34]!==L||e[35]!==_||e[36]!==C||e[37]!==R||e[38]!==M||e[39]!==$?(E=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[_,C,R,M,$,A,L]}),e[33]=A,e[34]=L,e[35]=_,e[36]=C,e[37]=R,e[38]=M,e[39]=$,e[40]=E):E=e[40],E},"Js");export{Jr as MetricsPanel};
@@ -1 +1 @@
1
- import{x as i}from"./chunk-ITS5LMYJ.js";import{a as c}from"./chunk-A6TVTNKO.js";import{b as m}from"./chunk-ADABTCDI.js";import{a as s,d as n}from"./chunk-5PEAXTYQ.js";var d=n(c(),1);var p=n(m(),1);function b(r){let e=(0,d.c)(8),t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=i("flex items-center gap-2 text-xs leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==a||e[6]!==o?(l=(0,p.jsx)("label",{"data-slot":"label",className:o,...a}),e[5]=a,e[6]=o,e[7]=l):l=e[7],l}s(b,"m");export{b as a};
1
+ import{x as i}from"./chunk-PN7JHEYW.js";import{a as c}from"./chunk-A6TVTNKO.js";import{b as m}from"./chunk-ADABTCDI.js";import{a as s,d as n}from"./chunk-5PEAXTYQ.js";var d=n(c(),1);var p=n(m(),1);function b(r){let e=(0,d.c)(8),t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=i("flex items-center gap-2 text-xs leading-none select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==a||e[6]!==o?(l=(0,p.jsx)("label",{"data-slot":"label",className:o,...a}),e[5]=a,e[6]=o,e[7]=l):l=e[7],l}s(b,"m");export{b as a};
@@ -1 +1 @@
1
- import{a as le,d as ae,e as ke,i as Ne,j as we,l as Se}from"./chunk-I4AZTCAA.js";import"./chunk-Y2YLTUMD.js";import"./chunk-PFIATRRO.js";import"./chunk-LMCBMC2V.js";import"./chunk-QF743FSL.js";import{a as ye}from"./chunk-CLZSERWW.js";import"./chunk-IQ5CIBXJ.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import{a as ne}from"./chunk-SGIW3B4R.js";import"./chunk-2NUCBQFU.js";import{i as ue}from"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as re}from"./chunk-FOXLEMWC.js";import{b as oe}from"./chunk-26XOFIV4.js";import"./chunk-L27FKJTG.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-7MM2SI65.js";import{a as pe,e as ge}from"./chunk-QQENKHRS.js";import{n as fe}from"./chunk-F4ZN2DRL.js";import"./chunk-ZPQBVYNN.js";import{B as Y,s as me,x as he}from"./chunk-ITS5LMYJ.js";import"./chunk-PDBW6GTJ.js";import{a as qe}from"./chunk-A6TVTNKO.js";import{a as Ae,b as je}from"./chunk-ADABTCDI.js";import{a as c,d as te}from"./chunk-5PEAXTYQ.js";var z=te(qe(),1);var E=te(Ae(),1);var o=te(je(),1);var Le=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let a of r.nodes)(e===void 0||H(a)===e)&&t.add(a.id);if(e===void 0)return t;let l=new Set(t);for(let a of r.edges)d.has(a.kind)&&(t.has(a.from)&&l.add(a.to),t.has(a.to)&&l.add(a.from));return l},"Pe"),Ee=c((r,e,d,t)=>{let l=`lane:${r}`;return[{data:{label:e},id:l,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((a,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${a.detail??a.kind} \xB7 ${a.name}`,link:Pe(a)},extent:"parent",id:a.id,parentId:l,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let n of r.nodes)d.has(n.id)&&t.set(H(n),[...t.get(H(n))??[],n]);let l=[...r.modules.map(n=>({label:n.installed===!0?`${n.name} \xB7 ${e.componentLabel}`:n.name,lane:n.name})),{label:e.appLaneLabel,lane:Q}],a=[],i=0;for(let{label:n,lane:f}of l){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(a.push(...Ee(f,n,i,m)),i+=1)}let u=[];for(let n of r.edges)e.kinds.has(n.kind)&&d.has(n.from)&&d.has(n.to)&&u.push({animated:Me.has(n.kind),id:`${n.from}|${n.kind}|${n.to}`,label:n.kind,labelBgStyle:Fe,labelStyle:De,source:n.from,style:Be,target:n.to,type:"smoothstep"});return{edges:u,nodes:a}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),l;return e[0]!==t?(l=(0,o.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1],l},"qe"),Ie={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=ue(),{label:l,link:a}=d,i;e[0]!==a||e[1]!==t?(i=c(()=>{me(t(a))},"u"),e[0]=a,e[1]=t,e[2]=i):i=e[2];let u=i,n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,o.jsx)(ae,{isConnectable:!1,position:le.Left,style:Ie,type:"target"}),e[3]=n):n=e[3];let f;e[4]!==l||e[5]!==u?(f=(0,o.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:l}),e[4]=l,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,o.jsx)(ae,{isConnectable:!1,position:le.Right,style:Ie,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,o.jsxs)(o.Fragment,{children:[n,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),l,a,i,u,n,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");n=j(Q),u=pe,p="overflow-hidden py-0",i=ge,s="px-0",a=be,m="architecture-catalog";let I;e[13]!==t?(I=t("Module"),e[13]=t,e[14]=I):I=e[14];let L;e[15]!==I?(L=(0,o.jsx)(T,{children:I}),e[15]=I,e[16]=L):L=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,o.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,o.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,o.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==L||e[32]!==q?(h=(0,o.jsx)(xe,{children:(0,o.jsxs)(J,{children:[L,q,y,N]})}),e[29]=y,e[30]=N,e[31]=L,e[32]=q,e[33]=h):h=e[33],l=ve,f=d.modules.map(g=>(0,o.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,o.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,o.jsx)(oe,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,o.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,o.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,o.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=l,e[4]=a,e[5]=i,e[6]=u,e[7]=n,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else l=e[3],a=e[4],i=e[5],u=e[6],n=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==n||e[35]!==t?(b=n>0&&(0,o.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,o.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,o.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,o.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,o.jsx)(_,{className:"text-xs",children:n})]}),e[34]=n,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==l||e[38]!==f||e[39]!==b?(x=(0,o.jsxs)(l,{children:[f,b]}),e[37]=l,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==a||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,o.jsxs)(a,{"data-testid":m,children:[h,x]}),e[41]=a,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,o.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,o.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[l,a]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),n;e[0]!==d.edges?(n=c(w=>d.edges.some(X=>X.kind===w),"s"),e[0]=d.edges,e[1]=n):n=e[1];let f=Le.filter(n),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==l||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...l===ce?{}:{lane:l}}),e[6]=h,e[7]=p,e[8]=i,e[9]=l,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{a(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let I=j,L="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,o.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,o.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==l||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,o.jsxs)("select",{"aria-label":v,className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"architecture-module-filter",onChange:P,value:l,children:[k,N,M]}),e[26]=l,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,o.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,o.jsx)("button",{"aria-pressed":i.has(w),className:he("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{I(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,o.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,o.jsx)(Ne,{}),G=(0,o.jsx)(we,{showInteractive:!1}),K=(0,o.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,o.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,o.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,o.jsxs)("section",{className:L,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),l=fe(),a;e[0]!==l?(a=c(()=>l.fetchArchitecture(),"r"),e[0]=l,e[1]=a):a=e[1];let i=ye(d,a,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,o.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,o.jsx)(ne,{className:"h-8 w-48"}),(0,o.jsx)(ne,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,o.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,o.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,n,f;e[18]!==u?(n=(0,o.jsx)(We,{manifest:u}),f=(0,o.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=n,e[20]=f):(n=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,o.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,o.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,o.jsx)(oe,{variant:"outline",children:u.unresolved.length})]}),(0,o.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==n||e[25]!==f||e[26]!==m?(h=(0,o.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[n,f,m]}),e[24]=n,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Le)}c(Je,"We");function Qe(r){return(0,o.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,o.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
1
+ import{a as le,d as ae,e as ke,i as Ne,j as we,l as Se}from"./chunk-U5YP7MSK.js";import"./chunk-Y2YLTUMD.js";import"./chunk-QAETUNZX.js";import"./chunk-LMCBMC2V.js";import"./chunk-QF743FSL.js";import{a as ye}from"./chunk-4KVCH3A4.js";import"./chunk-IQ5CIBXJ.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import{a as ne}from"./chunk-HB2FLDDU.js";import"./chunk-2NUCBQFU.js";import{i as ue}from"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as re}from"./chunk-S3TDGFRE.js";import{b as oe}from"./chunk-UV6GPH2E.js";import"./chunk-L27FKJTG.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-J3ZEO3PJ.js";import{a as pe,e as ge}from"./chunk-TN4Z3P6S.js";import{n as fe}from"./chunk-UK5OOCLQ.js";import"./chunk-ZPQBVYNN.js";import{B as Y,s as me,x as he}from"./chunk-PN7JHEYW.js";import"./chunk-PDBW6GTJ.js";import{a as qe}from"./chunk-A6TVTNKO.js";import{a as Ae,b as je}from"./chunk-ADABTCDI.js";import{a as c,d as te}from"./chunk-5PEAXTYQ.js";var z=te(qe(),1);var E=te(Ae(),1);var o=te(je(),1);var Le=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let a of r.nodes)(e===void 0||H(a)===e)&&t.add(a.id);if(e===void 0)return t;let l=new Set(t);for(let a of r.edges)d.has(a.kind)&&(t.has(a.from)&&l.add(a.to),t.has(a.to)&&l.add(a.from));return l},"Pe"),Ee=c((r,e,d,t)=>{let l=`lane:${r}`;return[{data:{label:e},id:l,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((a,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${a.detail??a.kind} \xB7 ${a.name}`,link:Pe(a)},extent:"parent",id:a.id,parentId:l,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let n of r.nodes)d.has(n.id)&&t.set(H(n),[...t.get(H(n))??[],n]);let l=[...r.modules.map(n=>({label:n.installed===!0?`${n.name} \xB7 ${e.componentLabel}`:n.name,lane:n.name})),{label:e.appLaneLabel,lane:Q}],a=[],i=0;for(let{label:n,lane:f}of l){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(a.push(...Ee(f,n,i,m)),i+=1)}let u=[];for(let n of r.edges)e.kinds.has(n.kind)&&d.has(n.from)&&d.has(n.to)&&u.push({animated:Me.has(n.kind),id:`${n.from}|${n.kind}|${n.to}`,label:n.kind,labelBgStyle:Fe,labelStyle:De,source:n.from,style:Be,target:n.to,type:"smoothstep"});return{edges:u,nodes:a}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),l;return e[0]!==t?(l=(0,o.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1],l},"qe"),Ie={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=ue(),{label:l,link:a}=d,i;e[0]!==a||e[1]!==t?(i=c(()=>{me(t(a))},"u"),e[0]=a,e[1]=t,e[2]=i):i=e[2];let u=i,n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,o.jsx)(ae,{isConnectable:!1,position:le.Left,style:Ie,type:"target"}),e[3]=n):n=e[3];let f;e[4]!==l||e[5]!==u?(f=(0,o.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:l}),e[4]=l,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,o.jsx)(ae,{isConnectable:!1,position:le.Right,style:Ie,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,o.jsxs)(o.Fragment,{children:[n,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),l,a,i,u,n,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");n=j(Q),u=pe,p="overflow-hidden py-0",i=ge,s="px-0",a=be,m="architecture-catalog";let I;e[13]!==t?(I=t("Module"),e[13]=t,e[14]=I):I=e[14];let L;e[15]!==I?(L=(0,o.jsx)(T,{children:I}),e[15]=I,e[16]=L):L=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,o.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,o.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,o.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==L||e[32]!==q?(h=(0,o.jsx)(xe,{children:(0,o.jsxs)(J,{children:[L,q,y,N]})}),e[29]=y,e[30]=N,e[31]=L,e[32]=q,e[33]=h):h=e[33],l=ve,f=d.modules.map(g=>(0,o.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,o.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,o.jsx)(oe,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,o.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,o.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,o.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=l,e[4]=a,e[5]=i,e[6]=u,e[7]=n,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else l=e[3],a=e[4],i=e[5],u=e[6],n=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==n||e[35]!==t?(b=n>0&&(0,o.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,o.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,o.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,o.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,o.jsx)(_,{className:"text-xs",children:n})]}),e[34]=n,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==l||e[38]!==f||e[39]!==b?(x=(0,o.jsxs)(l,{children:[f,b]}),e[37]=l,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==a||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,o.jsxs)(a,{"data-testid":m,children:[h,x]}),e[41]=a,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,o.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,o.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[l,a]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),n;e[0]!==d.edges?(n=c(w=>d.edges.some(X=>X.kind===w),"s"),e[0]=d.edges,e[1]=n):n=e[1];let f=Le.filter(n),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==l||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...l===ce?{}:{lane:l}}),e[6]=h,e[7]=p,e[8]=i,e[9]=l,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{a(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let I=j,L="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,o.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,o.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==l||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,o.jsxs)("select",{"aria-label":v,className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"architecture-module-filter",onChange:P,value:l,children:[k,N,M]}),e[26]=l,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,o.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,o.jsx)("button",{"aria-pressed":i.has(w),className:he("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{I(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,o.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,o.jsx)(Ne,{}),G=(0,o.jsx)(we,{showInteractive:!1}),K=(0,o.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,o.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,o.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,o.jsxs)("section",{className:L,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),l=fe(),a;e[0]!==l?(a=c(()=>l.fetchArchitecture(),"r"),e[0]=l,e[1]=a):a=e[1];let i=ye(d,a,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,o.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,o.jsx)(ne,{className:"h-8 w-48"}),(0,o.jsx)(ne,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,o.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,o.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,n,f;e[18]!==u?(n=(0,o.jsx)(We,{manifest:u}),f=(0,o.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=n,e[20]=f):(n=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,o.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,o.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,o.jsx)(oe,{variant:"outline",children:u.unresolved.length})]}),(0,o.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==n||e[25]!==f||e[26]!==m?(h=(0,o.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[n,f,m]}),e[24]=n,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Le)}c(Je,"We");function Qe(r){return(0,o.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,o.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};