@lunora/studio 1.0.0-alpha.37 → 1.0.0-alpha.38

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 (67) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/packem_chunks/auth-config-panel.js +290 -104
  3. package/dist/packem_chunks/organizations-panel.js +3002 -494
  4. package/dist/packem_chunks/users-panel.js +576 -110
  5. package/dist/packem_shared/use-async-submit-BWMDwRa4.js +91 -0
  6. package/dist/standalone/{chunk-PACH5AHG.js → chunk-2F4VYKM6.js} +1 -1
  7. package/dist/standalone/{chunk-OIZ4CHPN.js → chunk-2GFAOIC3.js} +1 -1
  8. package/dist/standalone/{chunk-OY3GVYS7.js → chunk-2SAZ5BZ5.js} +1 -1
  9. package/dist/standalone/chunk-2SE7II7A.js +1 -0
  10. package/dist/standalone/{chunk-5OH3VPZF.js → chunk-34OQUHSV.js} +1 -1
  11. package/dist/standalone/{chunk-2THHW7BC.js → chunk-3DBG4RIV.js} +1 -1
  12. package/dist/standalone/{chunk-EUIHTPKI.js → chunk-3UFZCRWL.js} +1 -1
  13. package/dist/standalone/{chunk-QLM6FYZW.js → chunk-4FL3EDN5.js} +1 -1
  14. package/dist/standalone/{chunk-ILCTSAOB.js → chunk-4JOKDSPU.js} +1 -1
  15. package/dist/standalone/{chunk-BQUQS7QN.js → chunk-7FF76BYY.js} +1 -1
  16. package/dist/standalone/chunk-7YXOPTWI.js +1 -0
  17. package/dist/standalone/chunk-AJKR6PY7.js +1 -0
  18. package/dist/standalone/{chunk-TOJ3TC35.js → chunk-FA3CCTXK.js} +1 -1
  19. package/dist/standalone/chunk-GLUNBZRI.js +1 -0
  20. package/dist/standalone/chunk-GM4NPF3W.js +1 -0
  21. package/dist/standalone/{chunk-XLQ4BHBD.js → chunk-HLZ4YLRK.js} +1 -1
  22. package/dist/standalone/{chunk-RRAFQ5G2.js → chunk-I3VXCZZL.js} +1 -1
  23. package/dist/standalone/{chunk-7VF3IAAW.js → chunk-IJPFHUJK.js} +1 -1
  24. package/dist/standalone/chunk-IQ466Q6W.js +1 -0
  25. package/dist/standalone/{chunk-LD2R263D.js → chunk-IU6GTBPD.js} +1 -1
  26. package/dist/standalone/{chunk-764T6X6X.js → chunk-IXDH4GL5.js} +1 -1
  27. package/dist/standalone/{chunk-6WRZP62V.js → chunk-JTTVXBLU.js} +1 -1
  28. package/dist/standalone/{chunk-7SLSB2TS.js → chunk-KQTCLPLO.js} +2 -2
  29. package/dist/standalone/chunk-KSKXW5PX.js +1 -0
  30. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  31. package/dist/standalone/{chunk-BI35RXKQ.js → chunk-LEHGGJP2.js} +1 -1
  32. package/dist/standalone/chunk-LNZIB2MD.js +1 -0
  33. package/dist/standalone/{chunk-OCHNCAXJ.js → chunk-MZ756AFF.js} +1 -1
  34. package/dist/standalone/chunk-N7G5I47W.js +1 -0
  35. package/dist/standalone/{chunk-TO4JQX7W.js → chunk-NV6RHG5L.js} +1 -1
  36. package/dist/standalone/chunk-O3I57FXK.js +1 -0
  37. package/dist/standalone/{chunk-YEVCU7TB.js → chunk-OES45DFG.js} +1 -1
  38. package/dist/standalone/{chunk-DVKPRFIJ.js → chunk-OIC7EJWI.js} +1 -1
  39. package/dist/standalone/{chunk-ZU4DZ6NK.js → chunk-OLE2AYTD.js} +1 -1
  40. package/dist/standalone/{chunk-U4OAQPBT.js → chunk-P3ZMBPCY.js} +1 -1
  41. package/dist/standalone/{chunk-VTGBPW24.js → chunk-P5JW7HKP.js} +1 -1
  42. package/dist/standalone/{chunk-MPTM7ZU3.js → chunk-Q3PTSVVU.js} +1 -1
  43. package/dist/standalone/chunk-QKQABJBE.js +1 -0
  44. package/dist/standalone/{chunk-JE2YOAB7.js → chunk-R5OQZYSW.js} +1 -1
  45. package/dist/standalone/{chunk-ATYUMPDM.js → chunk-SE2TQAHJ.js} +1 -1
  46. package/dist/standalone/{chunk-DVC6YWVP.js → chunk-TI7SE33D.js} +1 -1
  47. package/dist/standalone/{chunk-DWTBY343.js → chunk-VFJPO4UO.js} +1 -1
  48. package/dist/standalone/chunk-VON7JUPG.js +1 -0
  49. package/dist/standalone/{chunk-46K3NKPA.js → chunk-X7RPB4K4.js} +1 -1
  50. package/dist/standalone/{chunk-X5P2WRYI.js → chunk-XFSUINL3.js} +1 -1
  51. package/dist/standalone/{chunk-SLKF2L74.js → chunk-XGUOXHX4.js} +1 -1
  52. package/dist/standalone/{chunk-M55U7NHO.js → chunk-ZL4E2WVF.js} +1 -1
  53. package/dist/standalone/studio.js +1 -1
  54. package/package.json +3 -3
  55. package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
  56. package/dist/standalone/chunk-22W5VKZ6.js +0 -1
  57. package/dist/standalone/chunk-2GGMGPEP.js +0 -1
  58. package/dist/standalone/chunk-BACPICH6.js +0 -1
  59. package/dist/standalone/chunk-DORBUITF.js +0 -1
  60. package/dist/standalone/chunk-IOFMK4D7.js +0 -1
  61. package/dist/standalone/chunk-LI43EKM6.js +0 -1
  62. package/dist/standalone/chunk-MPYFGAOW.js +0 -1
  63. package/dist/standalone/chunk-NKJDGOM3.js +0 -1
  64. package/dist/standalone/chunk-PN5NCZDX.js +0 -1
  65. package/dist/standalone/chunk-RSEEHNFI.js +0 -1
  66. package/dist/standalone/chunk-X7MMBSNW.js +0 -1
  67. package/dist/standalone/chunk-XUGSA2NG.js +0 -1
@@ -1 +1 @@
1
- import{a as C}from"./chunk-J6J54MBP.js";import{a as E}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as x,b as I,c as N,d as u,e as l,f as o}from"./chunk-GTM65MVX.js";import{a as g}from"./chunk-BOXSWNXZ.js";import{a as A}from"./chunk-TAD43CG5.js";import{b as y}from"./chunk-DVKPRFIJ.js";import{a as m,e as h}from"./chunk-SEU5V7I6.js";import{b as v}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as S,n as b}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as c,e as Q,h as V}from"./chunk-RRCPZMC2.js";var e=Q(V(),1);var P=new Set(["active","trialing"]),D=new Set(["past_due","unpaid"]),a=c((t,s)=>{if(t[s]!==void 0)return t[s];let d=t.__doc__;if(typeof d=="string")try{let n=JSON.parse(d);if(n!==null&&typeof n=="object"&&!Array.isArray(n))return n[s]}catch{}},"readField"),i=c(t=>typeof t=="string"?t:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?String(t):"","text"),F=c(t=>P.has(t)?"default":D.has(t)?"destructive":"outline","badgeVariant"),K=c(({limit:t=100})=>{let s=S(),d=y(g.readTablePage,{filters:[],limit:t,offset:0,orderBy:[],search:"",table:"subscriptions"}),n=y(g.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"});C(()=>{d.refetch(),n.refetch()},!0);let f=d.data?.rows??[],R=n.data?.rows??[],B=d.error??n.error,w=d.error===null?n.errorSource:d.errorSource,T=f.filter(r=>P.has(i(a(r,"state")))).length,j=R.toSorted((r,p)=>Number(a(p,"processedAt")??0)-Number(a(r,"processedAt")??0));return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsxDEV)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxDEV)(m,{className:"justify-between gap-0 py-0",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Subscriptions")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,e.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T},void 0,!1),(0,e.jsxDEV)(v,{variant:"default",children:s("{count} active",{count:T})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s("{total} total",{total:f.length})},void 0,!1)]},void 0,!0)},void 0,!1),B===null?void 0:(0,e.jsxDEV)(E,{error:w},void 0,!1),f.length===0&&!d.isLoading?(0,e.jsxDEV)(A,{testId:"payments-empty",title:s("No subscriptions yet")},void 0,!1):(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(x,{children:[(0,e.jsxDEV)(I,{children:(0,e.jsxDEV)(u,{children:[(0,e.jsxDEV)(l,{children:s("Provider")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Reference")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Plan")},void 0,!1),(0,e.jsxDEV)(l,{children:s("State")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Renews")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(N,{children:f.map(r=>{let p=i(a(r,"state"));return(0,e.jsxDEV)(u,{"data-testid":"payment-subscription-row",children:[(0,e.jsxDEV)(o,{children:i(a(r,"provider"))},void 0,!1),(0,e.jsxDEV)(o,{children:i(a(r,"referenceId"))},void 0,!1),(0,e.jsxDEV)(o,{children:i(a(r,"priceId"))},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(v,{variant:F(p),children:p},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:b(a(r,"currentPeriodEnd"))},void 0,!1)]},i(a(r,"providerSubscriptionId")),!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Recent webhook events")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(x,{children:(0,e.jsxDEV)(N,{children:j.map(r=>(0,e.jsxDEV)(u,{"data-testid":"payment-event-row",children:[(0,e.jsxDEV)(o,{children:i(a(r,"provider"))},void 0,!1),(0,e.jsxDEV)(o,{className:"font-medium",children:i(a(r,"type"))},void 0,!1),(0,e.jsxDEV)(o,{className:"text-muted-foreground",children:i(a(r,"providerEventId"))},void 0,!1),(0,e.jsxDEV)(o,{children:b(a(r,"processedAt"))},void 0,!1)]},i(a(r,"providerEventId")),!0))},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PaymentsPanel");export{K as PaymentsPanel};
1
+ import{a as C}from"./chunk-J6J54MBP.js";import{a as E}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as x,b as I,c as N,d as u,e as l,f as o}from"./chunk-GTM65MVX.js";import{a as g}from"./chunk-BOXSWNXZ.js";import{a as A}from"./chunk-TAD43CG5.js";import{b as y}from"./chunk-OIC7EJWI.js";import{a as m,e as h}from"./chunk-SEU5V7I6.js";import{b as v}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as S,n as b}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as c,e as Q,h as V}from"./chunk-RRCPZMC2.js";var e=Q(V(),1);var P=new Set(["active","trialing"]),D=new Set(["past_due","unpaid"]),a=c((t,s)=>{if(t[s]!==void 0)return t[s];let d=t.__doc__;if(typeof d=="string")try{let n=JSON.parse(d);if(n!==null&&typeof n=="object"&&!Array.isArray(n))return n[s]}catch{}},"readField"),i=c(t=>typeof t=="string"?t:typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"?String(t):"","text"),F=c(t=>P.has(t)?"default":D.has(t)?"destructive":"outline","badgeVariant"),K=c(({limit:t=100})=>{let s=S(),d=y(g.readTablePage,{filters:[],limit:t,offset:0,orderBy:[],search:"",table:"subscriptions"}),n=y(g.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"});C(()=>{d.refetch(),n.refetch()},!0);let f=d.data?.rows??[],R=n.data?.rows??[],B=d.error??n.error,w=d.error===null?n.errorSource:d.errorSource,T=f.filter(r=>P.has(i(a(r,"state")))).length,j=R.toSorted((r,p)=>Number(a(p,"processedAt")??0)-Number(a(r,"processedAt")??0));return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsxDEV)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxDEV)(m,{className:"justify-between gap-0 py-0",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Subscriptions")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,e.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:T},void 0,!1),(0,e.jsxDEV)(v,{variant:"default",children:s("{count} active",{count:T})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s("{total} total",{total:f.length})},void 0,!1)]},void 0,!0)},void 0,!1),B===null?void 0:(0,e.jsxDEV)(E,{error:w},void 0,!1),f.length===0&&!d.isLoading?(0,e.jsxDEV)(A,{testId:"payments-empty",title:s("No subscriptions yet")},void 0,!1):(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(x,{children:[(0,e.jsxDEV)(I,{children:(0,e.jsxDEV)(u,{children:[(0,e.jsxDEV)(l,{children:s("Provider")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Reference")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Plan")},void 0,!1),(0,e.jsxDEV)(l,{children:s("State")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Renews")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(N,{children:f.map(r=>{let p=i(a(r,"state"));return(0,e.jsxDEV)(u,{"data-testid":"payment-subscription-row",children:[(0,e.jsxDEV)(o,{children:i(a(r,"provider"))},void 0,!1),(0,e.jsxDEV)(o,{children:i(a(r,"referenceId"))},void 0,!1),(0,e.jsxDEV)(o,{children:i(a(r,"priceId"))},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(v,{variant:F(p),children:p},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:b(a(r,"currentPeriodEnd"))},void 0,!1)]},i(a(r,"providerSubscriptionId")),!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Recent webhook events")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(x,{children:(0,e.jsxDEV)(N,{children:j.map(r=>(0,e.jsxDEV)(u,{"data-testid":"payment-event-row",children:[(0,e.jsxDEV)(o,{children:i(a(r,"provider"))},void 0,!1),(0,e.jsxDEV)(o,{className:"font-medium",children:i(a(r,"type"))},void 0,!1),(0,e.jsxDEV)(o,{className:"text-muted-foreground",children:i(a(r,"providerEventId"))},void 0,!1),(0,e.jsxDEV)(o,{children:b(a(r,"processedAt"))},void 0,!1)]},i(a(r,"providerEventId")),!0))},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PaymentsPanel");export{K as PaymentsPanel};
@@ -1 +1 @@
1
- import{a as $}from"./chunk-WXPWVBIY.js";import{a as W}from"./chunk-TDL7NEWA.js";import{a as _}from"./chunk-2K47A3P6.js";import{a as q}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as G,b as P,c as V,d as b,e as i,f as o}from"./chunk-GTM65MVX.js";import{a as y}from"./chunk-JSEXCW5Q.js";import{a as U}from"./chunk-K3GNLVYK.js";import{b as Q}from"./chunk-TBMYIZIO.js";import{R as w}from"./chunk-3CJW6NWG.js";import{c as L}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as g}from"./chunk-BOXSWNXZ.js";import{a as A}from"./chunk-TAD43CG5.js";import{b as H}from"./chunk-DVKPRFIJ.js";import{a as k,e as B}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as M}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as S,e as F,f as K,g as O,k as j,n as z}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as n,e as D,f as le,h as ce}from"./chunk-RRCPZMC2.js";var a=D(le(),1);var e=D(ce(),1);var ue=F(g.runMigration),we=n(({initialShardKey:J})=>{let X=M(),r=S(),[c,Y]=(0,a.useState)(J??""),[x,Z]=(0,a.useState)(""),[R,ee]=(0,a.useState)("up"),[f,re]=(0,a.useState)(!0),[u,N]=(0,a.useState)(!1),[d,h]=(0,a.useState)(null),[C,p]=(0,a.useState)(null),m=_(c.trim(),400),I=c.trim()===m,s=H(g.migrationStatus,{},{live:!0,shardKey:m}),l=s.data?.migrations??null,te=s.error,{errorSource:ae,liveError:ie}=s;(0,a.useEffect)(()=>{s.data!==void 0&&Q(m)},[s.data,m]);let oe=n(async()=>{let t=x.trim();if(t===""){p(r("Enter a migration id")),h(null);return}N(!0),p(null);try{let v=await X.query(ue,{direction:R,dryRun:f,id:t},K(c));h(v),s.refetch()}catch(v){h(null),p(O(v))}finally{N(!1)}},"run"),E=n(()=>{j(oe())},"runMigration"),ne=n(t=>{Z(t.target.value)},"onIdChange"),se=n(t=>{ee(t.target.value==="down"?"down":"up")},"onDirectionChange"),de=n(t=>{re(t.target.checked)},"onDryRunChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(U,{onChange:Y,testId:"mg-shard-input",value:c},void 0,!1),(0,e.jsxDEV)($,{message:ie,prefix:"mg"},void 0,!1)]},void 0,!0),te!==null&&(0,e.jsxDEV)(q,{error:ae,testId:"mg-status-error"},void 0,!1),l!==null&&l.length===0&&(0,e.jsxDEV)(A,{description:r("Data migrations you run against this shard will be tracked here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1)},void 0,!1),testId:"mg-empty",title:r("No migrations have run on this shard.")},void 0,!1),l!==null&&l.length>0&&(0,e.jsxDEV)(k,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(B,{className:"px-0",children:(0,e.jsxDEV)(G,{"data-testid":"mg-table",children:[(0,e.jsxDEV)(P,{children:(0,e.jsxDEV)(b,{children:[(0,e.jsxDEV)(i,{children:r("id")},void 0,!1),(0,e.jsxDEV)(i,{children:r("direction")},void 0,!1),(0,e.jsxDEV)(i,{children:r("status")},void 0,!1),(0,e.jsxDEV)(i,{children:r("processed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("changed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("updated")},void 0,!1),(0,e.jsxDEV)(i,{children:r("error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:l.map(t=>(0,e.jsxDEV)(b,{"data-testid":`mg-row-${t.id}`,children:[(0,e.jsxDEV)(o,{children:t.id},void 0,!1),(0,e.jsxDEV)(o,{children:t.direction},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:t.status},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:t.processed},void 0,!1),(0,e.jsxDEV)(o,{children:t.changed},void 0,!1),(0,e.jsxDEV)(o,{children:z(t.updatedAt)},void 0,!1),(0,e.jsxDEV)(o,{children:t.error??""},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsxDEV)(y,{children:r("Run migration")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(w,{"aria-label":r("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:ne,placeholder:r("migration id"),value:x},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":r("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:se,value:R,children:[(0,e.jsxDEV)("option",{value:"up",children:r("up")},void 0,!1),(0,e.jsxDEV)("option",{value:"down",children:r("down")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,e.jsxDEV)("input",{checked:f,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:de,type:"checkbox"},void 0,!1),r("Dry run")]},void 0,!0),f?(0,e.jsxDEV)(L,{"data-testid":"mg-run",disabled:u||!I,onClick:E,size:"sm",type:"button",children:r(u?"Running\u2026":"Run")},void 0,!1):(0,e.jsxDEV)(W,{confirmLabel:r(u?"Running\u2026":"Run migration?"),disabled:u||!I,onConfirm:E,testId:"mg-run",children:r("Run")},void 0,!1)]},void 0,!0)]},void 0,!0),C!==null&&(0,e.jsxDEV)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:C},void 0,!1),d!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?r("Dry run: "):"",r("{status} \u2014 processed",{status:d.status}),d.processed,r(", changed"),d.changed]},void 0,!0)]},void 0,!0)},"MigrationsPanel");export{we as MigrationsPanel};
1
+ import{a as $}from"./chunk-WXPWVBIY.js";import{a as W}from"./chunk-TDL7NEWA.js";import{a as _}from"./chunk-2K47A3P6.js";import{a as q}from"./chunk-AJIUI7DD.js";import"./chunk-XNJNSCLM.js";import{a as G,b as P,c as V,d as b,e as i,f as o}from"./chunk-GTM65MVX.js";import{a as y}from"./chunk-JSEXCW5Q.js";import{a as U}from"./chunk-K3GNLVYK.js";import{b as Q}from"./chunk-TBMYIZIO.js";import{R as w}from"./chunk-3CJW6NWG.js";import{c as L}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as g}from"./chunk-BOXSWNXZ.js";import{a as A}from"./chunk-TAD43CG5.js";import{b as H}from"./chunk-OIC7EJWI.js";import{a as k,e as B}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as M}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as S,e as F,f as K,g as O,k as j,n as z}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as n,e as D,f as le,h as ce}from"./chunk-RRCPZMC2.js";var a=D(le(),1);var e=D(ce(),1);var ue=F(g.runMigration),we=n(({initialShardKey:J})=>{let X=M(),r=S(),[c,Y]=(0,a.useState)(J??""),[x,Z]=(0,a.useState)(""),[R,ee]=(0,a.useState)("up"),[f,re]=(0,a.useState)(!0),[u,N]=(0,a.useState)(!1),[d,h]=(0,a.useState)(null),[C,p]=(0,a.useState)(null),m=_(c.trim(),400),I=c.trim()===m,s=H(g.migrationStatus,{},{live:!0,shardKey:m}),l=s.data?.migrations??null,te=s.error,{errorSource:ae,liveError:ie}=s;(0,a.useEffect)(()=>{s.data!==void 0&&Q(m)},[s.data,m]);let oe=n(async()=>{let t=x.trim();if(t===""){p(r("Enter a migration id")),h(null);return}N(!0),p(null);try{let v=await X.query(ue,{direction:R,dryRun:f,id:t},K(c));h(v),s.refetch()}catch(v){h(null),p(O(v))}finally{N(!1)}},"run"),E=n(()=>{j(oe())},"runMigration"),ne=n(t=>{Z(t.target.value)},"onIdChange"),se=n(t=>{ee(t.target.value==="down"?"down":"up")},"onDirectionChange"),de=n(t=>{re(t.target.checked)},"onDryRunChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(U,{onChange:Y,testId:"mg-shard-input",value:c},void 0,!1),(0,e.jsxDEV)($,{message:ie,prefix:"mg"},void 0,!1)]},void 0,!0),te!==null&&(0,e.jsxDEV)(q,{error:ae,testId:"mg-status-error"},void 0,!1),l!==null&&l.length===0&&(0,e.jsxDEV)(A,{description:r("Data migrations you run against this shard will be tracked here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"},void 0,!1)},void 0,!1),testId:"mg-empty",title:r("No migrations have run on this shard.")},void 0,!1),l!==null&&l.length>0&&(0,e.jsxDEV)(k,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(B,{className:"px-0",children:(0,e.jsxDEV)(G,{"data-testid":"mg-table",children:[(0,e.jsxDEV)(P,{children:(0,e.jsxDEV)(b,{children:[(0,e.jsxDEV)(i,{children:r("id")},void 0,!1),(0,e.jsxDEV)(i,{children:r("direction")},void 0,!1),(0,e.jsxDEV)(i,{children:r("status")},void 0,!1),(0,e.jsxDEV)(i,{children:r("processed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("changed")},void 0,!1),(0,e.jsxDEV)(i,{children:r("updated")},void 0,!1),(0,e.jsxDEV)(i,{children:r("error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:l.map(t=>(0,e.jsxDEV)(b,{"data-testid":`mg-row-${t.id}`,children:[(0,e.jsxDEV)(o,{children:t.id},void 0,!1),(0,e.jsxDEV)(o,{children:t.direction},void 0,!1),(0,e.jsxDEV)(o,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:t.status},void 0,!1)},void 0,!1),(0,e.jsxDEV)(o,{children:t.processed},void 0,!1),(0,e.jsxDEV)(o,{children:t.changed},void 0,!1),(0,e.jsxDEV)(o,{children:z(t.updatedAt)},void 0,!1),(0,e.jsxDEV)(o,{children:t.error??""},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsxDEV)(y,{children:r("Run migration")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(w,{"aria-label":r("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:ne,placeholder:r("migration id"),value:x},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":r("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:se,value:R,children:[(0,e.jsxDEV)("option",{value:"up",children:r("up")},void 0,!1),(0,e.jsxDEV)("option",{value:"down",children:r("down")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,e.jsxDEV)("input",{checked:f,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:de,type:"checkbox"},void 0,!1),r("Dry run")]},void 0,!0),f?(0,e.jsxDEV)(L,{"data-testid":"mg-run",disabled:u||!I,onClick:E,size:"sm",type:"button",children:r(u?"Running\u2026":"Run")},void 0,!1):(0,e.jsxDEV)(W,{confirmLabel:r(u?"Running\u2026":"Run migration?"),disabled:u||!I,onConfirm:E,testId:"mg-run",children:r("Run")},void 0,!1)]},void 0,!0)]},void 0,!0),C!==null&&(0,e.jsxDEV)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:C},void 0,!1),d!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?r("Dry run: "):"",r("{status} \u2014 processed",{status:d.status}),d.processed,r(", changed"),d.changed]},void 0,!0)]},void 0,!0)},"MigrationsPanel");export{we as MigrationsPanel};
@@ -1,4 +1,4 @@
1
- import{a as hS,b as rp,c as vS,d as dp,e as SS,f as bS,k as ES}from"./chunk-IOFMK4D7.js";import"./chunk-ZPUO7FNI.js";import"./chunk-764T6X6X.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import"./chunk-ZIGWVHCS.js";import"./chunk-7TJJXVSE.js";import"./chunk-WI7GWFEG.js";import{a as gS}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import"./chunk-KZ6INM5M.js";import"./chunk-4QHKBC77.js";import{R as mS}from"./chunk-3CJW6NWG.js";import{c as yS}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as bT}from"./chunk-HV7G6DFP.js";import"./chunk-BOXSWNXZ.js";import"./chunk-TAD43CG5.js";import"./chunk-DVKPRFIJ.js";import"./chunk-SEU5V7I6.js";import"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as fS,e as dS}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as pS,d as fp}from"./chunk-PVZI3CXP.js";import{b as cS}from"./chunk-GMSGZDDH.js";import{a as o,c as gf,e as Wi,f as sS,g as ET,h as rS,j as sp}from"./chunk-RRCPZMC2.js";var TS=gf(Ye=>{"use strict";(function(){function ge(){if(ot=!1,K){var z=Ye.unstable_now();De=z;var j=!0;try{e:{he=!1,Ue&&(Ue=!1,pt(Ke),Ke=-1),oe=!0;var q=V;try{t:{for(se(z),I=J(L);I!==null&&!(I.expirationTime>z&&A());){var xe=I.callback;if(typeof xe=="function"){I.callback=null,V=I.priorityLevel;var Ge=xe(I.expirationTime<=z);if(z=Ye.unstable_now(),typeof Ge=="function"){I.callback=Ge,se(z),j=!0;break t}I===J(L)&&G(L),se(z)}else G(L);I=J(L)}if(I!==null)j=!0;else{var ba=J(de);ba!==null&&ce(ae,ba.startTime-z),j=!1}}break e}finally{I=null,V=q,oe=!1}j=void 0}}finally{j?_e():K=!1}}}o(ge,"performWorkUntilDeadline");function r(z,j){var q=z.length;z.push(j);e:for(;0<q;){var xe=q-1>>>1,Ge=z[xe];if(0<ee(Ge,j))z[xe]=j,z[q]=Ge,q=xe;else break e}}o(r,"push");function J(z){return z.length===0?null:z[0]}o(J,"peek");function G(z){if(z.length===0)return null;var j=z[0],q=z.pop();if(q!==j){z[0]=q;e:for(var xe=0,Ge=z.length,ba=Ge>>>1;xe<ba;){var iu=2*(xe+1)-1,yo=z[iu],Sn=iu+1,it=z[Sn];if(0>ee(yo,q))Sn<Ge&&0>ee(it,yo)?(z[xe]=it,z[Sn]=q,xe=Sn):(z[xe]=yo,z[iu]=q,xe=iu);else if(Sn<Ge&&0>ee(it,q))z[xe]=it,z[Sn]=q,xe=Sn;else break e}}return j}o(G,"pop");function ee(z,j){var q=z.sortIndex-j.sortIndex;return q!==0?q:z.id-j.id}o(ee,"compare");function se(z){for(var j=J(de);j!==null;){if(j.callback===null)G(de);else if(j.startTime<=z)G(de),j.sortIndex=j.expirationTime,r(L,j);else break;j=J(de)}}o(se,"advanceTimers");function ae(z){if(Ue=!1,se(z),!he)if(J(L)!==null)he=!0,K||(K=!0,_e());else{var j=J(de);j!==null&&ce(ae,j.startTime-z)}}o(ae,"handleTimeout");function A(){return ot?!0:!(Ye.unstable_now()-De<U)}o(A,"shouldYieldToHost");function ce(z,j){Ke=Gt(function(){z(Ye.unstable_now())},j)}if(o(ce,"requestHostTimeout"),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),Ye.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var Be=performance;Ye.unstable_now=function(){return Be.now()}}else{var Ze=Date,ue=Ze.now();Ye.unstable_now=function(){return Ze.now()-ue}}var L=[],de=[],Ae=1,I=null,V=3,oe=!1,he=!1,Ue=!1,ot=!1,Gt=typeof setTimeout=="function"?setTimeout:null,pt=typeof clearTimeout=="function"?clearTimeout:null,bt=typeof setImmediate<"u"?setImmediate:null,K=!1,Ke=-1,U=5,De=-1;if(typeof bt=="function")var _e=o(function(){bt(ge)},"schedulePerformWorkUntilDeadline");else if(typeof MessageChannel<"u"){var pe=new MessageChannel,ul=pe.port2;pe.port1.onmessage=ge,_e=o(function(){ul.postMessage(null)},"schedulePerformWorkUntilDeadline")}else _e=o(function(){Gt(ge,0)},"schedulePerformWorkUntilDeadline");Ye.unstable_IdlePriority=5,Ye.unstable_ImmediatePriority=1,Ye.unstable_LowPriority=4,Ye.unstable_NormalPriority=3,Ye.unstable_Profiling=null,Ye.unstable_UserBlockingPriority=2,Ye.unstable_cancelCallback=function(z){z.callback=null},Ye.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<z?Math.floor(1e3/z):5},Ye.unstable_getCurrentPriorityLevel=function(){return V},Ye.unstable_next=function(z){switch(V){case 1:case 2:case 3:var j=3;break;default:j=V}var q=V;V=j;try{return z()}finally{V=q}},Ye.unstable_requestPaint=function(){ot=!0},Ye.unstable_runWithPriority=function(z,j){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var q=V;V=z;try{return j()}finally{V=q}},Ye.unstable_scheduleCallback=function(z,j,q){var xe=Ye.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?xe+q:xe):q=xe,z){case 1:var Ge=-1;break;case 2:Ge=250;break;case 5:Ge=1073741823;break;case 4:Ge=1e4;break;default:Ge=5e3}return Ge=q+Ge,z={id:Ae++,callback:j,priorityLevel:z,startTime:q,expirationTime:Ge,sortIndex:-1},q>xe?(z.sortIndex=q,r(de,z),J(L)===null&&z===J(de)&&(Ue?(pt(Ke),Ke=-1):Ue=!0,ce(ae,q-xe))):(z.sortIndex=Ge,r(L,z),he||oe||(he=!0,K||(K=!0,_e()))),z},Ye.unstable_shouldYield=A,Ye.unstable_wrapCallback=function(z){var j=V;return function(){var q=V;V=j;try{return z.apply(this,arguments)}finally{V=q}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var DS=gf((_T,AS)=>{"use strict";AS.exports=TS()});var RS=gf(vf=>{"use strict";(function(){function ge(e,t){for(e=e.memoizedState;e!==null&&0<t;)e=e.next,t--;return e}o(ge,"findHook");function r(e,t,n,l){if(n>=t.length)return l;var a=t[n],u=lt(e)?e.slice():F({},e);return u[a]=r(e[a],t,n+1,l),u}o(r,"copyWithSetImpl");function J(e,t,n){if(t.length!==n.length)console.warn("copyWithRename() expects paths of the same length");else{for(var l=0;l<n.length-1;l++)if(t[l]!==n[l]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return G(e,t,n,0)}}o(J,"copyWithRename");function G(e,t,n,l){var a=t[l],u=lt(e)?e.slice():F({},e);return l+1===t.length?(u[n[l]]=u[a],lt(u)?u.splice(a,1):delete u[a]):u[a]=G(e[a],t,n,l+1),u}o(G,"copyWithRenameImpl");function ee(e,t,n){var l=t[n],a=lt(e)?e.slice():F({},e);return n+1===t.length?(lt(a)?a.splice(l,1):delete a[l],a):(a[l]=ee(e[l],t,n+1),a)}o(ee,"copyWithDeleteImpl");function se(){return!1}o(se,"shouldSuspendImpl");function ae(){return null}o(ae,"shouldErrorImpl");function A(){console.error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks")}o(A,"warnInvalidHookAccess");function ce(){console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")}o(ce,"warnInvalidContextAccess");function Be(){}o(Be,"noop");function Ze(){}o(Ze,"warnForMissingKey");function ue(e){var t=[];return e.forEach(function(n){t.push(n)}),t.sort().join(", ")}o(ue,"setToSortedString");function L(e,t,n,l){return new cb(e,t,n,l)}o(L,"createFiber");function de(e,t){e.context===Pl&&(Cd(e.current,2,t,e,null,null),Du())}o(de,"scheduleRoot");function Ae(e,t){if(sn!==null){var n=t.staleFamilies;t=t.updatedFamilies,Jo(),pm(e.current,t,n),Du()}}o(Ae,"scheduleRefresh");function I(e){sn=e}o(I,"setRefreshHandler");function V(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}o(V,"isValidContainer");function oe(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}o(oe,"getNearestMountedFiber");function he(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}o(he,"getSuspenseInstanceFromFiber");function Ue(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}o(Ue,"getActivityInstanceFromFiber");function ot(e){if(oe(e)!==e)throw Error("Unable to find node on an unmounted component.")}o(ot,"assertIsMounted");function Gt(e){var t=e.alternate;if(!t){if(t=oe(e),t===null)throw Error("Unable to find node on an unmounted component.");return t!==e?null:e}for(var n=e,l=t;;){var a=n.return;if(a===null)break;var u=a.alternate;if(u===null){if(l=a.return,l!==null){n=l;continue}break}if(a.child===u.child){for(u=a.child;u;){if(u===n)return ot(a),e;if(u===l)return ot(a),t;u=u.sibling}throw Error("Unable to find node on an unmounted component.")}if(n.return!==l.return)n=a,l=u;else{for(var i=!1,c=a.child;c;){if(c===n){i=!0,n=a,l=u;break}if(c===l){i=!0,l=a,n=u;break}c=c.sibling}if(!i){for(c=u.child;c;){if(c===n){i=!0,n=u,l=a;break}if(c===l){i=!0,l=u,n=a;break}c=c.sibling}if(!i)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(n.alternate!==l)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(n.tag!==3)throw Error("Unable to find node on an unmounted component.");return n.stateNode.current===n?e:t}o(Gt,"findCurrentFiberUsingSlowPath");function pt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=pt(e),t!==null)return t;e=e.sibling}return null}o(pt,"findCurrentHostFiberImpl");function bt(e){return e===null||typeof e!="object"?null:(e=Eg&&e[Eg]||e["@@iterator"],typeof e=="function"?e:null)}o(bt,"getIteratorFn");function K(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===U2?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _u:return"Fragment";case Bd:return"Profiler";case fs:return"StrictMode";case qd:return"Suspense";case jd:return"SuspenseList";case Yd:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Uu:return"Portal";case Kn:return e.displayName||"Context";case Nd:return(e._context.displayName||"Context")+".Consumer";case ni:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rs:return t=e.displayName||null,t!==null?t:K(e.type)||"Memo";case kt:t=e._payload,e=e._init;try{return K(e(t))}catch{}}return null}o(K,"getComponentNameFromType");function Ke(e){return typeof e.tag=="number"?U(e):typeof e.name=="string"?e.name:null}o(Ke,"getComponentNameFromOwner");function U(e){var t=e.type;switch(e.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(t._context.displayName||"Context")+".Consumer";case 10:return t.displayName||"Context";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(t);case 8:return t===fs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;break;case 29:if(t=e._debugInfo,t!=null){for(var n=t.length-1;0<=n;n--)if(typeof t[n].name=="string")return t[n].name}if(e.return!==null)return U(e.return)}return null}o(U,"getComponentNameFromFiber");function De(e){return{current:e}}o(De,"createCursor");function _e(e,t){0>ml?console.error("Unexpected pop."):(t!==Ld[ml]&&console.error("Unexpected Fiber popped."),e.current=Gd[ml],Gd[ml]=null,Ld[ml]=null,ml--)}o(_e,"pop");function pe(e,t,n){ml++,Gd[ml]=e.current,Ld[ml]=n,e.current=t}o(pe,"push");function ul(e){return e===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),e}o(ul,"requiredContext");function z(e,t){pe($l,t,e),pe(li,e,e),pe(Jl,null,e);var n=t.nodeType;switch(n){case 9:case 11:n=n===9?"#document":"#fragment",t=(t=t.documentElement)&&(t=t.namespaceURI)?Zy(t):Ml;break;default:if(n=t.tagName,t=t.namespaceURI)t=Zy(t),t=Jy(t,n);else switch(n){case"svg":t=ro;break;case"math":t=ff;break;default:t=Ml}}n=n.toLowerCase(),n=Yp(null,n),n={context:t,ancestorInfo:n},_e(Jl,e),pe(Jl,n,e)}o(z,"pushHostContainer");function j(e){_e(Jl,e),_e(li,e),_e($l,e)}o(j,"popHostContainer");function q(){return ul(Jl.current)}o(q,"getHostContext");function xe(e){e.memoizedState!==null&&pe(ds,e,e);var t=ul(Jl.current),n=e.type,l=Jy(t.context,n);n=Yp(t.ancestorInfo,n),l={context:l,ancestorInfo:n},t!==l&&(pe(li,e,e),pe(Jl,l,e))}o(xe,"pushHostContext");function Ge(e){li.current===e&&(_e(Jl,e),_e(li,e)),ds.current===e&&(_e(ds,e),Ki._currentValue=ou)}o(Ge,"popHostContext");function ba(){}o(ba,"disabledLog");function iu(){if(ai===0){Tg=console.log,Ag=console.info,Dg=console.warn,Rg=console.error,Og=console.group,zg=console.groupCollapsed,Cg=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ba,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}ai++}o(iu,"disableLogs");function yo(){if(ai--,ai===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:Tg}),info:F({},e,{value:Ag}),warn:F({},e,{value:Dg}),error:F({},e,{value:Rg}),group:F({},e,{value:Og}),groupCollapsed:F({},e,{value:zg}),groupEnd:F({},e,{value:Cg})})}0>ai&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}o(yo,"reenableLogs");function Sn(e){var t=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,e=e.stack,Error.prepareStackTrace=t,e.startsWith(`Error: react-stack-top-frame
1
+ import{a as hS,b as rp,c as vS,d as dp,e as SS,f as bS,k as ES}from"./chunk-2SE7II7A.js";import"./chunk-ZPUO7FNI.js";import"./chunk-IXDH4GL5.js";import"./chunk-KSKXW5PX.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import"./chunk-ZIGWVHCS.js";import"./chunk-7TJJXVSE.js";import"./chunk-WI7GWFEG.js";import{a as gS}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import"./chunk-KZ6INM5M.js";import"./chunk-4QHKBC77.js";import{R as mS}from"./chunk-3CJW6NWG.js";import{c as yS}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as bT}from"./chunk-HV7G6DFP.js";import"./chunk-BOXSWNXZ.js";import"./chunk-TAD43CG5.js";import"./chunk-OIC7EJWI.js";import"./chunk-SEU5V7I6.js";import"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as fS,e as dS}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as pS,d as fp}from"./chunk-PVZI3CXP.js";import{b as cS}from"./chunk-GMSGZDDH.js";import{a as o,c as gf,e as Wi,f as sS,g as ET,h as rS,j as sp}from"./chunk-RRCPZMC2.js";var TS=gf(Ye=>{"use strict";(function(){function ge(){if(ot=!1,K){var z=Ye.unstable_now();De=z;var j=!0;try{e:{he=!1,Ue&&(Ue=!1,pt(Ke),Ke=-1),oe=!0;var q=V;try{t:{for(se(z),I=J(L);I!==null&&!(I.expirationTime>z&&A());){var xe=I.callback;if(typeof xe=="function"){I.callback=null,V=I.priorityLevel;var Ge=xe(I.expirationTime<=z);if(z=Ye.unstable_now(),typeof Ge=="function"){I.callback=Ge,se(z),j=!0;break t}I===J(L)&&G(L),se(z)}else G(L);I=J(L)}if(I!==null)j=!0;else{var ba=J(de);ba!==null&&ce(ae,ba.startTime-z),j=!1}}break e}finally{I=null,V=q,oe=!1}j=void 0}}finally{j?_e():K=!1}}}o(ge,"performWorkUntilDeadline");function r(z,j){var q=z.length;z.push(j);e:for(;0<q;){var xe=q-1>>>1,Ge=z[xe];if(0<ee(Ge,j))z[xe]=j,z[q]=Ge,q=xe;else break e}}o(r,"push");function J(z){return z.length===0?null:z[0]}o(J,"peek");function G(z){if(z.length===0)return null;var j=z[0],q=z.pop();if(q!==j){z[0]=q;e:for(var xe=0,Ge=z.length,ba=Ge>>>1;xe<ba;){var iu=2*(xe+1)-1,yo=z[iu],Sn=iu+1,it=z[Sn];if(0>ee(yo,q))Sn<Ge&&0>ee(it,yo)?(z[xe]=it,z[Sn]=q,xe=Sn):(z[xe]=yo,z[iu]=q,xe=iu);else if(Sn<Ge&&0>ee(it,q))z[xe]=it,z[Sn]=q,xe=Sn;else break e}}return j}o(G,"pop");function ee(z,j){var q=z.sortIndex-j.sortIndex;return q!==0?q:z.id-j.id}o(ee,"compare");function se(z){for(var j=J(de);j!==null;){if(j.callback===null)G(de);else if(j.startTime<=z)G(de),j.sortIndex=j.expirationTime,r(L,j);else break;j=J(de)}}o(se,"advanceTimers");function ae(z){if(Ue=!1,se(z),!he)if(J(L)!==null)he=!0,K||(K=!0,_e());else{var j=J(de);j!==null&&ce(ae,j.startTime-z)}}o(ae,"handleTimeout");function A(){return ot?!0:!(Ye.unstable_now()-De<U)}o(A,"shouldYieldToHost");function ce(z,j){Ke=Gt(function(){z(Ye.unstable_now())},j)}if(o(ce,"requestHostTimeout"),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),Ye.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var Be=performance;Ye.unstable_now=function(){return Be.now()}}else{var Ze=Date,ue=Ze.now();Ye.unstable_now=function(){return Ze.now()-ue}}var L=[],de=[],Ae=1,I=null,V=3,oe=!1,he=!1,Ue=!1,ot=!1,Gt=typeof setTimeout=="function"?setTimeout:null,pt=typeof clearTimeout=="function"?clearTimeout:null,bt=typeof setImmediate<"u"?setImmediate:null,K=!1,Ke=-1,U=5,De=-1;if(typeof bt=="function")var _e=o(function(){bt(ge)},"schedulePerformWorkUntilDeadline");else if(typeof MessageChannel<"u"){var pe=new MessageChannel,ul=pe.port2;pe.port1.onmessage=ge,_e=o(function(){ul.postMessage(null)},"schedulePerformWorkUntilDeadline")}else _e=o(function(){Gt(ge,0)},"schedulePerformWorkUntilDeadline");Ye.unstable_IdlePriority=5,Ye.unstable_ImmediatePriority=1,Ye.unstable_LowPriority=4,Ye.unstable_NormalPriority=3,Ye.unstable_Profiling=null,Ye.unstable_UserBlockingPriority=2,Ye.unstable_cancelCallback=function(z){z.callback=null},Ye.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<z?Math.floor(1e3/z):5},Ye.unstable_getCurrentPriorityLevel=function(){return V},Ye.unstable_next=function(z){switch(V){case 1:case 2:case 3:var j=3;break;default:j=V}var q=V;V=j;try{return z()}finally{V=q}},Ye.unstable_requestPaint=function(){ot=!0},Ye.unstable_runWithPriority=function(z,j){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var q=V;V=z;try{return j()}finally{V=q}},Ye.unstable_scheduleCallback=function(z,j,q){var xe=Ye.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?xe+q:xe):q=xe,z){case 1:var Ge=-1;break;case 2:Ge=250;break;case 5:Ge=1073741823;break;case 4:Ge=1e4;break;default:Ge=5e3}return Ge=q+Ge,z={id:Ae++,callback:j,priorityLevel:z,startTime:q,expirationTime:Ge,sortIndex:-1},q>xe?(z.sortIndex=q,r(de,z),J(L)===null&&z===J(de)&&(Ue?(pt(Ke),Ke=-1):Ue=!0,ce(ae,q-xe))):(z.sortIndex=Ge,r(L,z),he||oe||(he=!0,K||(K=!0,_e()))),z},Ye.unstable_shouldYield=A,Ye.unstable_wrapCallback=function(z){var j=V;return function(){var q=V;V=j;try{return z.apply(this,arguments)}finally{V=q}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var DS=gf((_T,AS)=>{"use strict";AS.exports=TS()});var RS=gf(vf=>{"use strict";(function(){function ge(e,t){for(e=e.memoizedState;e!==null&&0<t;)e=e.next,t--;return e}o(ge,"findHook");function r(e,t,n,l){if(n>=t.length)return l;var a=t[n],u=lt(e)?e.slice():F({},e);return u[a]=r(e[a],t,n+1,l),u}o(r,"copyWithSetImpl");function J(e,t,n){if(t.length!==n.length)console.warn("copyWithRename() expects paths of the same length");else{for(var l=0;l<n.length-1;l++)if(t[l]!==n[l]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return G(e,t,n,0)}}o(J,"copyWithRename");function G(e,t,n,l){var a=t[l],u=lt(e)?e.slice():F({},e);return l+1===t.length?(u[n[l]]=u[a],lt(u)?u.splice(a,1):delete u[a]):u[a]=G(e[a],t,n,l+1),u}o(G,"copyWithRenameImpl");function ee(e,t,n){var l=t[n],a=lt(e)?e.slice():F({},e);return n+1===t.length?(lt(a)?a.splice(l,1):delete a[l],a):(a[l]=ee(e[l],t,n+1),a)}o(ee,"copyWithDeleteImpl");function se(){return!1}o(se,"shouldSuspendImpl");function ae(){return null}o(ae,"shouldErrorImpl");function A(){console.error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks")}o(A,"warnInvalidHookAccess");function ce(){console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")}o(ce,"warnInvalidContextAccess");function Be(){}o(Be,"noop");function Ze(){}o(Ze,"warnForMissingKey");function ue(e){var t=[];return e.forEach(function(n){t.push(n)}),t.sort().join(", ")}o(ue,"setToSortedString");function L(e,t,n,l){return new cb(e,t,n,l)}o(L,"createFiber");function de(e,t){e.context===Pl&&(Cd(e.current,2,t,e,null,null),Du())}o(de,"scheduleRoot");function Ae(e,t){if(sn!==null){var n=t.staleFamilies;t=t.updatedFamilies,Jo(),pm(e.current,t,n),Du()}}o(Ae,"scheduleRefresh");function I(e){sn=e}o(I,"setRefreshHandler");function V(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}o(V,"isValidContainer");function oe(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}o(oe,"getNearestMountedFiber");function he(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}o(he,"getSuspenseInstanceFromFiber");function Ue(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}o(Ue,"getActivityInstanceFromFiber");function ot(e){if(oe(e)!==e)throw Error("Unable to find node on an unmounted component.")}o(ot,"assertIsMounted");function Gt(e){var t=e.alternate;if(!t){if(t=oe(e),t===null)throw Error("Unable to find node on an unmounted component.");return t!==e?null:e}for(var n=e,l=t;;){var a=n.return;if(a===null)break;var u=a.alternate;if(u===null){if(l=a.return,l!==null){n=l;continue}break}if(a.child===u.child){for(u=a.child;u;){if(u===n)return ot(a),e;if(u===l)return ot(a),t;u=u.sibling}throw Error("Unable to find node on an unmounted component.")}if(n.return!==l.return)n=a,l=u;else{for(var i=!1,c=a.child;c;){if(c===n){i=!0,n=a,l=u;break}if(c===l){i=!0,l=a,n=u;break}c=c.sibling}if(!i){for(c=u.child;c;){if(c===n){i=!0,n=u,l=a;break}if(c===l){i=!0,l=u,n=a;break}c=c.sibling}if(!i)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(n.alternate!==l)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(n.tag!==3)throw Error("Unable to find node on an unmounted component.");return n.stateNode.current===n?e:t}o(Gt,"findCurrentFiberUsingSlowPath");function pt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=pt(e),t!==null)return t;e=e.sibling}return null}o(pt,"findCurrentHostFiberImpl");function bt(e){return e===null||typeof e!="object"?null:(e=Eg&&e[Eg]||e["@@iterator"],typeof e=="function"?e:null)}o(bt,"getIteratorFn");function K(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===U2?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _u:return"Fragment";case Bd:return"Profiler";case fs:return"StrictMode";case qd:return"Suspense";case jd:return"SuspenseList";case Yd:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Uu:return"Portal";case Kn:return e.displayName||"Context";case Nd:return(e._context.displayName||"Context")+".Consumer";case ni:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rs:return t=e.displayName||null,t!==null?t:K(e.type)||"Memo";case kt:t=e._payload,e=e._init;try{return K(e(t))}catch{}}return null}o(K,"getComponentNameFromType");function Ke(e){return typeof e.tag=="number"?U(e):typeof e.name=="string"?e.name:null}o(Ke,"getComponentNameFromOwner");function U(e){var t=e.type;switch(e.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(t._context.displayName||"Context")+".Consumer";case 10:return t.displayName||"Context";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(t);case 8:return t===fs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;break;case 29:if(t=e._debugInfo,t!=null){for(var n=t.length-1;0<=n;n--)if(typeof t[n].name=="string")return t[n].name}if(e.return!==null)return U(e.return)}return null}o(U,"getComponentNameFromFiber");function De(e){return{current:e}}o(De,"createCursor");function _e(e,t){0>ml?console.error("Unexpected pop."):(t!==Ld[ml]&&console.error("Unexpected Fiber popped."),e.current=Gd[ml],Gd[ml]=null,Ld[ml]=null,ml--)}o(_e,"pop");function pe(e,t,n){ml++,Gd[ml]=e.current,Ld[ml]=n,e.current=t}o(pe,"push");function ul(e){return e===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),e}o(ul,"requiredContext");function z(e,t){pe($l,t,e),pe(li,e,e),pe(Jl,null,e);var n=t.nodeType;switch(n){case 9:case 11:n=n===9?"#document":"#fragment",t=(t=t.documentElement)&&(t=t.namespaceURI)?Zy(t):Ml;break;default:if(n=t.tagName,t=t.namespaceURI)t=Zy(t),t=Jy(t,n);else switch(n){case"svg":t=ro;break;case"math":t=ff;break;default:t=Ml}}n=n.toLowerCase(),n=Yp(null,n),n={context:t,ancestorInfo:n},_e(Jl,e),pe(Jl,n,e)}o(z,"pushHostContainer");function j(e){_e(Jl,e),_e(li,e),_e($l,e)}o(j,"popHostContainer");function q(){return ul(Jl.current)}o(q,"getHostContext");function xe(e){e.memoizedState!==null&&pe(ds,e,e);var t=ul(Jl.current),n=e.type,l=Jy(t.context,n);n=Yp(t.ancestorInfo,n),l={context:l,ancestorInfo:n},t!==l&&(pe(li,e,e),pe(Jl,l,e))}o(xe,"pushHostContext");function Ge(e){li.current===e&&(_e(Jl,e),_e(li,e)),ds.current===e&&(_e(ds,e),Ki._currentValue=ou)}o(Ge,"popHostContext");function ba(){}o(ba,"disabledLog");function iu(){if(ai===0){Tg=console.log,Ag=console.info,Dg=console.warn,Rg=console.error,Og=console.group,zg=console.groupCollapsed,Cg=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ba,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}ai++}o(iu,"disableLogs");function yo(){if(ai--,ai===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:Tg}),info:F({},e,{value:Ag}),warn:F({},e,{value:Dg}),error:F({},e,{value:Rg}),group:F({},e,{value:Og}),groupCollapsed:F({},e,{value:zg}),groupEnd:F({},e,{value:Cg})})}0>ai&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}o(yo,"reenableLogs");function Sn(e){var t=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,e=e.stack,Error.prepareStackTrace=t,e.startsWith(`Error: react-stack-top-frame
2
2
  `)&&(e=e.slice(29)),t=e.indexOf(`
3
3
  `),t!==-1&&(e=e.slice(t+1)),t=e.indexOf("react_stack_bottom_frame"),t!==-1&&(t=e.lastIndexOf(`
4
4
  `,t)),t!==-1)e=e.slice(0,t);else return"";return e}o(Sn,"formatOwnerStack");function it(e){if(Vd===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Vd=t&&t[1]||"",Mg=-1<n.stack.indexOf(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/studio",
3
- "version": "1.0.0-alpha.37",
3
+ "version": "1.0.0-alpha.38",
4
4
  "description": "The Lunora Studio: a local admin UI for your schema, data, logs, and advisors",
5
5
  "keywords": [
6
6
  "admin-ui",
@@ -60,9 +60,9 @@
60
60
  "@lingui/message-utils": "^6.4.0",
61
61
  "@lunora/advisor": "1.0.0-alpha.18",
62
62
  "@lunora/bindings": "1.0.0-alpha.4",
63
- "@lunora/client": "1.0.0-alpha.17",
63
+ "@lunora/client": "1.0.0-alpha.18",
64
64
  "@lunora/errors": "1.0.0-alpha.1",
65
- "@lunora/react": "1.0.0-alpha.19",
65
+ "@lunora/react": "1.0.0-alpha.20",
66
66
  "@tanstack/react-query": "^5.101.2",
67
67
  "@tanstack/react-router": "^1.170.17",
68
68
  "@tanstack/react-table": "^8.21.3",
@@ -1,32 +0,0 @@
1
- import { useLunora } from '@lunora/react';
2
- import { useState, useEffect } from 'react';
3
- import { f as fireAndForget } from './internal-DTsYVn-g.js';
4
-
5
- const DEFAULT_CAPABILITIES = {
6
- accounts: true,
7
- admin: true,
8
- organization: false,
9
- passkey: false,
10
- twoFactor: false
11
- };
12
- const useAuthCapabilities = () => {
13
- const client = useLunora();
14
- const [capabilities, setCapabilities] = useState(DEFAULT_CAPABILITIES);
15
- const [ready, setReady] = useState(false);
16
- useEffect(() => {
17
- fireAndForget((async () => {
18
- try {
19
- setCapabilities(await client.getAuthCapabilities());
20
- } catch {
21
- } finally {
22
- setReady(true);
23
- }
24
- })());
25
- }, [client]);
26
- return {
27
- capabilities,
28
- ready
29
- };
30
- };
31
-
32
- export { useAuthCapabilities as u };
@@ -1 +0,0 @@
1
- import{a as be,b as ge,c as xe,d as Ne,e as Ce}from"./chunk-LI43EKM6.js";import"./chunk-DWDILV2E.js";import{a as ue}from"./chunk-BACPICH6.js";import"./chunk-QBAT52GB.js";import"./chunk-QAFAJBAW.js";import{g as me,h as ve,i as fe,j as pe}from"./chunk-IOFMK4D7.js";import"./chunk-ZPUO7FNI.js";import"./chunk-764T6X6X.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import"./chunk-ZIGWVHCS.js";import"./chunk-7TJJXVSE.js";import"./chunk-WI7GWFEG.js";import"./chunk-KEGAWN6Y.js";import{a as de,b as ne,c as oe,d as q,e as Q,f as X}from"./chunk-GTM65MVX.js";import{a as ce}from"./chunk-VLXV72QE.js";import{a as W}from"./chunk-JSEXCW5Q.js";import"./chunk-KZ6INM5M.js";import"./chunk-4QHKBC77.js";import{R as le}from"./chunk-3CJW6NWG.js";import{c as $}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import"./chunk-BOXSWNXZ.js";import{a as ye}from"./chunk-TAD43CG5.js";import"./chunk-DVKPRFIJ.js";import{a as re,e as se}from"./chunk-SEU5V7I6.js";import{b as he}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as Y}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as U,g as z,k as H,l as ie,m as ke}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as n,e as ae,f as Me,g as Le,h as Be}from"./chunk-RRCPZMC2.js";var J=ae(Me(),1);var ee=ae(Le(),1);var l=ae(Be(),1);var De=n(r=>{let e=r.trim();if(e==="")return;let s=Number(e);return Number.isFinite(s)&&s>0?Math.floor(s):void 0},"parseTtl"),Oe=n(r=>r===void 0?"\u2014":new Date(r*1e3).toISOString(),"formatExpiration"),Ae=n(r=>new TextEncoder().encode(r).length,"byteLength"),Te=n(r=>{if(r.trim()!=="")try{return JSON.stringify(JSON.parse(r),void 0,2)}catch{return}},"tryFormatJson"),Ee=n(r=>{if(r.trim()==="")return!0;try{return JSON.parse(r),!0}catch{return!1}},"isJsonOrEmpty"),Fe=[{key:"seconds",seconds:1},{key:"minutes",seconds:60},{key:"hours",seconds:3600},{key:"days",seconds:86400}],Se=n((r,e)=>{let s=r.trim();if(s==="")return"";let u=Number(s),d=Fe.find(f=>f.key===e)?.seconds??1;return Number.isFinite(u)&&u>0?String(Math.round(u*d)):s},"ttlToSeconds"),Ke=n(r=>{let e=r.trim();if(e==="")return!0;let s=Number(e);return Number.isInteger(s)&&s>=60},"isTtlValid"),Ve=n((r,e,s,u)=>{let d=De(r.ttl);return{expiration:d===void 0?u:void 0,expirationTtl:d,key:e,metadata:r.metadata.trim()===""?void 0:JSON.parse(r.metadata),namespace:s,value:r.value}},"buildKvPutOptions"),Ie=n(r=>{let e=(0,ee.c)(60),{helper:s,id:u,invalid:d,onChange:f,testId:o}=r,t=U(),[a,p]=(0,J.useState)(""),[c,x]=(0,J.useState)("seconds"),b;e[0]!==f||e[1]!==c?(b=n(g=>{p(g.target.value),f(Se(g.target.value,c))},"t1"),e[0]=f,e[1]=c,e[2]=b):b=e[2];let M=b,V;e[3]!==a||e[4]!==f?(V=n(g=>{g!==null&&(x(g),f(Se(a,g)))},"t2"),e[3]=a,e[4]=f,e[5]=V):V=e[5];let L=V,h;e[6]!==t?(h=t("days"),e[6]=t,e[7]=h):h=e[7];let v;e[8]!==t?(v=t("hours"),e[8]=t,e[9]=v):v=e[9];let y;e[10]!==t?(y=t("minutes"),e[10]=t,e[11]=y):y=e[11];let N;e[12]!==t?(N=t("seconds"),e[12]=t,e[13]=N):N=e[13];let C;e[14]!==h||e[15]!==v||e[16]!==y||e[17]!==N?(C={days:h,hours:v,minutes:y,seconds:N},e[14]=h,e[15]=v,e[16]=y,e[17]=N,e[18]=C):C=e[18];let S=C,k;e[19]!==t?(k=t("Expires after"),e[19]=t,e[20]=k):k=e[20];let w;e[21]!==u||e[22]!==k?(w=(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:u,children:k},void 0,!1),e[21]=u,e[22]=k,e[23]=w):w=e[23];let E;e[24]!==t?(E=t("No expiration"),e[24]=t,e[25]=E):E=e[25];let B;e[26]!==a||e[27]!==u||e[28]!==d||e[29]!==M||e[30]!==E||e[31]!==o?(B=(0,l.jsxDEV)(le,{"aria-invalid":d,className:"flex-1","data-testid":o,id:u,inputMode:"numeric",onChange:M,placeholder:E,value:a},void 0,!1),e[26]=a,e[27]=u,e[28]=d,e[29]=M,e[30]=E,e[31]=o,e[32]=B):B=e[32];let I;e[33]!==t?(I=t("TTL unit"),e[33]=t,e[34]=I):I=e[34];let O=`${o}-unit`,D;e[35]===Symbol.for("react.memo_cache_sentinel")?(D=(0,l.jsxDEV)(ge,{},void 0,!1),e[35]=D):D=e[35];let i;e[36]!==I||e[37]!==O?(i=(0,l.jsxDEV)(xe,{"aria-label":I,className:"w-[7.5rem]","data-testid":O,children:D},void 0,!1),e[36]=I,e[37]=O,e[38]=i):i=e[38];let m;e[39]!==S?(m=Fe.map(g=>(0,l.jsxDEV)(Ce,{value:g.key,children:S[g.key]},g.key,!1)),e[39]=S,e[40]=m):m=e[40];let K;e[41]!==m?(K=(0,l.jsxDEV)(Ne,{children:m},void 0,!1),e[41]=m,e[42]=K):K=e[42];let T;e[43]!==L||e[44]!==i||e[45]!==K||e[46]!==c?(T=(0,l.jsxDEV)(be,{onValueChange:L,value:c,children:[i,K]},void 0,!0),e[43]=L,e[44]=i,e[45]=K,e[46]=c,e[47]=T):T=e[47];let _;e[48]!==B||e[49]!==T?(_=(0,l.jsxDEV)("div",{className:"flex gap-2",children:[B,T]},void 0,!0),e[48]=B,e[49]=T,e[50]=_):_=e[50];let F;e[51]!==s||e[52]!==d||e[53]!==t||e[54]!==o?(F=d?(0,l.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":`${o}-invalid`,children:t("TTL must be at least 60 seconds.")},void 0,!1):s!==void 0&&(0,l.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:s},void 0,!1),e[51]=s,e[52]=d,e[53]=t,e[54]=o,e[55]=F):F=e[55];let A;return e[56]!==_||e[57]!==F||e[58]!==w?(A=(0,l.jsxDEV)("div",{className:"mb-3 grid gap-1",children:[w,_,F]},void 0,!0),e[56]=_,e[57]=F,e[58]=w,e[59]=A):A=e[59],A},"TtlField"),_e=n(r=>{let e=(0,ee.c)(36),{id:s,invalidTestId:u,onChange:d,testId:f,valid:o,value:t}=r,a=U(),p;e[0]!==t?(p=Te(t),e[0]=t,e[1]=p):p=e[1];let c=p,x;e[2]!==a?(x=a("Metadata (JSON)"),e[2]=a,e[3]=x):x=e[3];let b;e[4]!==s||e[5]!==x?(b=(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:s,children:x},void 0,!1),e[4]=s,e[5]=x,e[6]=b):b=e[6];let M=`${f}-format`,V=c===void 0,L;e[7]!==c||e[8]!==d?(L=n(()=>{c!==void 0&&d(c)},"t6"),e[7]=c,e[8]=d,e[9]=L):L=e[9];let h;e[10]!==a?(h=a("Format JSON"),e[10]=a,e[11]=h):h=e[11];let v;e[12]!==M||e[13]!==V||e[14]!==L||e[15]!==h?(v=(0,l.jsxDEV)($,{"data-testid":M,disabled:V,onClick:L,size:"sm",variant:"outline",children:h},void 0,!1),e[12]=M,e[13]=V,e[14]=L,e[15]=h,e[16]=v):v=e[16];let y;e[17]!==b||e[18]!==v?(y=(0,l.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[b,v]},void 0,!0),e[17]=b,e[18]=v,e[19]=y):y=e[19];let N=!o,C;e[20]!==d?(C=n(E=>{d(E.target.value)},"t11"),e[20]=d,e[21]=C):C=e[21];let S;e[22]!==s||e[23]!==N||e[24]!==C||e[25]!==f||e[26]!==t?(S=(0,l.jsxDEV)(ce,{"aria-invalid":N,className:"min-h-[4rem] font-mono text-xs","data-testid":f,id:s,onChange:C,value:t},void 0,!1),e[22]=s,e[23]=N,e[24]=C,e[25]=f,e[26]=t,e[27]=S):S=e[27];let k;e[28]!==u||e[29]!==a||e[30]!==o?(k=!o&&(0,l.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":u,children:a("Metadata must be valid JSON.")},void 0,!1),e[28]=u,e[29]=a,e[30]=o,e[31]=k):k=e[31];let w;return e[32]!==S||e[33]!==k||e[34]!==y?(w=(0,l.jsxDEV)("div",{className:"mb-3 grid gap-1",children:[y,S,k]},void 0,!0),e[32]=S,e[33]=k,e[34]=y,e[35]=w):w=e[35],w},"MetadataField"),Je={busy:!1,error:null,metadata:"",name:"",ttl:"",value:""},Pe=n((r,e)=>{switch(e.type){case"setField":return{...r,[e.field]:e.value};case"submitFailed":return{...r,busy:!1,error:e.error};case"submitStart":return{...r,busy:!0,error:null};default:return r}},"createReducer"),$e=n(r=>{let e=(0,ee.c)(73),{namespace:s,onCancel:u,onCreated:d}=r,f=Y(),o=U(),[t,a]=(0,J.useReducer)(Pe,Je),p;e[0]!==t.metadata?(p=Ee(t.metadata),e[0]=t.metadata,e[1]=p):p=e[1];let c=p,x;e[2]!==t.ttl?(x=Ke(t.ttl),e[2]=t.ttl,e[3]=x):x=e[3];let b=x,M;e[4]!==c||e[5]!==t.busy||e[6]!==t.name||e[7]!==b?(M=t.name.trim()!==""&&c&&b&&!t.busy,e[4]=c,e[5]=t.busy,e[6]=t.name,e[7]=b,e[8]=M):M=e[8];let V=M,L;e[9]!==V||e[10]!==f||e[11]!==s||e[12]!==d||e[13]!==t.metadata||e[14]!==t.name||e[15]!==t.ttl||e[16]!==t.value?(L=n(()=>{V&&(a({type:"submitStart"}),H((async()=>{try{await f.putKvValue(Ve({metadata:t.metadata,ttl:t.ttl,value:t.value},t.name,s)),d()}catch(j){a({error:z(j),type:"submitFailed"})}})()))},"t4"),e[9]=V,e[10]=f,e[11]=s,e[12]=d,e[13]=t.metadata,e[14]=t.name,e[15]=t.ttl,e[16]=t.value,e[17]=L):L=e[17];let h=L,v;e[18]!==o?(v=o("Key name"),e[18]=o,e[19]=v):v=e[19];let y;e[20]!==v?(y=(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:"kv-create-name",children:v},void 0,!1),e[20]=v,e[21]=y):y=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(j=>{a({field:"name",type:"setField",value:j.target.value})},"t7"),e[22]=N):N=e[22];let C;e[23]!==o?(C=o("Key name"),e[23]=o,e[24]=C):C=e[24];let S;e[25]!==t.name||e[26]!==C?(S=(0,l.jsxDEV)(le,{autoFocus:!0,"data-testid":"kv-create-name",id:"kv-create-name",onChange:N,placeholder:C,value:t.name},void 0,!1),e[25]=t.name,e[26]=C,e[27]=S):S=e[27];let k;e[28]!==y||e[29]!==S?(k=(0,l.jsxDEV)("div",{className:"grid gap-1",children:[y,S]},void 0,!0),e[28]=y,e[29]=S,e[30]=k):k=e[30];let w;e[31]!==o?(w=o("Value"),e[31]=o,e[32]=w):w=e[32];let E;e[33]!==w?(E=(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:"kv-create-value",children:w},void 0,!1),e[33]=w,e[34]=E):E=e[34];let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=n(j=>{a({field:"value",type:"setField",value:j.target.value})},"t13"),e[35]=B):B=e[35];let I;e[36]!==t.value?(I=(0,l.jsxDEV)(ce,{className:"min-h-[6rem] font-mono text-xs","data-testid":"kv-create-value",id:"kv-create-value",onChange:B,value:t.value},void 0,!1),e[36]=t.value,e[37]=I):I=e[37];let O;e[38]!==E||e[39]!==I?(O=(0,l.jsxDEV)("div",{className:"grid gap-1",children:[E,I]},void 0,!0),e[38]=E,e[39]=I,e[40]=O):O=e[40];let D=!b,i;e[41]===Symbol.for("react.memo_cache_sentinel")?(i=n(j=>{a({field:"ttl",type:"setField",value:j})},"t17"),e[41]=i):i=e[41];let m;e[42]!==D?(m=(0,l.jsxDEV)(Ie,{id:"kv-create-ttl",invalid:D,onChange:i,testId:"kv-create-ttl"},void 0,!1),e[42]=D,e[43]=m):m=e[43];let K;e[44]===Symbol.for("react.memo_cache_sentinel")?(K=n(j=>{a({field:"metadata",type:"setField",value:j})},"t19"),e[44]=K):K=e[44];let T;e[45]!==c||e[46]!==t.metadata?(T=(0,l.jsxDEV)(_e,{id:"kv-create-metadata",invalidTestId:"kv-create-metadata-invalid",onChange:K,testId:"kv-create-metadata",valid:c,value:t.metadata},void 0,!1),e[45]=c,e[46]=t.metadata,e[47]=T):T=e[47];let _=!V,F;e[48]!==t.busy||e[49]!==o?(F=t.busy?o("Creating\u2026"):o("Create key"),e[48]=t.busy,e[49]=o,e[50]=F):F=e[50];let A;e[51]!==h||e[52]!==_||e[53]!==F?(A=(0,l.jsxDEV)($,{"data-testid":"kv-create-submit",disabled:_,onClick:h,children:F},void 0,!1),e[51]=h,e[52]=_,e[53]=F,e[54]=A):A=e[54];let g=t.busy,P;e[55]!==o?(P=o("Cancel"),e[55]=o,e[56]=P):P=e[56];let R;e[57]!==u||e[58]!==t.busy||e[59]!==P?(R=(0,l.jsxDEV)($,{"data-testid":"kv-create-cancel",disabled:g,onClick:u,variant:"outline",children:P},void 0,!1),e[57]=u,e[58]=t.busy,e[59]=P,e[60]=R):R=e[60];let Z;e[61]!==A||e[62]!==R?(Z=(0,l.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[A,R]},void 0,!0),e[61]=A,e[62]=R,e[63]=Z):Z=e[63];let G;e[64]!==t.error?(G=t.error!==null&&(0,l.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"kv-create-error",role:"alert",children:t.error},void 0,!1),e[64]=t.error,e[65]=G):G=e[65];let te;return e[66]!==k||e[67]!==O||e[68]!==m||e[69]!==T||e[70]!==Z||e[71]!==G?(te=(0,l.jsxDEV)("div",{className:"grid gap-3 px-4 pb-4","data-testid":"kv-create-form",children:[k,O,m,T,Z,G]},void 0,!0),e[66]=k,e[67]=O,e[68]=m,e[69]=T,e[70]=Z,e[71]=G,e[72]=te):te=e[72],te},"KvCreateForm"),je={busy:"",editedMetadata:"",editedTtl:"",editedValue:"",loadError:null,loading:!0,value:null,writeError:null},He=n((r,e)=>{switch(e.type){case"deleteStart":return{...r,busy:"deleting",writeError:null};case"editMetadata":return{...r,editedMetadata:e.value};case"editTtl":return{...r,editedTtl:e.value};case"editValue":return{...r,editedValue:e.value};case"loaded":return{...r,editedMetadata:e.metadata===null||e.metadata===void 0?"":JSON.stringify(e.metadata,null,2),editedValue:e.value??"",loading:!1,value:e.value};case"loadFailed":return{...r,loadError:e.error,loading:!1};case"saveOk":return{...r,busy:"",value:r.editedValue};case"saveStart":return{...r,busy:"saving",writeError:null};case"writeFailed":return{...r,busy:"",writeError:e.error};default:return r}},"valueReducer"),Re=n(r=>{let e=(0,ee.c)(67),{expiration:s,keyName:u,namespace:d,onDeleted:f}=r,o=Y(),t=U(),[a,p]=(0,J.useReducer)(He,je),c,x;e[0]!==o||e[1]!==u||e[2]!==d?(c=n(()=>{let g={cancelled:!1};return H((async()=>{try{let P=await o.getKvValue({key:u,namespace:d});g.cancelled||p({metadata:P.metadata,type:"loaded",value:P.value})}catch(P){let R=P;g.cancelled||p({error:z(R),type:"loadFailed"})}})()),()=>{g.cancelled=!0}},"t1"),x=[o,d,u],e[0]=o,e[1]=u,e[2]=d,e[3]=c,e[4]=x):(c=e[3],x=e[4]),(0,J.useEffect)(c,x);let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=n(g=>{p({type:"editValue",value:g.target.value})},"t3"),e[5]=b):b=e[5];let M=b,V;e[6]===Symbol.for("react.memo_cache_sentinel")?(V=n(g=>{p({type:"editMetadata",value:g})},"t4"),e[6]=V):V=e[6];let L=V,h;e[7]!==a.editedValue?(h=Te(a.editedValue),e[7]=a.editedValue,e[8]=h):h=e[8];let v=h,y;e[9]!==a.editedMetadata?(y=Ee(a.editedMetadata),e[9]=a.editedMetadata,e[10]=y):y=e[10];let N=y,C;e[11]!==a.editedTtl?(C=Ke(a.editedTtl),e[11]=a.editedTtl,e[12]=C):C=e[12];let S=C,k;e[13]!==v?(k=n(()=>{v!==void 0&&p({type:"editValue",value:v})},"t8"),e[13]=v,e[14]=k):k=e[14];let w=k,E;e[15]!==o||e[16]!==s||e[17]!==u||e[18]!==N||e[19]!==d||e[20]!==a.editedMetadata||e[21]!==a.editedTtl||e[22]!==a.editedValue||e[23]!==t?(E=n(()=>{if(!N){p({error:t("Metadata must be valid JSON."),type:"writeFailed"});return}p({type:"saveStart"}),H((async()=>{try{await o.putKvValue(Ve({metadata:a.editedMetadata,ttl:a.editedTtl,value:a.editedValue},u,d,s)),p({type:"saveOk"})}catch(g){p({error:z(g),type:"writeFailed"})}})())},"t9"),e[15]=o,e[16]=s,e[17]=u,e[18]=N,e[19]=d,e[20]=a.editedMetadata,e[21]=a.editedTtl,e[22]=a.editedValue,e[23]=t,e[24]=E):E=e[24];let B=E,I;e[25]!==o||e[26]!==u||e[27]!==d||e[28]!==f?(I=n(()=>{p({type:"deleteStart"}),H((async()=>{try{await o.deleteKvKey({key:u,namespace:d}),f(u)}catch(g){p({error:z(g),type:"writeFailed"})}})())},"t10"),e[25]=o,e[26]=u,e[27]=d,e[28]=f,e[29]=I):I=e[29];let O=I,D;e[30]!==u?(D=n(()=>{ie(u)},"t11"),e[30]=u,e[31]=D):D=e[31];let i;e[32]!==t?(i=t("Copy key"),e[32]=t,e[33]=i):i=e[33];let m;e[34]!==D||e[35]!==i?(m=(0,l.jsxDEV)("div",{className:"mb-2 flex justify-end",children:(0,l.jsxDEV)($,{"data-testid":"kv-copy-key-btn",onClick:D,size:"sm",variant:"outline",children:i},void 0,!1)},void 0,!1),e[34]=D,e[35]=i,e[36]=m):m=e[36];let K;e[37]!==a.loadError?(K=a.loadError!==null&&(0,l.jsxDEV)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-value-error",role:"alert",children:a.loadError},void 0,!1),e[37]=a.loadError,e[38]=K):K=e[38];let T;e[39]!==a.loading||e[40]!==t?(T=a.loading&&(0,l.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-value-loading",children:t("Loading\u2026")},void 0,!1),e[39]=a.loading,e[40]=t,e[41]=T):T=e[41];let _;e[42]!==v||e[43]!==N||e[44]!==O||e[45]!==w||e[46]!==B||e[47]!==a.busy||e[48]!==a.editedMetadata||e[49]!==a.editedValue||e[50]!==a.loading||e[51]!==a.value||e[52]!==a.writeError||e[53]!==t||e[54]!==S?(_=!a.loading&&a.value!==null&&(0,l.jsxDEV)(l.Fragment,{children:[(0,l.jsxDEV)("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[(0,l.jsxDEV)(W,{className:"text-xs",htmlFor:"kv-value-editor",children:t("Value")},void 0,!1),v!==void 0&&(0,l.jsxDEV)(he,{variant:"secondary",children:t("JSON")},void 0,!1),(0,l.jsxDEV)("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground","data-testid":"kv-value-size",children:ke(Ae(a.editedValue))},void 0,!1)]},void 0,!0),(0,l.jsxDEV)("textarea",{"aria-label":t("KV value"),className:"mb-2 min-h-[8rem] w-full rounded border border-border bg-muted/30 p-2 font-mono text-xs","data-testid":"kv-value-editor",id:"kv-value-editor",onChange:M,value:a.editedValue},void 0,!1),(0,l.jsxDEV)("div",{className:"mb-3 flex flex-wrap gap-2",children:[(0,l.jsxDEV)($,{"data-testid":"kv-format-btn",disabled:v===void 0,onClick:w,size:"sm",variant:"outline",children:t("Format JSON")},void 0,!1),(0,l.jsxDEV)($,{"data-testid":"kv-copy-value-btn",onClick:n(()=>{ie(a.editedValue)},"onClick"),size:"sm",variant:"outline",children:t("Copy value")},void 0,!1)]},void 0,!0),(0,l.jsxDEV)(Ie,{helper:t("Leave blank to keep the current expiration."),id:"kv-ttl-input",invalid:!S,onChange:n(g=>{p({type:"editTtl",value:g})},"onChange"),testId:"kv-ttl-input"},void 0,!1),(0,l.jsxDEV)(_e,{id:"kv-metadata-editor",invalidTestId:"kv-metadata-invalid",onChange:L,testId:"kv-metadata-editor",valid:N,value:a.editedMetadata},void 0,!1),(0,l.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,l.jsxDEV)($,{"data-testid":"kv-save-btn",disabled:a.busy!==""||!N||!S,onClick:B,children:a.busy==="saving"?t("Saving\u2026"):t("Save")},void 0,!1),(0,l.jsxDEV)($,{"data-testid":"kv-delete-btn",disabled:a.busy!=="",onClick:O,variant:"destructive",children:a.busy==="deleting"?t("Deleting\u2026"):t("Delete")},void 0,!1)]},void 0,!0),a.writeError!==null&&(0,l.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"kv-save-error",role:"alert",children:a.writeError},void 0,!1)]},void 0,!0),e[42]=v,e[43]=N,e[44]=O,e[45]=w,e[46]=B,e[47]=a.busy,e[48]=a.editedMetadata,e[49]=a.editedValue,e[50]=a.loading,e[51]=a.value,e[52]=a.writeError,e[53]=t,e[54]=S,e[55]=_):_=e[55];let F;e[56]!==a.loadError||e[57]!==a.loading||e[58]!==a.value||e[59]!==t?(F=!a.loading&&a.value===null&&a.loadError===null&&(0,l.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-absent",children:t("Key is absent or has no value.")},void 0,!1),e[56]=a.loadError,e[57]=a.loading,e[58]=a.value,e[59]=t,e[60]=F):F=e[60];let A;return e[61]!==m||e[62]!==K||e[63]!==T||e[64]!==_||e[65]!==F?(A=(0,l.jsxDEV)("div",{className:"px-4 pb-4","data-testid":"kv-value-section",children:[m,K,T,_,F]},void 0,!0),e[61]=m,e[62]=K,e[63]=T,e[64]=_,e[65]=F,e[66]=A):A=e[66],A},"KvValueEditor"),we=100,ze={appliedPrefix:"",bulk:[],bulkBusy:!1,bulkError:null,cursor:null,keys:null,listComplete:!1,loadError:null,loading:!1,prefixInput:"",reloadNonce:0,selectedKey:null},Ue=n((r,e)=>{switch(e.type){case"appendPage":return{...r,cursor:e.cursor,keys:[...r.keys??[],...e.keys],listComplete:e.listComplete,loading:!1};case"applyFilter":return{...r,appliedPrefix:r.prefixInput,bulk:[],bulkError:null,cursor:null,keys:null,listComplete:!1,selectedKey:null};case"bulkDeleted":{let s=new Set(e.deleted);return{...r,bulk:r.bulk.filter(u=>!s.has(u)),bulkBusy:!1,bulkError:e.error,keys:r.keys===null?null:r.keys.filter(u=>!s.has(u.name)),selectedKey:r.selectedKey!==null&&s.has(r.selectedKey)?null:r.selectedKey}}case"bulkDeleteStart":return{...r,bulkBusy:!0,bulkError:null};case"firstPage":return{...r,cursor:e.cursor,keys:e.keys,listComplete:e.listComplete,loading:!1};case"keyDeleted":return{...r,bulk:r.bulk.filter(s=>s!==e.name),keys:r.keys===null?null:r.keys.filter(s=>s.name!==e.name),selectedKey:null};case"loadFailed":return{...r,loadError:e.error,loading:!1};case"loadStart":return{...r,loadError:null,loading:!0};case"prefixInput":return{...r,prefixInput:e.value};case"reload":return{...r,bulk:[],bulkError:null,reloadNonce:r.reloadNonce+1,selectedKey:null};case"selectKey":return{...r,selectedKey:e.name};case"toggleAllBulk":return{...r,bulk:e.names};case"toggleBulk":return{...r,bulk:r.bulk.includes(e.name)?r.bulk.filter(s=>s!==e.name):[...r.bulk,e.name]};default:return r}},"keyListReducer"),Ze=n(({namespace:r})=>{let e=Y(),s=U(),[u,d]=(0,J.useReducer)(Ue,ze),{appliedPrefix:f,bulk:o,bulkBusy:t,bulkError:a,cursor:p,keys:c,listComplete:x,loadError:b,loading:M,prefixInput:V,reloadNonce:L,selectedKey:h}=u,[v,y]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let i={cancelled:!1};return H((async()=>{d({type:"loadStart"});try{let m=await e.listKvKeys({limit:we,namespace:r,prefix:f===""?void 0:f});i.cancelled||d({cursor:m.cursor??null,keys:m.keys,listComplete:m.listComplete,type:"firstPage"})}catch(m){i.cancelled||d({error:z(m),type:"loadFailed"})}})()),()=>{i.cancelled=!0}},[e,r,f,L]);let N=n(i=>{d({type:"prefixInput",value:i.target.value})},"onPrefixChange"),C=n(()=>{d({type:"applyFilter"})},"onFilter"),S=n(i=>{d({name:i.currentTarget.dataset.key??null,type:"selectKey"})},"onSelectKey"),k=n(()=>{p!==null&&(d({type:"loadStart"}),H((async()=>{try{let i=await e.listKvKeys({cursor:p,limit:we,namespace:r,prefix:f===""?void 0:f});d({cursor:i.cursor??null,keys:i.keys,listComplete:i.listComplete,type:"appendPage"})}catch(i){d({error:z(i),type:"loadFailed"})}})()))},"onLoadMore"),w=n(i=>{d({name:i,type:"keyDeleted"})},"onKeyDeleted"),E=n(i=>{d({name:i,type:"toggleBulk"})},"onToggleBulk"),B=n(i=>{d({names:i&&c!==null?c.map(m=>m.name):[],type:"toggleAllBulk"})},"onToggleAll"),I=n(()=>{if(o.length===0)return;let i=[...o];d({type:"bulkDeleteStart"}),H((async()=>{let m=await Promise.allSettled(i.map(_=>e.deleteKvKey({key:_,namespace:r}))),K=i.filter((_,F)=>m[F]?.status==="fulfilled"),T=i.length-K.length;d({deleted:K,error:T>0?s("Failed to delete {count} keys.",{count:T}):null,type:"bulkDeleted"})})())},"onBulkDelete"),O=n(()=>{y(!1),d({type:"reload"})},"onCreated"),D=c!==null&&c.length>0&&o.length===c.length;return(0,l.jsxDEV)(l.Fragment,{children:[(0,l.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"kv-keys-section",children:[(0,l.jsxDEV)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,l.jsxDEV)(le,{"aria-label":s("Filter keys by prefix"),className:"min-w-[16rem] flex-1","data-testid":"kv-prefix-input",onChange:N,placeholder:s("Filter by prefix\u2026"),value:V},void 0,!1),(0,l.jsxDEV)($,{"data-testid":"kv-filter-btn",disabled:M,onClick:C,children:s("Filter")},void 0,!1),(0,l.jsxDEV)($,{"data-testid":"kv-new-key-btn",onClick:n(()=>{y(i=>!i)},"onClick"),variant:"outline",children:s("New key")},void 0,!1),o.length>0&&(0,l.jsxDEV)($,{"data-testid":"kv-bulk-delete-btn",disabled:t,onClick:I,variant:"destructive",children:t?s("Deleting\u2026"):s("Delete {count}",{count:o.length})},void 0,!1)]},void 0,!0),a!==null&&(0,l.jsxDEV)("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-bulk-error",role:"alert",children:a},void 0,!1),b!==null&&(0,l.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"kv-keys-error",role:"alert",children:b},void 0,!1),c!==null&&c.length===0&&!M&&(0,l.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"kv-no-keys",children:s("No keys.")},void 0,!1),c!==null&&c.length>0&&(0,l.jsxDEV)(re,{className:"overflow-hidden py-0",children:(0,l.jsxDEV)(se,{className:"px-0",children:(0,l.jsxDEV)(de,{"data-testid":"kv-key-table",children:[(0,l.jsxDEV)(ne,{children:(0,l.jsxDEV)(q,{children:[(0,l.jsxDEV)(Q,{className:"w-10",children:(0,l.jsxDEV)(ue,{"aria-label":s("Select all"),checked:D,"data-testid":"kv-select-all",onCheckedChange:B},void 0,!1)},void 0,!1),(0,l.jsxDEV)(Q,{children:s("Key")},void 0,!1),(0,l.jsxDEV)(Q,{children:s("Expiration")},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(oe,{children:c.map(i=>(0,l.jsxDEV)(q,{className:i.name===h?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-key":i.name,"data-testid":`kv-key-row-${i.name}`,onClick:S,children:[(0,l.jsxDEV)(X,{onClick:n(m=>{m.stopPropagation()},"onClick"),children:(0,l.jsxDEV)(ue,{"aria-label":s("Select {name}",{name:i.name}),checked:o.includes(i.name),"data-testid":`kv-select-${i.name}`,onCheckedChange:n(()=>{E(i.name)},"onCheckedChange")},void 0,!1)},void 0,!1),(0,l.jsxDEV)(X,{className:"font-mono text-xs",children:i.name},void 0,!1),(0,l.jsxDEV)(X,{className:"tabular-nums text-xs",children:Oe(i.expiration)},void 0,!1)]},i.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),!x&&p!==null&&(0,l.jsxDEV)("div",{className:"mt-2",children:(0,l.jsxDEV)($,{"data-testid":"kv-load-more",disabled:M,onClick:k,variant:"outline",children:s(M?"Loading\u2026":"Load more")},void 0,!1)},void 0,!1)]},void 0,!0),(0,l.jsxDEV)(me,{onOpenChange:n(i=>{i||y(!1)},"onOpenChange"),open:v,children:(0,l.jsxDEV)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-create-sheet",side:"right",children:[(0,l.jsxDEV)(fe,{children:(0,l.jsxDEV)(pe,{children:s("New key")},void 0,!1)},void 0,!1),(0,l.jsxDEV)($e,{namespace:r,onCancel:n(()=>{y(!1)},"onCancel"),onCreated:O},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(me,{onOpenChange:n(i=>{i||d({name:null,type:"selectKey"})},"onOpenChange"),open:h!==null,children:(0,l.jsxDEV)(ve,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-editor-sheet",side:"right",children:[(0,l.jsxDEV)(fe,{children:(0,l.jsxDEV)(pe,{className:"truncate font-mono text-xs",children:h},void 0,!1)},void 0,!1),h!==null&&(0,l.jsxDEV)(Re,{expiration:c?.find(i=>i.name===h)?.expiration,keyName:h,namespace:r,onDeleted:w},`${r}:${h}`,!1)]},void 0,!0)},void 0,!1)]},void 0,!0)},"KvKeyList"),ot=n(({loadNamespaces:r}={})=>{let e=Y(),s=U(),[u,d]=(0,J.useState)(null),[f,o]=(0,J.useState)(null),[t,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{let c={cancelled:!1};return H((async()=>{try{let x=await(r??(()=>e.listKvNamespaces()))();c.cancelled||(d(x),o(null),a(b=>b??x[0]?.binding??null))}catch(x){c.cancelled||(d(null),o(z(x)))}})()),()=>{c.cancelled=!0}},[e,r]);let p=n(c=>{a(c.currentTarget.dataset.ns??null)},"onSelectNs");return(0,l.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-kv-browser",children:[f!==null&&(0,l.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"kv-ns-error",role:"alert",children:f},void 0,!1),u!==null&&u.length===0&&(0,l.jsxDEV)(ye,{description:s("Add a kv_namespaces binding to wrangler.jsonc \u2014 it appears here automatically, no wiring needed."),icon:(0,l.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M5 5h14v4H5V5Zm0 5h14v4H5v-4Zm0 5h14v4H5v-4Z"},void 0,!1)},void 0,!1),testId:"kv-empty",title:s("No KV namespaces.")},void 0,!1),u!==null&&u.length>0&&(0,l.jsxDEV)(re,{className:"overflow-hidden py-0",children:(0,l.jsxDEV)(se,{className:"px-0",children:(0,l.jsxDEV)(de,{"data-testid":"kv-namespace-table",children:[(0,l.jsxDEV)(ne,{children:(0,l.jsxDEV)(q,{children:(0,l.jsxDEV)(Q,{children:s("Namespace")},void 0,!1)},void 0,!1)},void 0,!1),(0,l.jsxDEV)(oe,{children:u.map(c=>(0,l.jsxDEV)(q,{className:c.binding===t?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-ns":c.binding,"data-testid":`kv-ns-row-${c.binding}`,onClick:p,children:(0,l.jsxDEV)(X,{className:"font-mono text-xs",children:c.binding},void 0,!1)},c.binding,!1))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t!==null&&(0,l.jsxDEV)(Ze,{namespace:t},t,!1)]},void 0,!0)},"KvBrowser");export{ot as KvBrowser};
@@ -1 +0,0 @@
1
- import{a as Ae}from"./chunk-MPYFGAOW.js";import{a as we}from"./chunk-J6J54MBP.js";import{a as ve,b as ge,c as pe,d as K,e as O,f as T}from"./chunk-GTM65MVX.js";import{c as fe}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as he}from"./chunk-TAD43CG5.js";import{a as re}from"./chunk-DVKPRFIJ.js";import{a as me,e as ue}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as xe}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as ce,j as w,k as ye,n as ze}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a as o,e as de,f as Oe,g as Te,h as _e}from"./chunk-RRCPZMC2.js";var be=de(Te(),1);var Ie=de(Oe(),1);var i=de(_e(),1);var Ce=o(e=>{let t=(0,be.c)(35),{actionLabel:l,actionPrefix:f,columns:p,heading:r,onAction:_,rowPrefix:b,rows:I,testId:N}=e,A=ce(),n;t[0]!==r?(n=(0,i.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,i.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r},void 0,!1)},void 0,!1),t[0]=r,t[1]=n):n=t[1];let m;t[2]!==p?(m=p.map($e),t[2]=p,t[3]=m):m=t[3];let u;t[4]!==A?(u=A("Actions"),t[4]=A,t[5]=u):u=t[5];let x;t[6]!==u?(x=(0,i.jsxDEV)(O,{"aria-label":u},void 0,!1),t[6]=u,t[7]=x):x=t[7];let h;t[8]!==m||t[9]!==x?(h=(0,i.jsxDEV)(ge,{children:(0,i.jsxDEV)(K,{children:[m,x]},void 0,!0)},void 0,!1),t[8]=m,t[9]=x,t[10]=h):h=t[10];let s;if(t[11]!==l||t[12]!==f||t[13]!==p||t[14]!==_||t[15]!==b||t[16]!==I){let d;t[18]!==l||t[19]!==f||t[20]!==p||t[21]!==_||t[22]!==b?(d=o($=>{let z=w($.id);return(0,i.jsxDEV)(K,{"data-testid":`${b}-${z}`,children:[p.map(P=>(0,i.jsxDEV)(T,{children:P.render($)},P.head,!1)),(0,i.jsxDEV)(T,{children:(0,i.jsxDEV)(fe,{"data-testid":`${f}-${z}`,onClick:o(()=>{_(z)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l},void 0,!1)},void 0,!1)]},z,!0)},"t72"),t[18]=l,t[19]=f,t[20]=p,t[21]=_,t[22]=b,t[23]=d):d=t[23],s=I.map(d),t[11]=l,t[12]=f,t[13]=p,t[14]=_,t[15]=b,t[16]=I,t[17]=s}else s=t[17];let v;t[24]!==s?(v=(0,i.jsxDEV)(pe,{children:s},void 0,!1),t[24]=s,t[25]=v):v=t[25];let g;t[26]!==h||t[27]!==v?(g=(0,i.jsxDEV)(ue,{className:"px-0",children:(0,i.jsxDEV)(ve,{children:[h,v]},void 0,!0)},void 0,!1),t[26]=h,t[27]=v,t[28]=g):g=t[28];let y;t[29]!==n||t[30]!==g?(y=(0,i.jsxDEV)(me,{className:"overflow-hidden py-0",children:[n,g]},void 0,!0),t[29]=n,t[30]=g,t[31]=y):y=t[31];let C;return t[32]!==y||t[33]!==N?(C=(0,i.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":N,children:y},void 0,!1),t[32]=y,t[33]=N,t[34]=C):C=t[34],C},"OrgRowTable"),Ge=o(()=>{let e=(0,be.c)(95),t=xe(),l=ce(),{capabilities:f,ready:p}=Ae(),[r,_]=(0,Ie.useState)(null),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-auth-orgs"],e[0]=b):b=e[0];let I;e[1]!==t?(I=o(()=>t.listAuthOrganizations({limit:100}),"t1"),e[1]=t,e[2]=I):I=e[2];let N;e[3]!==f.organization?(N={enabled:f.organization},e[3]=f.organization,e[4]=N):N=e[4];let A=re(b,I,N),n=A.data?.rows??null,m;e[5]!==r?(m=["lunora-auth-org-members",r],e[5]=r,e[6]=m):m=e[6];let u;e[7]!==t||e[8]!==r?(u=o(()=>t.listAuthOrgMembers({limit:200,organizationId:r??""}),"t4"),e[7]=t,e[8]=r,e[9]=u):u=e[9];let x=r!==null,h;e[10]!==x?(h={enabled:x},e[10]=x,e[11]=h):h=e[11];let s=re(m,u,h),v;e[12]!==r?(v=["lunora-auth-org-invitations",r],e[12]=r,e[13]=v):v=e[13];let g;e[14]!==t||e[15]!==r?(g=o(()=>t.listAuthOrgInvitations({limit:200,organizationId:r??""}),"t8"),e[14]=t,e[15]=r,e[16]=g):g=e[16];let y=r!==null,C;e[17]!==y?(C={enabled:y},e[17]=y,e[18]=C):C=e[18];let d=re(v,g,C),$=r===null?null:s.data?.rows??null,z=r===null?null:d.data?.rows??null,P=A.error??s.error??d.error,U;e[19]!==d||e[20]!==s||e[21]!==A||e[22]!==r?(U=o(()=>{A.refetch(),r!==null&&(s.refetch(),d.refetch())},"t11"),e[19]=d,e[20]=s,e[21]=A,e[22]=r,e[23]=U):U=e[23],we(U,f.organization);let W;e[24]===Symbol.for("react.memo_cache_sentinel")?(W=o(a=>{_(a)},"t12"),e[24]=W):W=e[24];let Ne=W,X;e[25]!==d||e[26]!==s?(X=o(a=>{ye((async()=>{await a(),s.refetch(),d.refetch()})())},"t13"),e[25]=d,e[26]=s,e[27]=X):X=e[27];let S=X,Y;e[28]!==t||e[29]!==S?(Y=o(a=>{S(()=>t.removeAuthOrgMember({memberId:a}))},"t14"),e[28]=t,e[29]=S,e[30]=Y):Y=e[30];let oe=Y,Z;e[31]!==t||e[32]!==S?(Z=o(a=>{S(()=>t.cancelAuthOrgInvitation({invitationId:a}))},"t15"),e[31]=t,e[32]=S,e[33]=Z):Z=e[33];let ae=Z,M;e[34]!==l?(M=l("userId"),e[34]=l,e[35]=M):M=e[35];let R;e[36]!==M?(R={head:M,render:Pe},e[36]=M,e[37]=R):R=e[37];let E;e[38]!==l?(E=l("role"),e[38]=l,e[39]=E):E=e[39];let L;e[40]!==E?(L={head:E,render:Se},e[40]=E,e[41]=L):L=e[41];let ee;e[42]!==R||e[43]!==L?(ee=[R,L],e[42]=R,e[43]=L,e[44]=ee):ee=e[44];let ne=ee,Q;e[45]!==l?(Q=l("email"),e[45]=l,e[46]=Q):Q=e[46];let k;e[47]!==Q?(k={head:Q,render:Me},e[47]=Q,e[48]=k):k=e[48];let B;e[49]!==l?(B=l("role"),e[49]=l,e[50]=B):B=e[50];let H;e[51]!==B?(H={head:B,render:Re},e[51]=B,e[52]=H):H=e[52];let j;e[53]!==l?(j=l("status"),e[53]=l,e[54]=j):j=e[54];let D;e[55]!==j?(D={head:j,render:Ee},e[55]=j,e[56]=D):D=e[56];let te;e[57]!==k||e[58]!==H||e[59]!==D?(te=[k,H,D],e[57]=k,e[58]=H,e[59]=D,e[60]=te):te=e[60];let se=te;if(p&&!f.organization){let a;e[61]!==l?(a=l("Enable the organization() plugin in your auth config to manage organizations here."),e[61]=l,e[62]=a):a=e[62];let c;e[63]!==l?(c=l("Organizations are not enabled."),e[63]=l,e[64]=c):c=e[64];let ie;return e[65]!==a||e[66]!==c?(ie=(0,i.jsxDEV)(he,{description:a,testId:"org-disabled",title:c},void 0,!1),e[65]=a,e[66]=c,e[67]=ie):ie=e[67],ie}let F;e[68]!==P?(F=P!==null&&(0,i.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:P},void 0,!1),e[68]=P,e[69]=F):F=e[69];let V;e[70]!==n||e[71]!==l?(V=n!==null&&n.length===0&&(0,i.jsxDEV)(he,{testId:"org-empty",title:l("No organizations.")},void 0,!1),e[70]=n,e[71]=l,e[72]=V):V=e[72];let q;e[73]!==n||e[74]!==r||e[75]!==l?(q=n!==null&&n.length>0&&(0,i.jsxDEV)(me,{className:"overflow-hidden py-0",children:(0,i.jsxDEV)(ue,{className:"px-0",children:(0,i.jsxDEV)(ve,{"data-testid":"org-table",children:[(0,i.jsxDEV)(ge,{children:(0,i.jsxDEV)(K,{children:[(0,i.jsxDEV)(O,{children:l("id")},void 0,!1),(0,i.jsxDEV)(O,{children:l("name")},void 0,!1),(0,i.jsxDEV)(O,{children:l("slug")},void 0,!1),(0,i.jsxDEV)(O,{children:l("created")},void 0,!1),(0,i.jsxDEV)(O,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,i.jsxDEV)(pe,{children:n.map(a=>{let c=w(a.id);return(0,i.jsxDEV)(K,{"data-testid":`org-row-${c}`,children:[(0,i.jsxDEV)(T,{className:"font-mono text-xs",children:c},void 0,!1),(0,i.jsxDEV)(T,{children:w(a.name)},void 0,!1),(0,i.jsxDEV)(T,{children:w(a.slug)},void 0,!1),(0,i.jsxDEV)(T,{className:"text-muted-foreground tabular-nums",children:ze(a.createdAt)},void 0,!1),(0,i.jsxDEV)(T,{children:(0,i.jsxDEV)(fe,{"aria-pressed":r===c,"data-testid":`org-select-${c}`,onClick:o(()=>{Ne(c)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Members")},void 0,!1)},void 0,!1)]},c,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[73]=n,e[74]=r,e[75]=l,e[76]=q):q=e[76];let G;e[77]!==ne||e[78]!==$||e[79]!==oe||e[80]!==r||e[81]!==l?(G=r!==null&&$!==null&&(0,i.jsxDEV)(Ce,{actionLabel:l("Remove"),actionPrefix:"org-remove-member",columns:ne,heading:l("Members"),onAction:oe,rowPrefix:"org-member",rows:$,testId:"org-members"},void 0,!1),e[77]=ne,e[78]=$,e[79]=oe,e[80]=r,e[81]=l,e[82]=G):G=e[82];let J;e[83]!==se||e[84]!==z||e[85]!==ae||e[86]!==r||e[87]!==l?(J=r!==null&&z!==null&&z.length>0&&(0,i.jsxDEV)(Ce,{actionLabel:l("Cancel"),actionPrefix:"org-cancel-invitation",columns:se,heading:l("Invitations"),onAction:ae,rowPrefix:"org-invitation",rows:z,testId:"org-invitations"},void 0,!1),e[83]=se,e[84]=z,e[85]=ae,e[86]=r,e[87]=l,e[88]=J):J=e[88];let le;return e[89]!==F||e[90]!==V||e[91]!==q||e[92]!==G||e[93]!==J?(le=(0,i.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[F,V,q,G,J]},void 0,!0),e[89]=F,e[90]=V,e[91]=q,e[92]=G,e[93]=J,e[94]=le):le=e[94],le},"OrganizationsPanel");function $e(e){return(0,i.jsxDEV)(O,{children:e.head},e.head,!1)}o($e,"_temp");function Pe(e){return w(e.userId)}o(Pe,"_temp2");function Se(e){return w(e.role)}o(Se,"_temp3");function Me(e){return w(e.email)}o(Me,"_temp4");function Re(e){return w(e.role)}o(Re,"_temp5");function Ee(e){return w(e.status)}o(Ee,"_temp6");export{Ge as OrganizationsPanel};
@@ -1 +0,0 @@
1
- import{l as we,m as Ke,ma as je}from"./chunk-XUGSA2NG.js";import{i as Ge,k as He}from"./chunk-4QHKBC77.js";import{D as Me,I as Se,K as Ve,L as De,M as Le,N as Oe,O as Te,P as Fe,Q as _e,a as $,b as Ie,c as Ne,e as F,f as Be}from"./chunk-3CJW6NWG.js";import{b as Ae}from"./chunk-UK64ZSUW.js";import{a as T,e as ce}from"./chunk-O3NAGRTR.js";import{a as ve,c as Re,d as Ee,g as de,i as Pe,j as W}from"./chunk-CKSHCYGC.js";import{a as vt}from"./chunk-3OA7PECS.js";import{a as i,d as Ct,e as k,f as O,g as yt,h as Rt,j as ye}from"./chunk-RRCPZMC2.js";var Je=k(yt(),1);var w={};Ct(w,{Indicator:()=>fe,Root:()=>ue});var u=k(O(),1);function Ue(t){if(!t)return null;for(let e of t.elements){let n=e.tagName;if(n==="BUTTON"||n==="INPUT"){let o=e;if(o.type==="submit")return o}}return null}i(Ue,"getDefaultFormSubmitter");var qe=k(O(),1);var le=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.indeterminate="data-indeterminate",t.disabled="data-disabled",t.readonly="data-readonly",t.required="data-required",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});function z(t){return qe.useMemo(()=>({checked(e){return t.indeterminate?{}:e?{[le.checked]:""}:{[le.unchecked]:""}},...$}),[t.indeterminate])}i(z,"useStateAttributesMapping");var We=k(O(),1);function $e(t,e,n,o=!0,a){let[f,p]=We.useState(),M=F(a?`${a}-label`:void 0),b=t??e??f;return T(()=>{let g=t||e||!o?void 0:Et(n.current,M);f!==g&&p(g)}),b}i($e,"useAriaLabelledBy");function Et(t,e){let n=Pt(t);if(n)return!n.id&&e&&(n.id=e),n.id||void 0}i(Et,"getAriaLabelledBy");function Pt(t){if(!t)return;let e=t.parentElement;if(e&&e.tagName==="LABEL")return e;let n=t.id;if(n){let a=t.nextElementSibling;if(a&&a.htmlFor===n)return a}let o=t.labels;return o&&o[0]}i(Pt,"findAssociatedLabel");var J=k(O(),1);var X=J.createContext(void 0);X.displayName="CheckboxRootContext";function ze(){let t=J.useContext(X);if(t===void 0)throw new Error("Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.");return t}i(ze,"useCheckboxRootContext");var _=k(vt(),1);var It="data-parent",ue=u.forwardRef(i(function(e,n){let{checked:o,className:a,defaultChecked:f=!1,"aria-labelledby":p,disabled:M=!1,form:b,id:g,indeterminate:S=!1,inputRef:Z,name:K,onCheckedChange:A,parent:m=!1,readOnly:R=!1,render:pe,required:E=!1,uncheckedValue:j,value:G,nativeButton:H=!1,style:Nt,...Xe}=e,{clearErrors:Ye}=Ne(),{disabled:Qe,name:Ze,setDirty:et,setFilled:ee,setFocused:me,setTouched:tt,state:he,validationMode:rt,validityData:nt,validation:ot}=Ie(),it=Me(),{labelId:at,controlId:st,registerControlId:P,getDescriptionProps:be}=Be(),s=_e(),V=s?.parent,D=V&&s.allValues,c=Qe||it.disabled||s?.disabled||M,I=Ze??K,d=G??I,ge=F(),dt=F(),x=st;D?x=m?dt:`${V.id}-${d}`:g&&(x=g);let te={};D&&(m?te=s.parent.getParentProps():d&&(te=s.parent.getChildProps(d)));let{checked:ke=o,indeterminate:ct=S,onCheckedChange:lt,...ut}=te,N=s?.value,xe=s?.setValue,Ce=s?.defaultValue,re=u.useRef(null),U=Re(()=>Symbol("checkbox-control")),ne=u.useRef(!1),{getButtonProps:ft,buttonRef:pt}=Ae({disabled:c,native:H}),B=s?.validation??ot,[l,mt]=Le({controlled:d&&N&&!m?N.includes(d):ke,default:d&&Ce&&!m?Ce.includes(d):f,name:"Checkbox",state:"checked"}),oe=D?!!ke:l,L=D&&ct||S;T(()=>{P!==de&&(ne.current=!0,P(U.current,x))},[x,P,U]),u.useEffect(()=>{let r=U.current;return()=>{!ne.current||P===de||(ne.current=!1,P(r,void 0))}},[P,U]),Oe(re,ge,l,void 0,!s&&!c,K);let C=u.useRef(null),ht=Ee(Z,C,B.inputRef,B.registerInput),bt=$e(p,at,C,!H,x??void 0);T(()=>{C.current&&(C.current.indeterminate=L,l&&ee(!0))},[l,L,ee]),je(l,()=>{s||(Ye(I),ee(l),et(l!==nt.initialValue),B.change(l))});let gt=ve({checked:l,disabled:c,form:b,name:m?void 0:I,id:H?void 0:x??void 0,required:E,ref:ht,style:I?Ke:we,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(r){if(r.nativeEvent.defaultPrevented)return;if(R){r.preventDefault();return}let h=r.currentTarget.checked,y=Fe(Te.none,r.nativeEvent);if(A?.(h,y),!y.isCanceled&&(lt?.(h,y),!y.isCanceled&&(mt(h),d&&N&&xe&&!m&&!D))){let v=h?[...N,d]:N.filter(q=>q!==d);xe(v,y)}},onFocus(){re.current?.focus()}},G!==void 0?{value:(s?l&&G:G)||""}:Pe,be,r=>B.getValidationProps(c,r));u.useEffect(()=>{if(!V||!d)return;let r=V.disabledStatesRef.current;return r.set(d,c),()=>{r.delete(d)}},[V,c,d]);let ie=u.useMemo(()=>({...he,checked:oe,disabled:c,readOnly:R,required:E,indeterminate:L}),[he,oe,c,R,E,L]),kt=z(ie),xt=W("span",e,{state:ie,ref:[pt,re,n,s?.registerControlRef],props:[{id:H?x??void 0:ge,role:"checkbox","aria-checked":L?"mixed":oe,"aria-readonly":R||void 0,"aria-required":E||void 0,"aria-labelledby":bt,[It]:m?"":void 0,onFocus(){c||me(!0)},onBlur(){let r=C.current;r&&(tt(!0),me(!1),rt==="onBlur"&&B.commit(s?N:r.checked))},onKeyDown(r){if(r.key!=="Enter"||(r.preventBaseUIHandler(),r.defaultPrevented))return;let h=C.current?.form??null,y=r.currentTarget,v=r.nativeEvent,q=r.preventDefault,ae=v.preventDefault,se=!1;r.preventDefault=()=>{se=!0,q.call(r)},v.preventDefault=()=>{se=!0,ae.call(v)},ae.call(v),ce(y).queueMicrotask(()=>{r.preventDefault=q,v.preventDefault=ae,se||Ue(h)?.click()})},onClick(r){if(R||c)return;r.preventDefault();let h=C.current;h&&h.dispatchEvent(new(ce(h)).PointerEvent("click",{bubbles:!0,shiftKey:r.shiftKey,ctrlKey:r.ctrlKey,altKey:r.altKey,metaKey:r.metaKey}))}},Xe,ut,ft,be,r=>B.getValidationProps(c,r)],stateAttributesMapping:kt});return(0,_.jsxs)(X.Provider,{value:ie,children:[xt,!l&&!s&&I&&!m&&j!==void 0&&(0,_.jsx)("input",{type:"hidden",form:b,name:I,value:j,disabled:c}),(0,_.jsx)("input",{...gt,suppressHydrationWarning:!0})]})},"CheckboxRoot"));ue.displayName="CheckboxRoot";var Y=k(O(),1);var fe=Y.forwardRef(i(function(e,n){let{render:o,className:a,style:f,keepMounted:p=!1,...M}=e,b=ze(),g=b.checked||b.indeterminate,{mounted:S,transitionStatus:Z,setMounted:K}=De(g),A=Y.useRef(null),m={...b,transitionStatus:Z};Ve({open:g,ref:A,onComplete(){g||K(!1)}});let pe={...z(b),...Se,...$},E=p||S,j=W("span",e,{ref:[n,A],state:m,stateAttributesMapping:pe,props:M});return E?j:null},"CheckboxIndicator"));fe.displayName="CheckboxIndicator";var Q=k(Rt(),1);function Sr(t){let e=(0,Je.c)(9),n,o;e[0]!==t?({className:n,...o}=t,e[0]=t,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let a;e[3]!==n?(a=ye("peer relative flex size-4 shrink-0 items-center justify-center rounded-md border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",n),e[3]=n,e[4]=a):a=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(0,Q.jsxDEV)(w.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:(0,Q.jsxDEV)(He,{icon:Ge,strokeWidth:2},void 0,!1)},void 0,!1),e[5]=f):f=e[5];let p;return e[6]!==o||e[7]!==a?(p=(0,Q.jsxDEV)(w.Root,{"data-slot":"checkbox",className:a,...o,children:f},void 0,!1),e[6]=o,e[7]=a,e[8]=p):p=e[8],p}i(Sr,"Checkbox");export{Sr as a};
@@ -1 +0,0 @@
1
- import{a as le}from"./chunk-MPYFGAOW.js";import{a as X}from"./chunk-AHILM3ZP.js";import{a as ae}from"./chunk-J6J54MBP.js";import{a as se}from"./chunk-2K47A3P6.js";import{a as G,b as W,c as Y,d as B,e as F,f as U}from"./chunk-GTM65MVX.js";import{a as z}from"./chunk-JSEXCW5Q.js";import{R as D}from"./chunk-3CJW6NWG.js";import{c as S}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as ee}from"./chunk-TAD43CG5.js";import{a as te}from"./chunk-DVKPRFIJ.js";import{a as V,e as j}from"./chunk-SEU5V7I6.js";import{b as E}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as $}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as M,g as Z,j as H,k as O,n as Q}from"./chunk-PVZI3CXP.js";import"./chunk-GMSGZDDH.js";import{a,e as K,f as ge,g as Ne,h as we}from"./chunk-RRCPZMC2.js";var m=K(ge(),1);var t=K(we(),1),q=K(Ne(),1);var ke=a(({onClose:w,onCreated:e})=>{let i=$(),s=M(),[c,d]=(0,m.useState)(""),[u,l]=(0,m.useState)(""),[o,f]=(0,m.useState)(""),[k,I]=(0,m.useState)(""),[C,b]=(0,m.useState)(!1),[N,y]=(0,m.useState)(null),h=a(r=>{d(r.target.value)},"onEmailChange"),p=a(r=>{l(r.target.value)},"onNameChange"),x=a(r=>{f(r.target.value)},"onPasswordChange"),v=a(r=>{I(r.target.value)},"onRoleChange"),n=a(async()=>{b(!0),y(null);try{await i.createAuthUser({email:c.trim(),name:u.trim(),password:o===""?void 0:o,role:k.trim()===""?void 0:k.trim()}),e(),w()}catch(r){y(Z(r))}finally{b(!1)}},"submit"),A=a(()=>{O(n())},"onSubmit");return(0,t.jsxDEV)(X,{label:s("Create user"),onClose:w,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:s("Create user")},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-email",children:s("email")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-email",id:"uc-email",onChange:h,type:"email",value:c},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-name",children:s("name")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-name",id:"uc-name",onChange:p,value:u},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-password",children:s("Password (optional)")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-password",id:"uc-password",onChange:x,type:"password",value:o},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-role",children:s("Role (optional)")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-role",id:"uc-role",onChange:v,value:k},void 0,!1)]},void 0,!0),N!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:N},void 0,!1),(0,t.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsxDEV)(S,{"data-testid":"uc-cancel",onClick:w,size:"sm",type:"button",variant:"outline",children:s("Cancel")},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"uc-submit",disabled:C||c.trim()===""||u.trim()==="",onClick:A,size:"sm",type:"button",children:s(C?"Creating\u2026":"Create")},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserCreateDialog"),_=a(w=>{let e=(0,q.c)(2),{children:i}=w,s;return e[0]!==i?(s=(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i},void 0,!1),e[0]=i,e[1]=s):s=e[1],s},"SectionHeading"),Ce=a(w=>{let e=(0,q.c)(29),{busy:i,runAction:s,userId:c,version:d}=w,u=$(),l=M(),[o,f]=(0,m.useState)(null),[k,I]=(0,m.useState)(null),C;e[0]!==u||e[1]!==c?(C=a(()=>{O((async()=>{I(null);try{let r=await u.listAuthSessions({limit:50,userId:c});f(r.rows)}catch(r){let R=r;f(null),I(Z(R))}})())},"t1"),e[0]=u,e[1]=c,e[2]=C):C=e[2];let b;e[3]!==u||e[4]!==c||e[5]!==d?(b=[u,c,d],e[3]=u,e[4]=c,e[5]=d,e[6]=b):b=e[6],(0,m.useEffect)(C,b);let N;e[7]!==u||e[8]!==s?(N=a(r=>{s(()=>u.revokeAuthSession({sessionId:r}))},"t3"),e[7]=u,e[8]=s,e[9]=N):N=e[9];let y=N,h;e[10]!==l?(h=l("Sessions"),e[10]=l,e[11]=h):h=e[11];let p;e[12]!==h?(p=(0,t.jsxDEV)(_,{children:h},void 0,!1),e[12]=h,e[13]=p):p=e[13];let x;e[14]!==k?(x=k!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:k},void 0,!1),e[14]=k,e[15]=x):x=e[15];let v;e[16]!==o||e[17]!==l?(v=o!==null&&o.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:l("No active sessions.")},void 0,!1),e[16]=o,e[17]=l,e[18]=v):v=e[18];let n;e[19]!==i||e[20]!==y||e[21]!==o||e[22]!==l?(n=o!==null&&o.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"ud-sessions-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:l("expires")},void 0,!1),(0,t.jsxDEV)(F,{children:l("ip")},void 0,!1),(0,t.jsxDEV)(F,{children:l("user agent")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:o.map(r=>(0,t.jsxDEV)(B,{"data-testid":`ud-session-${r.id}`,children:[(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(r.expiresAt)},void 0,!1),(0,t.jsxDEV)(U,{children:r.ipAddress??""},void 0,!1),(0,t.jsxDEV)(U,{className:"max-w-40 truncate",children:r.userAgent??""},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`ud-revoke-${r.id}`,disabled:i,onClick:a(()=>{y(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Revoke")},void 0,!1)},void 0,!1)]},r.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=i,e[20]=y,e[21]=o,e[22]=l,e[23]=n):n=e[23];let A;return e[24]!==p||e[25]!==x||e[26]!==v||e[27]!==n?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[p,x,v,n]},void 0,!0),e[24]=p,e[25]=x,e[26]=v,e[27]=n,e[28]=A):A=e[28],A},"UserSessionsPanel"),Ae=a(w=>{let e=(0,q.c)(30),{busy:i,runAction:s,userId:c,version:d}=w,u=$(),l=M(),[o,f]=(0,m.useState)(null),[k,I]=(0,m.useState)(null),C;e[0]!==u||e[1]!==c?(C=a(()=>{O((async()=>{I(null);try{f(await u.listAuthAccounts({userId:c}))}catch(r){let R=r;f(null),I(Z(R))}})())},"t1"),e[0]=u,e[1]=c,e[2]=C):C=e[2];let b;e[3]!==u||e[4]!==c||e[5]!==d?(b=[u,c,d],e[3]=u,e[4]=c,e[5]=d,e[6]=b):b=e[6],(0,m.useEffect)(C,b);let N;e[7]!==u||e[8]!==s||e[9]!==c?(N=a(r=>{s(()=>u.unlinkAuthAccount({accountId:r,userId:c}))},"t3"),e[7]=u,e[8]=s,e[9]=c,e[10]=N):N=e[10];let y=N,h;e[11]!==l?(h=l("Linked accounts"),e[11]=l,e[12]=h):h=e[12];let p;e[13]!==h?(p=(0,t.jsxDEV)(_,{children:h},void 0,!1),e[13]=h,e[14]=p):p=e[14];let x;e[15]!==k?(x=k!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:k},void 0,!1),e[15]=k,e[16]=x):x=e[16];let v;e[17]!==o||e[18]!==l?(v=o!==null&&o.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:l("No linked accounts.")},void 0,!1),e[17]=o,e[18]=l,e[19]=v):v=e[19];let n;e[20]!==o||e[21]!==i||e[22]!==y||e[23]!==l?(n=o!==null&&o.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"ud-accounts-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:l("provider")},void 0,!1),(0,t.jsxDEV)(F,{children:l("created")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:o.map(r=>{let R=H(r.id);return(0,t.jsxDEV)(B,{"data-testid":`ud-account-${R}`,children:[(0,t.jsxDEV)(U,{children:H(r.providerId)},void 0,!1),(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(r.createdAt)},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`ud-unlink-${R}`,disabled:i,onClick:a(()=>{y(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Unlink")},void 0,!1)},void 0,!1)]},R,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=o,e[21]=i,e[22]=y,e[23]=l,e[24]=n):n=e[24];let A;return e[25]!==p||e[26]!==x||e[27]!==v||e[28]!==n?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[p,x,v,n]},void 0,!0),e[25]=p,e[26]=x,e[27]=v,e[28]=n,e[29]=A):A=e[29],A},"UserAccountsPanel"),Ie=a(w=>{let e=(0,q.c)(40),{busy:i,capabilities:s,runAction:c,userId:d,version:u}=w,l=$(),o=M(),[f,k]=(0,m.useState)(null),I;e[0]!==s.passkey||e[1]!==l||e[2]!==d?(I=a(()=>{s.passkey&&O((async()=>{try{k(await l.listAuthPasskeys({userId:d}))}catch{k(null)}})())},"t1"),e[0]=s.passkey,e[1]=l,e[2]=d,e[3]=I):I=e[3];let C;e[4]!==s.passkey||e[5]!==l||e[6]!==d||e[7]!==u?(C=[s.passkey,l,d,u],e[4]=s.passkey,e[5]=l,e[6]=d,e[7]=u,e[8]=C):C=e[8],(0,m.useEffect)(I,C);let b;e[9]!==l||e[10]!==c||e[11]!==d?(b=a(()=>{c(()=>l.disableAuthTwoFactor({userId:d}))},"t3"),e[9]=l,e[10]=c,e[11]=d,e[12]=b):b=e[12];let N=b,y;e[13]!==l||e[14]!==c?(y=a(R=>{c(()=>l.deleteAuthPasskey({passkeyId:R}))},"t4"),e[13]=l,e[14]=c,e[15]=y):y=e[15];let h=y,p;e[16]!==o?(p=o("Security"),e[16]=o,e[17]=p):p=e[17];let x;e[18]!==p?(x=(0,t.jsxDEV)(_,{children:p},void 0,!1),e[18]=p,e[19]=x):x=e[19];let v;e[20]!==i||e[21]!==s.twoFactor||e[22]!==N||e[23]!==o?(v=s.twoFactor&&(0,t.jsxDEV)(S,{"data-testid":"ud-disable-2fa",disabled:i,onClick:N,size:"sm",type:"button",variant:"outline",children:o("Disable two-factor")},void 0,!1),e[20]=i,e[21]=s.twoFactor,e[22]=N,e[23]=o,e[24]=v):v=e[24];let n;e[25]!==s.passkey||e[26]!==f||e[27]!==o?(n=s.passkey&&f!==null&&f.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o("No passkeys.")},void 0,!1),e[25]=s.passkey,e[26]=f,e[27]=o,e[28]=n):n=e[28];let A;e[29]!==i||e[30]!==s.passkey||e[31]!==h||e[32]!==f||e[33]!==o?(A=s.passkey&&f!==null&&f.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"ud-passkeys-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:o("name")},void 0,!1),(0,t.jsxDEV)(F,{children:o("created")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:f.map(R=>{let T=H(R.id);return(0,t.jsxDEV)(B,{"data-testid":`ud-passkey-${T}`,children:[(0,t.jsxDEV)(U,{children:H(R.name)||T},void 0,!1),(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(R.createdAt)},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`ud-delete-passkey-${T}`,disabled:i,onClick:a(()=>{h(T)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")},void 0,!1)},void 0,!1)]},T,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=i,e[30]=s.passkey,e[31]=h,e[32]=f,e[33]=o,e[34]=A):A=e[34];let r;return e[35]!==x||e[36]!==v||e[37]!==n||e[38]!==A?(r=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[x,v,n,A]},void 0,!0),e[35]=x,e[36]=v,e[37]=n,e[38]=A,e[39]=r):r=e[39],r},"UserSecurityPanel"),Se=/(?:at|expires)$/iu,Fe=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),Ue=a((w,e)=>typeof e=="number"&&Se.test(w)?Q(e):H(e),"formatField"),Re=a(({capabilities:w,onChanged:e,onClose:i,user:s})=>{let c=$(),d=M(),u=s.banned===!0,[l,o]=(0,m.useState)(null),[f,k]=(0,m.useState)(!1),[I,C]=(0,m.useState)(0),[b,N]=(0,m.useState)(typeof s.role=="string"?s.role:""),[y,h]=(0,m.useState)(""),[p,x]=(0,m.useState)(""),[v,n]=(0,m.useState)(""),[A,r]=(0,m.useState)(null),[R,T]=(0,m.useState)(!1),P=a((g,L)=>{O((async()=>{k(!0),o(null);try{let J=await g();L?.refresh!==!1&&(C(ye=>ye+1),e()),L?.onResult?.(J)}catch(J){o(Z(J))}finally{k(!1)}})())},"runAction"),ie=a(g=>{N(g.target.value)},"onRoleInputChange"),de=a(g=>{h(g.target.value)},"onBanReasonChange"),oe=a(g=>{x(g.target.value)},"onBanDaysChange"),ne=a(g=>{n(g.target.value)},"onNewPasswordChange"),re=a(()=>{let g=b.trim();g!==""&&P(async()=>{await c.setAuthUserRole({role:g,userId:s.id})})},"onSetRole"),ce=a(()=>{let g=Number.parseInt(p,10),L=Number.isFinite(g)&&g>0?g*86400:void 0;P(async()=>{await c.banAuthUser({expiresInSeconds:L,reason:y.trim()===""?void 0:y.trim(),userId:s.id})})},"onBan"),ue=a(()=>{P(async()=>{await c.unbanAuthUser({userId:s.id})})},"onUnban"),fe=a(()=>{P(async()=>{await c.setAuthUserPassword({newPassword:v,userId:s.id}),n("")})},"onSetPassword"),ve=a(()=>{P(()=>c.impersonateAuthUser({userId:s.id}),{onResult:a(g=>{r(g.token)},"onResult"),refresh:!1})},"onImpersonate"),me=a(()=>{P(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"onRevokeAll"),he=a(()=>{P(async()=>{await c.removeAuthUser({userId:s.id}),i()})},"onDelete"),pe=a(()=>{T(!0)},"onConfirmDelete"),xe=a(()=>{T(!1)},"onCancelDelete"),be=Object.entries(s).filter(([g])=>!Fe.has(g));return(0,t.jsxDEV)(X,{label:d("User details"),onClose:i,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id},void 0,!1),(0,t.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsxDEV)(E,{variant:"secondary",children:s.role},void 0,!1),u?(0,t.jsxDEV)(E,{variant:"destructive",children:d("Banned")},void 0,!1):(0,t.jsxDEV)(E,{variant:"outline",children:d("Active")},void 0,!1),s.emailVerified===!0?(0,t.jsxDEV)(E,{variant:"secondary",children:d("verified")},void 0,!1):(0,t.jsxDEV)(E,{variant:"outline",children:d("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-close",onClick:i,size:"sm",type:"button",variant:"ghost",children:d("Close")},void 0,!1)]},void 0,!0),l!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:l},void 0,!1),w.admin&&(0,t.jsxDEV)(V,{className:"gap-0 py-0",children:[(0,t.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Actions")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(j,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-role",children:d("Role")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-role-input",id:"ud-role",onChange:ie,value:b},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-set-role",disabled:f||b.trim()==="",onClick:re,size:"sm",type:"button",variant:"outline",children:d("Set role")},void 0,!1)]},void 0,!0),u?(0,t.jsxDEV)(S,{"data-testid":"ud-unban",disabled:f,onClick:ue,size:"sm",type:"button",variant:"outline",children:d("Unban")},void 0,!1):(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-ban-reason",children:d("Ban reason (optional)")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:de,value:y},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-ban-days",children:d("Days")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:oe,type:"number",value:p},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-ban",disabled:f,onClick:ce,size:"sm",type:"button",variant:"destructive",children:d("Ban user")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-password",children:d("New password")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-password",id:"ud-password",onChange:ne,type:"password",value:v},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-set-password",disabled:f||v==="",onClick:fe,size:"sm",type:"button",variant:"outline",children:d("Set password")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxDEV)(S,{"data-testid":"ud-impersonate",disabled:f,onClick:ve,size:"sm",type:"button",variant:"outline",children:d("Impersonate")},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"ud-revoke-all",disabled:f,onClick:me,size:"sm",type:"button",variant:"outline",children:d("Revoke all sessions")},void 0,!1),R?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(S,{"data-testid":"ud-delete-confirm",disabled:f,onClick:he,size:"sm",type:"button",variant:"destructive",children:d("Confirm delete")},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"ud-delete-cancel",onClick:xe,size:"sm",type:"button",variant:"ghost",children:d("Cancel")},void 0,!1)]},void 0,!0):(0,t.jsxDEV)(S,{"data-testid":"ud-delete",disabled:f,onClick:pe,size:"sm",type:"button",variant:"destructive",children:d("Delete user")},void 0,!1)]},void 0,!0),A!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-token",children:d("Impersonation token")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(Ce,{busy:f,runAction:P,userId:s.id,version:I},void 0,!1),w.accounts&&(0,t.jsxDEV)(Ae,{busy:f,runAction:P,userId:s.id,version:I},void 0,!1),(w.twoFactor||w.passkey)&&(0,t.jsxDEV)(Ie,{busy:f,capabilities:w,runAction:P,userId:s.id,version:I},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Fields")},void 0,!1),(0,t.jsxDEV)("dl",{className:"flex flex-col",children:be.map(([g,L])=>(0,t.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:g},void 0,!1),(0,t.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:Ue(g,L)},void 0,!1)]},g,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),De=50,We=a(({pageSize:w=De}={})=>{let e=$(),i=M(),[s,c]=(0,m.useState)(""),[d,u]=(0,m.useState)(""),l=se(s),[o,f]=(0,m.useState)(null),[k,I]=(0,m.useState)(!1),{capabilities:C}=le(),b=l.trim(),N=d.trim(),y=te(["lunora-auth-users",b,N,w],()=>e.listAuthUsers({filterField:N===""?void 0:"role",filterValue:N===""?void 0:N,limit:w,search:b===""?void 0:b}),{keepPreviousData:!0}),h=y.data?.rows??null,p=y.error,x=a(()=>{y.refetch()},"reloadUsers");ae(()=>{y.refetch()},!0);let v=o===null?null:h?.find(n=>n.id===o)??null;return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(D,{"aria-label":i("Search users"),className:"w-56","data-testid":"us-search",onChange:a(n=>{c(n.target.value)},"onChange"),placeholder:i("Search by email or name\u2026"),value:s},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":i("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:a(n=>{u(n.target.value)},"onChange"),placeholder:i("Filter by role"),value:d},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"us-new",onClick:a(()=>{I(!0)},"onClick"),size:"sm",type:"button",children:i("New user")},void 0,!1)]},void 0,!0),p!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:p},void 0,!1),h!==null&&h.length===0&&(0,t.jsxDEV)(ee,{description:i("Users who sign up to your app will appear here."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:i("No users.")},void 0,!1),h!==null&&h.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"us-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:i("id")},void 0,!1),(0,t.jsxDEV)(F,{children:i("email")},void 0,!1),(0,t.jsxDEV)(F,{children:i("name")},void 0,!1),(0,t.jsxDEV)(F,{children:i("role")},void 0,!1),(0,t.jsxDEV)(F,{children:i("status")},void 0,!1),(0,t.jsxDEV)(F,{children:i("verified")},void 0,!1),(0,t.jsxDEV)(F,{children:i("created")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":i("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:h.map(n=>(0,t.jsxDEV)(B,{"data-testid":`us-row-${n.id}`,children:[(0,t.jsxDEV)(U,{className:"font-mono text-xs",children:n.id},void 0,!1),(0,t.jsxDEV)(U,{children:n.email??""},void 0,!1),(0,t.jsxDEV)(U,{children:n.name??""},void 0,!1),(0,t.jsxDEV)(U,{children:typeof n.role=="string"&&n.role!==""?(0,t.jsxDEV)(E,{variant:"secondary",children:n.role},void 0,!1):""},void 0,!1),(0,t.jsxDEV)(U,{children:n.banned===!0?(0,t.jsxDEV)(E,{variant:"destructive",children:i("Banned")},void 0,!1):(0,t.jsxDEV)(E,{variant:"success",children:i("Active")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(U,{children:n.emailVerified===!0?(0,t.jsxDEV)(E,{variant:"success",children:i("yes")},void 0,!1):(0,t.jsxDEV)(E,{variant:"outline",children:i("no")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(n.createdAt)},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`us-manage-${n.id}`,onClick:a(()=>{f(n.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Manage")},void 0,!1)},void 0,!1)]},n.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),v!==null&&(0,t.jsxDEV)(Re,{capabilities:C,onChanged:x,onClose:a(()=>{f(null)},"onClose"),user:v},void 0,!1),k&&(0,t.jsxDEV)(ke,{onClose:a(()=>{I(!1)},"onClose"),onCreated:x},void 0,!1)]},void 0,!0)},"UsersPanel");export{We as UsersPanel};