@lunora/studio 1.0.0-alpha.96 → 1.0.0-alpha.97
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.
- package/dist/standalone/{chunk-ESIEIGR3.js → chunk-2KRXOCZ2.js} +1 -1
- package/dist/standalone/{chunk-2YGNOZPZ.js → chunk-3626PHEZ.js} +1 -1
- package/dist/standalone/{chunk-2FRLB5SB.js → chunk-3IF75YS7.js} +1 -1
- package/dist/standalone/{chunk-44T6NSYY.js → chunk-3SGYSFRC.js} +1 -1
- package/dist/standalone/{chunk-WPERYUTG.js → chunk-4EHNOASW.js} +1 -1
- package/dist/standalone/{chunk-ZCPQGIQW.js → chunk-5A7NIX77.js} +1 -1
- package/dist/standalone/{chunk-34WN3PEC.js → chunk-5L2VKBAJ.js} +1 -1
- package/dist/standalone/{chunk-YOKL7XDT.js → chunk-5L63KFHD.js} +1 -1
- package/dist/standalone/{chunk-LZGOETI3.js → chunk-6F7KP54M.js} +1 -1
- package/dist/standalone/{chunk-DXJWFZFI.js → chunk-73B3T2SA.js} +1 -1
- package/dist/standalone/{chunk-VWKQ6X2S.js → chunk-7CWPU3LW.js} +1 -1
- package/dist/standalone/{chunk-IGBUUFPN.js → chunk-A6NAMYVS.js} +1 -1
- package/dist/standalone/{chunk-57BUSXRD.js → chunk-ATLV7KWK.js} +1 -1
- package/dist/standalone/{chunk-NSUBZT43.js → chunk-BLHSTFG3.js} +1 -1
- package/dist/standalone/{chunk-ETU7KIO4.js → chunk-C2ZFQARQ.js} +1 -1
- package/dist/standalone/{chunk-WQJOV6L5.js → chunk-CXBXUT5A.js} +2 -2
- package/dist/standalone/{chunk-HJC67CE4.js → chunk-D264UAKY.js} +1 -1
- package/dist/standalone/{chunk-AUXEGD24.js → chunk-DDO5EGID.js} +1 -1
- package/dist/standalone/{chunk-QNQTMABQ.js → chunk-E3Z4QXAD.js} +1 -1
- package/dist/standalone/{chunk-I7FF5IIJ.js → chunk-EZKBI7SZ.js} +1 -1
- package/dist/standalone/{chunk-UZHRBXA7.js → chunk-FHZ5WDTU.js} +1 -1
- package/dist/standalone/{chunk-WOBRLIBX.js → chunk-FXBBFE7Y.js} +1 -1
- package/dist/standalone/{chunk-BAJXBWFJ.js → chunk-G2O3XP7Y.js} +1 -1
- package/dist/standalone/{chunk-BLJANR7J.js → chunk-H5ZYPSLB.js} +1 -1
- package/dist/standalone/{chunk-J4POSI6T.js → chunk-HH5CZ6KD.js} +1 -1
- package/dist/standalone/{chunk-UE6A3CRB.js → chunk-I7V54EDS.js} +1 -1
- package/dist/standalone/{chunk-EYIEO5QZ.js → chunk-II64XEZV.js} +1 -1
- package/dist/standalone/{chunk-TKFI6XYV.js → chunk-IZFPJXB3.js} +1 -1
- package/dist/standalone/{chunk-D7B2KFWM.js → chunk-J4UYSDWF.js} +1 -1
- package/dist/standalone/{chunk-TVRCPIAV.js → chunk-JNY7CFF4.js} +1 -1
- package/dist/standalone/{chunk-TAWXVVAZ.js → chunk-KP6VHTO4.js} +1 -1
- package/dist/standalone/{chunk-CFXL7MQK.js → chunk-LAEO6D34.js} +1 -1
- package/dist/standalone/{chunk-QVPKPH2T.js → chunk-LHAHIDNT.js} +1 -1
- package/dist/standalone/{chunk-LT236J7E.js → chunk-M2M3RYJU.js} +1 -1
- package/dist/standalone/{chunk-KGPNIBOV.js → chunk-M3Z2YAHD.js} +1 -1
- package/dist/standalone/{chunk-TGQH54CS.js → chunk-MW5YIENZ.js} +1 -1
- package/dist/standalone/{chunk-2IFGRS6R.js → chunk-NBANYYGB.js} +1 -1
- package/dist/standalone/{chunk-3WISGFZ7.js → chunk-NCKRVNF2.js} +1 -1
- package/dist/standalone/{chunk-JRAUQ4L2.js → chunk-NDO6YSEG.js} +1 -1
- package/dist/standalone/{chunk-DGO2XJOT.js → chunk-NJRW66LJ.js} +1 -1
- package/dist/standalone/{chunk-LV5UVTHL.js → chunk-OKZP3YY3.js} +1 -1
- package/dist/standalone/{chunk-NQ4FA65F.js → chunk-ON2FIVI2.js} +1 -1
- package/dist/standalone/{chunk-U7ILDM43.js → chunk-OQIGV6FX.js} +1 -1
- package/dist/standalone/{chunk-E2C6CK7F.js → chunk-OZA2RA45.js} +1 -1
- package/dist/standalone/{chunk-YEGFNH56.js → chunk-P33WK7YI.js} +1 -1
- package/dist/standalone/{chunk-LZ2RREQV.js → chunk-PKWJ7UOG.js} +1 -1
- package/dist/standalone/{chunk-GL7YL3VF.js → chunk-PLFTCTMX.js} +1 -1
- package/dist/standalone/{chunk-Q2QILUP4.js → chunk-PMGTIUU2.js} +1 -1
- package/dist/standalone/{chunk-SFQX7RUJ.js → chunk-QC4T2L6I.js} +1 -1
- package/dist/standalone/{chunk-U5MIBWJD.js → chunk-QEVFPILV.js} +1 -1
- package/dist/standalone/{chunk-ECF57FQF.js → chunk-QQYX5WN4.js} +1 -1
- package/dist/standalone/{chunk-7URLLMST.js → chunk-S7ZOM3NK.js} +1 -1
- package/dist/standalone/{chunk-AQZMKZMP.js → chunk-SPE3AB54.js} +1 -1
- package/dist/standalone/{chunk-7KU3LR7G.js → chunk-STESBRLN.js} +1 -1
- package/dist/standalone/{chunk-ZURV2PEP.js → chunk-SZXVX6PY.js} +1 -1
- package/dist/standalone/{chunk-OZK52CH2.js → chunk-UYPXC3OO.js} +1 -1
- package/dist/standalone/{chunk-3PXUIMP2.js → chunk-VH2IO643.js} +1 -1
- package/dist/standalone/{chunk-BMYWOK5Q.js → chunk-WLXH4ECM.js} +1 -1
- package/dist/standalone/{chunk-2NO45MRI.js → chunk-XPOUF2XH.js} +1 -1
- package/dist/standalone/{chunk-MVJMAEP4.js → chunk-YP7WZ6YM.js} +1 -1
- package/dist/standalone/{chunk-FA6AR5QU.js → chunk-YZIR7PL5.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as X}from"./chunk-QWGT25SE.js";import{a as Le}from"./chunk-ZJGP6EKR.js";import{b as Se}from"./chunk-AVAC26HJ.js";import{a as de}from"./chunk-XF2B7P5A.js";import{a as Ce}from"./chunk-IGCNMZSB.js";import{a as ie}from"./chunk-FURI47Z2.js";import{a as be}from"./chunk-3CWGJYBB.js";import{a as ve}from"./chunk-RMN2JN4S.js";import{b as pe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as D}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ge}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as J}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as xe}from"./chunk-3WISGFZ7.js";import"./chunk-XXQUMVWH.js";import"./chunk-DGO2XJOT.js";import"./chunk-QLQADHFE.js";import{a as se}from"./chunk-VDW32UET.js";import{c as oe}from"./chunk-LZGOETI3.js";import{f as he}from"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as Z}from"./chunk-XQCVZAGU.js";import{a as ye,b as we,c as Ne,d as ne,e as U,f as z}from"./chunk-WJQLNYGX.js";import{d as B,h as le,i as fe,o as ae}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as N,e as re,f as Ee,g as Ke,h as Me,j as G}from"./chunk-3XIESWL4.js";var _=re(Ke(),1);var T=re(Ee(),1);var r=re(Me(),1);var ue=["trace","debug","log","info","warn","error","fatal"],_e="LOG_ARCHIVE_NOT_CONFIGURED",Re={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},$e={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},Ae=N((c,e)=>{switch(e.type){case"append":return{...c,cursor:e.cursor,error:null,loading:!1,rows:[...c.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...c,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...c,error:e.message,loading:!1};default:return c}},"Ke"),Oe=N(c=>{let e=(0,_.c)(33),{row:t}=c,s;e[0]!==t.fields?(s=X(t.fields),e[0]=t.fields,e[1]=s):s=e[1];let i=s,o=`lg-archive-row-${String(t.ts)}`,m;e[2]!==t.ts?(m=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=m):m=e[3];let p;e[4]!==m?(p=(0,r.jsx)(z,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:m}),e[4]=m,e[5]=p):p=e[5];let f=Re[t.level],n;e[6]!==t.level||e[7]!==f?(n=(0,r.jsx)(z,{children:(0,r.jsx)(J,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=n):n=e[8];let l;e[9]!==t.functionPath?(l=(0,r.jsx)(z,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=l):l=e[10];let v;e[11]!==t.message?(v=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=v):v=e[12];let a;e[13]!==i?(a=i!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i}),e[13]=i,e[14]=a):a=e[14];let d;e[15]!==v||e[16]!==a?(d=(0,r.jsxs)(z,{className:"max-w-md",children:[v,a]}),e[15]=v,e[16]=a,e[17]=d):d=e[17];let u=t.traceId??"\u2014",h;e[18]!==u?(h=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:u}),e[18]=u,e[19]=h):h=e[19];let b=t.shardKey??"\u2014",g;e[20]!==b?(g=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:b}),e[20]=b,e[21]=g):g=e[21];let x=t.userId??"\u2014",y;e[22]!==x?(y=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[22]=x,e[23]=y):y=e[23];let S;return e[24]!==d||e[25]!==h||e[26]!==g||e[27]!==y||e[28]!==o||e[29]!==p||e[30]!==n||e[31]!==l?(S=(0,r.jsxs)(ne,{"data-testid":o,children:[p,n,l,d,h,g,y]}),e[24]=d,e[25]=h,e[26]=g,e[27]=y,e[28]=o,e[29]=p,e[30]=n,e[31]=l,e[32]=S):S=e[32],S},"Ue"),De=N(({shardKey:c})=>{let e=he(),t=B(),[s,i]=(0,T.useState)(""),[o,m]=(0,T.useState)(""),[p,f]=(0,T.useState)(""),[{cursor:n,error:l,loading:v,notConfigured:a,rows:d},u]=(0,T.useReducer)(Ae,$e),h=ie(s.trim(),400),b=ie(o.trim(),400),g={...h===""?{}:{functionPathPrefix:h},...p===""?{}:{minLevel:p},...c===""?{}:{shardKey:c},...b===""?{}:{userId:b}},x=JSON.stringify(g),y=(0,T.useRef)(x);(0,T.useEffect)(()=>{let w={cancelled:!1};return y.current=x,ae((async()=>{u({type:"loading"});try{let C=await e.queryLogArchive(g);w.cancelled||u({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){w.cancelled||u(fe(C)===_e?{type:"notConfigured"}:{message:le(C),type:"failed"})}})()),()=>{w.cancelled=!0}},[e,x]);let S=N(async()=>{if(n===void 0)return;let w=x;u({type:"loading"});try{let C=await e.queryLogArchive({...g,cursor:n});y.current===w&&u({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===w&&u({message:le(C),type:"pageFailed"})}},"C"),R=N(w=>{i(w.target.value)},"$"),L=N(w=>{m(w.target.value)},"L"),k=N(w=>{f(w.target.value)},"S"),I=N(()=>{ae(S())},"R");return a?(0,r.jsx)(Z,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:s}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:L,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:k,value:p,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),ue.map(w=>(0,r.jsx)("option",{value:w,children:w},w))]})]}),l!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:l}),v&&d===null&&l===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),d!==null&&d.length===0&&(0,r.jsx)(Z,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),d!==null&&d.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(ye,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(we,{children:(0,r.jsxs)(ne,{children:[(0,r.jsx)(U,{children:t("Time")}),(0,r.jsx)(U,{children:t("Level")}),(0,r.jsx)(U,{children:t("Function")}),(0,r.jsx)(U,{children:t("Message")}),(0,r.jsx)(U,{children:t("Trace")}),(0,r.jsx)(U,{children:t("Shard")}),(0,r.jsx)(U,{children:t("User")})]})}),(0,r.jsx)(Ne,{children:d.map((w,C)=>(0,r.jsx)(Oe,{row:w},`${String(w.ts)}-${String(C)}`))})]})}),n!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(ge,{"data-testid":"lg-archive-more",disabled:v,onClick:I,size:"sm",variant:"outline",children:t(v?"Loading\u2026":"Load more")})})]})},"De"),Ue=N(c=>{let e=(0,_.c)(11),{level:t,onToggle:s,selected:i}=c,o;e[0]!==t||e[1]!==s?(o=N(()=>{s(t)},"o"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let m=o,p=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",f;e[3]!==p?(f=G("rounded-md border px-2 py-1 text-xs",p),e[3]=p,e[4]=f):f=e[4];let n=`logs-level-${t}`,l;return e[5]!==t||e[6]!==m||e[7]!==i||e[8]!==f||e[9]!==n?(l=(0,r.jsx)("button",{"aria-pressed":i,className:f,"data-testid":n,onClick:m,type:"button",children:t}),e[5]=t,e[6]=m,e[7]=i,e[8]=f,e[9]=n,e[10]=l):l=e[10],l},"Ve"),ze=N(c=>{let e=(0,_.c)(68),{levelFilter:t,onLogPathChange:s,onSearchChange:i,onTimeRangeChange:o,onToggleLevel:m,onToggleSummary:p,pathFilter:f,search:n,showSummary:l,timeRange:v}=c,a=B(),d;e[0]!==a?(d=a("Search messages"),e[0]=a,e[1]=d):d=e[1];let u;e[2]!==a?(u=a("search message"),e[2]=a,e[3]=u):u=e[3];let h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==u?(h=(0,r.jsx)(D,{"aria-label":d,className:"h-8 w-48","data-testid":"lg-search",onChange:i,placeholder:u,value:n}),e[4]=i,e[5]=n,e[6]=d,e[7]=u,e[8]=h):h=e[8];let b;e[9]!==a?(b=a("Function path"),e[9]=a,e[10]=b):b=e[10];let g;e[11]!==a?(g=a("filter path"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==s||e[14]!==f||e[15]!==b||e[16]!==g?(x=(0,r.jsx)(D,{"aria-label":b,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:s,placeholder:g,value:f}),e[13]=s,e[14]=f,e[15]=b,e[16]=g,e[17]=x):x=e[17];let y;e[18]!==a?(y=a("Level filter"),e[18]=a,e[19]=y):y=e[19];let S;e[20]!==t||e[21]!==m?(S=ue.map(j=>(0,r.jsx)(Ue,{level:j,onToggle:m,selected:t.has(j)},j)),e[20]=t,e[21]=m,e[22]=S):S=e[22];let R;e[23]!==y||e[24]!==S?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:S}),e[23]=y,e[24]=S,e[25]=R):R=e[25];let L;e[26]!==a?(L=a("Time range"),e[26]=a,e[27]=L):L=e[27];let k;e[28]!==a?(k=a("All time"),e[28]=a,e[29]=k):k=e[29];let I;e[30]!==k?(I=(0,r.jsx)("option",{value:"all",children:k}),e[30]=k,e[31]=I):I=e[31];let w;e[32]!==a?(w=a("Last 5m"),e[32]=a,e[33]=w):w=e[33];let C;e[34]!==w?(C=(0,r.jsx)("option",{value:"5m",children:w}),e[34]=w,e[35]=C):C=e[35];let q;e[36]!==a?(q=a("Last 15m"),e[36]=a,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let E;e[40]!==a?(E=a("Last hour"),e[40]=a,e[41]=E):E=e[41];let K;e[42]!==E?(K=(0,r.jsx)("option",{value:"1h",children:E}),e[42]=E,e[43]=K):K=e[43];let $;e[44]!==o||e[45]!==L||e[46]!==I||e[47]!==C||e[48]!==F||e[49]!==K||e[50]!==v?($=(0,r.jsxs)("select",{"aria-label":L,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:v,children:[I,C,F,K]}),e[44]=o,e[45]=L,e[46]=I,e[47]=C,e[48]=F,e[49]=K,e[50]=v,e[51]=$):$=e[51];let V=l?"border-border bg-muted font-medium":"border-input text-muted-foreground",O;e[52]!==V?(O=G("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=O):O=e[53];let A;e[54]!==l||e[55]!==a?(A=a(l?"List":"Summary"),e[54]=l,e[55]=a,e[56]=A):A=e[56];let M;e[57]!==p||e[58]!==l||e[59]!==O||e[60]!==A?(M=(0,r.jsx)("button",{"aria-pressed":l,className:O,"data-testid":"logs-summary-toggle",onClick:p,type:"button",children:A}),e[57]=p,e[58]=l,e[59]=O,e[60]=A,e[61]=M):M=e[61];let W;return e[62]!==$||e[63]!==M||e[64]!==h||e[65]!==x||e[66]!==R?(W=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[h,x,R,$,M]}),e[62]=$,e[63]=M,e[64]=h,e[65]=x,e[66]=R,e[67]=W):W=e[67],W},"je"),je=N(c=>{let e=(0,_.c)(53),{onOutcomeChange:t,onPathChange:s,onTableChange:i,onUserChange:o,outcomeFilter:m,pathPrefix:p,tableFilter:f,userIdFilter:n}=c,l=B(),v;e[0]!==l?(v=l("Function path"),e[0]=l,e[1]=v):v=e[1];let a;e[2]!==l?(a=l("file:function"),e[2]=l,e[3]=a):a=e[3];let d;e[4]!==s||e[5]!==p||e[6]!==v||e[7]!==a?(d=(0,r.jsx)(D,{"aria-label":v,className:"h-8 w-44","data-testid":"lg-req-path",onChange:s,placeholder:a,value:p}),e[4]=s,e[5]=p,e[6]=v,e[7]=a,e[8]=d):d=e[8];let u;e[9]!==l?(u=l("User id"),e[9]=l,e[10]=u):u=e[10];let h;e[11]!==l?(h=l("userId"),e[11]=l,e[12]=h):h=e[12];let b;e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==n?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:h,value:n}),e[13]=o,e[14]=u,e[15]=h,e[16]=n,e[17]=b):b=e[17];let g;e[18]!==l?(g=l("Table touched"),e[18]=l,e[19]=g):g=e[19];let x;e[20]!==l?(x=l("table"),e[20]=l,e[21]=x):x=e[21];let y;e[22]!==i||e[23]!==g||e[24]!==x||e[25]!==f?(y=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-table",onChange:i,placeholder:x,value:f}),e[22]=i,e[23]=g,e[24]=x,e[25]=f,e[26]=y):y=e[26];let S;e[27]!==l?(S=l("Outcome filter"),e[27]=l,e[28]=S):S=e[28];let R;e[29]!==l?(R=l("all"),e[29]=l,e[30]=R):R=e[30];let L;e[31]!==R?(L=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=L):L=e[32];let k;e[33]!==l?(k=l("ok"),e[33]=l,e[34]=k):k=e[34];let I;e[35]!==k?(I=(0,r.jsx)("option",{value:"ok",children:k}),e[35]=k,e[36]=I):I=e[36];let w;e[37]!==l?(w=l("error"),e[37]=l,e[38]=w):w=e[38];let C;e[39]!==w?(C=(0,r.jsx)("option",{value:"error",children:w}),e[39]=w,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==m||e[43]!==S||e[44]!==L||e[45]!==I||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":S,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:m,children:[L,I,C]}),e[41]=t,e[42]=m,e[43]=S,e[44]=L,e[45]=I,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==d||e[50]!==b||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[d,b,y,q]}),e[48]=q,e[49]=d,e[50]=b,e[51]=y,e[52]=F):F=e[52],F},"Be"),Ie=N(c=>{let e=(0,_.c)(7),{bucket:t}=c,s;e[0]!==t.key?(s=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=s):s=e[1];let i;e[2]!==t.count?(i=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=i):i=e[3];let o;return e[4]!==s||e[5]!==i?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[s,i]}),e[4]=s,e[5]=i,e[6]=o):o=e[6],o},"ve"),Be=N(c=>{let e=(0,_.c)(31),{summary:t}=c,s=B(),i;e[0]!==t.total||e[1]!==s?(i=s("{count} entries",{count:t.total}),e[0]=t.total,e[1]=s,e[2]=i):i=e[2];let o;e[3]!==i?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:i}),e[3]=i,e[4]=o):o=e[4];let m;e[5]!==s?(m=s("By level"),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==m?(p=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:m}),e[7]=m,e[8]=p):p=e[8];let f;e[9]!==t.byLevel?(f=t.byLevel.map(We),e[9]=t.byLevel,e[10]=f):f=e[10];let n;e[11]!==f?(n=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:f}),e[11]=f,e[12]=n):n=e[12];let l;e[13]!==p||e[14]!==n?(l=(0,r.jsxs)("div",{children:[p,n]}),e[13]=p,e[14]=n,e[15]=l):l=e[15];let v;e[16]!==s?(v=s("By function"),e[16]=s,e[17]=v):v=e[17];let a;e[18]!==v?(a=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[18]=v,e[19]=a):a=e[19];let d;e[20]!==t.byPath?(d=t.byPath.map(Ge),e[20]=t.byPath,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:d}),e[22]=d,e[23]=u):u=e[23];let h;e[24]!==u||e[25]!==a?(h=(0,r.jsxs)("div",{children:[a,u]}),e[24]=u,e[25]=a,e[26]=h):h=e[26];let b;return e[27]!==h||e[28]!==o||e[29]!==l?(b=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,l,h]}),e[27]=h,e[28]=o,e[29]=l,e[30]=b):b=e[30],b},"ze");function We(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(We,"Ge");function Ge(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(Ge,"We");var Ve=N(c=>{let e=(0,_.c)(46),{liveError:t,onShardKeyChange:s,onShowArchive:i,onShowErrors:o,onShowRequests:m,shardKey:p,view:f}=c,n=B(),l=f==="requests",v=f==="requests"?"bg-muted font-medium":"text-muted-foreground",a;e[0]!==v?(a=G("px-3 py-1 text-sm",v),e[0]=v,e[1]=a):a=e[1];let d;e[2]!==n?(d=n("Requests"),e[2]=n,e[3]=d):d=e[3];let u;e[4]!==m||e[5]!==l||e[6]!==a||e[7]!==d?(u=(0,r.jsx)("button",{"aria-selected":l,className:a,"data-testid":"lg-view-requests",onClick:m,role:"tab",type:"button",children:d}),e[4]=m,e[5]=l,e[6]=a,e[7]=d,e[8]=u):u=e[8];let h=f==="errors",b=f==="errors"?"bg-muted font-medium":"text-muted-foreground",g;e[9]!==b?(g=G("px-3 py-1 text-sm",b),e[9]=b,e[10]=g):g=e[10];let x;e[11]!==n?(x=n("Errors"),e[11]=n,e[12]=x):x=e[12];let y;e[13]!==o||e[14]!==h||e[15]!==g||e[16]!==x?(y=(0,r.jsx)("button",{"aria-selected":h,className:g,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:x}),e[13]=o,e[14]=h,e[15]=g,e[16]=x,e[17]=y):y=e[17];let S=f==="archive",R=f==="archive"?"bg-muted font-medium":"text-muted-foreground",L;e[18]!==R?(L=G("px-3 py-1 text-sm",R),e[18]=R,e[19]=L):L=e[19];let k;e[20]!==n?(k=n("Archive"),e[20]=n,e[21]=k):k=e[21];let I;e[22]!==i||e[23]!==S||e[24]!==L||e[25]!==k?(I=(0,r.jsx)("button",{"aria-selected":S,className:L,"data-testid":"lg-view-archive",onClick:i,role:"tab",type:"button",children:k}),e[22]=i,e[23]=S,e[24]=L,e[25]=k,e[26]=I):I=e[26];let w;e[27]!==y||e[28]!==I||e[29]!==u?(w=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[u,y,I]}),e[27]=y,e[28]=I,e[29]=u,e[30]=w):w=e[30];let C;e[31]!==s||e[32]!==p?(C=(0,r.jsx)(ve,{onChange:s,testId:"lg-shard-input",value:p}),e[31]=s,e[32]=p,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==f?(q=f!=="archive"&&(0,r.jsx)(Ce,{message:t,prefix:"lg"}),e[34]=t,e[35]=f,e[36]=q):q=e[36];let F;e[37]!==n?(F=n("Open in Cloudflare"),e[37]=n,e[38]=F):F=e[38];let E;e[39]!==F?(E=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=E):E=e[40];let K;return e[41]!==w||e[42]!==C||e[43]!==q||e[44]!==E?(K=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[w,C,q,E]}),e[41]=w,e[42]=C,e[43]=q,e[44]=E,e[45]=K):K=e[45],K},"Qe"),ce=400,Qe=36,Ye={height:ce,overflow:"auto"},Te={left:0,position:"absolute",top:0,width:"100%"},He={error:"destructive",ok:"secondary"},Je=N(c=>{let e=(0,_.c)(26),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.fields?(n=X(t.fields),e[2]=t.fields,e[3]=n):n=e[3];let l=n,v;e[4]!==t.timestamp?(v=new Date(t.timestamp).toLocaleString(),e[4]=t.timestamp,e[5]=v):v=e[5];let a;e[6]!==v?(a=(0,r.jsx)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:v}),e[6]=v,e[7]=a):a=e[7];let d=Re[t.level],u;e[8]!==t.level||e[9]!==d?(u=(0,r.jsx)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:d,children:t.level})}),e[8]=t.level,e[9]=d,e[10]=u):u=e[10];let h=t.functionPath??"\u2014",b;e[11]!==h?(b=(0,r.jsx)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:h}),e[11]=h,e[12]=b):b=e[12];let g;e[13]!==l?(g=l===""?null:(0,r.jsx)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:l}),e[13]=l,e[14]=g):g=e[14];let x;e[15]!==t.message||e[16]!==g?(x=(0,r.jsxs)("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,g]}),e[15]=t.message,e[16]=g,e[17]=x):x=e[17];let y;return e[18]!==s||e[19]!==i||e[20]!==f||e[21]!==x||e[22]!==a||e[23]!==u||e[24]!==b?(y=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-row",ref:i,role:"row",style:f,children:[a,u,b,x]}),e[18]=s,e[19]=i,e[20]=f,e[21]=x,e[22]=a,e[23]=u,e[24]=b,e[25]=y):y=e[25],y},"Xe"),ke=N(c=>c.length===0?"\u2014":c.join(", "),"ce"),Ze=N(c=>{let e=(0,_.c)(37),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.ts?(n=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=n):n=e[3];let l;e[4]!==n?(l=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:n}),e[4]=n,e[5]=l):l=e[5];let v=He[t.outcome],a;e[6]!==t.outcome||e[7]!==v?(a=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:v,children:t.outcome})}),e[6]=t.outcome,e[7]=v,e[8]=a):a=e[8];let d;e[9]!==t.functionPath?(d=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=d):d=e[10];let u=t.shardKey??"\u2014",h;e[11]!==u?(h=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[11]=u,e[12]=h):h=e[12];let b=t.userId??"\u2014",g;e[13]!==b?(g=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[13]=b,e[14]=g):g=e[14];let x;e[15]!==t.durationMs?(x=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=x):x=e[16];let y=`${String(x)}ms`,S;e[17]!==y?(S=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:y}),e[17]=y,e[18]=S):S=e[18];let R;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(R=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${ke(t.tablesRead)} \xB7 w:${ke(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=R):R=e[23];let L;e[24]!==R?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:R}),e[24]=R,e[25]=L):L=e[25];let k;return e[26]!==s||e[27]!==i||e[28]!==f||e[29]!==g||e[30]!==S||e[31]!==L||e[32]!==l||e[33]!==a||e[34]!==d||e[35]!==h?(k=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-req-row",ref:i,role:"row",style:f,children:[l,a,d,h,g,S,L]}),e[26]=s,e[27]=i,e[28]=f,e[29]=g,e[30]=S,e[31]=L,e[32]=l,e[33]=a,e[34]=d,e[35]=h,e[36]=k):k=e[36],k},"Ze"),Pe=N(c=>{let{entries:e}=c??{};return Array.isArray(e)?e:[]},"ue"),Xe=N(c=>{let e={};return c.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=c.functionPathPrefix.trim()),c.userId.trim()!==""&&(e.userId=c.userId.trim()),c.tableTouched.trim()!==""&&(e.tableTouched=c.tableTouched.trim()),(c.outcome==="ok"||c.outcome==="error")&&(e.outcome=c.outcome),e},"et"),et={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},tt=N((c,e)=>{let t=e.search.trim().toLowerCase(),s=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-et[e.range];return c.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<i||s!==""&&!(o.functionPath??"").toLowerCase().includes(s)?!1:t===""||o.message.toLowerCase().includes(t)||X(o.fields).toLowerCase().includes(t))},"rt"),rt="\u2014",lt=N(c=>{let e=new Map,t=new Map;for(let o of c){e.set(o.level,(e.get(o.level)??0)+1);let m=o.functionPath??rt;t.set(m,(t.get(m)??0)+1)}let s=ue.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),i=[...t.entries()].map(([o,m])=>({count:m,key:o})).toSorted((o,m)=>m.count===o.count?o.key.localeCompare(m.key):m.count-o.count);return{byLevel:s,byPath:i,total:c.length}},"at"),Lt=N(({initialShardKey:c})=>{let e=B(),[t,s]=(0,T.useState)("requests"),{queryShardKey:i,setShardKey:o,shardKey:m}=be(c),[p,f]=(0,T.useState)(""),[n,l]=(0,T.useState)(()=>new Set),[v,a]=(0,T.useState)(""),[d,u]=(0,T.useState)("all"),[h,b]=(0,T.useState)(!1),[g,x]=(0,T.useState)(""),[y,S]=(0,T.useState)(""),[R,L]=(0,T.useState)(""),[k,I]=(0,T.useState)("all"),w=Xe({functionPathPrefix:g,outcome:k,tableTouched:R,userId:y}),C=oe(se.getRequestLog,w,{enabled:t==="requests",live:!0,shardKey:i}),q=oe(se.getLogs,{},{enabled:t==="errors",live:!0,shardKey:i}),F=t==="requests"?C:q,{error:E,errorSource:K,isLoading:$,liveError:V}=F,O=Pe(q.data),A=Pe(C.data);(0,T.useEffect)(()=>{F.data!==void 0&&pe(i)},[F.data,i]);let M=tt(O,{levels:n,now:Date.now(),path:v,range:d,search:p}),W=lt(M),j=t==="requests"?A.length:M.length,ee=t==="errors"&&h,Q=(0,T.useMemo)(()=>E!==null?"error":j===0?$?ee?"summary":"list":"empty":ee?"summary":"list",[j,$,E,ee]),me=(0,T.useRef)(null),Y=Se({count:j,estimateSize:N(()=>Qe,"estimateSize"),getScrollElement:N(()=>me.current,"getScrollElement"),initialRect:{height:ce,width:800},observeElementRect:N((P,te)=>Le(P,te,ce),"observeElementRect"),overscan:8}),qe=Y.getVirtualItems(),Fe={height:Y.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Ve,{liveError:V,onShardKeyChange:o,onShowArchive:N(()=>{s("archive"),b(!1)},"onShowArchive"),onShowErrors:N(()=>{s("errors"),b(!1)},"onShowErrors"),onShowRequests:N(()=>{s("requests"),b(!1)},"onShowRequests"),shardKey:m,view:t}),t==="errors"&&(0,r.jsx)(ze,{levelFilter:n,onLogPathChange:N(P=>{a(P.target.value)},"onLogPathChange"),onSearchChange:N(P=>{f(P.target.value)},"onSearchChange"),onTimeRangeChange:N(P=>{u(P.target.value)},"onTimeRangeChange"),onToggleLevel:N(P=>{l(te=>{let H=new Set(te);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:N(()=>{b(P=>!P)},"onToggleSummary"),pathFilter:v,search:p,showSummary:h,timeRange:d}),t==="requests"&&(0,r.jsx)(je,{onOutcomeChange:N(P=>{I(P.target.value)},"onOutcomeChange"),onPathChange:N(P=>{x(P.target.value)},"onPathChange"),onTableChange:N(P=>{L(P.target.value)},"onTableChange"),onUserChange:N(P=>{S(P.target.value)},"onUserChange"),outcomeFilter:k,pathPrefix:g,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(De,{shardKey:i}):(0,r.jsxs)(r.Fragment,{children:[Q==="error"&&(0,r.jsx)(xe,{error:K,testId:"lg-error"}),Q==="empty"&&(0,r.jsx)(Z,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Q==="summary"&&(0,r.jsx)(Be,{summary:W}),Q==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:me,style:Ye,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Fe,children:qe.map(P=>t==="requests"?(0,r.jsx)(Ze,{entry:A[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key):(0,r.jsx)(Je,{entry:M[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key))})})]})]})},"Pt");export{Lt as LogsPanel,tt as filterLogs,lt as summarizeLogs};
|
|
1
|
+
import{a as X}from"./chunk-QWGT25SE.js";import{a as Le}from"./chunk-ZJGP6EKR.js";import{b as Se}from"./chunk-AVAC26HJ.js";import{a as de}from"./chunk-XF2B7P5A.js";import{a as Ce}from"./chunk-IGCNMZSB.js";import{a as ie}from"./chunk-FURI47Z2.js";import{a as be}from"./chunk-3CWGJYBB.js";import{a as ve}from"./chunk-RMN2JN4S.js";import{b as pe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as D}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ge}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as J}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as xe}from"./chunk-NCKRVNF2.js";import"./chunk-XXQUMVWH.js";import"./chunk-NJRW66LJ.js";import"./chunk-QLQADHFE.js";import{a as se}from"./chunk-VDW32UET.js";import{c as oe}from"./chunk-6F7KP54M.js";import{f as he}from"./chunk-C2ZFQARQ.js";import"./chunk-XBDKZZ67.js";import{a as Z}from"./chunk-XQCVZAGU.js";import{a as ye,b as we,c as Ne,d as ne,e as U,f as z}from"./chunk-WJQLNYGX.js";import{d as B,h as le,i as fe,o as ae}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as N,e as re,f as Ee,g as Ke,h as Me,j as G}from"./chunk-3XIESWL4.js";var _=re(Ke(),1);var T=re(Ee(),1);var r=re(Me(),1);var ue=["trace","debug","log","info","warn","error","fatal"],_e="LOG_ARCHIVE_NOT_CONFIGURED",Re={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},$e={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},Ae=N((c,e)=>{switch(e.type){case"append":return{...c,cursor:e.cursor,error:null,loading:!1,rows:[...c.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...c,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...c,error:e.message,loading:!1};default:return c}},"Ke"),Oe=N(c=>{let e=(0,_.c)(33),{row:t}=c,s;e[0]!==t.fields?(s=X(t.fields),e[0]=t.fields,e[1]=s):s=e[1];let i=s,o=`lg-archive-row-${String(t.ts)}`,m;e[2]!==t.ts?(m=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=m):m=e[3];let p;e[4]!==m?(p=(0,r.jsx)(z,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:m}),e[4]=m,e[5]=p):p=e[5];let f=Re[t.level],n;e[6]!==t.level||e[7]!==f?(n=(0,r.jsx)(z,{children:(0,r.jsx)(J,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=n):n=e[8];let l;e[9]!==t.functionPath?(l=(0,r.jsx)(z,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=l):l=e[10];let v;e[11]!==t.message?(v=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=v):v=e[12];let a;e[13]!==i?(a=i!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i}),e[13]=i,e[14]=a):a=e[14];let d;e[15]!==v||e[16]!==a?(d=(0,r.jsxs)(z,{className:"max-w-md",children:[v,a]}),e[15]=v,e[16]=a,e[17]=d):d=e[17];let u=t.traceId??"\u2014",h;e[18]!==u?(h=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:u}),e[18]=u,e[19]=h):h=e[19];let b=t.shardKey??"\u2014",g;e[20]!==b?(g=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:b}),e[20]=b,e[21]=g):g=e[21];let x=t.userId??"\u2014",y;e[22]!==x?(y=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[22]=x,e[23]=y):y=e[23];let S;return e[24]!==d||e[25]!==h||e[26]!==g||e[27]!==y||e[28]!==o||e[29]!==p||e[30]!==n||e[31]!==l?(S=(0,r.jsxs)(ne,{"data-testid":o,children:[p,n,l,d,h,g,y]}),e[24]=d,e[25]=h,e[26]=g,e[27]=y,e[28]=o,e[29]=p,e[30]=n,e[31]=l,e[32]=S):S=e[32],S},"Ue"),De=N(({shardKey:c})=>{let e=he(),t=B(),[s,i]=(0,T.useState)(""),[o,m]=(0,T.useState)(""),[p,f]=(0,T.useState)(""),[{cursor:n,error:l,loading:v,notConfigured:a,rows:d},u]=(0,T.useReducer)(Ae,$e),h=ie(s.trim(),400),b=ie(o.trim(),400),g={...h===""?{}:{functionPathPrefix:h},...p===""?{}:{minLevel:p},...c===""?{}:{shardKey:c},...b===""?{}:{userId:b}},x=JSON.stringify(g),y=(0,T.useRef)(x);(0,T.useEffect)(()=>{let w={cancelled:!1};return y.current=x,ae((async()=>{u({type:"loading"});try{let C=await e.queryLogArchive(g);w.cancelled||u({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){w.cancelled||u(fe(C)===_e?{type:"notConfigured"}:{message:le(C),type:"failed"})}})()),()=>{w.cancelled=!0}},[e,x]);let S=N(async()=>{if(n===void 0)return;let w=x;u({type:"loading"});try{let C=await e.queryLogArchive({...g,cursor:n});y.current===w&&u({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===w&&u({message:le(C),type:"pageFailed"})}},"C"),R=N(w=>{i(w.target.value)},"$"),L=N(w=>{m(w.target.value)},"L"),k=N(w=>{f(w.target.value)},"S"),I=N(()=>{ae(S())},"R");return a?(0,r.jsx)(Z,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:s}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:L,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:k,value:p,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),ue.map(w=>(0,r.jsx)("option",{value:w,children:w},w))]})]}),l!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:l}),v&&d===null&&l===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),d!==null&&d.length===0&&(0,r.jsx)(Z,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),d!==null&&d.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(ye,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(we,{children:(0,r.jsxs)(ne,{children:[(0,r.jsx)(U,{children:t("Time")}),(0,r.jsx)(U,{children:t("Level")}),(0,r.jsx)(U,{children:t("Function")}),(0,r.jsx)(U,{children:t("Message")}),(0,r.jsx)(U,{children:t("Trace")}),(0,r.jsx)(U,{children:t("Shard")}),(0,r.jsx)(U,{children:t("User")})]})}),(0,r.jsx)(Ne,{children:d.map((w,C)=>(0,r.jsx)(Oe,{row:w},`${String(w.ts)}-${String(C)}`))})]})}),n!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(ge,{"data-testid":"lg-archive-more",disabled:v,onClick:I,size:"sm",variant:"outline",children:t(v?"Loading\u2026":"Load more")})})]})},"De"),Ue=N(c=>{let e=(0,_.c)(11),{level:t,onToggle:s,selected:i}=c,o;e[0]!==t||e[1]!==s?(o=N(()=>{s(t)},"o"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let m=o,p=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",f;e[3]!==p?(f=G("rounded-md border px-2 py-1 text-xs",p),e[3]=p,e[4]=f):f=e[4];let n=`logs-level-${t}`,l;return e[5]!==t||e[6]!==m||e[7]!==i||e[8]!==f||e[9]!==n?(l=(0,r.jsx)("button",{"aria-pressed":i,className:f,"data-testid":n,onClick:m,type:"button",children:t}),e[5]=t,e[6]=m,e[7]=i,e[8]=f,e[9]=n,e[10]=l):l=e[10],l},"Ve"),ze=N(c=>{let e=(0,_.c)(68),{levelFilter:t,onLogPathChange:s,onSearchChange:i,onTimeRangeChange:o,onToggleLevel:m,onToggleSummary:p,pathFilter:f,search:n,showSummary:l,timeRange:v}=c,a=B(),d;e[0]!==a?(d=a("Search messages"),e[0]=a,e[1]=d):d=e[1];let u;e[2]!==a?(u=a("search message"),e[2]=a,e[3]=u):u=e[3];let h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==u?(h=(0,r.jsx)(D,{"aria-label":d,className:"h-8 w-48","data-testid":"lg-search",onChange:i,placeholder:u,value:n}),e[4]=i,e[5]=n,e[6]=d,e[7]=u,e[8]=h):h=e[8];let b;e[9]!==a?(b=a("Function path"),e[9]=a,e[10]=b):b=e[10];let g;e[11]!==a?(g=a("filter path"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==s||e[14]!==f||e[15]!==b||e[16]!==g?(x=(0,r.jsx)(D,{"aria-label":b,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:s,placeholder:g,value:f}),e[13]=s,e[14]=f,e[15]=b,e[16]=g,e[17]=x):x=e[17];let y;e[18]!==a?(y=a("Level filter"),e[18]=a,e[19]=y):y=e[19];let S;e[20]!==t||e[21]!==m?(S=ue.map(j=>(0,r.jsx)(Ue,{level:j,onToggle:m,selected:t.has(j)},j)),e[20]=t,e[21]=m,e[22]=S):S=e[22];let R;e[23]!==y||e[24]!==S?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:S}),e[23]=y,e[24]=S,e[25]=R):R=e[25];let L;e[26]!==a?(L=a("Time range"),e[26]=a,e[27]=L):L=e[27];let k;e[28]!==a?(k=a("All time"),e[28]=a,e[29]=k):k=e[29];let I;e[30]!==k?(I=(0,r.jsx)("option",{value:"all",children:k}),e[30]=k,e[31]=I):I=e[31];let w;e[32]!==a?(w=a("Last 5m"),e[32]=a,e[33]=w):w=e[33];let C;e[34]!==w?(C=(0,r.jsx)("option",{value:"5m",children:w}),e[34]=w,e[35]=C):C=e[35];let q;e[36]!==a?(q=a("Last 15m"),e[36]=a,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let E;e[40]!==a?(E=a("Last hour"),e[40]=a,e[41]=E):E=e[41];let K;e[42]!==E?(K=(0,r.jsx)("option",{value:"1h",children:E}),e[42]=E,e[43]=K):K=e[43];let $;e[44]!==o||e[45]!==L||e[46]!==I||e[47]!==C||e[48]!==F||e[49]!==K||e[50]!==v?($=(0,r.jsxs)("select",{"aria-label":L,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:v,children:[I,C,F,K]}),e[44]=o,e[45]=L,e[46]=I,e[47]=C,e[48]=F,e[49]=K,e[50]=v,e[51]=$):$=e[51];let V=l?"border-border bg-muted font-medium":"border-input text-muted-foreground",O;e[52]!==V?(O=G("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=O):O=e[53];let A;e[54]!==l||e[55]!==a?(A=a(l?"List":"Summary"),e[54]=l,e[55]=a,e[56]=A):A=e[56];let M;e[57]!==p||e[58]!==l||e[59]!==O||e[60]!==A?(M=(0,r.jsx)("button",{"aria-pressed":l,className:O,"data-testid":"logs-summary-toggle",onClick:p,type:"button",children:A}),e[57]=p,e[58]=l,e[59]=O,e[60]=A,e[61]=M):M=e[61];let W;return e[62]!==$||e[63]!==M||e[64]!==h||e[65]!==x||e[66]!==R?(W=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[h,x,R,$,M]}),e[62]=$,e[63]=M,e[64]=h,e[65]=x,e[66]=R,e[67]=W):W=e[67],W},"je"),je=N(c=>{let e=(0,_.c)(53),{onOutcomeChange:t,onPathChange:s,onTableChange:i,onUserChange:o,outcomeFilter:m,pathPrefix:p,tableFilter:f,userIdFilter:n}=c,l=B(),v;e[0]!==l?(v=l("Function path"),e[0]=l,e[1]=v):v=e[1];let a;e[2]!==l?(a=l("file:function"),e[2]=l,e[3]=a):a=e[3];let d;e[4]!==s||e[5]!==p||e[6]!==v||e[7]!==a?(d=(0,r.jsx)(D,{"aria-label":v,className:"h-8 w-44","data-testid":"lg-req-path",onChange:s,placeholder:a,value:p}),e[4]=s,e[5]=p,e[6]=v,e[7]=a,e[8]=d):d=e[8];let u;e[9]!==l?(u=l("User id"),e[9]=l,e[10]=u):u=e[10];let h;e[11]!==l?(h=l("userId"),e[11]=l,e[12]=h):h=e[12];let b;e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==n?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:h,value:n}),e[13]=o,e[14]=u,e[15]=h,e[16]=n,e[17]=b):b=e[17];let g;e[18]!==l?(g=l("Table touched"),e[18]=l,e[19]=g):g=e[19];let x;e[20]!==l?(x=l("table"),e[20]=l,e[21]=x):x=e[21];let y;e[22]!==i||e[23]!==g||e[24]!==x||e[25]!==f?(y=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-table",onChange:i,placeholder:x,value:f}),e[22]=i,e[23]=g,e[24]=x,e[25]=f,e[26]=y):y=e[26];let S;e[27]!==l?(S=l("Outcome filter"),e[27]=l,e[28]=S):S=e[28];let R;e[29]!==l?(R=l("all"),e[29]=l,e[30]=R):R=e[30];let L;e[31]!==R?(L=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=L):L=e[32];let k;e[33]!==l?(k=l("ok"),e[33]=l,e[34]=k):k=e[34];let I;e[35]!==k?(I=(0,r.jsx)("option",{value:"ok",children:k}),e[35]=k,e[36]=I):I=e[36];let w;e[37]!==l?(w=l("error"),e[37]=l,e[38]=w):w=e[38];let C;e[39]!==w?(C=(0,r.jsx)("option",{value:"error",children:w}),e[39]=w,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==m||e[43]!==S||e[44]!==L||e[45]!==I||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":S,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:m,children:[L,I,C]}),e[41]=t,e[42]=m,e[43]=S,e[44]=L,e[45]=I,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==d||e[50]!==b||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[d,b,y,q]}),e[48]=q,e[49]=d,e[50]=b,e[51]=y,e[52]=F):F=e[52],F},"Be"),Ie=N(c=>{let e=(0,_.c)(7),{bucket:t}=c,s;e[0]!==t.key?(s=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=s):s=e[1];let i;e[2]!==t.count?(i=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=i):i=e[3];let o;return e[4]!==s||e[5]!==i?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[s,i]}),e[4]=s,e[5]=i,e[6]=o):o=e[6],o},"ve"),Be=N(c=>{let e=(0,_.c)(31),{summary:t}=c,s=B(),i;e[0]!==t.total||e[1]!==s?(i=s("{count} entries",{count:t.total}),e[0]=t.total,e[1]=s,e[2]=i):i=e[2];let o;e[3]!==i?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:i}),e[3]=i,e[4]=o):o=e[4];let m;e[5]!==s?(m=s("By level"),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==m?(p=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:m}),e[7]=m,e[8]=p):p=e[8];let f;e[9]!==t.byLevel?(f=t.byLevel.map(We),e[9]=t.byLevel,e[10]=f):f=e[10];let n;e[11]!==f?(n=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:f}),e[11]=f,e[12]=n):n=e[12];let l;e[13]!==p||e[14]!==n?(l=(0,r.jsxs)("div",{children:[p,n]}),e[13]=p,e[14]=n,e[15]=l):l=e[15];let v;e[16]!==s?(v=s("By function"),e[16]=s,e[17]=v):v=e[17];let a;e[18]!==v?(a=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[18]=v,e[19]=a):a=e[19];let d;e[20]!==t.byPath?(d=t.byPath.map(Ge),e[20]=t.byPath,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:d}),e[22]=d,e[23]=u):u=e[23];let h;e[24]!==u||e[25]!==a?(h=(0,r.jsxs)("div",{children:[a,u]}),e[24]=u,e[25]=a,e[26]=h):h=e[26];let b;return e[27]!==h||e[28]!==o||e[29]!==l?(b=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,l,h]}),e[27]=h,e[28]=o,e[29]=l,e[30]=b):b=e[30],b},"ze");function We(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(We,"Ge");function Ge(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(Ge,"We");var Ve=N(c=>{let e=(0,_.c)(46),{liveError:t,onShardKeyChange:s,onShowArchive:i,onShowErrors:o,onShowRequests:m,shardKey:p,view:f}=c,n=B(),l=f==="requests",v=f==="requests"?"bg-muted font-medium":"text-muted-foreground",a;e[0]!==v?(a=G("px-3 py-1 text-sm",v),e[0]=v,e[1]=a):a=e[1];let d;e[2]!==n?(d=n("Requests"),e[2]=n,e[3]=d):d=e[3];let u;e[4]!==m||e[5]!==l||e[6]!==a||e[7]!==d?(u=(0,r.jsx)("button",{"aria-selected":l,className:a,"data-testid":"lg-view-requests",onClick:m,role:"tab",type:"button",children:d}),e[4]=m,e[5]=l,e[6]=a,e[7]=d,e[8]=u):u=e[8];let h=f==="errors",b=f==="errors"?"bg-muted font-medium":"text-muted-foreground",g;e[9]!==b?(g=G("px-3 py-1 text-sm",b),e[9]=b,e[10]=g):g=e[10];let x;e[11]!==n?(x=n("Errors"),e[11]=n,e[12]=x):x=e[12];let y;e[13]!==o||e[14]!==h||e[15]!==g||e[16]!==x?(y=(0,r.jsx)("button",{"aria-selected":h,className:g,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:x}),e[13]=o,e[14]=h,e[15]=g,e[16]=x,e[17]=y):y=e[17];let S=f==="archive",R=f==="archive"?"bg-muted font-medium":"text-muted-foreground",L;e[18]!==R?(L=G("px-3 py-1 text-sm",R),e[18]=R,e[19]=L):L=e[19];let k;e[20]!==n?(k=n("Archive"),e[20]=n,e[21]=k):k=e[21];let I;e[22]!==i||e[23]!==S||e[24]!==L||e[25]!==k?(I=(0,r.jsx)("button",{"aria-selected":S,className:L,"data-testid":"lg-view-archive",onClick:i,role:"tab",type:"button",children:k}),e[22]=i,e[23]=S,e[24]=L,e[25]=k,e[26]=I):I=e[26];let w;e[27]!==y||e[28]!==I||e[29]!==u?(w=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[u,y,I]}),e[27]=y,e[28]=I,e[29]=u,e[30]=w):w=e[30];let C;e[31]!==s||e[32]!==p?(C=(0,r.jsx)(ve,{onChange:s,testId:"lg-shard-input",value:p}),e[31]=s,e[32]=p,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==f?(q=f!=="archive"&&(0,r.jsx)(Ce,{message:t,prefix:"lg"}),e[34]=t,e[35]=f,e[36]=q):q=e[36];let F;e[37]!==n?(F=n("Open in Cloudflare"),e[37]=n,e[38]=F):F=e[38];let E;e[39]!==F?(E=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=E):E=e[40];let K;return e[41]!==w||e[42]!==C||e[43]!==q||e[44]!==E?(K=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[w,C,q,E]}),e[41]=w,e[42]=C,e[43]=q,e[44]=E,e[45]=K):K=e[45],K},"Qe"),ce=400,Qe=36,Ye={height:ce,overflow:"auto"},Te={left:0,position:"absolute",top:0,width:"100%"},He={error:"destructive",ok:"secondary"},Je=N(c=>{let e=(0,_.c)(26),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.fields?(n=X(t.fields),e[2]=t.fields,e[3]=n):n=e[3];let l=n,v;e[4]!==t.timestamp?(v=new Date(t.timestamp).toLocaleString(),e[4]=t.timestamp,e[5]=v):v=e[5];let a;e[6]!==v?(a=(0,r.jsx)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:v}),e[6]=v,e[7]=a):a=e[7];let d=Re[t.level],u;e[8]!==t.level||e[9]!==d?(u=(0,r.jsx)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:d,children:t.level})}),e[8]=t.level,e[9]=d,e[10]=u):u=e[10];let h=t.functionPath??"\u2014",b;e[11]!==h?(b=(0,r.jsx)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:h}),e[11]=h,e[12]=b):b=e[12];let g;e[13]!==l?(g=l===""?null:(0,r.jsx)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:l}),e[13]=l,e[14]=g):g=e[14];let x;e[15]!==t.message||e[16]!==g?(x=(0,r.jsxs)("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,g]}),e[15]=t.message,e[16]=g,e[17]=x):x=e[17];let y;return e[18]!==s||e[19]!==i||e[20]!==f||e[21]!==x||e[22]!==a||e[23]!==u||e[24]!==b?(y=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-row",ref:i,role:"row",style:f,children:[a,u,b,x]}),e[18]=s,e[19]=i,e[20]=f,e[21]=x,e[22]=a,e[23]=u,e[24]=b,e[25]=y):y=e[25],y},"Xe"),ke=N(c=>c.length===0?"\u2014":c.join(", "),"ce"),Ze=N(c=>{let e=(0,_.c)(37),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.ts?(n=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=n):n=e[3];let l;e[4]!==n?(l=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:n}),e[4]=n,e[5]=l):l=e[5];let v=He[t.outcome],a;e[6]!==t.outcome||e[7]!==v?(a=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:v,children:t.outcome})}),e[6]=t.outcome,e[7]=v,e[8]=a):a=e[8];let d;e[9]!==t.functionPath?(d=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=d):d=e[10];let u=t.shardKey??"\u2014",h;e[11]!==u?(h=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[11]=u,e[12]=h):h=e[12];let b=t.userId??"\u2014",g;e[13]!==b?(g=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[13]=b,e[14]=g):g=e[14];let x;e[15]!==t.durationMs?(x=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=x):x=e[16];let y=`${String(x)}ms`,S;e[17]!==y?(S=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:y}),e[17]=y,e[18]=S):S=e[18];let R;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(R=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${ke(t.tablesRead)} \xB7 w:${ke(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=R):R=e[23];let L;e[24]!==R?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:R}),e[24]=R,e[25]=L):L=e[25];let k;return e[26]!==s||e[27]!==i||e[28]!==f||e[29]!==g||e[30]!==S||e[31]!==L||e[32]!==l||e[33]!==a||e[34]!==d||e[35]!==h?(k=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-req-row",ref:i,role:"row",style:f,children:[l,a,d,h,g,S,L]}),e[26]=s,e[27]=i,e[28]=f,e[29]=g,e[30]=S,e[31]=L,e[32]=l,e[33]=a,e[34]=d,e[35]=h,e[36]=k):k=e[36],k},"Ze"),Pe=N(c=>{let{entries:e}=c??{};return Array.isArray(e)?e:[]},"ue"),Xe=N(c=>{let e={};return c.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=c.functionPathPrefix.trim()),c.userId.trim()!==""&&(e.userId=c.userId.trim()),c.tableTouched.trim()!==""&&(e.tableTouched=c.tableTouched.trim()),(c.outcome==="ok"||c.outcome==="error")&&(e.outcome=c.outcome),e},"et"),et={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},tt=N((c,e)=>{let t=e.search.trim().toLowerCase(),s=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-et[e.range];return c.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<i||s!==""&&!(o.functionPath??"").toLowerCase().includes(s)?!1:t===""||o.message.toLowerCase().includes(t)||X(o.fields).toLowerCase().includes(t))},"rt"),rt="\u2014",lt=N(c=>{let e=new Map,t=new Map;for(let o of c){e.set(o.level,(e.get(o.level)??0)+1);let m=o.functionPath??rt;t.set(m,(t.get(m)??0)+1)}let s=ue.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),i=[...t.entries()].map(([o,m])=>({count:m,key:o})).toSorted((o,m)=>m.count===o.count?o.key.localeCompare(m.key):m.count-o.count);return{byLevel:s,byPath:i,total:c.length}},"at"),Lt=N(({initialShardKey:c})=>{let e=B(),[t,s]=(0,T.useState)("requests"),{queryShardKey:i,setShardKey:o,shardKey:m}=be(c),[p,f]=(0,T.useState)(""),[n,l]=(0,T.useState)(()=>new Set),[v,a]=(0,T.useState)(""),[d,u]=(0,T.useState)("all"),[h,b]=(0,T.useState)(!1),[g,x]=(0,T.useState)(""),[y,S]=(0,T.useState)(""),[R,L]=(0,T.useState)(""),[k,I]=(0,T.useState)("all"),w=Xe({functionPathPrefix:g,outcome:k,tableTouched:R,userId:y}),C=oe(se.getRequestLog,w,{enabled:t==="requests",live:!0,shardKey:i}),q=oe(se.getLogs,{},{enabled:t==="errors",live:!0,shardKey:i}),F=t==="requests"?C:q,{error:E,errorSource:K,isLoading:$,liveError:V}=F,O=Pe(q.data),A=Pe(C.data);(0,T.useEffect)(()=>{F.data!==void 0&&pe(i)},[F.data,i]);let M=tt(O,{levels:n,now:Date.now(),path:v,range:d,search:p}),W=lt(M),j=t==="requests"?A.length:M.length,ee=t==="errors"&&h,Q=(0,T.useMemo)(()=>E!==null?"error":j===0?$?ee?"summary":"list":"empty":ee?"summary":"list",[j,$,E,ee]),me=(0,T.useRef)(null),Y=Se({count:j,estimateSize:N(()=>Qe,"estimateSize"),getScrollElement:N(()=>me.current,"getScrollElement"),initialRect:{height:ce,width:800},observeElementRect:N((P,te)=>Le(P,te,ce),"observeElementRect"),overscan:8}),qe=Y.getVirtualItems(),Fe={height:Y.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Ve,{liveError:V,onShardKeyChange:o,onShowArchive:N(()=>{s("archive"),b(!1)},"onShowArchive"),onShowErrors:N(()=>{s("errors"),b(!1)},"onShowErrors"),onShowRequests:N(()=>{s("requests"),b(!1)},"onShowRequests"),shardKey:m,view:t}),t==="errors"&&(0,r.jsx)(ze,{levelFilter:n,onLogPathChange:N(P=>{a(P.target.value)},"onLogPathChange"),onSearchChange:N(P=>{f(P.target.value)},"onSearchChange"),onTimeRangeChange:N(P=>{u(P.target.value)},"onTimeRangeChange"),onToggleLevel:N(P=>{l(te=>{let H=new Set(te);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:N(()=>{b(P=>!P)},"onToggleSummary"),pathFilter:v,search:p,showSummary:h,timeRange:d}),t==="requests"&&(0,r.jsx)(je,{onOutcomeChange:N(P=>{I(P.target.value)},"onOutcomeChange"),onPathChange:N(P=>{x(P.target.value)},"onPathChange"),onTableChange:N(P=>{L(P.target.value)},"onTableChange"),onUserChange:N(P=>{S(P.target.value)},"onUserChange"),outcomeFilter:k,pathPrefix:g,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(De,{shardKey:i}):(0,r.jsxs)(r.Fragment,{children:[Q==="error"&&(0,r.jsx)(xe,{error:K,testId:"lg-error"}),Q==="empty"&&(0,r.jsx)(Z,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Q==="summary"&&(0,r.jsx)(Be,{summary:W}),Q==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:me,style:Ye,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Fe,children:qe.map(P=>t==="requests"?(0,r.jsx)(Ze,{entry:A[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key):(0,r.jsx)(Je,{entry:M[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key))})})]})]})},"Pt");export{Lt as LogsPanel,tt as filterLogs,lt as summarizeLogs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as y}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as R}from"./chunk-
|
|
1
|
+
import{b as y}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as R}from"./chunk-NCKRVNF2.js";import"./chunk-XXQUMVWH.js";import"./chunk-NJRW66LJ.js";import"./chunk-QLQADHFE.js";import{a as v}from"./chunk-VDW32UET.js";import{c as $}from"./chunk-6F7KP54M.js";import"./chunk-C2ZFQARQ.js";import"./chunk-XBDKZZ67.js";import{a as S}from"./chunk-XQCVZAGU.js";import{a as A,b as I,c as j,d as x,e as n,f as c}from"./chunk-WJQLNYGX.js";import{a as k,e as w}from"./chunk-WQH3LT2P.js";import{d as b}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as f,e as N,g as _,h as D}from"./chunk-3XIESWL4.js";var T=N(_(),1);var r=N(D(),1);var E=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"E"),C={delete:2,list:3,read:0,write:1},O=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||C[t.on]-C[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"T"),q=f(()=>{let e=(0,T.c)(14),t=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=O(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(I,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(n,{children:t("Bucket")}),(0,r.jsx)(n,{children:t("Operation")}),(0,r.jsx)(n,{children:t("Key prefix")}),(0,r.jsx)(n,{children:t("Guarded by")})]})}),(0,r.jsx)(j,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(c,{children:(0,r.jsx)(y,{variant:"secondary",children:E(t,s.on)})}),(0,r.jsx)(c,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"W");export{q as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as ye}from"./chunk-V53KNYRN.js";import{a as we}from"./chunk-AREBQI6D.js";import{a as Ne}from"./chunk-RMN2JN4S.js";import{b as pe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ge}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{a as H}from"./chunk-VDW32UET.js";import{d as be}from"./chunk-
|
|
1
|
+
import{a as ye}from"./chunk-V53KNYRN.js";import{a as we}from"./chunk-AREBQI6D.js";import{a as Ne}from"./chunk-RMN2JN4S.js";import{b as pe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ge}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{a as H}from"./chunk-VDW32UET.js";import{d as be}from"./chunk-6F7KP54M.js";import{f as xe}from"./chunk-C2ZFQARQ.js";import"./chunk-XBDKZZ67.js";import{a as ne,e as ie}from"./chunk-WQH3LT2P.js";import{d as he,f as ce,g as de,h as ee,o as me}from"./chunk-IUYFXK4X.js";import{c as ae}from"./chunk-P33WK7YI.js";import{a,e as se,f as ve,g as je,h as Ee}from"./chunk-3XIESWL4.js";var Se=se(je(),1);var b=se(ve(),1);var r=se(Ee(),1);var Ce=ce(H.exportShard),Oe=ce(H.importShard),Te=a(x=>x.map(e=>JSON.stringify(e)).join(`
|
|
2
2
|
`),"je"),Ae=a(x=>{let e=[],te=x.split(`
|
|
3
3
|
`);for(let[n,N]of te.entries()){let t=N.trim();if(t==="")continue;let o=JSON.parse(t);if(typeof o!="object"||o===null)throw new ae("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);let h=o;if(typeof h.table!="string"||typeof h.doc!="object"||h.doc===null||Array.isArray(h.doc))throw new ae("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);e.push(h)}return e},"$e"),Me=a(x=>{let e=(0,Se.c)(94),{initialShardKey:te}=x,n=xe(),N=be(),t=he(),[o,h]=(0,b.useState)(te??""),[l,ue]=(0,b.useState)(""),[d,K]=(0,b.useState)(!1),[Q,M]=(0,b.useState)(null),[i,re]=(0,b.useState)(null),[w,fe]=(0,b.useState)(null),V;e[0]!==n||e[1]!==o?(V=a(async()=>{K(!0),M(null),re(null);try{let c=await n.query(Ce,{},de(o));pe(o),ue(Te(c.rows)),fe(c.rows.length)}catch(c){M(ee(c))}K(!1)},"Q"),e[0]=n,e[1]=o,e[2]=V):V=e[2];let z=V,W;e[3]!==n||e[4]!==N||e[5]!==l||e[6]!==o||e[7]!==t?(W=a(async()=>{K(!0),M(null),re(null),fe(null);let c;try{c=Ae(l)}catch(s){M(t("Invalid NDJSON: {message}",{message:ee(s)})),K(!1);return}try{let s=await n.query(Oe,{rows:c},de(o));pe(o),re(s),N(H.readTablePage),N(H.listTables)}catch(s){M(ee(s))}K(!1)},"V"),e[3]=n,e[4]=N,e[5]=l,e[6]=o,e[7]=t,e[8]=W):W=e[8];let G=W,y,S,I,m,v,p,u,j,E,f,C;if(e[9]!==d||e[10]!==w||e[11]!==z||e[12]!==i||e[13]!==G||e[14]!==l||e[15]!==o||e[16]!==t){let c=i===null?0:Object.values(i.inserted).reduce(Le,0),s;e[28]!==z?(s=a(()=>{me(z())},"s"),e[28]=z,e[29]=s):s=e[29];let oe=s,Y;e[30]!==G?(Y=a(()=>{me(G())},"X"),e[30]=G,e[31]=Y):Y=e[31];let le=Y,Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=a(g=>{ue(g.target.value)},"Y"),e[32]=Z):Z=e[32];let Ie=Z;C="flex flex-col gap-4",I="lunora-export-import";let L;e[33]!==t?(L=t("Export"),e[33]=t,e[34]=L):L=e[34];let $;e[35]!==L?($=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:L})}),e[35]=L,e[36]=$):$=e[36];let J;e[37]!==o?(J=(0,r.jsx)(Ne,{onChange:h,testId:"ei-shard-input",value:o}),e[37]=o,e[38]=J):J=e[38];let k;e[39]!==t?(k=t("Export"),e[39]=t,e[40]=k):k=e[40];let D;e[41]!==d||e[42]!==oe||e[43]!==k?(D=(0,r.jsx)(ge,{"data-testid":"ei-export",disabled:d,onClick:oe,type:"button",children:k}),e[41]=d,e[42]=oe,e[43]=k,e[44]=D):D=e[44];let _;e[45]!==J||e[46]!==D?(_=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[J,D]}),e[45]=J,e[46]=D,e[47]=_):_=e[47];let q;e[48]!==w||e[49]!==t?(q=w!==null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:t("Exported {count} rows.",{count:w})}),e[48]=w,e[49]=t,e[50]=q):q=e[50];let B;e[51]!==_||e[52]!==q?(B=(0,r.jsxs)(ie,{className:"flex flex-col gap-3 p-4",children:[_,q]}),e[51]=_,e[52]=q,e[53]=B):B=e[53],e[54]!==$||e[55]!==B?(m=(0,r.jsxs)(ne,{className:"rounded-xl border border-border bg-card shadow-xs",children:[$,B]}),e[54]=$,e[55]=B,e[56]=m):m=e[56],S=ne,E="rounded-xl border border-border bg-card shadow-xs";let P;e[57]!==t?(P=t("Import"),e[57]=t,e[58]=P):P=e[58],e[59]!==P?(f=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:P})}),e[59]=P,e[60]=f):f=e[60],y=ie,v="flex flex-col gap-3 p-4",e[61]!==l?(p=(0,r.jsx)(ye,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:Ie,placeholder:'{"table":"messages","doc":{\u2026}}',value:l}),e[61]=l,e[62]=p):p=e[62];let R;e[63]!==t?(R=t("Import (writes rows)?"),e[63]=t,e[64]=R):R=e[64];let U;e[65]!==d||e[66]!==l?(U=d||l.trim()==="",e[65]=d,e[66]=l,e[67]=U):U=e[67];let F;e[68]!==t?(F=t("Import"),e[68]=t,e[69]=F):F=e[69],e[70]!==le||e[71]!==R||e[72]!==U||e[73]!==F?(u=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,r.jsx)(we,{confirmLabel:R,disabled:U,onConfirm:le,testId:"ei-import",children:F})}),e[70]=le,e[71]=R,e[72]=U,e[73]=F,e[74]=u):u=e[74],j=i!==null&&(0,r.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:c})}),i.errors.length>0&&(0,r.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(g=>(0,r.jsx)("li",{className:"text-xs text-destructive",children:t("line {line} ({table}): {message}",{line:g.line,message:g.message,table:g.table})},`${g.table}-${g.line.toString()}`))})]}),e[9]=d,e[10]=w,e[11]=z,e[12]=i,e[13]=G,e[14]=l,e[15]=o,e[16]=t,e[17]=y,e[18]=S,e[19]=I,e[20]=m,e[21]=v,e[22]=p,e[23]=u,e[24]=j,e[25]=E,e[26]=f,e[27]=C}else y=e[17],S=e[18],I=e[19],m=e[20],v=e[21],p=e[22],u=e[23],j=e[24],E=e[25],f=e[26],C=e[27];let O;e[75]!==y||e[76]!==v||e[77]!==p||e[78]!==u||e[79]!==j?(O=(0,r.jsxs)(y,{className:v,children:[p,u,j]}),e[75]=y,e[76]=v,e[77]=p,e[78]=u,e[79]=j,e[80]=O):O=e[80];let T;e[81]!==S||e[82]!==O||e[83]!==E||e[84]!==f?(T=(0,r.jsxs)(S,{className:E,children:[f,O]}),e[81]=S,e[82]=O,e[83]=E,e[84]=f,e[85]=T):T=e[85];let A;e[86]!==Q?(A=Q!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:Q}),e[86]=Q,e[87]=A):A=e[87];let X;return e[88]!==I||e[89]!==m||e[90]!==T||e[91]!==A||e[92]!==C?(X=(0,r.jsxs)("div",{className:C,"data-testid":I,children:[m,T,A]}),e[88]=I,e[89]=m,e[90]=T,e[91]=A,e[92]=C,e[93]=X):X=e[93],X},"Be");function Le(x,e){return x+e}a(Le,"Ee");export{Me as ExportImportPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as jt}from"./chunk-PKSAWP56.js";import{a as me}from"./chunk-TMGHRD6W.js";import{a as Kt,b as Lt,c as At,d as Ot,e as ot}from"./chunk-LT236J7E.js";import{a as zt}from"./chunk-QWGT25SE.js";import{e as Dt}from"./chunk-XF2B7P5A.js";import{a as It,b as Ct,c as Tt,d as Rt,e as Pe}from"./chunk-MKYEFQCA.js";import"./chunk-2PJNAWB3.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as _t}from"./chunk-IGCNMZSB.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import{a as et,b as tt,c as rt,d as yt,e as Nt,f as at,g as st,h as St,i as wt}from"./chunk-U7ILDM43.js";import"./chunk-4UOFSGUS.js";import"./chunk-CZZWYUTR.js";import{a as Mt}from"./chunk-3CWGJYBB.js";import{a as $t}from"./chunk-RMN2JN4S.js";import{a as qt,b as kt}from"./chunk-GRL5MG3Z.js";import{e as ut}from"./chunk-SMIESS7P.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{c as Ze}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Be}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import"./chunk-QLQADHFE.js";import{a as Le}from"./chunk-VDW32UET.js";import{c as je}from"./chunk-LZGOETI3.js";import{f as mt}from"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as ft}from"./chunk-XQCVZAGU.js";import{a as lt,b as nt,c as it,d as Ee,e as ce,f as B}from"./chunk-WJQLNYGX.js";import{a as fe,b as Ae,c as Oe,d as gt,e as pe}from"./chunk-WQH3LT2P.js";import{d as ge,f as pt,g as xt,h as bt,i as vt,l as Ge,o as Ue}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as o,e as Ye,f as Ft,g as Jt,h as Ht,j as ht}from"./chunk-3XIESWL4.js";var P=Ye(Ft(),1);var xe=Ye(Jt(),1);var t=Ye(Ht(),1);var Wt=o((s,e)=>s<e?-1:s>e?1:0,"Jt"),ct=o(s=>{if(s===void 0)return"null";if(typeof s=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s))return`[${s.map(c=>ct(c)).join(",")}]`;let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let c=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${c} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let l=s,a=Object.keys(l).toSorted(Wt),r=[];for(let c of a){let i=l[c];i!==void 0&&r.push(`${JSON.stringify(c)}:${ct(i)}`)}return`{${r.join(",")}}`},"Ze"),Pt=o((s,e,l)=>`${s}:${e}:${ct(l??{})}`,"gt"),Qt=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"ft"),Bt=o((s,e)=>Qt(s,e),"Ht"),Gt=o(s=>Qt(s.kind,s),"Gt"),dt=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"Xe"),Vt=o(s=>Array.isArray(s?.series)?s.series:[],"Wt"),Xt="FUNCTION_NOT_FOUND",Yt=o(s=>{let e=new Map;if(!Array.isArray(s?.series))return e;for(let l of s.series)e.set(Pt(l.kind,l.name,l.attributes),l.points);return e},"Yt"),Zt={counter:"secondary",gauge:"default",histogram:"outline"},Ut=o(s=>{let e=(0,xe.c)(18),{name:l,onOpenTrace:a,traceId:r}=s,c=ge();if(r===void 0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=u):u=e[0],u}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 u=`mt-instrument-trace-${l}`,h;return e[3]!==n||e[4]!==u||e[5]!==r?(h=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":u,title:r,children:n}),e[3]=n,e[4]=u,e[5]=r,e[6]=h):h=e[6],h}let $=`mt-instrument-trace-${l}`,f;e[7]!==a||e[8]!==r?(f=o(()=>{a(r)},"f"),e[7]=a,e[8]=r,e[9]=f):f=e[9];let S;e[10]!==c||e[11]!==r?(S=c("Open the exemplar trace {trace}",{trace:r}),e[10]=c,e[11]=r,e[12]=S):S=e[12];let p;return e[13]!==n||e[14]!==$||e[15]!==f||e[16]!==S?(p=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":$,onClick:f,title:S,type:"button",children:n}),e[13]=n,e[14]=$,e[15]=f,e[16]=S,e[17]=p):p=e[17],p},"Zt"),er=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=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:$,errorSource:f}=je(Le.getMetricSeries,c,i),S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S={},e[3]=S):S=e[3];let p;e[4]!==a?(p={live:!0,shardKey:a},e[4]=a,e[5]=p):p=e[5];let{data:u}=je(Le.getMetricHistory,S,p),h,M,b,w,_,d,g,x,q,k,y,D,I;if(e[6]!==n||e[7]!==$||e[8]!==f||e[9]!==u||e[10]!==l||e[11]!==r){x=Symbol.for("react.early_return_sentinel");e:{let A=Vt(n),j=vt(f)===Xt;if($!==null&&!j){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let E;e[27]!==m?(E=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=E):E=e[28];let Q;e[29]!==$||e[30]!==r?(Q=r("Instruments unavailable: {error}",{error:$}),e[29]=$,e[30]=r,e[31]=Q):Q=e[31];let F;e[32]!==Q?(F=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:Q}),e[32]=Q,e[33]=F):F=e[33];let de;e[34]!==E||e[35]!==F?(de=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[E,F]}),e[34]=E,e[35]=F,e[36]=de):de=e[36],x=de;break e}if(A.length===0){x=null;break e}let J=Yt(u),K;e[37]!==r?(K=o(m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),"L"),e[37]=r,e[38]=K):K=e[38];let H=K;_="flex flex-col gap-2",d="mt-instruments";let L;e[39]!==r?(L=r("Instruments"),e[39]=r,e[40]=L):L=e[40],e[41]!==L?(g=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:L}),e[41]=L,e[42]=g):g=e[42],w=fe,I="overflow-hidden py-0",b=pe,D="px-0",M=lt,k="mt-instruments-table";let O;e[43]!==r?(O=r("name"),e[43]=r,e[44]=O):O=e[44];let G;e[45]!==O?(G=(0,t.jsx)(ce,{children:O}),e[45]=O,e[46]=G):G=e[46];let V;e[47]!==r?(V=r("kind"),e[47]=r,e[48]=V):V=e[48];let X;e[49]!==V?(X=(0,t.jsx)(ce,{children:V}),e[49]=V,e[50]=X):X=e[50];let Y;e[51]!==r?(Y=r("value"),e[51]=r,e[52]=Y):Y=e[52];let Z;e[53]!==Y?(Z=(0,t.jsx)(ce,{className:"text-right",children:Y}),e[53]=Y,e[54]=Z):Z=e[54];let U;e[55]!==r?(U=r("count"),e[55]=r,e[56]=U):U=e[56];let ee;e[57]!==U?(ee=(0,t.jsx)(ce,{className:"text-right",children:U}),e[57]=U,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(ce,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(ce,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(ce,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(ce,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==G||e[76]!==X||e[77]!==Z||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(y=(0,t.jsx)(nt,{children:(0,t.jsxs)(Ee,{children:[G,X,Z,ee,re,se,ne,oe]})}),e[75]=G,e[76]=X,e[77]=Z,e[78]=ee,e[79]=re,e[80]=se,e[81]=ne,e[82]=oe,e[83]=y):y=e[83],h=it,q=A.map(m=>{let E=zt(m.attributes),Q=Pt(m.kind,m.name,m.attributes),F=(J.get(Q)??[]).map(de=>Bt(m.kind,de));return(0,t.jsxs)(Ee,{"data-testid":`mt-instrument-${m.name}`,children:[(0,t.jsx)(B,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),(0,t.jsx)(B,{children:(0,t.jsx)(Be,{variant:Zt[m.kind],children:H(m.kind)})}),(0,t.jsx)(B,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:dt(Gt(m))}),(0,t.jsx)(B,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),(0,t.jsx)(B,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"\u2014":`${dt(m.min)}\u2013${dt(m.max)}`}),(0,t.jsx)(B,{children:F.length>=2?(0,t.jsx)(ot,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:F,testId:`mt-instrument-trend-${m.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)(Ut,{name:m.name,onOpenTrace:l,traceId:m.exemplarTraceId})}),(0,t.jsx)(B,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:E,children:E===""?"\u2014":E})]},Q)})}e[6]=n,e[7]=$,e[8]=f,e[9]=u,e[10]=l,e[11]=r,e[12]=h,e[13]=M,e[14]=b,e[15]=w,e[16]=_,e[17]=d,e[18]=g,e[19]=x,e[20]=q,e[21]=k,e[22]=y,e[23]=D,e[24]=I}else h=e[12],M=e[13],b=e[14],w=e[15],_=e[16],d=e[17],g=e[18],x=e[19],q=e[20],k=e[21],y=e[22],D=e[23],I=e[24];if(x!==Symbol.for("react.early_return_sentinel"))return x;let C;e[84]!==h||e[85]!==q?(C=(0,t.jsx)(h,{children:q}),e[84]=h,e[85]=q,e[86]=C):C=e[86];let T;e[87]!==M||e[88]!==C||e[89]!==k||e[90]!==y?(T=(0,t.jsxs)(M,{"data-testid":k,children:[y,C]}),e[87]=M,e[88]=C,e[89]=k,e[90]=y,e[91]=T):T=e[91];let N;e[92]!==b||e[93]!==T||e[94]!==D?(N=(0,t.jsx)(b,{className:D,children:T}),e[92]=b,e[93]=T,e[94]=D,e[95]=N):N=e[95];let v;e[96]!==w||e[97]!==N||e[98]!==I?(v=(0,t.jsx)(w,{className:I,children:N}),e[96]=w,e[97]=N,e[98]=I,e[99]=v):v=e[99];let z;return e[100]!==_||e[101]!==d||e[102]!==g||e[103]!==v?(z=(0,t.jsxs)("section",{className:_,"data-testid":d,children:[g,v]}),e[100]=_,e[101]=d,e[102]=g,e[103]=v,e[104]=z):z=e[104],z},"er"),tr=o(s=>{let e=(0,xe.c)(74),{aggregate:l,shardResults:a}=s,r=ge(),c;e[0]!==r?(c=r("Shards"),e[0]=r,e[1]=c):c=e[1];let i;e[2]!==l.failed||e[3]!==l.reachable||e[4]!==r?(i=l.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:l.failed,reachable:l.reachable}):r("{reachable} reachable",{reachable:l.reachable}),e[2]=l.failed,e[3]=l.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==c||e[7]!==i?(n=(0,t.jsx)(me,{label:c,testId:"mt-agg-shards",value:i}),e[6]=c,e[7]=i,e[8]=n):n=e[8];let $;e[9]!==r?($=r("Total requests"),e[9]=r,e[10]=$):$=e[10];let f;e[11]!==l.totalRequests||e[12]!==$?(f=(0,t.jsx)(me,{label:$,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=$,e[13]=f):f=e[13];let S;e[14]!==r?(S=r("Total errors"),e[14]=r,e[15]=S):S=e[15];let p;e[16]!==l.totalErrors||e[17]!==S?(p=(0,t.jsx)(me,{label:S,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=S,e[18]=p):p=e[18];let u;e[19]!==r?(u=r("Total database size"),e[19]=r,e[20]=u):u=e[20];let h;e[21]!==l.totalDatabaseSize?(h=Ge(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=h):h=e[22];let M;e[23]!==u||e[24]!==h?(M=(0,t.jsx)(me,{label:u,testId:"mt-agg-db-size",value:h}),e[23]=u,e[24]=h,e[25]=M):M=e[25];let b;e[26]!==r?(b=r("Combined cache hit rate"),e[26]=r,e[27]=b):b=e[27];let w;e[28]!==l.hitRate||e[29]!==r?(w=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=w):w=e[30];let _;e[31]!==b||e[32]!==w?(_=(0,t.jsx)(me,{label:b,testId:"mt-agg-cache",value:w}),e[31]=b,e[32]=w,e[33]=_):_=e[33];let d;e[34]!==M||e[35]!==_||e[36]!==n||e[37]!==f||e[38]!==p?(d=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,f,p,M,_]}),e[34]=M,e[35]=_,e[36]=n,e[37]=f,e[38]=p,e[39]=d):d=e[39];let g;e[40]!==r?(g=r("shard"),e[40]=r,e[41]=g):g=e[41];let x;e[42]!==g?(x=(0,t.jsx)(ce,{children:g}),e[42]=g,e[43]=x):x=e[43];let q;e[44]!==r?(q=r("requests"),e[44]=r,e[45]=q):q=e[45];let k;e[46]!==q?(k=(0,t.jsx)(ce,{children:q}),e[46]=q,e[47]=k):k=e[47];let y;e[48]!==r?(y=r("errors"),e[48]=r,e[49]=y):y=e[49];let D;e[50]!==y?(D=(0,t.jsx)(ce,{children:y}),e[50]=y,e[51]=D):D=e[51];let I;e[52]!==r?(I=r("db size"),e[52]=r,e[53]=I):I=e[53];let C;e[54]!==I?(C=(0,t.jsx)(ce,{children:I}),e[54]=I,e[55]=C):C=e[55];let T;e[56]!==x||e[57]!==k||e[58]!==D||e[59]!==C?(T=(0,t.jsx)(nt,{children:(0,t.jsxs)(Ee,{children:[x,k,D,C]})}),e[56]=x,e[57]=k,e[58]=D,e[59]=C,e[60]=T):T=e[60];let N;if(e[61]!==a||e[62]!==r){let j;e[64]!==r?(j=o(J=>(0,t.jsxs)(Ee,{"data-testid":`mt-agg-row-${J.shard}`,children:[(0,t.jsx)(B,{children:J.shard}),J.metrics===null?(0,t.jsx)(B,{className:"text-destructive",colSpan:3,children:J.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{className:"tabular-nums",children:J.metrics.requests}),(0,t.jsx)(B,{className:"tabular-nums",children:J.metrics.errors}),(0,t.jsx)(B,{className:"tabular-nums",children:Ge(J.metrics.databaseSize)})]})]},J.shard),"K"),e[64]=r,e[65]=j):j=e[65],N=a.map(j),e[61]=a,e[62]=r,e[63]=N}else N=e[63];let v;e[66]!==N?(v=(0,t.jsx)(it,{children:N}),e[66]=N,e[67]=v):v=e[67];let z;e[68]!==T||e[69]!==v?(z=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(lt,{"data-testid":"mt-agg-table",children:[T,v]})})}),e[68]=T,e[69]=v,e[70]=z):z=e[70];let A;return e[71]!==d||e[72]!==z?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[d,z]}),e[71]=d,e[72]=z,e[73]=A):A=e[73],A},"tr"),rr=o(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return l>0?`${l.toString()}h ${a.toString()}m`:a>0?`${a.toString()}m ${r.toString()}s`:`${r.toString()}s`},"rr"),ar=o((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"ar"),Et=o(s=>s<=0?"\u2014":s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"ct"),sr=o(s=>{let e=(0,xe.c)(75),{currentDelta:l,errorRate:a,history:r,latencyPercentiles:c,metrics:i}=s,n=ge(),$;e[0]!==r||e[1]!==n?($=r.length>=2?(0,t.jsx)(ot,{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]=$):$=e[2];let f;e[3]!==l||e[4]!==r.length||e[5]!==n?(f=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${l.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=l,e[4]=r.length,e[5]=n,e[6]=f):f=e[6];let S;e[7]!==n?(S=n("Requests"),e[7]=n,e[8]=S):S=e[8];let p;e[9]!==i.requests||e[10]!==$||e[11]!==f||e[12]!==S?(p=(0,t.jsx)(me,{chart:$,footer:f,label:S,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=$,e[11]=f,e[12]=S,e[13]=p):p=e[13];let u;e[14]!==a||e[15]!==n?(u=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=u):u=e[16];let h;e[17]!==n?(h=n("Errors"),e[17]=n,e[18]=h):h=e[18];let M;e[19]!==a||e[20]!==i.errors?(M=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=M):M=e[21];let b;e[22]!==u||e[23]!==h||e[24]!==M?(b=(0,t.jsx)(me,{footer:u,label:h,testId:"mt-errors",value:M}),e[22]=u,e[23]=h,e[24]=M,e[25]=b):b=e[25];let w;e[26]!==c.p90?(w=c.p90>0?`P90 ${Et(c.p90)}`:void 0,e[26]=c.p90,e[27]=w):w=e[27];let _;e[28]!==n?(_=n("P95 latency"),e[28]=n,e[29]=_):_=e[29];let d;e[30]!==c.p95?(d=c.p95>0?Et(c.p95):"\u2014",e[30]=c.p95,e[31]=d):d=e[31];let g;e[32]!==_||e[33]!==d||e[34]!==w?(g=(0,t.jsx)(me,{footer:w,label:_,testId:"mt-p95",value:d}),e[32]=_,e[33]=d,e[34]=w,e[35]=g):g=e[35];let x;e[36]!==i.cache||e[37]!==n?(x=i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${n("cache entries")}`,e[36]=i.cache,e[37]=n,e[38]=x):x=e[38];let q;e[39]!==n?(q=n("Database size"),e[39]=n,e[40]=q):q=e[40];let k;e[41]!==i.databaseSize?(k=Ge(i.databaseSize),e[41]=i.databaseSize,e[42]=k):k=e[42];let y;e[43]!==x||e[44]!==q||e[45]!==k?(y=(0,t.jsx)(me,{footer:x,label:q,testId:"mt-db-size",value:k}),e[43]=x,e[44]=q,e[45]=k,e[46]=y):y=e[46];let D;e[47]!==n?(D=n("Shard"),e[47]=n,e[48]=D):D=e[48];let I;e[49]!==i.shard||e[50]!==D?(I=(0,t.jsx)(me,{label:D,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=D,e[51]=I):I=e[51];let C;e[52]!==n?(C=n("Uptime"),e[52]=n,e[53]=C):C=e[53];let T;e[54]!==i.uptimeMs?(T=rr(i.uptimeMs),e[54]=i.uptimeMs,e[55]=T):T=e[55];let N;e[56]!==C||e[57]!==T?(N=(0,t.jsx)(me,{label:C,testId:"mt-uptime",value:T}),e[56]=C,e[57]=T,e[58]=N):N=e[58];let v;e[59]!==n?(v=n("Cache hit rate"),e[59]=n,e[60]=v):v=e[60];let z;e[61]!==i.cache||e[62]!==n?(z=i.cache===null?n("no cache configured"):n("{rate} ({count} entries)",{count:i.cache.entries,rate:ar(i.cache.hits,i.cache.misses)}),e[61]=i.cache,e[62]=n,e[63]=z):z=e[63];let A;e[64]!==v||e[65]!==z?(A=(0,t.jsx)(me,{label:v,testId:"mt-cache",value:z}),e[64]=v,e[65]=z,e[66]=A):A=e[66];let j;return e[67]!==g||e[68]!==y||e[69]!==I||e[70]!==N||e[71]!==A||e[72]!==p||e[73]!==b?(j=(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:[p,b,g,y,I,N,A]}),e[67]=g,e[68]=y,e[69]=I,e[70]=N,e[71]=A,e[72]=p,e[73]=b,e[74]=j):j=e[74],j},"lr"),Xe=o(s=>s>=100?"critical":s>=50?"warning":"good","Ge"),Qe=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Oe"),Ve=o(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"Be"),lr=o(s=>{let e=(0,xe.c)(3),{level:l}=s;if(l==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Be,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(l==="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},"sr"),nr=o((s,e)=>{let l=[...s];return l.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}}),l},"nr"),ir=o(s=>{let e=(0,xe.c)(161),{queryStats:l}=s,a=ge(),[r,c]=(0,P.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,$]=(0,P.useState)(i),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o(I=>{I!==null&&c(I)},"f"),e[1]=f):f=e[1];let S=f,p,u,h,M,b,w,_,d,g,x;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){h=Symbol.for("react.early_return_sentinel");e:{let I=nr(l,r),C;e[16]!==l?(C=l.filter(or),e[16]=l,e[17]=C):C=e[17];let T=C.length,N;e[18]!==l?(N=l.filter(dr),e[18]=l,e[19]=N):N=e[19];let v=N.length,z;e[20]!==l?(z=l.filter(cr),e[20]=l,e[21]=z):z=e[21];let A=z.length,j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=o(R=>{$(ue=>{let W=new Set(ue);return W.has(R)?W.delete(R):W.add(R),W})},"K"),e[22]=j):j=e[22];let J=j;if(l.length===0){let R;e[23]!==a?(R=a("No query insights yet"),e[23]=a,e[24]=R):R=e[24];let ue;e[25]!==R?(ue=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:R}),e[25]=R,e[26]=ue):ue=e[26];let W;e[27]!==a?(W=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=W):W=e[28];let he;e[29]!==W?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:W}),e[29]=W,e[30]=he):he=e[30];let We;e[31]!==ue||e[32]!==he?(We=(0,t.jsx)(fe,{children:(0,t.jsx)(pe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ue,he]})})}),e[31]=ue,e[32]=he,e[33]=We):We=e[33],h=We;break e}_="space-y-4",d="qi-root";let K;e[34]!==a?(K=a("Critical queries"),e[34]=a,e[35]=K):K=e[35];let H;e[36]!==K?(H=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:K})}),e[36]=K,e[37]=H):H=e[37];let L;e[38]!==T?(L=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:T}),e[38]=T,e[39]=L):L=e[39];let O;e[40]!==a?(O=a(">100ms avg execution"),e[40]=a,e[41]=O):O=e[41];let G;e[42]!==O?(G=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:O}),e[42]=O,e[43]=G):G=e[43];let V;e[44]!==L||e[45]!==G?(V=(0,t.jsxs)(pe,{children:[L,G]}),e[44]=L,e[45]=G,e[46]=V):V=e[46];let X;e[47]!==H||e[48]!==V?(X=(0,t.jsxs)(fe,{children:[H,V]}),e[47]=H,e[48]=V,e[49]=X):X=e[49];let Y;e[50]!==a?(Y=a("Moderate queries"),e[50]=a,e[51]=Y):Y=e[51];let Z;e[52]!==Y?(Z=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:Y})}),e[52]=Y,e[53]=Z):Z=e[53];let U;e[54]!==v?(U=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:v}),e[54]=v,e[55]=U):U=e[55];let ee;e[56]!==a?(ee=a("50\u2013100ms avg execution"),e[56]=a,e[57]=ee):ee=e[57];let te;e[58]!==ee?(te=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ee}),e[58]=ee,e[59]=te):te=e[59];let re;e[60]!==U||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[U,te]}),e[60]=U,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==Z||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[Z,re]}),e[63]=Z,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==A?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:A}),e[70]=A,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let m;e[76]!==ne||e[77]!==oe?(m=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=m):m=e[78];let E;e[79]!==le||e[80]!==m?(E=(0,t.jsxs)(fe,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=E):E=e[81],e[82]!==X||e[83]!==ae||e[84]!==E?(g=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[X,ae,E]}),e[82]=X,e[83]=ae,e[84]=E,e[85]=g):g=e[85];let Q;e[86]!==a?(Q=a("Query leaderboard"),e[86]=a,e[87]=Q):Q=e[87];let F;e[88]!==Q?(F=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:Q}),e[88]=Q,e[89]=F):F=e[89];let de;e[90]!==r||e[91]!==a?(de=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=de):de=e[92];let be;e[93]!==de?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:de}),e[93]=de,e[94]=be):be=e[94];let ve;e[95]!==F||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[F,be]}),e[95]=F,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 Fe;e[104]===Symbol.for("react.memo_cache_sentinel")?(Fe=(0,t.jsx)(Ct,{}),e[104]=Fe):Fe=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Tt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Fe}),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 ke;e[109]!==qe?(ke=(0,t.jsx)(Pe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=ke):ke=e[110];let $e;e[111]!==a?($e=a("Avg time"),e[111]=a,e[112]=$e):$e=e[112];let Me;e[113]!==$e?(Me=(0,t.jsx)(Pe,{value:"avgTime",children:$e}),e[113]=$e,e[114]=Me):Me=e[114];let _e;e[115]!==a?(_e=a("Execution count"),e[115]=a,e[116]=_e):_e=e[116];let De;e[117]!==_e?(De=(0,t.jsx)(Pe,{value:"execCount",children:_e}),e[117]=_e,e[118]=De):De=e[118];let Ie;e[119]!==a?(Ie=a("Rows read"),e[119]=a,e[120]=Ie):Ie=e[120];let Ce;e[121]!==Ie?(Ce=(0,t.jsx)(Pe,{value:"rowsRead",children:Ie}),e[121]=Ie,e[122]=Ce):Ce=e[122];let Te;e[123]!==ke||e[124]!==Me||e[125]!==De||e[126]!==Ce?(Te=(0,t.jsxs)(Rt,{children:[ke,Me,De,Ce]}),e[123]=ke,e[124]=Me,e[125]=De,e[126]=Ce,e[127]=Te):Te=e[127];let Re;e[128]!==r||e[129]!==we||e[130]!==Te?(Re=(0,t.jsxs)(It,{onValueChange:S,value:r,children:[we,Te]}),e[128]=r,e[129]=we,e[130]=Te,e[131]=Re):Re=e[131];let ze;e[132]!==Ne||e[133]!==Re?(ze=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,Re]}),e[132]=Ne,e[133]=Re,e[134]=ze):ze=e[134],e[135]!==ve||e[136]!==ze?(x=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,ze]}),e[135]=ve,e[136]=ze,e[137]=x):x=e[137],u=fe;let Ke;e[138]!==a?(Ke=a("Statements"),e[138]=a,e[139]=Ke):Ke=e[139];let Je;e[140]!==Ke?(Je=(0,t.jsx)(Oe,{children:Ke}),e[140]=Ke,e[141]=Je):Je=e[141],w=(0,t.jsxs)(Ae,{children:[Je,(0,t.jsx)(gt,{children:a("{count} tracked statements",{count:I.length})})]}),p=pe,M="space-y-2";let He;e[142]!==n||e[143]!==a?(He=o(R=>{let ue=R.normalizedSql,W=n.has(ue),he=Xe(R.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":W,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{J(ue)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(lr,{level:he}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:R.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:Qe(R.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:Qe(R.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),R.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Qe(R.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(R.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),W&&(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:R.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[R.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:Qe(R.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(R.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:Qe(R.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(R.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(R.rowsWritten)})]})]})]})]},ue)},"Ee"),e[142]=n,e[143]=a,e[144]=He):He=e[144],b=I.map(He)}e[2]=n,e[3]=l,e[4]=r,e[5]=a,e[6]=p,e[7]=u,e[8]=h,e[9]=M,e[10]=b,e[11]=w,e[12]=_,e[13]=d,e[14]=g,e[15]=x}else p=e[6],u=e[7],h=e[8],M=e[9],b=e[10],w=e[11],_=e[12],d=e[13],g=e[14],x=e[15];if(h!==Symbol.for("react.early_return_sentinel"))return h;let q;e[145]!==M||e[146]!==b?(q=(0,t.jsx)("div",{className:M,children:b}),e[145]=M,e[146]=b,e[147]=q):q=e[147];let k;e[148]!==p||e[149]!==q?(k=(0,t.jsx)(p,{children:q}),e[148]=p,e[149]=q,e[150]=k):k=e[150];let y;e[151]!==u||e[152]!==k||e[153]!==w?(y=(0,t.jsxs)(u,{children:[w,k]}),e[151]=u,e[152]=k,e[153]=w,e[154]=y):y=e[154];let D;return e[155]!==y||e[156]!==_||e[157]!==d||e[158]!==g||e[159]!==x?(D=(0,t.jsxs)("div",{className:_,"data-testid":d,children:[g,x,y]}),e[155]=y,e[156]=_,e[157]=d,e[158]=g,e[159]=x,e[160]=D):D=e[160],D},"ir");function or(s){return Xe(s.avgDurationMs)==="critical"}o(or,"or");function dr(s){return Xe(s.avgDurationMs)==="warning"}o(dr,"cr");function cr(s){return Xe(s.avgDurationMs)==="good"}o(cr,"dr");var mr=["1m","5m","15m","1h"],ur=o(s=>new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ur"),hr=o(s=>s.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ur(e.bucketMs)})),"hr"),gr=o(({shardKey:s=""})=>{let e=ge(),[l,a]=(0,P.useState)("15m"),r=je(Le.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,c=hr(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:mr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===l,className:ht("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===l&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:o(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Be,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),c.length===0?(0,t.jsx)(ft,{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)(et,{height:140,width:"100%",children:(0,t.jsxs)(wt,{data:c,children:[(0,t.jsx)(rt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(at,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(st,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(tt,{}),(0,t.jsx)(Nt,{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)(et,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:c,children:[(0,t.jsx)(rt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(at,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(st,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(tt,{}),(0,t.jsx)(yt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(ir,{queryStats:r?.entries??[]})]})},"gr"),fr=pt(Le.getMetrics),pr=o((s,e)=>s?e:"overview","pr"),Pr=o(({initialShardKey:s})=>{let e=mt(),l=ge(),a=ut(),{queryShardKey:r,setShardKey:c,shardKey:i}=Mt(s),[n,$]=(0,P.useState)("overview"),[f,S]=(0,P.useState)([]),p=(0,P.useRef)(null),u=(0,P.useRef)(null),h=(0,P.useRef)(!0);(0,P.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let M=o(K=>{jt({shardKey:r,traceId:K}),Ue(a({to:"/traces"}))},"M"),{data:b,error:w,liveError:_}=je(Le.getMetrics,{},{live:!0,shardKey:r}),d=b??null;(0,P.useEffect)(()=>{if(b===void 0)return;kt(r);let K=b,H=p.current,L=u.current!==null&&u.current!==K.shard;if(u.current=K.shard,p.current=K.requests,L){S([]);return}H!==null&&K.requests>=H&&S(O=>[...O,K.requests-H].slice(-30))},[b,r]);let[g,x]=(0,P.useState)(null),[q,k]=(0,P.useState)(!1),y=o(async()=>{k(!0);let K=Lt(i,qt());try{let H=await Promise.all(K.map(async L=>{try{let O=await e.query(fr,{},xt(L));return{error:null,metrics:O,shard:L===""?O.shard:L}}catch(O){return{error:bt(O),metrics:null,shard:L===""?"__root__":L}}}));h.current&&x(H)}finally{h.current&&k(!1)}},"y"),D=g===null?null:Kt(g),I=d===null||d.requests===0?"\u2014":`${(d.errors/d.requests*100).toFixed(1)}%`,C=f.length>0?f.at(-1):0,T=d?At(d):{p90:0,p95:0},N=(0,P.useMemo)(()=>{if(!d||!("queryStats"in d))return;let K=d.queryStats;if(!(!K||!Array.isArray(K)))return Ot(K)},[d]),v=pr(N!==void 0,n),z=o(()=>{Ue(y())},"T"),A=o(()=>{x(null)},"z"),j=o(()=>{$("overview")},"K"),J=o(()=>{$("query-insights")},"U");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)($t,{onChange:c,testId:"mt-shard-input",value:i}),(0,t.jsx)(_t,{message:_,prefix:"mt"}),(0,t.jsx)(Ze,{"data-testid":"mt-aggregate",disabled:q,onClick:z,size:"sm",type:"button",variant:"secondary",children:l(q?"Aggregating\u2026":"All shards")}),g!==null&&(0,t.jsx)(Ze,{"data-testid":"mt-aggregate-clear",onClick:A,size:"sm",type:"button",variant:"ghost",children:l("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:Dt,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")})]}),w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:w}),N!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("button",{className:`pb-2 text-sm font-medium transition-colors ${v==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:j,type:"button",children:l("Overview")}),(0,t.jsxs)("button",{className:`pb-2 text-sm font-medium transition-colors ${v==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:J,type:"button",children:[l("Query insights"),N.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:N.length})]})]}),v==="query-insights"&&N!==void 0&&(0,t.jsx)(gr,{shardKey:r}),v==="overview"&&d!==null&&(0,t.jsx)(sr,{currentDelta:C,errorRate:I,history:f,latencyPercentiles:T,metrics:d}),v==="overview"&&d===null&&null,v==="overview"&&(0,t.jsx)(er,{onOpenTrace:M,shardKey:r}),v==="overview"&&D!==null&&g!==null&&(0,t.jsx)(tr,{aggregate:D,shardResults:g})]})},"Qr");export{Pr as MetricsPanel};
|
|
1
|
+
import{a as jt}from"./chunk-PKSAWP56.js";import{a as me}from"./chunk-TMGHRD6W.js";import{a as Kt,b as Lt,c as At,d as Ot,e as ot}from"./chunk-M2M3RYJU.js";import{a as zt}from"./chunk-QWGT25SE.js";import{e as Dt}from"./chunk-XF2B7P5A.js";import{a as It,b as Ct,c as Tt,d as Rt,e as Pe}from"./chunk-MKYEFQCA.js";import"./chunk-2PJNAWB3.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as _t}from"./chunk-IGCNMZSB.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import{a as et,b as tt,c as rt,d as yt,e as Nt,f as at,g as st,h as St,i as wt}from"./chunk-OQIGV6FX.js";import"./chunk-4UOFSGUS.js";import"./chunk-CZZWYUTR.js";import{a as Mt}from"./chunk-3CWGJYBB.js";import{a as $t}from"./chunk-RMN2JN4S.js";import{a as qt,b as kt}from"./chunk-GRL5MG3Z.js";import{e as ut}from"./chunk-SMIESS7P.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{c as Ze}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Be}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import"./chunk-QLQADHFE.js";import{a as Le}from"./chunk-VDW32UET.js";import{c as je}from"./chunk-6F7KP54M.js";import{f as mt}from"./chunk-C2ZFQARQ.js";import"./chunk-XBDKZZ67.js";import{a as ft}from"./chunk-XQCVZAGU.js";import{a as lt,b as nt,c as it,d as Ee,e as ce,f as B}from"./chunk-WJQLNYGX.js";import{a as fe,b as Ae,c as Oe,d as gt,e as pe}from"./chunk-WQH3LT2P.js";import{d as ge,f as pt,g as xt,h as bt,i as vt,l as Ge,o as Ue}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as o,e as Ye,f as Ft,g as Jt,h as Ht,j as ht}from"./chunk-3XIESWL4.js";var P=Ye(Ft(),1);var xe=Ye(Jt(),1);var t=Ye(Ht(),1);var Wt=o((s,e)=>s<e?-1:s>e?1:0,"Jt"),ct=o(s=>{if(s===void 0)return"null";if(typeof s=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s))return`[${s.map(c=>ct(c)).join(",")}]`;let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let c=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${c} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let l=s,a=Object.keys(l).toSorted(Wt),r=[];for(let c of a){let i=l[c];i!==void 0&&r.push(`${JSON.stringify(c)}:${ct(i)}`)}return`{${r.join(",")}}`},"Ze"),Pt=o((s,e,l)=>`${s}:${e}:${ct(l??{})}`,"gt"),Qt=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"ft"),Bt=o((s,e)=>Qt(s,e),"Ht"),Gt=o(s=>Qt(s.kind,s),"Gt"),dt=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"Xe"),Vt=o(s=>Array.isArray(s?.series)?s.series:[],"Wt"),Xt="FUNCTION_NOT_FOUND",Yt=o(s=>{let e=new Map;if(!Array.isArray(s?.series))return e;for(let l of s.series)e.set(Pt(l.kind,l.name,l.attributes),l.points);return e},"Yt"),Zt={counter:"secondary",gauge:"default",histogram:"outline"},Ut=o(s=>{let e=(0,xe.c)(18),{name:l,onOpenTrace:a,traceId:r}=s,c=ge();if(r===void 0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=u):u=e[0],u}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 u=`mt-instrument-trace-${l}`,h;return e[3]!==n||e[4]!==u||e[5]!==r?(h=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":u,title:r,children:n}),e[3]=n,e[4]=u,e[5]=r,e[6]=h):h=e[6],h}let $=`mt-instrument-trace-${l}`,f;e[7]!==a||e[8]!==r?(f=o(()=>{a(r)},"f"),e[7]=a,e[8]=r,e[9]=f):f=e[9];let S;e[10]!==c||e[11]!==r?(S=c("Open the exemplar trace {trace}",{trace:r}),e[10]=c,e[11]=r,e[12]=S):S=e[12];let p;return e[13]!==n||e[14]!==$||e[15]!==f||e[16]!==S?(p=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":$,onClick:f,title:S,type:"button",children:n}),e[13]=n,e[14]=$,e[15]=f,e[16]=S,e[17]=p):p=e[17],p},"Zt"),er=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=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:$,errorSource:f}=je(Le.getMetricSeries,c,i),S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S={},e[3]=S):S=e[3];let p;e[4]!==a?(p={live:!0,shardKey:a},e[4]=a,e[5]=p):p=e[5];let{data:u}=je(Le.getMetricHistory,S,p),h,M,b,w,_,d,g,x,q,k,y,D,I;if(e[6]!==n||e[7]!==$||e[8]!==f||e[9]!==u||e[10]!==l||e[11]!==r){x=Symbol.for("react.early_return_sentinel");e:{let A=Vt(n),j=vt(f)===Xt;if($!==null&&!j){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let E;e[27]!==m?(E=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=E):E=e[28];let Q;e[29]!==$||e[30]!==r?(Q=r("Instruments unavailable: {error}",{error:$}),e[29]=$,e[30]=r,e[31]=Q):Q=e[31];let F;e[32]!==Q?(F=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:Q}),e[32]=Q,e[33]=F):F=e[33];let de;e[34]!==E||e[35]!==F?(de=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[E,F]}),e[34]=E,e[35]=F,e[36]=de):de=e[36],x=de;break e}if(A.length===0){x=null;break e}let J=Yt(u),K;e[37]!==r?(K=o(m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),"L"),e[37]=r,e[38]=K):K=e[38];let H=K;_="flex flex-col gap-2",d="mt-instruments";let L;e[39]!==r?(L=r("Instruments"),e[39]=r,e[40]=L):L=e[40],e[41]!==L?(g=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:L}),e[41]=L,e[42]=g):g=e[42],w=fe,I="overflow-hidden py-0",b=pe,D="px-0",M=lt,k="mt-instruments-table";let O;e[43]!==r?(O=r("name"),e[43]=r,e[44]=O):O=e[44];let G;e[45]!==O?(G=(0,t.jsx)(ce,{children:O}),e[45]=O,e[46]=G):G=e[46];let V;e[47]!==r?(V=r("kind"),e[47]=r,e[48]=V):V=e[48];let X;e[49]!==V?(X=(0,t.jsx)(ce,{children:V}),e[49]=V,e[50]=X):X=e[50];let Y;e[51]!==r?(Y=r("value"),e[51]=r,e[52]=Y):Y=e[52];let Z;e[53]!==Y?(Z=(0,t.jsx)(ce,{className:"text-right",children:Y}),e[53]=Y,e[54]=Z):Z=e[54];let U;e[55]!==r?(U=r("count"),e[55]=r,e[56]=U):U=e[56];let ee;e[57]!==U?(ee=(0,t.jsx)(ce,{className:"text-right",children:U}),e[57]=U,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(ce,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(ce,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(ce,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(ce,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==G||e[76]!==X||e[77]!==Z||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(y=(0,t.jsx)(nt,{children:(0,t.jsxs)(Ee,{children:[G,X,Z,ee,re,se,ne,oe]})}),e[75]=G,e[76]=X,e[77]=Z,e[78]=ee,e[79]=re,e[80]=se,e[81]=ne,e[82]=oe,e[83]=y):y=e[83],h=it,q=A.map(m=>{let E=zt(m.attributes),Q=Pt(m.kind,m.name,m.attributes),F=(J.get(Q)??[]).map(de=>Bt(m.kind,de));return(0,t.jsxs)(Ee,{"data-testid":`mt-instrument-${m.name}`,children:[(0,t.jsx)(B,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),(0,t.jsx)(B,{children:(0,t.jsx)(Be,{variant:Zt[m.kind],children:H(m.kind)})}),(0,t.jsx)(B,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:dt(Gt(m))}),(0,t.jsx)(B,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),(0,t.jsx)(B,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"\u2014":`${dt(m.min)}\u2013${dt(m.max)}`}),(0,t.jsx)(B,{children:F.length>=2?(0,t.jsx)(ot,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:F,testId:`mt-instrument-trend-${m.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)(Ut,{name:m.name,onOpenTrace:l,traceId:m.exemplarTraceId})}),(0,t.jsx)(B,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:E,children:E===""?"\u2014":E})]},Q)})}e[6]=n,e[7]=$,e[8]=f,e[9]=u,e[10]=l,e[11]=r,e[12]=h,e[13]=M,e[14]=b,e[15]=w,e[16]=_,e[17]=d,e[18]=g,e[19]=x,e[20]=q,e[21]=k,e[22]=y,e[23]=D,e[24]=I}else h=e[12],M=e[13],b=e[14],w=e[15],_=e[16],d=e[17],g=e[18],x=e[19],q=e[20],k=e[21],y=e[22],D=e[23],I=e[24];if(x!==Symbol.for("react.early_return_sentinel"))return x;let C;e[84]!==h||e[85]!==q?(C=(0,t.jsx)(h,{children:q}),e[84]=h,e[85]=q,e[86]=C):C=e[86];let T;e[87]!==M||e[88]!==C||e[89]!==k||e[90]!==y?(T=(0,t.jsxs)(M,{"data-testid":k,children:[y,C]}),e[87]=M,e[88]=C,e[89]=k,e[90]=y,e[91]=T):T=e[91];let N;e[92]!==b||e[93]!==T||e[94]!==D?(N=(0,t.jsx)(b,{className:D,children:T}),e[92]=b,e[93]=T,e[94]=D,e[95]=N):N=e[95];let v;e[96]!==w||e[97]!==N||e[98]!==I?(v=(0,t.jsx)(w,{className:I,children:N}),e[96]=w,e[97]=N,e[98]=I,e[99]=v):v=e[99];let z;return e[100]!==_||e[101]!==d||e[102]!==g||e[103]!==v?(z=(0,t.jsxs)("section",{className:_,"data-testid":d,children:[g,v]}),e[100]=_,e[101]=d,e[102]=g,e[103]=v,e[104]=z):z=e[104],z},"er"),tr=o(s=>{let e=(0,xe.c)(74),{aggregate:l,shardResults:a}=s,r=ge(),c;e[0]!==r?(c=r("Shards"),e[0]=r,e[1]=c):c=e[1];let i;e[2]!==l.failed||e[3]!==l.reachable||e[4]!==r?(i=l.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:l.failed,reachable:l.reachable}):r("{reachable} reachable",{reachable:l.reachable}),e[2]=l.failed,e[3]=l.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==c||e[7]!==i?(n=(0,t.jsx)(me,{label:c,testId:"mt-agg-shards",value:i}),e[6]=c,e[7]=i,e[8]=n):n=e[8];let $;e[9]!==r?($=r("Total requests"),e[9]=r,e[10]=$):$=e[10];let f;e[11]!==l.totalRequests||e[12]!==$?(f=(0,t.jsx)(me,{label:$,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=$,e[13]=f):f=e[13];let S;e[14]!==r?(S=r("Total errors"),e[14]=r,e[15]=S):S=e[15];let p;e[16]!==l.totalErrors||e[17]!==S?(p=(0,t.jsx)(me,{label:S,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=S,e[18]=p):p=e[18];let u;e[19]!==r?(u=r("Total database size"),e[19]=r,e[20]=u):u=e[20];let h;e[21]!==l.totalDatabaseSize?(h=Ge(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=h):h=e[22];let M;e[23]!==u||e[24]!==h?(M=(0,t.jsx)(me,{label:u,testId:"mt-agg-db-size",value:h}),e[23]=u,e[24]=h,e[25]=M):M=e[25];let b;e[26]!==r?(b=r("Combined cache hit rate"),e[26]=r,e[27]=b):b=e[27];let w;e[28]!==l.hitRate||e[29]!==r?(w=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=w):w=e[30];let _;e[31]!==b||e[32]!==w?(_=(0,t.jsx)(me,{label:b,testId:"mt-agg-cache",value:w}),e[31]=b,e[32]=w,e[33]=_):_=e[33];let d;e[34]!==M||e[35]!==_||e[36]!==n||e[37]!==f||e[38]!==p?(d=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,f,p,M,_]}),e[34]=M,e[35]=_,e[36]=n,e[37]=f,e[38]=p,e[39]=d):d=e[39];let g;e[40]!==r?(g=r("shard"),e[40]=r,e[41]=g):g=e[41];let x;e[42]!==g?(x=(0,t.jsx)(ce,{children:g}),e[42]=g,e[43]=x):x=e[43];let q;e[44]!==r?(q=r("requests"),e[44]=r,e[45]=q):q=e[45];let k;e[46]!==q?(k=(0,t.jsx)(ce,{children:q}),e[46]=q,e[47]=k):k=e[47];let y;e[48]!==r?(y=r("errors"),e[48]=r,e[49]=y):y=e[49];let D;e[50]!==y?(D=(0,t.jsx)(ce,{children:y}),e[50]=y,e[51]=D):D=e[51];let I;e[52]!==r?(I=r("db size"),e[52]=r,e[53]=I):I=e[53];let C;e[54]!==I?(C=(0,t.jsx)(ce,{children:I}),e[54]=I,e[55]=C):C=e[55];let T;e[56]!==x||e[57]!==k||e[58]!==D||e[59]!==C?(T=(0,t.jsx)(nt,{children:(0,t.jsxs)(Ee,{children:[x,k,D,C]})}),e[56]=x,e[57]=k,e[58]=D,e[59]=C,e[60]=T):T=e[60];let N;if(e[61]!==a||e[62]!==r){let j;e[64]!==r?(j=o(J=>(0,t.jsxs)(Ee,{"data-testid":`mt-agg-row-${J.shard}`,children:[(0,t.jsx)(B,{children:J.shard}),J.metrics===null?(0,t.jsx)(B,{className:"text-destructive",colSpan:3,children:J.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{className:"tabular-nums",children:J.metrics.requests}),(0,t.jsx)(B,{className:"tabular-nums",children:J.metrics.errors}),(0,t.jsx)(B,{className:"tabular-nums",children:Ge(J.metrics.databaseSize)})]})]},J.shard),"K"),e[64]=r,e[65]=j):j=e[65],N=a.map(j),e[61]=a,e[62]=r,e[63]=N}else N=e[63];let v;e[66]!==N?(v=(0,t.jsx)(it,{children:N}),e[66]=N,e[67]=v):v=e[67];let z;e[68]!==T||e[69]!==v?(z=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(lt,{"data-testid":"mt-agg-table",children:[T,v]})})}),e[68]=T,e[69]=v,e[70]=z):z=e[70];let A;return e[71]!==d||e[72]!==z?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[d,z]}),e[71]=d,e[72]=z,e[73]=A):A=e[73],A},"tr"),rr=o(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return l>0?`${l.toString()}h ${a.toString()}m`:a>0?`${a.toString()}m ${r.toString()}s`:`${r.toString()}s`},"rr"),ar=o((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"ar"),Et=o(s=>s<=0?"\u2014":s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"ct"),sr=o(s=>{let e=(0,xe.c)(75),{currentDelta:l,errorRate:a,history:r,latencyPercentiles:c,metrics:i}=s,n=ge(),$;e[0]!==r||e[1]!==n?($=r.length>=2?(0,t.jsx)(ot,{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]=$):$=e[2];let f;e[3]!==l||e[4]!==r.length||e[5]!==n?(f=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${l.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=l,e[4]=r.length,e[5]=n,e[6]=f):f=e[6];let S;e[7]!==n?(S=n("Requests"),e[7]=n,e[8]=S):S=e[8];let p;e[9]!==i.requests||e[10]!==$||e[11]!==f||e[12]!==S?(p=(0,t.jsx)(me,{chart:$,footer:f,label:S,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=$,e[11]=f,e[12]=S,e[13]=p):p=e[13];let u;e[14]!==a||e[15]!==n?(u=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=u):u=e[16];let h;e[17]!==n?(h=n("Errors"),e[17]=n,e[18]=h):h=e[18];let M;e[19]!==a||e[20]!==i.errors?(M=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=M):M=e[21];let b;e[22]!==u||e[23]!==h||e[24]!==M?(b=(0,t.jsx)(me,{footer:u,label:h,testId:"mt-errors",value:M}),e[22]=u,e[23]=h,e[24]=M,e[25]=b):b=e[25];let w;e[26]!==c.p90?(w=c.p90>0?`P90 ${Et(c.p90)}`:void 0,e[26]=c.p90,e[27]=w):w=e[27];let _;e[28]!==n?(_=n("P95 latency"),e[28]=n,e[29]=_):_=e[29];let d;e[30]!==c.p95?(d=c.p95>0?Et(c.p95):"\u2014",e[30]=c.p95,e[31]=d):d=e[31];let g;e[32]!==_||e[33]!==d||e[34]!==w?(g=(0,t.jsx)(me,{footer:w,label:_,testId:"mt-p95",value:d}),e[32]=_,e[33]=d,e[34]=w,e[35]=g):g=e[35];let x;e[36]!==i.cache||e[37]!==n?(x=i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${n("cache entries")}`,e[36]=i.cache,e[37]=n,e[38]=x):x=e[38];let q;e[39]!==n?(q=n("Database size"),e[39]=n,e[40]=q):q=e[40];let k;e[41]!==i.databaseSize?(k=Ge(i.databaseSize),e[41]=i.databaseSize,e[42]=k):k=e[42];let y;e[43]!==x||e[44]!==q||e[45]!==k?(y=(0,t.jsx)(me,{footer:x,label:q,testId:"mt-db-size",value:k}),e[43]=x,e[44]=q,e[45]=k,e[46]=y):y=e[46];let D;e[47]!==n?(D=n("Shard"),e[47]=n,e[48]=D):D=e[48];let I;e[49]!==i.shard||e[50]!==D?(I=(0,t.jsx)(me,{label:D,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=D,e[51]=I):I=e[51];let C;e[52]!==n?(C=n("Uptime"),e[52]=n,e[53]=C):C=e[53];let T;e[54]!==i.uptimeMs?(T=rr(i.uptimeMs),e[54]=i.uptimeMs,e[55]=T):T=e[55];let N;e[56]!==C||e[57]!==T?(N=(0,t.jsx)(me,{label:C,testId:"mt-uptime",value:T}),e[56]=C,e[57]=T,e[58]=N):N=e[58];let v;e[59]!==n?(v=n("Cache hit rate"),e[59]=n,e[60]=v):v=e[60];let z;e[61]!==i.cache||e[62]!==n?(z=i.cache===null?n("no cache configured"):n("{rate} ({count} entries)",{count:i.cache.entries,rate:ar(i.cache.hits,i.cache.misses)}),e[61]=i.cache,e[62]=n,e[63]=z):z=e[63];let A;e[64]!==v||e[65]!==z?(A=(0,t.jsx)(me,{label:v,testId:"mt-cache",value:z}),e[64]=v,e[65]=z,e[66]=A):A=e[66];let j;return e[67]!==g||e[68]!==y||e[69]!==I||e[70]!==N||e[71]!==A||e[72]!==p||e[73]!==b?(j=(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:[p,b,g,y,I,N,A]}),e[67]=g,e[68]=y,e[69]=I,e[70]=N,e[71]=A,e[72]=p,e[73]=b,e[74]=j):j=e[74],j},"lr"),Xe=o(s=>s>=100?"critical":s>=50?"warning":"good","Ge"),Qe=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Oe"),Ve=o(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"Be"),lr=o(s=>{let e=(0,xe.c)(3),{level:l}=s;if(l==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Be,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(l==="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},"sr"),nr=o((s,e)=>{let l=[...s];return l.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}}),l},"nr"),ir=o(s=>{let e=(0,xe.c)(161),{queryStats:l}=s,a=ge(),[r,c]=(0,P.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,$]=(0,P.useState)(i),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o(I=>{I!==null&&c(I)},"f"),e[1]=f):f=e[1];let S=f,p,u,h,M,b,w,_,d,g,x;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){h=Symbol.for("react.early_return_sentinel");e:{let I=nr(l,r),C;e[16]!==l?(C=l.filter(or),e[16]=l,e[17]=C):C=e[17];let T=C.length,N;e[18]!==l?(N=l.filter(dr),e[18]=l,e[19]=N):N=e[19];let v=N.length,z;e[20]!==l?(z=l.filter(cr),e[20]=l,e[21]=z):z=e[21];let A=z.length,j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=o(R=>{$(ue=>{let W=new Set(ue);return W.has(R)?W.delete(R):W.add(R),W})},"K"),e[22]=j):j=e[22];let J=j;if(l.length===0){let R;e[23]!==a?(R=a("No query insights yet"),e[23]=a,e[24]=R):R=e[24];let ue;e[25]!==R?(ue=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:R}),e[25]=R,e[26]=ue):ue=e[26];let W;e[27]!==a?(W=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=W):W=e[28];let he;e[29]!==W?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:W}),e[29]=W,e[30]=he):he=e[30];let We;e[31]!==ue||e[32]!==he?(We=(0,t.jsx)(fe,{children:(0,t.jsx)(pe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ue,he]})})}),e[31]=ue,e[32]=he,e[33]=We):We=e[33],h=We;break e}_="space-y-4",d="qi-root";let K;e[34]!==a?(K=a("Critical queries"),e[34]=a,e[35]=K):K=e[35];let H;e[36]!==K?(H=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:K})}),e[36]=K,e[37]=H):H=e[37];let L;e[38]!==T?(L=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:T}),e[38]=T,e[39]=L):L=e[39];let O;e[40]!==a?(O=a(">100ms avg execution"),e[40]=a,e[41]=O):O=e[41];let G;e[42]!==O?(G=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:O}),e[42]=O,e[43]=G):G=e[43];let V;e[44]!==L||e[45]!==G?(V=(0,t.jsxs)(pe,{children:[L,G]}),e[44]=L,e[45]=G,e[46]=V):V=e[46];let X;e[47]!==H||e[48]!==V?(X=(0,t.jsxs)(fe,{children:[H,V]}),e[47]=H,e[48]=V,e[49]=X):X=e[49];let Y;e[50]!==a?(Y=a("Moderate queries"),e[50]=a,e[51]=Y):Y=e[51];let Z;e[52]!==Y?(Z=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:Y})}),e[52]=Y,e[53]=Z):Z=e[53];let U;e[54]!==v?(U=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:v}),e[54]=v,e[55]=U):U=e[55];let ee;e[56]!==a?(ee=a("50\u2013100ms avg execution"),e[56]=a,e[57]=ee):ee=e[57];let te;e[58]!==ee?(te=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ee}),e[58]=ee,e[59]=te):te=e[59];let re;e[60]!==U||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[U,te]}),e[60]=U,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==Z||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[Z,re]}),e[63]=Z,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==A?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:A}),e[70]=A,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let m;e[76]!==ne||e[77]!==oe?(m=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=m):m=e[78];let E;e[79]!==le||e[80]!==m?(E=(0,t.jsxs)(fe,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=E):E=e[81],e[82]!==X||e[83]!==ae||e[84]!==E?(g=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[X,ae,E]}),e[82]=X,e[83]=ae,e[84]=E,e[85]=g):g=e[85];let Q;e[86]!==a?(Q=a("Query leaderboard"),e[86]=a,e[87]=Q):Q=e[87];let F;e[88]!==Q?(F=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:Q}),e[88]=Q,e[89]=F):F=e[89];let de;e[90]!==r||e[91]!==a?(de=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=de):de=e[92];let be;e[93]!==de?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:de}),e[93]=de,e[94]=be):be=e[94];let ve;e[95]!==F||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[F,be]}),e[95]=F,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 Fe;e[104]===Symbol.for("react.memo_cache_sentinel")?(Fe=(0,t.jsx)(Ct,{}),e[104]=Fe):Fe=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Tt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Fe}),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 ke;e[109]!==qe?(ke=(0,t.jsx)(Pe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=ke):ke=e[110];let $e;e[111]!==a?($e=a("Avg time"),e[111]=a,e[112]=$e):$e=e[112];let Me;e[113]!==$e?(Me=(0,t.jsx)(Pe,{value:"avgTime",children:$e}),e[113]=$e,e[114]=Me):Me=e[114];let _e;e[115]!==a?(_e=a("Execution count"),e[115]=a,e[116]=_e):_e=e[116];let De;e[117]!==_e?(De=(0,t.jsx)(Pe,{value:"execCount",children:_e}),e[117]=_e,e[118]=De):De=e[118];let Ie;e[119]!==a?(Ie=a("Rows read"),e[119]=a,e[120]=Ie):Ie=e[120];let Ce;e[121]!==Ie?(Ce=(0,t.jsx)(Pe,{value:"rowsRead",children:Ie}),e[121]=Ie,e[122]=Ce):Ce=e[122];let Te;e[123]!==ke||e[124]!==Me||e[125]!==De||e[126]!==Ce?(Te=(0,t.jsxs)(Rt,{children:[ke,Me,De,Ce]}),e[123]=ke,e[124]=Me,e[125]=De,e[126]=Ce,e[127]=Te):Te=e[127];let Re;e[128]!==r||e[129]!==we||e[130]!==Te?(Re=(0,t.jsxs)(It,{onValueChange:S,value:r,children:[we,Te]}),e[128]=r,e[129]=we,e[130]=Te,e[131]=Re):Re=e[131];let ze;e[132]!==Ne||e[133]!==Re?(ze=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,Re]}),e[132]=Ne,e[133]=Re,e[134]=ze):ze=e[134],e[135]!==ve||e[136]!==ze?(x=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,ze]}),e[135]=ve,e[136]=ze,e[137]=x):x=e[137],u=fe;let Ke;e[138]!==a?(Ke=a("Statements"),e[138]=a,e[139]=Ke):Ke=e[139];let Je;e[140]!==Ke?(Je=(0,t.jsx)(Oe,{children:Ke}),e[140]=Ke,e[141]=Je):Je=e[141],w=(0,t.jsxs)(Ae,{children:[Je,(0,t.jsx)(gt,{children:a("{count} tracked statements",{count:I.length})})]}),p=pe,M="space-y-2";let He;e[142]!==n||e[143]!==a?(He=o(R=>{let ue=R.normalizedSql,W=n.has(ue),he=Xe(R.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":W,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{J(ue)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(lr,{level:he}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:R.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:Qe(R.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:Qe(R.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),R.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Qe(R.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(R.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),W&&(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:R.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[R.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:Qe(R.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(R.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:Qe(R.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(R.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(R.rowsWritten)})]})]})]})]},ue)},"Ee"),e[142]=n,e[143]=a,e[144]=He):He=e[144],b=I.map(He)}e[2]=n,e[3]=l,e[4]=r,e[5]=a,e[6]=p,e[7]=u,e[8]=h,e[9]=M,e[10]=b,e[11]=w,e[12]=_,e[13]=d,e[14]=g,e[15]=x}else p=e[6],u=e[7],h=e[8],M=e[9],b=e[10],w=e[11],_=e[12],d=e[13],g=e[14],x=e[15];if(h!==Symbol.for("react.early_return_sentinel"))return h;let q;e[145]!==M||e[146]!==b?(q=(0,t.jsx)("div",{className:M,children:b}),e[145]=M,e[146]=b,e[147]=q):q=e[147];let k;e[148]!==p||e[149]!==q?(k=(0,t.jsx)(p,{children:q}),e[148]=p,e[149]=q,e[150]=k):k=e[150];let y;e[151]!==u||e[152]!==k||e[153]!==w?(y=(0,t.jsxs)(u,{children:[w,k]}),e[151]=u,e[152]=k,e[153]=w,e[154]=y):y=e[154];let D;return e[155]!==y||e[156]!==_||e[157]!==d||e[158]!==g||e[159]!==x?(D=(0,t.jsxs)("div",{className:_,"data-testid":d,children:[g,x,y]}),e[155]=y,e[156]=_,e[157]=d,e[158]=g,e[159]=x,e[160]=D):D=e[160],D},"ir");function or(s){return Xe(s.avgDurationMs)==="critical"}o(or,"or");function dr(s){return Xe(s.avgDurationMs)==="warning"}o(dr,"cr");function cr(s){return Xe(s.avgDurationMs)==="good"}o(cr,"dr");var mr=["1m","5m","15m","1h"],ur=o(s=>new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ur"),hr=o(s=>s.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ur(e.bucketMs)})),"hr"),gr=o(({shardKey:s=""})=>{let e=ge(),[l,a]=(0,P.useState)("15m"),r=je(Le.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,c=hr(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:mr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===l,className:ht("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===l&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:o(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Be,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),c.length===0?(0,t.jsx)(ft,{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)(et,{height:140,width:"100%",children:(0,t.jsxs)(wt,{data:c,children:[(0,t.jsx)(rt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(at,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(st,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(tt,{}),(0,t.jsx)(Nt,{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)(et,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:c,children:[(0,t.jsx)(rt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(at,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(st,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(tt,{}),(0,t.jsx)(yt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(ir,{queryStats:r?.entries??[]})]})},"gr"),fr=pt(Le.getMetrics),pr=o((s,e)=>s?e:"overview","pr"),Pr=o(({initialShardKey:s})=>{let e=mt(),l=ge(),a=ut(),{queryShardKey:r,setShardKey:c,shardKey:i}=Mt(s),[n,$]=(0,P.useState)("overview"),[f,S]=(0,P.useState)([]),p=(0,P.useRef)(null),u=(0,P.useRef)(null),h=(0,P.useRef)(!0);(0,P.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let M=o(K=>{jt({shardKey:r,traceId:K}),Ue(a({to:"/traces"}))},"M"),{data:b,error:w,liveError:_}=je(Le.getMetrics,{},{live:!0,shardKey:r}),d=b??null;(0,P.useEffect)(()=>{if(b===void 0)return;kt(r);let K=b,H=p.current,L=u.current!==null&&u.current!==K.shard;if(u.current=K.shard,p.current=K.requests,L){S([]);return}H!==null&&K.requests>=H&&S(O=>[...O,K.requests-H].slice(-30))},[b,r]);let[g,x]=(0,P.useState)(null),[q,k]=(0,P.useState)(!1),y=o(async()=>{k(!0);let K=Lt(i,qt());try{let H=await Promise.all(K.map(async L=>{try{let O=await e.query(fr,{},xt(L));return{error:null,metrics:O,shard:L===""?O.shard:L}}catch(O){return{error:bt(O),metrics:null,shard:L===""?"__root__":L}}}));h.current&&x(H)}finally{h.current&&k(!1)}},"y"),D=g===null?null:Kt(g),I=d===null||d.requests===0?"\u2014":`${(d.errors/d.requests*100).toFixed(1)}%`,C=f.length>0?f.at(-1):0,T=d?At(d):{p90:0,p95:0},N=(0,P.useMemo)(()=>{if(!d||!("queryStats"in d))return;let K=d.queryStats;if(!(!K||!Array.isArray(K)))return Ot(K)},[d]),v=pr(N!==void 0,n),z=o(()=>{Ue(y())},"T"),A=o(()=>{x(null)},"z"),j=o(()=>{$("overview")},"K"),J=o(()=>{$("query-insights")},"U");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)($t,{onChange:c,testId:"mt-shard-input",value:i}),(0,t.jsx)(_t,{message:_,prefix:"mt"}),(0,t.jsx)(Ze,{"data-testid":"mt-aggregate",disabled:q,onClick:z,size:"sm",type:"button",variant:"secondary",children:l(q?"Aggregating\u2026":"All shards")}),g!==null&&(0,t.jsx)(Ze,{"data-testid":"mt-aggregate-clear",onClick:A,size:"sm",type:"button",variant:"ghost",children:l("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:Dt,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")})]}),w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:w}),N!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("button",{className:`pb-2 text-sm font-medium transition-colors ${v==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:j,type:"button",children:l("Overview")}),(0,t.jsxs)("button",{className:`pb-2 text-sm font-medium transition-colors ${v==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:J,type:"button",children:[l("Query insights"),N.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:N.length})]})]}),v==="query-insights"&&N!==void 0&&(0,t.jsx)(gr,{shardKey:r}),v==="overview"&&d!==null&&(0,t.jsx)(sr,{currentDelta:C,errorRate:I,history:f,latencyPercentiles:T,metrics:d}),v==="overview"&&d===null&&null,v==="overview"&&(0,t.jsx)(er,{onOpenTrace:M,shardKey:r}),v==="overview"&&D!==null&&g!==null&&(0,t.jsx)(tr,{aggregate:D,shardResults:g})]})},"Qr");export{Pr as MetricsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as B}from"./chunk-XF2B7P5A.js";import{b as A}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as P}from"./chunk-
|
|
1
|
+
import{b as B}from"./chunk-XF2B7P5A.js";import{b as A}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as P}from"./chunk-NCKRVNF2.js";import"./chunk-XXQUMVWH.js";import"./chunk-NJRW66LJ.js";import"./chunk-QLQADHFE.js";import{a as M}from"./chunk-VDW32UET.js";import{c as F}from"./chunk-6F7KP54M.js";import"./chunk-C2ZFQARQ.js";import"./chunk-XBDKZZ67.js";import{a as R,b as q,c as z,d as K,e as U,f as _}from"./chunk-WJQLNYGX.js";import{a as E,e as j}from"./chunk-WQH3LT2P.js";import{d as V}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as k,e as O,g as H,h as W}from"./chunk-3XIESWL4.js";var G=O(H(),1);var t=O(W(),1);var $={binding:"outline",secret:"destructive",var:"secondary"},J=k((n,e)=>{if(n===void 0)return[];let m=[];return n.workerUrl!==void 0&&m.push({label:e("URL"),value:n.workerUrl}),n.environment!==void 0&&m.push({label:e("Environment"),value:n.environment}),n.deploymentId!==void 0&&m.push({label:e("Deployment"),value:n.deploymentId}),n.versionTag!==void 0&&m.push({label:e("Version"),value:n.versionTag}),m},"B"),le=k(n=>{let e=(0,G.c)(52),{initialShardKey:m}=n,r=V(),w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];let C=m??"",S;e[1]!==C?(S={shardKey:C},e[1]=C,e[2]=S):S=e[2];let{data:s,error:l,errorSource:N,isLoading:D}=F(M.getSettings,w,S),a,c,p,d,o,i,u;if(e[3]!==l||e[4]!==N||e[5]!==s?.deploy||e[6]!==s?.settings||e[7]!==r){let L=J(s?.deploy,r),T;e[15]!==s?.settings?(T=s?.settings??[],e[15]=s?.settings,e[16]=T):T=e[16],a=T,c="flex flex-col gap-4",p="lunora-settings";let y;e[17]!==r?(y=r("Open in Cloudflare"),e[17]=r,e[18]=y):y=e[18],e[19]!==y?(d=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:B,rel:"noreferrer",target:"_blank",children:y})}),e[19]=y,e[20]=d):d=e[20];let b;e[21]!==r?(b=r("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=r,e[22]=b):b=e[22],e[23]!==b?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:b}),e[23]=b,e[24]=o):o=e[24],e[25]!==l||e[26]!==N?(i=l!==null&&(0,t.jsx)(P,{error:N,testId:"set-error"}),e[25]=l,e[26]=N,e[27]=i):i=e[27],u=L.length>0&&(0,t.jsxs)(E,{className:"py-0","data-testid":"set-deploy",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Deployment")})}),(0,t.jsx)(j,{className:"py-3",children:(0,t.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:L.map(Q)})})]}),e[3]=l,e[4]=N,e[5]=s?.deploy,e[6]=s?.settings,e[7]=r,e[8]=a,e[9]=c,e[10]=p,e[11]=d,e[12]=o,e[13]=i,e[14]=u}else a=e[8],c=e[9],p=e[10],d=e[11],o=e[12],i=e[13],u=e[14];let h;e[28]!==r?(h=r("Environment & bindings"),e[28]=r,e[29]=h):h=e[29];let f;e[30]!==h?(f=(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h})}),e[30]=h,e[31]=f):f=e[31];let g;e[32]!==l||e[33]!==D||e[34]!==a.length||e[35]!==r?(g=l===null&&!D&&a.length===0&&(0,t.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:r("No environment variables or bindings.")}),e[32]=l,e[33]=D,e[34]=a.length,e[35]=r,e[36]=g):g=e[36];let x;e[37]!==a||e[38]!==r?(x=a.length>0&&(0,t.jsx)(j,{className:"px-0 py-0",children:(0,t.jsxs)(R,{"data-testid":"set-table",children:[(0,t.jsx)(q,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(U,{children:r("name")}),(0,t.jsx)(U,{children:r("kind")}),(0,t.jsx)(U,{children:r("value")})]})}),(0,t.jsx)(z,{children:a.map(X)})]})}),e[37]=a,e[38]=r,e[39]=x):x=e[39];let v;e[40]!==f||e[41]!==g||e[42]!==x?(v=(0,t.jsxs)(E,{className:"py-0",children:[f,g,x]}),e[40]=f,e[41]=g,e[42]=x,e[43]=v):v=e[43];let I;return e[44]!==v||e[45]!==c||e[46]!==p||e[47]!==d||e[48]!==o||e[49]!==i||e[50]!==u?(I=(0,t.jsxs)("div",{className:c,"data-testid":p,children:[d,o,i,u,v]}),e[44]=v,e[45]=c,e[46]=p,e[47]=d,e[48]=o,e[49]=i,e[50]=u,e[51]=I):I=e[51],I},"le");function Q(n){return(0,t.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:n.label}),(0,t.jsx)("dd",{className:"truncate font-mono text-xs",title:n.value,children:n.value})]},n.label)}k(Q,"G");function X(n){return(0,t.jsxs)(K,{"data-testid":"set-row",children:[(0,t.jsx)(_,{className:"font-mono text-xs font-medium",children:n.name}),(0,t.jsx)(_,{children:(0,t.jsx)(A,{variant:$[n.kind],children:n.bindingType??n.kind})}),(0,t.jsx)(_,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:n.value??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},n.name)}k(X,"H");export{le as SettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./chunk-XQCVZAGU.js";import{a as O,b as v,c as N,d as b,e as _,f as M}from"./chunk-WJQLNYGX.js";import{a as k}from"./chunk-WQH3LT2P.js";import{d as g,h as w,m as I,o as T}from"./chunk-IUYFXK4X.js";import{c as L}from"./chunk-
|
|
1
|
+
import{a as q}from"./chunk-XQCVZAGU.js";import{a as O,b as v,c as N,d as b,e as _,f as M}from"./chunk-WJQLNYGX.js";import{a as k}from"./chunk-WQH3LT2P.js";import{d as g,h as w,m as I,o as T}from"./chunk-IUYFXK4X.js";import{c as L}from"./chunk-P33WK7YI.js";import{a as d,e as x,f as P,g as U,h as W}from"./chunk-3XIESWL4.js";var $=x(U(),1);var F="https://api.cloudflare.com/client/v4/accounts",E=class extends L{static{d(this,"c")}constructor(t,m){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(t)}: ${m}`,{name:"AnalyticsSqlError",status:t})}},R=d(n=>{let t=n.fetch??globalThis.fetch,m=`${F}/${encodeURIComponent(n.accountId)}/analytics_engine/sql`;return{query:d(async p=>{let l=await t(m,{body:p,headers:{Authorization:`Bearer ${n.apiToken}`,"Content-Type":"text/plain"},method:"POST"});if(!l.ok)throw new E(l.status,await l.text());let r;try{r=await l.json()}catch{throw new E(l.status,"Analytics Engine SQL API returned a non-JSON body.")}let e=r,s=e.data??[];return{columns:e.meta??[],rowCount:e.rows??s.length,rows:s}},"query")}},"d");var y=x(P(),1);var a=x(W(),1);var H="ANALYTICS",D=[{key:"volume",sql:d(n=>`SELECT blob2 AS fn, count() AS calls FROM ${n} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:d(n=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${n} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:d(n=>`SELECT blob3 AS shard, count() AS calls FROM ${n} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],j={error:null,loading:!0,result:null},Q=d(n=>{let t=(0,$.c)(27),{state:m,title:p}=n,l=g(),{error:r,loading:e,result:s}=m,o=`analytics-panel-${p}`,c;t[0]!==l||t[1]!==p?(c=l(p),t[0]=l,t[1]=p,t[2]=c):c=t[2];let i;t[3]!==c?(i=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c})}),t[3]=c,t[4]=i):i=t[4];let u;t[5]!==e||t[6]!==l?(u=e&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:l("Loading\u2026")}),t[5]=e,t[6]=l,t[7]=u):u=t[7];let f;t[8]!==r||t[9]!==e?(f=!e&&r!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:r}),t[8]=r,t[9]=e,t[10]=f):f=t[10];let h;t[11]!==r||t[12]!==e||t[13]!==s||t[14]!==l?(h=!e&&r===null&&s!==null&&s.rows.length===0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:l("No data points yet.")}),t[11]=r,t[12]=e,t[13]=s,t[14]=l,t[15]=h):h=t[15];let A;t[16]!==r||t[17]!==e||t[18]!==s?(A=!e&&r===null&&s!==null&&s.rows.length>0&&(0,a.jsxs)(O,{children:[(0,a.jsx)(v,{children:(0,a.jsx)(b,{children:s.columns.map(G)})}),(0,a.jsx)(N,{children:s.rows.map((B,Y)=>(0,a.jsx)(b,{children:s.columns.map(C=>(0,a.jsx)(M,{className:"font-mono text-xs",children:I(B[C.name])},C.name))},Y))})]}),t[16]=r,t[17]=e,t[18]=s,t[19]=A):A=t[19];let S;return t[20]!==o||t[21]!==i||t[22]!==u||t[23]!==f||t[24]!==h||t[25]!==A?(S=(0,a.jsxs)(k,{className:"gap-0 py-0","data-testid":o,children:[i,u,f,h,A]}),t[20]=o,t[21]=i,t[22]=u,t[23]=f,t[24]=h,t[25]=A,t[26]=S):S=t[26],S},"U"),rt=d(({config:n,dataset:t=H,runQuery:m}={})=>{let p=g(),[l,r]=(0,y.useState)({}),e=(0,y.useMemo)(()=>{if(m!==void 0)return m;if(n===void 0)return null;let o=R({accountId:n.accountId,apiToken:n.apiToken});return c=>o.query(c)},[n,m]),s=(0,y.useCallback)(async o=>{if(e!==null)for(let c of D){if(o.cancelled)return;r(i=>({...i,[c.key]:{error:null,loading:!0,result:null}}));try{let i=await e(c.sql(t));o.cancelled||r(u=>({...u,[c.key]:{error:null,loading:!1,result:i}}))}catch(i){o.cancelled||r(u=>({...u,[c.key]:{error:w(i),loading:!1,result:null}}))}}},[e,t]);return(0,y.useEffect)(()=>{let o={cancelled:!1};return T(s(o)),()=>{o.cancelled=!0}},[s]),e===null?(0,a.jsx)(q,{description:p("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"})}),testId:"analytics-not-configured",title:p("Analytics is not configured.")}):(0,a.jsx)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:D.map(o=>(0,a.jsx)(Q,{state:l[o.key]??j,title:o.title},o.key))})},"Z");function G(n){return(0,a.jsx)(_,{children:n.name},n.name)}d(G,"H");export{rt as AnalyticsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x}from"./chunk-VDW32UET.js";import{c as C}from"./chunk-
|
|
1
|
+
import{a as x}from"./chunk-VDW32UET.js";import{c as C}from"./chunk-6F7KP54M.js";import{f as q}from"./chunk-C2ZFQARQ.js";import{d as k,f as g,g as y,m as S}from"./chunk-IUYFXK4X.js";import{a as f,e as w,f as L,g as F,h as O}from"./chunk-3XIESWL4.js";var v=w(L(),1);var j={},I=g(x.aiGenerateSql),T=g(x.aiTableFilter),A=g(x.aiChartConfig),R=f(s=>{let e=q(),[l,d]=(0,v.useState)({}),[n,r]=(0,v.useState)({}),a=C(x.aiAvailable,j,{shardKey:s}),[u,i]=(0,v.useState)(!1),b=u||a.data?.available===!1,p=f(t=>{d(o=>({...o,[t]:!0})),r(o=>({...o,[t]:void 0}))},"n"),h=f((t,o)=>{d(c=>({...c,[t]:!1})),o!==void 0&&r(c=>({...c,[t]:o})),o==="no-ai-binding"&&i(!0)},"t");return{generate:f(async(t,o)=>{p("sql");try{let{result:c}=await e.query(I,{failedError:o?.error,failedSql:o?.sql,prompt:t},y(s));return h("sql",c.degraded?c.reason:void 0),c.degraded?void 0:c.sql}catch{h("sql","ai-error");return}},"generate"),inferChart:f(async t=>{p("chart");try{let{result:o}=await e.query(A,t,y(s));return h("chart",o.degraded?o.reason:void 0),o.degraded?void 0:o.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:f(t=>l[t]===!0,"pending"),reason:f(t=>n[t],"reason"),suggestFilter:f(async(t,o)=>{p("filter");try{let{result:c}=await e.query(T,{prompt:t,table:o},y(s));return h("filter",c.degraded?c.reason:void 0),c.degraded?void 0:c.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:b}},"k");var N=w(F(),1);var m=w(O(),1);var U=f((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let l=[],d=s.toLowerCase(),n=e.toLowerCase(),r=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,r))a>r&&l.push({match:!1,offset:r,text:s.slice(r,a)}),l.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),r=a+e.length;return r<s.length&&l.push({match:!1,offset:r,text:s.slice(r)}),l},"N"),z=f(s=>{let e=(0,N.c)(9),{highlight:l,value:d}=s;if(d==null){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=i):i=e[0],i}let n,r,a;if(e[1]!==l||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let i=S(d);if(l===void 0||l===""){a=(0,m.jsx)("span",{title:i,children:i});break e}n=i,r=U(i,l).map(D)}e[1]=l,e[2]=d,e[3]=n,e[4]=r,e[5]=a}else n=e[3],r=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let u;return e[6]!==n||e[7]!==r?(u=(0,m.jsx)("span",{title:n,children:r}),e[6]=n,e[7]=r,e[8]=u):u=e[8],u},"v"),Q=f(s=>{let e=(0,N.c)(22),{columns:l,rows:d}=s,n=k(),r;e[0]!==n?(r=n("Field"),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==r?(a=(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let u;if(e[4]!==d||e[5]!==n){let t;e[7]!==n?(t=f((o,c)=>(0,m.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:n("Row {n}",{n:c+1})},c),"i"),e[7]=n,e[8]=t):t=e[8],u=d.map(t),e[4]=d,e[5]=n,e[6]=u}else u=e[6];let i;e[9]!==a||e[10]!==u?(i=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,u]})}),e[9]=a,e[10]=u,e[11]=i):i=e[11];let b;if(e[12]!==l||e[13]!==d){let t;e[15]!==d?(t=f(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:o}),d.map((c,_)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(z,{value:c[o]})},_))]},o),"i"),e[15]=d,e[16]=t):t=e[16],b=l.map(t),e[12]=l,e[13]=d,e[14]=b}else b=e[14];let p;e[17]!==b?(p=(0,m.jsx)("tbody",{children:b}),e[17]=b,e[18]=p):p=e[18];let h;return e[19]!==i||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[i,p]})}),e[19]=i,e[20]=p,e[21]=h):h=e[21],h},"j"),V=f(({children:s,layout:e="card",testId:l})=>(0,m.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":l,children:s}),"O");function D(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}f(D,"k");export{R as a,z as b,Q as c,V as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as $}from"./chunk-
|
|
1
|
+
import{a as $}from"./chunk-PLFTCTMX.js";import{a as b}from"./chunk-NCKRVNF2.js";import"./chunk-XXQUMVWH.js";import"./chunk-NJRW66LJ.js";import"./chunk-QLQADHFE.js";import{a as u}from"./chunk-VDW32UET.js";import{c as p}from"./chunk-6F7KP54M.js";import"./chunk-C2ZFQARQ.js";import"./chunk-XBDKZZ67.js";import{a as y,b as w,c as j,d as h,e as i,f as n}from"./chunk-WJQLNYGX.js";import{a as l,e as c}from"./chunk-WQH3LT2P.js";import{d as k}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as o,e as S,h as T,j as x}from"./chunk-3XIESWL4.js";var e=S(T(),1);var m={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},A={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},O=o((r,a)=>`exempt: ${r.exemptReason===void 0||r.exemptReason===""?a:r.exemptReason}`,"S"),P=o(r=>r.toSorted((a,d)=>a.coverage==="clean"&&d.coverage!=="clean"?1:d.coverage==="clean"&&a.coverage!=="clean"?-1:a.score-d.score),"T"),q=o(({testId:r="advisor-health"})=>{let a=k(),d=p(u.getAdvisories,{},{live:!0}),g=p(u.getAdvisorProcedures,{},{live:!0}),f=d.data?.advisories??null,N=g.data?.procedures??null,t=f===null||N===null?null:$(N,f),v=g.error??d.error;if(v!==null)return(0,e.jsx)(b,{error:v,testId:`${r}-error`});if(t===null)return(0,e.jsx)(l,{children:(0,e.jsx)(c,{className:"py-8 text-center text-muted-foreground","data-testid":`${r}-loading`,children:a("Loading\u2026")})});let I=P(t.procedures);return(0,e.jsxs)("div",{className:"space-y-4","data-testid":r,children:[(0,e.jsx)(l,{children:(0,e.jsxs)(c,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:x("text-4xl font-semibold tabular-nums",A[t.grade]),"data-testid":`${r}-score`,children:t.score}),(0,e.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,e.jsx)("span",{className:x("text-sm font-medium uppercase tracking-wide",A[t.grade]),"data-testid":`${r}-grade`,children:t.grade}),(0,e.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${r}-summary`,children:[(0,e.jsxs)("span",{className:m.clean,children:[t.summary.clean," ",a("clean")]}),(0,e.jsxs)("span",{className:m.warned,children:[t.summary.warned," ",a("warned")]}),(0,e.jsxs)("span",{className:m.failing,children:[t.summary.failing," ",a("failing")]}),(0,e.jsxs)("span",{className:m.exempt,children:[t.summary.exempt," ",a("exempt")]})]})]})}),t.project.checks.length>0&&(0,e.jsx)(l,{children:(0,e.jsxs)(c,{className:"py-4 text-sm","data-testid":`${r}-project`,children:[(0,e.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",t.project.score,"/100"]}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",t.project.checks.map(s=>s.name).join(", ")]})]})}),(0,e.jsx)(l,{children:(0,e.jsx)(c,{className:"p-0",children:(0,e.jsxs)(y,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(i,{className:"w-20",children:a("Score")}),(0,e.jsx)(i,{children:a("Procedure")}),(0,e.jsx)(i,{className:"w-32",children:a("Kind")}),(0,e.jsx)(i,{children:a("Rules fired")})]})}),(0,e.jsx)(j,{children:I.map(s=>(0,e.jsxs)(h,{"data-testid":`${r}-row`,children:[(0,e.jsx)(n,{className:x("tabular-nums font-medium",m[s.coverage]),children:s.coverage==="exempt"?"\u2014":s.score}),(0,e.jsx)(n,{className:"font-mono text-xs",children:s.id}),(0,e.jsxs)(n,{className:"text-muted-foreground text-xs",children:[s.visibility," ",s.kind,s.sensitivity.level==="high"&&(0,e.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,e.jsx)(n,{className:"text-muted-foreground text-xs",children:s.coverage==="exempt"?O(s,a("no reason given")):s.checks.map(R=>R.name).join(", ")})]},s.id))})]})})})]})},"O");export{q as default};
|