@lunora/studio 1.0.0-alpha.55 → 1.0.0-alpha.57
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/index.d.ts +5 -1
- package/dist/index.js +11 -11
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/ApiTab.js +3 -3
- package/dist/packem_chunks/AuditPanel.js +4 -4
- package/dist/packem_chunks/ExportImportPanel.js +3 -3
- package/dist/packem_chunks/FileBrowser.js +3 -3
- package/dist/packem_chunks/FunctionRunner.js +2 -2
- package/dist/packem_chunks/FunctionStatsPanel.js +4 -4
- package/dist/packem_chunks/HealthPanel.js +3 -3
- package/dist/packem_chunks/InsightsPanel.js +4 -4
- package/dist/packem_chunks/LogsPanel.js +537 -89
- package/dist/packem_chunks/MailPanel.js +4 -4
- package/dist/packem_chunks/MetricsPanel.js +4 -4
- package/dist/packem_chunks/MigrationsPanel.js +4 -4
- package/dist/packem_chunks/PitrPanel.js +2 -2
- package/dist/packem_chunks/SchemaViewer.js +2 -2
- package/dist/packem_chunks/SecurityAdvisorPanel.js +3 -3
- package/dist/packem_chunks/SettingsPanel.js +3 -3
- package/dist/packem_chunks/SqlEditorPanel.js +5 -5
- package/dist/packem_chunks/TableEditor.js +3 -3
- package/dist/packem_chunks/agents-panel.js +4 -4
- package/dist/packem_chunks/analytics-panel.js +1 -1
- package/dist/packem_chunks/auth-config-panel.js +1 -1
- package/dist/packem_chunks/auth-sessions-panel.js +2 -2
- package/dist/packem_chunks/containers-panel.js +2 -2
- package/dist/packem_chunks/dashboards-panel.js +3 -3
- package/dist/packem_chunks/fanout-panel.js +3 -3
- package/dist/packem_chunks/flags-panel.js +3 -3
- package/dist/packem_chunks/issues-panel.js +321 -82
- package/dist/packem_chunks/kv-browser.js +3 -3
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +3 -3
- package/dist/packem_chunks/payments-panel.js +4 -4
- package/dist/packem_chunks/permissions-panel.js +4 -4
- package/dist/packem_chunks/queues-panel.js +4 -4
- package/dist/packem_chunks/rls-panel.js +3 -3
- package/dist/packem_chunks/schedule-panel.js +3 -3
- package/dist/packem_chunks/storage-rules-panel.js +3 -3
- package/dist/packem_chunks/subscriptions-panel.js +3 -3
- package/dist/packem_chunks/traces-panel.js +4 -4
- package/dist/packem_chunks/users-panel.js +3 -3
- package/dist/packem_chunks/vector-browser.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +3 -3
- package/dist/packem_shared/{ADMIN_FUNCTIONS-C6TEeUiJ.js → ADMIN_FUNCTIONS-C1LXrovV.js} +4 -0
- package/dist/packem_shared/{ApiDocsPanel-CcC6ucbp.js → ApiDocsPanel-BBvinlRD.js} +2 -2
- package/dist/packem_shared/{ApiReferencePanel-Dd8pcswz.js → ApiReferencePanel-ChlRsAXU.js} +1 -1
- package/dist/packem_shared/{CommandPalette-BXV4eKf5.js → CommandPalette-BpkopP5f.js} +1 -1
- package/dist/packem_shared/{DataBrowser-BuFEPTiv.js → DataBrowser-BoinTGxr.js} +6 -6
- package/dist/packem_shared/{GlobalDataBrowser-D8h1fTL1.js → GlobalDataBrowser-BCaohHZ5.js} +3 -3
- package/dist/packem_shared/{HomePanel-2I1YZm0A.js → HomePanel-BpdGcW4L.js} +4 -4
- package/dist/packem_shared/{OpenRpcReferencePanel-CWaf0ZtX.js → OpenRpcReferencePanel-CIeQE1aE.js} +1 -1
- package/dist/packem_shared/{ScheduledJobs-Cz5Tr-M6.js → ScheduledJobs-BQzQo84k.js} +2 -2
- package/dist/packem_shared/{Studio-CCJBI2wP.js → Studio-BpnYw3lc.js} +4 -4
- package/dist/packem_shared/{StudioApp-Daeqxw2h.js → StudioApp-DRGVBnFx.js} +2 -2
- package/dist/packem_shared/{advisor-view-1RaDWED7.js → advisor-view-D95sN-wO.js} +1 -1
- package/dist/packem_shared/{data-grid-C9I16KWr.js → data-grid-BywzWfek.js} +1 -1
- package/dist/packem_shared/{error-alert-vIPQoN3Y.js → error-alert-D9uIFJUS.js} +1 -1
- package/dist/packem_shared/{grid-features-B_fZH4iQ.js → grid-features-ZOLhHKrR.js} +1 -1
- package/dist/packem_shared/{home-panel-DHHUtnKU.js → home-panel-Dmg4sNiv.js} +3 -3
- package/dist/packem_shared/{internal-zwBoOv24.js → internal-DzHCc2Rq.js} +10 -1
- package/dist/packem_shared/{reference-view-DUULLuOi.js → reference-view-DfXN7oWP.js} +1 -1
- package/dist/packem_shared/{result-chart-DZradBAS.js → result-chart-Bf9mbCIo.js} +1 -1
- package/dist/packem_shared/{select-UkNYCT3s.js → select-D9OwHEch.js} +1 -1
- package/dist/packem_shared/{studio-0479nrrm.js → studio-LL4iP8fZ.js} +3 -3
- package/dist/packem_shared/{table-list-sidebar-huX4VmgI.js → table-list-sidebar-gCE17v9B.js} +1 -1
- package/dist/packem_shared/{use-admin-query-BGJ010yZ.js → use-admin-query-C7JNuQp-.js} +1 -1
- package/dist/packem_shared/{use-async-submit-DGCtuDyz.js → use-async-submit-rnSk_jXl.js} +2 -2
- package/dist/standalone/{chunk-GVFODXW2.js → chunk-227DORM6.js} +1 -1
- package/dist/standalone/{chunk-RCSULEDU.js → chunk-27JTW53L.js} +1 -1
- package/dist/standalone/{chunk-RG4HLPM2.js → chunk-2BSDITP4.js} +1 -1
- package/dist/standalone/{chunk-D73WYMRU.js → chunk-2ICZ6HXQ.js} +1 -1
- package/dist/standalone/{chunk-EOE5NDMK.js → chunk-2TJVFKD2.js} +1 -1
- package/dist/standalone/{chunk-4AZYW2PI.js → chunk-2XUT4Z4W.js} +1 -1
- package/dist/standalone/{chunk-WOYQG5AM.js → chunk-2YTF6LJ6.js} +1 -1
- package/dist/standalone/{chunk-4F72YCTU.js → chunk-2YUYNNHQ.js} +1 -1
- package/dist/standalone/chunk-3HGNPZBN.js +1 -0
- package/dist/standalone/{chunk-N5FMEYSL.js → chunk-4Q66FL5S.js} +1 -1
- package/dist/standalone/{chunk-SPACAIAR.js → chunk-53J4JZ2D.js} +1 -1
- package/dist/standalone/{chunk-EPDC422O.js → chunk-67YMILPJ.js} +1 -1
- package/dist/standalone/{chunk-XCNYUUD6.js → chunk-AN4RKMKW.js} +1 -1
- package/dist/standalone/{chunk-W7ND56KZ.js → chunk-AYHAJL3Z.js} +1 -1
- package/dist/standalone/chunk-BIA2DLBR.js +1 -0
- package/dist/standalone/{chunk-S2G7OH5T.js → chunk-C7UZEQZ7.js} +2 -2
- package/dist/standalone/{chunk-3W4CSGDO.js → chunk-CENYZ5GF.js} +1 -1
- package/dist/standalone/{chunk-DVBY6YQK.js → chunk-CURAOCQJ.js} +1 -1
- package/dist/standalone/{chunk-FPKTXKPE.js → chunk-EFYZYQUA.js} +1 -1
- package/dist/standalone/{chunk-TTEEPVCN.js → chunk-EXNK5XAW.js} +1 -1
- package/dist/standalone/{chunk-FDWXYXOM.js → chunk-F2YMCQ6B.js} +1 -1
- package/dist/standalone/{chunk-JQPHZL2A.js → chunk-GF6GF6CF.js} +1 -1
- package/dist/standalone/{chunk-5XO36X4C.js → chunk-HBGS4SEX.js} +8 -8
- package/dist/standalone/{chunk-HNIDN3RX.js → chunk-HQ2CPGA4.js} +1 -1
- package/dist/standalone/{chunk-LJE6PGHD.js → chunk-IMVAYDPK.js} +1 -1
- package/dist/standalone/{chunk-CW7LZ4SR.js → chunk-J2DQ63SR.js} +1 -1
- package/dist/standalone/{chunk-VC2VDAUO.js → chunk-JM3ZISDM.js} +1 -1
- package/dist/standalone/{chunk-S5NTGHCG.js → chunk-JZLGLG4T.js} +1 -1
- package/dist/standalone/{chunk-G5CMK5GY.js → chunk-LABWKVKR.js} +1 -1
- package/dist/standalone/chunk-LFORIMS7.js +1 -0
- package/dist/standalone/{chunk-JHR3HKT5.js → chunk-LT2HPR6R.js} +2 -2
- package/dist/standalone/{chunk-MWH5LBNF.js → chunk-MBG7XWNH.js} +1 -1
- package/dist/standalone/chunk-MHGJUKCZ.js +1 -0
- package/dist/standalone/{chunk-ZUTFDG76.js → chunk-MJ4HATA2.js} +1 -1
- package/dist/standalone/{chunk-EIZG4GOM.js → chunk-N2E4TKRD.js} +1 -1
- package/dist/standalone/{chunk-CHNXZYAC.js → chunk-N5XX4HOL.js} +1 -1
- package/dist/standalone/{chunk-YS7NUMAN.js → chunk-NIC6UYAQ.js} +1 -1
- package/dist/standalone/{chunk-XG4TZSP4.js → chunk-NV5LO5I6.js} +1 -1
- package/dist/standalone/{chunk-VQ3YOUZB.js → chunk-OHCGUIOG.js} +1 -1
- package/dist/standalone/{chunk-G4GGGHEV.js → chunk-OPSAI5PZ.js} +1 -1
- package/dist/standalone/{chunk-YRE6TGXH.js → chunk-P7MZQ6VJ.js} +1 -1
- package/dist/standalone/{chunk-FBGC3RSU.js → chunk-PRHAIUWS.js} +1 -1
- package/dist/standalone/{chunk-LTCX3QOE.js → chunk-PYPWIYI2.js} +1 -1
- package/dist/standalone/{chunk-6LLFTVEI.js → chunk-QAW6AWOE.js} +1 -1
- package/dist/standalone/{chunk-XZWFP2GI.js → chunk-QVUQXJCT.js} +1 -1
- package/dist/standalone/{chunk-NAFKYFBZ.js → chunk-R4ALMCZA.js} +1 -1
- package/dist/standalone/{chunk-JGCRBFFO.js → chunk-RIZDNIW7.js} +1 -1
- package/dist/standalone/{chunk-IKVZUVHJ.js → chunk-S6PTK7Y2.js} +1 -1
- package/dist/standalone/{chunk-FXNS5NBY.js → chunk-SAQU44MF.js} +1 -1
- package/dist/standalone/{chunk-WA3DGSC2.js → chunk-T3R6VHAT.js} +1 -1
- package/dist/standalone/{chunk-AE3AKGOW.js → chunk-W3EYW2EA.js} +1 -1
- package/dist/standalone/{chunk-RDA4VTHI.js → chunk-WAX3RSAI.js} +1 -1
- package/dist/standalone/{chunk-FQUNSQLG.js → chunk-WMDH2CIZ.js} +1 -1
- package/dist/standalone/{chunk-SP7GSPKX.js → chunk-X34PHGZF.js} +1 -1
- package/dist/standalone/{chunk-PIB7VUVM.js → chunk-X3VAERRH.js} +1 -1
- package/dist/standalone/{chunk-Q3X7IMLF.js → chunk-XAGYDGI6.js} +1 -1
- package/dist/standalone/{chunk-OVSBLTAA.js → chunk-Y26ZIWUZ.js} +1 -1
- package/dist/standalone/{chunk-WCLFE2ZB.js → chunk-ZVQMTQYX.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/dist/standalone/chunk-DWDILV2E.js +0 -1
- package/dist/standalone/chunk-EBTLTGG3.js +0 -1
- package/dist/standalone/chunk-G5RC7USY.js +0 -1
- package/dist/standalone/chunk-YNSFQKMM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as h}from"./chunk-2YUYNNHQ.js";import{a as C,b as w,c as I,d as u,e as o,f as n}from"./chunk-GTM65MVX.js";import{a as A,e as S}from"./chunk-Y572GMZE.js";import{c as T}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as N}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as g}from"./chunk-MHGJUKCZ.js";import"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as E}from"./chunk-TAD43CG5.js";import{d as D,q as H}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as d,e as M,f as X,h as Y}from"./chunk-RRCPZMC2.js";var q=M(X(),1);var e=M(Y(),1);var G="agent_threads",Z="agent_messages",_=100,ee=250,te={},ae={filters:[],limit:_,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:G},l=d((r,t)=>{let a=r[t];return typeof a=="string"?a:void 0},"readString"),B=d((r,t)=>{let a=r[t];return typeof a=="number"?a:void 0},"readNumber"),P=d(r=>{let{usage:t}=r;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"readTotalTokens"),se=d(r=>{let{toolCalls:t}=r;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"readToolNames"),re=d(r=>{switch(r){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"threadStatusVariant"),oe=d(r=>{switch(r){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"approvalVariant"),ge=d(({initialShardKey:r=""})=>{let t=D(),[a,R]=(0,q.useState)(void 0),{data:p}=h(g.listTables,te,{live:!0,shardKey:r}),U=p!==void 0,m=Array.isArray(p)&&p.some(s=>s.name===G),{data:$,error:V,errorSource:z,liveError:O}=h(g.readTablePage,ae,{enabled:m,live:!0,shardKey:r}),F={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:ee,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:Z},{data:j,error:Q,errorSource:J}=h(g.readTablePage,F,{enabled:m&&a!==void 0,live:!0,shardKey:r}),x=Array.isArray($?.rows)?$.rows:[],K=Array.isArray(j?.rows)?j.rows:[],L=x.find(s=>l(s,"key")===a),f;return U&&!m?f=(0,e.jsxDEV)(E,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")},void 0,!1):m&&x.length===0?f=(0,e.jsxDEV)(E,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")},void 0,!1):f=(0,e.jsxDEV)("div",{className:"flex flex-col gap-6",children:[(0,e.jsxDEV)(A,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(S,{className:"px-0",children:(0,e.jsxDEV)(C,{"data-testid":"agents-threads-table",children:[(0,e.jsxDEV)(w,{children:(0,e.jsxDEV)(u,{children:[(0,e.jsxDEV)(o,{children:t("Agent")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Key")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Status")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Messages")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Tokens")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Updated")},void 0,!1),(0,e.jsxDEV)(o,{"aria-label":t("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(I,{children:x.map(s=>{let i=l(s,"key")??"",c=l(s,"status"),v=P(s);return(0,e.jsxDEV)(u,{"data-active":i===a?"":void 0,"data-testid":`agents-thread-${i}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:l(s,"agent")??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs text-muted-foreground",children:i},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(N,{"data-testid":`agents-thread-status-${i}`,variant:re(c),children:c??"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:B(s,"messageCount")??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums text-muted-foreground",children:v??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:H(B(s,"updatedAt"),"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{className:"text-right",children:(0,e.jsxDEV)(T,{"data-testid":`agents-thread-open-${i}`,onClick:d(()=>{R(i)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")},void 0,!1)},void 0,!1)]},i,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),Q!==null&&(0,e.jsxDEV)(k,{error:J,testId:"agents-messages-error"},void 0,!1),a!==void 0&&(0,e.jsxDEV)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxDEV)(S,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,L!==void 0&&(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",P(L)??0," ",t("Tokens")]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{R(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")},void 0,!1)]},void 0,!0),K.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")},void 0,!1):(0,e.jsxDEV)(C,{"data-testid":"agents-messages-table",children:[(0,e.jsxDEV)(w,{children:(0,e.jsxDEV)(u,{children:[(0,e.jsxDEV)(o,{children:t("Role")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Content")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Tool")},void 0,!1),(0,e.jsxDEV)(o,{children:t("Approval")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(I,{children:K.map((s,i)=>{let c=l(s,"role")??"\u2014",v=se(s),W=l(s,"toolName"),y=l(s,"status"),b=B(s,"seq")??i;return(0,e.jsxDEV)(u,{"data-testid":`agents-message-${String(b)}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs align-top text-muted-foreground",children:c},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(s,"content")??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs align-top text-muted-foreground",children:W??(v.length>0?v.join(", "):"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{className:"align-top",children:y===void 0?(0,e.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:"\u2014"},void 0,!1):(0,e.jsxDEV)(N,{"data-testid":`agents-message-approval-${String(b)}`,variant:oe(y),children:y},void 0,!1)},void 0,!1)]},l(s,"messageKey")??`${c}:${String(b)}`,!0)})},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[V!==null&&(0,e.jsxDEV)(k,{error:z,testId:"agents-error"},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")},void 0,!1),O!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")},void 0,!1),f]},void 0,!0)},"AgentsPanel");export{ge as AgentsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as V}from"./chunk-J6J54MBP.js";import{a as L}from"./chunk-2K47A3P6.js";import{a as W}from"./chunk-
|
|
1
|
+
import{a as V}from"./chunk-J6J54MBP.js";import{a as L}from"./chunk-2K47A3P6.js";import{a as W}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as _}from"./chunk-2YUYNNHQ.js";import{a as O,b as Q,c as U,d as K,e as R,f as D}from"./chunk-GTM65MVX.js";import{a as E}from"./chunk-Y572GMZE.js";import{a as j}from"./chunk-F2YMCQ6B.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-O3NAGRTR.js";import{b as w}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as H}from"./chunk-MHGJUKCZ.js";import"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as A}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as C,e as F,f as J,g as X,h as Y}from"./chunk-RRCPZMC2.js";var P=F(X(),1),G=F(J(),1);var t=F(Y(),1);var q=C(r=>`${r.toString()} ms`,"formatMs"),Z=C(r=>r.totalConnections===0&&r.shapePoke.passes===0&&r.whisper.passes===0,"isFanoutIdle"),$=C(r=>{let e=(0,P.c)(8),{label:o,testId:s,value:i}=r,l;e[0]!==o?(l=(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=l):l=e[1];let d;e[2]!==s||e[3]!==i?(d=(0,t.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":s,children:i},void 0,!1),e[2]=s,e[3]=i,e[4]=d):d=e[4];let v;return e[5]!==l||e[6]!==d?(v=(0,t.jsxDEV)(E,{className:"gap-0 py-0",children:(0,t.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[l,d]},void 0,!0)},void 0,!1),e[5]=l,e[6]=d,e[7]=v):v=e[7],v},"StatCard"),z=C(r=>{let e=(0,P.c)(48),{counters:o,includeTiming:s,prefix:i,t:l,title:d}=r,v=`${i}-section`,h;e[0]!==d?(h=(0,t.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:d},void 0,!1),e[0]=d,e[1]=h):h=e[1];let k=`${i}-stats`,a;e[2]!==l?(a=l("Passes"),e[2]=l,e[3]=a):a=e[3];let n=`${i}-passes`,g;e[4]!==o.passes||e[5]!==a||e[6]!==n?(g=(0,t.jsxDEV)($,{label:a,testId:n,value:o.passes},void 0,!1),e[4]=o.passes,e[5]=a,e[6]=n,e[7]=g):g=e[7];let N;e[8]!==l?(N=l("Sockets iterated"),e[8]=l,e[9]=N):N=e[9];let I=`${i}-iterated`,c;e[10]!==o.socketsIterated||e[11]!==N||e[12]!==I?(c=(0,t.jsxDEV)($,{label:N,testId:I,value:o.socketsIterated},void 0,!1),e[10]=o.socketsIterated,e[11]=N,e[12]=I,e[13]=c):c=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${i}-delivered`,u;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(u=(0,t.jsxDEV)($,{label:f,testId:y,value:o.socketsDelivered},void 0,!1),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=u):u=e[19];let m;e[20]!==l?(m=l("Peak width"),e[20]=l,e[21]=m):m=e[21];let b=`${i}-peak`,p;e[22]!==o.peakSocketsIterated||e[23]!==m||e[24]!==b?(p=(0,t.jsxDEV)($,{label:m,testId:b,value:o.peakSocketsIterated},void 0,!1),e[22]=o.peakSocketsIterated,e[23]=m,e[24]=b,e[25]=p):p=e[25];let x;e[26]!==o.totalMs||e[27]!==s||e[28]!==i||e[29]!==l?(x=s&&(0,t.jsxDEV)($,{label:l("Total time"),testId:`${i}-total-ms`,value:q(o.totalMs)},void 0,!1),e[26]=o.totalMs,e[27]=s,e[28]=i,e[29]=l,e[30]=x):x=e[30];let S;e[31]!==o.maxMs||e[32]!==s||e[33]!==i||e[34]!==l?(S=s&&(0,t.jsxDEV)($,{label:l("Max time"),testId:`${i}-max-ms`,value:q(o.maxMs)},void 0,!1),e[31]=o.maxMs,e[32]=s,e[33]=i,e[34]=l,e[35]=S):S=e[35];let T;e[36]!==u||e[37]!==p||e[38]!==x||e[39]!==S||e[40]!==k||e[41]!==g||e[42]!==c?(T=(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":k,children:[g,c,u,p,x,S]},void 0,!0),e[36]=u,e[37]=p,e[38]=x,e[39]=S,e[40]=k,e[41]=g,e[42]=c,e[43]=T):T=e[43];let M;return e[44]!==v||e[45]!==T||e[46]!==h?(M=(0,t.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":v,children:[h,T]},void 0,!0),e[44]=v,e[45]=T,e[46]=h,e[47]=M):M=e[47],M},"PathCounters"),ue=C(r=>{let e=(0,P.c)(32),{initialShardKey:o}=r,s=A(),[i,l]=(0,G.useState)(o??""),d;e[0]!==i?(d=i.trim(),e[0]=i,e[1]=d):d=e[1];let v=L(d,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let k;e[3]!==v?(k={keepPreviousData:!0,shardKey:v},e[3]=v,e[4]=k):k=e[4];let{data:a,error:n,errorSource:g,refetch:N}=_(H.getFanoutMetrics,h,k);V(N,!0);let I;e[5]!==a?(I=a!==void 0&&Z(a),e[5]=a,e[6]=I):I=e[6];let c=I,f;e[7]!==i?(f=(0,t.jsxDEV)(j,{onChange:l,testId:"fanout-shard-input",value:i},void 0,!1),e[7]=i,e[8]=f):f=e[8];let y;e[9]!==a||e[10]!==s?(y=a!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[a.promoted&&(0,t.jsxDEV)(w,{"data-testid":"fanout-promoted",variant:a.relayCount>=a.maxRelays?"destructive":"default",children:a.relayCount>=a.maxRelays?s("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:a.maxRelays,relayCount:a.relayCount}):s("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:a.maxRelays,relayCount:a.relayCount})},void 0,!1),(0,t.jsxDEV)(w,{variant:"secondary",children:s("{count} connections",{count:a.totalConnections})},void 0,!1),(0,t.jsxDEV)(w,{variant:"secondary",children:s("peak {count} subscribers",{count:a.peakSubscribers})},void 0,!1)]},void 0,!0),e[9]=a,e[10]=s,e[11]=y):y=e[11];let u;e[12]!==f||e[13]!==y?(u=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[f,y]},void 0,!0),e[12]=f,e[13]=y,e[14]=u):u=e[14];let m;e[15]!==n||e[16]!==g?(m=n!==null&&(0,t.jsxDEV)(W,{error:g,testId:"fanout-error"},void 0,!1),e[15]=n,e[16]=g,e[17]=m):m=e[17];let b;e[18]!==n||e[19]!==c||e[20]!==s?(b=n===null&&c&&(0,t.jsxDEV)(B,{description:s("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M4 12h4l3 7 4-14 3 7h2"},void 0,!1)},void 0,!1),testId:"fanout-empty",title:s("No fan-out activity yet.")},void 0,!1),e[18]=n,e[19]=c,e[20]=s,e[21]=b):b=e[21];let p;e[22]!==n||e[23]!==c||e[24]!==a||e[25]!==s?(p=n===null&&a!==void 0&&!c&&(0,t.jsxDEV)(t.Fragment,{children:[a.topics.length>0&&(0,t.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:s("Hot topics")},void 0,!1),(0,t.jsxDEV)(E,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(O,{"data-testid":"fanout-topics-table",children:[(0,t.jsxDEV)(Q,{children:(0,t.jsxDEV)(K,{children:[(0,t.jsxDEV)(R,{children:s("Topic")},void 0,!1),(0,t.jsxDEV)(R,{children:s("Kind")},void 0,!1),(0,t.jsxDEV)(R,{className:"text-right",children:s("Subscribers")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(U,{children:a.topics.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("Fan-out cost since this instance woke")},void 0,!1),(0,t.jsxDEV)(z,{counters:a.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:s,title:s("Shape pokes")},void 0,!1),(0,t.jsxDEV)(z,{counters:a.whisper,includeTiming:!1,prefix:"fanout-whisper",t:s,title:s("Whisper broadcasts")},void 0,!1)]},void 0,!0)]},void 0,!0),e[22]=n,e[23]=c,e[24]=a,e[25]=s,e[26]=p):p=e[26];let x;return e[27]!==p||e[28]!==u||e[29]!==m||e[30]!==b?(x=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[u,m,b,p]},void 0,!0),e[27]=p,e[28]=u,e[29]=m,e[30]=b,e[31]=x):x=e[31],x},"FanoutPanel");function ee(r){return(0,t.jsxDEV)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsxDEV)(D,{className:"font-mono text-xs",children:r.topic},void 0,!1),(0,t.jsxDEV)(D,{children:(0,t.jsxDEV)(w,{variant:"outline",children:r.kind},void 0,!1)},void 0,!1),(0,t.jsxDEV)(D,{className:"text-right font-medium tabular-nums",children:r.subscribers},void 0,!1)]},`${r.kind}:${r.topic}`,!0)}C(ee,"_temp");export{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as se}from"./chunk-3W4CSGDO.js";import"./chunk-SWMBBYJU.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-KEGAWN6Y.js";import{a as te}from"./chunk-XNJNSCLM.js";import{a as z,b as V,c as P,e as D}from"./chunk-Y572GMZE.js";import{d as X,f as ee}from"./chunk-2MLA6WFH.js";import"./chunk-HV7G6DFP.js";import{c as I}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-EBTLTGG3.js";import{f as Q}from"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as U}from"./chunk-TAD43CG5.js";import{d as O,f as H,g as Y,h as G,l as Z}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a as k,e as j,f as ie,g as le,h as oe}from"./chunk-RRCPZMC2.js";var W=j(le(),1),T=j(ie(),1);var o=j(oe(),1);var de=H(J.runSql),ae=k(($,e)=>{let s=Q(),[f,t]=(0,T.useState)(void 0),[i,d]=(0,T.useState)(void 0),[l,c]=(0,T.useState)(!0),q=(0,T.useCallback)(async a=>{c(!0);try{let x=await s.query(de,{sql:$},Y(e));a.cancelled||(t(x),d(void 0))}catch(x){a.cancelled||(t(void 0),d(G(x)))}finally{a.cancelled||c(!1)}},[s,$,e]);return(0,T.useEffect)(()=>{let a={cancelled:!1};return Z(q(a)),()=>{a.cancelled=!0}},[q]),{error:i,loading:l,result:f}},"useRunSql"),re="lunora-studio-dashboards",B={shardKey:"",sql:"",title:""},ne=k($=>{let e=(0,W.c)(54),{onEdit:s,onRemove:f,widget:t}=$,i=O(),{error:d,loading:l,result:c}=ae(t.sql,t.shardKey??""),q;e[0]!==s||e[1]!==t.id?(q=k(()=>{s(t.id)},"t1"),e[0]=s,e[1]=t.id,e[2]=q):q=e[2];let a=q,x;e[3]!==f||e[4]!==t.id?(x=k(()=>{f(t.id)},"t2"),e[3]=f,e[4]=t.id,e[5]=x):x=e[5];let K=x,M=`dashboards-widget-${t.id}`,S;e[6]!==t.title?(S=(0,o.jsxDEV)(P,{className:"min-w-0 truncate",title:t.title,children:t.title},void 0,!1),e[6]=t.title,e[7]=S):S=e[7];let L;e[8]!==i?(L=i("Edit widget"),e[8]=i,e[9]=L):L=e[9];let R=`dashboards-widget-edit-${t.id}`,A;e[10]!==i?(A=i("Edit widget"),e[10]=i,e[11]=A):A=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,o.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsxDEV)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"},void 0,!1)},void 0,!1),e[12]=w):w=e[12];let C;e[13]!==a||e[14]!==L||e[15]!==R||e[16]!==A?(C=(0,o.jsxDEV)(I,{"aria-label":L,"data-testid":R,onClick:a,size:"icon-xs",title:A,type:"button",variant:"ghost",children:w},void 0,!1),e[13]=a,e[14]=L,e[15]=R,e[16]=A,e[17]=C):C=e[17];let b;e[18]!==i?(b=i("Remove widget"),e[18]=i,e[19]=b):b=e[19];let E=`dashboards-widget-remove-${t.id}`,m;e[20]!==i?(m=i("Remove widget"),e[20]=i,e[21]=m):m=e[21];let p;e[22]===Symbol.for("react.memo_cache_sentinel")?(p=(0,o.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[22]=p):p=e[22];let u;e[23]!==K||e[24]!==b||e[25]!==E||e[26]!==m?(u=(0,o.jsxDEV)(I,{"aria-label":b,"data-testid":E,onClick:K,size:"icon-xs",title:m,type:"button",variant:"ghost",children:p},void 0,!1),e[23]=K,e[24]=b,e[25]=E,e[26]=m,e[27]=u):u=e[27];let h;e[28]!==u||e[29]!==C?(h=(0,o.jsxDEV)("div",{className:"flex shrink-0 items-center gap-1",children:[C,u]},void 0,!0),e[28]=u,e[29]=C,e[30]=h):h=e[30];let v;e[31]!==h||e[32]!==S?(v=(0,o.jsxDEV)(V,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[S,h]},void 0,!0),e[31]=h,e[32]=S,e[33]=v):v=e[33];let g;e[34]!==d||e[35]!==t.id?(g=d!==void 0&&(0,o.jsxDEV)(te,{className:"font-mono text-xs",testId:`dashboards-widget-error-${t.id}`,variant:"destructive",children:d},void 0,!1),e[34]=d,e[35]=t.id,e[36]=g):g=e[36];let N;e[37]!==d||e[38]!==l||e[39]!==c||e[40]!==i||e[41]!==t.id?(N=d===void 0&&l&&c===void 0&&(0,o.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${t.id}`,children:i("Running\u2026")},void 0,!1),e[37]=d,e[38]=l,e[39]=c,e[40]=i,e[41]=t.id,e[42]=N):N=e[42];let r;e[43]!==d||e[44]!==c?(r=d===void 0&&c!==void 0&&(0,o.jsxDEV)(se,{result:c},void 0,!1),e[43]=d,e[44]=c,e[45]=r):r=e[45];let n;e[46]!==g||e[47]!==N||e[48]!==r?(n=(0,o.jsxDEV)(D,{className:"min-h-32 py-2",children:[g,N,r]},void 0,!0),e[46]=g,e[47]=N,e[48]=r,e[49]=n):n=e[49];let y;return e[50]!==v||e[51]!==n||e[52]!==M?(y=(0,o.jsxDEV)(z,{"data-testid":M,children:[v,n]},void 0,!0),e[50]=v,e[51]=n,e[52]=M,e[53]=y):y=e[53],y},"WidgetCard"),ce=k($=>{let e=(0,W.c)(58),{draft:s,editing:f,onCancel:t,onChange:i,onSubmit:d}=$,l=O(),c;e[0]!==s||e[1]!==i?(c=k(_=>{i({...s,title:_.target.value})},"t1"),e[0]=s,e[1]=i,e[2]=c):c=e[2];let q=c,a;e[3]!==s||e[4]!==i?(a=k(_=>{i({...s,sql:_.target.value})},"t2"),e[3]=s,e[4]=i,e[5]=a):a=e[5];let x=a,K;e[6]!==s||e[7]!==i?(K=k(_=>{i({...s,shardKey:_.target.value})},"t3"),e[6]=s,e[7]=i,e[8]=K):K=e[8];let M=K,S;e[9]!==d?(S=k(()=>{d()},"t4"),e[9]=d,e[10]=S):S=e[10];let L=S,R;e[11]!==s.sql||e[12]!==s.title?(R=s.title.trim()!==""&&s.sql.trim()!=="",e[11]=s.sql,e[12]=s.title,e[13]=R):R=e[13];let A=R,w;e[14]!==l?(w=l("Widget title"),e[14]=l,e[15]=w):w=e[15];let C;e[16]!==l?(C=l("Widget title"),e[16]=l,e[17]=C):C=e[17];let b;e[18]!==s.title||e[19]!==q||e[20]!==w||e[21]!==C?(b=(0,o.jsxDEV)("input",{"aria-label":w,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:q,placeholder:C,type:"text",value:s.title},void 0,!1),e[18]=s.title,e[19]=q,e[20]=w,e[21]=C,e[22]=b):b=e[22];let E;e[23]!==l?(E=l("SQL query"),e[23]=l,e[24]=E):E=e[24];let m;e[25]!==s.sql||e[26]!==x||e[27]!==E?(m=(0,o.jsxDEV)("textarea",{"aria-label":E,className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:x,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:s.sql},void 0,!1),e[25]=s.sql,e[26]=x,e[27]=E,e[28]=m):m=e[28];let p;e[29]!==l?(p=l("Shard key (optional)"),e[29]=l,e[30]=p):p=e[30];let u;e[31]!==l?(u=l("Shard key (optional)"),e[31]=l,e[32]=u):u=e[32];let h;e[33]!==s.shardKey||e[34]!==M||e[35]!==p||e[36]!==u?(h=(0,o.jsxDEV)("input",{"aria-label":p,className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:M,placeholder:u,type:"text",value:s.shardKey},void 0,!1),e[33]=s.shardKey,e[34]=M,e[35]=p,e[36]=u,e[37]=h):h=e[37];let v;e[38]!==l?(v=l("Cancel"),e[38]=l,e[39]=v):v=e[39];let g;e[40]!==t||e[41]!==v?(g=(0,o.jsxDEV)(I,{"data-testid":"dashboards-form-cancel",onClick:t,size:"sm",type:"button",variant:"outline",children:v},void 0,!1),e[40]=t,e[41]=v,e[42]=g):g=e[42];let N=!A,r;e[43]!==f||e[44]!==l?(r=l(f?"Save widget":"Add widget"),e[43]=f,e[44]=l,e[45]=r):r=e[45];let n;e[46]!==L||e[47]!==N||e[48]!==r?(n=(0,o.jsxDEV)(I,{"data-testid":"dashboards-form-save",disabled:N,onClick:L,size:"sm",type:"button",children:r},void 0,!1),e[46]=L,e[47]=N,e[48]=r,e[49]=n):n=e[49];let y;e[50]!==g||e[51]!==n?(y=(0,o.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[g,n]},void 0,!0),e[50]=g,e[51]=n,e[52]=y):y=e[52];let F;return e[53]!==m||e[54]!==h||e[55]!==y||e[56]!==b?(F=(0,o.jsxDEV)(z,{"data-testid":"dashboards-form",children:(0,o.jsxDEV)(D,{className:"flex flex-col gap-3 py-4",children:[b,m,h,y]},void 0,!0)},void 0,!1),e[53]=m,e[54]=h,e[55]=y,e[56]=b,e[57]=F):F=e[57],F},"WidgetForm"),xe=k($=>{let e=(0,W.c)(39),{initialShardKey:s}=$,f=O(),[t,i]=X(re),[d,l]=(0,T.useState)(B),[c,q]=(0,T.useState)(null),[a,x]=(0,T.useState)(!1),K;e[0]!==s?(K=k(()=>{q(null),l({...B,shardKey:s??""}),x(!0)},"t1"),e[0]=s,e[1]=K):K=e[1];let M=K,S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S=k(()=>{x(!1),q(null),l(B)},"t2"),e[2]=S):S=e[2];let L=S,R;e[3]!==t?(R=k(r=>{let n=t.find(y=>y.id===r);n!==void 0&&(q(r),l({shardKey:n.shardKey??"",sql:n.sql,title:n.title}),x(!0))},"t3"),e[3]=t,e[4]=R):R=e[4];let A=R,w;e[5]!==i?(w=k(r=>{i(n=>n.filter(y=>y.id!==r))},"t4"),e[5]=i,e[6]=w):w=e[6];let C=w,b;e[7]!==d.shardKey||e[8]!==d.sql||e[9]!==d.title||e[10]!==c||e[11]!==i?(b=k(()=>{let r=d.title.trim(),n=d.sql.trim();if(r===""||n==="")return;let y=d.shardKey.trim();i(c===null?F=>[...F,{id:ee("w"),shardKey:y,sql:n,title:r}]:F=>F.map(_=>_.id===c?{..._,shardKey:y,sql:n,title:r}:_)),L()},"t5"),e[7]=d.shardKey,e[8]=d.sql,e[9]=d.title,e[10]=c,e[11]=i,e[12]=b):b=e[12];let E=b,m;e[13]!==f?(m=f("Chart widgets backed by saved read-only SQL queries."),e[13]=f,e[14]=m):m=e[14];let p;e[15]!==m?(p=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:m},void 0,!1),e[15]=m,e[16]=p):p=e[16];let u;e[17]!==a||e[18]!==M||e[19]!==f?(u=!a&&(0,o.jsxDEV)(I,{"data-testid":"dashboards-add",onClick:M,size:"sm",type:"button",children:f("Add widget")},void 0,!1),e[17]=a,e[18]=M,e[19]=f,e[20]=u):u=e[20];let h;e[21]!==p||e[22]!==u?(h=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[p,u]},void 0,!0),e[21]=p,e[22]=u,e[23]=h):h=e[23];let v;e[24]!==d||e[25]!==c||e[26]!==a||e[27]!==E?(v=a&&(0,o.jsxDEV)(ce,{draft:d,editing:c!==null,onCancel:L,onChange:l,onSubmit:E},void 0,!1),e[24]=d,e[25]=c,e[26]=a,e[27]=E,e[28]=v):v=e[28];let g;e[29]!==a||e[30]!==A||e[31]!==C||e[32]!==f||e[33]!==t?(g=t.length===0&&!a?(0,o.jsxDEV)(U,{description:f("Add a widget to chart a saved SQL query on this browser."),testId:"dashboards-empty",title:f("No widgets yet")},void 0,!1):(0,o.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:t.map(r=>(0,o.jsxDEV)(ne,{onEdit:A,onRemove:C,widget:r},r.id,!1))},void 0,!1),e[29]=a,e[30]=A,e[31]=C,e[32]=f,e[33]=t,e[34]=g):g=e[34];let N;return e[35]!==v||e[36]!==g||e[37]!==h?(N=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[h,v,g]},void 0,!0),e[35]=v,e[36]=g,e[37]=h,e[38]=N):N=e[38],N},"DashboardsPanel");export{xe as default};
|
|
1
|
+
import{a as se}from"./chunk-CENYZ5GF.js";import"./chunk-SWMBBYJU.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import"./chunk-KEGAWN6Y.js";import{a as te}from"./chunk-XNJNSCLM.js";import{a as z,b as V,c as P,e as D}from"./chunk-Y572GMZE.js";import{d as X,f as ee}from"./chunk-2MLA6WFH.js";import"./chunk-HV7G6DFP.js";import{c as I}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-MHGJUKCZ.js";import{f as Q}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as U}from"./chunk-TAD43CG5.js";import{d as O,f as H,g as Y,h as G,m as Z}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as k,e as j,f as ie,g as le,h as oe}from"./chunk-RRCPZMC2.js";var W=j(le(),1),T=j(ie(),1);var o=j(oe(),1);var de=H(J.runSql),ae=k(($,e)=>{let s=Q(),[f,t]=(0,T.useState)(void 0),[i,d]=(0,T.useState)(void 0),[l,c]=(0,T.useState)(!0),q=(0,T.useCallback)(async a=>{c(!0);try{let x=await s.query(de,{sql:$},Y(e));a.cancelled||(t(x),d(void 0))}catch(x){a.cancelled||(t(void 0),d(G(x)))}finally{a.cancelled||c(!1)}},[s,$,e]);return(0,T.useEffect)(()=>{let a={cancelled:!1};return Z(q(a)),()=>{a.cancelled=!0}},[q]),{error:i,loading:l,result:f}},"useRunSql"),re="lunora-studio-dashboards",B={shardKey:"",sql:"",title:""},ne=k($=>{let e=(0,W.c)(54),{onEdit:s,onRemove:f,widget:t}=$,i=O(),{error:d,loading:l,result:c}=ae(t.sql,t.shardKey??""),q;e[0]!==s||e[1]!==t.id?(q=k(()=>{s(t.id)},"t1"),e[0]=s,e[1]=t.id,e[2]=q):q=e[2];let a=q,x;e[3]!==f||e[4]!==t.id?(x=k(()=>{f(t.id)},"t2"),e[3]=f,e[4]=t.id,e[5]=x):x=e[5];let K=x,M=`dashboards-widget-${t.id}`,S;e[6]!==t.title?(S=(0,o.jsxDEV)(P,{className:"min-w-0 truncate",title:t.title,children:t.title},void 0,!1),e[6]=t.title,e[7]=S):S=e[7];let L;e[8]!==i?(L=i("Edit widget"),e[8]=i,e[9]=L):L=e[9];let R=`dashboards-widget-edit-${t.id}`,A;e[10]!==i?(A=i("Edit widget"),e[10]=i,e[11]=A):A=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,o.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsxDEV)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"},void 0,!1)},void 0,!1),e[12]=w):w=e[12];let C;e[13]!==a||e[14]!==L||e[15]!==R||e[16]!==A?(C=(0,o.jsxDEV)(I,{"aria-label":L,"data-testid":R,onClick:a,size:"icon-xs",title:A,type:"button",variant:"ghost",children:w},void 0,!1),e[13]=a,e[14]=L,e[15]=R,e[16]=A,e[17]=C):C=e[17];let b;e[18]!==i?(b=i("Remove widget"),e[18]=i,e[19]=b):b=e[19];let E=`dashboards-widget-remove-${t.id}`,m;e[20]!==i?(m=i("Remove widget"),e[20]=i,e[21]=m):m=e[21];let p;e[22]===Symbol.for("react.memo_cache_sentinel")?(p=(0,o.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsxDEV)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"},void 0,!1)},void 0,!1),e[22]=p):p=e[22];let u;e[23]!==K||e[24]!==b||e[25]!==E||e[26]!==m?(u=(0,o.jsxDEV)(I,{"aria-label":b,"data-testid":E,onClick:K,size:"icon-xs",title:m,type:"button",variant:"ghost",children:p},void 0,!1),e[23]=K,e[24]=b,e[25]=E,e[26]=m,e[27]=u):u=e[27];let h;e[28]!==u||e[29]!==C?(h=(0,o.jsxDEV)("div",{className:"flex shrink-0 items-center gap-1",children:[C,u]},void 0,!0),e[28]=u,e[29]=C,e[30]=h):h=e[30];let v;e[31]!==h||e[32]!==S?(v=(0,o.jsxDEV)(V,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[S,h]},void 0,!0),e[31]=h,e[32]=S,e[33]=v):v=e[33];let g;e[34]!==d||e[35]!==t.id?(g=d!==void 0&&(0,o.jsxDEV)(te,{className:"font-mono text-xs",testId:`dashboards-widget-error-${t.id}`,variant:"destructive",children:d},void 0,!1),e[34]=d,e[35]=t.id,e[36]=g):g=e[36];let N;e[37]!==d||e[38]!==l||e[39]!==c||e[40]!==i||e[41]!==t.id?(N=d===void 0&&l&&c===void 0&&(0,o.jsxDEV)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${t.id}`,children:i("Running\u2026")},void 0,!1),e[37]=d,e[38]=l,e[39]=c,e[40]=i,e[41]=t.id,e[42]=N):N=e[42];let r;e[43]!==d||e[44]!==c?(r=d===void 0&&c!==void 0&&(0,o.jsxDEV)(se,{result:c},void 0,!1),e[43]=d,e[44]=c,e[45]=r):r=e[45];let n;e[46]!==g||e[47]!==N||e[48]!==r?(n=(0,o.jsxDEV)(D,{className:"min-h-32 py-2",children:[g,N,r]},void 0,!0),e[46]=g,e[47]=N,e[48]=r,e[49]=n):n=e[49];let y;return e[50]!==v||e[51]!==n||e[52]!==M?(y=(0,o.jsxDEV)(z,{"data-testid":M,children:[v,n]},void 0,!0),e[50]=v,e[51]=n,e[52]=M,e[53]=y):y=e[53],y},"WidgetCard"),ce=k($=>{let e=(0,W.c)(58),{draft:s,editing:f,onCancel:t,onChange:i,onSubmit:d}=$,l=O(),c;e[0]!==s||e[1]!==i?(c=k(_=>{i({...s,title:_.target.value})},"t1"),e[0]=s,e[1]=i,e[2]=c):c=e[2];let q=c,a;e[3]!==s||e[4]!==i?(a=k(_=>{i({...s,sql:_.target.value})},"t2"),e[3]=s,e[4]=i,e[5]=a):a=e[5];let x=a,K;e[6]!==s||e[7]!==i?(K=k(_=>{i({...s,shardKey:_.target.value})},"t3"),e[6]=s,e[7]=i,e[8]=K):K=e[8];let M=K,S;e[9]!==d?(S=k(()=>{d()},"t4"),e[9]=d,e[10]=S):S=e[10];let L=S,R;e[11]!==s.sql||e[12]!==s.title?(R=s.title.trim()!==""&&s.sql.trim()!=="",e[11]=s.sql,e[12]=s.title,e[13]=R):R=e[13];let A=R,w;e[14]!==l?(w=l("Widget title"),e[14]=l,e[15]=w):w=e[15];let C;e[16]!==l?(C=l("Widget title"),e[16]=l,e[17]=C):C=e[17];let b;e[18]!==s.title||e[19]!==q||e[20]!==w||e[21]!==C?(b=(0,o.jsxDEV)("input",{"aria-label":w,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:q,placeholder:C,type:"text",value:s.title},void 0,!1),e[18]=s.title,e[19]=q,e[20]=w,e[21]=C,e[22]=b):b=e[22];let E;e[23]!==l?(E=l("SQL query"),e[23]=l,e[24]=E):E=e[24];let m;e[25]!==s.sql||e[26]!==x||e[27]!==E?(m=(0,o.jsxDEV)("textarea",{"aria-label":E,className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:x,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:s.sql},void 0,!1),e[25]=s.sql,e[26]=x,e[27]=E,e[28]=m):m=e[28];let p;e[29]!==l?(p=l("Shard key (optional)"),e[29]=l,e[30]=p):p=e[30];let u;e[31]!==l?(u=l("Shard key (optional)"),e[31]=l,e[32]=u):u=e[32];let h;e[33]!==s.shardKey||e[34]!==M||e[35]!==p||e[36]!==u?(h=(0,o.jsxDEV)("input",{"aria-label":p,className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:M,placeholder:u,type:"text",value:s.shardKey},void 0,!1),e[33]=s.shardKey,e[34]=M,e[35]=p,e[36]=u,e[37]=h):h=e[37];let v;e[38]!==l?(v=l("Cancel"),e[38]=l,e[39]=v):v=e[39];let g;e[40]!==t||e[41]!==v?(g=(0,o.jsxDEV)(I,{"data-testid":"dashboards-form-cancel",onClick:t,size:"sm",type:"button",variant:"outline",children:v},void 0,!1),e[40]=t,e[41]=v,e[42]=g):g=e[42];let N=!A,r;e[43]!==f||e[44]!==l?(r=l(f?"Save widget":"Add widget"),e[43]=f,e[44]=l,e[45]=r):r=e[45];let n;e[46]!==L||e[47]!==N||e[48]!==r?(n=(0,o.jsxDEV)(I,{"data-testid":"dashboards-form-save",disabled:N,onClick:L,size:"sm",type:"button",children:r},void 0,!1),e[46]=L,e[47]=N,e[48]=r,e[49]=n):n=e[49];let y;e[50]!==g||e[51]!==n?(y=(0,o.jsxDEV)("div",{className:"flex items-center justify-end gap-2",children:[g,n]},void 0,!0),e[50]=g,e[51]=n,e[52]=y):y=e[52];let F;return e[53]!==m||e[54]!==h||e[55]!==y||e[56]!==b?(F=(0,o.jsxDEV)(z,{"data-testid":"dashboards-form",children:(0,o.jsxDEV)(D,{className:"flex flex-col gap-3 py-4",children:[b,m,h,y]},void 0,!0)},void 0,!1),e[53]=m,e[54]=h,e[55]=y,e[56]=b,e[57]=F):F=e[57],F},"WidgetForm"),xe=k($=>{let e=(0,W.c)(39),{initialShardKey:s}=$,f=O(),[t,i]=X(re),[d,l]=(0,T.useState)(B),[c,q]=(0,T.useState)(null),[a,x]=(0,T.useState)(!1),K;e[0]!==s?(K=k(()=>{q(null),l({...B,shardKey:s??""}),x(!0)},"t1"),e[0]=s,e[1]=K):K=e[1];let M=K,S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S=k(()=>{x(!1),q(null),l(B)},"t2"),e[2]=S):S=e[2];let L=S,R;e[3]!==t?(R=k(r=>{let n=t.find(y=>y.id===r);n!==void 0&&(q(r),l({shardKey:n.shardKey??"",sql:n.sql,title:n.title}),x(!0))},"t3"),e[3]=t,e[4]=R):R=e[4];let A=R,w;e[5]!==i?(w=k(r=>{i(n=>n.filter(y=>y.id!==r))},"t4"),e[5]=i,e[6]=w):w=e[6];let C=w,b;e[7]!==d.shardKey||e[8]!==d.sql||e[9]!==d.title||e[10]!==c||e[11]!==i?(b=k(()=>{let r=d.title.trim(),n=d.sql.trim();if(r===""||n==="")return;let y=d.shardKey.trim();i(c===null?F=>[...F,{id:ee("w"),shardKey:y,sql:n,title:r}]:F=>F.map(_=>_.id===c?{..._,shardKey:y,sql:n,title:r}:_)),L()},"t5"),e[7]=d.shardKey,e[8]=d.sql,e[9]=d.title,e[10]=c,e[11]=i,e[12]=b):b=e[12];let E=b,m;e[13]!==f?(m=f("Chart widgets backed by saved read-only SQL queries."),e[13]=f,e[14]=m):m=e[14];let p;e[15]!==m?(p=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:m},void 0,!1),e[15]=m,e[16]=p):p=e[16];let u;e[17]!==a||e[18]!==M||e[19]!==f?(u=!a&&(0,o.jsxDEV)(I,{"data-testid":"dashboards-add",onClick:M,size:"sm",type:"button",children:f("Add widget")},void 0,!1),e[17]=a,e[18]=M,e[19]=f,e[20]=u):u=e[20];let h;e[21]!==p||e[22]!==u?(h=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[p,u]},void 0,!0),e[21]=p,e[22]=u,e[23]=h):h=e[23];let v;e[24]!==d||e[25]!==c||e[26]!==a||e[27]!==E?(v=a&&(0,o.jsxDEV)(ce,{draft:d,editing:c!==null,onCancel:L,onChange:l,onSubmit:E},void 0,!1),e[24]=d,e[25]=c,e[26]=a,e[27]=E,e[28]=v):v=e[28];let g;e[29]!==a||e[30]!==A||e[31]!==C||e[32]!==f||e[33]!==t?(g=t.length===0&&!a?(0,o.jsxDEV)(U,{description:f("Add a widget to chart a saved SQL query on this browser."),testId:"dashboards-empty",title:f("No widgets yet")},void 0,!1):(0,o.jsxDEV)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:t.map(r=>(0,o.jsxDEV)(ne,{onEdit:A,onRemove:C,widget:r},r.id,!1))},void 0,!1),e[29]=a,e[30]=A,e[31]=C,e[32]=f,e[33]=t,e[34]=g):g=e[34];let N;return e[35]!==v||e[36]!==g||e[37]!==h?(N=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[h,v,g]},void 0,!0),e[35]=v,e[36]=g,e[37]=h,e[38]=N):N=e[38],N},"DashboardsPanel");export{xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as $}from"./chunk-IYHPYY4A.js";import{a as M}from"./chunk-
|
|
1
|
+
import{b as $}from"./chunk-IYHPYY4A.js";import{a as M}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as H}from"./chunk-2YUYNNHQ.js";import{a as P,b as Q,c as W,d as V,e as C,f as E}from"./chunk-GTM65MVX.js";import{a as K,e as O}from"./chunk-Y572GMZE.js";import{b as F}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as j}from"./chunk-MHGJUKCZ.js";import"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as B}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as U,e as L,f as G,g as J,h as X}from"./chunk-RRCPZMC2.js";var q=L(J(),1),te=L(G(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=U(i=>{let e=(0,q.c)(68),{initialShardKey:z}=i,t=B(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let R=z??"",T;e[1]!==R?(T={shardKey:R},e[1]=R,e[2]=T):T=e[2];let{data:k,error:d,errorSource:S,isLoading:A}=H(j.getSettings,N,T),D;e:{let s=k?.deploy;if(s===void 0){let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3],D=l;break e}let o;if(e[4]!==s.deploymentId||e[5]!==s.environment||e[6]!==s.versionTag||e[7]!==s.workerUrl||e[8]!==t){if(o=[],s.workerUrl!==void 0){let l;e[10]!==t?(l=t("URL"),e[10]=t,e[11]=l):l=e[11];let a;e[12]!==s.workerUrl||e[13]!==l?(a={label:l,value:s.workerUrl},e[12]=s.workerUrl,e[13]=l,e[14]=a):a=e[14],o.push(a)}if(s.environment!==void 0){let l;e[15]!==t?(l=t("Environment"),e[15]=t,e[16]=l):l=e[16];let a;e[17]!==s.environment||e[18]!==l?(a={label:l,value:s.environment},e[17]=s.environment,e[18]=l,e[19]=a):a=e[19],o.push(a)}if(s.deploymentId!==void 0){let l;e[20]!==t?(l=t("Deployment"),e[20]=t,e[21]=l):l=e[21];let a;e[22]!==s.deploymentId||e[23]!==l?(a={label:l,value:s.deploymentId},e[22]=s.deploymentId,e[23]=l,e[24]=a):a=e[24],o.push(a)}if(s.versionTag!==void 0){let l;e[25]!==t?(l=t("Version"),e[25]=t,e[26]=l):l=e[26];let a;e[27]!==s.versionTag||e[28]!==l?(a={label:l,value:s.versionTag},e[27]=s.versionTag,e[28]=l,e[29]=a):a=e[29],o.push(a)}e[4]=s.deploymentId,e[5]=s.environment,e[6]=s.versionTag,e[7]=s.workerUrl,e[8]=t,e[9]=o}else o=e[9];D=o}let w=D,_;e[30]!==k?.settings?(_=k?.settings??[],e[30]=k?.settings,e[31]=_):_=e[31];let n=_,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let f;e[34]!==m?(f=(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:$,rel:"noreferrer",target:"_blank",children:m},void 0,!1)},void 0,!1),e[34]=m,e[35]=f):f=e[35];let c;e[36]!==t?(c=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=c):c=e[37];let v;e[38]!==c?(v=(0,r.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:c},void 0,!1),e[38]=c,e[39]=v):v=e[39];let p;e[40]!==d||e[41]!==S?(p=d!==null&&(0,r.jsxDEV)(M,{error:S,testId:"set-error"},void 0,!1),e[40]=d,e[41]=S,e[42]=p):p=e[42];let u;e[43]!==w||e[44]!==t?(u=w.length>0&&(0,r.jsxDEV)(K,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{className:"py-3",children:(0,r.jsxDEV)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:w.map(Z)},void 0,!1)},void 0,!1)]},void 0,!0),e[43]=w,e[44]=t,e[45]=u):u=e[45];let h;e[46]!==t?(h=t("Environment & bindings"),e[46]=t,e[47]=h):h=e[47];let g;e[48]!==h?(g=(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h},void 0,!1)},void 0,!1),e[48]=h,e[49]=g):g=e[49];let x;e[50]!==d||e[51]!==A||e[52]!==n.length||e[53]!==t?(x=d===null&&!A&&n.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")},void 0,!1),e[50]=d,e[51]=A,e[52]=n.length,e[53]=t,e[54]=x):x=e[54];let b;e[55]!==n||e[56]!==t?(b=n.length>0&&(0,r.jsxDEV)(O,{className:"px-0 py-0",children:(0,r.jsxDEV)(P,{"data-testid":"set-table",children:[(0,r.jsxDEV)(Q,{children:(0,r.jsxDEV)(V,{children:[(0,r.jsxDEV)(C,{children:t("name")},void 0,!1),(0,r.jsxDEV)(C,{children:t("kind")},void 0,!1),(0,r.jsxDEV)(C,{children:t("value")},void 0,!1)]},void 0,!0)},void 0,!1),(0,r.jsxDEV)(W,{children:n.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1),e[55]=n,e[56]=t,e[57]=b):b=e[57];let y;e[58]!==g||e[59]!==x||e[60]!==b?(y=(0,r.jsxDEV)(K,{className:"py-0",children:[g,x,b]},void 0,!0),e[58]=g,e[59]=x,e[60]=b,e[61]=y):y=e[61];let I;return e[62]!==p||e[63]!==u||e[64]!==y||e[65]!==f||e[66]!==v?(I=(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[f,v,p,u,y]},void 0,!0),e[62]=p,e[63]=u,e[64]=y,e[65]=f,e[66]=v,e[67]=I):I=e[67],I},"SettingsPanel");function Z(i){return(0,r.jsxDEV)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsxDEV)("dt",{className:"text-muted-foreground",children:i.label},void 0,!1),(0,r.jsxDEV)("dd",{className:"truncate font-mono text-xs",title:i.value,children:i.value},void 0,!1)]},i.label,!0)}U(Z,"_temp");function ee(i){return(0,r.jsxDEV)(V,{"data-testid":"set-row",children:[(0,r.jsxDEV)(E,{className:"font-mono text-xs font-medium",children:i.name},void 0,!1),(0,r.jsxDEV)(E,{children:(0,r.jsxDEV)(F,{variant:Y[i.kind],children:i.bindingType??i.kind},void 0,!1)},void 0,!1),(0,r.jsxDEV)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:i.value??(0,r.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},i.name,!0)}U(ee,"_temp2");export{me as SettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as n}from"./chunk-
|
|
1
|
+
import{d as n}from"./chunk-HBGS4SEX.js";import{a as l,e as a,g as u,h as d}from"./chunk-RRCPZMC2.js";var c=a(u(),1);var v=a(d(),1);var x=l(f=>{let e=(0,c.c)(6),{message:r,prefix:m}=f,o=n();if(r===void 0)return null;let i=`${m}-live-error`,t;e[0]!==r||e[1]!==o?(t=o("Live unavailable: {liveError}",{liveError:r}),e[0]=r,e[1]=o,e[2]=t):t=e[2];let s;return e[3]!==i||e[4]!==t?(s=(0,v.jsxDEV)("span",{className:"text-xs text-destructive","data-testid":i,role:"status",children:t},void 0,!1),e[3]=i,e[4]=t,e[5]=s):s=e[5],s},"LiveError");export{x as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"./chunk-J6J54MBP.js";import{a as j}from"./chunk-2K47A3P6.js";import{a as H}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-J6J54MBP.js";import{a as j}from"./chunk-2K47A3P6.js";import{a as H}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as K}from"./chunk-2YUYNNHQ.js";import{a as P,b as F,c as L,d as k,e as u,f as m}from"./chunk-GTM65MVX.js";import{a as M,e as $}from"./chunk-Y572GMZE.js";import{a as _}from"./chunk-F2YMCQ6B.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import"./chunk-O3NAGRTR.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as R}from"./chunk-MHGJUKCZ.js";import"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as B}from"./chunk-TAD43CG5.js";import{d as D}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as S,e as T,f as U,g as V,h as X}from"./chunk-RRCPZMC2.js";var G=T(V(),1),J=T(U(),1);var t=T(X(),1);var W=80,Z=S(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>W?`${e.slice(0,W)}\u2026`:e},"formatArguments"),q=S(a=>{let e=[];for(let n of a){let o=n.id.toString();if(n.subscriptions.length===0){e.push({admin:n.admin,connectionId:n.id,key:`c${o}`,subscription:null});continue}n.subscriptions.forEach((s,N)=>{e.push({admin:n.admin,connectionId:n.id,key:`c${o}-s${N.toString()}`,subscription:s})})}return e},"toRows"),w=(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),de=S(a=>{let e=(0,G.c)(22),{initialShardKey:n}=a,o=D(),[s,N]=(0,J.useState)(n??""),f;e[0]!==s?(f=s.trim(),e[0]=s,e[1]=f):f=e[1];let A=j(f,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let p;e[3]!==A?(p={keepPreviousData:!0,shardKey:A},e[3]=A,e[4]=p):p=e[4];let{data:i,error:r,errorSource:c,refetch:Q}=K(R.listSubscriptions,h,p);O(Q,!0);let v;if(e[5]!==r||e[6]!==c||e[7]!==i||e[8]!==s||e[9]!==o){let C=i===void 0?[]:q(i.connections),l;e[11]!==s?(l=(0,t.jsxDEV)(_,{onChange:N,testId:"subs-shard-input",value:s},void 0,!1),e[11]=s,e[12]=l):l=e[12];let d;e[13]!==i||e[14]!==o?(d=i!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} connections",{count:i.totalConnections})},void 0,!1),(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} subscriptions",{count:i.totalSubscriptions})},void 0,!1)]},void 0,!0),e[13]=i,e[14]=o,e[15]=d):d=e[15];let b;e[16]!==l||e[17]!==d?(b=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[l,d]},void 0,!0),e[16]=l,e[17]=d,e[18]=b):b=e[18];let g;e[19]!==r||e[20]!==c?(g=r!==null&&(0,t.jsxDEV)(H,{error:c,testId:"subs-error"},void 0,!1),e[19]=r,e[20]=c,e[21]=g):g=e[21],v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[b,g,r===null&&i!==void 0&&C.length===0&&(0,t.jsxDEV)(B,{description:o("Active WebSocket subscriptions on this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1)},void 0,!1),testId:"subs-empty",title:o("No active subscriptions.")},void 0,!1),r===null&&C.length>0&&(0,t.jsxDEV)(M,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)($,{className:"px-0",children:(0,t.jsxDEV)(P,{"data-testid":"subs-table",children:[(0,t.jsxDEV)(F,{children:(0,t.jsxDEV)(k,{children:[(0,t.jsxDEV)(u,{children:o("Connection")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Function path")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Table")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(L,{children:C.map(x=>{let{subscription:I}=x,E=Z(I?.args);return(0,t.jsxDEV)(k,{"data-testid":"subs-row",children:[(0,t.jsxDEV)(m,{className:"font-medium tabular-nums",children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,t.jsxDEV)(y,{variant:"outline",children:o("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(m,{className:"font-mono text-xs",children:I?.functionPath??w},void 0,!1),(0,t.jsxDEV)(m,{children:I?.table??w},void 0,!1),(0,t.jsxDEV)(m,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:E||void 0,children:E||w},void 0,!1)]},x.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=r,e[6]=c,e[7]=i,e[8]=s,e[9]=o,e[10]=v}else v=e[10];return v},"SubscriptionsPanel");export{de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as vt,b as ht,c as gt,d as xt,e as pt}from"./chunk-7YGTGBP7.js";import{a as ct,b as ft,c as ut,d as mt,e as ke}from"./chunk-S5NTGHCG.js";import"./chunk-DWDILV2E.js";import{a as dt}from"./chunk-N7SVJOHN.js";import"./chunk-APSSZB6Z.js";import"./chunk-QAFAJBAW.js";import{e as nt}from"./chunk-IYHPYY4A.js";import{a as ot}from"./chunk-FQUNSQLG.js";import"./chunk-SHERR7ZP.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-SWMBBYJU.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import{a as it}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import{b as je}from"./chunk-4F72YCTU.js";import{a as Ue,b as Ve,c as Ge,d as Ie,e as Z,f as G}from"./chunk-GTM65MVX.js";import{a as ee,b as Re,c as Me,d as Ye,e as le}from"./chunk-Y572GMZE.js";import"./chunk-4QHKBC77.js";import{a as at}from"./chunk-FDWXYXOM.js";import{a as lt,b as st}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as Ke}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as He}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as Be}from"./chunk-EBTLTGG3.js";import{f as Xe}from"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as Ee,f as Ze,g as et,h as tt,l as rt,o as ze}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a as d,e as Qe,f as bt,g as Nt,h as yt}from"./chunk-RRCPZMC2.js";var Fe=Qe(Nt(),1);var _=Qe(bt(),1);var t=Qe(yt(),1);var St=d(s=>s.kind==="gauge"?s.last:s.kind==="histogram"?s.sum/Math.max(1,s.count):s.sum,"metricHeadline"),Je=d(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"formatMetricValue"),wt=d(s=>Array.isArray(s?.series)?s.series:[],"seriesOf"),qt={counter:"secondary",gauge:"default",histogram:"outline"},Tt=d(s=>{let e=(0,Fe.c)(79),{shardKey:l}=s,r=Ee(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let U;e[1]!==l?(U={live:!0,shardKey:l},e[1]=l,e[2]=U):U=e[2];let{data:M,error:g}=je(Be.getMetricSeries,o,U),y,v,p,u,c,C,z,B,i,q,O,E,W;if(e[3]!==M||e[4]!==g||e[5]!==r){C=Symbol.for("react.early_return_sentinel");e:{let V=wt(M);if(g!==null||V.length===0){C=null;break e}let S;e[19]!==r?(S=d(f=>r(f==="counter"?"Counter":f==="gauge"?"Gauge":"Histogram"),"t122"),e[19]=r,e[20]=S):S=e[20];let w=S;E="flex flex-col gap-2",W="mt-instruments";let F;e[21]!==r?(F=r("Instruments"),e[21]=r,e[22]=F):F=e[22],e[23]!==F?(c=(0,t.jsxDEV)("h3",{className:"text-sm font-semibold text-foreground",children:F},void 0,!1),e[23]=F,e[24]=c):c=e[24],u=ee,O="overflow-hidden py-0",p=le,q="px-0",v=Ue,B="mt-instruments-table";let D;e[25]!==r?(D=r("name"),e[25]=r,e[26]=D):D=e[26];let A;e[27]!==D?(A=(0,t.jsxDEV)(Z,{children:D},void 0,!1),e[27]=D,e[28]=A):A=e[28];let L;e[29]!==r?(L=r("kind"),e[29]=r,e[30]=L):L=e[30];let a;e[31]!==L?(a=(0,t.jsxDEV)(Z,{children:L},void 0,!1),e[31]=L,e[32]=a):a=e[32];let b;e[33]!==r?(b=r("value"),e[33]=r,e[34]=b):b=e[34];let h;e[35]!==b?(h=(0,t.jsxDEV)(Z,{className:"text-right",children:b},void 0,!1),e[35]=b,e[36]=h):h=e[36];let x;e[37]!==r?(x=r("count"),e[37]=r,e[38]=x):x=e[38];let P;e[39]!==x?(P=(0,t.jsxDEV)(Z,{className:"text-right",children:x},void 0,!1),e[39]=x,e[40]=P):P=e[40];let Q;e[41]!==r?(Q=r("range"),e[41]=r,e[42]=Q):Q=e[42];let H;e[43]!==Q?(H=(0,t.jsxDEV)(Z,{className:"text-right",children:Q},void 0,!1),e[43]=Q,e[44]=H):H=e[44];let K;e[45]!==r?(K=r("dimensions"),e[45]=r,e[46]=K):K=e[46];let j;e[47]!==K?(j=(0,t.jsxDEV)(Z,{children:K},void 0,!1),e[47]=K,e[48]=j):j=e[48],e[49]!==A||e[50]!==a||e[51]!==h||e[52]!==P||e[53]!==H||e[54]!==j?(i=(0,t.jsxDEV)(Ve,{children:(0,t.jsxDEV)(Ie,{children:[A,a,h,P,H,j]},void 0,!0)},void 0,!1),e[49]=A,e[50]=a,e[51]=h,e[52]=P,e[53]=H,e[54]=j,e[55]=i):i=e[55],y=Ge;let X;e[56]!==w?(X=d(f=>{let Y=dt(f.attributes),te=`${f.kind}:${f.name}:${Y}`;return(0,t.jsxDEV)(Ie,{"data-testid":`mt-instrument-${f.name}`,children:[(0,t.jsxDEV)(G,{className:"font-mono text-xs",title:f.functionPath,children:f.name},void 0,!1),(0,t.jsxDEV)(G,{children:(0,t.jsxDEV)(He,{variant:qt[f.kind],children:w(f.kind)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(G,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${f.name}`,children:Je(St(f))},void 0,!1),(0,t.jsxDEV)(G,{className:"text-right tabular-nums text-muted-foreground",children:f.count.toLocaleString()},void 0,!1),(0,t.jsxDEV)(G,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:f.min===f.max?"\u2014":`${Je(f.min)}\u2013${Je(f.max)}`},void 0,!1),(0,t.jsxDEV)(G,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:Y,children:Y===""?"\u2014":Y},void 0,!1)]},te,!0)},"t26"),e[56]=w,e[57]=X):X=e[57],z=V.map(X)}e[3]=M,e[4]=g,e[5]=r,e[6]=y,e[7]=v,e[8]=p,e[9]=u,e[10]=c,e[11]=C,e[12]=z,e[13]=B,e[14]=i,e[15]=q,e[16]=O,e[17]=E,e[18]=W}else y=e[6],v=e[7],p=e[8],u=e[9],c=e[10],C=e[11],z=e[12],B=e[13],i=e[14],q=e[15],O=e[16],E=e[17],W=e[18];if(C!==Symbol.for("react.early_return_sentinel"))return C;let I;e[58]!==y||e[59]!==z?(I=(0,t.jsxDEV)(y,{children:z},void 0,!1),e[58]=y,e[59]=z,e[60]=I):I=e[60];let m;e[61]!==v||e[62]!==I||e[63]!==B||e[64]!==i?(m=(0,t.jsxDEV)(v,{"data-testid":B,children:[i,I]},void 0,!0),e[61]=v,e[62]=I,e[63]=B,e[64]=i,e[65]=m):m=e[65];let $;e[66]!==p||e[67]!==m||e[68]!==q?($=(0,t.jsxDEV)(p,{className:q,children:m},void 0,!1),e[66]=p,e[67]=m,e[68]=q,e[69]=$):$=e[69];let k;e[70]!==u||e[71]!==$||e[72]!==O?(k=(0,t.jsxDEV)(u,{className:O,children:$},void 0,!1),e[70]=u,e[71]=$,e[72]=O,e[73]=k):k=e[73];let R;return e[74]!==c||e[75]!==k||e[76]!==E||e[77]!==W?(R=(0,t.jsxDEV)("section",{className:E,"data-testid":W,children:[c,k]},void 0,!0),e[74]=c,e[75]=k,e[76]=E,e[77]=W,e[78]=R):R=e[78],R},"InstrumentsTable"),Pe=d(s=>s>=100?"critical":s>=50?"warning":"good","performanceLevel"),We=d(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"formatLatency"),Oe=d(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"formatCount"),_t=d(s=>{let e=(0,Fe.c)(3),{level:l}=s;if(l==="critical"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxDEV)(He,{variant:"destructive",children:"Slow"},void 0,!1),e[0]=o):o=e[0],o}if(l==="warning"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxDEV)("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"},void 0,!1),e[1]=o):o=e[1],o}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxDEV)("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"},void 0,!1),e[2]=r):r=e[2],r},"PerformanceBadge"),Ct=d(s=>{let e=(0,Fe.c)(152),{queryStats:l}=s,r=Ee(),[o,U]=(0,_.useState)("totalTime"),M;e[0]===Symbol.for("react.memo_cache_sentinel")?(M=new Set,e[0]=M):M=e[0];let[g,y]=(0,_.useState)(M),v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=d(n=>{n!==null&&U(n)},"t2"),e[1]=v):v=e[1];let p=v,u;if(e[2]!==l||e[3]!==o){u=[...l];let n;e[5]!==o?(n=d((T,N)=>{switch(o){case"avgTime":return N.avgDurationMs-T.avgDurationMs;case"execCount":return N.execCount-T.execCount;case"rowsRead":return N.rowsRead-T.rowsRead;default:return N.totalDurationMs-T.totalDurationMs}},"t310"),e[5]=o,e[6]=n):n=e[6],u.sort(n),e[2]=l,e[3]=o,e[4]=u}else u=e[4];let c=u,C;e[7]!==l?(C=l.filter($t),e[7]=l,e[8]=C):C=e[8];let z=C.length,B;e[9]!==l?(B=l.filter(Rt),e[9]=l,e[10]=B):B=e[10];let i=B.length,q;e[11]!==l?(q=l.filter(Mt),e[11]=l,e[12]=q):q=e[12];let O=q.length,E;e[13]===Symbol.for("react.memo_cache_sentinel")?(E=d(n=>{y(T=>{let N=new Set(T);return N.has(n)?N.delete(n):N.add(n),N})},"t6"),e[13]=E):E=e[13];let W=E;if(l.length===0){let n;e[14]!==r?(n=r("No query insights yet"),e[14]=r,e[15]=n):n=e[15];let T;e[16]!==n?(T=(0,t.jsxDEV)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:n},void 0,!1),e[16]=n,e[17]=T):T=e[17];let N;e[18]!==r?(N=r("Query insights appear once statements are executed against this shard."),e[18]=r,e[19]=N):N=e[19];let re;e[20]!==N?(re=(0,t.jsxDEV)("p",{className:"mt-1 text-sm",children:N},void 0,!1),e[20]=N,e[21]=re):re=e[21];let Le;return e[22]!==re||e[23]!==T?(Le=(0,t.jsxDEV)(ee,{children:(0,t.jsxDEV)(le,{className:"py-12",children:(0,t.jsxDEV)("div",{className:"text-center text-muted-foreground",children:[T,re]},void 0,!0)},void 0,!1)},void 0,!1),e[22]=re,e[23]=T,e[24]=Le):Le=e[24],Le}let I;e[25]!==r?(I=r("Critical queries"),e[25]=r,e[26]=I):I=e[26];let m;e[27]!==I?(m=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(Me,{className:"text-sm font-medium",children:I},void 0,!1)},void 0,!1),e[27]=I,e[28]=m):m=e[28];let $;e[29]!==z?($=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:z},void 0,!1),e[29]=z,e[30]=$):$=e[30];let k;e[31]!==r?(k=r(">100ms avg execution"),e[31]=r,e[32]=k):k=e[32];let R;e[33]!==k?(R=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:k},void 0,!1),e[33]=k,e[34]=R):R=e[34];let V;e[35]!==R||e[36]!==$?(V=(0,t.jsxDEV)(le,{children:[$,R]},void 0,!0),e[35]=R,e[36]=$,e[37]=V):V=e[37];let S;e[38]!==V||e[39]!==m?(S=(0,t.jsxDEV)(ee,{children:[m,V]},void 0,!0),e[38]=V,e[39]=m,e[40]=S):S=e[40];let w;e[41]!==r?(w=r("Moderate queries"),e[41]=r,e[42]=w):w=e[42];let F;e[43]!==w?(F=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(Me,{className:"text-sm font-medium",children:w},void 0,!1)},void 0,!1),e[43]=w,e[44]=F):F=e[44];let D;e[45]!==i?(D=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:i},void 0,!1),e[45]=i,e[46]=D):D=e[46];let A;e[47]!==r?(A=r("50\u2013100ms avg execution"),e[47]=r,e[48]=A):A=e[48];let L;e[49]!==A?(L=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:A},void 0,!1),e[49]=A,e[50]=L):L=e[50];let a;e[51]!==D||e[52]!==L?(a=(0,t.jsxDEV)(le,{children:[D,L]},void 0,!0),e[51]=D,e[52]=L,e[53]=a):a=e[53];let b;e[54]!==F||e[55]!==a?(b=(0,t.jsxDEV)(ee,{children:[F,a]},void 0,!0),e[54]=F,e[55]=a,e[56]=b):b=e[56];let h;e[57]!==r?(h=r("Fast queries"),e[57]=r,e[58]=h):h=e[58];let x;e[59]!==h?(x=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(Me,{className:"text-sm font-medium",children:h},void 0,!1)},void 0,!1),e[59]=h,e[60]=x):x=e[60];let P;e[61]!==O?(P=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:O},void 0,!1),e[61]=O,e[62]=P):P=e[62];let Q;e[63]!==r?(Q=r("<50ms avg execution"),e[63]=r,e[64]=Q):Q=e[64];let H;e[65]!==Q?(H=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:Q},void 0,!1),e[65]=Q,e[66]=H):H=e[66];let K;e[67]!==P||e[68]!==H?(K=(0,t.jsxDEV)(le,{children:[P,H]},void 0,!0),e[67]=P,e[68]=H,e[69]=K):K=e[69];let j;e[70]!==x||e[71]!==K?(j=(0,t.jsxDEV)(ee,{children:[x,K]},void 0,!0),e[70]=x,e[71]=K,e[72]=j):j=e[72];let X;e[73]!==S||e[74]!==b||e[75]!==j?(X=(0,t.jsxDEV)("div",{className:"grid gap-4 md:grid-cols-3",children:[S,b,j]},void 0,!0),e[73]=S,e[74]=b,e[75]=j,e[76]=X):X=e[76];let f;e[77]!==r?(f=r("Query leaderboard"),e[77]=r,e[78]=f):f=e[78];let Y;e[79]!==f?(Y=(0,t.jsxDEV)("h3",{className:"text-lg font-semibold",children:f},void 0,!1),e[79]=f,e[80]=Y):Y=e[80];let te;e[81]!==o||e[82]!==r?(te=r("Slow queries sorted by {sortField}",{sortField:r(o)}),e[81]=o,e[82]=r,e[83]=te):te=e[83];let se;e[84]!==te?(se=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:te},void 0,!1),e[84]=te,e[85]=se):se=e[85];let ae;e[86]!==Y||e[87]!==se?(ae=(0,t.jsxDEV)("div",{children:[Y,se]},void 0,!0),e[86]=Y,e[87]=se,e[88]=ae):ae=e[88];let ie;e[89]!==r?(ie=r("Sort by"),e[89]=r,e[90]=ie):ie=e[90];let oe;e[91]!==ie?(oe=(0,t.jsxDEV)("span",{className:"text-sm text-muted-foreground",children:ie},void 0,!1),e[91]=ie,e[92]=oe):oe=e[92];let ne;e[93]!==r?(ne=r("Sort queries by"),e[93]=r,e[94]=ne):ne=e[94];let De;e[95]===Symbol.for("react.memo_cache_sentinel")?(De=(0,t.jsxDEV)(ft,{},void 0,!1),e[95]=De):De=e[95];let de;e[96]!==ne?(de=(0,t.jsxDEV)(ut,{"aria-label":ne,className:"w-[140px]","data-testid":"qi-sort",children:De},void 0,!1),e[96]=ne,e[97]=de):de=e[97];let ce;e[98]!==r?(ce=r("Total time"),e[98]=r,e[99]=ce):ce=e[99];let fe;e[100]!==ce?(fe=(0,t.jsxDEV)(ke,{value:"totalTime",children:ce},void 0,!1),e[100]=ce,e[101]=fe):fe=e[101];let ue;e[102]!==r?(ue=r("Avg time"),e[102]=r,e[103]=ue):ue=e[103];let me;e[104]!==ue?(me=(0,t.jsxDEV)(ke,{value:"avgTime",children:ue},void 0,!1),e[104]=ue,e[105]=me):me=e[105];let ve;e[106]!==r?(ve=r("Execution count"),e[106]=r,e[107]=ve):ve=e[107];let he;e[108]!==ve?(he=(0,t.jsxDEV)(ke,{value:"execCount",children:ve},void 0,!1),e[108]=ve,e[109]=he):he=e[109];let ge;e[110]!==r?(ge=r("Rows read"),e[110]=r,e[111]=ge):ge=e[111];let xe;e[112]!==ge?(xe=(0,t.jsxDEV)(ke,{value:"rowsRead",children:ge},void 0,!1),e[112]=ge,e[113]=xe):xe=e[113];let pe;e[114]!==fe||e[115]!==me||e[116]!==he||e[117]!==xe?(pe=(0,t.jsxDEV)(mt,{children:[fe,me,he,xe]},void 0,!0),e[114]=fe,e[115]=me,e[116]=he,e[117]=xe,e[118]=pe):pe=e[118];let be;e[119]!==o||e[120]!==de||e[121]!==pe?(be=(0,t.jsxDEV)(ct,{onValueChange:p,value:o,children:[de,pe]},void 0,!0),e[119]=o,e[120]=de,e[121]=pe,e[122]=be):be=e[122];let Ne;e[123]!==oe||e[124]!==be?(Ne=(0,t.jsxDEV)("div",{className:"flex items-center gap-2",children:[oe,be]},void 0,!0),e[123]=oe,e[124]=be,e[125]=Ne):Ne=e[125];let ye;e[126]!==ae||e[127]!==Ne?(ye=(0,t.jsxDEV)("div",{className:"flex items-center justify-between",children:[ae,Ne]},void 0,!0),e[126]=ae,e[127]=Ne,e[128]=ye):ye=e[128];let Se;e[129]!==r?(Se=r("Statements"),e[129]=r,e[130]=Se):Se=e[130];let we;e[131]!==Se?(we=(0,t.jsxDEV)(Me,{children:Se},void 0,!1),e[131]=Se,e[132]=we):we=e[132];let qe;e[133]!==c.length||e[134]!==r?(qe=r("{count} tracked statements",{count:c.length}),e[133]=c.length,e[134]=r,e[135]=qe):qe=e[135];let Te;e[136]!==qe?(Te=(0,t.jsxDEV)(Ye,{children:qe},void 0,!1),e[136]=qe,e[137]=Te):Te=e[137];let _e;e[138]!==we||e[139]!==Te?(_e=(0,t.jsxDEV)(Re,{children:[we,Te]},void 0,!0),e[138]=we,e[139]=Te,e[140]=_e):_e=e[140];let Ce;e[141]!==g||e[142]!==c||e[143]!==r?(Ce=(0,t.jsxDEV)(le,{children:(0,t.jsxDEV)("div",{className:"space-y-2",children:c.map(n=>{let T=n.normalizedSql,N=g.has(T),re=Pe(n.avgDurationMs);return(0,t.jsxDEV)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxDEV)("button",{"aria-expanded":N,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:d(()=>{W(T)},"onClick"),type:"button",children:[(0,t.jsxDEV)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsxDEV)(_t,{level:re},void 0,!1),(0,t.jsxDEV)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:n.normalizedSql},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:We(n.totalDurationMs)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("total")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:We(n.avgDurationMs)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("avg")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:Oe(n.execCount)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("calls")},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),N&&(0,t.jsxDEV)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("p",{className:"mb-2 text-sm font-medium",children:r("Full statement")},void 0,!1),(0,t.jsxDEV)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:n.normalizedSql},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Exec count")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Oe(n.execCount)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Total time")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:We(n.totalDurationMs)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Rows read")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Oe(n.rowsRead)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Rows written")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Oe(n.rowsWritten)},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},T,!0)})},void 0,!1)},void 0,!1),e[141]=g,e[142]=c,e[143]=r,e[144]=Ce):Ce=e[144];let $e;e[145]!==_e||e[146]!==Ce?($e=(0,t.jsxDEV)(ee,{children:[_e,Ce]},void 0,!0),e[145]=_e,e[146]=Ce,e[147]=$e):$e=e[147];let Ae;return e[148]!==X||e[149]!==ye||e[150]!==$e?(Ae=(0,t.jsxDEV)("div",{className:"space-y-4","data-testid":"qi-root",children:[X,ye,$e]},void 0,!0),e[148]=X,e[149]=ye,e[150]=$e,e[151]=Ae):Ae=e[151],Ae},"QueryInsights");function $t(s){return Pe(s.avgDurationMs)==="critical"}d($t,"_temp");function Rt(s){return Pe(s.avgDurationMs)==="warning"}d(Rt,"_temp2");function Mt(s){return Pe(s.avgDurationMs)==="good"}d(Mt,"_temp3");var It=Ze(Be.getMetrics),kt=d(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),r=Math.floor(e%3600/60),o=e%60;return l>0?`${l.toString()}h ${r.toString()}m`:r>0?`${r.toString()}m ${o.toString()}s`:`${o.toString()}s`},"formatDuration"),Ft=d((s,e)=>s?e:"overview","resolveTab"),Dt=d((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"hitRate"),J=d(s=>{let e=(0,Fe.c)(16),{chart:l,footer:r,label:o,testId:U,value:M}=s,g;e[0]!==o?(g=(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=g):g=e[1];let y;e[2]!==U||e[3]!==M?(y=(0,t.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":U,children:M},void 0,!1),e[2]=U,e[3]=M,e[4]=y):y=e[4];let v;e[5]!==l||e[6]!==y?(v=(0,t.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[y,l]},void 0,!0),e[5]=l,e[6]=y,e[7]=v):v=e[7];let p;e[8]!==g||e[9]!==v?(p=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,v]},void 0,!0),e[8]=g,e[9]=v,e[10]=p):p=e[10];let u;e[11]!==r?(u=r!=null&&(0,t.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:r},void 0,!1),e[11]=r,e[12]=u):u=e[12];let c;return e[13]!==p||e[14]!==u?(c=(0,t.jsxDEV)(ee,{className:"justify-between gap-0 py-0",children:[p,u]},void 0,!0),e[13]=p,e[14]=u,e[15]=c):c=e[15],c},"StatCard"),Zt=d(({initialShardKey:s})=>{let e=Xe(),l=Ee(),[r,o]=(0,_.useState)(s??""),[U,M]=(0,_.useState)("overview"),[g,y]=(0,_.useState)([]),v=(0,_.useRef)(null),p=(0,_.useRef)(null),u=(0,_.useRef)(!0);(0,_.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let c=it(r.trim(),400),{data:C,error:z,liveError:B}=je(Be.getMetrics,{},{live:!0,shardKey:c}),i=C??null;(0,_.useEffect)(()=>{if(C===void 0)return;st(c);let a=C,b=v.current,h=p.current!==null&&p.current!==a.shard;if(p.current=a.shard,v.current=a.requests,h){y([]);return}b!==null&&a.requests>=b&&y(x=>[...x,a.requests-b].slice(-30))},[C,c]);let[q,O]=(0,_.useState)(null),[E,W]=(0,_.useState)(!1),I=d(async()=>{W(!0);let a=ht(r,lt());try{let b=await Promise.all(a.map(async h=>{try{let x=await e.query(It,{},et(h));return{error:null,metrics:x,shard:h===""?x.shard:h}}catch(x){return{error:tt(x),metrics:null,shard:h===""?"__root__":h}}}));u.current&&O(b)}finally{u.current&&W(!1)}},"aggregateAll"),m=q===null?null:vt(q),$=i===null||i.requests===0?"\u2014":`${(i.errors/i.requests*100).toFixed(1)}%`,k=g.length>0?g.at(-1):0,R=i?gt(i):{p90:0,p95:0},V=d(a=>a<=0?"\u2014":a<1?`${(a*1e3).toFixed(0)}\u03BCs`:a<1e3?`${a.toFixed(1)}ms`:`${(a/1e3).toFixed(2)}s`,"formatMs"),S=(0,_.useMemo)(()=>{if(!i||!("queryStats"in i))return;let a=i.queryStats;if(!(!a||!Array.isArray(a)))return xt(a)},[i]),w=Ft(S!==void 0,U),F=d(()=>{rt(I())},"runAggregate"),D=d(()=>{O(null)},"clearAggregate"),A=d(()=>{M("overview")},"switchToOverview"),L=d(()=>{M("query-insights")},"switchToQueryInsights");return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(at,{onChange:o,testId:"mt-shard-input",value:r},void 0,!1),(0,t.jsxDEV)(ot,{message:B,prefix:"mt"},void 0,!1),(0,t.jsxDEV)(Ke,{"data-testid":"mt-aggregate",disabled:E,onClick:F,size:"sm",type:"button",variant:"secondary",children:l(E?"Aggregating\u2026":"All shards")},void 0,!1),q!==null&&(0,t.jsxDEV)(Ke,{"data-testid":"mt-aggregate-clear",onClick:D,size:"sm",type:"button",variant:"ghost",children:l("Hide")},void 0,!1),(0,t.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:nt,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")},void 0,!1)]},void 0,!0),z!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:z},void 0,!1),S!==void 0&&(0,t.jsxDEV)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsxDEV)("button",{className:`pb-2 text-sm font-medium transition-colors ${w==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:A,type:"button",children:l("Overview")},void 0,!1),(0,t.jsxDEV)("button",{className:`pb-2 text-sm font-medium transition-colors ${w==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:L,type:"button",children:[l("Query insights"),S.length>0&&(0,t.jsxDEV)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:S.length},void 0,!1)]},void 0,!0)]},void 0,!0),w==="query-insights"&&S!==void 0&&(0,t.jsxDEV)(Ct,{queryStats:S},void 0,!1),w==="overview"&&i!==null&&(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[(0,t.jsxDEV)(J,{chart:g.length>=2?(0,t.jsxDEV)(pt,{ariaLabel:l("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:g,testId:"mt-sparkline"},void 0,!1):void 0,footer:g.length>=2?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("span",{className:"font-semibold text-foreground",children:`+${k.toLocaleString()}`},void 0,!1)," ",l("last interval")]},void 0,!0):(0,t.jsxDEV)("span",{"data-testid":"mt-sparkline-empty",children:l("collecting samples\u2026")},void 0,!1),label:l("Requests"),testId:"mt-requests",value:i.requests},void 0,!1),(0,t.jsxDEV)(J,{footer:l("{rate} error rate",{rate:$}),label:l("Errors"),testId:"mt-errors",value:(0,t.jsxDEV)(t.Fragment,{children:[i.errors," (",$,")"]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(J,{footer:R.p90>0?`P90 ${V(R.p90)}`:void 0,label:l("P95 latency"),testId:"mt-p95",value:R.p95>0?V(R.p95):"\u2014"},void 0,!1),(0,t.jsxDEV)(J,{footer:i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${l("cache entries")}`,label:l("Database size"),testId:"mt-db-size",value:ze(i.databaseSize)},void 0,!1),(0,t.jsxDEV)(J,{label:l("Shard"),testId:"mt-shard",value:i.shard},void 0,!1),(0,t.jsxDEV)(J,{label:l("Uptime"),testId:"mt-uptime",value:kt(i.uptimeMs)},void 0,!1),(0,t.jsxDEV)(J,{label:l("Cache hit rate"),testId:"mt-cache",value:i.cache===null?l("no cache configured"):l("{rate} ({count} entries)",{count:i.cache.entries,rate:Dt(i.cache.hits,i.cache.misses)})},void 0,!1)]},void 0,!0),w==="overview"&&i===null&&null,w==="overview"&&(0,t.jsxDEV)(Tt,{shardKey:c},void 0,!1),w==="overview"&&m!==null&&q!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[(0,t.jsxDEV)(J,{label:l("Shards"),testId:"mt-agg-shards",value:m.failed>0?l("{reachable} reachable, {failed} unreachable",{failed:m.failed,reachable:m.reachable}):l("{reachable} reachable",{reachable:m.reachable})},void 0,!1),(0,t.jsxDEV)(J,{label:l("Total requests"),testId:"mt-agg-requests",value:m.totalRequests},void 0,!1),(0,t.jsxDEV)(J,{label:l("Total errors"),testId:"mt-agg-errors",value:m.totalErrors},void 0,!1),(0,t.jsxDEV)(J,{label:l("Total database size"),testId:"mt-agg-db-size",value:ze(m.totalDatabaseSize)},void 0,!1),(0,t.jsxDEV)(J,{label:l("Combined cache hit rate"),testId:"mt-agg-cache",value:m.hitRate===null?l("no cache configured"):`${(m.hitRate*100).toFixed(1)}%`},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(ee,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(le,{className:"px-0",children:(0,t.jsxDEV)(Ue,{"data-testid":"mt-agg-table",children:[(0,t.jsxDEV)(Ve,{children:(0,t.jsxDEV)(Ie,{children:[(0,t.jsxDEV)(Z,{children:l("shard")},void 0,!1),(0,t.jsxDEV)(Z,{children:l("requests")},void 0,!1),(0,t.jsxDEV)(Z,{children:l("errors")},void 0,!1),(0,t.jsxDEV)(Z,{children:l("db size")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Ge,{children:q.map(a=>(0,t.jsxDEV)(Ie,{"data-testid":`mt-agg-row-${a.shard}`,children:[(0,t.jsxDEV)(G,{children:a.shard},void 0,!1),a.metrics===null?(0,t.jsxDEV)(G,{className:"text-destructive",colSpan:3,children:a.error??l("unreachable")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(G,{className:"tabular-nums",children:a.metrics.requests},void 0,!1),(0,t.jsxDEV)(G,{className:"tabular-nums",children:a.metrics.errors},void 0,!1),(0,t.jsxDEV)(G,{className:"tabular-nums",children:ze(a.metrics.databaseSize)},void 0,!1)]},void 0,!0)]},a.shard,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"MetricsPanel");export{Zt as MetricsPanel};
|
|
1
|
+
import{a as vt,b as ht,c as gt,d as xt,e as pt}from"./chunk-7YGTGBP7.js";import{a as dt,b as ct,c as ft,d as ut,e as ke}from"./chunk-JZLGLG4T.js";import"./chunk-3HGNPZBN.js";import{a as mt}from"./chunk-N7SVJOHN.js";import"./chunk-APSSZB6Z.js";import"./chunk-QAFAJBAW.js";import{e as nt}from"./chunk-IYHPYY4A.js";import{a as ot}from"./chunk-WMDH2CIZ.js";import"./chunk-SHERR7ZP.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-SWMBBYJU.js";import"./chunk-BJGBHGK3.js";import"./chunk-ZIGWVHCS.js";import{a as it}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import{b as je}from"./chunk-2YUYNNHQ.js";import{a as Ue,b as Ve,c as Ge,d as Ie,e as Z,f as G}from"./chunk-GTM65MVX.js";import{a as ee,b as Re,c as Me,d as Ye,e as le}from"./chunk-Y572GMZE.js";import"./chunk-4QHKBC77.js";import{a as at}from"./chunk-F2YMCQ6B.js";import{a as lt,b as st}from"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as Ke}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as He}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as Be}from"./chunk-MHGJUKCZ.js";import{f as Xe}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as Ee,f as Ze,g as et,h as tt,m as rt,p as ze}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as d,e as Qe,f as bt,g as Nt,h as yt}from"./chunk-RRCPZMC2.js";var Fe=Qe(Nt(),1);var _=Qe(bt(),1);var t=Qe(yt(),1);var St=d(s=>s.kind==="gauge"?s.last:s.kind==="histogram"?s.sum/Math.max(1,s.count):s.sum,"metricHeadline"),Je=d(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"formatMetricValue"),wt=d(s=>Array.isArray(s?.series)?s.series:[],"seriesOf"),qt={counter:"secondary",gauge:"default",histogram:"outline"},Tt=d(s=>{let e=(0,Fe.c)(79),{shardKey:l}=s,r=Ee(),o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let U;e[1]!==l?(U={live:!0,shardKey:l},e[1]=l,e[2]=U):U=e[2];let{data:M,error:g}=je(Be.getMetricSeries,o,U),y,v,p,u,c,C,z,B,i,q,O,E,W;if(e[3]!==M||e[4]!==g||e[5]!==r){C=Symbol.for("react.early_return_sentinel");e:{let V=wt(M);if(g!==null||V.length===0){C=null;break e}let S;e[19]!==r?(S=d(f=>r(f==="counter"?"Counter":f==="gauge"?"Gauge":"Histogram"),"t122"),e[19]=r,e[20]=S):S=e[20];let w=S;E="flex flex-col gap-2",W="mt-instruments";let F;e[21]!==r?(F=r("Instruments"),e[21]=r,e[22]=F):F=e[22],e[23]!==F?(c=(0,t.jsxDEV)("h3",{className:"text-sm font-semibold text-foreground",children:F},void 0,!1),e[23]=F,e[24]=c):c=e[24],u=ee,O="overflow-hidden py-0",p=le,q="px-0",v=Ue,B="mt-instruments-table";let D;e[25]!==r?(D=r("name"),e[25]=r,e[26]=D):D=e[26];let A;e[27]!==D?(A=(0,t.jsxDEV)(Z,{children:D},void 0,!1),e[27]=D,e[28]=A):A=e[28];let L;e[29]!==r?(L=r("kind"),e[29]=r,e[30]=L):L=e[30];let a;e[31]!==L?(a=(0,t.jsxDEV)(Z,{children:L},void 0,!1),e[31]=L,e[32]=a):a=e[32];let b;e[33]!==r?(b=r("value"),e[33]=r,e[34]=b):b=e[34];let h;e[35]!==b?(h=(0,t.jsxDEV)(Z,{className:"text-right",children:b},void 0,!1),e[35]=b,e[36]=h):h=e[36];let x;e[37]!==r?(x=r("count"),e[37]=r,e[38]=x):x=e[38];let P;e[39]!==x?(P=(0,t.jsxDEV)(Z,{className:"text-right",children:x},void 0,!1),e[39]=x,e[40]=P):P=e[40];let Q;e[41]!==r?(Q=r("range"),e[41]=r,e[42]=Q):Q=e[42];let H;e[43]!==Q?(H=(0,t.jsxDEV)(Z,{className:"text-right",children:Q},void 0,!1),e[43]=Q,e[44]=H):H=e[44];let K;e[45]!==r?(K=r("dimensions"),e[45]=r,e[46]=K):K=e[46];let j;e[47]!==K?(j=(0,t.jsxDEV)(Z,{children:K},void 0,!1),e[47]=K,e[48]=j):j=e[48],e[49]!==A||e[50]!==a||e[51]!==h||e[52]!==P||e[53]!==H||e[54]!==j?(i=(0,t.jsxDEV)(Ve,{children:(0,t.jsxDEV)(Ie,{children:[A,a,h,P,H,j]},void 0,!0)},void 0,!1),e[49]=A,e[50]=a,e[51]=h,e[52]=P,e[53]=H,e[54]=j,e[55]=i):i=e[55],y=Ge;let X;e[56]!==w?(X=d(f=>{let Y=mt(f.attributes),te=`${f.kind}:${f.name}:${Y}`;return(0,t.jsxDEV)(Ie,{"data-testid":`mt-instrument-${f.name}`,children:[(0,t.jsxDEV)(G,{className:"font-mono text-xs",title:f.functionPath,children:f.name},void 0,!1),(0,t.jsxDEV)(G,{children:(0,t.jsxDEV)(He,{variant:qt[f.kind],children:w(f.kind)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(G,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${f.name}`,children:Je(St(f))},void 0,!1),(0,t.jsxDEV)(G,{className:"text-right tabular-nums text-muted-foreground",children:f.count.toLocaleString()},void 0,!1),(0,t.jsxDEV)(G,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:f.min===f.max?"\u2014":`${Je(f.min)}\u2013${Je(f.max)}`},void 0,!1),(0,t.jsxDEV)(G,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:Y,children:Y===""?"\u2014":Y},void 0,!1)]},te,!0)},"t26"),e[56]=w,e[57]=X):X=e[57],z=V.map(X)}e[3]=M,e[4]=g,e[5]=r,e[6]=y,e[7]=v,e[8]=p,e[9]=u,e[10]=c,e[11]=C,e[12]=z,e[13]=B,e[14]=i,e[15]=q,e[16]=O,e[17]=E,e[18]=W}else y=e[6],v=e[7],p=e[8],u=e[9],c=e[10],C=e[11],z=e[12],B=e[13],i=e[14],q=e[15],O=e[16],E=e[17],W=e[18];if(C!==Symbol.for("react.early_return_sentinel"))return C;let I;e[58]!==y||e[59]!==z?(I=(0,t.jsxDEV)(y,{children:z},void 0,!1),e[58]=y,e[59]=z,e[60]=I):I=e[60];let m;e[61]!==v||e[62]!==I||e[63]!==B||e[64]!==i?(m=(0,t.jsxDEV)(v,{"data-testid":B,children:[i,I]},void 0,!0),e[61]=v,e[62]=I,e[63]=B,e[64]=i,e[65]=m):m=e[65];let $;e[66]!==p||e[67]!==m||e[68]!==q?($=(0,t.jsxDEV)(p,{className:q,children:m},void 0,!1),e[66]=p,e[67]=m,e[68]=q,e[69]=$):$=e[69];let k;e[70]!==u||e[71]!==$||e[72]!==O?(k=(0,t.jsxDEV)(u,{className:O,children:$},void 0,!1),e[70]=u,e[71]=$,e[72]=O,e[73]=k):k=e[73];let R;return e[74]!==c||e[75]!==k||e[76]!==E||e[77]!==W?(R=(0,t.jsxDEV)("section",{className:E,"data-testid":W,children:[c,k]},void 0,!0),e[74]=c,e[75]=k,e[76]=E,e[77]=W,e[78]=R):R=e[78],R},"InstrumentsTable"),Pe=d(s=>s>=100?"critical":s>=50?"warning":"good","performanceLevel"),We=d(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"formatLatency"),Oe=d(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"formatCount"),_t=d(s=>{let e=(0,Fe.c)(3),{level:l}=s;if(l==="critical"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxDEV)(He,{variant:"destructive",children:"Slow"},void 0,!1),e[0]=o):o=e[0],o}if(l==="warning"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxDEV)("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"},void 0,!1),e[1]=o):o=e[1],o}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxDEV)("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"},void 0,!1),e[2]=r):r=e[2],r},"PerformanceBadge"),Ct=d(s=>{let e=(0,Fe.c)(152),{queryStats:l}=s,r=Ee(),[o,U]=(0,_.useState)("totalTime"),M;e[0]===Symbol.for("react.memo_cache_sentinel")?(M=new Set,e[0]=M):M=e[0];let[g,y]=(0,_.useState)(M),v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=d(n=>{n!==null&&U(n)},"t2"),e[1]=v):v=e[1];let p=v,u;if(e[2]!==l||e[3]!==o){u=[...l];let n;e[5]!==o?(n=d((T,N)=>{switch(o){case"avgTime":return N.avgDurationMs-T.avgDurationMs;case"execCount":return N.execCount-T.execCount;case"rowsRead":return N.rowsRead-T.rowsRead;default:return N.totalDurationMs-T.totalDurationMs}},"t310"),e[5]=o,e[6]=n):n=e[6],u.sort(n),e[2]=l,e[3]=o,e[4]=u}else u=e[4];let c=u,C;e[7]!==l?(C=l.filter($t),e[7]=l,e[8]=C):C=e[8];let z=C.length,B;e[9]!==l?(B=l.filter(Rt),e[9]=l,e[10]=B):B=e[10];let i=B.length,q;e[11]!==l?(q=l.filter(Mt),e[11]=l,e[12]=q):q=e[12];let O=q.length,E;e[13]===Symbol.for("react.memo_cache_sentinel")?(E=d(n=>{y(T=>{let N=new Set(T);return N.has(n)?N.delete(n):N.add(n),N})},"t6"),e[13]=E):E=e[13];let W=E;if(l.length===0){let n;e[14]!==r?(n=r("No query insights yet"),e[14]=r,e[15]=n):n=e[15];let T;e[16]!==n?(T=(0,t.jsxDEV)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:n},void 0,!1),e[16]=n,e[17]=T):T=e[17];let N;e[18]!==r?(N=r("Query insights appear once statements are executed against this shard."),e[18]=r,e[19]=N):N=e[19];let re;e[20]!==N?(re=(0,t.jsxDEV)("p",{className:"mt-1 text-sm",children:N},void 0,!1),e[20]=N,e[21]=re):re=e[21];let Le;return e[22]!==re||e[23]!==T?(Le=(0,t.jsxDEV)(ee,{children:(0,t.jsxDEV)(le,{className:"py-12",children:(0,t.jsxDEV)("div",{className:"text-center text-muted-foreground",children:[T,re]},void 0,!0)},void 0,!1)},void 0,!1),e[22]=re,e[23]=T,e[24]=Le):Le=e[24],Le}let I;e[25]!==r?(I=r("Critical queries"),e[25]=r,e[26]=I):I=e[26];let m;e[27]!==I?(m=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(Me,{className:"text-sm font-medium",children:I},void 0,!1)},void 0,!1),e[27]=I,e[28]=m):m=e[28];let $;e[29]!==z?($=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:z},void 0,!1),e[29]=z,e[30]=$):$=e[30];let k;e[31]!==r?(k=r(">100ms avg execution"),e[31]=r,e[32]=k):k=e[32];let R;e[33]!==k?(R=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:k},void 0,!1),e[33]=k,e[34]=R):R=e[34];let V;e[35]!==R||e[36]!==$?(V=(0,t.jsxDEV)(le,{children:[$,R]},void 0,!0),e[35]=R,e[36]=$,e[37]=V):V=e[37];let S;e[38]!==V||e[39]!==m?(S=(0,t.jsxDEV)(ee,{children:[m,V]},void 0,!0),e[38]=V,e[39]=m,e[40]=S):S=e[40];let w;e[41]!==r?(w=r("Moderate queries"),e[41]=r,e[42]=w):w=e[42];let F;e[43]!==w?(F=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(Me,{className:"text-sm font-medium",children:w},void 0,!1)},void 0,!1),e[43]=w,e[44]=F):F=e[44];let D;e[45]!==i?(D=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:i},void 0,!1),e[45]=i,e[46]=D):D=e[46];let A;e[47]!==r?(A=r("50\u2013100ms avg execution"),e[47]=r,e[48]=A):A=e[48];let L;e[49]!==A?(L=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:A},void 0,!1),e[49]=A,e[50]=L):L=e[50];let a;e[51]!==D||e[52]!==L?(a=(0,t.jsxDEV)(le,{children:[D,L]},void 0,!0),e[51]=D,e[52]=L,e[53]=a):a=e[53];let b;e[54]!==F||e[55]!==a?(b=(0,t.jsxDEV)(ee,{children:[F,a]},void 0,!0),e[54]=F,e[55]=a,e[56]=b):b=e[56];let h;e[57]!==r?(h=r("Fast queries"),e[57]=r,e[58]=h):h=e[58];let x;e[59]!==h?(x=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(Me,{className:"text-sm font-medium",children:h},void 0,!1)},void 0,!1),e[59]=h,e[60]=x):x=e[60];let P;e[61]!==O?(P=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:O},void 0,!1),e[61]=O,e[62]=P):P=e[62];let Q;e[63]!==r?(Q=r("<50ms avg execution"),e[63]=r,e[64]=Q):Q=e[64];let H;e[65]!==Q?(H=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:Q},void 0,!1),e[65]=Q,e[66]=H):H=e[66];let K;e[67]!==P||e[68]!==H?(K=(0,t.jsxDEV)(le,{children:[P,H]},void 0,!0),e[67]=P,e[68]=H,e[69]=K):K=e[69];let j;e[70]!==x||e[71]!==K?(j=(0,t.jsxDEV)(ee,{children:[x,K]},void 0,!0),e[70]=x,e[71]=K,e[72]=j):j=e[72];let X;e[73]!==S||e[74]!==b||e[75]!==j?(X=(0,t.jsxDEV)("div",{className:"grid gap-4 md:grid-cols-3",children:[S,b,j]},void 0,!0),e[73]=S,e[74]=b,e[75]=j,e[76]=X):X=e[76];let f;e[77]!==r?(f=r("Query leaderboard"),e[77]=r,e[78]=f):f=e[78];let Y;e[79]!==f?(Y=(0,t.jsxDEV)("h3",{className:"text-lg font-semibold",children:f},void 0,!1),e[79]=f,e[80]=Y):Y=e[80];let te;e[81]!==o||e[82]!==r?(te=r("Slow queries sorted by {sortField}",{sortField:r(o)}),e[81]=o,e[82]=r,e[83]=te):te=e[83];let se;e[84]!==te?(se=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:te},void 0,!1),e[84]=te,e[85]=se):se=e[85];let ae;e[86]!==Y||e[87]!==se?(ae=(0,t.jsxDEV)("div",{children:[Y,se]},void 0,!0),e[86]=Y,e[87]=se,e[88]=ae):ae=e[88];let ie;e[89]!==r?(ie=r("Sort by"),e[89]=r,e[90]=ie):ie=e[90];let oe;e[91]!==ie?(oe=(0,t.jsxDEV)("span",{className:"text-sm text-muted-foreground",children:ie},void 0,!1),e[91]=ie,e[92]=oe):oe=e[92];let ne;e[93]!==r?(ne=r("Sort queries by"),e[93]=r,e[94]=ne):ne=e[94];let De;e[95]===Symbol.for("react.memo_cache_sentinel")?(De=(0,t.jsxDEV)(ct,{},void 0,!1),e[95]=De):De=e[95];let de;e[96]!==ne?(de=(0,t.jsxDEV)(ft,{"aria-label":ne,className:"w-[140px]","data-testid":"qi-sort",children:De},void 0,!1),e[96]=ne,e[97]=de):de=e[97];let ce;e[98]!==r?(ce=r("Total time"),e[98]=r,e[99]=ce):ce=e[99];let fe;e[100]!==ce?(fe=(0,t.jsxDEV)(ke,{value:"totalTime",children:ce},void 0,!1),e[100]=ce,e[101]=fe):fe=e[101];let ue;e[102]!==r?(ue=r("Avg time"),e[102]=r,e[103]=ue):ue=e[103];let me;e[104]!==ue?(me=(0,t.jsxDEV)(ke,{value:"avgTime",children:ue},void 0,!1),e[104]=ue,e[105]=me):me=e[105];let ve;e[106]!==r?(ve=r("Execution count"),e[106]=r,e[107]=ve):ve=e[107];let he;e[108]!==ve?(he=(0,t.jsxDEV)(ke,{value:"execCount",children:ve},void 0,!1),e[108]=ve,e[109]=he):he=e[109];let ge;e[110]!==r?(ge=r("Rows read"),e[110]=r,e[111]=ge):ge=e[111];let xe;e[112]!==ge?(xe=(0,t.jsxDEV)(ke,{value:"rowsRead",children:ge},void 0,!1),e[112]=ge,e[113]=xe):xe=e[113];let pe;e[114]!==fe||e[115]!==me||e[116]!==he||e[117]!==xe?(pe=(0,t.jsxDEV)(ut,{children:[fe,me,he,xe]},void 0,!0),e[114]=fe,e[115]=me,e[116]=he,e[117]=xe,e[118]=pe):pe=e[118];let be;e[119]!==o||e[120]!==de||e[121]!==pe?(be=(0,t.jsxDEV)(dt,{onValueChange:p,value:o,children:[de,pe]},void 0,!0),e[119]=o,e[120]=de,e[121]=pe,e[122]=be):be=e[122];let Ne;e[123]!==oe||e[124]!==be?(Ne=(0,t.jsxDEV)("div",{className:"flex items-center gap-2",children:[oe,be]},void 0,!0),e[123]=oe,e[124]=be,e[125]=Ne):Ne=e[125];let ye;e[126]!==ae||e[127]!==Ne?(ye=(0,t.jsxDEV)("div",{className:"flex items-center justify-between",children:[ae,Ne]},void 0,!0),e[126]=ae,e[127]=Ne,e[128]=ye):ye=e[128];let Se;e[129]!==r?(Se=r("Statements"),e[129]=r,e[130]=Se):Se=e[130];let we;e[131]!==Se?(we=(0,t.jsxDEV)(Me,{children:Se},void 0,!1),e[131]=Se,e[132]=we):we=e[132];let qe;e[133]!==c.length||e[134]!==r?(qe=r("{count} tracked statements",{count:c.length}),e[133]=c.length,e[134]=r,e[135]=qe):qe=e[135];let Te;e[136]!==qe?(Te=(0,t.jsxDEV)(Ye,{children:qe},void 0,!1),e[136]=qe,e[137]=Te):Te=e[137];let _e;e[138]!==we||e[139]!==Te?(_e=(0,t.jsxDEV)(Re,{children:[we,Te]},void 0,!0),e[138]=we,e[139]=Te,e[140]=_e):_e=e[140];let Ce;e[141]!==g||e[142]!==c||e[143]!==r?(Ce=(0,t.jsxDEV)(le,{children:(0,t.jsxDEV)("div",{className:"space-y-2",children:c.map(n=>{let T=n.normalizedSql,N=g.has(T),re=Pe(n.avgDurationMs);return(0,t.jsxDEV)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxDEV)("button",{"aria-expanded":N,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:d(()=>{W(T)},"onClick"),type:"button",children:[(0,t.jsxDEV)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsxDEV)(_t,{level:re},void 0,!1),(0,t.jsxDEV)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:n.normalizedSql},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:We(n.totalDurationMs)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("total")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:We(n.avgDurationMs)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("avg")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:Oe(n.execCount)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("calls")},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),N&&(0,t.jsxDEV)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("p",{className:"mb-2 text-sm font-medium",children:r("Full statement")},void 0,!1),(0,t.jsxDEV)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:n.normalizedSql},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Exec count")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Oe(n.execCount)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Total time")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:We(n.totalDurationMs)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Rows read")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Oe(n.rowsRead)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Rows written")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Oe(n.rowsWritten)},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},T,!0)})},void 0,!1)},void 0,!1),e[141]=g,e[142]=c,e[143]=r,e[144]=Ce):Ce=e[144];let $e;e[145]!==_e||e[146]!==Ce?($e=(0,t.jsxDEV)(ee,{children:[_e,Ce]},void 0,!0),e[145]=_e,e[146]=Ce,e[147]=$e):$e=e[147];let Ae;return e[148]!==X||e[149]!==ye||e[150]!==$e?(Ae=(0,t.jsxDEV)("div",{className:"space-y-4","data-testid":"qi-root",children:[X,ye,$e]},void 0,!0),e[148]=X,e[149]=ye,e[150]=$e,e[151]=Ae):Ae=e[151],Ae},"QueryInsights");function $t(s){return Pe(s.avgDurationMs)==="critical"}d($t,"_temp");function Rt(s){return Pe(s.avgDurationMs)==="warning"}d(Rt,"_temp2");function Mt(s){return Pe(s.avgDurationMs)==="good"}d(Mt,"_temp3");var It=Ze(Be.getMetrics),kt=d(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),r=Math.floor(e%3600/60),o=e%60;return l>0?`${l.toString()}h ${r.toString()}m`:r>0?`${r.toString()}m ${o.toString()}s`:`${o.toString()}s`},"formatDuration"),Ft=d((s,e)=>s?e:"overview","resolveTab"),Dt=d((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"hitRate"),J=d(s=>{let e=(0,Fe.c)(16),{chart:l,footer:r,label:o,testId:U,value:M}=s,g;e[0]!==o?(g=(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=g):g=e[1];let y;e[2]!==U||e[3]!==M?(y=(0,t.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":U,children:M},void 0,!1),e[2]=U,e[3]=M,e[4]=y):y=e[4];let v;e[5]!==l||e[6]!==y?(v=(0,t.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[y,l]},void 0,!0),e[5]=l,e[6]=y,e[7]=v):v=e[7];let p;e[8]!==g||e[9]!==v?(p=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,v]},void 0,!0),e[8]=g,e[9]=v,e[10]=p):p=e[10];let u;e[11]!==r?(u=r!=null&&(0,t.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:r},void 0,!1),e[11]=r,e[12]=u):u=e[12];let c;return e[13]!==p||e[14]!==u?(c=(0,t.jsxDEV)(ee,{className:"justify-between gap-0 py-0",children:[p,u]},void 0,!0),e[13]=p,e[14]=u,e[15]=c):c=e[15],c},"StatCard"),Zt=d(({initialShardKey:s})=>{let e=Xe(),l=Ee(),[r,o]=(0,_.useState)(s??""),[U,M]=(0,_.useState)("overview"),[g,y]=(0,_.useState)([]),v=(0,_.useRef)(null),p=(0,_.useRef)(null),u=(0,_.useRef)(!0);(0,_.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let c=it(r.trim(),400),{data:C,error:z,liveError:B}=je(Be.getMetrics,{},{live:!0,shardKey:c}),i=C??null;(0,_.useEffect)(()=>{if(C===void 0)return;st(c);let a=C,b=v.current,h=p.current!==null&&p.current!==a.shard;if(p.current=a.shard,v.current=a.requests,h){y([]);return}b!==null&&a.requests>=b&&y(x=>[...x,a.requests-b].slice(-30))},[C,c]);let[q,O]=(0,_.useState)(null),[E,W]=(0,_.useState)(!1),I=d(async()=>{W(!0);let a=ht(r,lt());try{let b=await Promise.all(a.map(async h=>{try{let x=await e.query(It,{},et(h));return{error:null,metrics:x,shard:h===""?x.shard:h}}catch(x){return{error:tt(x),metrics:null,shard:h===""?"__root__":h}}}));u.current&&O(b)}finally{u.current&&W(!1)}},"aggregateAll"),m=q===null?null:vt(q),$=i===null||i.requests===0?"\u2014":`${(i.errors/i.requests*100).toFixed(1)}%`,k=g.length>0?g.at(-1):0,R=i?gt(i):{p90:0,p95:0},V=d(a=>a<=0?"\u2014":a<1?`${(a*1e3).toFixed(0)}\u03BCs`:a<1e3?`${a.toFixed(1)}ms`:`${(a/1e3).toFixed(2)}s`,"formatMs"),S=(0,_.useMemo)(()=>{if(!i||!("queryStats"in i))return;let a=i.queryStats;if(!(!a||!Array.isArray(a)))return xt(a)},[i]),w=Ft(S!==void 0,U),F=d(()=>{rt(I())},"runAggregate"),D=d(()=>{O(null)},"clearAggregate"),A=d(()=>{M("overview")},"switchToOverview"),L=d(()=>{M("query-insights")},"switchToQueryInsights");return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(at,{onChange:o,testId:"mt-shard-input",value:r},void 0,!1),(0,t.jsxDEV)(ot,{message:B,prefix:"mt"},void 0,!1),(0,t.jsxDEV)(Ke,{"data-testid":"mt-aggregate",disabled:E,onClick:F,size:"sm",type:"button",variant:"secondary",children:l(E?"Aggregating\u2026":"All shards")},void 0,!1),q!==null&&(0,t.jsxDEV)(Ke,{"data-testid":"mt-aggregate-clear",onClick:D,size:"sm",type:"button",variant:"ghost",children:l("Hide")},void 0,!1),(0,t.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:nt,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")},void 0,!1)]},void 0,!0),z!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:z},void 0,!1),S!==void 0&&(0,t.jsxDEV)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsxDEV)("button",{className:`pb-2 text-sm font-medium transition-colors ${w==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:A,type:"button",children:l("Overview")},void 0,!1),(0,t.jsxDEV)("button",{className:`pb-2 text-sm font-medium transition-colors ${w==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:L,type:"button",children:[l("Query insights"),S.length>0&&(0,t.jsxDEV)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:S.length},void 0,!1)]},void 0,!0)]},void 0,!0),w==="query-insights"&&S!==void 0&&(0,t.jsxDEV)(Ct,{queryStats:S},void 0,!1),w==="overview"&&i!==null&&(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[(0,t.jsxDEV)(J,{chart:g.length>=2?(0,t.jsxDEV)(pt,{ariaLabel:l("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:g,testId:"mt-sparkline"},void 0,!1):void 0,footer:g.length>=2?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("span",{className:"font-semibold text-foreground",children:`+${k.toLocaleString()}`},void 0,!1)," ",l("last interval")]},void 0,!0):(0,t.jsxDEV)("span",{"data-testid":"mt-sparkline-empty",children:l("collecting samples\u2026")},void 0,!1),label:l("Requests"),testId:"mt-requests",value:i.requests},void 0,!1),(0,t.jsxDEV)(J,{footer:l("{rate} error rate",{rate:$}),label:l("Errors"),testId:"mt-errors",value:(0,t.jsxDEV)(t.Fragment,{children:[i.errors," (",$,")"]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(J,{footer:R.p90>0?`P90 ${V(R.p90)}`:void 0,label:l("P95 latency"),testId:"mt-p95",value:R.p95>0?V(R.p95):"\u2014"},void 0,!1),(0,t.jsxDEV)(J,{footer:i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${l("cache entries")}`,label:l("Database size"),testId:"mt-db-size",value:ze(i.databaseSize)},void 0,!1),(0,t.jsxDEV)(J,{label:l("Shard"),testId:"mt-shard",value:i.shard},void 0,!1),(0,t.jsxDEV)(J,{label:l("Uptime"),testId:"mt-uptime",value:kt(i.uptimeMs)},void 0,!1),(0,t.jsxDEV)(J,{label:l("Cache hit rate"),testId:"mt-cache",value:i.cache===null?l("no cache configured"):l("{rate} ({count} entries)",{count:i.cache.entries,rate:Dt(i.cache.hits,i.cache.misses)})},void 0,!1)]},void 0,!0),w==="overview"&&i===null&&null,w==="overview"&&(0,t.jsxDEV)(Tt,{shardKey:c},void 0,!1),w==="overview"&&m!==null&&q!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[(0,t.jsxDEV)(J,{label:l("Shards"),testId:"mt-agg-shards",value:m.failed>0?l("{reachable} reachable, {failed} unreachable",{failed:m.failed,reachable:m.reachable}):l("{reachable} reachable",{reachable:m.reachable})},void 0,!1),(0,t.jsxDEV)(J,{label:l("Total requests"),testId:"mt-agg-requests",value:m.totalRequests},void 0,!1),(0,t.jsxDEV)(J,{label:l("Total errors"),testId:"mt-agg-errors",value:m.totalErrors},void 0,!1),(0,t.jsxDEV)(J,{label:l("Total database size"),testId:"mt-agg-db-size",value:ze(m.totalDatabaseSize)},void 0,!1),(0,t.jsxDEV)(J,{label:l("Combined cache hit rate"),testId:"mt-agg-cache",value:m.hitRate===null?l("no cache configured"):`${(m.hitRate*100).toFixed(1)}%`},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(ee,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(le,{className:"px-0",children:(0,t.jsxDEV)(Ue,{"data-testid":"mt-agg-table",children:[(0,t.jsxDEV)(Ve,{children:(0,t.jsxDEV)(Ie,{children:[(0,t.jsxDEV)(Z,{children:l("shard")},void 0,!1),(0,t.jsxDEV)(Z,{children:l("requests")},void 0,!1),(0,t.jsxDEV)(Z,{children:l("errors")},void 0,!1),(0,t.jsxDEV)(Z,{children:l("db size")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Ge,{children:q.map(a=>(0,t.jsxDEV)(Ie,{"data-testid":`mt-agg-row-${a.shard}`,children:[(0,t.jsxDEV)(G,{children:a.shard},void 0,!1),a.metrics===null?(0,t.jsxDEV)(G,{className:"text-destructive",colSpan:3,children:a.error??l("unreachable")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(G,{className:"tabular-nums",children:a.metrics.requests},void 0,!1),(0,t.jsxDEV)(G,{className:"tabular-nums",children:a.metrics.errors},void 0,!1),(0,t.jsxDEV)(G,{className:"tabular-nums",children:ze(a.metrics.databaseSize)},void 0,!1)]},void 0,!0)]},a.shard,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"MetricsPanel");export{Zt as MetricsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as le}from"./chunk-
|
|
1
|
+
import{a as le}from"./chunk-WMDH2CIZ.js";import{a as Y}from"./chunk-2K47A3P6.js";import{a as Z}from"./chunk-2ICZ6HXQ.js";import"./chunk-XNJNSCLM.js";import{b as G}from"./chunk-2YUYNNHQ.js";import{a as ee,b as te,c as re,d as j,e as o,f as i}from"./chunk-GTM65MVX.js";import{a as z,e as Q}from"./chunk-Y572GMZE.js";import{a as X}from"./chunk-F2YMCQ6B.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as O}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-MHGJUKCZ.js";import"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as U}from"./chunk-TAD43CG5.js";import{d as H,q as W}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a,e as L,f as fe,g as me,h as ue,j as P}from"./chunk-RRCPZMC2.js";var ae=L(me(),1),q=L(fe(),1);var t=L(ue(),1);var he={action:"outline",mutation:"default",query:"secondary"},se=a(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"formatMs"),ve=a(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"errorCell"),pe=a(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"conflictCell"),xe={calls:a((r,e)=>e.calls-r.calls,"calls"),recent:a((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:a((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ie=a(r=>{let e=(0,ae.c)(47),{functions:I,initialShardKey:oe}=r,s=H(),[n,ie]=(0,q.useState)(oe??""),[d,ne]=(0,q.useState)("recent"),C;e[0]!==n?(C=n.trim(),e[0]=n,e[1]=C):C=e[1];let F=Y(C,400),M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M={},e[2]=M):M=e[2];let T;e[3]!==F?(T={live:!0,shardKey:F},e[3]=F,e[4]=T):T=e[4];let{data:de,error:c,errorSource:N,liveError:b}=G(J.getFunctionStats,M,T),S=de?.functions??null,w;e[5]!==I?(w=new Map((I??[]).map(ge)),e[5]=I,e[6]=w):w=e[6];let K=w,E;e[7]===Symbol.for("react.memo_cache_sentinel")?(E=a(k=>{ne(k.currentTarget.dataset.sort)},"t5"),e[7]=E):E=e[7];let ce=E,$;if(e[8]!==c||e[9]!==N||e[10]!==K||e[11]!==b||e[12]!==n||e[13]!==d||e[14]!==S||e[15]!==s){let k=S===null?[]:S.toSorted(xe[d]),f;e[17]!==s?(f=s("Recent"),e[17]=s,e[18]=f):f=e[18];let m;e[19]!==f?(m={key:"recent",label:f},e[19]=f,e[20]=m):m=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let h;e[23]!==u?(h={key:"calls",label:u},e[23]=u,e[24]=h):h=e[24];let v;e[25]!==s?(v=s("Slowest"),e[25]=s,e[26]=v):v=e[26];let p;e[27]!==v?(p={key:"slowest",label:v},e[27]=v,e[28]=p):p=e[28];let A;e[29]!==h||e[30]!==p||e[31]!==m?(A=[m,h,p],e[29]=h,e[30]=p,e[31]=m,e[32]=A):A=e[32];let _=A,x;e[33]!==n?(x=(0,t.jsxDEV)(X,{onChange:ie,testId:"fs-shard-input",value:n},void 0,!1),e[33]=n,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsxDEV)(le,{message:b,prefix:"fs"},void 0,!1),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==_||e[38]!==d?(y=(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:_.map(l=>(0,t.jsxDEV)(V,{"data-sort":l.key,"data-testid":`fs-sort-${l.key}`,onClick:ce,size:"sm",type:"button",variant:d===l.key?"secondary":"ghost",children:l.label},l.key,!1))},void 0,!1),e[37]=_,e[38]=d,e[39]=y):y=e[39];let B;e[40]!==x||e[41]!==g||e[42]!==y?(B=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]},void 0,!0),e[40]=x,e[41]=g,e[42]=y,e[43]=B):B=e[43];let D;e[44]!==c||e[45]!==N?(D=c!==null&&(0,t.jsxDEV)(Z,{error:N,testId:"fs-error"},void 0,!1),e[44]=c,e[45]=N,e[46]=D):D=e[46],$=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[B,D,S!==null&&k.length===0&&c===null&&(0,t.jsxDEV)(U,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsxDEV)("path",{d:"M3 3v18h18"},void 0,!1),(0,t.jsxDEV)("path",{d:"M7 14l4-4 3 3 5-6"},void 0,!1)]},void 0,!0),testId:"fs-empty",title:s("No functions have run on this shard yet.")},void 0,!1),k.length>0&&(0,t.jsxDEV)(z,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Q,{className:"px-0",children:(0,t.jsxDEV)(ee,{"data-testid":"fs-table",children:[(0,t.jsxDEV)(te,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(o,{children:s("function")},void 0,!1),(0,t.jsxDEV)(o,{children:s("kind")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("calls")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("errors")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("conflicts")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("avg")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("max")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last run")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(re,{children:k.map(l=>{let R=K.get(l.path);return(0,t.jsxDEV)(j,{"data-testid":`fs-row-${l.path}`,children:[(0,t.jsxDEV)(i,{className:"font-medium",children:l.path},void 0,!1),(0,t.jsxDEV)(i,{children:R===void 0?(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,t.jsxDEV)(O,{variant:he[R],children:R},void 0,!1)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",l.errors>0&&"text-destructive"),children:ve(l)},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",(l.conflicts??0)>0&&"text-warning"),children:pe(l)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.totalDurationMs/l.calls)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.maxDurationMs)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-muted-foreground",children:W(l.lastCalledAt,"\u2014")},void 0,!1),(0,t.jsxDEV)(i,{className:"max-w-[24ch] truncate text-destructive",title:l.lastErrorMessage??void 0,children:l.lastErrorMessage??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},l.path,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[8]=c,e[9]=N,e[10]=K,e[11]=b,e[12]=n,e[13]=d,e[14]=S,e[15]=s,e[16]=$}else $=e[16];return $},"FunctionStatsPanel");function ge(r){return[r.path,r.kind]}a(ge,"_temp");export{Ie as FunctionStatsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as He}from"./chunk-EOE5NDMK.js";import"./chunk-DWDILV2E.js";import{a as je}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as Pe}from"./chunk-D73WYMRU.js";import{a as Ge}from"./chunk-XNJNSCLM.js";import{b as De}from"./chunk-4F72YCTU.js";import{a as Be,b as Re,c as $e,d as j,e as E,f as _}from"./chunk-GTM65MVX.js";import{a as Le,e as Me}from"./chunk-Y572GMZE.js";import{a as Ve}from"./chunk-VLXV72QE.js";import{R as We}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as de}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-EBTLTGG3.js";import{f as Fe}from"./chunk-S2G7OH5T.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ie}from"./chunk-TAD43CG5.js";import{d as U,f as ce,g as ue,h as me,l as fe,p as ze}from"./chunk-5XO36X4C.js";import"./chunk-ZXLEXF4X.js";import{a as f,e as Ie,f as at,g as ot,h as rt}from"./chunk-RRCPZMC2.js";var F=Ie(ot(),1);var w=Ie(at(),1);var t=Ie(rt(),1);var lt=f((o,e)=>{let s=new Set(o.map(a=>a.deadLetterQueue).filter(a=>typeof a=="string"&&a!=="")),i=o.filter(a=>(a.deadLetterQueue===void 0||a.deadLetterQueue==="")&&!s.has(a.name)),n=e.filter(a=>a.deadLettered).length;return{deadLetteredCount:n,queuesWithoutDlq:i,showReliabilityWarning:i.length>0||n>0}},"computeQueueReliability"),nt=200,dt=ce(J.sendQueueMessage),it=ce(J.replayQueueMessage),ct=ce(J.clearQueueMessages),Ye=96,ut=f(o=>{if(o===void 0)return"\u2014";try{return JSON.stringify(o)}catch{return"[unserializable]"}},"formatBody"),mt=f(o=>o.length>Ye?`${o.slice(0,Ye)}\u2026`:o,"truncate"),ft=f(o=>o==="error"?"destructive":o==="retry"?"outline":"secondary","outcomeVariant"),ht=f((o,e)=>e(o==="messages"?"Messages":o==="send"?"Send":"Declared"),"tabLabel"),pt=f(o=>{let e=(0,F.c)(11),{loaded:s,queues:i}=o,n=U(),a;e[0]!==n?(a=n("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=n,e[1]=a):a=e[1];let l;e[2]!==a?(l=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a},void 0,!1),e[2]=a,e[3]=l):l=e[3];let r;e[4]!==s||e[5]!==i||e[6]!==n?(r=s&&i.length===0?(0,t.jsxDEV)(ie,{description:n("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:n("No queues defined")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:n("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Queue")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Mode")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Binding")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(yt)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[4]=s,e[5]=i,e[6]=n,e[7]=r):r=e[7];let h;return e[8]!==l||e[9]!==r?(h=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[l,r]},void 0,!0),e[8]=l,e[9]=r,e[10]=h):h=e[10],h},"QueuesDeclaredTab"),gt=f(o=>{let e=(0,F.c)(67),{message:s,onReplay:i,replayingId:n}=o,a=U(),l,r,h,u,y,p,x,d,m,g;if(e[0]!==s.attempts||e[1]!==s.body||e[2]!==s.deadLettered||e[3]!==s.exportName||e[4]!==s.id||e[5]!==s.messageId||e[6]!==s.outcome||e[7]!==s.queue||e[8]!==a){let W=ut(s.body);r=j,p=`queues-message-${s.id}`;let z=s.exportName??s.queue;e[19]!==z?(x=(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:z},void 0,!1),e[19]=z,e[20]=x):x=e[20],e[21]!==s.messageId?(d=(0,t.jsxDEV)(_,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:s.messageId,children:s.messageId},void 0,!1),e[21]=s.messageId,e[22]=d):d=e[22],e[23]!==s.attempts?(m=(0,t.jsxDEV)(_,{className:"font-mono text-xs tabular-nums",children:s.attempts},void 0,!1),e[23]=s.attempts,e[24]=m):m=e[24];let I=`queues-outcome-${s.id}`,L;e[25]!==s.outcome?(L=ft(s.outcome),e[25]=s.outcome,e[26]=L):L=e[26];let T;e[27]!==s.outcome||e[28]!==I||e[29]!==L?(T=(0,t.jsxDEV)(de,{"data-testid":I,variant:L,children:s.outcome},void 0,!1),e[27]=s.outcome,e[28]=I,e[29]=L,e[30]=T):T=e[30];let M;e[31]!==s.deadLettered||e[32]!==s.id||e[33]!==a?(M=s.deadLettered&&(0,t.jsxDEV)(de,{"data-testid":`queues-dlq-${s.id}`,variant:"destructive",children:a("DLQ")},void 0,!1),e[31]=s.deadLettered,e[32]=s.id,e[33]=a,e[34]=M):M=e[34],e[35]!==T||e[36]!==M?(g=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:[T,M]},void 0,!0)},void 0,!1),e[35]=T,e[36]=M,e[37]=g):g=e[37],l=_,h="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=W,y=mt(W),e[0]=s.attempts,e[1]=s.body,e[2]=s.deadLettered,e[3]=s.exportName,e[4]=s.id,e[5]=s.messageId,e[6]=s.outcome,e[7]=s.queue,e[8]=a,e[9]=l,e[10]=r,e[11]=h,e[12]=u,e[13]=y,e[14]=p,e[15]=x,e[16]=d,e[17]=m,e[18]=g}else l=e[9],r=e[10],h=e[11],u=e[12],y=e[13],p=e[14],x=e[15],d=e[16],m=e[17],g=e[18];let v;e[38]!==l||e[39]!==h||e[40]!==u||e[41]!==y?(v=(0,t.jsxDEV)(l,{className:h,title:u,children:y},void 0,!1),e[38]=l,e[39]=h,e[40]=u,e[41]=y,e[42]=v):v=e[42];let N;e[43]!==s.capturedAt?(N=ze(s.capturedAt,"\u2014"),e[43]=s.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=(0,t.jsxDEV)(_,{className:"text-xs text-muted-foreground tabular-nums",children:N},void 0,!1),e[45]=N,e[46]=b):b=e[46];let S=`queues-replay-${s.id}`,A=n!==null,C;e[47]!==s.id||e[48]!==n||e[49]!==a?(C=n===s.id?a("Replaying\u2026"):a("Replay"),e[47]=s.id,e[48]=n,e[49]=a,e[50]=C):C=e[50];let Q;e[51]!==s.id||e[52]!==i||e[53]!==S||e[54]!==A||e[55]!==C?(Q=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(V,{"data-id":s.id,"data-testid":S,disabled:A,onClick:i,size:"xs",type:"button",variant:"outline",children:C},void 0,!1)},void 0,!1),e[51]=s.id,e[52]=i,e[53]=S,e[54]=A,e[55]=C,e[56]=Q):Q=e[56];let D;return e[57]!==r||e[58]!==b||e[59]!==Q||e[60]!==p||e[61]!==x||e[62]!==d||e[63]!==m||e[64]!==g||e[65]!==v?(D=(0,t.jsxDEV)(r,{"data-testid":p,children:[x,d,m,g,v,b,Q]},void 0,!0),e[57]=r,e[58]=b,e[59]=Q,e[60]=p,e[61]=x,e[62]=d,e[63]=m,e[64]=g,e[65]=v,e[66]=D):D=e[66],D},"QueueLogRow"),vt=f(o=>{let e=(0,F.c)(26),{hasError:s,messages:i,onClear:n,onReplay:a,replayingId:l}=o,r=U(),h;e[0]!==r?(h=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=h):h=e[1];let u;e[2]!==h?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:h},void 0,!1),e[2]=h,e[3]=u):u=e[3];let y=i.length===0,p;e[4]!==r?(p=r("Clear log"),e[4]=r,e[5]=p):p=e[5];let x;e[6]!==n||e[7]!==y||e[8]!==p?(x=(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-clear",disabled:y,onClick:n,size:"sm",type:"button",variant:"outline",children:p},void 0,!1),e[6]=n,e[7]=y,e[8]=p,e[9]=x):x=e[9];let d;e[10]!==i.length||e[11]!==r?(d=i.length>0&&(0,t.jsxDEV)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:i.length})},void 0,!1),e[10]=i.length,e[11]=r,e[12]=d):d=e[12];let m;e[13]!==u||e[14]!==x||e[15]!==d?(m=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[u,x,d]},void 0,!0),e[13]=u,e[14]=x,e[15]=d,e[16]=m):m=e[16];let g;e[17]!==s||e[18]!==i||e[19]!==a||e[20]!==l||e[21]!==r?(g=!s&&i.length===0?(0,t.jsxDEV)(ie,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-messages-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:r("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Message")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Attempts")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Outcome")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Body")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Captured")},void 0,!1),(0,t.jsxDEV)(E,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(N=>(0,t.jsxDEV)(gt,{message:N,onReplay:a,replayingId:l},N.id,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)},void 0,!1),e[17]=s,e[18]=i,e[19]=a,e[20]=l,e[21]=r,e[22]=g):g=e[22];let v;return e[23]!==m||e[24]!==g?(v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[m,g]},void 0,!0),e[23]=m,e[24]=g,e[25]=v):v=e[25],v},"QueuesMessagesTab"),xt=f(o=>{let e=(0,F.c)(20),{batchMode:s,bodyText:i,delayText:n,onBatchModeChange:a,onBodyChange:l,onDelayChange:r,onSelectExport:h,onSend:u,queues:y,selectedExportName:p,sending:x}=o,d=U(),m;e[0]!==d?(m=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=m):m=e[1];let g;e[2]!==m?(g=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:m},void 0,!1),e[2]=m,e[3]=g):g=e[3];let v;e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==a||e[8]!==l||e[9]!==r||e[10]!==h||e[11]!==u||e[12]!==y||e[13]!==p||e[14]!==x||e[15]!==d?(v=y.length===0?(0,t.jsxDEV)(ie,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)("select",{"aria-label":d("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:h,value:p,children:y.map(bt)},void 0,!1),(0,t.jsxDEV)(We,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:d("Delay (s)"),type:"number",value:n},void 0,!1),(0,t.jsxDEV)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsxDEV)("input",{checked:s,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:a,type:"checkbox"},void 0,!1),d("Send as batch (JSON array)")]},void 0,!0),(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||p==="",onClick:u,type:"button",children:d(x?"Sending\u2026":"Send message")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(Ve,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:s?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:i},void 0,!1)]},void 0,!0),e[4]=s,e[5]=i,e[6]=n,e[7]=a,e[8]=l,e[9]=r,e[10]=h,e[11]=u,e[12]=y,e[13]=p,e[14]=x,e[15]=d,e[16]=v):v=e[16];let N;return e[17]!==g||e[18]!==v?(N=(0,t.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[g,v]},void 0,!0),e[17]=g,e[18]=v,e[19]=N):N=e[19],N},"QueuesSendTab"),Ut=f(o=>{let e=(0,F.c)(59),{limit:s}=o,i=s??nt,n=Fe(),a=U(),[l,r]=(0,w.useState)("declared"),[h,u]=(0,w.useState)(null),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:p,error:x,errorSource:d}=De(J.listQueues,y),m;e[1]!==i?(m={limit:i},e[1]=i,e[2]=m):m=e[2];let{data:g,error:v,errorSource:N,refetch:b}=De(J.getQueueMessages,m),S=Array.isArray(p?.queues)?[...p.queues].toSorted(Nt):[],A=g?.entries??[],{deadLetteredCount:C,queuesWithoutDlq:Q,showReliabilityWarning:D}=lt(S,A),[W,z]=(0,w.useState)(""),[I,L]=(0,w.useState)(""),[T,M]=(0,w.useState)(""),[G,Xe]=(0,w.useState)(!1),[he,Oe]=(0,w.useState)(!1),[pe,ke]=(0,w.useState)(null),H=S.some(c=>c.exportName===W)?W:S[0]?.exportName??"",Ue=l==="messages"?v:x,Ke=l==="messages"?N:d,ge=Ue??h,ve=Ue===null?h:Ke,Y;e[3]!==b?(Y=f(()=>{b()},"t3"),e[3]=b,e[4]=Y):Y=e[4],je(Y,l==="messages");let xe=f(async()=>{u(null);let c=H;if(c==="")return;let q=null,we=I.trim();if(we!=="")try{q=JSON.parse(we)}catch{u(a("Body must be valid JSON."));return}let Ae,Je=T.trim();if(Je!==""){let P=Number(Je);if(!Number.isFinite(P)||P<0){u(a("Delay must be a non-negative number of seconds."));return}Ae=P}if(G&&!Array.isArray(q)){u(a("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=G?{batch:q,delaySeconds:Ae,exportName:c}:{body:q,delaySeconds:Ae,exportName:c};try{await n.query(dt,st,ue("")),b()}catch(P){u(me(P))}Oe(!1)},"send"),X;e[5]!==n||e[6]!==b?(X=f(async c=>{u(null),ke(c);try{await n.query(it,{id:c},ue("")),b()}catch(q){u(me(q))}ke(null)},"t5"),e[5]=n,e[6]=b,e[7]=X):X=e[7];let ye=X,K;e[8]!==n||e[9]!==b?(K=f(async()=>{u(null);try{await n.query(ct,{},ue("")),b()}catch(c){u(me(c))}},"t6"),e[8]=n,e[9]=b,e[10]=K):K=e[10];let be=K,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=f(c=>{let q=c.currentTarget.dataset.tab;(q==="declared"||q==="messages"||q==="send")&&r(q)},"t7"),e[11]=Z):Z=e[11];let Ze=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=f(c=>{z(c.currentTarget.value)},"t8"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=f(c=>{L(c.currentTarget.value)},"t9"),e[13]=te):te=e[13];let qe=te,se;e[14]===Symbol.for("react.memo_cache_sentinel")?(se=f(c=>{M(c.currentTarget.value)},"t10"),e[14]=se):se=e[14];let Se=se,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=f(c=>{Xe(c.currentTarget.checked)},"t11"),e[15]=ae):ae=e[15];let Ee=ae,oe;e[16]!==xe?(oe=f(()=>{fe(xe())},"t12"),e[16]=xe,e[17]=oe):oe=e[17];let _e=oe,re;e[18]!==ye?(re=f(c=>{let{id:q}=c.currentTarget.dataset;q!==void 0&&fe(ye(q))},"t13"),e[18]=ye,e[19]=re):re=e[19];let Te=re,le;e[20]!==be?(le=f(()=>{fe(be())},"t14"),e[20]=be,e[21]=le):le=e[21];let Ce=le,et="flex flex-col gap-6",tt="lunora-queues-panel",B;e[22]!==a||e[23]!==l?(B=(0,t.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>(0,t.jsxDEV)(V,{"aria-selected":l===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:Ze,role:"tab",size:"sm",type:"button",variant:l===c?"secondary":"ghost",children:ht(c,a)},c,!1))},void 0,!1),e[22]=a,e[23]=l,e[24]=B):B=e[24];let R;e[25]!==ge||e[26]!==ve?(R=ge!==null&&(0,t.jsxDEV)(Pe,{error:ve,testId:"queues-error"},void 0,!1),e[25]=ge,e[26]=ve,e[27]=R):R=e[27];let Qe=D&&(0,t.jsxDEV)(Ge,{icon:(0,t.jsxDEV)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"},void 0,!1),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[Q.length>0&&(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("p",{className:"font-medium",children:a("No dead-letter queue on {queues}.",{queues:Q.map(qt).join(", ")})},void 0,!1),(0,t.jsxDEV)("p",{className:"text-muted-foreground",children:a("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")},void 0,!1)]},void 0,!0),C>0&&(0,t.jsxDEV)("p",{className:Q.length>0?"text-muted-foreground":"font-medium",children:C===1?a("1 message was recently dead-lettered."):a("{count} messages were recently dead-lettered.",{count:C})},void 0,!1)]},void 0,!0)},void 0,!1),$;e[28]!==S||e[29]!==p||e[30]!==l?($=l==="declared"&&(0,t.jsxDEV)(pt,{loaded:p!==void 0,queues:S},void 0,!1),e[28]=S,e[29]=p,e[30]=l,e[31]=$):$=e[31];let O;e[32]!==A||e[33]!==v||e[34]!==Ce||e[35]!==Te||e[36]!==pe||e[37]!==l?(O=l==="messages"&&(0,t.jsxDEV)(vt,{hasError:v!==null,messages:A,onClear:Ce,onReplay:Te,replayingId:pe},void 0,!1),e[32]=A,e[33]=v,e[34]=Ce,e[35]=Te,e[36]=pe,e[37]=l,e[38]=O):O=e[38];let k;e[39]!==G||e[40]!==I||e[41]!==T||e[42]!==Ee||e[43]!==qe||e[44]!==Se||e[45]!==Ne||e[46]!==_e||e[47]!==S||e[48]!==H||e[49]!==he||e[50]!==l?(k=l==="send"&&(0,t.jsxDEV)(xt,{batchMode:G,bodyText:I,delayText:T,onBatchModeChange:Ee,onBodyChange:qe,onDelayChange:Se,onSelectExport:Ne,onSend:_e,queues:S,selectedExportName:H,sending:he},void 0,!1),e[39]=G,e[40]=I,e[41]=T,e[42]=Ee,e[43]=qe,e[44]=Se,e[45]=Ne,e[46]=_e,e[47]=S,e[48]=H,e[49]=he,e[50]=l,e[51]=k):k=e[51];let ne;return e[52]!==B||e[53]!==R||e[54]!==Qe||e[55]!==$||e[56]!==O||e[57]!==k?(ne=(0,t.jsxDEV)("div",{className:et,"data-testid":tt,children:[B,R,Qe,$,O,k]},void 0,!0),e[52]=B,e[53]=R,e[54]=Qe,e[55]=$,e[56]=O,e[57]=k,e[58]=ne):ne=e[58],ne},"QueuesPanel");function yt(o){return(0,t.jsxDEV)(j,{"data-testid":`queues-row-${o.exportName}`,children:[(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:o.exportName},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.name},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.mode},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.binding},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.deadLetterQueue??"\u2014"},void 0,!1)]},o.exportName,!0)}f(yt,"_temp");function bt(o){return(0,t.jsxDEV)("option",{value:o.exportName,children:o.exportName},o.exportName,!1)}f(bt,"_temp2");function Nt(o,e){return o.exportName.localeCompare(e.exportName)}f(Nt,"_temp3");function qt(o){return o.name}f(qt,"_temp4");export{Ut as default};
|
|
1
|
+
import{a as He}from"./chunk-2TJVFKD2.js";import"./chunk-3HGNPZBN.js";import{a as je}from"./chunk-J6J54MBP.js";import"./chunk-5OIBXYZM.js";import{a as Pe}from"./chunk-2ICZ6HXQ.js";import{a as Ge}from"./chunk-XNJNSCLM.js";import{b as De}from"./chunk-2YUYNNHQ.js";import{a as Be,b as Re,c as $e,d as j,e as E,f as _}from"./chunk-GTM65MVX.js";import{a as Le,e as Me}from"./chunk-Y572GMZE.js";import{a as Ve}from"./chunk-VLXV72QE.js";import{R as We}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as de}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as J}from"./chunk-MHGJUKCZ.js";import{f as Fe}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as ie}from"./chunk-TAD43CG5.js";import{d as U,f as ce,g as ue,h as me,m as fe,q as ze}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as f,e as Ie,f as at,g as ot,h as rt}from"./chunk-RRCPZMC2.js";var F=Ie(ot(),1);var w=Ie(at(),1);var t=Ie(rt(),1);var lt=f((o,e)=>{let s=new Set(o.map(a=>a.deadLetterQueue).filter(a=>typeof a=="string"&&a!=="")),i=o.filter(a=>(a.deadLetterQueue===void 0||a.deadLetterQueue==="")&&!s.has(a.name)),n=e.filter(a=>a.deadLettered).length;return{deadLetteredCount:n,queuesWithoutDlq:i,showReliabilityWarning:i.length>0||n>0}},"computeQueueReliability"),nt=200,dt=ce(J.sendQueueMessage),it=ce(J.replayQueueMessage),ct=ce(J.clearQueueMessages),Ye=96,ut=f(o=>{if(o===void 0)return"\u2014";try{return JSON.stringify(o)}catch{return"[unserializable]"}},"formatBody"),mt=f(o=>o.length>Ye?`${o.slice(0,Ye)}\u2026`:o,"truncate"),ft=f(o=>o==="error"?"destructive":o==="retry"?"outline":"secondary","outcomeVariant"),ht=f((o,e)=>e(o==="messages"?"Messages":o==="send"?"Send":"Declared"),"tabLabel"),pt=f(o=>{let e=(0,F.c)(11),{loaded:s,queues:i}=o,n=U(),a;e[0]!==n?(a=n("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=n,e[1]=a):a=e[1];let l;e[2]!==a?(l=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:a},void 0,!1),e[2]=a,e[3]=l):l=e[3];let r;e[4]!==s||e[5]!==i||e[6]!==n?(r=s&&i.length===0?(0,t.jsxDEV)(ie,{description:n("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:n("No queues defined")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:n("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Queue")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Mode")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Binding")},void 0,!1),(0,t.jsxDEV)(E,{children:n("Dead-letter")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(yt)},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[4]=s,e[5]=i,e[6]=n,e[7]=r):r=e[7];let h;return e[8]!==l||e[9]!==r?(h=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[l,r]},void 0,!0),e[8]=l,e[9]=r,e[10]=h):h=e[10],h},"QueuesDeclaredTab"),gt=f(o=>{let e=(0,F.c)(67),{message:s,onReplay:i,replayingId:n}=o,a=U(),l,r,h,u,y,p,x,d,m,g;if(e[0]!==s.attempts||e[1]!==s.body||e[2]!==s.deadLettered||e[3]!==s.exportName||e[4]!==s.id||e[5]!==s.messageId||e[6]!==s.outcome||e[7]!==s.queue||e[8]!==a){let W=ut(s.body);r=j,p=`queues-message-${s.id}`;let z=s.exportName??s.queue;e[19]!==z?(x=(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:z},void 0,!1),e[19]=z,e[20]=x):x=e[20],e[21]!==s.messageId?(d=(0,t.jsxDEV)(_,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:s.messageId,children:s.messageId},void 0,!1),e[21]=s.messageId,e[22]=d):d=e[22],e[23]!==s.attempts?(m=(0,t.jsxDEV)(_,{className:"font-mono text-xs tabular-nums",children:s.attempts},void 0,!1),e[23]=s.attempts,e[24]=m):m=e[24];let I=`queues-outcome-${s.id}`,L;e[25]!==s.outcome?(L=ft(s.outcome),e[25]=s.outcome,e[26]=L):L=e[26];let T;e[27]!==s.outcome||e[28]!==I||e[29]!==L?(T=(0,t.jsxDEV)(de,{"data-testid":I,variant:L,children:s.outcome},void 0,!1),e[27]=s.outcome,e[28]=I,e[29]=L,e[30]=T):T=e[30];let M;e[31]!==s.deadLettered||e[32]!==s.id||e[33]!==a?(M=s.deadLettered&&(0,t.jsxDEV)(de,{"data-testid":`queues-dlq-${s.id}`,variant:"destructive",children:a("DLQ")},void 0,!1),e[31]=s.deadLettered,e[32]=s.id,e[33]=a,e[34]=M):M=e[34],e[35]!==T||e[36]!==M?(g=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:[T,M]},void 0,!0)},void 0,!1),e[35]=T,e[36]=M,e[37]=g):g=e[37],l=_,h="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=W,y=mt(W),e[0]=s.attempts,e[1]=s.body,e[2]=s.deadLettered,e[3]=s.exportName,e[4]=s.id,e[5]=s.messageId,e[6]=s.outcome,e[7]=s.queue,e[8]=a,e[9]=l,e[10]=r,e[11]=h,e[12]=u,e[13]=y,e[14]=p,e[15]=x,e[16]=d,e[17]=m,e[18]=g}else l=e[9],r=e[10],h=e[11],u=e[12],y=e[13],p=e[14],x=e[15],d=e[16],m=e[17],g=e[18];let v;e[38]!==l||e[39]!==h||e[40]!==u||e[41]!==y?(v=(0,t.jsxDEV)(l,{className:h,title:u,children:y},void 0,!1),e[38]=l,e[39]=h,e[40]=u,e[41]=y,e[42]=v):v=e[42];let N;e[43]!==s.capturedAt?(N=ze(s.capturedAt,"\u2014"),e[43]=s.capturedAt,e[44]=N):N=e[44];let b;e[45]!==N?(b=(0,t.jsxDEV)(_,{className:"text-xs text-muted-foreground tabular-nums",children:N},void 0,!1),e[45]=N,e[46]=b):b=e[46];let S=`queues-replay-${s.id}`,A=n!==null,C;e[47]!==s.id||e[48]!==n||e[49]!==a?(C=n===s.id?a("Replaying\u2026"):a("Replay"),e[47]=s.id,e[48]=n,e[49]=a,e[50]=C):C=e[50];let Q;e[51]!==s.id||e[52]!==i||e[53]!==S||e[54]!==A||e[55]!==C?(Q=(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(V,{"data-id":s.id,"data-testid":S,disabled:A,onClick:i,size:"xs",type:"button",variant:"outline",children:C},void 0,!1)},void 0,!1),e[51]=s.id,e[52]=i,e[53]=S,e[54]=A,e[55]=C,e[56]=Q):Q=e[56];let D;return e[57]!==r||e[58]!==b||e[59]!==Q||e[60]!==p||e[61]!==x||e[62]!==d||e[63]!==m||e[64]!==g||e[65]!==v?(D=(0,t.jsxDEV)(r,{"data-testid":p,children:[x,d,m,g,v,b,Q]},void 0,!0),e[57]=r,e[58]=b,e[59]=Q,e[60]=p,e[61]=x,e[62]=d,e[63]=m,e[64]=g,e[65]=v,e[66]=D):D=e[66],D},"QueueLogRow"),vt=f(o=>{let e=(0,F.c)(26),{hasError:s,messages:i,onClear:n,onReplay:a,replayingId:l}=o,r=U(),h;e[0]!==r?(h=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=h):h=e[1];let u;e[2]!==h?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:h},void 0,!1),e[2]=h,e[3]=u):u=e[3];let y=i.length===0,p;e[4]!==r?(p=r("Clear log"),e[4]=r,e[5]=p):p=e[5];let x;e[6]!==n||e[7]!==y||e[8]!==p?(x=(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-clear",disabled:y,onClick:n,size:"sm",type:"button",variant:"outline",children:p},void 0,!1),e[6]=n,e[7]=y,e[8]=p,e[9]=x):x=e[9];let d;e[10]!==i.length||e[11]!==r?(d=i.length>0&&(0,t.jsxDEV)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:i.length})},void 0,!1),e[10]=i.length,e[11]=r,e[12]=d):d=e[12];let m;e[13]!==u||e[14]!==x||e[15]!==d?(m=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[u,x,d]},void 0,!0),e[13]=u,e[14]=x,e[15]=d,e[16]=m):m=e[16];let g;e[17]!==s||e[18]!==i||e[19]!==a||e[20]!==l||e[21]!==r?(g=!s&&i.length===0?(0,t.jsxDEV)(ie,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")},void 0,!1):(0,t.jsxDEV)(Le,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Me,{className:"px-0",children:(0,t.jsxDEV)(He,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxDEV)(Be,{"data-testid":"queues-messages-table",children:[(0,t.jsxDEV)(Re,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(E,{children:r("Export")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Message")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Attempts")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Outcome")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Body")},void 0,!1),(0,t.jsxDEV)(E,{children:r("Captured")},void 0,!1),(0,t.jsxDEV)(E,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($e,{children:i.map(N=>(0,t.jsxDEV)(gt,{message:N,onReplay:a,replayingId:l},N.id,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)},void 0,!1),e[17]=s,e[18]=i,e[19]=a,e[20]=l,e[21]=r,e[22]=g):g=e[22];let v;return e[23]!==m||e[24]!==g?(v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[m,g]},void 0,!0),e[23]=m,e[24]=g,e[25]=v):v=e[25],v},"QueuesMessagesTab"),xt=f(o=>{let e=(0,F.c)(20),{batchMode:s,bodyText:i,delayText:n,onBatchModeChange:a,onBodyChange:l,onDelayChange:r,onSelectExport:h,onSend:u,queues:y,selectedExportName:p,sending:x}=o,d=U(),m;e[0]!==d?(m=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=m):m=e[1];let g;e[2]!==m?(g=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:m},void 0,!1),e[2]=m,e[3]=g):g=e[3];let v;e[4]!==s||e[5]!==i||e[6]!==n||e[7]!==a||e[8]!==l||e[9]!==r||e[10]!==h||e[11]!==u||e[12]!==y||e[13]!==p||e[14]!==x||e[15]!==d?(v=y.length===0?(0,t.jsxDEV)(ie,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)("select",{"aria-label":d("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:h,value:p,children:y.map(bt)},void 0,!1),(0,t.jsxDEV)(We,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:d("Delay (s)"),type:"number",value:n},void 0,!1),(0,t.jsxDEV)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsxDEV)("input",{checked:s,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:a,type:"checkbox"},void 0,!1),d("Send as batch (JSON array)")]},void 0,!0),(0,t.jsxDEV)(V,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||p==="",onClick:u,type:"button",children:d(x?"Sending\u2026":"Send message")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(Ve,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:s?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:i},void 0,!1)]},void 0,!0),e[4]=s,e[5]=i,e[6]=n,e[7]=a,e[8]=l,e[9]=r,e[10]=h,e[11]=u,e[12]=y,e[13]=p,e[14]=x,e[15]=d,e[16]=v):v=e[16];let N;return e[17]!==g||e[18]!==v?(N=(0,t.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[g,v]},void 0,!0),e[17]=g,e[18]=v,e[19]=N):N=e[19],N},"QueuesSendTab"),Ut=f(o=>{let e=(0,F.c)(59),{limit:s}=o,i=s??nt,n=Fe(),a=U(),[l,r]=(0,w.useState)("declared"),[h,u]=(0,w.useState)(null),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:p,error:x,errorSource:d}=De(J.listQueues,y),m;e[1]!==i?(m={limit:i},e[1]=i,e[2]=m):m=e[2];let{data:g,error:v,errorSource:N,refetch:b}=De(J.getQueueMessages,m),S=Array.isArray(p?.queues)?[...p.queues].toSorted(Nt):[],A=g?.entries??[],{deadLetteredCount:C,queuesWithoutDlq:Q,showReliabilityWarning:D}=lt(S,A),[W,z]=(0,w.useState)(""),[I,L]=(0,w.useState)(""),[T,M]=(0,w.useState)(""),[G,Xe]=(0,w.useState)(!1),[he,Oe]=(0,w.useState)(!1),[pe,ke]=(0,w.useState)(null),H=S.some(c=>c.exportName===W)?W:S[0]?.exportName??"",Ue=l==="messages"?v:x,Ke=l==="messages"?N:d,ge=Ue??h,ve=Ue===null?h:Ke,Y;e[3]!==b?(Y=f(()=>{b()},"t3"),e[3]=b,e[4]=Y):Y=e[4],je(Y,l==="messages");let xe=f(async()=>{u(null);let c=H;if(c==="")return;let q=null,we=I.trim();if(we!=="")try{q=JSON.parse(we)}catch{u(a("Body must be valid JSON."));return}let Ae,Je=T.trim();if(Je!==""){let P=Number(Je);if(!Number.isFinite(P)||P<0){u(a("Delay must be a non-negative number of seconds."));return}Ae=P}if(G&&!Array.isArray(q)){u(a("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=G?{batch:q,delaySeconds:Ae,exportName:c}:{body:q,delaySeconds:Ae,exportName:c};try{await n.query(dt,st,ue("")),b()}catch(P){u(me(P))}Oe(!1)},"send"),X;e[5]!==n||e[6]!==b?(X=f(async c=>{u(null),ke(c);try{await n.query(it,{id:c},ue("")),b()}catch(q){u(me(q))}ke(null)},"t5"),e[5]=n,e[6]=b,e[7]=X):X=e[7];let ye=X,K;e[8]!==n||e[9]!==b?(K=f(async()=>{u(null);try{await n.query(ct,{},ue("")),b()}catch(c){u(me(c))}},"t6"),e[8]=n,e[9]=b,e[10]=K):K=e[10];let be=K,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=f(c=>{let q=c.currentTarget.dataset.tab;(q==="declared"||q==="messages"||q==="send")&&r(q)},"t7"),e[11]=Z):Z=e[11];let Ze=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=f(c=>{z(c.currentTarget.value)},"t8"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=f(c=>{L(c.currentTarget.value)},"t9"),e[13]=te):te=e[13];let qe=te,se;e[14]===Symbol.for("react.memo_cache_sentinel")?(se=f(c=>{M(c.currentTarget.value)},"t10"),e[14]=se):se=e[14];let Se=se,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=f(c=>{Xe(c.currentTarget.checked)},"t11"),e[15]=ae):ae=e[15];let Ee=ae,oe;e[16]!==xe?(oe=f(()=>{fe(xe())},"t12"),e[16]=xe,e[17]=oe):oe=e[17];let _e=oe,re;e[18]!==ye?(re=f(c=>{let{id:q}=c.currentTarget.dataset;q!==void 0&&fe(ye(q))},"t13"),e[18]=ye,e[19]=re):re=e[19];let Te=re,le;e[20]!==be?(le=f(()=>{fe(be())},"t14"),e[20]=be,e[21]=le):le=e[21];let Ce=le,et="flex flex-col gap-6",tt="lunora-queues-panel",B;e[22]!==a||e[23]!==l?(B=(0,t.jsxDEV)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>(0,t.jsxDEV)(V,{"aria-selected":l===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:Ze,role:"tab",size:"sm",type:"button",variant:l===c?"secondary":"ghost",children:ht(c,a)},c,!1))},void 0,!1),e[22]=a,e[23]=l,e[24]=B):B=e[24];let R;e[25]!==ge||e[26]!==ve?(R=ge!==null&&(0,t.jsxDEV)(Pe,{error:ve,testId:"queues-error"},void 0,!1),e[25]=ge,e[26]=ve,e[27]=R):R=e[27];let Qe=D&&(0,t.jsxDEV)(Ge,{icon:(0,t.jsxDEV)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"},void 0,!1),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[Q.length>0&&(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("p",{className:"font-medium",children:a("No dead-letter queue on {queues}.",{queues:Q.map(qt).join(", ")})},void 0,!1),(0,t.jsxDEV)("p",{className:"text-muted-foreground",children:a("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")},void 0,!1)]},void 0,!0),C>0&&(0,t.jsxDEV)("p",{className:Q.length>0?"text-muted-foreground":"font-medium",children:C===1?a("1 message was recently dead-lettered."):a("{count} messages were recently dead-lettered.",{count:C})},void 0,!1)]},void 0,!0)},void 0,!1),$;e[28]!==S||e[29]!==p||e[30]!==l?($=l==="declared"&&(0,t.jsxDEV)(pt,{loaded:p!==void 0,queues:S},void 0,!1),e[28]=S,e[29]=p,e[30]=l,e[31]=$):$=e[31];let O;e[32]!==A||e[33]!==v||e[34]!==Ce||e[35]!==Te||e[36]!==pe||e[37]!==l?(O=l==="messages"&&(0,t.jsxDEV)(vt,{hasError:v!==null,messages:A,onClear:Ce,onReplay:Te,replayingId:pe},void 0,!1),e[32]=A,e[33]=v,e[34]=Ce,e[35]=Te,e[36]=pe,e[37]=l,e[38]=O):O=e[38];let k;e[39]!==G||e[40]!==I||e[41]!==T||e[42]!==Ee||e[43]!==qe||e[44]!==Se||e[45]!==Ne||e[46]!==_e||e[47]!==S||e[48]!==H||e[49]!==he||e[50]!==l?(k=l==="send"&&(0,t.jsxDEV)(xt,{batchMode:G,bodyText:I,delayText:T,onBatchModeChange:Ee,onBodyChange:qe,onDelayChange:Se,onSelectExport:Ne,onSend:_e,queues:S,selectedExportName:H,sending:he},void 0,!1),e[39]=G,e[40]=I,e[41]=T,e[42]=Ee,e[43]=qe,e[44]=Se,e[45]=Ne,e[46]=_e,e[47]=S,e[48]=H,e[49]=he,e[50]=l,e[51]=k):k=e[51];let ne;return e[52]!==B||e[53]!==R||e[54]!==Qe||e[55]!==$||e[56]!==O||e[57]!==k?(ne=(0,t.jsxDEV)("div",{className:et,"data-testid":tt,children:[B,R,Qe,$,O,k]},void 0,!0),e[52]=B,e[53]=R,e[54]=Qe,e[55]=$,e[56]=O,e[57]=k,e[58]=ne):ne=e[58],ne},"QueuesPanel");function yt(o){return(0,t.jsxDEV)(j,{"data-testid":`queues-row-${o.exportName}`,children:[(0,t.jsxDEV)(_,{className:"font-mono text-xs",children:o.exportName},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.name},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.mode},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.binding},void 0,!1),(0,t.jsxDEV)(_,{className:"font-mono text-xs text-muted-foreground",children:o.deadLetterQueue??"\u2014"},void 0,!1)]},o.exportName,!0)}f(yt,"_temp");function bt(o){return(0,t.jsxDEV)("option",{value:o.exportName,children:o.exportName},o.exportName,!1)}f(bt,"_temp2");function Nt(o,e){return o.exportName.localeCompare(e.exportName)}f(Nt,"_temp3");function qt(o){return o.name}f(qt,"_temp4");export{Ut as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{a as S,e as k}from"./chunk-Y572GMZE.js";import{R as $}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as A}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as F}from"./chunk-
|
|
1
|
+
import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{a as S,e as k}from"./chunk-Y572GMZE.js";import{R as $}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as A}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as F}from"./chunk-C7UZEQZ7.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as H}from"./chunk-TAD43CG5.js";import{d as Q,h as E,l as K,m as I}from"./chunk-HBGS4SEX.js";import"./chunk-ZXLEXF4X.js";import{a as f,e as C,f as Z,g as G,h as J}from"./chunk-RRCPZMC2.js";var z=C(G(),1);var s=C(Z(),1);var e=C(J(),1);var X=10,g=f(x=>{let l=(0,z.c)(7),{label:m,value:a}=x,r;l[0]!==m?(r=(0,e.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m},void 0,!1),l[0]=m,l[1]=r):r=l[1];let v=a??"\u2014",o;l[2]!==v?(o=(0,e.jsxDEV)("span",{className:"font-mono text-sm",children:v},void 0,!1),l[2]=v,l[3]=o):o=l[3];let u;return l[4]!==r||l[5]!==o?(u=(0,e.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[r,o]},void 0,!0),l[4]=r,l[5]=o,l[6]=u):u=l[6],u},"Detail"),oe=f(({loadIndexes:x,runQuery:l}={})=>{let m=F(),a=Q(),[r,v]=(0,s.useState)(null),[o,u]=(0,s.useState)(null),[b,L]=(0,s.useState)(null),[N,O]=(0,s.useState)(""),[h,y]=(0,s.useState)(null),[M,w]=(0,s.useState)(null),[j,D]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let t={cancelled:!1};return I((async()=>{try{let c=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(v(c),u(null),L(T=>T??c[0]?.name??null))}catch(c){t.cancelled||(v(null),u(E(c)))}})()),()=>{t.cancelled=!0}},[m,x]);let i=r?.find(t=>t.name===b)??null,P=f(t=>{L(t.currentTarget.dataset.index??null),y(null),w(null)},"onSelect"),R=f(t=>{O(t.target.value)},"onQueryTextChange"),U=f(async()=>{let t=N.trim();if(!(b===null||t==="")){D(!0),w(null);try{let c=await(l??(T=>m.queryVectorIndex(T)))({name:b,text:t,topK:X});y(c)}catch(c){y(null),w(E(c))}finally{D(!1)}}},"search"),W=f(()=>{I(U())},"onSearch");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[o!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:o},void 0,!1),r!==null&&r.length===0&&(0,e.jsxDEV)(H,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:a("No vector indexes.")},void 0,!1),r!==null&&r.length>0&&(0,e.jsxDEV)(S,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-table",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("name")},void 0,!1),(0,e.jsxDEV)(d,{children:a("table")},void 0,!1),(0,e.jsxDEV)(d,{children:a("dimensions")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metric")},void 0,!1),(0,e.jsxDEV)(d,{children:a("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:r.map(t=>(0,e.jsxDEV)(p,{className:t.name===b?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:P,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.table},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.dimensions??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{children:t.metric??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.vectorsCount??"\u2014"},void 0,!1)]},t.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsxDEV)(g,{label:a("field"),value:i.field},void 0,!1),(0,e.jsxDEV)(g,{label:a("dimensions"),value:i.dimensions},void 0,!1),(0,e.jsxDEV)(g,{label:a("metric"),value:i.metric},void 0,!1),(0,e.jsxDEV)(g,{label:a("vectors"),value:i.vectorsCount},void 0,!1)]},void 0,!0),i.metadata!==void 0&&i.metadata.length>0&&(0,e.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsxDEV)("span",{className:"font-mono",children:i.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)($,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:R,placeholder:a("Search by similarity\u2026"),value:N},void 0,!1),(0,e.jsxDEV)(A,{"data-testid":"vector-search",disabled:j||N.trim()==="",onClick:W,children:a(j?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),M!==null&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M},void 0,!1),h!==null&&h.length===0&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,e.jsxDEV)(S,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-matches",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("id")},void 0,!1),(0,e.jsxDEV)(d,{children:a("score")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.id},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.score.toFixed(4)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":K(t.metadata)},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser");export{oe as VectorBrowser};
|