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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +1 -1
  3. package/dist/mount.js +1 -1
  4. package/dist/packem_chunks/ApiTab.js +1 -1
  5. package/dist/packem_chunks/AuditPanel.js +1 -1
  6. package/dist/packem_chunks/ExportImportPanel.js +1 -1
  7. package/dist/packem_chunks/FileBrowser.js +1 -1
  8. package/dist/packem_chunks/FunctionRunner.js +1 -1
  9. package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
  10. package/dist/packem_chunks/HealthPanel.js +1 -1
  11. package/dist/packem_chunks/InsightsPanel.js +1 -1
  12. package/dist/packem_chunks/LogsPanel.js +1 -1
  13. package/dist/packem_chunks/MailPanel.js +1 -1
  14. package/dist/packem_chunks/MetricsPanel.js +1 -1
  15. package/dist/packem_chunks/MigrationsPanel.js +1 -1
  16. package/dist/packem_chunks/NotificationsPanel.js +1 -1
  17. package/dist/packem_chunks/PitrPanel.js +1 -1
  18. package/dist/packem_chunks/SchemaViewer.js +1 -1
  19. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
  20. package/dist/packem_chunks/SettingsPanel.js +1 -1
  21. package/dist/packem_chunks/SqlEditorPanel.js +1 -1
  22. package/dist/packem_chunks/TableEditor.js +1 -1
  23. package/dist/packem_chunks/agents-panel.js +1 -1
  24. package/dist/packem_chunks/auth-audit-panel.js +1 -1
  25. package/dist/packem_chunks/containers-panel.js +1 -1
  26. package/dist/packem_chunks/dashboards-panel.js +1 -1
  27. package/dist/packem_chunks/fanout-panel.js +1 -1
  28. package/dist/packem_chunks/flags-panel.js +1 -1
  29. package/dist/packem_chunks/issues-panel.js +1 -1
  30. package/dist/packem_chunks/kv-browser.js +1 -1
  31. package/dist/packem_chunks/organizations-panel.js +1 -1
  32. package/dist/packem_chunks/payments-panel.js +1 -1
  33. package/dist/packem_chunks/permissions-panel.js +1 -1
  34. package/dist/packem_chunks/queues-panel.js +1 -1
  35. package/dist/packem_chunks/rls-panel.js +1 -1
  36. package/dist/packem_chunks/storage-rules-panel.js +1 -1
  37. package/dist/packem_chunks/subscriptions-panel.js +1 -1
  38. package/dist/packem_chunks/traces-panel.js +1 -1
  39. package/dist/packem_chunks/users-panel.js +1 -1
  40. package/dist/packem_chunks/workflows-panel.js +1 -1
  41. package/dist/packem_shared/ADMIN_FUNCTIONS-CpgIo9pj.js +1 -0
  42. package/dist/packem_shared/{ApiDocsPanel-eJYZlylw.js → ApiDocsPanel-CjdsxN1t.js} +1 -1
  43. package/dist/packem_shared/{DataBrowser-B8J5lHjP.js → DataBrowser-Bfstz_au.js} +1 -1
  44. package/dist/packem_shared/{HomePanel-DL1HupAN.js → HomePanel-B8EFM4u3.js} +1 -1
  45. package/dist/packem_shared/{Studio-BWBclm_C.js → Studio-BDtS9C5g.js} +1 -1
  46. package/dist/packem_shared/{StudioApp-BFm73yVr.js → StudioApp-DjLzIO9E.js} +1 -1
  47. package/dist/packem_shared/{home-panel-B-8BCffw.js → home-panel-Cm88Nvqh.js} +1 -1
  48. package/dist/packem_shared/{studio-BHA7hnI3.js → studio-BmWFd-Rz.js} +1 -1
  49. package/dist/packem_shared/use-async-submit-DLNCqLFq.js +1 -0
  50. package/dist/packem_shared/use-auth-config-9S_K_W-G.js +1 -0
  51. package/dist/standalone/{chunk-EVN46TVV.js → chunk-2SHUN7KF.js} +1 -1
  52. package/dist/standalone/{chunk-C43X4M5U.js → chunk-3EXLKL6V.js} +1 -1
  53. package/dist/standalone/{chunk-KDOC2DP5.js → chunk-3KAERFMC.js} +1 -1
  54. package/dist/standalone/{chunk-GSPTEMYN.js → chunk-4XDMVUS5.js} +1 -1
  55. package/dist/standalone/{chunk-YD5NF6UT.js → chunk-5YWJNF5X.js} +1 -1
  56. package/dist/standalone/chunk-66YJ3IOZ.js +1 -0
  57. package/dist/standalone/{chunk-2F7G7IWQ.js → chunk-6CULAILE.js} +1 -1
  58. package/dist/standalone/{chunk-D7XXWV4E.js → chunk-6KHEBRBB.js} +1 -1
  59. package/dist/standalone/{chunk-4WLYA3XE.js → chunk-6WCIFGDW.js} +1 -1
  60. package/dist/standalone/{chunk-OHKRN65U.js → chunk-7RG3AKPY.js} +1 -1
  61. package/dist/standalone/{chunk-65OTWFS3.js → chunk-A2FPLOMJ.js} +1 -1
  62. package/dist/standalone/chunk-AADILRJW.js +14 -0
  63. package/dist/standalone/chunk-AADXUXZO.js +1 -0
  64. package/dist/standalone/{chunk-L7N7F3DA.js → chunk-ARI4JTIH.js} +1 -1
  65. package/dist/standalone/chunk-AVZGVZZ7.js +1 -0
  66. package/dist/standalone/{chunk-5U2THBI7.js → chunk-BDO4J5AP.js} +1 -1
  67. package/dist/standalone/{chunk-XSD4Y6SQ.js → chunk-BMQJ4CAO.js} +1 -1
  68. package/dist/standalone/{chunk-5L2MD6F6.js → chunk-CMUP7HPS.js} +1 -1
  69. package/dist/standalone/{chunk-QGKAJTQQ.js → chunk-CP7AUUOU.js} +1 -1
  70. package/dist/standalone/{chunk-UIS34ZPB.js → chunk-DX3RMFQU.js} +1 -1
  71. package/dist/standalone/{chunk-5OWIOACV.js → chunk-E2CJUP53.js} +1 -1
  72. package/dist/standalone/{chunk-FGTK44LR.js → chunk-EIT7ERYE.js} +1 -1
  73. package/dist/standalone/{chunk-35II7U25.js → chunk-EN2QAEO4.js} +1 -1
  74. package/dist/standalone/{chunk-QVEHPYA5.js → chunk-FLYO3XY5.js} +1 -1
  75. package/dist/standalone/{chunk-DVOBKIUX.js → chunk-FWCKM2CU.js} +1 -1
  76. package/dist/standalone/{chunk-VPAXCQ2Y.js → chunk-GITJXQOS.js} +1 -1
  77. package/dist/standalone/{chunk-SA3MDZC3.js → chunk-GP6IRITM.js} +1 -1
  78. package/dist/standalone/{chunk-VGHSEUEX.js → chunk-GXU3ATKS.js} +1 -1
  79. package/dist/standalone/{chunk-FPLGBHY4.js → chunk-H5Y5NQPL.js} +1 -1
  80. package/dist/standalone/{chunk-34UVAASH.js → chunk-HALNNKTC.js} +1 -1
  81. package/dist/standalone/{chunk-UNUU7CJJ.js → chunk-HK4OVYG3.js} +1 -1
  82. package/dist/standalone/{chunk-ZNNAGR6N.js → chunk-HQEMYD2K.js} +1 -1
  83. package/dist/standalone/{chunk-F6GOKFMU.js → chunk-HYT2ZUNP.js} +2 -2
  84. package/dist/standalone/{chunk-7RXOPYR5.js → chunk-I4WGRDL2.js} +1 -1
  85. package/dist/standalone/{chunk-P24JBHEZ.js → chunk-ISZSYNTI.js} +1 -1
  86. package/dist/standalone/chunk-JWG3VRGB.js +1 -0
  87. package/dist/standalone/{chunk-RAA2RGG6.js → chunk-KDYNM3GV.js} +1 -1
  88. package/dist/standalone/{chunk-T2JIUFOD.js → chunk-KP6JQSH2.js} +1 -1
  89. package/dist/standalone/{chunk-IDNNI63H.js → chunk-LSEZN2ZL.js} +1 -1
  90. package/dist/standalone/{chunk-LJDP7NRB.js → chunk-LU3GW7HI.js} +1 -1
  91. package/dist/standalone/chunk-MVGE3JJN.js +1 -0
  92. package/dist/standalone/chunk-MXSHWB3M.js +1 -0
  93. package/dist/standalone/{chunk-BEH5N5ZA.js → chunk-NG6LYBPJ.js} +1 -1
  94. package/dist/standalone/{chunk-HP2UCWND.js → chunk-NL2DZKFI.js} +1 -1
  95. package/dist/standalone/{chunk-EXFBIISG.js → chunk-OGVCXKRL.js} +1 -1
  96. package/dist/standalone/{chunk-EKRN4ZQM.js → chunk-OPC233PZ.js} +1 -1
  97. package/dist/standalone/{chunk-TLHJRWNK.js → chunk-P4CWOYFL.js} +1 -1
  98. package/dist/standalone/{chunk-QLJJ5YYZ.js → chunk-PRJ4RJDU.js} +1 -1
  99. package/dist/standalone/{chunk-XEDU5FO4.js → chunk-PUY3YDXI.js} +1 -1
  100. package/dist/standalone/{chunk-FGTABSAK.js → chunk-QZMR6MUG.js} +1 -1
  101. package/dist/standalone/{chunk-F5QWLENA.js → chunk-W6TE2I2D.js} +1 -1
  102. package/dist/standalone/{chunk-PF7V3G2Z.js → chunk-WCWYSOCN.js} +1 -1
  103. package/dist/standalone/{chunk-BNUJ7QMG.js → chunk-WEO3YVP6.js} +1 -1
  104. package/dist/standalone/{chunk-6DWCIIHE.js → chunk-XIZNYKOD.js} +1 -1
  105. package/dist/standalone/{chunk-3FUFEZ65.js → chunk-XS6Q6GGV.js} +1 -1
  106. package/dist/standalone/{chunk-XQBTNJUQ.js → chunk-Y3CQDULJ.js} +1 -1
  107. package/dist/standalone/{chunk-7J5N6DGQ.js → chunk-YCRMVBPW.js} +1 -1
  108. package/dist/standalone/{chunk-H7NIIBHH.js → chunk-Z2JPEI2V.js} +1 -1
  109. package/dist/standalone/studio.js +1 -1
  110. package/dist/styles.css +1 -1
  111. package/package.json +6 -6
  112. package/dist/packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js +0 -1
  113. package/dist/packem_shared/use-async-submit-H68GHPz8.js +0 -1
  114. package/dist/standalone/chunk-3QRTYSSX.js +0 -1
  115. package/dist/standalone/chunk-B43FTQJ7.js +0 -1
  116. package/dist/standalone/chunk-GXZAXNZI.js +0 -1
  117. package/dist/standalone/chunk-LE56LPNH.js +0 -13
  118. package/dist/standalone/chunk-PWWHP76O.js +0 -1
  119. package/dist/standalone/chunk-YI3WYUXK.js +0 -1
@@ -1 +1 @@
1
- import{a as R}from"./chunk-54MMVNPT.js";import{a as E}from"./chunk-F6GOKFMU.js";import"./chunk-SFDOII3B.js";import"./chunk-SMIESS7P.js";import"./chunk-T6VMSOBB.js";import{a as T}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b}from"./chunk-XSD4Y6SQ.js";import{a as A,b as j,c as I,d as g,e as c,f as a}from"./chunk-MIQTKZAR.js";import{a as y,e as N}from"./chunk-UZERI5YC.js";import"./chunk-7QIFDWQV.js";import"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as x}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as v}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as w}from"./chunk-XQCVZAGU.js";import{d as _,q as S}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as m,e as M,h as G}from"./chunk-3XIESWL4.js";var e=M(G(),1);var H=["subscriptions","events"],K={},k=new Set(["active","trialing"]),L=new Set(["past_due","unpaid"]),n=m((s,t)=>{if(s[t]!==void 0)return s[t];let p=s.__doc__;if(typeof p=="string")try{let o=JSON.parse(p);if(o!==null&&typeof o=="object"&&!Array.isArray(o))return o[t]}catch{}},"s"),i=m(s=>typeof s=="string"?s:typeof s=="number"||typeof s=="bigint"||typeof s=="boolean"?String(s):"","i"),U=m(s=>k.has(s)?"default":L.has(s)?"destructive":"outline","J"),te=m(({limit:s=100})=>{let t=_(),p=E(),{data:o}=b(v.listTables,K,{live:!0}),D=o!==void 0,O=Array.isArray(o)&&H.every(r=>o.some(l=>l.name===r)),f=p.payments&&O,d=b(v.readTablePage,{filters:[],limit:s,offset:0,orderBy:[],search:"",table:"subscriptions"},{enabled:f}),h=b(v.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"},{enabled:f});R(()=>{f&&(d.refetch(),h.refetch())},!0);let u=d.data?.rows??[],B=h.data?.rows??[],C=d.error??h.error,F=d.error===null?h.errorSource:d.errorSource,P=u.filter(r=>k.has(i(n(r,"state")))).length,J=B.toSorted((r,l)=>Number(n(l,"processedAt")??0)-Number(n(r,"processedAt")??0));return D&&!f?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(w,{description:t("No @lunora/payment tables found in this deployment. Declare the store tables (subscriptions, events, \u2026) in lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(y,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:P}),(0,e.jsx)(x,{variant:"default",children:t("{count} active",{count:P})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:u.length})})]})}),C===null?void 0:(0,e.jsx)(T,{error:F}),u.length===0&&!d.isLoading?(0,e.jsx)(w,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(y,{className:"overflow-hidden py-0",children:(0,e.jsx)(N,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(j,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(c,{children:t("Provider")}),(0,e.jsx)(c,{children:t("Reference")}),(0,e.jsx)(c,{children:t("Plan")}),(0,e.jsx)(c,{children:t("State")}),(0,e.jsx)(c,{children:t("Renews")})]})}),(0,e.jsx)(I,{children:u.map(r=>{let l=i(n(r,"state"));return(0,e.jsxs)(g,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(a,{children:i(n(r,"provider"))}),(0,e.jsx)(a,{children:i(n(r,"referenceId"))}),(0,e.jsx)(a,{children:i(n(r,"priceId"))}),(0,e.jsx)(a,{children:(0,e.jsx)(x,{variant:U(l),children:l})}),(0,e.jsx)(a,{children:S(n(r,"currentPeriodEnd"))})]},i(n(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(y,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(N,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(I,{children:J.map(r=>(0,e.jsxs)(g,{"data-testid":"payment-event-row",children:[(0,e.jsx)(a,{children:i(n(r,"provider"))}),(0,e.jsx)(a,{className:"font-medium",children:i(n(r,"type"))}),(0,e.jsx)(a,{className:"text-muted-foreground",children:i(n(r,"providerEventId"))}),(0,e.jsx)(a,{children:S(n(r,"processedAt"))})]},i(n(r,"providerEventId"))))})})})]})]})},"re");export{te as PaymentsPanel};
1
+ import{a as R}from"./chunk-54MMVNPT.js";import{a as E}from"./chunk-HYT2ZUNP.js";import"./chunk-SFDOII3B.js";import"./chunk-SMIESS7P.js";import"./chunk-T6VMSOBB.js";import{a as T}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b}from"./chunk-BMQJ4CAO.js";import{a as A,b as j,c as I,d as g,e as c,f as a}from"./chunk-MIQTKZAR.js";import{a as y,e as N}from"./chunk-UZERI5YC.js";import"./chunk-7QIFDWQV.js";import"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as x}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as v}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as w}from"./chunk-XQCVZAGU.js";import{d as _,q as S}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as m,e as M,h as G}from"./chunk-3XIESWL4.js";var e=M(G(),1);var H=["subscriptions","events"],K={},k=new Set(["active","trialing"]),L=new Set(["past_due","unpaid"]),n=m((s,t)=>{if(s[t]!==void 0)return s[t];let p=s.__doc__;if(typeof p=="string")try{let o=JSON.parse(p);if(o!==null&&typeof o=="object"&&!Array.isArray(o))return o[t]}catch{}},"s"),i=m(s=>typeof s=="string"?s:typeof s=="number"||typeof s=="bigint"||typeof s=="boolean"?String(s):"","i"),U=m(s=>k.has(s)?"default":L.has(s)?"destructive":"outline","J"),te=m(({limit:s=100})=>{let t=_(),p=E(),{data:o}=b(v.listTables,K,{live:!0}),D=o!==void 0,O=Array.isArray(o)&&H.every(r=>o.some(l=>l.name===r)),f=p.payments&&O,d=b(v.readTablePage,{filters:[],limit:s,offset:0,orderBy:[],search:"",table:"subscriptions"},{enabled:f}),h=b(v.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"},{enabled:f});R(()=>{f&&(d.refetch(),h.refetch())},!0);let u=d.data?.rows??[],B=h.data?.rows??[],C=d.error??h.error,F=d.error===null?h.errorSource:d.errorSource,P=u.filter(r=>k.has(i(n(r,"state")))).length,J=B.toSorted((r,l)=>Number(n(l,"processedAt")??0)-Number(n(r,"processedAt")??0));return D&&!f?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(w,{description:t("No @lunora/payment tables found in this deployment. Declare the store tables (subscriptions, events, \u2026) in lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(y,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:P}),(0,e.jsx)(x,{variant:"default",children:t("{count} active",{count:P})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:u.length})})]})}),C===null?void 0:(0,e.jsx)(T,{error:F}),u.length===0&&!d.isLoading?(0,e.jsx)(w,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(y,{className:"overflow-hidden py-0",children:(0,e.jsx)(N,{className:"px-0",children:(0,e.jsxs)(A,{children:[(0,e.jsx)(j,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(c,{children:t("Provider")}),(0,e.jsx)(c,{children:t("Reference")}),(0,e.jsx)(c,{children:t("Plan")}),(0,e.jsx)(c,{children:t("State")}),(0,e.jsx)(c,{children:t("Renews")})]})}),(0,e.jsx)(I,{children:u.map(r=>{let l=i(n(r,"state"));return(0,e.jsxs)(g,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(a,{children:i(n(r,"provider"))}),(0,e.jsx)(a,{children:i(n(r,"referenceId"))}),(0,e.jsx)(a,{children:i(n(r,"priceId"))}),(0,e.jsx)(a,{children:(0,e.jsx)(x,{variant:U(l),children:l})}),(0,e.jsx)(a,{children:S(n(r,"currentPeriodEnd"))})]},i(n(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(y,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(N,{className:"px-0",children:(0,e.jsx)(A,{children:(0,e.jsx)(I,{children:J.map(r=>(0,e.jsxs)(g,{"data-testid":"payment-event-row",children:[(0,e.jsx)(a,{children:i(n(r,"provider"))}),(0,e.jsx)(a,{className:"font-medium",children:i(n(r,"type"))}),(0,e.jsx)(a,{className:"text-muted-foreground",children:i(n(r,"providerEventId"))}),(0,e.jsx)(a,{children:S(n(r,"processedAt"))})]},i(n(r,"providerEventId"))))})})})]})]})},"re");export{te as PaymentsPanel};
@@ -1 +1 @@
1
- import{a as g}from"./chunk-XXQUMVWH.js";import{h as N,j,k}from"./chunk-4CGALXS3.js";import{a as w}from"./chunk-LE56LPNH.js";import{a as b,e as v,g as V,h as y}from"./chunk-3XIESWL4.js";var A=v(V(),1);var d=v(y(),1);var _=b(I=>{let e=(0,A.c)(26),{className:h,error:r,testId:u}=I,a,s,l,o,i,t,n;if(e[0]!==h||e[1]!==r||e[2]!==u){let x=j(r),f;e[10]!==r?(f=k(r),e[10]=r,e[11]=f):f=e[11],s=f,a=g,l=h,o=u,i="destructive";let c;e[12]!==r?(c=N(r),e[12]=r,e[13]=c):c=e[13],e[14]!==c?(t=(0,d.jsx)("p",{className:"font-medium",children:c}),e[14]=c,e[15]=t):t=e[15],n=x===void 0?null:(0,d.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:w(x)}),e[0]=h,e[1]=r,e[2]=u,e[3]=a,e[4]=s,e[5]=l,e[6]=o,e[7]=i,e[8]=t,e[9]=n}else a=e[3],s=e[4],l=e[5],o=e[6],i=e[7],t=e[8],n=e[9];let m;e[16]!==s?(m=s===void 0?null:(0,d.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:s,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[16]=s,e[17]=m):m=e[17];let p;return e[18]!==a||e[19]!==l||e[20]!==o||e[21]!==i||e[22]!==t||e[23]!==n||e[24]!==m?(p=(0,d.jsxs)(a,{className:l,testId:o,variant:i,children:[t,n,m]}),e[18]=a,e[19]=l,e[20]=o,e[21]=i,e[22]=t,e[23]=n,e[24]=m,e[25]=p):p=e[25],p},"D");export{_ as a};
1
+ import{a as g}from"./chunk-XXQUMVWH.js";import{h as N,j,k}from"./chunk-4CGALXS3.js";import{a as w}from"./chunk-AADILRJW.js";import{a as b,e as v,g as V,h as y}from"./chunk-3XIESWL4.js";var A=v(V(),1);var d=v(y(),1);var _=b(I=>{let e=(0,A.c)(26),{className:h,error:r,testId:u}=I,a,s,l,o,i,t,n;if(e[0]!==h||e[1]!==r||e[2]!==u){let x=j(r),f;e[10]!==r?(f=k(r),e[10]=r,e[11]=f):f=e[11],s=f,a=g,l=h,o=u,i="destructive";let c;e[12]!==r?(c=N(r),e[12]=r,e[13]=c):c=e[13],e[14]!==c?(t=(0,d.jsx)("p",{className:"font-medium",children:c}),e[14]=c,e[15]=t):t=e[15],n=x===void 0?null:(0,d.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:w(x)}),e[0]=h,e[1]=r,e[2]=u,e[3]=a,e[4]=s,e[5]=l,e[6]=o,e[7]=i,e[8]=t,e[9]=n}else a=e[3],s=e[4],l=e[5],o=e[6],i=e[7],t=e[8],n=e[9];let m;e[16]!==s?(m=s===void 0?null:(0,d.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:s,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[16]=s,e[17]=m):m=e[17];let p;return e[18]!==a||e[19]!==l||e[20]!==o||e[21]!==i||e[22]!==t||e[23]!==n||e[24]!==m?(p=(0,d.jsxs)(a,{className:l,testId:o,variant:i,children:[t,n,m]}),e[18]=a,e[19]=l,e[20]=o,e[21]=i,e[22]=t,e[23]=n,e[24]=m,e[25]=p):p=e[25],p},"D");export{_ as a};
@@ -1 +1 @@
1
- import{a as B}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as q}from"./chunk-XSD4Y6SQ.js";import{a as M,b as U,c as $,d as P,e as d,f as c}from"./chunk-MIQTKZAR.js";import{a as C,e as E}from"./chunk-UZERI5YC.js";import{b as T}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as z}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as G}from"./chunk-XQCVZAGU.js";import{d as _}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as R,e as O,g as L,h as V}from"./chunk-3XIESWL4.js";var J=O(L(),1);var r=O(V(),1);var H=["read","insert","update","delete"],W=R((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"q"),Q=R(e=>{let s=new Map;for(let l of e){let t=s.get(l.table)??{operations:new Set,procedures:[],table:l.table};t.operations.add(l.on),t.procedures.includes(l.procedure)||t.procedures.push(l.procedure),s.set(l.table,t)}return[...s.values()].toSorted((l,t)=>l.table.localeCompare(t.table))},"B"),ie=R(()=>{let e=(0,J.c)(49),s=_(),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let{data:t,error:S,errorSource:k}=q(z.rlsPolicies,l),p=t!==void 0,m,n,h,a,u,f,x,b,o;if(e[1]!==t||e[2]!==S||e[3]!==k||e[4]!==p||e[5]!==s){let F=Q(Array.isArray(t?.policies)?t.policies:[]),D;e[15]!==t?(D=Array.isArray(t?.roles)?t.roles:[],e[15]=t,e[16]=D):D=e[16],n=D,x="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==S||e[18]!==k?(o=S!==null&&(0,r.jsx)(B,{error:k,testId:"rls-error"}),e[17]=S,e[18]=k,e[19]=o):o=e[19],f="flex flex-col gap-2",m=C,h="overflow-hidden py-0";let I;e[20]!==s?(I=s("Policies"),e[20]=s,e[21]=I):I=e[21],e[22]!==I?(a=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:I})}),e[22]=I,e[23]=a):a=e[23],u=p&&F.length===0?(0,r.jsx)(G,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")}):(0,r.jsx)(E,{className:"px-0",children:(0,r.jsxs)(M,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(U,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Table")}),H.map(i=>(0,r.jsx)(d,{children:W(s,i)},i)),(0,r.jsx)(d,{children:s("Guarded by")})]})}),(0,r.jsx)($,{children:F.map(i=>(0,r.jsxs)(P,{"data-testid":`rls-table-${i.table}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:i.table}),H.map(K=>(0,r.jsx)(c,{children:i.operations.has(K)?(0,r.jsx)(T,{variant:"secondary",children:s("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},K)),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:i.procedures.join(", ")})]},i.table))})]})}),e[1]=t,e[2]=S,e[3]=k,e[4]=p,e[5]=s,e[6]=m,e[7]=n,e[8]=h,e[9]=a,e[10]=u,e[11]=f,e[12]=x,e[13]=b,e[14]=o}else m=e[6],n=e[7],h=e[8],a=e[9],u=e[10],f=e[11],x=e[12],b=e[13],o=e[14];let N;e[24]!==m||e[25]!==h||e[26]!==a||e[27]!==u?(N=(0,r.jsxs)(m,{className:h,children:[a,u]}),e[24]=m,e[25]=h,e[26]=a,e[27]=u,e[28]=N):N=e[28];let g;e[29]!==f||e[30]!==N?(g=(0,r.jsx)("section",{className:f,children:N}),e[29]=f,e[30]=N,e[31]=g):g=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let w;e[34]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[34]=y,e[35]=w):w=e[35];let v;e[36]!==p||e[37]!==n||e[38]!==s?(v=p&&n.length===0?(0,r.jsx)(G,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")}):(0,r.jsx)(E,{className:"px-0",children:(0,r.jsxs)(M,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(U,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Role")}),(0,r.jsx)(d,{children:s("Description")}),(0,r.jsx)(d,{children:s("Permissions")})]})}),(0,r.jsx)($,{children:n.map(Y)})]})}),e[36]=p,e[37]=n,e[38]=s,e[39]=v):v=e[39];let A;e[40]!==w||e[41]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(C,{className:"overflow-hidden py-0",children:[w,v]})}),e[40]=w,e[41]=v,e[42]=A):A=e[42];let j;return e[43]!==A||e[44]!==x||e[45]!==b||e[46]!==o||e[47]!==g?(j=(0,r.jsxs)("div",{className:x,"data-testid":b,children:[o,g,A]}),e[43]=A,e[44]=x,e[45]=b,e[46]=o,e[47]=g,e[48]=j):j=e[48],j},"ae");function X(e){return(0,r.jsx)(T,{variant:"outline",children:e},e)}R(X,"H");function Y(e){return(0,r.jsxs)(P,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(c,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(c,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)})})]},e.name)}R(Y,"L");export{ie as default};
1
+ import{a as B}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b as q}from"./chunk-BMQJ4CAO.js";import{a as M,b as U,c as $,d as P,e as d,f as c}from"./chunk-MIQTKZAR.js";import{a as C,e as E}from"./chunk-UZERI5YC.js";import{b as T}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as z}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as G}from"./chunk-XQCVZAGU.js";import{d as _}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as R,e as O,g as L,h as V}from"./chunk-3XIESWL4.js";var J=O(L(),1);var r=O(V(),1);var H=["read","insert","update","delete"],W=R((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"q"),Q=R(e=>{let s=new Map;for(let l of e){let t=s.get(l.table)??{operations:new Set,procedures:[],table:l.table};t.operations.add(l.on),t.procedures.includes(l.procedure)||t.procedures.push(l.procedure),s.set(l.table,t)}return[...s.values()].toSorted((l,t)=>l.table.localeCompare(t.table))},"B"),ie=R(()=>{let e=(0,J.c)(49),s=_(),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let{data:t,error:S,errorSource:k}=q(z.rlsPolicies,l),p=t!==void 0,m,n,h,a,u,f,x,b,o;if(e[1]!==t||e[2]!==S||e[3]!==k||e[4]!==p||e[5]!==s){let F=Q(Array.isArray(t?.policies)?t.policies:[]),D;e[15]!==t?(D=Array.isArray(t?.roles)?t.roles:[],e[15]=t,e[16]=D):D=e[16],n=D,x="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==S||e[18]!==k?(o=S!==null&&(0,r.jsx)(B,{error:k,testId:"rls-error"}),e[17]=S,e[18]=k,e[19]=o):o=e[19],f="flex flex-col gap-2",m=C,h="overflow-hidden py-0";let I;e[20]!==s?(I=s("Policies"),e[20]=s,e[21]=I):I=e[21],e[22]!==I?(a=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:I})}),e[22]=I,e[23]=a):a=e[23],u=p&&F.length===0?(0,r.jsx)(G,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")}):(0,r.jsx)(E,{className:"px-0",children:(0,r.jsxs)(M,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(U,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Table")}),H.map(i=>(0,r.jsx)(d,{children:W(s,i)},i)),(0,r.jsx)(d,{children:s("Guarded by")})]})}),(0,r.jsx)($,{children:F.map(i=>(0,r.jsxs)(P,{"data-testid":`rls-table-${i.table}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:i.table}),H.map(K=>(0,r.jsx)(c,{children:i.operations.has(K)?(0,r.jsx)(T,{variant:"secondary",children:s("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},K)),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:i.procedures.join(", ")})]},i.table))})]})}),e[1]=t,e[2]=S,e[3]=k,e[4]=p,e[5]=s,e[6]=m,e[7]=n,e[8]=h,e[9]=a,e[10]=u,e[11]=f,e[12]=x,e[13]=b,e[14]=o}else m=e[6],n=e[7],h=e[8],a=e[9],u=e[10],f=e[11],x=e[12],b=e[13],o=e[14];let N;e[24]!==m||e[25]!==h||e[26]!==a||e[27]!==u?(N=(0,r.jsxs)(m,{className:h,children:[a,u]}),e[24]=m,e[25]=h,e[26]=a,e[27]=u,e[28]=N):N=e[28];let g;e[29]!==f||e[30]!==N?(g=(0,r.jsx)("section",{className:f,children:N}),e[29]=f,e[30]=N,e[31]=g):g=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let w;e[34]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[34]=y,e[35]=w):w=e[35];let v;e[36]!==p||e[37]!==n||e[38]!==s?(v=p&&n.length===0?(0,r.jsx)(G,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")}):(0,r.jsx)(E,{className:"px-0",children:(0,r.jsxs)(M,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(U,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Role")}),(0,r.jsx)(d,{children:s("Description")}),(0,r.jsx)(d,{children:s("Permissions")})]})}),(0,r.jsx)($,{children:n.map(Y)})]})}),e[36]=p,e[37]=n,e[38]=s,e[39]=v):v=e[39];let A;e[40]!==w||e[41]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(C,{className:"overflow-hidden py-0",children:[w,v]})}),e[40]=w,e[41]=v,e[42]=A):A=e[42];let j;return e[43]!==A||e[44]!==x||e[45]!==b||e[46]!==o||e[47]!==g?(j=(0,r.jsxs)("div",{className:x,"data-testid":b,children:[o,g,A]}),e[43]=A,e[44]=x,e[45]=b,e[46]=o,e[47]=g,e[48]=j):j=e[48],j},"ae");function X(e){return(0,r.jsx)(T,{variant:"outline",children:e},e)}R(X,"H");function Y(e){return(0,r.jsxs)(P,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(c,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(c,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)})})]},e.name)}R(Y,"L");export{ie as default};
@@ -1,3 +1,3 @@
1
- import{a as nt}from"./chunk-SFDOII3B.js";import{e as Ee}from"./chunk-SMIESS7P.js";import{b as ke}from"./chunk-XSD4Y6SQ.js";import{a as T,e as He}from"./chunk-UZERI5YC.js";import{c as Ue}from"./chunk-FXCBF4XT.js";import{b as Fe}from"./chunk-THIXMMZD.js";import{a as D}from"./chunk-GXZAXNZI.js";import{f as We}from"./chunk-35II7U25.js";import{a as Ye}from"./chunk-XQCVZAGU.js";import{d as $,f as Qe,g as Xe,m as Se,n as et,o as tt,p as at}from"./chunk-4CGALXS3.js";import{a as m,e as Ve,f as ct,g as dt,h as mt,j as Be}from"./chunk-3XIESWL4.js";var S=Ve(dt(),1);var L=Ve(ct(),1);var n=Ve(mt(),1);var ut=Qe(D.studioFeatures),it={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},pt=m(t=>{if(t===null||typeof t!="object")return it;let e=t,s=m(a=>typeof e[a]=="boolean"?e[a]:!0,"a");return{analytics:s("analytics"),auth:s("auth"),containers:s("containers"),flags:s("flags"),kv:s("kv"),mail:s("mail"),payments:s("payments"),queues:s("queues"),scheduler:s("scheduler"),storage:s("storage"),vectors:s("vectors"),workflows:s("workflows")}},"ut"),ft=m(()=>{let t=(0,S.c)(3),e=We(),[s,a]=(0,L.useState)(it),r,l;return t[0]!==e?(r=m(()=>{Se((async()=>{try{a(pt(await e.query(ut,{},Xe(""))))}catch{}})())},"s"),l=[e],t[0]=e,t[1]=r,t[2]=l):(r=t[1],l=t[2]),(0,L.useEffect)(r,l),s},"pt"),ht=m(()=>{let t=(0,S.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"ft"),gt=m(t=>{let e=(0,S.c)(24),{group:s}=t,a=$(),r=Ee(),l;e[0]!==s.tab||e[1]!==r?(l=m(()=>{Se(r({to:`/${s.tab}`}))},"o"),e[0]=s.tab,e[1]=r,e[2]=l):l=e[2];let o=l,i=s.bindings.length,c;e[3]!==s.label?(c=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:s.label}),e[3]=s.label,e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,n.jsx)(ht,{}),e[5]=p):p=e[5];let d;e[6]!==c?(d=(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[c,p]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==a?(f=i===1?a("1 binding"):a("{count} bindings",{count:i}),e[8]=i,e[9]=a,e[10]=f):f=e[10];let u;e[11]!==f?(u=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let h;e[13]!==i||e[14]!==s.bindings?(h=i>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.bindings.map(yt)}),e[13]=i,e[14]=s.bindings,e[15]=h):h=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==h?(g=(0,n.jsxs)(He,{className:"flex flex-col gap-2 py-4",children:[d,u,h]}),e[16]=d,e[17]=u,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==s.testId||e[21]!==o||e[22]!==g?(x=(0,n.jsx)(T,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":s.testId,onClick:o,children:g}),e[20]=s.testId,e[21]=o,e[22]=g,e[23]=x):x=e[23],x},"ht"),st=["kv","files","vectors"],xt=m((t,e)=>[...t.filter(s=>s.tab!==e.tab),e].toSorted((s,a)=>st.indexOf(s.tab)-st.indexOf(a.tab)),"gt"),bt=m(()=>{let t=(0,S.c)(19),e=We(),s=ft(),a=$(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];let[l,o]=(0,L.useState)(r),i,c;if(t[1]!==e||t[2]!==s.kv||t[3]!==s.storage||t[4]!==s.vectors||t[5]!==a?(i=m(()=>{let g={cancelled:!1},x=[{enabled:s.kv,label:a("KV Namespaces"),load:m(async()=>(await e.listKvNamespaces()).map(vt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:s.storage,label:a("R2 Buckets"),load:m(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:s.vectors,label:a("Vectorize Indexes"),load:m(async()=>(await e.listVectorIndexes()).map(Nt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Se((async()=>{try{let y=await b.load();if(!g.cancelled){let k={bindings:y,label:b.label,tab:b.tab,testId:b.testId};o(A=>xt(A,k))}}catch{}})());return()=>{g.cancelled=!0}},"i"),c=[e,s.kv,s.storage,s.vectors,a],t[1]=e,t[2]=s.kv,t[3]=s.storage,t[4]=s.vectors,t[5]=a,t[6]=i,t[7]=c):(i=t[6],c=t[7]),(0,L.useEffect)(i,c),l.length===0)return null;let p;t[8]!==a?(p=a("Bindings"),t[8]=a,t[9]=p):p=t[9];let d;t[10]!==p?(d=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:p}),t[10]=p,t[11]=d):d=t[11];let f;t[12]!==l?(f=l.map(_t),t[12]=l,t[13]=f):f=t[13];let u;t[14]!==f?(u=(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let h;return t[16]!==d||t[17]!==u?(h=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=h):h=t[18],h},"xt");function yt(t){return(0,n.jsx)(Fe,{variant:"secondary",children:t},t)}m(yt,"bt");function vt(t){return t.binding}m(vt,"yt");function Nt(t){return t.name}m(Nt,"vt");function _t(t){return(0,n.jsx)(gt,{group:t},t.tab)}m(_t,"Nt");var St=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],kt=m(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"St"),wt=m(t=>{let e=St.map(s=>`- ${s.name} \u2014 ${s.summary}`).join(`
1
+ import{a as nt}from"./chunk-SFDOII3B.js";import{e as Ee}from"./chunk-SMIESS7P.js";import{b as ke}from"./chunk-BMQJ4CAO.js";import{a as T,e as He}from"./chunk-UZERI5YC.js";import{c as Ue}from"./chunk-FXCBF4XT.js";import{b as Fe}from"./chunk-THIXMMZD.js";import{a as D}from"./chunk-AADXUXZO.js";import{f as We}from"./chunk-EN2QAEO4.js";import{a as Ye}from"./chunk-XQCVZAGU.js";import{d as $,f as Qe,g as Xe,m as Se,n as et,o as tt,p as at}from"./chunk-4CGALXS3.js";import{a as m,e as Ve,f as ct,g as dt,h as mt,j as Be}from"./chunk-3XIESWL4.js";var S=Ve(dt(),1);var L=Ve(ct(),1);var n=Ve(mt(),1);var ut=Qe(D.studioFeatures),it={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},pt=m(t=>{if(t===null||typeof t!="object")return it;let e=t,s=m(a=>typeof e[a]=="boolean"?e[a]:!0,"a");return{analytics:s("analytics"),auth:s("auth"),containers:s("containers"),flags:s("flags"),kv:s("kv"),mail:s("mail"),payments:s("payments"),queues:s("queues"),scheduler:s("scheduler"),storage:s("storage"),vectors:s("vectors"),workflows:s("workflows")}},"ut"),ft=m(()=>{let t=(0,S.c)(3),e=We(),[s,a]=(0,L.useState)(it),r,l;return t[0]!==e?(r=m(()=>{Se((async()=>{try{a(pt(await e.query(ut,{},Xe(""))))}catch{}})())},"s"),l=[e],t[0]=e,t[1]=r,t[2]=l):(r=t[1],l=t[2]),(0,L.useEffect)(r,l),s},"pt"),ht=m(()=>{let t=(0,S.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"ft"),gt=m(t=>{let e=(0,S.c)(24),{group:s}=t,a=$(),r=Ee(),l;e[0]!==s.tab||e[1]!==r?(l=m(()=>{Se(r({to:`/${s.tab}`}))},"o"),e[0]=s.tab,e[1]=r,e[2]=l):l=e[2];let o=l,i=s.bindings.length,c;e[3]!==s.label?(c=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:s.label}),e[3]=s.label,e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,n.jsx)(ht,{}),e[5]=p):p=e[5];let d;e[6]!==c?(d=(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[c,p]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==a?(f=i===1?a("1 binding"):a("{count} bindings",{count:i}),e[8]=i,e[9]=a,e[10]=f):f=e[10];let u;e[11]!==f?(u=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let h;e[13]!==i||e[14]!==s.bindings?(h=i>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.bindings.map(yt)}),e[13]=i,e[14]=s.bindings,e[15]=h):h=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==h?(g=(0,n.jsxs)(He,{className:"flex flex-col gap-2 py-4",children:[d,u,h]}),e[16]=d,e[17]=u,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==s.testId||e[21]!==o||e[22]!==g?(x=(0,n.jsx)(T,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":s.testId,onClick:o,children:g}),e[20]=s.testId,e[21]=o,e[22]=g,e[23]=x):x=e[23],x},"ht"),st=["kv","files","vectors"],xt=m((t,e)=>[...t.filter(s=>s.tab!==e.tab),e].toSorted((s,a)=>st.indexOf(s.tab)-st.indexOf(a.tab)),"gt"),bt=m(()=>{let t=(0,S.c)(19),e=We(),s=ft(),a=$(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];let[l,o]=(0,L.useState)(r),i,c;if(t[1]!==e||t[2]!==s.kv||t[3]!==s.storage||t[4]!==s.vectors||t[5]!==a?(i=m(()=>{let g={cancelled:!1},x=[{enabled:s.kv,label:a("KV Namespaces"),load:m(async()=>(await e.listKvNamespaces()).map(vt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:s.storage,label:a("R2 Buckets"),load:m(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:s.vectors,label:a("Vectorize Indexes"),load:m(async()=>(await e.listVectorIndexes()).map(Nt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Se((async()=>{try{let y=await b.load();if(!g.cancelled){let k={bindings:y,label:b.label,tab:b.tab,testId:b.testId};o(A=>xt(A,k))}}catch{}})());return()=>{g.cancelled=!0}},"i"),c=[e,s.kv,s.storage,s.vectors,a],t[1]=e,t[2]=s.kv,t[3]=s.storage,t[4]=s.vectors,t[5]=a,t[6]=i,t[7]=c):(i=t[6],c=t[7]),(0,L.useEffect)(i,c),l.length===0)return null;let p;t[8]!==a?(p=a("Bindings"),t[8]=a,t[9]=p):p=t[9];let d;t[10]!==p?(d=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:p}),t[10]=p,t[11]=d):d=t[11];let f;t[12]!==l?(f=l.map(_t),t[12]=l,t[13]=f):f=t[13];let u;t[14]!==f?(u=(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let h;return t[16]!==d||t[17]!==u?(h=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=h):h=t[18],h},"xt");function yt(t){return(0,n.jsx)(Fe,{variant:"secondary",children:t},t)}m(yt,"bt");function vt(t){return t.binding}m(vt,"yt");function Nt(t){return t.name}m(Nt,"vt");function _t(t){return(0,n.jsx)(gt,{group:t},t.tab)}m(_t,"Nt");var St=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],kt=m(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"St"),wt=m(t=>{let e=St.map(s=>`- ${s.name} \u2014 ${s.summary}`).join(`
2
2
  `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
- `)},"kt"),Mt=1500,It=m(()=>{let t=(0,S.c)(35),e=$(),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=et(),t[0]=s):s=t[0];let a=s,[r,l]=(0,L.useState)(null),o,i;t[1]!==r?(o=m(()=>{if(r===null)return;let C=globalThis.setTimeout(()=>{l(null)},Mt);return()=>{globalThis.clearTimeout(C)}},"l"),i=[r],t[1]=r,t[2]=o,t[3]=i):(o=t[2],i=t[3]),(0,L.useEffect)(o,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=m((C,j)=>{tt(j)&&l(C)},"c"),t[4]=c):c=t[4];let p=c,d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=m(()=>{p("config",kt(a))},"d"),t[5]=d):d=t[5];let f=d,u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=m(()=>{p("prompt",wt(a))},"m"),t[6]=u):u=t[6];let h=u,g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let y;t[13]!==b?(y=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=y):y=t[14];let k;t[15]!==x||t[16]!==y?(k=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[x,y]}),t[15]=x,t[16]=y,t[17]=k):k=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let w;t[19]!==r||t[20]!==e?(w=e(r==="config"?"Copied":"Copy MCP config"),t[19]=r,t[20]=e,t[21]=w):w=t[21];let v;t[22]!==w?(v=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:w}),t[22]=w,t[23]=v):v=t[23];let M;t[24]!==r||t[25]!==e?(M=e(r==="prompt"?"Copied":"Copy agent prompt"),t[24]=r,t[25]=e,t[26]=M):M=t[26];let I;t[27]!==M?(I=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-prompt",onClick:h,size:"xs",variant:"outline",children:M}),t[27]=M,t[28]=I):I=t[28];let N;t[29]!==v||t[30]!==I?(N=(0,n.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[v,I]})]}),t[29]=v,t[30]=I,t[31]=N):N=t[31];let _;return t[32]!==k||t[33]!==N?(_=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[k,N]}),t[32]=k,t[33]=N,t[34]=_):_=t[34],_},"$t"),Lt=(0,L.lazy)(()=>import("./chunk-QLJJ5YYZ.js").then(t=>({default:t.Sparkline}))),Ze=m(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"Be"),At=m((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let a=Math.round(s/60);if(a<60)return`${String(a)}m ago`;let r=Math.round(a/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},"Mt"),rt=m((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let a of t)s.set(a.bucketMs,(s.get(a.bucketMs)??0)+a[e]);return[...s.entries()].toSorted(([a],[r])=>a-r).map(([,a])=>a)},"He"),lt=m((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),a=t.slice(0,s).reduce((o,i)=>o+i,0),r=t.slice(s).reduce((o,i)=>o+i,0);if(a===0)return null;let l=(r-a)/a*100;return{positive:e?l>=0:l<=0,text:`${l>=0?"+":""}${l.toFixed(1)}%`}},"Je"),Ke=m(t=>{let e=(0,S.c)(24),{delta:s,footer:a,label:r,trend:l,unit:o,value:i}=t,c=$(),p;e[0]!==r?(p=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=p):p=e[1];let d;e[2]!==i?(d=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==o?(f=o!==void 0&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let h;e[9]!==l?(h=l!==void 0&&(0,n.jsx)(L.Suspense,{fallback:(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,n.jsx)(Lt,{data:l})}),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==u||e[12]!==h?(g=(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,h]}),e[11]=u,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==p||e[15]!==g?(x=(0,n.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]}),e[14]=p,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==a||e[19]!==c?(b=s==null?a!=null&&(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:a}):(0,n.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,n.jsx)("span",{className:Be("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,n.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=a,e[19]=c,e[20]=b):b=e[20];let y;return e[21]!==x||e[22]!==b?(y=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23],y},"Oe"),Ct=m(()=>{let t=(0,S.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"At"),Je=m(t=>{let e=(0,S.c)(7),{command:s,label:a}=t,r;e[0]!==a?(r=(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:a})}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==s?(l=(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=l):l=e[3];let o;return e[4]!==r||e[5]!==l?(o=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[r,l]}),e[4]=r,e[5]=l,e[6]=o):o=e[6],o},"De"),ot=m(t=>{let e=(0,S.c)(18),{count:s,onView:a,testId:r,title:l}=t,o=$(),i;e[0]!==l?(i=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==o?(c=s===null?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o("No data yet")}):(0,n.jsx)(Fe,{variant:s>0?"destructive":"success",children:s>0?s:o("All clear")}),e[2]=s,e[3]=o,e[4]=c):c=e[4];let p;e[5]!==i||e[6]!==c?(p=(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=p):p=e[7];let d;e[8]!==o?(d=o("View"),e[8]=o,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsx)(Ct,{}),e[10]=f):f=e[10];let u;e[11]!==a||e[12]!==d?(u=(0,n.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:a,type:"button",children:[d,f]}),e[11]=a,e[12]=d,e[13]=u):u=e[13];let h;return e[14]!==p||e[15]!==u||e[16]!==r?(h=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":r,children:[p,u]}),e[14]=p,e[15]=u,e[16]=r,e[17]=h):h=e[17],h},"Ge"),$t=m(t=>{let e=(0,S.c)(7),{functions:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=[...s].toSorted(Kt).slice(0,5),o;e[3]!==a?(o=a("Top functions"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,l.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No functions called yet.")}):(0,n.jsxs)("div",{className:"divide-y divide-border",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,n.jsx)("span",{children:a("Function")}),(0,n.jsx)("span",{className:"text-end",children:a("Calls")}),(0,n.jsx)("span",{className:"w-12 text-end",children:a("Avg")}),(0,n.jsx)("span",{className:"w-8 text-end",children:a("Err")})]}),l.map(Rt)]})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"Ct"),jt=m(t=>{let e=(0,S.c)(26),{subs:s}=t,a=$(),r;e[0]!==a?(r=a("Live connections"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=l):l=e[3];let o=s?.totalConnections??0,i;e[4]!==o?(i=o.toLocaleString(),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let p;e[8]!==a?(p=a("sockets"),e[8]=a,e[9]=p):p=e[9];let d;e[10]!==p?(d=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:p}),e[10]=p,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];let u=s?.totalSubscriptions??0,h;e[15]!==u?(h=u.toLocaleString(),e[15]=u,e[16]=h):h=e[16];let g;e[17]!==a?(g=a("active subscriptions"),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,n.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==l||e[24]!==f?(b=(0,n.jsx)(T,{"data-testid":"home-live-connections",children:(0,n.jsxs)(He,{className:"flex flex-col gap-2.5 py-4",children:[l,f,x]})}),e[22]=x,e[23]=l,e[24]=f,e[25]=b):b=e[25],b},"It"),Tt=m(t=>{let e=(0,S.c)(7),{entries:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=Date.now(),o;e[3]!==a?(o=a("Recent activity"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,s.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No recent activity.")}):(0,n.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,n.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:At(c.ts,l)})]},c.seq))})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"jt"),Ot=m(t=>{let e=t.reduce((s,a)=>s+a.calls,0);return e===0?null:t.reduce((s,a)=>s+a.totalDurationMs,0)/e},"Tt"),Gt=m(t=>{let e=(0,S.c)(151),{initialShardKey:s}=t,a=$(),r=Ee(),l=s??"",o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==l?(i={shardKey:l},e[1]=l,e[2]=i):i=e[2];let c=ke(D.getMetrics,o,i),p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p={},e[3]=p):p=e[3];let d;e[4]!==l?(d={shardKey:l},e[4]=l,e[5]=d):d=e[5];let f=ke(D.getFunctionStats,p,d),u,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},h={shardKey:""},e[6]=u,e[7]=h):(u=e[6],h=e[7]);let g=ke(D.getSecurityAudit,u,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==l?(b={shardKey:l},e[9]=l,e[10]=b):b=e[10];let y=ke(D.listSubscriptions,x,b),k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k={},e[11]=k):k=e[11];let A;e[12]!==l?(A={shardKey:l},e[12]=l,e[13]=A):A=e[13];let w=ke(D.getAuditLog,k,A),v=c.data??null,M,I,N,_,C,j,P,O,K,V,W,E,R,q,B,F,U,H;if(e[14]!==w.data||e[15]!==g.data||e[16]!==v||e[17]!==c.data||e[18]!==r||e[19]!==f.data||e[20]!==y.data||e[21]!==a){_=Array.isArray(f.data?.functions)?f.data.functions:[],P=y.data??null;let Le;e[40]!==w.data?(Le=Array.isArray(w.data?.entries)?w.data.entries:[],e[40]=w.data,e[41]=Le):Le=e[41],I=Le,C=c.data===void 0||f.data===void 0?null:nt(v,_).length,j=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ae;e[42]!==r?(Ae=m(()=>{Se(r({to:"/security"}))},"Me"),e[42]=r,e[43]=Ae):Ae=e[43],H=Ae;let Ce;e[44]!==r?(Ce=m(()=>{Se(r({to:"/insights"}))},"Ae"),e[44]=r,e[45]=Ce):Ce=e[45],U=Ce;let $e=rt(v?.history,"calls"),je=rt(v?.history,"errors"),Ge=Ot(_),Te=Math.max(0,..._.map(qt)),z=v?.cache,Oe;e[46]!==z?(Oe=z!=null&&z.hits+z.misses>0?Math.round(z.hits/(z.hits+z.misses)*100):null,e[46]=z,e[47]=Oe):Oe=e[47],N=Oe,B="flex flex-col gap-6",F="lunora-home",W="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let qe=lt($e),ye;e[48]!==a?(ye=a("Requests"),e[48]=a,e[49]=ye):ye=e[49];let ze=v?.requests??0,ve;e[50]!==ze?(ve=ze.toLocaleString(),e[50]=ze,e[51]=ve):ve=e[51],e[52]!==$e||e[53]!==qe||e[54]!==ye||e[55]!==ve?(R=(0,n.jsx)(Ke,{delta:qe,label:ye,trend:$e,value:ve}),e[52]=$e,e[53]=qe,e[54]=ye,e[55]=ve,e[56]=R):R=e[56];let De=lt(je,!1),Ne;e[57]!==a?(Ne=a("Errors"),e[57]=a,e[58]=Ne):Ne=e[58];let Pe=v?.errors??0,_e;e[59]!==Pe?(_e=Pe.toLocaleString(),e[59]=Pe,e[60]=_e):_e=e[60],e[61]!==je||e[62]!==De||e[63]!==Ne||e[64]!==_e?(q=(0,n.jsx)(Ke,{delta:De,label:Ne,trend:je,value:_e}),e[61]=je,e[62]=De,e[63]=Ne,e[64]=_e,e[65]=q):q=e[65],M=Ke,e[66]!==Te||e[67]!==a?(O=Te>0?`${a("max")} ${Ze(Te)}`:void 0,e[66]=Te,e[67]=a,e[68]=O):O=e[68],e[69]!==a?(K=a("Avg latency"),e[69]=a,e[70]=K):K=e[70],V=Ge===null?"\u2014":Ze(Ge),e[14]=w.data,e[15]=g.data,e[16]=v,e[17]=c.data,e[18]=r,e[19]=f.data,e[20]=y.data,e[21]=a,e[22]=M,e[23]=I,e[24]=N,e[25]=_,e[26]=C,e[27]=j,e[28]=P,e[29]=O,e[30]=K,e[31]=V,e[32]=W,e[33]=E,e[34]=R,e[35]=q,e[36]=B,e[37]=F,e[38]=U,e[39]=H}else M=e[22],I=e[23],N=e[24],_=e[25],C=e[26],j=e[27],P=e[28],O=e[29],K=e[30],V=e[31],W=e[32],E=e[33],R=e[34],q=e[35],B=e[36],F=e[37],U=e[38],H=e[39];let J;e[71]!==M||e[72]!==O||e[73]!==K||e[74]!==V?(J=(0,n.jsx)(M,{footer:O,label:K,value:V}),e[71]=M,e[72]=O,e[73]=K,e[74]=V,e[75]=J):J=e[75];let Z;e[76]!==N||e[77]!==a?(Z=N===null?void 0:`${String(N)}% ${a("cache hit")}`,e[76]=N,e[77]=a,e[78]=Z):Z=e[78];let G;e[79]!==a?(G=a("Database size"),e[79]=a,e[80]=G):G=e[80];let Re=v?.databaseSize??null,Y;e[81]!==Re?(Y=at(Re),e[81]=Re,e[82]=Y):Y=e[82];let Q;e[83]!==Z||e[84]!==G||e[85]!==Y?(Q=(0,n.jsx)(Ke,{footer:Z,label:G,value:Y}),e[83]=Z,e[84]=G,e[85]=Y,e[86]=Q):Q=e[86];let X;e[87]!==W||e[88]!==E||e[89]!==R||e[90]!==q||e[91]!==J||e[92]!==Q?(X=(0,n.jsxs)("div",{className:W,"data-testid":E,children:[R,q,J,Q]}),e[87]=W,e[88]=E,e[89]=R,e[90]=q,e[91]=J,e[92]=Q,e[93]=X):X=e[93];let we;e[94]===Symbol.for("react.memo_cache_sentinel")?(we=(0,n.jsx)(bt,{}),e[94]=we):we=e[94];let ee;e[95]!==_?(ee=(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)($t,{functions:_})}),e[95]=_,e[96]=ee):ee=e[96];let te;e[97]!==P?(te=(0,n.jsx)(jt,{subs:P}),e[97]=P,e[98]=te):te=e[98];let ae;e[99]!==I?(ae=(0,n.jsx)(Tt,{entries:I}),e[99]=I,e[100]=ae):ae=e[100];let ne;e[101]!==te||e[102]!==ae?(ne=(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[te,ae]}),e[101]=te,e[102]=ae,e[103]=ne):ne=e[103];let se;e[104]!==ee||e[105]!==ne?(se=(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[ee,ne]}),e[104]=ee,e[105]=ne,e[106]=se):se=e[106];let re;e[107]!==a?(re=a("Advisors"),e[107]=a,e[108]=re):re=e[108];let le;e[109]!==re?(le=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:re}),e[109]=re,e[110]=le):le=e[110];let oe;e[111]!==C||e[112]!==j||e[113]!==a||e[114]!==U||e[115]!==H?(oe=j===0&&C===0?(0,n.jsx)(Ye,{description:a("No security or performance issues detected."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,n.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:a("No issues found")}):(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(ot,{count:j,onView:H,testId:"home-security",title:a("Security findings")}),(0,n.jsx)(ot,{count:C,onView:U,testId:"home-performance",title:a("Performance issues")})]}),e[111]=C,e[112]=j,e[113]=a,e[114]=U,e[115]=H,e[116]=oe):oe=e[116];let ie;e[117]!==le||e[118]!==oe?(ie=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[le,oe]}),e[117]=le,e[118]=oe,e[119]=ie):ie=e[119];let ce;e[120]!==a?(ce=a("Get connected"),e[120]=a,e[121]=ce):ce=e[121];let de;e[122]!==ce?(de=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ce}),e[122]=ce,e[123]=de):de=e[123];let me;e[124]!==a?(me=a("Client SDK"),e[124]=a,e[125]=me):me=e[125];let ue;e[126]!==me?(ue=(0,n.jsx)(Je,{command:"npm i @lunora/client",label:me}),e[126]=me,e[127]=ue):ue=e[127];let pe;e[128]!==a?(pe=a("React"),e[128]=a,e[129]=pe):pe=e[129];let fe;e[130]!==pe?(fe=(0,n.jsx)(Je,{command:"npm i @lunora/react",label:pe}),e[130]=pe,e[131]=fe):fe=e[131];let he;e[132]!==a?(he=a("CLI"),e[132]=a,e[133]=he):he=e[133];let ge;e[134]!==he?(ge=(0,n.jsx)(Je,{command:"lunora dev",label:he}),e[134]=he,e[135]=ge):ge=e[135];let xe;e[136]!==ue||e[137]!==fe||e[138]!==ge?(xe=(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[ue,fe,ge]}),e[136]=ue,e[137]=fe,e[138]=ge,e[139]=xe):xe=e[139];let Me;e[140]===Symbol.for("react.memo_cache_sentinel")?(Me=(0,n.jsx)(It,{}),e[140]=Me):Me=e[140];let be;e[141]!==de||e[142]!==xe?(be=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[de,xe,Me]}),e[141]=de,e[142]=xe,e[143]=be):be=e[143];let Ie;return e[144]!==B||e[145]!==F||e[146]!==X||e[147]!==se||e[148]!==ie||e[149]!==be?(Ie=(0,n.jsxs)("div",{className:B,"data-testid":F,children:[X,we,se,ie,be]}),e[144]=B,e[145]=F,e[146]=X,e[147]=se,e[148]=ie,e[149]=be,e[150]=Ie):Ie=e[150],Ie},"Zt");function Kt(t,e){return e.calls-t.calls}m(Kt,"Ot");function Rt(t){return(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,n.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,n.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,n.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Ze(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,n.jsx)("span",{className:Be("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}m(Rt,"Kt");function qt(t){return t.maxDurationMs}m(qt,"Rt");export{ft as a,Gt as b};
3
+ `)},"kt"),Mt=1500,It=m(()=>{let t=(0,S.c)(35),e=$(),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=et(),t[0]=s):s=t[0];let a=s,[r,l]=(0,L.useState)(null),o,i;t[1]!==r?(o=m(()=>{if(r===null)return;let C=globalThis.setTimeout(()=>{l(null)},Mt);return()=>{globalThis.clearTimeout(C)}},"l"),i=[r],t[1]=r,t[2]=o,t[3]=i):(o=t[2],i=t[3]),(0,L.useEffect)(o,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=m((C,j)=>{tt(j)&&l(C)},"c"),t[4]=c):c=t[4];let p=c,d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=m(()=>{p("config",kt(a))},"d"),t[5]=d):d=t[5];let f=d,u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=m(()=>{p("prompt",wt(a))},"m"),t[6]=u):u=t[6];let h=u,g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let y;t[13]!==b?(y=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=y):y=t[14];let k;t[15]!==x||t[16]!==y?(k=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[x,y]}),t[15]=x,t[16]=y,t[17]=k):k=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let w;t[19]!==r||t[20]!==e?(w=e(r==="config"?"Copied":"Copy MCP config"),t[19]=r,t[20]=e,t[21]=w):w=t[21];let v;t[22]!==w?(v=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:w}),t[22]=w,t[23]=v):v=t[23];let M;t[24]!==r||t[25]!==e?(M=e(r==="prompt"?"Copied":"Copy agent prompt"),t[24]=r,t[25]=e,t[26]=M):M=t[26];let I;t[27]!==M?(I=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-prompt",onClick:h,size:"xs",variant:"outline",children:M}),t[27]=M,t[28]=I):I=t[28];let N;t[29]!==v||t[30]!==I?(N=(0,n.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[v,I]})]}),t[29]=v,t[30]=I,t[31]=N):N=t[31];let _;return t[32]!==k||t[33]!==N?(_=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[k,N]}),t[32]=k,t[33]=N,t[34]=_):_=t[34],_},"$t"),Lt=(0,L.lazy)(()=>import("./chunk-PRJ4RJDU.js").then(t=>({default:t.Sparkline}))),Ze=m(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"Be"),At=m((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let a=Math.round(s/60);if(a<60)return`${String(a)}m ago`;let r=Math.round(a/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},"Mt"),rt=m((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let a of t)s.set(a.bucketMs,(s.get(a.bucketMs)??0)+a[e]);return[...s.entries()].toSorted(([a],[r])=>a-r).map(([,a])=>a)},"He"),lt=m((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),a=t.slice(0,s).reduce((o,i)=>o+i,0),r=t.slice(s).reduce((o,i)=>o+i,0);if(a===0)return null;let l=(r-a)/a*100;return{positive:e?l>=0:l<=0,text:`${l>=0?"+":""}${l.toFixed(1)}%`}},"Je"),Ke=m(t=>{let e=(0,S.c)(24),{delta:s,footer:a,label:r,trend:l,unit:o,value:i}=t,c=$(),p;e[0]!==r?(p=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=p):p=e[1];let d;e[2]!==i?(d=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==o?(f=o!==void 0&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let h;e[9]!==l?(h=l!==void 0&&(0,n.jsx)(L.Suspense,{fallback:(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,n.jsx)(Lt,{data:l})}),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==u||e[12]!==h?(g=(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,h]}),e[11]=u,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==p||e[15]!==g?(x=(0,n.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]}),e[14]=p,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==a||e[19]!==c?(b=s==null?a!=null&&(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:a}):(0,n.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,n.jsx)("span",{className:Be("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,n.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=a,e[19]=c,e[20]=b):b=e[20];let y;return e[21]!==x||e[22]!==b?(y=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23],y},"Oe"),Ct=m(()=>{let t=(0,S.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"At"),Je=m(t=>{let e=(0,S.c)(7),{command:s,label:a}=t,r;e[0]!==a?(r=(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:a})}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==s?(l=(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=l):l=e[3];let o;return e[4]!==r||e[5]!==l?(o=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[r,l]}),e[4]=r,e[5]=l,e[6]=o):o=e[6],o},"De"),ot=m(t=>{let e=(0,S.c)(18),{count:s,onView:a,testId:r,title:l}=t,o=$(),i;e[0]!==l?(i=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==o?(c=s===null?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o("No data yet")}):(0,n.jsx)(Fe,{variant:s>0?"destructive":"success",children:s>0?s:o("All clear")}),e[2]=s,e[3]=o,e[4]=c):c=e[4];let p;e[5]!==i||e[6]!==c?(p=(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=p):p=e[7];let d;e[8]!==o?(d=o("View"),e[8]=o,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsx)(Ct,{}),e[10]=f):f=e[10];let u;e[11]!==a||e[12]!==d?(u=(0,n.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:a,type:"button",children:[d,f]}),e[11]=a,e[12]=d,e[13]=u):u=e[13];let h;return e[14]!==p||e[15]!==u||e[16]!==r?(h=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":r,children:[p,u]}),e[14]=p,e[15]=u,e[16]=r,e[17]=h):h=e[17],h},"Ge"),$t=m(t=>{let e=(0,S.c)(7),{functions:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=[...s].toSorted(Kt).slice(0,5),o;e[3]!==a?(o=a("Top functions"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,l.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No functions called yet.")}):(0,n.jsxs)("div",{className:"divide-y divide-border",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,n.jsx)("span",{children:a("Function")}),(0,n.jsx)("span",{className:"text-end",children:a("Calls")}),(0,n.jsx)("span",{className:"w-12 text-end",children:a("Avg")}),(0,n.jsx)("span",{className:"w-8 text-end",children:a("Err")})]}),l.map(Rt)]})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"Ct"),jt=m(t=>{let e=(0,S.c)(26),{subs:s}=t,a=$(),r;e[0]!==a?(r=a("Live connections"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=l):l=e[3];let o=s?.totalConnections??0,i;e[4]!==o?(i=o.toLocaleString(),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let p;e[8]!==a?(p=a("sockets"),e[8]=a,e[9]=p):p=e[9];let d;e[10]!==p?(d=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:p}),e[10]=p,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];let u=s?.totalSubscriptions??0,h;e[15]!==u?(h=u.toLocaleString(),e[15]=u,e[16]=h):h=e[16];let g;e[17]!==a?(g=a("active subscriptions"),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,n.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==l||e[24]!==f?(b=(0,n.jsx)(T,{"data-testid":"home-live-connections",children:(0,n.jsxs)(He,{className:"flex flex-col gap-2.5 py-4",children:[l,f,x]})}),e[22]=x,e[23]=l,e[24]=f,e[25]=b):b=e[25],b},"It"),Tt=m(t=>{let e=(0,S.c)(7),{entries:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=Date.now(),o;e[3]!==a?(o=a("Recent activity"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,s.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No recent activity.")}):(0,n.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,n.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:At(c.ts,l)})]},c.seq))})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"jt"),Ot=m(t=>{let e=t.reduce((s,a)=>s+a.calls,0);return e===0?null:t.reduce((s,a)=>s+a.totalDurationMs,0)/e},"Tt"),Gt=m(t=>{let e=(0,S.c)(151),{initialShardKey:s}=t,a=$(),r=Ee(),l=s??"",o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==l?(i={shardKey:l},e[1]=l,e[2]=i):i=e[2];let c=ke(D.getMetrics,o,i),p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p={},e[3]=p):p=e[3];let d;e[4]!==l?(d={shardKey:l},e[4]=l,e[5]=d):d=e[5];let f=ke(D.getFunctionStats,p,d),u,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},h={shardKey:""},e[6]=u,e[7]=h):(u=e[6],h=e[7]);let g=ke(D.getSecurityAudit,u,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==l?(b={shardKey:l},e[9]=l,e[10]=b):b=e[10];let y=ke(D.listSubscriptions,x,b),k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k={},e[11]=k):k=e[11];let A;e[12]!==l?(A={shardKey:l},e[12]=l,e[13]=A):A=e[13];let w=ke(D.getAuditLog,k,A),v=c.data??null,M,I,N,_,C,j,P,O,K,V,W,E,R,q,B,F,U,H;if(e[14]!==w.data||e[15]!==g.data||e[16]!==v||e[17]!==c.data||e[18]!==r||e[19]!==f.data||e[20]!==y.data||e[21]!==a){_=Array.isArray(f.data?.functions)?f.data.functions:[],P=y.data??null;let Le;e[40]!==w.data?(Le=Array.isArray(w.data?.entries)?w.data.entries:[],e[40]=w.data,e[41]=Le):Le=e[41],I=Le,C=c.data===void 0||f.data===void 0?null:nt(v,_).length,j=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ae;e[42]!==r?(Ae=m(()=>{Se(r({to:"/security"}))},"Me"),e[42]=r,e[43]=Ae):Ae=e[43],H=Ae;let Ce;e[44]!==r?(Ce=m(()=>{Se(r({to:"/insights"}))},"Ae"),e[44]=r,e[45]=Ce):Ce=e[45],U=Ce;let $e=rt(v?.history,"calls"),je=rt(v?.history,"errors"),Ge=Ot(_),Te=Math.max(0,..._.map(qt)),z=v?.cache,Oe;e[46]!==z?(Oe=z!=null&&z.hits+z.misses>0?Math.round(z.hits/(z.hits+z.misses)*100):null,e[46]=z,e[47]=Oe):Oe=e[47],N=Oe,B="flex flex-col gap-6",F="lunora-home",W="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let qe=lt($e),ye;e[48]!==a?(ye=a("Requests"),e[48]=a,e[49]=ye):ye=e[49];let ze=v?.requests??0,ve;e[50]!==ze?(ve=ze.toLocaleString(),e[50]=ze,e[51]=ve):ve=e[51],e[52]!==$e||e[53]!==qe||e[54]!==ye||e[55]!==ve?(R=(0,n.jsx)(Ke,{delta:qe,label:ye,trend:$e,value:ve}),e[52]=$e,e[53]=qe,e[54]=ye,e[55]=ve,e[56]=R):R=e[56];let De=lt(je,!1),Ne;e[57]!==a?(Ne=a("Errors"),e[57]=a,e[58]=Ne):Ne=e[58];let Pe=v?.errors??0,_e;e[59]!==Pe?(_e=Pe.toLocaleString(),e[59]=Pe,e[60]=_e):_e=e[60],e[61]!==je||e[62]!==De||e[63]!==Ne||e[64]!==_e?(q=(0,n.jsx)(Ke,{delta:De,label:Ne,trend:je,value:_e}),e[61]=je,e[62]=De,e[63]=Ne,e[64]=_e,e[65]=q):q=e[65],M=Ke,e[66]!==Te||e[67]!==a?(O=Te>0?`${a("max")} ${Ze(Te)}`:void 0,e[66]=Te,e[67]=a,e[68]=O):O=e[68],e[69]!==a?(K=a("Avg latency"),e[69]=a,e[70]=K):K=e[70],V=Ge===null?"\u2014":Ze(Ge),e[14]=w.data,e[15]=g.data,e[16]=v,e[17]=c.data,e[18]=r,e[19]=f.data,e[20]=y.data,e[21]=a,e[22]=M,e[23]=I,e[24]=N,e[25]=_,e[26]=C,e[27]=j,e[28]=P,e[29]=O,e[30]=K,e[31]=V,e[32]=W,e[33]=E,e[34]=R,e[35]=q,e[36]=B,e[37]=F,e[38]=U,e[39]=H}else M=e[22],I=e[23],N=e[24],_=e[25],C=e[26],j=e[27],P=e[28],O=e[29],K=e[30],V=e[31],W=e[32],E=e[33],R=e[34],q=e[35],B=e[36],F=e[37],U=e[38],H=e[39];let J;e[71]!==M||e[72]!==O||e[73]!==K||e[74]!==V?(J=(0,n.jsx)(M,{footer:O,label:K,value:V}),e[71]=M,e[72]=O,e[73]=K,e[74]=V,e[75]=J):J=e[75];let Z;e[76]!==N||e[77]!==a?(Z=N===null?void 0:`${String(N)}% ${a("cache hit")}`,e[76]=N,e[77]=a,e[78]=Z):Z=e[78];let G;e[79]!==a?(G=a("Database size"),e[79]=a,e[80]=G):G=e[80];let Re=v?.databaseSize??null,Y;e[81]!==Re?(Y=at(Re),e[81]=Re,e[82]=Y):Y=e[82];let Q;e[83]!==Z||e[84]!==G||e[85]!==Y?(Q=(0,n.jsx)(Ke,{footer:Z,label:G,value:Y}),e[83]=Z,e[84]=G,e[85]=Y,e[86]=Q):Q=e[86];let X;e[87]!==W||e[88]!==E||e[89]!==R||e[90]!==q||e[91]!==J||e[92]!==Q?(X=(0,n.jsxs)("div",{className:W,"data-testid":E,children:[R,q,J,Q]}),e[87]=W,e[88]=E,e[89]=R,e[90]=q,e[91]=J,e[92]=Q,e[93]=X):X=e[93];let we;e[94]===Symbol.for("react.memo_cache_sentinel")?(we=(0,n.jsx)(bt,{}),e[94]=we):we=e[94];let ee;e[95]!==_?(ee=(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)($t,{functions:_})}),e[95]=_,e[96]=ee):ee=e[96];let te;e[97]!==P?(te=(0,n.jsx)(jt,{subs:P}),e[97]=P,e[98]=te):te=e[98];let ae;e[99]!==I?(ae=(0,n.jsx)(Tt,{entries:I}),e[99]=I,e[100]=ae):ae=e[100];let ne;e[101]!==te||e[102]!==ae?(ne=(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[te,ae]}),e[101]=te,e[102]=ae,e[103]=ne):ne=e[103];let se;e[104]!==ee||e[105]!==ne?(se=(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[ee,ne]}),e[104]=ee,e[105]=ne,e[106]=se):se=e[106];let re;e[107]!==a?(re=a("Advisors"),e[107]=a,e[108]=re):re=e[108];let le;e[109]!==re?(le=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:re}),e[109]=re,e[110]=le):le=e[110];let oe;e[111]!==C||e[112]!==j||e[113]!==a||e[114]!==U||e[115]!==H?(oe=j===0&&C===0?(0,n.jsx)(Ye,{description:a("No security or performance issues detected."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,n.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:a("No issues found")}):(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(ot,{count:j,onView:H,testId:"home-security",title:a("Security findings")}),(0,n.jsx)(ot,{count:C,onView:U,testId:"home-performance",title:a("Performance issues")})]}),e[111]=C,e[112]=j,e[113]=a,e[114]=U,e[115]=H,e[116]=oe):oe=e[116];let ie;e[117]!==le||e[118]!==oe?(ie=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[le,oe]}),e[117]=le,e[118]=oe,e[119]=ie):ie=e[119];let ce;e[120]!==a?(ce=a("Get connected"),e[120]=a,e[121]=ce):ce=e[121];let de;e[122]!==ce?(de=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ce}),e[122]=ce,e[123]=de):de=e[123];let me;e[124]!==a?(me=a("Client SDK"),e[124]=a,e[125]=me):me=e[125];let ue;e[126]!==me?(ue=(0,n.jsx)(Je,{command:"npm i @lunora/client",label:me}),e[126]=me,e[127]=ue):ue=e[127];let pe;e[128]!==a?(pe=a("React"),e[128]=a,e[129]=pe):pe=e[129];let fe;e[130]!==pe?(fe=(0,n.jsx)(Je,{command:"npm i @lunora/react",label:pe}),e[130]=pe,e[131]=fe):fe=e[131];let he;e[132]!==a?(he=a("CLI"),e[132]=a,e[133]=he):he=e[133];let ge;e[134]!==he?(ge=(0,n.jsx)(Je,{command:"lunora dev",label:he}),e[134]=he,e[135]=ge):ge=e[135];let xe;e[136]!==ue||e[137]!==fe||e[138]!==ge?(xe=(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[ue,fe,ge]}),e[136]=ue,e[137]=fe,e[138]=ge,e[139]=xe):xe=e[139];let Me;e[140]===Symbol.for("react.memo_cache_sentinel")?(Me=(0,n.jsx)(It,{}),e[140]=Me):Me=e[140];let be;e[141]!==de||e[142]!==xe?(be=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[de,xe,Me]}),e[141]=de,e[142]=xe,e[143]=be):be=e[143];let Ie;return e[144]!==B||e[145]!==F||e[146]!==X||e[147]!==se||e[148]!==ie||e[149]!==be?(Ie=(0,n.jsxs)("div",{className:B,"data-testid":F,children:[X,we,se,ie,be]}),e[144]=B,e[145]=F,e[146]=X,e[147]=se,e[148]=ie,e[149]=be,e[150]=Ie):Ie=e[150],Ie},"Zt");function Kt(t,e){return e.calls-t.calls}m(Kt,"Ot");function Rt(t){return(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,n.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,n.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,n.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Ze(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,n.jsx)("span",{className:Be("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}m(Rt,"Kt");function qt(t){return t.maxDurationMs}m(qt,"Rt");export{ft as a,Gt as b};
@@ -1 +1 @@
1
- import{a as w,b as x,c as N,d as j}from"./chunk-PF7V3G2Z.js";import{d as y,l as g}from"./chunk-4CGALXS3.js";import{a as v,e as b,g as S,h as B}from"./chunk-3XIESWL4.js";var q=b(S(),1);var a=b(B(),1);var K=50,T={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},X=v(r=>{let l=r.columns.find(e=>r.rows.length>0&&r.rows.every(o=>typeof o[e]=="number"))??null;return{label:r.columns.find(e=>e!==l)??null,value:l}},"S"),$=v(r=>{let l=(0,q.c)(15),{result:e}=r,o=y(),c;l[0]!==e?(c=X(e),l[0]=e,l[1]=c):c=l[1];let{label:u,value:n}=c,m;l[2]!==u||l[3]!==e||l[4]!==n?(m=n===null?[]:e.rows.slice(0,K).map((t,s)=>({label:u===null?`#${(s+1).toString()}`:g(t[u]),value:Number(t[n])||0})),l[2]=u,l[3]=e,l[4]=n,l[5]=m):m=l[5];let p=m;if(n===null){let t;l[6]!==o?(t=o("No numeric column to chart."),l[6]=o,l[7]=t):t=l[7];let s;return l[8]!==t?(s=(0,a.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:t}),l[8]=t,l[9]=s):s=l[9],s}let i,d,f;l[10]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(N,{dataKey:"label"}),d=(0,a.jsx)(x,{dataKey:"value"}),f=(0,a.jsx)(j,{}),l[10]=i,l[11]=d,l[12]=f):(i=l[10],d=l[11],f=l[12]);let h;return l[13]!==p?(h=(0,a.jsx)("div",{className:"h-80 w-full p-3","data-testid":"sql-chart",children:(0,a.jsxs)(w,{className:"h-full w-full",config:T,data:p,children:[i,d,f]})}),l[13]=p,l[14]=h):h=l[14],h},"X");export{$ as a};
1
+ import{a as w,b as x,c as N,d as j}from"./chunk-WCWYSOCN.js";import{d as y,l as g}from"./chunk-4CGALXS3.js";import{a as v,e as b,g as S,h as B}from"./chunk-3XIESWL4.js";var q=b(S(),1);var a=b(B(),1);var K=50,T={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},X=v(r=>{let l=r.columns.find(e=>r.rows.length>0&&r.rows.every(o=>typeof o[e]=="number"))??null;return{label:r.columns.find(e=>e!==l)??null,value:l}},"S"),$=v(r=>{let l=(0,q.c)(15),{result:e}=r,o=y(),c;l[0]!==e?(c=X(e),l[0]=e,l[1]=c):c=l[1];let{label:u,value:n}=c,m;l[2]!==u||l[3]!==e||l[4]!==n?(m=n===null?[]:e.rows.slice(0,K).map((t,s)=>({label:u===null?`#${(s+1).toString()}`:g(t[u]),value:Number(t[n])||0})),l[2]=u,l[3]=e,l[4]=n,l[5]=m):m=l[5];let p=m;if(n===null){let t;l[6]!==o?(t=o("No numeric column to chart."),l[6]=o,l[7]=t):t=l[7];let s;return l[8]!==t?(s=(0,a.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:t}),l[8]=t,l[9]=s):s=l[9],s}let i,d,f;l[10]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)(N,{dataKey:"label"}),d=(0,a.jsx)(x,{dataKey:"value"}),f=(0,a.jsx)(j,{}),l[10]=i,l[11]=d,l[12]=f):(i=l[10],d=l[11],f=l[12]);let h;return l[13]!==p?(h=(0,a.jsx)("div",{className:"h-80 w-full p-3","data-testid":"sql-chart",children:(0,a.jsxs)(w,{className:"h-full w-full",config:T,data:p,children:[i,d,f]})}),l[13]=p,l[14]=h):h=l[14],h},"X");export{$ as a};
@@ -1,4 +1,4 @@
1
- import{b as Ee}from"./chunk-5RF4QDDA.js";import"./chunk-XQGANNLS.js";import{c as _e}from"./chunk-SKHEGARW.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as ye}from"./chunk-JN2Y24PY.js";import"./chunk-ESVP44Y3.js";import{a as Ue}from"./chunk-54MMVNPT.js";import"./chunk-KYF2E5CJ.js";import"./chunk-7YEFOSPH.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import{a as Re}from"./chunk-7LQWFOEU.js";import"./chunk-T6VMSOBB.js";import{a as $e,b as Te,c as Fe,d as ce,e as ne,f as ee}from"./chunk-MIQTKZAR.js";import{a as je,e as ze}from"./chunk-UZERI5YC.js";import"./chunk-QBWRC5YX.js";import{a as De}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as Ne}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as re}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as ae}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as be}from"./chunk-GXZAXNZI.js";import{f as Se}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as he}from"./chunk-XQCVZAGU.js";import{d as Ce,f as me,g as ge,h as Y,m as W,o as Ke,p as pe}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as g,e as fe,f as gt,g as pt,h as bt}from"./chunk-3XIESWL4.js";var M=fe(pt(),1),z=fe(gt(),1);var n=fe(bt(),1);var Me=g((c,e,r)=>{let t=(0,M.c)(21),{onCopy:s,onDelete:o,onDownload:u,onToggleSelect:i}=r,l;t[0]!==c.key||t[1]!==s?(l=g(()=>{s(c.key)},"l"),t[0]=c.key,t[1]=s,t[2]=l):l=t[2];let f=l,h;t[3]!==c.key||t[4]!==u?(h=g(()=>{u(c.key)},"h"),t[3]=c.key,t[4]=u,t[5]=h):h=t[5];let d=h,m;t[6]!==c.key||t[7]!==o?(m=g(()=>{o(c.key)},"m"),t[6]=c.key,t[7]=o,t[8]=m):m=t[8];let w=m,a;t[9]!==c.key||t[10]!==i?(a=g(()=>{i(c.key)},"s"),t[9]=c.key,t[10]=i,t[11]=a):a=t[11];let v=a,x;t[12]!==c.key||t[13]!==e.length?(x=c.key.slice(e.length),t[12]=c.key,t[13]=e.length,t[14]=x):x=t[14];let b;return t[15]!==f||t[16]!==d||t[17]!==w||t[18]!==x||t[19]!==v?(b={copy:f,download:d,name:x,remove:w,toggle:v},t[15]=f,t[16]=d,t[17]=w,t[18]=x,t[19]=v,t[20]=b):b=t[20],b},"Ke"),Be=g(c=>{let e=(0,M.c)(31),{busy:r,buttonClassName:t,copied:s,objectKey:o,onCopy:u,onDelete:i,onDownload:l,t:f}=c,h=`storage-copy-${o}`,d;e[0]!==s||e[1]!==f?(d=f(s?"Copied":"Copy URL"),e[0]=s,e[1]=f,e[2]=d):d=e[2];let m;e[3]!==r||e[4]!==t||e[5]!==u||e[6]!==h||e[7]!==d?(m=(0,n.jsx)(re,{className:t,"data-testid":h,disabled:r,onClick:u,size:"sm",type:"button",variant:"ghost",children:d}),e[3]=r,e[4]=t,e[5]=u,e[6]=h,e[7]=d,e[8]=m):m=e[8];let w=`storage-download-${o}`,a;e[9]!==f?(a=f("Download"),e[9]=f,e[10]=a):a=e[10];let v;e[11]!==r||e[12]!==t||e[13]!==l||e[14]!==w||e[15]!==a?(v=(0,n.jsx)(re,{className:t,"data-testid":w,disabled:r,onClick:l,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=r,e[12]=t,e[13]=l,e[14]=w,e[15]=a,e[16]=v):v=e[16];let x;e[17]!==f?(x=f("Delete object?"),e[17]=f,e[18]=x):x=e[18];let b=`storage-delete-${o}`,y;e[19]!==f?(y=f("Delete"),e[19]=f,e[20]=y):y=e[20];let k;e[21]!==r||e[22]!==i||e[23]!==x||e[24]!==b||e[25]!==y?(k=(0,n.jsx)(Re,{confirmLabel:x,disabled:r,onConfirm:i,testId:b,children:y}),e[21]=r,e[22]=i,e[23]=x,e[24]=b,e[25]=y,e[26]=k):k=e[26];let S;return e[27]!==k||e[28]!==m||e[29]!==v?(S=(0,n.jsxs)(n.Fragment,{children:[m,v,k]}),e[27]=k,e[28]=m,e[29]=v,e[30]=S):S=e[30],S},"De"),Ae=g(c=>{let e=(0,M.c)(14),{objectKey:r,references:t,t:s}=c;if(t===void 0)return null;if(t.length===0){let h=`storage-orphan-${r}`,d;e[0]!==s?(d=s("Orphan"),e[0]=s,e[1]=d):d=e[1];let m;return e[2]!==h||e[3]!==d?(m=(0,n.jsx)(ae,{"data-testid":h,variant:"warning",children:d}),e[2]=h,e[3]=d,e[4]=m):m=e[4],m}let o;e[5]!==t?(o=t.map(yt).join(`
1
+ import{b as Ee}from"./chunk-5RF4QDDA.js";import"./chunk-XQGANNLS.js";import{c as _e}from"./chunk-SKHEGARW.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as ye}from"./chunk-JN2Y24PY.js";import"./chunk-ESVP44Y3.js";import{a as Ue}from"./chunk-54MMVNPT.js";import"./chunk-KYF2E5CJ.js";import"./chunk-7YEFOSPH.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import{a as Re}from"./chunk-7LQWFOEU.js";import"./chunk-T6VMSOBB.js";import{a as $e,b as Te,c as Fe,d as ce,e as ne,f as ee}from"./chunk-MIQTKZAR.js";import{a as je,e as ze}from"./chunk-UZERI5YC.js";import"./chunk-QBWRC5YX.js";import{a as De}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as Ne}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as re}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as ae}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as be}from"./chunk-AADXUXZO.js";import{f as Se}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as he}from"./chunk-XQCVZAGU.js";import{d as Ce,f as me,g as ge,h as Y,m as W,o as Ke,p as pe}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as g,e as fe,f as gt,g as pt,h as bt}from"./chunk-3XIESWL4.js";var M=fe(pt(),1),z=fe(gt(),1);var n=fe(bt(),1);var Me=g((c,e,r)=>{let t=(0,M.c)(21),{onCopy:s,onDelete:o,onDownload:u,onToggleSelect:i}=r,l;t[0]!==c.key||t[1]!==s?(l=g(()=>{s(c.key)},"l"),t[0]=c.key,t[1]=s,t[2]=l):l=t[2];let f=l,h;t[3]!==c.key||t[4]!==u?(h=g(()=>{u(c.key)},"h"),t[3]=c.key,t[4]=u,t[5]=h):h=t[5];let d=h,m;t[6]!==c.key||t[7]!==o?(m=g(()=>{o(c.key)},"m"),t[6]=c.key,t[7]=o,t[8]=m):m=t[8];let w=m,a;t[9]!==c.key||t[10]!==i?(a=g(()=>{i(c.key)},"s"),t[9]=c.key,t[10]=i,t[11]=a):a=t[11];let v=a,x;t[12]!==c.key||t[13]!==e.length?(x=c.key.slice(e.length),t[12]=c.key,t[13]=e.length,t[14]=x):x=t[14];let b;return t[15]!==f||t[16]!==d||t[17]!==w||t[18]!==x||t[19]!==v?(b={copy:f,download:d,name:x,remove:w,toggle:v},t[15]=f,t[16]=d,t[17]=w,t[18]=x,t[19]=v,t[20]=b):b=t[20],b},"Ke"),Be=g(c=>{let e=(0,M.c)(31),{busy:r,buttonClassName:t,copied:s,objectKey:o,onCopy:u,onDelete:i,onDownload:l,t:f}=c,h=`storage-copy-${o}`,d;e[0]!==s||e[1]!==f?(d=f(s?"Copied":"Copy URL"),e[0]=s,e[1]=f,e[2]=d):d=e[2];let m;e[3]!==r||e[4]!==t||e[5]!==u||e[6]!==h||e[7]!==d?(m=(0,n.jsx)(re,{className:t,"data-testid":h,disabled:r,onClick:u,size:"sm",type:"button",variant:"ghost",children:d}),e[3]=r,e[4]=t,e[5]=u,e[6]=h,e[7]=d,e[8]=m):m=e[8];let w=`storage-download-${o}`,a;e[9]!==f?(a=f("Download"),e[9]=f,e[10]=a):a=e[10];let v;e[11]!==r||e[12]!==t||e[13]!==l||e[14]!==w||e[15]!==a?(v=(0,n.jsx)(re,{className:t,"data-testid":w,disabled:r,onClick:l,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=r,e[12]=t,e[13]=l,e[14]=w,e[15]=a,e[16]=v):v=e[16];let x;e[17]!==f?(x=f("Delete object?"),e[17]=f,e[18]=x):x=e[18];let b=`storage-delete-${o}`,y;e[19]!==f?(y=f("Delete"),e[19]=f,e[20]=y):y=e[20];let k;e[21]!==r||e[22]!==i||e[23]!==x||e[24]!==b||e[25]!==y?(k=(0,n.jsx)(Re,{confirmLabel:x,disabled:r,onConfirm:i,testId:b,children:y}),e[21]=r,e[22]=i,e[23]=x,e[24]=b,e[25]=y,e[26]=k):k=e[26];let S;return e[27]!==k||e[28]!==m||e[29]!==v?(S=(0,n.jsxs)(n.Fragment,{children:[m,v,k]}),e[27]=k,e[28]=m,e[29]=v,e[30]=S):S=e[30],S},"De"),Ae=g(c=>{let e=(0,M.c)(14),{objectKey:r,references:t,t:s}=c;if(t===void 0)return null;if(t.length===0){let h=`storage-orphan-${r}`,d;e[0]!==s?(d=s("Orphan"),e[0]=s,e[1]=d):d=e[1];let m;return e[2]!==h||e[3]!==d?(m=(0,n.jsx)(ae,{"data-testid":h,variant:"warning",children:d}),e[2]=h,e[3]=d,e[4]=m):m=e[4],m}let o;e[5]!==t?(o=t.map(yt).join(`
2
2
  `),e[5]=t,e[6]=o):o=e[6];let u=o,i=`storage-refs-${r}`,l;e[7]!==t.length||e[8]!==s?(l=t.length===1?s("1 record"):s("{count} records",{count:t.length}),e[7]=t.length,e[8]=s,e[9]=l):l=e[9];let f;return e[10]!==u||e[11]!==i||e[12]!==l?(f=(0,n.jsx)(ae,{"data-testid":i,title:u,variant:"secondary",children:l}),e[10]=u,e[11]=i,e[12]=l,e[13]=f):f=e[13],f},"Te"),Pe=g(c=>{let e=(0,M.c)(7),{objectKey:r,onToggle:t,selected:s,t:o}=c,u;e[0]!==o?(u=o("Select row"),e[0]=o,e[1]=u):u=e[1];let i=`storage-select-${r}`,l;return e[2]!==t||e[3]!==s||e[4]!==u||e[5]!==i?(l=(0,n.jsx)(ye,{"aria-label":u,checked:s,"data-testid":i,onCheckedChange:t}),e[2]=t,e[3]=s,e[4]=u,e[5]=i,e[6]=l):l=e[6],l},"Fe");function yt(c){return`${c.table}\xB7${c.id}`}g(yt,"xt");var xt=g(c=>{let e=(0,M.c)(10),{colSpan:r,name:t,onEnter:s}=c,o;e[0]!==t||e[1]!==s?(o=g(()=>{s(t)},"n"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let u=o,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})}),e[3]=i):i=e[3];let l;e[4]!==u||e[5]!==t?(l=(0,n.jsxs)("button",{className:"inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground","data-testid":"fb-folder",onClick:u,type:"button",children:[i,t]}),e[4]=u,e[5]=t,e[6]=l):l=e[6];let f;return e[7]!==r||e[8]!==l?(f=(0,n.jsx)(ce,{children:(0,n.jsx)(ee,{colSpan:r,children:l})}),e[7]=r,e[8]=l,e[9]=f):f=e[9],f},"kt"),vt=g(c=>{let e=(0,M.c)(33),{busy:r,copiedKey:t,handlers:s,object:o,prefix:u,references:i,selected:l,showReferences:f,t:h}=c,{copy:d,download:m,name:w,remove:a,toggle:v}=Me(o,u,s),x;e[0]!==o.key||e[1]!==l||e[2]!==h||e[3]!==v?(x=(0,n.jsx)(ee,{className:"w-8",children:(0,n.jsx)(Pe,{objectKey:o.key,onToggle:v,selected:l,t:h})}),e[0]=o.key,e[1]=l,e[2]=h,e[3]=v,e[4]=x):x=e[4];let b;e[5]!==w?(b=(0,n.jsx)(ee,{className:"font-mono text-xs",children:w}),e[5]=w,e[6]=b):b=e[6];let y;e[7]!==o.size?(y=pe(o.size),e[7]=o.size,e[8]=y):y=e[8];let k;e[9]!==y?(k=(0,n.jsx)(ee,{className:"tabular-nums text-muted-foreground",children:y}),e[9]=y,e[10]=k):k=e[10];let S=o.httpMetadata?.contentType??"",j;e[11]!==S?(j=(0,n.jsx)(ee,{children:S}),e[11]=S,e[12]=j):j=e[12];let C;e[13]!==o.key||e[14]!==i||e[15]!==f||e[16]!==h?(C=f&&(0,n.jsx)(ee,{children:(0,n.jsx)(Ae,{objectKey:o.key,references:i,t:h})}),e[13]=o.key,e[14]=i,e[15]=f,e[16]=h,e[17]=C):C=e[17];let N=t===o.key,K;e[18]!==r||e[19]!==d||e[20]!==m||e[21]!==o.key||e[22]!==a||e[23]!==h||e[24]!==N?(K=(0,n.jsx)(ee,{className:"text-right",children:(0,n.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,n.jsx)(Be,{busy:r,copied:N,objectKey:o.key,onCopy:d,onDelete:a,onDownload:m,t:h})})}),e[18]=r,e[19]=d,e[20]=m,e[21]=o.key,e[22]=a,e[23]=h,e[24]=N,e[25]=K):K=e[25];let $;return e[26]!==x||e[27]!==b||e[28]!==k||e[29]!==j||e[30]!==C||e[31]!==K?($=(0,n.jsxs)(ce,{"data-testid":"fb-row",children:[x,b,k,j,C,K]}),e[26]=x,e[27]=b,e[28]=k,e[29]=j,e[30]=C,e[31]=K,e[32]=$):$=e[32],$},"vt"),kt=g(c=>{let e=(0,M.c)(65),{allSelected:r,busy:t,copiedKey:s,files:o,folders:u,handlers:i,onEnterFolder:l,prefix:f,references:h,selected:d,showReferences:m,someSelected:w,t:a,toggleSelectAll:v}=c,x;e[0]!==a?(x=a("Select all rows"),e[0]=a,e[1]=x):x=e[1];let b;e[2]!==r||e[3]!==w||e[4]!==x||e[5]!==v?(b=(0,n.jsx)(ne,{className:"w-8",children:(0,n.jsx)(ye,{"aria-label":x,checked:r,"data-testid":"storage-select-all",indeterminate:w,onCheckedChange:v})}),e[2]=r,e[3]=w,e[4]=x,e[5]=v,e[6]=b):b=e[6];let y;e[7]!==a?(y=a("key"),e[7]=a,e[8]=y):y=e[8];let k;e[9]!==y?(k=(0,n.jsx)(ne,{children:y}),e[9]=y,e[10]=k):k=e[10];let S;e[11]!==a?(S=a("size"),e[11]=a,e[12]=S):S=e[12];let j;e[13]!==S?(j=(0,n.jsx)(ne,{children:S}),e[13]=S,e[14]=j):j=e[14];let C;e[15]!==a?(C=a("content-type"),e[15]=a,e[16]=C):C=e[16];let N;e[17]!==C?(N=(0,n.jsx)(ne,{children:C}),e[17]=C,e[18]=N):N=e[18];let K;e[19]!==m||e[20]!==a?(K=m&&(0,n.jsx)(ne,{children:a("used by")}),e[19]=m,e[20]=a,e[21]=K):K=e[21];let $;e[22]!==a?($=a("Actions"),e[22]=a,e[23]=$):$=e[23];let F;e[24]!==$?(F=(0,n.jsx)(ne,{"aria-label":$}),e[24]=$,e[25]=F):F=e[25];let T;e[26]!==F||e[27]!==b||e[28]!==k||e[29]!==j||e[30]!==N||e[31]!==K?(T=(0,n.jsx)(Te,{children:(0,n.jsxs)(ce,{children:[b,k,j,N,K,F]})}),e[26]=F,e[27]=b,e[28]=k,e[29]=j,e[30]=N,e[31]=K,e[32]=T):T=e[32];let _;if(e[33]!==u||e[34]!==l||e[35]!==m){let R;e[37]!==l||e[38]!==m?(R=g(E=>(0,n.jsx)(xt,{colSpan:m?6:5,name:E,onEnter:l},E),"F"),e[37]=l,e[38]=m,e[39]=R):R=e[39],_=u.map(R),e[33]=u,e[34]=l,e[35]=m,e[36]=_}else _=e[36];let O;if(e[40]!==t||e[41]!==s||e[42]!==o||e[43]!==i||e[44]!==f||e[45]!==h||e[46]!==d||e[47]!==m||e[48]!==a){let R;e[50]!==t||e[51]!==s||e[52]!==i||e[53]!==f||e[54]!==h||e[55]!==d||e[56]!==m||e[57]!==a?(R=g(E=>(0,n.jsx)(vt,{busy:t,copiedKey:s,handlers:i,object:E,prefix:f,references:h[E.key],selected:d.has(E.key),showReferences:m,t:a},E.key),"F"),e[50]=t,e[51]=s,e[52]=i,e[53]=f,e[54]=h,e[55]=d,e[56]=m,e[57]=a,e[58]=R):R=e[58],O=o.map(R),e[40]=t,e[41]=s,e[42]=o,e[43]=i,e[44]=f,e[45]=h,e[46]=d,e[47]=m,e[48]=a,e[49]=O}else O=e[49];let U;e[59]!==_||e[60]!==O?(U=(0,n.jsxs)(Fe,{children:[_,O]}),e[59]=_,e[60]=O,e[61]=U):U=e[61];let L;return e[62]!==T||e[63]!==U?(L=(0,n.jsx)(je,{className:"overflow-hidden py-0",children:(0,n.jsx)(ze,{className:"px-0",children:(0,n.jsxs)($e,{"data-testid":"fb-table",children:[T,U]})})}),e[62]=T,e[63]=U,e[64]=L):L=e[64],L},"wt"),wt=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],St=3600,Oe=g((c,e)=>{if(e==="size")return c.size;if(e==="type")return c.httpMetadata?.contentType??"";if(e==="date"){if(c.uploaded===void 0)return 0;let r=new Date(c.uploaded).getTime();return Number.isNaN(r)?0:r}return e.startsWith("tag:")?c.customMetadata?.[e.slice(4)]??"":c.key},"ke"),Ct=g((c,e,r)=>{let t=r==="desc"?-1:1;return c.toSorted((s,o)=>{let u=Oe(s,e),i=Oe(o,e);return(typeof u=="number"&&typeof i=="number"?u-i:String(u).localeCompare(String(i)))*t})},"Ct"),Nt=g((c,e)=>{let r=new Set,t=[];for(let s of c){let o=s.key.slice(e.length),u=o.indexOf("/");u===-1?t.push(s):r.add(o.slice(0,u+1))}return{files:t,folders:[...r].toSorted((s,o)=>s.localeCompare(o))}},"$t"),jt=g(c=>{let e=(0,M.c)(59),{bucket:r,buckets:t,busy:s,draftPrefix:o,expiry:u,fileInputRef:i,onBucketChange:l,onExpiryChange:f,onFileChange:h,onList:d,onPrefixChange:m,onUploadClick:w,t:a}=c,v;e[0]!==m?(v=g(P=>{m(P.target.value)},"x"),e[0]=m,e[1]=v):v=e[1];let x=v,b;e[2]!==l?(b=g(P=>{l(P.target.value)},"g"),e[2]=l,e[3]=b):b=e[3];let y=b,k;e[4]!==f?(k=g(P=>{f(Number.parseInt(P.target.value,10))},"k"),e[4]=f,e[5]=k):k=e[5];let S=k,j;e[6]!==r||e[7]!==t||e[8]!==y||e[9]!==a?(j=t.length>0&&(0,n.jsx)("select",{"aria-label":a("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:y,value:r,children:t.map(Kt)}),e[6]=r,e[7]=t,e[8]=y,e[9]=a,e[10]=j):j=e[10];let C;e[11]!==a?(C=a("Key prefix"),e[11]=a,e[12]=C):C=e[12];let N;e[13]!==a?(N=a("key prefix (optional)"),e[13]=a,e[14]=N):N=e[14];let K;e[15]!==o||e[16]!==x||e[17]!==C||e[18]!==N?(K=(0,n.jsx)(Ne,{"aria-label":C,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:x,placeholder:N,value:o}),e[15]=o,e[16]=x,e[17]=C,e[18]=N,e[19]=K):K=e[19];let $;e[20]!==a?($=a("List"),e[20]=a,e[21]=$):$=e[21];let F;e[22]!==s||e[23]!==d||e[24]!==$?(F=(0,n.jsx)(re,{"data-testid":"fb-list",disabled:s,onClick:d,size:"sm",type:"button",children:$}),e[22]=s,e[23]=d,e[24]=$,e[25]=F):F=e[25];let T;e[26]!==s||e[27]!==a?(T=a(s?"Uploading\u2026":"Upload"),e[26]=s,e[27]=a,e[28]=T):T=e[28];let _;e[29]!==s||e[30]!==w||e[31]!==T?(_=(0,n.jsx)(re,{"data-testid":"storage-upload",disabled:s,onClick:w,size:"sm",type:"button",variant:"outline",children:T}),e[29]=s,e[30]=w,e[31]=T,e[32]=_):_=e[32];let O;e[33]!==i||e[34]!==h?(O=(0,n.jsx)("input",{className:"hidden","data-testid":"storage-file-input",onChange:h,ref:i,type:"file"}),e[33]=i,e[34]=h,e[35]=O):O=e[35];let U;e[36]!==a?(U=a("Link expiry"),e[36]=a,e[37]=U):U=e[37];let L;e[38]!==a?(L=wt.map(P=>(0,n.jsx)("option",{value:P.seconds,children:a(P.label)},P.seconds)),e[38]=a,e[39]=L):L=e[39];let R;e[40]!==u||e[41]!==S||e[42]!==L?(R=(0,n.jsx)("select",{className:"h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":"storage-expiry",id:"storage-expiry",onChange:S,value:u,children:L}),e[40]=u,e[41]=S,e[42]=L,e[43]=R):R=e[43];let E;e[44]!==U||e[45]!==R?(E=(0,n.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[U,R]}),e[44]=U,e[45]=R,e[46]=E):E=e[46];let B;e[47]!==a?(B=a("Open in Cloudflare"),e[47]=a,e[48]=B):B=e[48];let A;e[49]!==B?(A=(0,n.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:_e,rel:"noreferrer",target:"_blank",children:B}),e[49]=B,e[50]=A):A=e[50];let G;return e[51]!==_||e[52]!==O||e[53]!==E||e[54]!==A||e[55]!==j||e[56]!==K||e[57]!==F?(G=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[j,K,F,_,O,E,A]}),e[51]=_,e[52]=O,e[53]=E,e[54]=A,e[55]=j,e[56]=K,e[57]=F,e[58]=G):G=e[58],G},"jt"),zt=g(c=>{let e=(0,M.c)(66),{onSortKeyChange:r,onThumbSizeChange:t,showGrid:s,showList:o,sortDirection:u,sortKey:i,t:l,tagKeys:f,thumbSize:h,toggleSortDirection:d,view:m}=c,w;e[0]!==r?(w=g(q=>{r(q.target.value)},"v"),e[0]=r,e[1]=w):w=e[1];let a=w,v;e[2]!==t?(v=g(q=>{t(Number.parseInt(q.target.value,10))},"x"),e[2]=t,e[3]=v):v=e[3];let x=v,b=m==="list",y;e[4]!==l?(y=l("List"),e[4]=l,e[5]=y):y=e[5];let k;e[6]!==o||e[7]!==b||e[8]!==y?(k=(0,n.jsx)("button",{"aria-pressed":b,className:"px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-list",onClick:o,type:"button",children:y}),e[6]=o,e[7]=b,e[8]=y,e[9]=k):k=e[9];let S=m==="grid",j;e[10]!==l?(j=l("Grid"),e[10]=l,e[11]=j):j=e[11];let C;e[12]!==s||e[13]!==S||e[14]!==j?(C=(0,n.jsx)("button",{"aria-pressed":S,className:"border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-grid",onClick:s,type:"button",children:j}),e[12]=s,e[13]=S,e[14]=j,e[15]=C):C=e[15];let N;e[16]!==k||e[17]!==C?(N=(0,n.jsxs)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[k,C]}),e[16]=k,e[17]=C,e[18]=N):N=e[18];let K;e[19]!==l?(K=l("Sort"),e[19]=l,e[20]=K):K=e[20];let $;e[21]!==l?($=l("Name"),e[21]=l,e[22]=$):$=e[22];let F;e[23]!==$?(F=(0,n.jsx)("option",{value:"name",children:$}),e[23]=$,e[24]=F):F=e[24];let T;e[25]!==l?(T=l("size"),e[25]=l,e[26]=T):T=e[26];let _;e[27]!==T?(_=(0,n.jsx)("option",{value:"size",children:T}),e[27]=T,e[28]=_):_=e[28];let O;e[29]!==l?(O=l("Type"),e[29]=l,e[30]=O):O=e[30];let U;e[31]!==O?(U=(0,n.jsx)("option",{value:"type",children:O}),e[31]=O,e[32]=U):U=e[32];let L;e[33]!==l?(L=l("Modified"),e[33]=l,e[34]=L):L=e[34];let R;e[35]!==L?(R=(0,n.jsx)("option",{value:"date",children:L}),e[35]=L,e[36]=R):R=e[36];let E;e[37]!==f?(E=f.map(Dt),e[37]=f,e[38]=E):E=e[38];let B;e[39]!==a||e[40]!==i||e[41]!==F||e[42]!==_||e[43]!==U||e[44]!==R||e[45]!==E?(B=(0,n.jsxs)("select",{className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-sort",id:"fb-sort",onChange:a,value:i,children:[F,_,U,R,E]}),e[39]=a,e[40]=i,e[41]=F,e[42]=_,e[43]=U,e[44]=R,e[45]=E,e[46]=B):B=e[46];let A;e[47]!==K||e[48]!==B?(A=(0,n.jsxs)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[K,B]}),e[47]=K,e[48]=B,e[49]=A):A=e[49];let G;e[50]!==l?(G=l("Toggle sort direction"),e[50]=l,e[51]=G):G=e[51];let P=u==="asc"?"\u2191":"\u2193",H;e[52]!==G||e[53]!==P||e[54]!==d?(H=(0,n.jsx)("button",{"aria-label":G,className:"flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"fb-sort-dir",onClick:d,type:"button",children:P}),e[52]=G,e[53]=P,e[54]=d,e[55]=H):H=e[55];let Q;e[56]!==x||e[57]!==l||e[58]!==h||e[59]!==m?(Q=m==="grid"&&(0,n.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[l("Thumbnail size"),(0,n.jsx)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:x,step:8,type:"range",value:h})]}),e[56]=x,e[57]=l,e[58]=h,e[59]=m,e[60]=Q):Q=e[60];let oe;return e[61]!==A||e[62]!==H||e[63]!==Q||e[64]!==N?(oe=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[N,A,H,Q]}),e[61]=A,e[62]=H,e[63]=Q,e[64]=N,e[65]=oe):oe=e[65],oe},"zt");function Kt(c){return(0,n.jsx)("option",{value:c,children:c},c)}g(Kt,"Kt");function Dt(c){return(0,n.jsx)("option",{value:`tag:${c}`,children:c},c)}g(Dt,"Dt");var $t=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,Tt=g(c=>(c.httpMetadata?.contentType??"").startsWith("image/")||$t.test(c.key),"Ft"),Ft=g(()=>{let c=(0,M.c)(1),e;return c[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-8 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"})}),c[0]=e):e=c[0],e},"Rt"),Rt=g(c=>{let e=(0,M.c)(13),{object:r,resolveUrl:t}=c,[s,o]=(0,z.useState)(null),[u,i]=(0,z.useState)(!1),l;e[0]!==r?(l=Tt(r),e[0]=r,e[1]=l):l=e[1];let f=l,h,d;e[2]!==f||e[3]!==r.key||e[4]!==t?(h=g(()=>{if(!f)return;let v={cancelled:!1};return W((async()=>{try{let x=await t(r.key);v.cancelled||o(x)}catch{v.cancelled||i(!0)}})()),()=>{v.cancelled=!0}},"h"),d=[f,r.key,t],e[2]=f,e[3]=r.key,e[4]=t,e[5]=h,e[6]=d):(h=e[5],d=e[6]),(0,z.useEffect)(h,d);let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=g(()=>{i(!0)},"m"),e[7]=m):m=e[7];let w=m,a;return e[8]!==u||e[9]!==f||e[10]!==r.key||e[11]!==s?(a=(0,n.jsx)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:f&&s!==null&&!u?(0,n.jsx)("img",{alt:r.key,className:"size-full object-cover",loading:"lazy",onError:w,src:s}):(0,n.jsx)(Ft,{})}),e[8]=u,e[9]=f,e[10]=r.key,e[11]=s,e[12]=a):a=e[12],a},"Lt"),Ut=g(c=>{let e=(0,M.c)(38),{busy:r,copiedKey:t,handlers:s,object:o,prefix:u,references:i,resolveUrl:l,selected:f,showReferences:h,t:d}=c,{copy:m,download:w,name:a,remove:v,toggle:x}=Me(o,u,s),b;e[0]!==o||e[1]!==l?(b=(0,n.jsx)(Rt,{object:o,resolveUrl:l}),e[0]=o,e[1]=l,e[2]=b):b=e[2];let y;e[3]!==o.key||e[4]!==f||e[5]!==d||e[6]!==x?(y=(0,n.jsx)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,n.jsx)(Pe,{objectKey:o.key,onToggle:x,selected:f,t:d})}),e[3]=o.key,e[4]=f,e[5]=d,e[6]=x,e[7]=y):y=e[7];let k;e[8]!==b||e[9]!==y?(k=(0,n.jsxs)("div",{className:"relative",children:[b,y]}),e[8]=b,e[9]=y,e[10]=k):k=e[10];let S;e[11]!==a?(S=(0,n.jsx)("p",{className:"truncate font-mono text-xs",title:a,children:a}),e[11]=a,e[12]=S):S=e[12];let j;e[13]!==o.size?(j=pe(o.size),e[13]=o.size,e[14]=j):j=e[14];let C;e[15]!==j?(C=(0,n.jsx)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:j}),e[15]=j,e[16]=C):C=e[16];let N;e[17]!==o.key||e[18]!==i||e[19]!==h||e[20]!==d?(N=h&&(0,n.jsx)("div",{className:"mt-1",children:(0,n.jsx)(Ae,{objectKey:o.key,references:i,t:d})}),e[17]=o.key,e[18]=i,e[19]=h,e[20]=d,e[21]=N):N=e[21];let K;e[22]!==S||e[23]!==C||e[24]!==N?(K=(0,n.jsxs)("div",{className:"min-w-0",children:[S,C,N]}),e[22]=S,e[23]=C,e[24]=N,e[25]=K):K=e[25];let $=t===o.key,F;e[26]!==r||e[27]!==m||e[28]!==w||e[29]!==o.key||e[30]!==v||e[31]!==d||e[32]!==$?(F=(0,n.jsx)("div",{className:"flex items-center gap-1",children:(0,n.jsx)(Be,{busy:r,buttonClassName:"h-7 px-2 text-xs",copied:$,objectKey:o.key,onCopy:m,onDelete:v,onDownload:w,t:d})}),e[26]=r,e[27]=m,e[28]=w,e[29]=o.key,e[30]=v,e[31]=d,e[32]=$,e[33]=F):F=e[33];let T;return e[34]!==F||e[35]!==k||e[36]!==K?(T=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[k,K,F]}),e[34]=F,e[35]=k,e[36]=K,e[37]=T):T=e[37],T},"Ot"),Et=g(c=>{let e=(0,M.c)(9),{name:r,onEnter:t}=c,s;e[0]!==r||e[1]!==t?(s=g(()=>{t(r)},"o"),e[0]=r,e[1]=t,e[2]=s):s=e[2];let o=s,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=(0,n.jsx)("span",{className:"flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",children:(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-10 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})})}),e[3]=u):u=e[3];let i;e[4]!==r?(i=(0,n.jsx)("span",{className:"truncate font-mono text-xs",title:r,children:r}),e[4]=r,e[5]=i):i=e[5];let l;return e[6]!==o||e[7]!==i?(l=(0,n.jsxs)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:o,type:"button",children:[u,i]}),e[6]=o,e[7]=i,e[8]=l):l=e[8],l},"Et"),_t=g(c=>{let e=(0,M.c)(34),{busy:r,copiedKey:t,files:s,folders:o,handlers:u,onEnterFolder:i,prefix:l,references:f,resolveUrl:h,selected:d,showReferences:m,size:w,t:a}=c,v;e[0]!==w?(v=w.toString(),e[0]=w,e[1]=v):v=e[1];let x=`repeat(auto-fill, minmax(${v}px, 1fr))`,b;e[2]!==x?(b={gridTemplateColumns:x},e[2]=x,e[3]=b):b=e[3];let y=b,k;if(e[4]!==o||e[5]!==i){let C;e[7]!==i?(C=g(N=>(0,n.jsx)(Et,{name:N,onEnter:i},N),"S"),e[7]=i,e[8]=C):C=e[8],k=o.map(C),e[4]=o,e[5]=i,e[6]=k}else k=e[6];let S;if(e[9]!==r||e[10]!==t||e[11]!==s||e[12]!==u||e[13]!==l||e[14]!==f||e[15]!==h||e[16]!==d||e[17]!==m||e[18]!==a){let C;e[20]!==r||e[21]!==t||e[22]!==u||e[23]!==l||e[24]!==f||e[25]!==h||e[26]!==d||e[27]!==m||e[28]!==a?(C=g(N=>(0,n.jsx)(Ut,{busy:r,copiedKey:t,handlers:u,object:N,prefix:l,references:f[N.key],resolveUrl:h,selected:d.has(N.key),showReferences:m,t:a},N.key),"S"),e[20]=r,e[21]=t,e[22]=u,e[23]=l,e[24]=f,e[25]=h,e[26]=d,e[27]=m,e[28]=a,e[29]=C):C=e[29],S=s.map(C),e[9]=r,e[10]=t,e[11]=s,e[12]=u,e[13]=l,e[14]=f,e[15]=h,e[16]=d,e[17]=m,e[18]=a,e[19]=S}else S=e[19];let j;return e[30]!==y||e[31]!==k||e[32]!==S?(j=(0,n.jsxs)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:y,children:[k,S]}),e[30]=y,e[31]=k,e[32]=S,e[33]=j):j=e[33],j},"Ut"),Ot=g(c=>{let e=(0,M.c)(23),{reference:r,t}=c,s=`fb-dangling-${r.table}-${r.id}-${r.column}`,o=`${r.table}\xB7${r.id}`,u;e[0]!==o?(u=(0,n.jsx)(ae,{variant:"secondary",children:o}),e[0]=o,e[1]=u):u=e[1];let i;e[2]!==r.column?(i=(0,n.jsx)("span",{className:"text-muted-foreground",children:r.column}),e[2]=r.column,e[3]=i):i=e[3];let l;e[4]!==t?(l=t("\u2192"),e[4]=t,e[5]=l):l=e[5];let f;e[6]!==l?(f=(0,n.jsx)("span",{className:"text-muted-foreground/60",children:l}),e[6]=l,e[7]=f):f=e[7];let h;e[8]!==r.key?(h=(0,n.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:r.key}),e[8]=r.key,e[9]=h):h=e[9];let d;e[10]!==u||e[11]!==i||e[12]!==f||e[13]!==h?(d=(0,n.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[u,i,f,h]}),e[10]=u,e[11]=i,e[12]=f,e[13]=h,e[14]=d):d=e[14];let m;e[15]!==t?(m=t("Missing object"),e[15]=t,e[16]=m):m=e[16];let w;e[17]!==m?(w=(0,n.jsx)(ae,{className:"border-destructive/40 text-destructive",variant:"outline",children:m}),e[17]=m,e[18]=w):w=e[18];let a;return e[19]!==s||e[20]!==w||e[21]!==d?(a=(0,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs","data-testid":s,children:[d,w]}),e[19]=s,e[20]=w,e[21]=d,e[22]=a):a=e[22],a},"_t"),It=g(c=>{let e=(0,M.c)(37),{busy:r,onCheck:t,references:s,t:o,truncated:u}=c,i;e[0]!==o?(i=o("Integrity"),e[0]=o,e[1]=i):i=e[1];let l;e[2]!==i?(l=(0,n.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[2]=i,e[3]=l):l=e[3];let f;e[4]!==o?(f=o("Orphaned objects"),e[4]=o,e[5]=f):f=e[5];let h;e[6]!==f?(h=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:f}),e[6]=f,e[7]=h):h=e[7];let d;e[8]!==o?(d=o("Find records whose file reference points at an object the bucket no longer has."),e[8]=o,e[9]=d):d=e[9];let m;e[10]!==d?(m=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:d}),e[10]=d,e[11]=m):m=e[11];let w;e[12]!==l||e[13]!==h||e[14]!==m?(w=(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[l,h,m]}),e[12]=l,e[13]=h,e[14]=m,e[15]=w):w=e[15];let a;e[16]!==r||e[17]!==o?(a=o(r?"Checking\u2026":"Check for orphans"),e[16]=r,e[17]=o,e[18]=a):a=e[18];let v;e[19]!==r||e[20]!==t||e[21]!==a?(v=(0,n.jsx)(re,{"data-testid":"fb-orphans-check",disabled:r,onClick:t,size:"sm",type:"button",variant:"outline",children:a}),e[19]=r,e[20]=t,e[21]=a,e[22]=v):v=e[22];let x;e[23]!==w||e[24]!==v?(x=(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[w,v]}),e[23]=w,e[24]=v,e[25]=x):x=e[25];let b;e[26]!==s?.length||e[27]!==o?(b=s?.length===0&&(0,n.jsx)(he,{description:o("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:o("No dangling references.")}),e[26]=s?.length,e[27]=o,e[28]=b):b=e[28];let y;e[29]!==s||e[30]!==o||e[31]!==u?(y=s!==void 0&&s.length>0&&(0,n.jsxs)(n.Fragment,{children:[u&&(0,n.jsx)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:o("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:s.length})}),(0,n.jsx)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:s.map(S=>(0,n.jsx)(Ot,{reference:S,t:o},`${S.table}\xB7${S.id}\xB7${S.column}`))})]}),e[29]=s,e[30]=o,e[31]=u,e[32]=y):y=e[32];let k;return e[33]!==x||e[34]!==b||e[35]!==y?(k=(0,n.jsxs)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[x,b,y]}),e[33]=x,e[34]=b,e[35]=y,e[36]=k):k=e[36],k},"It"),Lt=g(function(c,e){let r=(0,M.c)(18),t;r[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Set,r[0]=t):t=r[0];let[s,o]=(0,z.useState)(t),u;r[1]===Symbol.for("react.memo_cache_sentinel")?(u=g(b=>{o(y=>{let k=new Set(y);return k.has(b)?k.delete(b):k.add(b),k})},"u"),r[1]=u):u=r[1];let i=u,l;r[2]===Symbol.for("react.memo_cache_sentinel")?(l=g(()=>{o(new Set)},"l"),r[2]=l):l=r[2];let f=l,h,d,m;if(r[3]!==c||r[4]!==e||r[5]!==s){let b;r[9]!==e?(b=g(y=>e(y),"g"),r[9]=e,r[10]=b):b=r[10],d=c.map(b),h=d.length>0&&d.every(y=>s.has(y)),m=!h&&d.some(y=>s.has(y)),r[3]=c,r[4]=e,r[5]=s,r[6]=h,r[7]=d,r[8]=m}else h=r[6],d=r[7],m=r[8];let w=m,a;r[11]!==d?(a=g(()=>{o(b=>d.every(y=>b.has(y))?new Set:new Set(d))},"s"),r[11]=d,r[12]=a):a=r[12];let v=a,x;return r[13]!==h||r[14]!==s||r[15]!==w||r[16]!==v?(x={allSelected:h,clear:f,selected:s,someSelected:w,toggle:i,toggleAll:v},r[13]=h,r[14]=s,r[15]=w,r[16]=v,r[17]=x):x=r[17],x},"Mt"),Mt=me(be.storageReferences),Bt=me(be.storageOrphans),Ie=1e4,At=1e3,Pt=3600,Wt=g((c,e)=>{if(!("document"in globalThis))return;let r=globalThis.document.createElement("a");r.href=c,r.download=e,r.rel="noopener",globalThis.document.body.append(r),r.click(),r.remove()},"Gt"),Gt=g(({initialPrefix:c,pageSize:e})=>{let r=Se(),[t,s]=(0,z.useState)(c??""),[o,u]=(0,z.useState)(c??""),[i,l]=(0,z.useState)(St),[f,h]=(0,z.useState)("list"),[d,m]=(0,z.useState)(128),[w,a]=(0,z.useState)("name"),[v,x]=(0,z.useState)("asc"),[b,y]=(0,z.useState)(void 0),[k,S]=(0,z.useState)(void 0),[j,C]=(0,z.useState)(!1),[N,K]=(0,z.useState)(void 0),[$,F]=(0,z.useState)(void 0),[T,_]=(0,z.useState)(""),[O,U]=(0,z.useState)({}),[L,R]=(0,z.useState)(!1),[E,B]=(0,z.useState)(void 0),[A,G]=(0,z.useState)(!1),[P,H]=(0,z.useState)(!1),[Q,oe]=(0,z.useState)([]),[q,xe]=(0,z.useState)(""),le=(0,z.useRef)(0),X=(0,z.useRef)(0);(0,z.useEffect)(()=>{let p={cancelled:!1};return W((async()=>{try{let D=await r.listStorageBuckets();if(!p.cancelled){oe(D);let[I]=D;I!==void 0&&xe(Z=>Z===""?I:Z)}}catch{}})()),()=>{p.cancelled=!0}},[r]);let V=(0,z.useMemo)(()=>({list:g(p=>r.listStorageObjects({...p,bucket:q}),"list"),remove:g(p=>r.deleteStorageObject(p,{bucket:q}),"remove"),signedUrl:g((p,D)=>r.signedStorageUrl(p,{...D,bucket:q}),"signedUrl"),upload:g(p=>r.uploadStorageObject({...p,bucket:q}),"upload")}),[q,r]),J=(0,z.useCallback)(async(p,D,I)=>{le.current+=1;let Z=le.current;S(void 0),C(!0);try{let te=await V.list({cursor:D,limit:e,prefix:p});if(Z!==le.current)return;y(we=>I&&we!==void 0?[...we,...te.objects]:te.objects),F(te.cursor)}catch(te){if(Z!==le.current)return;I||y(void 0),S(Y(te))}finally{Z===le.current&&C(!1)}},[e,V]);(0,z.useEffect)(()=>{W(J(c??"",void 0,!1))},[J,c]);let We=(b?.length??0)<=e;Ue(()=>{W(J(t,void 0,!1))},We);let{files:de,folders:Ge}=Nt(b??[],t),He=(0,z.useMemo)(()=>{let p=new Set;for(let D of de)for(let I of Object.keys(D.customMetadata??{}))p.add(I);return[...p].toSorted((D,I)=>D.localeCompare(I))},[de]),ie=Ct(de,w,v),ue=(0,z.useMemo)(()=>[...new Set(ie.map(p=>p.key))].toSorted((p,D)=>p.localeCompare(D)).join(`
3
3
  `),[ie]);(0,z.useEffect)(()=>{let p=ue===""?[]:ue.split(`
4
4
  `);if(p.length===0){U({});return}let D={current:!0};return W((async()=>{try{let I=await r.query(Mt,{keys:p},ge(T));D.current&&(U(I.references??{}),R(Object.keys(I.storageColumns??{}).length>0))}catch{D.current&&(U({}),R(!1))}})()),()=>{D.current=!1}},[r,ue,T]);let Ze=g(p=>p.key,"Ee"),{allSelected:qe,clear:se,selected:ve,someSelected:Ve,toggle:Je,toggleAll:Qe}=Lt(ie,Ze),Xe=g(()=>{s(o),se(),W(J(o,void 0,!1))},"Be"),Ye=g(()=>{W(J(t,$,!0))},"Ae"),ke=g(p=>{s(p),u(p),se(),W(J(p,void 0,!1))},"be"),et=g(p=>{ke(`${t}${p}`)},"Pe"),tt=g(p=>V.signedUrl(p,{expiresInSeconds:Pt}),"We"),rt=g(()=>{h("list")},"Ge"),nt=g(()=>{h("grid")},"He"),ot=g(p=>{a(p)},"Ze"),lt=g(()=>{x(p=>p==="asc"?"desc":"asc")},"qe"),st=g(p=>{m(p)},"Ve"),at=g(p=>{l(p)},"Xe"),it=g(()=>{S(void 0),C(!0),W((async()=>{try{for(let p of ve)await V.remove(p);await J(t,void 0,!1),se()}catch(p){S(Y(p))}finally{C(!1)}})())},"Qe"),ct=g(p=>{S(void 0),W((async()=>{try{let D=await V.signedUrl(p,{expiresInSeconds:i});Ke(D)&&K(p)}catch(D){S(Y(D))}})())},"Ye"),dt=g(p=>{S(void 0),W((async()=>{try{let D=await V.signedUrl(p,{expiresInSeconds:i}),I=p.slice(p.lastIndexOf("/")+1)||p;Wt(D,I)}catch(D){S(Y(D))}})())},"Je");(0,z.useEffect)(()=>{if(N===void 0)return;let p=globalThis.setTimeout(()=>{K(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[N]);let ut=g(p=>{S(void 0),C(!0),W((async()=>{try{await V.remove(p),await J(t,void 0,!1)}catch(D){S(Y(D))}finally{C(!1)}})())},"et"),ft=g(p=>{let D=`${t}${p.name}`;S(void 0),C(!0),W((async()=>{try{let I=await p.arrayBuffer();await V.upload({body:I,contentType:p.type===""?void 0:p.type,key:D}),await J(t,void 0,!1)}catch(I){S(Y(I))}finally{C(!1)}})())},"tt");(0,z.useEffect)(()=>{X.current+=1,B(void 0),H(!1)},[T]);let ht=g(()=>{X.current+=1;let p=X.current;S(void 0),G(!0),W((async()=>{try{let D=[],I;do{let Z=await V.list({cursor:I,limit:At});for(let te of Z.objects)D.push(te.key);I=D.length>=Ie?void 0:Z.cursor}while(I!==void 0);if(D.length>=Ie)p===X.current&&(B([]),H(!0));else{let Z=await r.query(Bt,{liveKeys:D},ge(T));p===X.current&&(B(Z.references??[]),H(Z.truncated===!0))}}catch(D){p===X.current&&(B([]),H(!1),S(Y(D)))}finally{p===X.current&&G(!1)}})())},"rt"),mt=g(p=>{le.current+=1,X.current+=1,xe(p),s(c??""),u(c??""),y(void 0),B(void 0),H(!1),se()},"nt");return{allSelected:qe,bucket:q,buckets:Q,bulkDelete:it,busy:j,checkOrphans:ht,clearSelection:se,copiedKey:N,danglingBusy:A,danglingReferences:E,danglingTruncated:P,draftPrefix:o,enterFolder:et,error:k,expiry:i,files:ie,folders:Ge,hasObjects:b!==void 0&&b.length>0,hasStorageColumns:L,listFirst:Xe,loaded:b!==void 0,loadMore:Ye,navigate:ke,nextCursor:$,onCopy:ct,onDelete:ut,onDownload:dt,onExpiryChange:at,onFile:ft,onSortKeyChange:ot,onThumbSizeChange:st,prefix:t,referenceShard:T,references:O,resolveUrl:tt,selectBucket:mt,selected:ve,setDraftPrefix:u,setReferenceShard:_,showGrid:nt,showList:rt,someSelected:Ve,sortDirection:v,sortKey:w,tagKeys:He,thumbSize:d,toggleSelect:Je,toggleSelectAll:Qe,toggleSortDirection:lt,view:f}},"Ht"),Ht=100,Le=g(c=>{let e=(0,M.c)(6),{label:r,onNavigate:t,target:s}=c,o;e[0]!==t||e[1]!==s?(o=g(()=>{t(s)},"n"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let u=o,i;return e[3]!==u||e[4]!==r?(i=(0,n.jsx)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:u,type:"button",children:r}),e[3]=u,e[4]=r,e[5]=i):i=e[5],i},"we"),Zt=g(c=>{let e=(0,M.c)(11),{onNavigate:r,prefix:t,t:s}=c,o;if(e[0]!==r||e[1]!==t||e[2]!==s){let u=t.split("/").filter(qt),i;e[4]!==s?(i=s("Folder path"),e[4]=s,e[5]=i):i=e[5];let l;e[6]!==s?(l=s("root"),e[6]=s,e[7]=l):l=e[7];let f;e[8]!==r||e[9]!==l?(f=(0,n.jsx)(Le,{label:l,onNavigate:r,target:""}),e[8]=r,e[9]=l,e[10]=f):f=e[10],o=(0,n.jsxs)("nav",{"aria-label":i,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[f,u.map((h,d)=>(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)("span",{className:"text-muted-foreground/50",children:"/"}),(0,n.jsx)(Le,{label:h,onNavigate:r,target:`${u.slice(0,d+1).join("/")}/`})]},`${h}-${d.toString()}`))]}),e[0]=r,e[1]=t,e[2]=s,e[3]=o}else o=e[3];return o},"qt"),ur=g(({initialPrefix:c,pageSize:e=Ht})=>{let r=Ce(),t=Gt({initialPrefix:c,pageSize:e}),s=(0,z.useRef)(null),{onCopy:o,onDelete:u,onDownload:i,onFile:l,toggleSelect:f}=t,h={onCopy:o,onDelete:u,onDownload:i,onToggleSelect:f},d=g(()=>{s.current?.click()},"d"),m=g(a=>{let v=a.target,x=v.files?.[0];v.value="",x&&l(x)},"m"),w=t.loaded&&!t.hasObjects;return(0,n.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,n.jsx)(jt,{bucket:t.bucket,buckets:t.buckets,busy:t.busy,draftPrefix:t.draftPrefix,expiry:t.expiry,fileInputRef:s,onBucketChange:t.selectBucket,onExpiryChange:t.onExpiryChange,onFileChange:m,onList:t.listFirst,onPrefixChange:t.setDraftPrefix,onUploadClick:d,t:r}),t.loaded&&(0,n.jsx)(Zt,{onNavigate:t.navigate,prefix:t.prefix,t:r}),t.hasObjects&&(0,n.jsx)(zt,{onSortKeyChange:t.onSortKeyChange,onThumbSizeChange:t.onThumbSizeChange,showGrid:t.showGrid,showList:t.showList,sortDirection:t.sortDirection,sortKey:t.sortKey,t:r,tagKeys:t.tagKeys,thumbSize:t.thumbSize,toggleSortDirection:t.toggleSortDirection,view:t.view}),t.hasStorageColumns&&(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:r("References shard")}),(0,n.jsx)(De,{id:"fb-reference-shard-input",onChange:t.setReferenceShard,testId:"fb-reference-shard-input",value:t.referenceShard}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:r("Which shard's records are checked for references to these files. Empty = root shard.")})]}),t.hasStorageColumns&&(0,n.jsx)(It,{busy:t.danglingBusy,onCheck:t.checkOrphans,references:t.danglingReferences,t:r,truncated:t.danglingTruncated}),t.selected.size>0&&(0,n.jsx)(Ee,{count:t.selected.size,editable:!0,onClear:t.clearSelection,onDelete:t.bulkDelete}),t.error!==void 0&&(0,n.jsx)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:t.error}),w&&(0,n.jsx)(he,{description:r("Objects you upload to your R2 buckets will appear here."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"}),(0,n.jsx)("path",{d:"M12 11v5m-2.5-2.5h5"})]}),testId:"fb-empty",title:r("No objects.")}),t.hasObjects&&t.view==="list"&&(0,n.jsx)(kt,{allSelected:t.allSelected,busy:t.busy,copiedKey:t.copiedKey,files:t.files,folders:t.folders,handlers:h,onEnterFolder:t.enterFolder,prefix:t.prefix,references:t.references,selected:t.selected,showReferences:t.hasStorageColumns,someSelected:t.someSelected,t:r,toggleSelectAll:t.toggleSelectAll}),t.hasObjects&&t.view==="grid"&&(0,n.jsx)(_t,{busy:t.busy,copiedKey:t.copiedKey,files:t.files,folders:t.folders,handlers:h,onEnterFolder:t.enterFolder,prefix:t.prefix,references:t.references,resolveUrl:t.resolveUrl,selected:t.selected,showReferences:t.hasStorageColumns,size:t.thumbSize,t:r}),t.nextCursor!==void 0&&(0,n.jsx)("div",{children:(0,n.jsx)(re,{"data-testid":"fb-next",disabled:t.busy,onClick:t.loadMore,size:"sm",type:"button",variant:"outline",children:r("Load more")})})]})},"pr");function qt(c){return c!==""}g(qt,"Vt");export{ur as FileBrowser};
@@ -0,0 +1 @@
1
+ import{a as Oe}from"./chunk-AVZGVZZ7.js";import{a as Ke}from"./chunk-66YJ3IOZ.js";import{a as Qe}from"./chunk-JN2Y24PY.js";import{a as Ve}from"./chunk-ESVP44Y3.js";import{a as Je}from"./chunk-54MMVNPT.js";import"./chunk-IVFHIQOT.js";import{a as He}from"./chunk-LFKCLLPT.js";import{a as Ge}from"./chunk-BMQJ4CAO.js";import{a as Ue,b as _e,c as $e,d as M,e as U,f as _}from"./chunk-MIQTKZAR.js";import{a as we,e as Ce}from"./chunk-UZERI5YC.js";import{a as D}from"./chunk-5Y3QLNWX.js";import"./chunk-QBWRC5YX.js";import{R as B}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as z}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as P}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{f as E}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as Ze}from"./chunk-XQCVZAGU.js";import{d as W,h as Te,l as Ae,m as ze,q as Ie}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as r,e as Me,f as Ye,g as et,h as tt}from"./chunk-3XIESWL4.js";var k=Me(Ye(),1);var Z=Me(et(),1);var t=Me(tt(),1);var at=r(()=>{let u=(0,Z.c)(3),{config:e,ready:l}=Oe(),s;return u[0]!==e.capabilities||u[1]!==l?(s={capabilities:e.capabilities,ready:l},u[0]=e.capabilities,u[1]=l,u[2]=s):s=u[2],s},"et"),st={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},lt=r((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"at"),rt=r((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let l=typeof e=="string"?e.trim():"";if(l!==""){if(u.type==="number"){let s=Number(l);return Number.isNaN(s)?void 0:{value:s}}return{value:l}}},"lt"),it=r(u=>{let e=(0,Z.c)(105),{onClose:l,onCreated:s}=u,c=E(),a=W(),{config:o}=Oe(),{busy:i,error:n,run:m}=Ke(),[w,S]=(0,k.useState)(""),[b,C]=(0,k.useState)(""),[y,I]=(0,k.useState)(""),[h,g]=(0,k.useState)(""),v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v={},e[0]=v):v=e[0];let[f,d]=(0,k.useState)(v),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=r(p=>{S(p.target.value)},"C"),e[1]=A):A=e[1];let x=A,F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r(p=>{C(p.target.value)},"F"),e[2]=F):F=e[2];let q=F,R;e[3]===Symbol.for("react.memo_cache_sentinel")?(R=r(p=>{I(p.target.value)},"_"),e[3]=R):R=e[3];let Be=R,G;e[4]===Symbol.for("react.memo_cache_sentinel")?(G=r(p=>{g(p.target.value)},"O"),e[4]=G):G=e[4];let Pe=G,H;e[5]===Symbol.for("react.memo_cache_sentinel")?(H=r((p,$)=>{d(V=>({...V,[p]:$}))},"G"),e[5]=H):H=e[5];let Re=H,J;e[6]!==f?(J=r(p=>f[p.name]??(p.type==="boolean"?!1:""),"H"),e[6]=f,e[7]=J):J=e[7];let j=J,K;if(e[8]!==o.userFields||e[9]!==j){let p;e[11]!==j?(p=r($=>!$.required||lt($,j($)),"p"),e[11]=j,e[12]=p):p=e[12],K=o.userFields.every(p),e[8]=o.userFields,e[9]=j,e[10]=K}else K=e[10];let Fe=K,Q;e[13]!==i||e[14]!==w||e[15]!==b||e[16]!==Fe?(Q=!i&&w.trim()!==""&&b.trim()!==""&&Fe,e[13]=i,e[14]=w,e[15]=b,e[16]=Fe,e[17]=Q):Q=e[17];let De=Q,X;e[18]!==o.userFields||e[19]!==j?(X=r(()=>{let p={};for(let $ of o.userFields){let V=rt($,j($));V!==void 0&&(p[$.name]=V.value)}return Object.keys(p).length===0?void 0:p},"W"),e[18]=o.userFields,e[19]=j,e[20]=X):X=e[20];let Se=X,Y;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==b||e[25]!==l||e[26]!==s||e[27]!==y||e[28]!==h||e[29]!==m?(Y=r(()=>{m(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:b.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),s(),l()})},"Z"),e[21]=Se,e[22]=c,e[23]=w,e[24]=b,e[25]=l,e[26]=s,e[27]=y,e[28]=h,e[29]=m,e[30]=Y):Y=e[30];let N=Y,T;e[31]!==a?(T=a("Create user"),e[31]=a,e[32]=T):T=e[32];let L;e[33]!==a?(L=a("Create user"),e[33]=a,e[34]=L):L=e[34];let O;e[35]!==L?(O=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:L}),e[35]=L,e[36]=O):O=e[36];let ee;e[37]!==a?(ee=a("email"),e[37]=a,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsx)(D,{htmlFor:"uc-email",children:ee}),e[39]=ee,e[40]=te):te=e[40];let ae;e[41]!==w?(ae=(0,t.jsx)(B,{"data-testid":"uc-email",id:"uc-email",onChange:x,type:"email",value:w}),e[41]=w,e[42]=ae):ae=e[42];let se;e[43]!==te||e[44]!==ae?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[te,ae]}),e[43]=te,e[44]=ae,e[45]=se):se=e[45];let le;e[46]!==a?(le=a("name"),e[46]=a,e[47]=le):le=e[47];let re;e[48]!==le?(re=(0,t.jsx)(D,{htmlFor:"uc-name",children:le}),e[48]=le,e[49]=re):re=e[49];let ie;e[50]!==b?(ie=(0,t.jsx)(B,{"data-testid":"uc-name",id:"uc-name",onChange:q,value:b}),e[50]=b,e[51]=ie):ie=e[51];let ne;e[52]!==re||e[53]!==ie?(ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[52]=re,e[53]=ie,e[54]=ne):ne=e[54];let de;e[55]!==a?(de=a("Password (optional)"),e[55]=a,e[56]=de):de=e[56];let oe;e[57]!==de?(oe=(0,t.jsx)(D,{htmlFor:"uc-password",children:de}),e[57]=de,e[58]=oe):oe=e[58];let ce;e[59]!==y?(ce=(0,t.jsx)(B,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:y}),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==oe||e[62]!==ce?(ue=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[oe,ce]}),e[61]=oe,e[62]=ce,e[63]=ue):ue=e[63];let me;e[64]!==a?(me=a("Role (optional)"),e[64]=a,e[65]=me):me=e[65];let he;e[66]!==me?(he=(0,t.jsx)(D,{htmlFor:"uc-role",children:me}),e[66]=me,e[67]=he):he=e[67];let pe;e[68]!==h?(pe=(0,t.jsx)(B,{"data-testid":"uc-role",id:"uc-role",onChange:Pe,value:h}),e[68]=h,e[69]=pe):pe=e[69];let fe;e[70]!==he||e[71]!==pe?(fe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[he,pe]}),e[70]=he,e[71]=pe,e[72]=fe):fe=e[72];let ve;e[73]!==o.userFields||e[74]!==j||e[75]!==a?(ve=o.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),o.userFields.map(p=>{let $=`uc-field-${p.name}`,V=p.required?"":` (${a("optional")})`;if(p.type==="boolean"){let Le=j(p)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:$,children:[(0,t.jsx)(Qe,{checked:Le,"data-testid":$,id:$,onCheckedChange:r(Xe=>{Re(p.name,Xe)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[p.name,V]})]},p.name)}let We=j(p);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(D,{htmlFor:$,children:[p.name,V]}),(0,t.jsx)(B,{"data-testid":$,id:$,onChange:r(Le=>{Re(p.name,Le.target.value)},"onChange"),type:st[p.type],value:typeof We=="string"?We:""})]},p.name)})]}),e[73]=o.userFields,e[74]=j,e[75]=a,e[76]=ve):ve=e[76];let xe;e[77]!==n?(xe=n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n}),e[77]=n,e[78]=xe):xe=e[78];let be;e[79]!==a?(be=a("Cancel"),e[79]=a,e[80]=be):be=e[80];let ye;e[81]!==l||e[82]!==be?(ye=(0,t.jsx)(z,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:be}),e[81]=l,e[82]=be,e[83]=ye):ye=e[83];let qe=!De,ge;e[84]!==i||e[85]!==a?(ge=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==qe||e[89]!==ge?(Ne=(0,t.jsx)(z,{"data-testid":"uc-submit",disabled:qe,onClick:N,size:"sm",type:"button",children:ge}),e[87]=N,e[88]=qe,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]}),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let je;return e[94]!==l||e[95]!==T||e[96]!==O||e[97]!==se||e[98]!==ne||e[99]!==ue||e[100]!==fe||e[101]!==ve||e[102]!==xe||e[103]!==ke?(je=(0,t.jsxs)(Ve,{label:T,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[O,se,ne,ue,fe,ve,xe,ke]}),e[94]=l,e[95]=T,e[96]=O,e[97]=se,e[98]=ne,e[99]=ue,e[100]=fe,e[101]=ve,e[102]=xe,e[103]=ke,e[104]=je):je=e[104],je},"st"),Ee=r(u=>{let e=(0,Z.c)(2),{children:l}=u,s;return e[0]!==l?(s=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=s):s=e[1],s},"Le"),nt=r(u=>{let e=(0,Z.c)(29),{busy:l,runAction:s,userId:c,version:a}=u,o=E(),i=W(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),b;e[0]!==o||e[1]!==c?(b=r(()=>{ze((async()=>{S(null);try{let x=await o.listAuthSessions({limit:50,userId:c});m(x.rows)}catch(x){let F=x;m(null),S(Te(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=b):b=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(b,C);let y;e[7]!==o||e[8]!==s?(y=r(x=>{s(()=>o.revokeAuthSession({sessionId:x}))},"y"),e[7]=o,e[8]=s,e[9]=y):y=e[9];let I=y,h;e[10]!==i?(h=i("Sessions"),e[10]=i,e[11]=h):h=e[11];let g;e[12]!==h?(g=(0,t.jsx)(Ee,{children:h}),e[12]=h,e[13]=g):g=e[13];let v;e[14]!==w?(v=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w}),e[14]=w,e[15]=v):v=e[15];let f;e[16]!==n||e[17]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=n,e[17]=i,e[18]=f):f=e[18];let d;e[19]!==l||e[20]!==I||e[21]!==n||e[22]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(U,{children:i("expires")}),(0,t.jsx)(U,{children:i("ip")}),(0,t.jsx)(U,{children:i("user agent")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)($e,{children:n.map(x=>(0,t.jsxs)(M,{"data-testid":`ud-session-${x.id}`,children:[(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(x.expiresAt)}),(0,t.jsx)(_,{children:x.ipAddress??""}),(0,t.jsx)(_,{className:"max-w-40 truncate",children:x.userAgent??""}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`ud-revoke-${x.id}`,disabled:l,onClick:r(()=>{I(x.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},x.id))})]})})}),e[19]=l,e[20]=I,e[21]=n,e[22]=i,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==v||e[26]!==f||e[27]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,v,f,d]}),e[24]=g,e[25]=v,e[26]=f,e[27]=d,e[28]=A):A=e[28],A},"rt"),dt=r(u=>{let e=(0,Z.c)(30),{busy:l,runAction:s,userId:c,version:a}=u,o=E(),i=W(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),b;e[0]!==o||e[1]!==c?(b=r(()=>{ze((async()=>{S(null);try{m(await o.listAuthAccounts({userId:c}))}catch(x){let F=x;m(null),S(Te(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=b):b=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(b,C);let y;e[7]!==o||e[8]!==s||e[9]!==c?(y=r(x=>{s(()=>o.unlinkAuthAccount({accountId:x,userId:c}))},"y"),e[7]=o,e[8]=s,e[9]=c,e[10]=y):y=e[10];let I=y,h;e[11]!==i?(h=i("Linked accounts"),e[11]=i,e[12]=h):h=e[12];let g;e[13]!==h?(g=(0,t.jsx)(Ee,{children:h}),e[13]=h,e[14]=g):g=e[14];let v;e[15]!==w?(v=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:w}),e[15]=w,e[16]=v):v=e[16];let f;e[17]!==n||e[18]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=n,e[18]=i,e[19]=f):f=e[19];let d;e[20]!==n||e[21]!==l||e[22]!==I||e[23]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(U,{children:i("provider")}),(0,t.jsx)(U,{children:i("created")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)($e,{children:n.map(x=>{let F=Ae(x.id);return(0,t.jsxs)(M,{"data-testid":`ud-account-${F}`,children:[(0,t.jsx)(_,{children:Ae(x.providerId)}),(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(x.createdAt)}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`ud-unlink-${F}`,disabled:l,onClick:r(()=>{I(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},F)})})]})})}),e[20]=n,e[21]=l,e[22]=I,e[23]=i,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==v||e[27]!==f||e[28]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,v,f,d]}),e[25]=g,e[26]=v,e[27]=f,e[28]=d,e[29]=A):A=e[29],A},"it"),ot=r(u=>{let e=(0,Z.c)(40),{busy:l,capabilities:s,runAction:c,userId:a,version:o}=u,i=E(),n=W(),[m,w]=(0,k.useState)(null),S;e[0]!==s.passkey||e[1]!==i||e[2]!==a?(S=r(()=>{s.passkey&&ze((async()=>{try{w(await i.listAuthPasskeys({userId:a}))}catch{w(null)}})())},"I"),e[0]=s.passkey,e[1]=i,e[2]=a,e[3]=S):S=e[3];let b;e[4]!==s.passkey||e[5]!==i||e[6]!==a||e[7]!==o?(b=[s.passkey,i,a,o],e[4]=s.passkey,e[5]=i,e[6]=a,e[7]=o,e[8]=b):b=e[8],(0,k.useEffect)(S,b);let C;e[9]!==i||e[10]!==c||e[11]!==a?(C=r(()=>{c(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=c,e[11]=a,e[12]=C):C=e[12];let y=C,I;e[13]!==i||e[14]!==c?(I=r(F=>{c(()=>i.deleteAuthPasskey({passkeyId:F}))},"A"),e[13]=i,e[14]=c,e[15]=I):I=e[15];let h=I,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let v;e[18]!==g?(v=(0,t.jsx)(Ee,{children:g}),e[18]=g,e[19]=v):v=e[19];let f;e[20]!==l||e[21]!==s.twoFactor||e[22]!==y||e[23]!==n?(f=s.twoFactor&&(0,t.jsx)(z,{"data-testid":"ud-disable-2fa",disabled:l,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")}),e[20]=l,e[21]=s.twoFactor,e[22]=y,e[23]=n,e[24]=f):f=e[24];let d;e[25]!==s.passkey||e[26]!==m||e[27]!==n?(d=s.passkey&&m!==null&&m.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")}),e[25]=s.passkey,e[26]=m,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==l||e[30]!==s.passkey||e[31]!==h||e[32]!==m||e[33]!==n?(A=s.passkey&&m!==null&&m.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)($e,{children:m.map(F=>{let q=Ae(F.id);return(0,t.jsxs)(M,{"data-testid":`ud-passkey-${q}`,children:[(0,t.jsx)(_,{children:Ae(F.name)||q}),(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(F.createdAt)}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`ud-delete-passkey-${q}`,disabled:l,onClick:r(()=>{h(q)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})})]},q)})})]})})}),e[29]=l,e[30]=s.passkey,e[31]=h,e[32]=m,e[33]=n,e[34]=A):A=e[34];let x;return e[35]!==v||e[36]!==f||e[37]!==d||e[38]!==A?(x=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[v,f,d,A]}),e[35]=v,e[36]=f,e[37]=d,e[38]=A,e[39]=x):x=e[39],x},"nt"),ct=/(?:at|expires)$/iu,ut=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),mt=r((u,e)=>typeof e=="number"&&ct.test(u)?Ie(e):Ae(e),"ct"),ht=r(({capabilities:u,onChanged:e,onClose:l,user:s})=>{let c=E(),a=W(),o=s.banned===!0,[i,n]=(0,k.useState)(null),[m,w]=(0,k.useState)(!1),[S,b]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof s.role=="string"?s.role:""),[I,h]=(0,k.useState)(""),[g,v]=(0,k.useState)(""),[f,d]=(0,k.useState)(""),[A,x]=(0,k.useState)(null),[F,q]=(0,k.useState)(!1),R=r((N,T)=>{ze((async()=>{w(!0),n(null);try{let L=await N();T?.refresh!==!1&&(b(O=>O+1),e()),T?.onResult?.(L)}catch(L){n(Te(L))}finally{w(!1)}})())},"_"),Be=r(N=>{y(N.target.value)},"De"),G=r(N=>{h(N.target.value)},"O"),Pe=r(N=>{v(N.target.value)},"je"),H=r(N=>{d(N.target.value)},"G"),Re=r(()=>{let N=C.trim();N!==""&&R(async()=>{await c.setAuthUserRole({role:N,userId:s.id})})},"Se"),J=r(()=>{let N=Number.parseInt(g,10),T=Number.isFinite(N)&&N>0?N*86400:void 0;R(async()=>{await c.banAuthUser({expiresInSeconds:T,reason:I.trim()===""?void 0:I.trim(),userId:s.id})})},"H"),j=r(()=>{R(async()=>{await c.unbanAuthUser({userId:s.id})})},"R"),K=r(()=>{R(async()=>{await c.setAuthUserPassword({newPassword:f,userId:s.id}),d("")})},"J"),Fe=r(()=>{R(()=>c.impersonateAuthUser({userId:s.id}),{onResult:r(N=>{x(N.token)},"onResult"),refresh:!1})},"we"),Q=r(()=>{R(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"K"),De=r(()=>{R(async()=>{await c.removeAuthUser({userId:s.id}),l()})},"Te"),X=r(()=>{q(!0)},"W"),Se=r(()=>{q(!1)},"Ce"),Y=Object.entries(s).filter(([N])=>!ut.has(N));return(0,t.jsxs)(Ve,{label:a("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsx)(P,{variant:"secondary",children:s.role}),o?(0,t.jsx)(P,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(P,{variant:"outline",children:a("Active")}),s.emailVerified===!0?(0,t.jsx)(P,{variant:"secondary",children:a("verified")}):(0,t.jsx)(P,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(z,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),u.admin&&(0,t.jsxs)(we,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:C})]}),(0,t.jsx)(z,{"data-testid":"ud-set-role",disabled:m||C.trim()==="",onClick:Re,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),o?(0,t.jsx)(z,{"data-testid":"ud-unban",disabled:m,onClick:j,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),(0,t.jsx)(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:G,value:I})]}),(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-days",children:a("Days")}),(0,t.jsx)(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Pe,type:"number",value:g})]}),(0,t.jsx)(z,{"data-testid":"ud-ban",disabled:m,onClick:J,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(B,{"data-testid":"ud-password",id:"ud-password",onChange:H,type:"password",value:f})]}),(0,t.jsx)(z,{"data-testid":"ud-set-password",disabled:m||f==="",onClick:K,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(z,{"data-testid":"ud-impersonate",disabled:m,onClick:Fe,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(z,{"data-testid":"ud-revoke-all",disabled:m,onClick:Q,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),F?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{"data-testid":"ud-delete-confirm",disabled:m,onClick:De,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(z,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(z,{"data-testid":"ud-delete",disabled:m,onClick:X,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),A!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(D,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A})]})]})]}),(0,t.jsx)(nt,{busy:m,runAction:R,userId:s.id,version:S}),u.accounts&&(0,t.jsx)(dt,{busy:m,runAction:R,userId:s.id,version:S}),(u.twoFactor||u.passkey)&&(0,t.jsx)(ot,{busy:m,capabilities:u,runAction:R,userId:s.id,version:S}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:Y.map(([N,T])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:mt(N,T)})]},N))})]})]})},"ut"),pt=50,$t=r(({pageSize:u=pt}={})=>{let e=E(),l=W(),[s,c]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),i=He(s),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:b}=at(),C=i.trim(),y=a.trim(),I=Ge(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),h=I.data?.rows??null,g=I.error,v=r(()=>{I.refetch()},"v");Je(()=>{I.refetch()},!0);let f=n===null?null:h?.find(d=>d.id===n)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(B,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:r(d=>{c(d.target.value)},"onChange"),placeholder:l("Search by email or name\u2026"),value:s}),(0,t.jsx)(B,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:r(d=>{o(d.target.value)},"onChange"),placeholder:l("Filter by role"),value:a}),(0,t.jsx)(z,{"data-testid":"us-new",onClick:r(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:l("New user")})]}),g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&(0,t.jsx)(Ze,{description:l("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("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"})}),testId:"us-empty",title:l("No users.")}),h!==null&&h.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"us-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(U,{children:l("id")}),(0,t.jsx)(U,{children:l("email")}),(0,t.jsx)(U,{children:l("name")}),(0,t.jsx)(U,{children:l("role")}),(0,t.jsx)(U,{children:l("status")}),(0,t.jsx)(U,{children:l("verified")}),(0,t.jsx)(U,{children:l("created")}),(0,t.jsx)(U,{"aria-label":l("Actions")})]})}),(0,t.jsx)($e,{children:h.map(d=>(0,t.jsxs)(M,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsx)(_,{className:"font-mono text-xs",children:d.id}),(0,t.jsx)(_,{children:d.email??""}),(0,t.jsx)(_,{children:d.name??""}),(0,t.jsx)(_,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsx)(P,{variant:"secondary",children:d.role}):""}),(0,t.jsx)(_,{children:d.banned===!0?(0,t.jsx)(P,{variant:"destructive",children:l("Banned")}):(0,t.jsx)(P,{variant:"success",children:l("Active")})}),(0,t.jsx)(_,{children:d.emailVerified===!0?(0,t.jsx)(P,{variant:"success",children:l("yes")}):(0,t.jsx)(P,{variant:"outline",children:l("no")})}),(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(d.createdAt)}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`us-manage-${d.id}`,onClick:r(()=>{m(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},d.id))})]})})}),f!==null&&(0,t.jsx)(ht,{capabilities:b,onChanged:v,onClose:r(()=>{m(null)},"onClose"),user:f}),w&&(0,t.jsx)(it,{onClose:r(()=>{S(!1)},"onClose"),onCreated:v})]})},"_t");export{$t as UsersPanel};
@@ -1 +1 @@
1
- import{a as J}from"./chunk-54MMVNPT.js";import{a as L}from"./chunk-LFKCLLPT.js";import{a as O}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as _}from"./chunk-XSD4Y6SQ.js";import{a as P,b as W,c as B,d as A,e as m,f as u}from"./chunk-MIQTKZAR.js";import{a as E,e as K}from"./chunk-UZERI5YC.js";import{a as F}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as S}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as D}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as T}from"./chunk-XQCVZAGU.js";import{d as j}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as N,e as C,f as X,g as q,h as z}from"./chunk-3XIESWL4.js";var U=C(q(),1),Z=C(X(),1);var e=C(z(),1);var R=80,G=N(a=>{if(a===void 0)return"";let t=JSON.stringify(a);return t.length>R?`${t.slice(0,R)}\u2026`:t},"X"),H=N(a=>{let t=[];for(let i of a){let n=i.id.toString();if(i.subscriptions.length===0){t.push({admin:i.admin,connectionId:i.id,key:`c${n}`,subscription:null});continue}i.subscriptions.forEach((s,y)=>{t.push({admin:i.admin,connectionId:i.id,key:`c${n}-s${y.toString()}`,subscription:s})})}return t},"Z"),M=(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),lt=N(a=>{let t=(0,U.c)(22),{initialShardKey:i}=a,n=j(),[s,y]=(0,Z.useState)(i??""),h;t[0]!==s?(h=s.trim(),t[0]=s,t[1]=h):h=t[1];let k=L(h,400),p;t[2]===Symbol.for("react.memo_cache_sentinel")?(p={},t[2]=p):p=t[2];let f;t[3]!==k?(f={keepPreviousData:!0,shardKey:k},t[3]=k,t[4]=f):f=t[4];let{data:r,error:o,errorSource:d,refetch:Q}=_(D.listSubscriptions,p,f);J(Q,!0);let b;if(t[5]!==o||t[6]!==d||t[7]!==r||t[8]!==s||t[9]!==n){let I=r===void 0?[]:H(r.connections),c;t[11]!==s?(c=(0,e.jsx)(F,{onChange:y,testId:"subs-shard-input",value:s}),t[11]=s,t[12]=c):c=t[12];let l;t[13]!==r||t[14]!==n?(l=r!==void 0&&(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,e.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:r.totalConnections})}),(0,e.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:r.totalSubscriptions})})]}),t[13]=r,t[14]=n,t[15]=l):l=t[15];let g;t[16]!==c||t[17]!==l?(g=(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,l]}),t[16]=c,t[17]=l,t[18]=g):g=t[18];let v;t[19]!==o||t[20]!==d?(v=o!==null&&(0,e.jsx)(O,{error:d,testId:"subs-error"}),t[19]=o,t[20]=d,t[21]=v):v=t[21],b=(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&r!==void 0&&I.length===0&&(0,e.jsx)(T,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"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"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&I.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(K,{className:"px-0",children:(0,e.jsxs)(P,{"data-testid":"subs-table",children:[(0,e.jsx)(W,{children:(0,e.jsxs)(A,{children:[(0,e.jsx)(m,{children:n("Connection")}),(0,e.jsx)(m,{children:n("Function path")}),(0,e.jsx)(m,{children:n("Table")}),(0,e.jsx)(m,{children:n("Arguments")})]})}),(0,e.jsx)(B,{children:I.map(x=>{let{subscription:w}=x,$=G(w?.args);return(0,e.jsxs)(A,{"data-testid":"subs-row",children:[(0,e.jsx)(u,{className:"font-medium tabular-nums",children:(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,e.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,e.jsx)(u,{className:"font-mono text-xs",children:w?.functionPath??M}),(0,e.jsx)(u,{children:w?.table??M}),(0,e.jsx)(u,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:$||void 0,children:$||M})]},x.key)})})]})})})]}),t[5]=o,t[6]=d,t[7]=r,t[8]=s,t[9]=n,t[10]=b}else b=t[10];return b},"at");export{lt as default};
1
+ import{a as J}from"./chunk-54MMVNPT.js";import{a as L}from"./chunk-LFKCLLPT.js";import{a as O}from"./chunk-HK4OVYG3.js";import"./chunk-XXQUMVWH.js";import{b as _}from"./chunk-BMQJ4CAO.js";import{a as P,b as W,c as B,d as A,e as m,f as u}from"./chunk-MIQTKZAR.js";import{a as E,e as K}from"./chunk-UZERI5YC.js";import{a as F}from"./chunk-LFXFP4IF.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as S}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as D}from"./chunk-AADXUXZO.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as T}from"./chunk-XQCVZAGU.js";import{d as j}from"./chunk-4CGALXS3.js";import"./chunk-AADILRJW.js";import{a as N,e as C,f as X,g as q,h as z}from"./chunk-3XIESWL4.js";var U=C(q(),1),Z=C(X(),1);var e=C(z(),1);var R=80,G=N(a=>{if(a===void 0)return"";let t=JSON.stringify(a);return t.length>R?`${t.slice(0,R)}\u2026`:t},"X"),H=N(a=>{let t=[];for(let i of a){let n=i.id.toString();if(i.subscriptions.length===0){t.push({admin:i.admin,connectionId:i.id,key:`c${n}`,subscription:null});continue}i.subscriptions.forEach((s,y)=>{t.push({admin:i.admin,connectionId:i.id,key:`c${n}-s${y.toString()}`,subscription:s})})}return t},"Z"),M=(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),lt=N(a=>{let t=(0,U.c)(22),{initialShardKey:i}=a,n=j(),[s,y]=(0,Z.useState)(i??""),h;t[0]!==s?(h=s.trim(),t[0]=s,t[1]=h):h=t[1];let k=L(h,400),p;t[2]===Symbol.for("react.memo_cache_sentinel")?(p={},t[2]=p):p=t[2];let f;t[3]!==k?(f={keepPreviousData:!0,shardKey:k},t[3]=k,t[4]=f):f=t[4];let{data:r,error:o,errorSource:d,refetch:Q}=_(D.listSubscriptions,p,f);J(Q,!0);let b;if(t[5]!==o||t[6]!==d||t[7]!==r||t[8]!==s||t[9]!==n){let I=r===void 0?[]:H(r.connections),c;t[11]!==s?(c=(0,e.jsx)(F,{onChange:y,testId:"subs-shard-input",value:s}),t[11]=s,t[12]=c):c=t[12];let l;t[13]!==r||t[14]!==n?(l=r!==void 0&&(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,e.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:r.totalConnections})}),(0,e.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:r.totalSubscriptions})})]}),t[13]=r,t[14]=n,t[15]=l):l=t[15];let g;t[16]!==c||t[17]!==l?(g=(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,l]}),t[16]=c,t[17]=l,t[18]=g):g=t[18];let v;t[19]!==o||t[20]!==d?(v=o!==null&&(0,e.jsx)(O,{error:d,testId:"subs-error"}),t[19]=o,t[20]=d,t[21]=v):v=t[21],b=(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&r!==void 0&&I.length===0&&(0,e.jsx)(T,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"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"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&I.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(K,{className:"px-0",children:(0,e.jsxs)(P,{"data-testid":"subs-table",children:[(0,e.jsx)(W,{children:(0,e.jsxs)(A,{children:[(0,e.jsx)(m,{children:n("Connection")}),(0,e.jsx)(m,{children:n("Function path")}),(0,e.jsx)(m,{children:n("Table")}),(0,e.jsx)(m,{children:n("Arguments")})]})}),(0,e.jsx)(B,{children:I.map(x=>{let{subscription:w}=x,$=G(w?.args);return(0,e.jsxs)(A,{"data-testid":"subs-row",children:[(0,e.jsx)(u,{className:"font-medium tabular-nums",children:(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,e.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,e.jsx)(u,{className:"font-mono text-xs",children:w?.functionPath??M}),(0,e.jsx)(u,{children:w?.table??M}),(0,e.jsx)(u,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:$||void 0,children:$||M})]},x.key)})})]})})})]}),t[5]=o,t[6]=d,t[7]=r,t[8]=s,t[9]=n,t[10]=b}else b=t[10];return b},"at");export{lt as default};