@lunora/studio 1.0.0-alpha.31 → 1.0.0-alpha.33
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.js +10 -10
- package/dist/mount.js +3 -2
- package/dist/packem_chunks/ApiTab.js +3 -3
- package/dist/packem_chunks/AuditPanel.js +7 -7
- package/dist/packem_chunks/ExportImportPanel.js +5 -4
- package/dist/packem_chunks/FileBrowser.js +2 -2
- package/dist/packem_chunks/FunctionRunner.js +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +72 -70
- package/dist/packem_chunks/HealthPanel.js +3 -3
- package/dist/packem_chunks/InsightsPanel.js +4 -3
- package/dist/packem_chunks/LogsPanel.js +6 -6
- package/dist/packem_chunks/MailPanel.js +8 -7
- package/dist/packem_chunks/MetricsPanel.js +3 -3
- package/dist/packem_chunks/MigrationsPanel.js +7 -7
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +3 -2
- package/dist/packem_chunks/SecurityAdvisorPanel.js +11 -8
- package/dist/packem_chunks/SettingsPanel.js +50 -49
- package/dist/packem_chunks/SqlEditorPanel.js +5 -4
- package/dist/packem_chunks/TableEditor.js +3 -3
- 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 +1 -1
- package/dist/packem_chunks/dashboards-panel.js +3 -2
- package/dist/packem_chunks/fanout-panel.js +31 -30
- package/dist/packem_chunks/flags-panel.js +6 -6
- package/dist/packem_chunks/kv-browser.js +2 -2
- 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 +6 -5
- package/dist/packem_chunks/permissions-panel.js +12 -11
- package/dist/packem_chunks/queues-panel.js +32 -31
- package/dist/packem_chunks/rls-panel.js +86 -84
- package/dist/packem_chunks/schedule-panel.js +3 -3
- package/dist/packem_chunks/sparkline.js +1 -1
- package/dist/packem_chunks/storage-rules-panel.js +27 -25
- package/dist/packem_chunks/subscriptions-panel.js +33 -31
- 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 +2 -2
- package/dist/packem_shared/{ApiDocsPanel-B6u_wnz-.js → ApiDocsPanel-Cu6mD4u7.js} +1 -1
- package/dist/packem_shared/{ApiReferencePanel-Drz4UO0a.js → ApiReferencePanel-Co_wpRF2.js} +1 -1
- package/dist/packem_shared/{CommandPalette-B5BertvU.js → CommandPalette-BUPpbpMc.js} +1 -1
- package/dist/packem_shared/{DataBrowser-ANTHLWWh.js → DataBrowser-DSNK1tPg.js} +5 -5
- package/dist/packem_shared/{GlobalDataBrowser-CjgTG_wa.js → GlobalDataBrowser-ErfvIs1S.js} +3 -3
- package/dist/packem_shared/{HomePanel-BRcQVDby.js → HomePanel-DQk3P8xX.js} +3 -3
- package/dist/packem_shared/{OpenRpcReferencePanel-CspFdbUT.js → OpenRpcReferencePanel-DLWzrIx9.js} +1 -1
- package/dist/packem_shared/{ScheduledJobs-BEJXtsBn.js → ScheduledJobs-ClaNpZsg.js} +2 -2
- package/dist/packem_shared/{Studio-B1V0GxTz.js → Studio-CFTYGEUt.js} +4 -4
- package/dist/packem_shared/{StudioApp-CR0Tvy81.js → StudioApp-Cy9vUwVl.js} +1 -1
- package/dist/packem_shared/{advisor-view-DzqyvUU3.js → advisor-view-D3-U4kRR.js} +5 -5
- package/dist/packem_shared/alert-CdAET2K_.js +68 -0
- package/dist/packem_shared/{bar-chart-Bb__F5-u.js → bar-chart-DSwcWIRy.js} +4 -3
- package/dist/packem_shared/{browser-storage-d03UsV7v.js → browser-storage-tLOxkIHd.js} +3 -67
- package/dist/packem_shared/{data-grid-Dsg6nRjo.js → data-grid-Jz8FqQ2C.js} +1 -1
- package/dist/packem_shared/error-alert-BBT6D22d.js +114 -0
- package/dist/packem_shared/{grid-features-D7nNzBYm.js → grid-features-CUr8Z1_O.js} +1 -1
- package/dist/packem_shared/{home-panel-CRIs6x2j.js → home-panel-Bo-Mgrkn.js} +2 -2
- package/dist/packem_shared/{internal-FcNZ3beb.js → internal-DTsYVn-g.js} +30 -1
- package/dist/packem_shared/{reference-view-Doy1XlQq.js → reference-view-CSKyUyPl.js} +3 -2
- package/dist/packem_shared/{sparkline-KgMPHS4u.js → sparkline-BnA1kC9X.js} +1 -1
- package/dist/packem_shared/{studio-CQ-rtNhn.js → studio-Dg2e-dsR.js} +6 -5
- package/dist/packem_shared/{table-list-sidebar-VMo0ftxD.js → table-list-sidebar-B5psdSV1.js} +1 -1
- package/dist/packem_shared/{use-admin-query-BViPA3US.js → use-admin-query-BHPKmPuj.js} +2 -1
- package/dist/packem_shared/{use-auth-capabilities-BHkoBnbZ.js → use-auth-capabilities-C-VH0oJJ.js} +1 -1
- package/dist/standalone/{chunk-N4JI6VQD.js → chunk-25VHPD2I.js} +1 -1
- package/dist/standalone/chunk-2GGMGPEP.js +1 -0
- package/dist/standalone/{chunk-BHTPZS7L.js → chunk-3CJW6NWG.js} +1 -1
- package/dist/standalone/chunk-4H2OJBXO.js +1 -0
- package/dist/standalone/chunk-4LDOOKES.js +1 -0
- package/dist/standalone/chunk-4MLAVZP4.js +1 -0
- package/dist/standalone/chunk-55YA7ZZI.js +76 -0
- package/dist/standalone/chunk-5OH3VPZF.js +1 -0
- package/dist/standalone/chunk-5PQMXK24.js +1 -0
- package/dist/standalone/chunk-66DNF4AJ.js +1 -0
- package/dist/standalone/chunk-6GFEVKJP.js +1 -0
- package/dist/standalone/{chunk-ITLLHEVG.js → chunk-764T6X6X.js} +1 -1
- package/dist/standalone/chunk-7M3F6U4L.js +1 -0
- package/dist/standalone/{chunk-KGS7KM4A.js → chunk-7VF3IAAW.js} +1 -1
- package/dist/standalone/chunk-AJIUI7DD.js +1 -0
- package/dist/standalone/{chunk-5NSZVXCS.js → chunk-BACPICH6.js} +1 -1
- package/dist/standalone/chunk-BET2625I.js +1 -0
- package/dist/standalone/chunk-BQUQS7QN.js +1 -0
- package/dist/standalone/chunk-CKSHCYGC.js +2 -0
- package/dist/standalone/chunk-DCECRP45.js +1 -0
- package/dist/standalone/chunk-DFP2DADO.js +1 -0
- package/dist/standalone/chunk-DORBUITF.js +1 -0
- package/dist/standalone/chunk-DVKPRFIJ.js +1 -0
- package/dist/standalone/chunk-E6WUCLSI.js +1 -0
- package/dist/standalone/chunk-E7WLF6IU.js +1 -0
- package/dist/standalone/chunk-EVPLBWUT.js +8 -0
- package/dist/standalone/chunk-FCSPAJW4.js +1 -0
- package/dist/standalone/chunk-G2ICR3DL.js +1 -0
- package/dist/standalone/{chunk-2DS7JLWL.js → chunk-GJ6PGSES.js} +5 -5
- package/dist/standalone/chunk-GMSGZDDH.js +13 -0
- package/dist/standalone/chunk-GVRM4U6W.js +2 -0
- package/dist/standalone/chunk-GZDWDDXN.js +1 -0
- package/dist/standalone/chunk-ISJAJWYI.js +1 -0
- package/dist/standalone/{chunk-G2TFEWEQ.js → chunk-JIDZFLTB.js} +1 -1
- package/dist/standalone/{chunk-RMYA7NAH.js → chunk-K3GNLVYK.js} +1 -1
- package/dist/standalone/chunk-K4ZDRTQM.js +1 -0
- package/dist/standalone/{chunk-ASLGNHAX.js → chunk-LI43EKM6.js} +1 -1
- package/dist/standalone/chunk-MFPTVCJ6.js +1 -0
- package/dist/standalone/chunk-MPYFGAOW.js +1 -0
- package/dist/standalone/{chunk-TICVNLPM.js → chunk-O3NAGRTR.js} +1 -1
- package/dist/standalone/chunk-PA3LN4XJ.js +1 -0
- package/dist/standalone/{chunk-7PBZKXYA.js → chunk-PN5NCZDX.js} +1 -1
- package/dist/standalone/{chunk-YJGANMU7.js → chunk-PVZI3CXP.js} +10 -9
- package/dist/standalone/chunk-PZ7HD5T2.js +1 -0
- package/dist/standalone/{chunk-UGMRUEBU.js → chunk-QAFAJBAW.js} +1 -1
- package/dist/standalone/{chunk-6VTGE3WJ.js → chunk-QBAT52GB.js} +1 -1
- package/dist/standalone/chunk-QHIIRFG7.js +1 -0
- package/dist/standalone/chunk-RSEEHNFI.js +1 -0
- package/dist/standalone/{chunk-3BP4BTLR.js → chunk-SGDQIWAR.js} +3 -3
- package/dist/standalone/chunk-SYEIXTEU.js +1 -0
- package/dist/standalone/chunk-T5HRXUSY.js +1 -0
- package/dist/standalone/{chunk-OD2POGPJ.js → chunk-TDL7NEWA.js} +1 -1
- package/dist/standalone/chunk-TM7CMA7X.js +1 -0
- package/dist/standalone/chunk-U4OAQPBT.js +1 -0
- package/dist/standalone/chunk-UDSVXA42.js +1 -0
- package/dist/standalone/chunk-UK64ZSUW.js +1 -0
- package/dist/standalone/chunk-VEZO7G5Q.js +3 -0
- package/dist/standalone/chunk-VSHUSN6T.js +1 -0
- package/dist/standalone/chunk-VYMCCC6O.js +1 -0
- package/dist/standalone/{chunk-7RYIQKZA.js → chunk-WXPWVBIY.js} +1 -1
- package/dist/standalone/chunk-X72PYOEW.js +1 -0
- package/dist/standalone/chunk-X7MMBSNW.js +1 -0
- package/dist/standalone/{chunk-6RC6L33K.js → chunk-XIGIWZLO.js} +3 -3
- package/dist/standalone/chunk-XNJNSCLM.js +1 -0
- package/dist/standalone/{chunk-NNISYDNI.js → chunk-XUGSA2NG.js} +1 -1
- package/dist/standalone/{chunk-VXBZQIGY.js → chunk-Y2ZPNDL7.js} +1 -1
- package/dist/standalone/chunk-YM6BBZDN.js +1 -0
- package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
- package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
- package/dist/standalone/studio.js +30 -30
- package/dist/styles.css +1 -1
- package/package.json +6 -5
- package/dist/standalone/chunk-2PDQ4KZ6.js +0 -1
- package/dist/standalone/chunk-45QK5ZPN.js +0 -1
- package/dist/standalone/chunk-57LYXHXH.js +0 -1
- package/dist/standalone/chunk-63XKJQTQ.js +0 -1
- package/dist/standalone/chunk-7POIIWC5.js +0 -3
- package/dist/standalone/chunk-AB6QGMBF.js +0 -1
- package/dist/standalone/chunk-D6ORSB24.js +0 -1
- package/dist/standalone/chunk-DGWTR4G7.js +0 -1
- package/dist/standalone/chunk-DSX53PBM.js +0 -1
- package/dist/standalone/chunk-DV2MNASX.js +0 -1
- package/dist/standalone/chunk-EGJX34WM.js +0 -1
- package/dist/standalone/chunk-FCR3HKFV.js +0 -1
- package/dist/standalone/chunk-FQKNJSRA.js +0 -76
- package/dist/standalone/chunk-GZXPPJVK.js +0 -1
- package/dist/standalone/chunk-HFBRE65A.js +0 -1
- package/dist/standalone/chunk-HG7Q5B3H.js +0 -1
- package/dist/standalone/chunk-HTQL7AXU.js +0 -1
- package/dist/standalone/chunk-KG3QTFWE.js +0 -1
- package/dist/standalone/chunk-KNRVPCFX.js +0 -1
- package/dist/standalone/chunk-KODWGUAB.js +0 -1
- package/dist/standalone/chunk-LZWPCZLE.js +0 -1
- package/dist/standalone/chunk-N2QDG3MW.js +0 -1
- package/dist/standalone/chunk-O4PXDNR3.js +0 -1
- package/dist/standalone/chunk-OXCK3ZUG.js +0 -1
- package/dist/standalone/chunk-P7DSVO4U.js +0 -1
- package/dist/standalone/chunk-PKAM3N5C.js +0 -1
- package/dist/standalone/chunk-QGXGBHQO.js +0 -1
- package/dist/standalone/chunk-QHA3TAEJ.js +0 -1
- package/dist/standalone/chunk-QQWC62X7.js +0 -1
- package/dist/standalone/chunk-S53RUBW5.js +0 -1
- package/dist/standalone/chunk-SB4GT6PK.js +0 -1
- package/dist/standalone/chunk-SHIOUDOT.js +0 -1
- package/dist/standalone/chunk-SIDRSX7Y.js +0 -1
- package/dist/standalone/chunk-VJPQUBN6.js +0 -8
- package/dist/standalone/chunk-VMJKJWG6.js +0 -1
- package/dist/standalone/chunk-VPDPN5RR.js +0 -2
- package/dist/standalone/chunk-VSEGZA3J.js +0 -1
- package/dist/standalone/chunk-W5LWN6IP.js +0 -1
- package/dist/standalone/chunk-W7PCVQTE.js +0 -1
- package/dist/standalone/chunk-W7SQVLBH.js +0 -1
- package/dist/standalone/chunk-XLILSHPE.js +0 -1
- package/dist/standalone/chunk-XURNGQSS.js +0 -1
- package/dist/standalone/chunk-YQQJ4N6U.js +0 -1
- package/dist/standalone/chunk-ZH7UES4T.js +0 -2
- package/dist/standalone/chunk-ZQCVDXDL.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k,b as j}from"./chunk-FKO3HO6I.js";import{a as D}from"./chunk-WXPWVBIY.js";import{a as O}from"./chunk-2K47A3P6.js";import{a as V}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as _,b as z,c as B,d as f,e as l,f as n}from"./chunk-GTM65MVX.js";import{a as M}from"./chunk-K3GNLVYK.js";import"./chunk-TBMYIZIO.js";import{R as L}from"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-AQGOX5DK.js";import{a as I}from"./chunk-TAD43CG5.js";import{b as A}from"./chunk-DVKPRFIJ.js";import{a as y,e as E}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C,n as R}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as i,e as w,f as ee,h as te}from"./chunk-RRCPZMC2.js";var o=w(ee(),1);var e=w(te(),1);var K=80,ae=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>K?`${t.slice(0,K)}\u2026`:t},"formatDetail"),re=41,F=480,U=5,oe=i((s,t)=>k(s,d=>{t(d.height>0?d:{height:F,width:d.width})}),"observeViewportRect"),Se=i(({initialShardKey:s})=>{let t=C(),[d,G]=(0,o.useState)(s??""),[m,W]=(0,o.useState)(""),q=O(d.trim(),400),{data:v,error:p,errorSource:J,isLoading:P,liveError:Q}=A(H.getAuditLog,{},{live:!0,shardKey:q}),u=(0,o.useMemo)(()=>v?.entries??[],[v]),c=(0,o.useMemo)(()=>{let r=m.trim().toLowerCase();return r===""?u:u.filter(a=>a.op.toLowerCase().includes(r)||(a.table??"").toLowerCase().includes(r)||(a.id??"").toLowerCase().includes(r))},[u,m]),g=(0,o.useRef)(null),x=j({count:c.length,estimateSize:i(()=>re,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:F,width:800},observeElementRect:oe,overscan:8}),h=x.getVirtualItems(),X=x.getTotalSize(),S=h[0]?.start??0,b=X-(h.at(-1)?.end??0),Z={height:S},$={height:b},Y=i(r=>{W(r.target.value)},"onSearchChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(M,{onChange:G,testId:"au-shard-input",value:d},void 0,!1),(0,e.jsxDEV)(D,{message:Q,prefix:"au"},void 0,!1),(0,e.jsxDEV)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m},void 0,!1)]},void 0,!0),p!==null&&(0,e.jsxDEV)(V,{error:J,testId:"au-error"},void 0,!1),p===null&&!P&&c.length===0&&(0,e.jsxDEV)(I,{description:t("State-changing admin operations are recorded 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:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"},void 0,!1)},void 0,!1),testId:"au-empty",title:t("No audit entries.")},void 0,!1),c.length>0&&(0,e.jsxDEV)(y,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:g,children:(0,e.jsxDEV)(_,{"data-testid":"au-table",children:[(0,e.jsxDEV)(z,{children:(0,e.jsxDEV)(f,{children:[(0,e.jsxDEV)(l,{children:t("time")},void 0,!1),(0,e.jsxDEV)(l,{children:t("op")},void 0,!1),(0,e.jsxDEV)(l,{children:t("table")},void 0,!1),(0,e.jsxDEV)(l,{children:t("id")},void 0,!1),(0,e.jsxDEV)(l,{children:t("detail")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(B,{children:[S>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:Z},void 0,!1)},void 0,!1),h.map(r=>{let a=c[r.index],N=ae(a.detail);return(0,e.jsxDEV)(f,{"data-testid":"au-row",children:[(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:R(a.ts,"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:a.op},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"font-medium",children:a.table??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[20ch] truncate font-mono text-xs",children:a.id??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:N||void 0,children:N||(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.seq,!0)}),b>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:$},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AuditPanel");export{Se as AuditPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as le}from"./chunk-MPYFGAOW.js";import{a as X}from"./chunk-AHILM3ZP.js";import{a as ae}from"./chunk-J6J54MBP.js";import{a as se}from"./chunk-2K47A3P6.js";import{a as G,b as W,c as Y,d as B,e as F,f as U}from"./chunk-GTM65MVX.js";import{a as z}from"./chunk-JSEXCW5Q.js";import{R as D}from"./chunk-3CJW6NWG.js";import{c as S}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as ee}from"./chunk-TAD43CG5.js";import{a as te}from"./chunk-DVKPRFIJ.js";import{a as V,e as j}from"./chunk-SEU5V7I6.js";import{b as E}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as $}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as M,g as Z,j as H,k as O,n as Q}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a,e as K,f as ge,g as Ne,h as we}from"./chunk-RRCPZMC2.js";var m=K(ge(),1);var t=K(we(),1),q=K(Ne(),1);var ke=a(({onClose:w,onCreated:e})=>{let i=$(),s=M(),[c,d]=(0,m.useState)(""),[u,l]=(0,m.useState)(""),[o,f]=(0,m.useState)(""),[k,I]=(0,m.useState)(""),[C,b]=(0,m.useState)(!1),[N,y]=(0,m.useState)(null),h=a(r=>{d(r.target.value)},"onEmailChange"),p=a(r=>{l(r.target.value)},"onNameChange"),x=a(r=>{f(r.target.value)},"onPasswordChange"),v=a(r=>{I(r.target.value)},"onRoleChange"),n=a(async()=>{b(!0),y(null);try{await i.createAuthUser({email:c.trim(),name:u.trim(),password:o===""?void 0:o,role:k.trim()===""?void 0:k.trim()}),e(),w()}catch(r){y(Z(r))}finally{b(!1)}},"submit"),A=a(()=>{O(n())},"onSubmit");return(0,t.jsxDEV)(X,{label:s("Create user"),onClose:w,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:s("Create user")},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-email",children:s("email")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-email",id:"uc-email",onChange:h,type:"email",value:c},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-name",children:s("name")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-name",id:"uc-name",onChange:p,value:u},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-password",children:s("Password (optional)")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-password",id:"uc-password",onChange:x,type:"password",value:o},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-role",children:s("Role (optional)")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-role",id:"uc-role",onChange:v,value:k},void 0,!1)]},void 0,!0),N!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:N},void 0,!1),(0,t.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsxDEV)(S,{"data-testid":"uc-cancel",onClick:w,size:"sm",type:"button",variant:"outline",children:s("Cancel")},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"uc-submit",disabled:C||c.trim()===""||u.trim()==="",onClick:A,size:"sm",type:"button",children:s(C?"Creating\u2026":"Create")},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserCreateDialog"),_=a(w=>{let e=(0,q.c)(2),{children:i}=w,s;return e[0]!==i?(s=(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i},void 0,!1),e[0]=i,e[1]=s):s=e[1],s},"SectionHeading"),Ce=a(w=>{let e=(0,q.c)(29),{busy:i,runAction:s,userId:c,version:d}=w,u=$(),l=M(),[o,f]=(0,m.useState)(null),[k,I]=(0,m.useState)(null),C;e[0]!==u||e[1]!==c?(C=a(()=>{O((async()=>{I(null);try{let r=await u.listAuthSessions({limit:50,userId:c});f(r.rows)}catch(r){let R=r;f(null),I(Z(R))}})())},"t1"),e[0]=u,e[1]=c,e[2]=C):C=e[2];let b;e[3]!==u||e[4]!==c||e[5]!==d?(b=[u,c,d],e[3]=u,e[4]=c,e[5]=d,e[6]=b):b=e[6],(0,m.useEffect)(C,b);let N;e[7]!==u||e[8]!==s?(N=a(r=>{s(()=>u.revokeAuthSession({sessionId:r}))},"t3"),e[7]=u,e[8]=s,e[9]=N):N=e[9];let y=N,h;e[10]!==l?(h=l("Sessions"),e[10]=l,e[11]=h):h=e[11];let p;e[12]!==h?(p=(0,t.jsxDEV)(_,{children:h},void 0,!1),e[12]=h,e[13]=p):p=e[13];let x;e[14]!==k?(x=k!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:k},void 0,!1),e[14]=k,e[15]=x):x=e[15];let v;e[16]!==o||e[17]!==l?(v=o!==null&&o.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:l("No active sessions.")},void 0,!1),e[16]=o,e[17]=l,e[18]=v):v=e[18];let n;e[19]!==i||e[20]!==y||e[21]!==o||e[22]!==l?(n=o!==null&&o.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"ud-sessions-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:l("expires")},void 0,!1),(0,t.jsxDEV)(F,{children:l("ip")},void 0,!1),(0,t.jsxDEV)(F,{children:l("user agent")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:o.map(r=>(0,t.jsxDEV)(B,{"data-testid":`ud-session-${r.id}`,children:[(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(r.expiresAt)},void 0,!1),(0,t.jsxDEV)(U,{children:r.ipAddress??""},void 0,!1),(0,t.jsxDEV)(U,{className:"max-w-40 truncate",children:r.userAgent??""},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`ud-revoke-${r.id}`,disabled:i,onClick:a(()=>{y(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Revoke")},void 0,!1)},void 0,!1)]},r.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=i,e[20]=y,e[21]=o,e[22]=l,e[23]=n):n=e[23];let A;return e[24]!==p||e[25]!==x||e[26]!==v||e[27]!==n?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[p,x,v,n]},void 0,!0),e[24]=p,e[25]=x,e[26]=v,e[27]=n,e[28]=A):A=e[28],A},"UserSessionsPanel"),Ae=a(w=>{let e=(0,q.c)(30),{busy:i,runAction:s,userId:c,version:d}=w,u=$(),l=M(),[o,f]=(0,m.useState)(null),[k,I]=(0,m.useState)(null),C;e[0]!==u||e[1]!==c?(C=a(()=>{O((async()=>{I(null);try{f(await u.listAuthAccounts({userId:c}))}catch(r){let R=r;f(null),I(Z(R))}})())},"t1"),e[0]=u,e[1]=c,e[2]=C):C=e[2];let b;e[3]!==u||e[4]!==c||e[5]!==d?(b=[u,c,d],e[3]=u,e[4]=c,e[5]=d,e[6]=b):b=e[6],(0,m.useEffect)(C,b);let N;e[7]!==u||e[8]!==s||e[9]!==c?(N=a(r=>{s(()=>u.unlinkAuthAccount({accountId:r,userId:c}))},"t3"),e[7]=u,e[8]=s,e[9]=c,e[10]=N):N=e[10];let y=N,h;e[11]!==l?(h=l("Linked accounts"),e[11]=l,e[12]=h):h=e[12];let p;e[13]!==h?(p=(0,t.jsxDEV)(_,{children:h},void 0,!1),e[13]=h,e[14]=p):p=e[14];let x;e[15]!==k?(x=k!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:k},void 0,!1),e[15]=k,e[16]=x):x=e[16];let v;e[17]!==o||e[18]!==l?(v=o!==null&&o.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:l("No linked accounts.")},void 0,!1),e[17]=o,e[18]=l,e[19]=v):v=e[19];let n;e[20]!==o||e[21]!==i||e[22]!==y||e[23]!==l?(n=o!==null&&o.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"ud-accounts-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:l("provider")},void 0,!1),(0,t.jsxDEV)(F,{children:l("created")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:o.map(r=>{let R=H(r.id);return(0,t.jsxDEV)(B,{"data-testid":`ud-account-${R}`,children:[(0,t.jsxDEV)(U,{children:H(r.providerId)},void 0,!1),(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(r.createdAt)},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`ud-unlink-${R}`,disabled:i,onClick:a(()=>{y(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Unlink")},void 0,!1)},void 0,!1)]},R,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=o,e[21]=i,e[22]=y,e[23]=l,e[24]=n):n=e[24];let A;return e[25]!==p||e[26]!==x||e[27]!==v||e[28]!==n?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[p,x,v,n]},void 0,!0),e[25]=p,e[26]=x,e[27]=v,e[28]=n,e[29]=A):A=e[29],A},"UserAccountsPanel"),Ie=a(w=>{let e=(0,q.c)(40),{busy:i,capabilities:s,runAction:c,userId:d,version:u}=w,l=$(),o=M(),[f,k]=(0,m.useState)(null),I;e[0]!==s.passkey||e[1]!==l||e[2]!==d?(I=a(()=>{s.passkey&&O((async()=>{try{k(await l.listAuthPasskeys({userId:d}))}catch{k(null)}})())},"t1"),e[0]=s.passkey,e[1]=l,e[2]=d,e[3]=I):I=e[3];let C;e[4]!==s.passkey||e[5]!==l||e[6]!==d||e[7]!==u?(C=[s.passkey,l,d,u],e[4]=s.passkey,e[5]=l,e[6]=d,e[7]=u,e[8]=C):C=e[8],(0,m.useEffect)(I,C);let b;e[9]!==l||e[10]!==c||e[11]!==d?(b=a(()=>{c(()=>l.disableAuthTwoFactor({userId:d}))},"t3"),e[9]=l,e[10]=c,e[11]=d,e[12]=b):b=e[12];let N=b,y;e[13]!==l||e[14]!==c?(y=a(R=>{c(()=>l.deleteAuthPasskey({passkeyId:R}))},"t4"),e[13]=l,e[14]=c,e[15]=y):y=e[15];let h=y,p;e[16]!==o?(p=o("Security"),e[16]=o,e[17]=p):p=e[17];let x;e[18]!==p?(x=(0,t.jsxDEV)(_,{children:p},void 0,!1),e[18]=p,e[19]=x):x=e[19];let v;e[20]!==i||e[21]!==s.twoFactor||e[22]!==N||e[23]!==o?(v=s.twoFactor&&(0,t.jsxDEV)(S,{"data-testid":"ud-disable-2fa",disabled:i,onClick:N,size:"sm",type:"button",variant:"outline",children:o("Disable two-factor")},void 0,!1),e[20]=i,e[21]=s.twoFactor,e[22]=N,e[23]=o,e[24]=v):v=e[24];let n;e[25]!==s.passkey||e[26]!==f||e[27]!==o?(n=s.passkey&&f!==null&&f.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o("No passkeys.")},void 0,!1),e[25]=s.passkey,e[26]=f,e[27]=o,e[28]=n):n=e[28];let A;e[29]!==i||e[30]!==s.passkey||e[31]!==h||e[32]!==f||e[33]!==o?(A=s.passkey&&f!==null&&f.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"ud-passkeys-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:o("name")},void 0,!1),(0,t.jsxDEV)(F,{children:o("created")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:f.map(R=>{let T=H(R.id);return(0,t.jsxDEV)(B,{"data-testid":`ud-passkey-${T}`,children:[(0,t.jsxDEV)(U,{children:H(R.name)||T},void 0,!1),(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(R.createdAt)},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`ud-delete-passkey-${T}`,disabled:i,onClick:a(()=>{h(T)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")},void 0,!1)},void 0,!1)]},T,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=i,e[30]=s.passkey,e[31]=h,e[32]=f,e[33]=o,e[34]=A):A=e[34];let r;return e[35]!==x||e[36]!==v||e[37]!==n||e[38]!==A?(r=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[x,v,n,A]},void 0,!0),e[35]=x,e[36]=v,e[37]=n,e[38]=A,e[39]=r):r=e[39],r},"UserSecurityPanel"),Se=/(?:at|expires)$/iu,Fe=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),Ue=a((w,e)=>typeof e=="number"&&Se.test(w)?Q(e):H(e),"formatField"),Re=a(({capabilities:w,onChanged:e,onClose:i,user:s})=>{let c=$(),d=M(),u=s.banned===!0,[l,o]=(0,m.useState)(null),[f,k]=(0,m.useState)(!1),[I,C]=(0,m.useState)(0),[b,N]=(0,m.useState)(typeof s.role=="string"?s.role:""),[y,h]=(0,m.useState)(""),[p,x]=(0,m.useState)(""),[v,n]=(0,m.useState)(""),[A,r]=(0,m.useState)(null),[R,T]=(0,m.useState)(!1),P=a((g,L)=>{O((async()=>{k(!0),o(null);try{let J=await g();L?.refresh!==!1&&(C(ye=>ye+1),e()),L?.onResult?.(J)}catch(J){o(Z(J))}finally{k(!1)}})())},"runAction"),ie=a(g=>{N(g.target.value)},"onRoleInputChange"),de=a(g=>{h(g.target.value)},"onBanReasonChange"),oe=a(g=>{x(g.target.value)},"onBanDaysChange"),ne=a(g=>{n(g.target.value)},"onNewPasswordChange"),re=a(()=>{let g=b.trim();g!==""&&P(async()=>{await c.setAuthUserRole({role:g,userId:s.id})})},"onSetRole"),ce=a(()=>{let g=Number.parseInt(p,10),L=Number.isFinite(g)&&g>0?g*86400:void 0;P(async()=>{await c.banAuthUser({expiresInSeconds:L,reason:y.trim()===""?void 0:y.trim(),userId:s.id})})},"onBan"),ue=a(()=>{P(async()=>{await c.unbanAuthUser({userId:s.id})})},"onUnban"),fe=a(()=>{P(async()=>{await c.setAuthUserPassword({newPassword:v,userId:s.id}),n("")})},"onSetPassword"),ve=a(()=>{P(()=>c.impersonateAuthUser({userId:s.id}),{onResult:a(g=>{r(g.token)},"onResult"),refresh:!1})},"onImpersonate"),me=a(()=>{P(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"onRevokeAll"),he=a(()=>{P(async()=>{await c.removeAuthUser({userId:s.id}),i()})},"onDelete"),pe=a(()=>{T(!0)},"onConfirmDelete"),xe=a(()=>{T(!1)},"onCancelDelete"),be=Object.entries(s).filter(([g])=>!Fe.has(g));return(0,t.jsxDEV)(X,{label:d("User details"),onClose:i,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id},void 0,!1),(0,t.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsxDEV)(E,{variant:"secondary",children:s.role},void 0,!1),u?(0,t.jsxDEV)(E,{variant:"destructive",children:d("Banned")},void 0,!1):(0,t.jsxDEV)(E,{variant:"outline",children:d("Active")},void 0,!1),s.emailVerified===!0?(0,t.jsxDEV)(E,{variant:"secondary",children:d("verified")},void 0,!1):(0,t.jsxDEV)(E,{variant:"outline",children:d("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-close",onClick:i,size:"sm",type:"button",variant:"ghost",children:d("Close")},void 0,!1)]},void 0,!0),l!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:l},void 0,!1),w.admin&&(0,t.jsxDEV)(V,{className:"gap-0 py-0",children:[(0,t.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Actions")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(j,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-role",children:d("Role")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-role-input",id:"ud-role",onChange:ie,value:b},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-set-role",disabled:f||b.trim()==="",onClick:re,size:"sm",type:"button",variant:"outline",children:d("Set role")},void 0,!1)]},void 0,!0),u?(0,t.jsxDEV)(S,{"data-testid":"ud-unban",disabled:f,onClick:ue,size:"sm",type:"button",variant:"outline",children:d("Unban")},void 0,!1):(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-ban-reason",children:d("Ban reason (optional)")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:de,value:y},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-ban-days",children:d("Days")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:oe,type:"number",value:p},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-ban",disabled:f,onClick:ce,size:"sm",type:"button",variant:"destructive",children:d("Ban user")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-password",children:d("New password")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-password",id:"ud-password",onChange:ne,type:"password",value:v},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-set-password",disabled:f||v==="",onClick:fe,size:"sm",type:"button",variant:"outline",children:d("Set password")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxDEV)(S,{"data-testid":"ud-impersonate",disabled:f,onClick:ve,size:"sm",type:"button",variant:"outline",children:d("Impersonate")},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"ud-revoke-all",disabled:f,onClick:me,size:"sm",type:"button",variant:"outline",children:d("Revoke all sessions")},void 0,!1),R?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(S,{"data-testid":"ud-delete-confirm",disabled:f,onClick:he,size:"sm",type:"button",variant:"destructive",children:d("Confirm delete")},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"ud-delete-cancel",onClick:xe,size:"sm",type:"button",variant:"ghost",children:d("Cancel")},void 0,!1)]},void 0,!0):(0,t.jsxDEV)(S,{"data-testid":"ud-delete",disabled:f,onClick:pe,size:"sm",type:"button",variant:"destructive",children:d("Delete user")},void 0,!1)]},void 0,!0),A!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-token",children:d("Impersonation token")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(Ce,{busy:f,runAction:P,userId:s.id,version:I},void 0,!1),w.accounts&&(0,t.jsxDEV)(Ae,{busy:f,runAction:P,userId:s.id,version:I},void 0,!1),(w.twoFactor||w.passkey)&&(0,t.jsxDEV)(Ie,{busy:f,capabilities:w,runAction:P,userId:s.id,version:I},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Fields")},void 0,!1),(0,t.jsxDEV)("dl",{className:"flex flex-col",children:be.map(([g,L])=>(0,t.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:g},void 0,!1),(0,t.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:Ue(g,L)},void 0,!1)]},g,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),De=50,We=a(({pageSize:w=De}={})=>{let e=$(),i=M(),[s,c]=(0,m.useState)(""),[d,u]=(0,m.useState)(""),l=se(s),[o,f]=(0,m.useState)(null),[k,I]=(0,m.useState)(!1),{capabilities:C}=le(),b=l.trim(),N=d.trim(),y=te(["lunora-auth-users",b,N,w],()=>e.listAuthUsers({filterField:N===""?void 0:"role",filterValue:N===""?void 0:N,limit:w,search:b===""?void 0:b}),{keepPreviousData:!0}),h=y.data?.rows??null,p=y.error,x=a(()=>{y.refetch()},"reloadUsers");ae(()=>{y.refetch()},!0);let v=o===null?null:h?.find(n=>n.id===o)??null;return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(D,{"aria-label":i("Search users"),className:"w-56","data-testid":"us-search",onChange:a(n=>{c(n.target.value)},"onChange"),placeholder:i("Search by email or name\u2026"),value:s},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":i("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:a(n=>{u(n.target.value)},"onChange"),placeholder:i("Filter by role"),value:d},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"us-new",onClick:a(()=>{I(!0)},"onClick"),size:"sm",type:"button",children:i("New user")},void 0,!1)]},void 0,!0),p!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:p},void 0,!1),h!==null&&h.length===0&&(0,t.jsxDEV)(ee,{description:i("Users who sign up to your app will appear here."),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:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:i("No users.")},void 0,!1),h!==null&&h.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"us-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:i("id")},void 0,!1),(0,t.jsxDEV)(F,{children:i("email")},void 0,!1),(0,t.jsxDEV)(F,{children:i("name")},void 0,!1),(0,t.jsxDEV)(F,{children:i("role")},void 0,!1),(0,t.jsxDEV)(F,{children:i("status")},void 0,!1),(0,t.jsxDEV)(F,{children:i("verified")},void 0,!1),(0,t.jsxDEV)(F,{children:i("created")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":i("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:h.map(n=>(0,t.jsxDEV)(B,{"data-testid":`us-row-${n.id}`,children:[(0,t.jsxDEV)(U,{className:"font-mono text-xs",children:n.id},void 0,!1),(0,t.jsxDEV)(U,{children:n.email??""},void 0,!1),(0,t.jsxDEV)(U,{children:n.name??""},void 0,!1),(0,t.jsxDEV)(U,{children:typeof n.role=="string"&&n.role!==""?(0,t.jsxDEV)(E,{variant:"secondary",children:n.role},void 0,!1):""},void 0,!1),(0,t.jsxDEV)(U,{children:n.banned===!0?(0,t.jsxDEV)(E,{variant:"destructive",children:i("Banned")},void 0,!1):(0,t.jsxDEV)(E,{variant:"success",children:i("Active")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(U,{children:n.emailVerified===!0?(0,t.jsxDEV)(E,{variant:"success",children:i("yes")},void 0,!1):(0,t.jsxDEV)(E,{variant:"outline",children:i("no")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(n.createdAt)},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`us-manage-${n.id}`,onClick:a(()=>{f(n.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Manage")},void 0,!1)},void 0,!1)]},n.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),v!==null&&(0,t.jsxDEV)(Re,{capabilities:C,onChanged:x,onClose:a(()=>{f(null)},"onClose"),user:v},void 0,!1),k&&(0,t.jsxDEV)(ke,{onClose:a(()=>{I(!1)},"onClose"),onCreated:x},void 0,!1)]},void 0,!0)},"UsersPanel");export{We as UsersPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b,c as v,d as g,f as D}from"./chunk-X7MMBSNW.js";import{e as y,f as p,g as P,k as O}from"./chunk-PVZI3CXP.js";import{a as n,e as Q,f as N,g as _}from"./chunk-RRCPZMC2.js";var E=Q(_(),1);var c=Q(N(),1);var C=n((e,r,o)=>["lunora-admin",e,r,o.trim()],"adminQueryKey"),h=1e3,S=25,q=new Map,k=n(e=>{let r=Date.now(),o=(q.get(e)??[]).filter(s=>r-s<h);o.push(r),q.set(e,o),o.length===S&&(console.error(`[lunora-studio] possible request loop: ${e} fired ${String(S)}\xD7 in <1s \u2014 a render/effect is re-issuing this read unbounded.`),console.trace("[lunora-studio] request-loop call site"))},"noteQueryFetch");function R(e,r,o={}){let{enabled:s=!0,keepPreviousData:a=!1,staleTime:i=0}=o,t=g({enabled:s,queryFn:n(()=>(k(JSON.stringify(e)),r()),"trackedQueryFunction"),placeholderData:a?b:void 0,queryKey:e,staleTime:i});return{data:t.data,error:t.error?P(t.error):t.error,errorSource:t.error??void 0,isLoading:t.isLoading,liveError:void 0,refetch:n(()=>{O(t.refetch())},"refetch")}}n(R,"useClientQuery");function K(e,r,o={}){let s=D(),a=v(),{enabled:i=!0,keepPreviousData:u=!1,live:t=!1,shardKey:l="",staleTime:I}=o,d=C(e,r,l),L=R(d,()=>s.query(y(e),r,p(l)),{enabled:i,keepPreviousData:u,staleTime:I??(t?Number.POSITIVE_INFINITY:0)}),[T,f]=(0,c.useState)(void 0),F=JSON.stringify(d);return(0,c.useEffect)(()=>{if(!(!i||!t))return f(void 0),s.subscribe(y(e),r,m=>{f(void 0),a.setQueryData(d,m)},{...p(l),onError:n(m=>{f(m.message)},"onError")})},[F,i,t]),{...L,liveError:i&&t?T:void 0}}n(K,"useAdminQuery");var M=n(()=>{let e=(0,E.c)(2),r=v(),o;return e[0]!==r?(o=n((s,a,i)=>{let u=a===void 0?["lunora-admin",s]:C(s,a,i??"");O(r.invalidateQueries({queryKey:u}))},"t0"),e[0]=r,e[1]=o):o=e[1],o},"useInvalidateAdmin");export{R as a,K as b,M as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as $}from"./chunk-TQ36RWOP.js";import{a as M}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.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 j}from"./chunk-AQGOX5DK.js";import{b as H}from"./chunk-DVKPRFIJ.js";import{a as K,e as O}from"./chunk-SEU5V7I6.js";import{b as F}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as B}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.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(a=>{let e=(0,q.c)(68),{initialShardKey:z}=a,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 i;e[12]!==s.workerUrl||e[13]!==l?(i={label:l,value:s.workerUrl},e[12]=s.workerUrl,e[13]=l,e[14]=i):i=e[14],o.push(i)}if(s.environment!==void 0){let l;e[15]!==t?(l=t("Environment"),e[15]=t,e[16]=l):l=e[16];let i;e[17]!==s.environment||e[18]!==l?(i={label:l,value:s.environment},e[17]=s.environment,e[18]=l,e[19]=i):i=e[19],o.push(i)}if(s.deploymentId!==void 0){let l;e[20]!==t?(l=t("Deployment"),e[20]=t,e[21]=l):l=e[21];let i;e[22]!==s.deploymentId||e[23]!==l?(i={label:l,value:s.deploymentId},e[22]=s.deploymentId,e[23]=l,e[24]=i):i=e[24],o.push(i)}if(s.versionTag!==void 0){let l;e[25]!==t?(l=t("Version"),e[25]=t,e[26]=l):l=e[26];let i;e[27]!==s.versionTag||e[28]!==l?(i={label:l,value:s.versionTag},e[27]=s.versionTag,e[28]=l,e[29]=i):i=e[29],o.push(i)}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(a){return(0,r.jsxDEV)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsxDEV)("dt",{className:"text-muted-foreground",children:a.label},void 0,!1),(0,r.jsxDEV)("dd",{className:"truncate font-mono text-xs",title:a.value,children:a.value},void 0,!1)]},a.label,!0)}U(Z,"_temp");function ee(a){return(0,r.jsxDEV)(V,{"data-testid":"set-row",children:[(0,r.jsxDEV)(E,{className:"font-mono text-xs font-medium",children:a.name},void 0,!1),(0,r.jsxDEV)(E,{children:(0,r.jsxDEV)(F,{variant:Y[a.kind],children:a.bindingType??a.kind},void 0,!1)},void 0,!1),(0,r.jsxDEV)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:a.value??(0,r.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.name,!0)}U(ee,"_temp2");export{me as SettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as dt,b as nt,c as ct,d as ut,e as Me}from"./chunk-LI43EKM6.js";import{a as ft,b as mt,c as vt,d as ht,e as gt}from"./chunk-25VHPD2I.js";import"./chunk-DWDILV2E.js";import"./chunk-QBAT52GB.js";import{e as ot}from"./chunk-TQ36RWOP.js";import"./chunk-QAFAJBAW.js";import{a as it}from"./chunk-WXPWVBIY.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import"./chunk-55YA7ZZI.js";import"./chunk-BJGBHGK3.js";import"./chunk-UII66UVF.js";import{a as rt}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import{a as st,b as lt,c as at,d as je,e as $e,f as Te}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as tt}from"./chunk-K3GNLVYK.js";import{a as Ze,b as et}from"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as Oe}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as Pe}from"./chunk-AQGOX5DK.js";import{b as Ye}from"./chunk-DVKPRFIJ.js";import{a as B,b as Re,c as _e,d as Ve,e as P}from"./chunk-SEU5V7I6.js";import{b as Ke}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as Ue}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as Qe,e as Ge,f as Je,g as We,k as Xe,m as Ae}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as n,e as Be,f as pt,g as xt,h as bt}from"./chunk-RRCPZMC2.js";var Le=Be(xt(),1);var v=Be(pt(),1);var t=Be(bt(),1);var ze=n(l=>l>=100?"critical":l>=50?"warning":"good","performanceLevel"),He=n(l=>l<1?`${(l*1e3).toFixed(0)}\u03BCs`:l<1e3?`${l.toFixed(1)}ms`:`${(l/1e3).toFixed(2)}s`,"formatLatency"),Ee=n(l=>l>=1e9?`${(l/1e9).toFixed(1)}B`:l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:l.toLocaleString(),"formatCount"),Nt=n(l=>{let e=(0,Le.c)(3),{level:s}=l;if(s==="critical"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsxDEV)(Ke,{variant:"destructive",children:"Slow"},void 0,!1),e[0]=i):i=e[0],i}if(s==="warning"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(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]=i):i=e[1],i}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"),yt=n(l=>{let e=(0,Le.c)(152),{queryStats:s}=l,r=Qe(),[i,Q]=(0,v.useState)("totalTime"),C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=new Set,e[0]=C):C=e[0];let[h,T]=(0,v.useState)(C),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=n(o=>{o!==null&&Q(o)},"t2"),e[1]=p):p=e[1];let S=p,u;if(e[2]!==s||e[3]!==i){u=[...s];let o;e[5]!==i?(o=n((m,c)=>{switch(i){case"avgTime":return c.avgDurationMs-m.avgDurationMs;case"execCount":return c.execCount-m.execCount;case"rowsRead":return c.rowsRead-m.rowsRead;default:return c.totalDurationMs-m.totalDurationMs}},"t310"),e[5]=i,e[6]=o):o=e[6],u.sort(o),e[2]=s,e[3]=i,e[4]=u}else u=e[4];let g=u,$;e[7]!==s?($=s.filter(St),e[7]=s,e[8]=$):$=e[8];let j=$.length,H;e[9]!==s?(H=s.filter(wt),e[9]=s,e[10]=H):H=e[10];let d=H.length,_;e[11]!==s?(_=s.filter(qt),e[11]=s,e[12]=_):_=e[12];let U=_.length,O;e[13]===Symbol.for("react.memo_cache_sentinel")?(O=n(o=>{T(m=>{let c=new Set(m);return c.has(o)?c.delete(o):c.add(o),c})},"t6"),e[13]=O):O=e[13];let Fe=O;if(s.length===0){let o;e[14]!==r?(o=r("No query insights yet"),e[14]=r,e[15]=o):o=e[15];let m;e[16]!==o?(m=(0,t.jsxDEV)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:o},void 0,!1),e[16]=o,e[17]=m):m=e[17];let c;e[18]!==r?(c=r("Query insights appear once statements are executed against this shard."),e[18]=r,e[19]=c):c=e[19];let z;e[20]!==c?(z=(0,t.jsxDEV)("p",{className:"mt-1 text-sm",children:c},void 0,!1),e[20]=c,e[21]=z):z=e[21];let ke;return e[22]!==z||e[23]!==m?(ke=(0,t.jsxDEV)(B,{children:(0,t.jsxDEV)(P,{className:"py-12",children:(0,t.jsxDEV)("div",{className:"text-center text-muted-foreground",children:[m,z]},void 0,!0)},void 0,!1)},void 0,!1),e[22]=z,e[23]=m,e[24]=ke):ke=e[24],ke}let I;e[25]!==r?(I=r("Critical queries"),e[25]=r,e[26]=I):I=e[26];let f;e[27]!==I?(f=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(_e,{className:"text-sm font-medium",children:I},void 0,!1)},void 0,!1),e[27]=I,e[28]=f):f=e[28];let M;e[29]!==j?(M=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:j},void 0,!1),e[29]=j,e[30]=M):M=e[30];let D;e[31]!==r?(D=r(">100ms avg execution"),e[31]=r,e[32]=D):D=e[32];let R;e[33]!==D?(R=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:D},void 0,!1),e[33]=D,e[34]=R):R=e[34];let F;e[35]!==R||e[36]!==M?(F=(0,t.jsxDEV)(P,{children:[M,R]},void 0,!0),e[35]=R,e[36]=M,e[37]=F):F=e[37];let b;e[38]!==F||e[39]!==f?(b=(0,t.jsxDEV)(B,{children:[f,F]},void 0,!0),e[38]=F,e[39]=f,e[40]=b):b=e[40];let N;e[41]!==r?(N=r("Moderate queries"),e[41]=r,e[42]=N):N=e[42];let k;e[43]!==N?(k=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(_e,{className:"text-sm font-medium",children:N},void 0,!1)},void 0,!1),e[43]=N,e[44]=k):k=e[44];let A;e[45]!==d?(A=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:d},void 0,!1),e[45]=d,e[46]=A):A=e[46];let E;e[47]!==r?(E=r("50\u2013100ms avg execution"),e[47]=r,e[48]=E):E=e[48];let L;e[49]!==E?(L=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:E},void 0,!1),e[49]=E,e[50]=L):L=e[50];let a;e[51]!==A||e[52]!==L?(a=(0,t.jsxDEV)(P,{children:[A,L]},void 0,!0),e[51]=A,e[52]=L,e[53]=a):a=e[53];let w;e[54]!==k||e[55]!==a?(w=(0,t.jsxDEV)(B,{children:[k,a]},void 0,!0),e[54]=k,e[55]=a,e[56]=w):w=e[56];let x;e[57]!==r?(x=r("Fast queries"),e[57]=r,e[58]=x):x=e[58];let y;e[59]!==x?(y=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(_e,{className:"text-sm font-medium",children:x},void 0,!1)},void 0,!1),e[59]=x,e[60]=y):y=e[60];let K;e[61]!==U?(K=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:U},void 0,!1),e[61]=U,e[62]=K):K=e[62];let V;e[63]!==r?(V=r("<50ms avg execution"),e[63]=r,e[64]=V):V=e[64];let G;e[65]!==V?(G=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:V},void 0,!1),e[65]=V,e[66]=G):G=e[66];let J;e[67]!==K||e[68]!==G?(J=(0,t.jsxDEV)(P,{children:[K,G]},void 0,!0),e[67]=K,e[68]=G,e[69]=J):J=e[69];let W;e[70]!==y||e[71]!==J?(W=(0,t.jsxDEV)(B,{children:[y,J]},void 0,!0),e[70]=y,e[71]=J,e[72]=W):W=e[72];let X;e[73]!==b||e[74]!==w||e[75]!==W?(X=(0,t.jsxDEV)("div",{className:"grid gap-4 md:grid-cols-3",children:[b,w,W]},void 0,!0),e[73]=b,e[74]=w,e[75]=W,e[76]=X):X=e[76];let Y;e[77]!==r?(Y=r("Query leaderboard"),e[77]=r,e[78]=Y):Y=e[78];let Z;e[79]!==Y?(Z=(0,t.jsxDEV)("h3",{className:"text-lg font-semibold",children:Y},void 0,!1),e[79]=Y,e[80]=Z):Z=e[80];let ee;e[81]!==i||e[82]!==r?(ee=r("Slow queries sorted by {sortField}",{sortField:r(i)}),e[81]=i,e[82]=r,e[83]=ee):ee=e[83];let te;e[84]!==ee?(te=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:ee},void 0,!1),e[84]=ee,e[85]=te):te=e[85];let re;e[86]!==Z||e[87]!==te?(re=(0,t.jsxDEV)("div",{children:[Z,te]},void 0,!0),e[86]=Z,e[87]=te,e[88]=re):re=e[88];let se;e[89]!==r?(se=r("Sort by"),e[89]=r,e[90]=se):se=e[90];let le;e[91]!==se?(le=(0,t.jsxDEV)("span",{className:"text-sm text-muted-foreground",children:se},void 0,!1),e[91]=se,e[92]=le):le=e[92];let ae;e[93]!==r?(ae=r("Sort queries by"),e[93]=r,e[94]=ae):ae=e[94];let Ie;e[95]===Symbol.for("react.memo_cache_sentinel")?(Ie=(0,t.jsxDEV)(nt,{},void 0,!1),e[95]=Ie):Ie=e[95];let ie;e[96]!==ae?(ie=(0,t.jsxDEV)(ct,{"aria-label":ae,className:"w-[140px]","data-testid":"qi-sort",children:Ie},void 0,!1),e[96]=ae,e[97]=ie):ie=e[97];let oe;e[98]!==r?(oe=r("Total time"),e[98]=r,e[99]=oe):oe=e[99];let de;e[100]!==oe?(de=(0,t.jsxDEV)(Me,{value:"totalTime",children:oe},void 0,!1),e[100]=oe,e[101]=de):de=e[101];let ne;e[102]!==r?(ne=r("Avg time"),e[102]=r,e[103]=ne):ne=e[103];let ce;e[104]!==ne?(ce=(0,t.jsxDEV)(Me,{value:"avgTime",children:ne},void 0,!1),e[104]=ne,e[105]=ce):ce=e[105];let ue;e[106]!==r?(ue=r("Execution count"),e[106]=r,e[107]=ue):ue=e[107];let fe;e[108]!==ue?(fe=(0,t.jsxDEV)(Me,{value:"execCount",children:ue},void 0,!1),e[108]=ue,e[109]=fe):fe=e[109];let me;e[110]!==r?(me=r("Rows read"),e[110]=r,e[111]=me):me=e[111];let ve;e[112]!==me?(ve=(0,t.jsxDEV)(Me,{value:"rowsRead",children:me},void 0,!1),e[112]=me,e[113]=ve):ve=e[113];let he;e[114]!==de||e[115]!==ce||e[116]!==fe||e[117]!==ve?(he=(0,t.jsxDEV)(ut,{children:[de,ce,fe,ve]},void 0,!0),e[114]=de,e[115]=ce,e[116]=fe,e[117]=ve,e[118]=he):he=e[118];let ge;e[119]!==i||e[120]!==ie||e[121]!==he?(ge=(0,t.jsxDEV)(dt,{onValueChange:S,value:i,children:[ie,he]},void 0,!0),e[119]=i,e[120]=ie,e[121]=he,e[122]=ge):ge=e[122];let pe;e[123]!==le||e[124]!==ge?(pe=(0,t.jsxDEV)("div",{className:"flex items-center gap-2",children:[le,ge]},void 0,!0),e[123]=le,e[124]=ge,e[125]=pe):pe=e[125];let xe;e[126]!==re||e[127]!==pe?(xe=(0,t.jsxDEV)("div",{className:"flex items-center justify-between",children:[re,pe]},void 0,!0),e[126]=re,e[127]=pe,e[128]=xe):xe=e[128];let be;e[129]!==r?(be=r("Statements"),e[129]=r,e[130]=be):be=e[130];let Ne;e[131]!==be?(Ne=(0,t.jsxDEV)(_e,{children:be},void 0,!1),e[131]=be,e[132]=Ne):Ne=e[132];let ye;e[133]!==g.length||e[134]!==r?(ye=r("{count} tracked statements",{count:g.length}),e[133]=g.length,e[134]=r,e[135]=ye):ye=e[135];let Se;e[136]!==ye?(Se=(0,t.jsxDEV)(Ve,{children:ye},void 0,!1),e[136]=ye,e[137]=Se):Se=e[137];let we;e[138]!==Ne||e[139]!==Se?(we=(0,t.jsxDEV)(Re,{children:[Ne,Se]},void 0,!0),e[138]=Ne,e[139]=Se,e[140]=we):we=e[140];let qe;e[141]!==h||e[142]!==g||e[143]!==r?(qe=(0,t.jsxDEV)(P,{children:(0,t.jsxDEV)("div",{className:"space-y-2",children:g.map(o=>{let m=o.normalizedSql,c=h.has(m),z=ze(o.avgDurationMs);return(0,t.jsxDEV)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxDEV)("button",{"aria-expanded":c,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:n(()=>{Fe(m)},"onClick"),type:"button",children:[(0,t.jsxDEV)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsxDEV)(Nt,{level:z},void 0,!1),(0,t.jsxDEV)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:o.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:He(o.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:He(o.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:Ee(o.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),c&&(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:o.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:Ee(o.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:He(o.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:Ee(o.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:Ee(o.rowsWritten)},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},m,!0)})},void 0,!1)},void 0,!1),e[141]=h,e[142]=g,e[143]=r,e[144]=qe):qe=e[144];let Ce;e[145]!==we||e[146]!==qe?(Ce=(0,t.jsxDEV)(B,{children:[we,qe]},void 0,!0),e[145]=we,e[146]=qe,e[147]=Ce):Ce=e[147];let De;return e[148]!==X||e[149]!==xe||e[150]!==Ce?(De=(0,t.jsxDEV)("div",{className:"space-y-4","data-testid":"qi-root",children:[X,xe,Ce]},void 0,!0),e[148]=X,e[149]=xe,e[150]=Ce,e[151]=De):De=e[151],De},"QueryInsights");function St(l){return ze(l.avgDurationMs)==="critical"}n(St,"_temp");function wt(l){return ze(l.avgDurationMs)==="warning"}n(wt,"_temp2");function qt(l){return ze(l.avgDurationMs)==="good"}n(qt,"_temp3");var Ct=Ge(Pe.getMetrics),Tt=n(l=>{let e=Math.floor(l/1e3),s=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return s>0?`${s.toString()}h ${r.toString()}m`:r>0?`${r.toString()}m ${i.toString()}s`:`${i.toString()}s`},"formatDuration"),Rt=n((l,e)=>l?e:"overview","resolveTab"),_t=n((l,e)=>{let s=l+e;return s===0?"\u2014":`${(l/s*100).toFixed(1)}%`},"hitRate"),q=n(l=>{let e=(0,Le.c)(16),{chart:s,footer:r,label:i,testId:Q,value:C}=l,h;e[0]!==i?(h=(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i},void 0,!1),e[0]=i,e[1]=h):h=e[1];let T;e[2]!==Q||e[3]!==C?(T=(0,t.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":Q,children:C},void 0,!1),e[2]=Q,e[3]=C,e[4]=T):T=e[4];let p;e[5]!==s||e[6]!==T?(p=(0,t.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[T,s]},void 0,!0),e[5]=s,e[6]=T,e[7]=p):p=e[7];let S;e[8]!==h||e[9]!==p?(S=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[h,p]},void 0,!0),e[8]=h,e[9]=p,e[10]=S):S=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 g;return e[13]!==S||e[14]!==u?(g=(0,t.jsxDEV)(B,{className:"justify-between gap-0 py-0",children:[S,u]},void 0,!0),e[13]=S,e[14]=u,e[15]=g):g=e[15],g},"StatCard"),Kt=n(({initialShardKey:l})=>{let e=Ue(),s=Qe(),[r,i]=(0,v.useState)(l??""),[Q,C]=(0,v.useState)("overview"),[h,T]=(0,v.useState)([]),p=(0,v.useRef)(null),S=(0,v.useRef)(null),u=(0,v.useRef)(!0);(0,v.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let g=rt(r.trim(),400),{data:$,error:j,liveError:H}=Ye(Pe.getMetrics,{},{live:!0,shardKey:g}),d=$??null;(0,v.useEffect)(()=>{if($===void 0)return;et(g);let a=$,w=p.current,x=S.current!==null&&S.current!==a.shard;if(S.current=a.shard,p.current=a.requests,x){T([]);return}w!==null&&a.requests>=w&&T(y=>[...y,a.requests-w].slice(-30))},[$,g]);let[_,U]=(0,v.useState)(null),[O,Fe]=(0,v.useState)(!1),I=n(async()=>{Fe(!0);let a=mt(r,Ze());try{let w=await Promise.all(a.map(async x=>{try{let y=await e.query(Ct,{},Je(x));return{error:null,metrics:y,shard:x===""?y.shard:x}}catch(y){return{error:We(y),metrics:null,shard:x===""?"__root__":x}}}));u.current&&U(w)}finally{u.current&&Fe(!1)}},"aggregateAll"),f=_===null?null:ft(_),M=d===null||d.requests===0?"\u2014":`${(d.errors/d.requests*100).toFixed(1)}%`,D=h.length>0?h.at(-1):0,R=d?vt(d):{p90:0,p95:0},F=n(a=>a<=0?"\u2014":a<1?`${(a*1e3).toFixed(0)}\u03BCs`:a<1e3?`${a.toFixed(1)}ms`:`${(a/1e3).toFixed(2)}s`,"formatMs"),b=(0,v.useMemo)(()=>{if(!d||!("queryStats"in d))return;let a=d.queryStats;if(!(!a||!Array.isArray(a)))return ht(a)},[d]),N=Rt(b!==void 0,Q),k=n(()=>{Xe(I())},"runAggregate"),A=n(()=>{U(null)},"clearAggregate"),E=n(()=>{C("overview")},"switchToOverview"),L=n(()=>{C("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)(tt,{onChange:i,testId:"mt-shard-input",value:r},void 0,!1),(0,t.jsxDEV)(it,{message:H,prefix:"mt"},void 0,!1),(0,t.jsxDEV)(Oe,{"data-testid":"mt-aggregate",disabled:O,onClick:k,size:"sm",type:"button",variant:"secondary",children:s(O?"Aggregating\u2026":"All shards")},void 0,!1),_!==null&&(0,t.jsxDEV)(Oe,{"data-testid":"mt-aggregate-clear",onClick:A,size:"sm",type:"button",variant:"ghost",children:s("Hide")},void 0,!1),(0,t.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:ot,rel:"noreferrer",target:"_blank",children:s("Open in Cloudflare")},void 0,!1)]},void 0,!0),j!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:j},void 0,!1),b!==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 ${N==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:E,type:"button",children:s("Overview")},void 0,!1),(0,t.jsxDEV)("button",{className:`pb-2 text-sm font-medium transition-colors ${N==="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:[s("Query insights"),b.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:b.length},void 0,!1)]},void 0,!0)]},void 0,!0),N==="query-insights"&&b!==void 0&&(0,t.jsxDEV)(yt,{queryStats:b},void 0,!1),N==="overview"&&d!==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)(q,{chart:h.length>=2?(0,t.jsxDEV)(gt,{ariaLabel:s("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:h,testId:"mt-sparkline"},void 0,!1):void 0,footer:h.length>=2?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("span",{className:"font-semibold text-foreground",children:`+${D.toLocaleString()}`},void 0,!1)," ",s("last interval")]},void 0,!0):(0,t.jsxDEV)("span",{"data-testid":"mt-sparkline-empty",children:s("collecting samples\u2026")},void 0,!1),label:s("Requests"),testId:"mt-requests",value:d.requests},void 0,!1),(0,t.jsxDEV)(q,{footer:s("{rate} error rate",{rate:M}),label:s("Errors"),testId:"mt-errors",value:(0,t.jsxDEV)(t.Fragment,{children:[d.errors," (",M,")"]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(q,{footer:R.p90>0?`P90 ${F(R.p90)}`:void 0,label:s("P95 latency"),testId:"mt-p95",value:R.p95>0?F(R.p95):"\u2014"},void 0,!1),(0,t.jsxDEV)(q,{footer:d.cache===null?void 0:`${d.cache.entries.toLocaleString()} ${s("cache entries")}`,label:s("Database size"),testId:"mt-db-size",value:Ae(d.databaseSize)},void 0,!1),(0,t.jsxDEV)(q,{label:s("Shard"),testId:"mt-shard",value:d.shard},void 0,!1),(0,t.jsxDEV)(q,{label:s("Uptime"),testId:"mt-uptime",value:Tt(d.uptimeMs)},void 0,!1),(0,t.jsxDEV)(q,{label:s("Cache hit rate"),testId:"mt-cache",value:d.cache===null?s("no cache configured"):s("{rate} ({count} entries)",{count:d.cache.entries,rate:_t(d.cache.hits,d.cache.misses)})},void 0,!1)]},void 0,!0),N==="overview"&&d===null&&null,N==="overview"&&f!==null&&_!==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)(q,{label:s("Shards"),testId:"mt-agg-shards",value:f.failed>0?s("{reachable} reachable, {failed} unreachable",{failed:f.failed,reachable:f.reachable}):s("{reachable} reachable",{reachable:f.reachable})},void 0,!1),(0,t.jsxDEV)(q,{label:s("Total requests"),testId:"mt-agg-requests",value:f.totalRequests},void 0,!1),(0,t.jsxDEV)(q,{label:s("Total errors"),testId:"mt-agg-errors",value:f.totalErrors},void 0,!1),(0,t.jsxDEV)(q,{label:s("Total database size"),testId:"mt-agg-db-size",value:Ae(f.totalDatabaseSize)},void 0,!1),(0,t.jsxDEV)(q,{label:s("Combined cache hit rate"),testId:"mt-agg-cache",value:f.hitRate===null?s("no cache configured"):`${(f.hitRate*100).toFixed(1)}%`},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(B,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(P,{className:"px-0",children:(0,t.jsxDEV)(st,{"data-testid":"mt-agg-table",children:[(0,t.jsxDEV)(lt,{children:(0,t.jsxDEV)(je,{children:[(0,t.jsxDEV)($e,{children:s("shard")},void 0,!1),(0,t.jsxDEV)($e,{children:s("requests")},void 0,!1),(0,t.jsxDEV)($e,{children:s("errors")},void 0,!1),(0,t.jsxDEV)($e,{children:s("db size")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(at,{children:_.map(a=>(0,t.jsxDEV)(je,{"data-testid":`mt-agg-row-${a.shard}`,children:[(0,t.jsxDEV)(Te,{children:a.shard},void 0,!1),a.metrics===null?(0,t.jsxDEV)(Te,{className:"text-destructive",colSpan:3,children:a.error??s("unreachable")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(Te,{className:"tabular-nums",children:a.metrics.requests},void 0,!1),(0,t.jsxDEV)(Te,{className:"tabular-nums",children:a.metrics.errors},void 0,!1),(0,t.jsxDEV)(Te,{className:"tabular-nums",children:Ae(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{Kt as MetricsPanel};
|