@lunora/studio 1.0.0-alpha.157 → 1.0.0-alpha.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1 -1
- package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
- package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_shared/{DataBrowser-FiF2tNdq.mjs → DataBrowser-DIbS5LdO.mjs} +1 -1
- package/dist/packem_shared/wire-codec-Bk4XZGE4.mjs +1 -0
- package/dist/standalone/{chunk-YVNA6TPB.js → chunk-24WQBQWW.js} +1 -1
- package/dist/standalone/{chunk-Y7BODRFB.js → chunk-2XRSS2M6.js} +1 -1
- package/dist/standalone/chunk-3LTNH237.js +15 -0
- package/dist/standalone/{chunk-WO3CKCCK.js → chunk-5EBAAJ4D.js} +1 -1
- package/dist/standalone/{chunk-UAA6K2G3.js → chunk-5QKJ5G6Z.js} +1 -1
- package/dist/standalone/{chunk-7SPAXZ55.js → chunk-5QTPE32B.js} +1 -1
- package/dist/standalone/{chunk-MMYETC7K.js → chunk-5TB4AS52.js} +1 -1
- package/dist/standalone/{chunk-J2REGA6E.js → chunk-6L4BGYXK.js} +1 -1
- package/dist/standalone/{chunk-YMWPOBTZ.js → chunk-6MSV6AGL.js} +1 -1
- package/dist/standalone/{chunk-JXZBR6KQ.js → chunk-7DJSJJBN.js} +1 -1
- package/dist/standalone/{chunk-RBUZXGW4.js → chunk-7NLTT26I.js} +1 -1
- package/dist/standalone/{chunk-CNBQXYLI.js → chunk-AE7ASECR.js} +1 -1
- package/dist/standalone/{chunk-M2KEQODB.js → chunk-AOOJS3RO.js} +1 -1
- package/dist/standalone/{chunk-7SA3C6AD.js → chunk-B7XC7OEM.js} +1 -1
- package/dist/standalone/chunk-BCBNKE7J.js +11 -0
- package/dist/standalone/{chunk-KHIJLXVN.js → chunk-CAKOSEB7.js} +1 -1
- package/dist/standalone/{chunk-57JVL7N6.js → chunk-ESR2SZ36.js} +1 -1
- package/dist/standalone/{chunk-X6XVQUHD.js → chunk-EXTJNNOY.js} +2 -2
- package/dist/standalone/{chunk-FAIPFZHS.js → chunk-FS7BPB4J.js} +1 -1
- package/dist/standalone/{chunk-2GUY4BYT.js → chunk-FZ4DKTWL.js} +1 -1
- package/dist/standalone/{chunk-Y4S6PSQJ.js → chunk-FZJD2AW6.js} +1 -1
- package/dist/standalone/{chunk-Q2XPCZNR.js → chunk-G57SBM72.js} +1 -1
- package/dist/standalone/{chunk-T3NZUPJT.js → chunk-H3SID7AN.js} +1 -1
- package/dist/standalone/{chunk-MAIRKGBC.js → chunk-HF5NNUYU.js} +1 -1
- package/dist/standalone/{chunk-BHRODRCE.js → chunk-HQTWP46Z.js} +1 -1
- package/dist/standalone/{chunk-PEC7L2M2.js → chunk-I2LRZGW7.js} +1 -1
- package/dist/standalone/{chunk-BI3WYQT4.js → chunk-I5FUZTVN.js} +1 -1
- package/dist/standalone/{chunk-BF4ANX7Y.js → chunk-IJHCFEYG.js} +1 -1
- package/dist/standalone/{chunk-O3OLYWXH.js → chunk-JHP7UDU3.js} +1 -1
- package/dist/standalone/{chunk-BNMKGBRO.js → chunk-KAJ53T5A.js} +1 -1
- package/dist/standalone/{chunk-VVIGMZZI.js → chunk-KMXRGAJN.js} +2 -2
- package/dist/standalone/{chunk-VHFBBAB3.js → chunk-LFGT7SHV.js} +1 -1
- package/dist/standalone/{chunk-3BOMO6FO.js → chunk-LKDXWSK3.js} +1 -1
- package/dist/standalone/{chunk-SZD6O7K2.js → chunk-LW4TJA4W.js} +1 -1
- package/dist/standalone/{chunk-4YPDEUPJ.js → chunk-M2R7QUP7.js} +1 -1
- package/dist/standalone/{chunk-IBCJ44SS.js → chunk-N2KEHJFT.js} +1 -1
- package/dist/standalone/{chunk-ENE4N6ZV.js → chunk-N4T2MINL.js} +1 -1
- package/dist/standalone/{chunk-FFSMP4KF.js → chunk-NT2U7JJI.js} +1 -1
- package/dist/standalone/{chunk-LPTEXH2G.js → chunk-NZIKF3FN.js} +1 -1
- package/dist/standalone/{chunk-NJSJI7SX.js → chunk-OBRWA7NJ.js} +1 -1
- package/dist/standalone/{chunk-ZUFIKCHC.js → chunk-PDTRYBNK.js} +1 -1
- package/dist/standalone/{chunk-7VYWS2FY.js → chunk-PO6QDP32.js} +1 -1
- package/dist/standalone/{chunk-6BI6AL3F.js → chunk-PQTHMQHP.js} +1 -1
- package/dist/standalone/{chunk-CJMZSHN3.js → chunk-Q3WZBID4.js} +1 -1
- package/dist/standalone/{chunk-KJGAW36O.js → chunk-QJ7AIK4F.js} +1 -1
- package/dist/standalone/{chunk-HMRLSE2Y.js → chunk-R3Y3RWZE.js} +1 -1
- package/dist/standalone/{chunk-PBMIQYWZ.js → chunk-RCL6OSSI.js} +1 -1
- package/dist/standalone/{chunk-73S4ZMSC.js → chunk-RJ52BWWR.js} +1 -1
- package/dist/standalone/{chunk-HETDJ4ZA.js → chunk-S2DMXDVV.js} +1 -1
- package/dist/standalone/{chunk-D722YMVG.js → chunk-T7PDUIXF.js} +1 -1
- package/dist/standalone/{chunk-L2PBRJ7G.js → chunk-TC7TSIPJ.js} +1 -1
- package/dist/standalone/{chunk-B7IXABRK.js → chunk-UCDF4BKD.js} +1 -1
- package/dist/standalone/{chunk-JXCWNZ7T.js → chunk-UK32ZCIK.js} +1 -1
- package/dist/standalone/{chunk-3SCT7QG7.js → chunk-UVB3R7NI.js} +1 -1
- package/dist/standalone/{chunk-EFXL7F5E.js → chunk-VDTEOMR4.js} +1 -1
- package/dist/standalone/{chunk-CXNY45A3.js → chunk-XD6I4DFM.js} +1 -1
- package/dist/standalone/{chunk-M55KXW5Z.js → chunk-YAGZIUBA.js} +1 -1
- package/dist/standalone/{chunk-KEXRHVLN.js → chunk-YAUA3WS7.js} +1 -1
- package/dist/standalone/chunk-YOB2X3FZ.js +1 -0
- package/dist/standalone/{chunk-M5ITKPZN.js → chunk-YTWAOTZD.js} +1 -1
- package/dist/standalone/{chunk-ODULTMQE.js → chunk-YVYWT5AX.js} +1 -1
- package/dist/standalone/{chunk-BFPZHZ5M.js → chunk-YYIWZFCC.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +6 -6
- package/dist/packem_shared/wire-codec-DnslZGxC.mjs +0 -1
- package/dist/standalone/chunk-ET6VU4YM.js +0 -11
- package/dist/standalone/chunk-FMRAZ6MD.js +0 -15
- package/dist/standalone/chunk-XAG625PN.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as yt}from"./chunk-EA2JKR5D.js";import{b as Nt}from"./chunk-CXNY45A3.js";import{a as ne}from"./chunk-TIUMFAN2.js";import{a as St}from"./chunk-XZMOZFE6.js";import{a as zt}from"./chunk-IMOHEGMV.js";import{a as Ct}from"./chunk-66UGPQVC.js";import{P as Z}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as L}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{b as ue}from"./chunk-6BI6AL3F.js";import{f as re}from"./chunk-ET6VU4YM.js";import"./chunk-FSRSK4LY.js";import"./chunk-FMRAZ6MD.js";import{a as ce}from"./chunk-FKVZRPV5.js";import{a as ft,b as pt,c as vt,d as Ze,e as se,f as me}from"./chunk-HEAQVSNS.js";import{a as ht,e as bt}from"./chunk-WUWBZPUK.js";import{d as q,h as xt,n as S,o as wt,r as kt}from"./chunk-FODLDLE2.js";import{a as c,d as gt,e as Rt,f as $t,g as Ft}from"./chunk-YKXDMIHQ.js";var U=gt($t(),1);var j=gt(Rt(),1);var a=gt(Ft(),1);var Ot=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Dt"),Et=c(t=>{let e=Ot(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Mt"),Tt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"St"),X=c(t=>{let e=(0,U.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(zt,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"G"),de=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:s})=>{let m=q();return(0,a.jsxs)(St,{label:s,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:m("Cancel")}),(0,a.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?m("Saving\u2026"):l})]})]})},"ae"),Dt=c(t=>{let e=(0,U.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=re(),l=q(),{busy:n,error:s,run:m}=ne(),b;e[0]!==i?(b=i?S(i.name):"",e[0]=i,e[1]=b):b=e[1];let[u,g]=(0,j.useState)(b),p;e[2]!==i?(p=i?S(i.slug):"",e[2]=i,e[3]=p):p=e[3];let[f,y]=(0,j.useState)(p),k;e[4]!==i?(k=i?S(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[v,I]=(0,j.useState)(k),[C,z]=(0,j.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Tt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[w,N]=(0,j.useState)(x),O;e[9]!==o||e[10]!==v||e[11]!==w||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==m||e[19]!==f?(O=c(()=>{m(async()=>{let F=w.trim()===""?void 0:Ot(w);r==="create"?await o.createAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:f.trim()===""?void 0:f.trim()}):await o.updateAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim()===""?void 0:u.trim(),organizationId:S(i?.id),slug:f.trim()===""?void 0:f.trim()}),h(),d()})},"_"),e[9]=o,e[10]=v,e[11]=w,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=m,e[19]=f,e[20]=O):O=e[20];let A=O,D;e[21]!==r||e[22]!==u?(D=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let M;e[27]!==r||e[28]!==l?(M=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=M):M=e[29];let P;e[30]!==l?(P=l("name"),e[30]=l,e[31]=P):P=e[31];let Q;e[32]===Symbol.for("react.memo_cache_sentinel")?(Q=c(F=>{g(F.target.value)},"q"),e[32]=Q):Q=e[32];let B;e[33]!==u?(B=(0,a.jsx)(Z,{"data-testid":"org-form-name",id:"org-form-name",onChange:Q,value:u}),e[33]=u,e[34]=B):B=e[34];let E;e[35]!==B||e[36]!==P?(E=(0,a.jsx)(X,{htmlFor:"org-form-name",label:P,children:B}),e[35]=B,e[36]=P,e[37]=E):E=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let Y;e[40]===Symbol.for("react.memo_cache_sentinel")?(Y=c(F=>{y(F.target.value)},"K"),e[40]=Y):Y=e[40];let R;e[41]!==f?(R=(0,a.jsx)(Z,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:Y,value:f}),e[41]=f,e[42]=R):R=e[42];let $;e[43]!==J||e[44]!==R?($=(0,a.jsx)(X,{htmlFor:"org-form-slug",label:J,children:R}),e[43]=J,e[44]=R,e[45]=$):$=e[45];let K;e[46]!==l?(K=l("Logo URL (optional)"),e[46]=l,e[47]=K):K=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=c(F=>{I(F.target.value)},"ne"),e[48]=ie):ie=e[48];let H;e[49]!==v?(H=(0,a.jsx)(Z,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:v}),e[49]=v,e[50]=H):H=e[50];let ee;e[51]!==K||e[52]!==H?(ee=(0,a.jsx)(X,{htmlFor:"org-form-logo",label:K,children:H}),e[51]=K,e[52]=H,e[53]=ee):ee=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(Z,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(F=>{z(F.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=c(F=>{N(F.target.value)},"le"),e[60]=oe):oe=e[60];let V;e[61]!==w?(V=(0,a.jsx)(yt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:w}),e[61]=w,e[62]=V):V=e[62];let _;e[63]!==te||e[64]!==V?(_=(0,a.jsx)(X,{htmlFor:"org-form-metadata",label:te,children:V}),e[63]=te,e[64]=V,e[65]=_):_=e[65];let ae;return e[66]!==n||e[67]!==s||e[68]!==d||e[69]!==A||e[70]!==E||e[71]!==$||e[72]!==ee||e[73]!==W||e[74]!==_||e[75]!==D||e[76]!==T||e[77]!==M?(ae=(0,a.jsxs)(de,{busy:n,canSubmit:D,error:s,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:M,children:[E,$,ee,W,_]}),e[66]=n,e[67]=s,e[68]=d,e[69]=A,e[70]=E,e[71]=$,e[72]=ee,e[73]=W,e[74]=_,e[75]=D,e[76]=T,e[77]=M,e[78]=ae):ae=e[78],ae},"ht"),Lt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==s||e[6]!==m?(p=c(()=>{s(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:m.trim()}),d(),r()})},"b"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=s,e[6]=m,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Add member"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:z,value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-add-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-add-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Rt"),jt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==m||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==s?(p=c(()=>{s(async()=>{await i.inviteAuthOrgMember({email:m.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"b"),e[0]=i,e[1]=m,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=s,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Send invitation"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:z,type:"email",value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-invite-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-invite-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Ft"),Pt=c(t=>{let e=(0,U.c)(32),{member:r,onClose:d,onDone:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),m;e[0]!==r.role?(m=c(()=>S(r.role),"m"),e[0]=r.role,e[1]=m):m=e[1];let[b,u]=(0,j.useState)(m),g;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==b||e[7]!==s?(g=c(()=>{s(async()=>{await i.setAuthOrgMemberRole({memberId:S(r.id),role:b.trim()}),h(),d()})},"f"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=b,e[7]=s,e[8]=g):g=e[8];let p=g,f;e[9]!==b?(f=b.trim(),e[9]=b,e[10]=f):f=e[10];let y=f!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("Change member role"),e[13]=o,e[14]=v):v=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let z;e[18]!==b?(z=(0,a.jsx)(Z,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:b}),e[18]=b,e[19]=z):z=e[19];let x;e[20]!==I||e[21]!==z?(x=(0,a.jsx)(X,{htmlFor:"org-member-role-value",label:I,children:z}),e[20]=I,e[21]=z,e[22]=x):x=e[22];let w;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==p||e[27]!==x||e[28]!==y||e[29]!==k||e[30]!==v?(w=(0,a.jsx)(de,{busy:l,canSubmit:y,error:n,onClose:d,onSubmit:p,submitLabel:k,testId:"org-member-role",title:v,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=p,e[27]=x,e[28]=y,e[29]=k,e[30]=v,e[31]=w):w=e[31],w},"Et"),At=c(t=>{let e=(0,U.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.name):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==l||e[3]!==r||e[4]!==g||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==b||e[9]!==o?.id?(f=c(()=>{b(async()=>{await(r==="create"?l.createAuthOrgTeam({name:g.trim(),organizationId:i}):l.updateAuthOrgTeam({name:g.trim(),teamId:S(o?.id)})),h(),d()})},"h"),e[2]=l,e[3]=r,e[4]=g,e[5]=d,e[6]=h,e[7]=i,e[8]=b,e[9]=o?.id,e[10]=f):f=e[10];let y=f,k;e[11]!==g?(k=g.trim(),e[11]=g,e[12]=k):k=e[12];let v=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let z;e[19]!==n?(z=n("name"),e[19]=n,e[20]=z):z=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(A=>{p(A.target.value)},"x"),e[21]=x):x=e[21];let w;e[22]!==g?(w=(0,a.jsx)(Z,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:g}),e[22]=g,e[23]=w):w=e[23];let N;e[24]!==z||e[25]!==w?(N=(0,a.jsx)(X,{htmlFor:"org-team-form-name",label:z,children:w}),e[24]=z,e[25]=w,e[26]=N):N=e[26];let O;return e[27]!==s||e[28]!==m||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==v||e[33]!==I||e[34]!==C?(O=(0,a.jsx)(de,{busy:s,canSubmit:v,error:m,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=s,e[28]=m,e[29]=d,e[30]=y,e[31]=N,e[32]=v,e[33]=I,e[34]=C,e[35]=O):O=e[35],O},"bt"),Bt=c(t=>{let e=(0,U.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==s||e[4]!==h||e[5]!==m?(u=c(()=>{s(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:m.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=s,e[4]=h,e[5]=m,e[6]=u):u=e[6];let g=u,p;e[7]!==m?(p=m.trim(),e[7]=m,e[8]=p):p=e[8];let f=p!=="",y;e[9]!==o?(y=o("Add member"),e[9]=o,e[10]=y):y=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("User id"),e[13]=o,e[14]=v):v=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(w=>{b(w.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==m?(C=(0,a.jsx)(Z,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:m}),e[16]=m,e[17]=C):C=e[17];let z;e[18]!==v||e[19]!==C?(z=(0,a.jsx)(X,{htmlFor:"org-team-add-member-user",label:v,children:C}),e[18]=v,e[19]=C,e[20]=z):z=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==g||e[25]!==f||e[26]!==y||e[27]!==k||e[28]!==z?(x=(0,a.jsx)(de,{busy:l,canSubmit:f,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:k,children:z}),e[21]=l,e[22]=n,e[23]=r,e[24]=g,e[25]=f,e[26]=y,e[27]=k,e[28]=z,e[29]=x):x=e[29],x},"jt"),_t=c(t=>{let e=(0,U.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.role):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==r||e[3]!==o?.permission?(f=r==="edit"?Tt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=f):f=e[4];let[y,k]=(0,j.useState)(f),v;e[5]!==l||e[6]!==r||e[7]!==g||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==y||e[12]!==o?.id||e[13]!==b?(v=c(()=>{b(async()=>{let M=Et(y);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:M,role:g.trim()}):l.updateAuthOrgRole({permission:M,roleId:S(o?.id)})),h(),d()})},"p"),e[5]=l,e[6]=r,e[7]=g,e[8]=d,e[9]=h,e[10]=i,e[11]=y,e[12]=o?.id,e[13]=b,e[14]=v):v=e[14];let I=v,C;e[15]!==r||e[16]!==g||e[17]!==y?(C=y.trim()!==""&&(r==="edit"||g.trim()!==""),e[15]=r,e[16]=g,e[17]=y,e[18]=C):C=e[18];let z;e[19]!==r||e[20]!==n?(z=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=z):z=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let w;e[25]!==r||e[26]!==g||e[27]!==n?(w=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(Z,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c(M=>{p(M.target.value)},"onChange"),value:g})}),e[25]=r,e[26]=g,e[27]=n,e[28]=w):w=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{k(M.target.value)},"_"),e[31]=O):O=e[31];let A;e[32]!==y?(A=(0,a.jsx)(yt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:O,value:y}),e[32]=y,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,a.jsx)(X,{htmlFor:"org-role-form-permission",label:N,children:A}),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==s||e[38]!==m||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==C||e[43]!==z||e[44]!==x||e[45]!==w?(T=(0,a.jsxs)(de,{busy:s,canSubmit:C,error:m,onClose:d,onSubmit:I,submitLabel:z,testId:"org-role-form",title:x,children:[w,D]}),e[37]=s,e[38]=m,e[39]=d,e[40]=I,e[41]=D,e[42]=C,e[43]=z,e[44]=x,e[45]=w,e[46]=T):T=e[46],T},"pt"),Mt=c(t=>{let e=(0,U.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==b?(u=c(()=>{b(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=b,e[4]=u):u=e[4];let g=u,p;e[5]!==n?(p=n("Delete"),e[5]=n,e[6]=p):p=e[6];let f;e[7]!==d?(f=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let y;return e[9]!==s||e[10]!==m||e[11]!==h||e[12]!==g||e[13]!==p||e[14]!==f||e[15]!==o||e[16]!==l?(y=(0,a.jsx)(de,{busy:s,canSubmit:!0,destructive:!0,error:m,onClose:h,onSubmit:g,submitLabel:p,testId:o,title:l,children:f}),e[9]=s,e[10]=m,e[11]=h,e[12]=g,e[13]=p,e[14]=f,e[15]=o,e[16]=l,e[17]=y):y=e[17],y},"zt"),Ge=c(t=>{let e=(0,U.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let s;e[7]!==d?(s=(0,a.jsx)(bt,{className:"px-0",children:d}),e[7]=d,e[8]=s):s=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==i?(m=(0,a.jsxs)(ht,{className:"overflow-hidden py-0","data-testid":i,children:[n,s]}),e[9]=n,e[10]=s,e[11]=i,e[12]=m):m=e[12],m},"Ve"),He=c(t=>{let e=(0,U.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=q(),l;e[0]!==r?(l=r.map(Jt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==n?(s=(0,a.jsx)(se,{"aria-label":n}),e[4]=n,e[5]=s):s=e[5];let m;e[6]!==l||e[7]!==s?(m=(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[l,s]})}),e[6]=l,e[7]=s,e[8]=m):m=e[8];let b;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let p;e[14]!==r||e[15]!==d||e[16]!==h?(p=c((f,y)=>{let k=S(f.id),v=k===""?`index-${y.toString()}`:k;return(0,a.jsxs)(Ze,{"data-testid":`${h}-${v}`,children:[r.map(I=>(0,a.jsx)(me,{className:I.className,children:I.render(f)},I.head)),(0,a.jsx)(me,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(f)})})]},v)},"b"),e[14]=r,e[15]=d,e[16]=h,e[17]=p):p=e[17],b=i.map(p),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=b}else b=e[13];let u;e[18]!==b?(u=(0,a.jsx)(vt,{children:b}),e[18]=b,e[19]=u):u=e[19];let g;return e[20]!==m||e[21]!==u?(g=(0,a.jsxs)(ft,{children:[m,u]}),e[20]=m,e[21]=u,e[22]=g):g=e[22],g},"We");function Jt(t){return(0,a.jsx)(se,{children:t.head},t.head)}c(Jt,"Lt");var Ut=c(t=>{let e=(0,U.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let s;e[2]!==l?(s=l("Add member"),e[2]=l,e[3]=s):s=e[3];let m;e[4]!==n||e[5]!==s?(m=(0,a.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:s}),e[4]=n,e[5]=s,e[6]=m):m=e[6];let b;e[7]!==o?(b=c(()=>{o({kind:"invite-member"})},"g"),e[7]=o,e[8]=b):b=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let g;e[11]!==b||e[12]!==u?(g=(0,a.jsx)(L,{"data-testid":"org-open-invite-member",onClick:b,size:"xs",type:"button",variant:"outline",children:u}),e[11]=b,e[12]=u,e[13]=g):g=e[13];let p;e[14]!==m||e[15]!==g?(p=(0,a.jsxs)(a.Fragment,{children:[m,g]}),e[14]=m,e[15]=g,e[16]=p):p=e[16];let f;e[17]!==l?(f=l("Members"),e[17]=l,e[18]=f):f=e[18];let y;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(y=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(v=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-member-role-${S(v.id)}`,onClick:c(()=>{o({kind:"member-role",member:v})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(L,{"data-testid":`org-remove-member-${S(v.id)}`,disabled:r,onClick:c(()=>{d(S(v.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=y):y=e[25];let k;return e[26]!==p||e[27]!==f||e[28]!==y?(k=(0,a.jsx)(Ge,{action:p,heading:f,testId:"org-members",children:y}),e[26]=p,e[27]=f,e[28]=y,e[29]=k):k=e[29],k},"Pt"),qt=c(t=>{let e=(0,U.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=q(),s;e[0]!==d?(s=c(()=>{d({kind:"team-create"})},"a"),e[0]=d,e[1]=s):s=e[1];let m;e[2]!==n?(m=n("New team"),e[2]=n,e[3]=m):m=e[3];let b;e[4]!==s||e[5]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-create-team",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[4]=s,e[5]=m,e[6]=b):b=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let g;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"aria-pressed":i===S(f.id),"data-testid":`org-team-select-${S(f.id)}`,onClick:c(()=>{h(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(L,{"data-testid":`org-team-rename-${S(f.id)}`,onClick:c(()=>{d({kind:"team-rename",team:f})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(L,{"data-testid":`org-team-delete-${S(f.id)}`,onClick:c(()=>{r(f)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=g):g=e[16];let p;return e[17]!==b||e[18]!==u||e[19]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-teams",children:g}),e[17]=b,e[18]=u,e[19]=g,e[20]=p):p=e[20],p},"Bt"),Kt=c(t=>{let e=(0,U.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=q(),s;e[0]!==h||e[1]!==i?(s=c(()=>{h({kind:"team-add-member",teamId:i})},"a"),e[0]=h,e[1]=i,e[2]=s):s=e[2];let m;e[3]!==n?(m=n("Add member"),e[3]=n,e[4]=m):m=e[4];let b;e[5]!==s||e[6]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[5]=s,e[6]=m,e[7]=b):b=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let g;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsx)(L,{"data-testid":`org-team-remove-member-${S(f.id)}`,disabled:r,onClick:c(()=>{d(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=g):g=e[15];let p;return e[16]!==b||e[17]!==u||e[18]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-team-members",children:g}),e[16]=b,e[17]=u,e[18]=g,e[19]=p):p=e[19],p},"Qt"),Qt=c(t=>{let e=(0,U.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"o"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==l||e[5]!==n?(s=(0,a.jsx)(L,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=s):s=e[6];let m;e[7]!==o?(m=o("Roles"),e[7]=o,e[8]=m):m=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(b=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-role-edit-${S(g.id)}`,onClick:c(()=>{d({kind:"role-edit",role:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(L,{"data-testid":`org-role-delete-${S(g.id)}`,onClick:c(()=>{r(S(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=b):b=e[14];let u;return e[15]!==s||e[16]!==m||e[17]!==b?(u=(0,a.jsx)(Ge,{action:s,heading:m,testId:"org-roles",children:b}),e[15]=s,e[16]=m,e[17]=b,e[18]=u):u=e[18],u},"Jt"),Xt=c(t=>{let e=(0,U.c)(199),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=re(),o=q(),[l,n]=(0,j.useState)(null),[s,m]=(0,j.useState)(null),[b,u]=(0,j.useState)(!1),[g,p]=(0,j.useState)(null),f;e[0]!==r?(f=["lunora-auth-org-members",r],e[0]=r,e[1]=f):f=e[1];let y;e[2]!==i||e[3]!==r?(y=c(()=>i.listAuthOrgMembers({limit:200,organizationId:r}),"v"),e[2]=i,e[3]=r,e[4]=y):y=e[4];let k=ue(f,y),v;e[5]!==r?(v=["lunora-auth-org-invitations",r],e[5]=r,e[6]=v):v=e[6];let I;e[7]!==i||e[8]!==r?(I=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"C"),e[7]=i,e[8]=r,e[9]=I):I=e[9];let C=ue(v,I),z;e[10]!==r?(z=["lunora-auth-org-teams",r],e[10]=r,e[11]=z):z=e[11];let x;e[12]!==i||e[13]!==r?(x=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"x"),e[12]=i,e[13]=r,e[14]=x):x=e[14];let w;e[15]!==h?(w={enabled:h},e[15]=h,e[16]=w):w=e[16];let N=ue(z,x,w),O;e[17]!==r?(O=["lunora-auth-org-roles",r],e[17]=r,e[18]=O):O=e[18];let A;e[19]!==i||e[20]!==r?(A=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"N"),e[19]=i,e[20]=r,e[21]=A):A=e[21];let D;e[22]!==d?(D={enabled:d},e[22]=d,e[23]=D):D=e[23];let T=ue(O,A,D),M;e[24]!==s?(M=["lunora-auth-org-team-members",s],e[24]=s,e[25]=M):M=e[25];let P;e[26]!==i||e[27]!==s?(P=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:s??""}),"P"),e[26]=i,e[27]=s,e[28]=P):P=e[28];let Q=s!==null,B;e[29]!==Q?(B={enabled:Q},e[29]=Q,e[30]=B):B=e[30];let E=ue(M,P,B),J;e[31]!==k.data?.rows?(J=k.data?.rows??[],e[31]=k.data?.rows,e[32]=J):J=e[32];let Y=J,R;e[33]!==C.data?.rows?(R=C.data?.rows??[],e[33]=C.data?.rows,e[34]=R):R=e[34];let $=R,K;e[35]!==N.data?.rows?(K=N.data?.rows??[],e[35]=N.data?.rows,e[36]=K):K=e[36];let ie=K,H;e[37]!==T.data?.rows?(H=T.data?.rows??[],e[37]=T.data?.rows,e[38]=H):H=e[38];let ee=H,W;e[39]!==s||e[40]!==E?(W=s===null?[]:E.data?.rows??[],e[39]=s,e[40]=E,e[41]=W):W=e[41];let te=W,oe=k.error??C.error??N.error??T.error??E.error,V;e[42]!==C||e[43]!==k||e[44]!==d||e[45]!==T||e[46]!==s||e[47]!==E||e[48]!==h||e[49]!==N?(V=c(()=>{k.refetch(),C.refetch(),h&&N.refetch(),d&&T.refetch(),s!==null&&E.refetch()},"Z"),e[42]=C,e[43]=k,e[44]=d,e[45]=T,e[46]=s,e[47]=E,e[48]=h,e[49]=N,e[50]=V):V=e[50];let _=V;Ct(_,!0);let ae;e[51]===Symbol.for("react.memo_cache_sentinel")?(ae=c(()=>{n(null)},"ie"),e[51]=ae):ae=e[51];let F=ae,We;e[52]!==_?(We=c(G=>{wt((async()=>{u(!0),p(null);try{await G(),_(),u(!1)}catch(nt){p(xt(nt)),u(!1)}})())},"Xe"),e[52]=_,e[53]=We):We=e[53];let le=We,Ve;e[54]!==i||e[55]!==o?(Ve=c(G=>{let nt=S(G.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:nt}),m(It=>It===nt?null:It)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"Ye"),e[54]=i,e[55]=o,e[56]=Ve):Ve=e[56];let it=Ve,ge;e[57]!==o?(ge=o("userId"),e[57]=o,e[58]=ge):ge=e[58];let he;e[59]!==ge?(he={head:ge,render:Yt},e[59]=ge,e[60]=he):he=e[60];let be;e[61]!==o?(be=o("role"),e[61]=o,e[62]=be):be=e[62];let fe;e[63]!==be?(fe={head:be,render:Zt},e[63]=be,e[64]=fe):fe=e[64];let et;e[65]!==he||e[66]!==fe?(et=[he,fe],e[65]=he,e[66]=fe,e[67]=et):et=e[67];let st=et,pe;e[68]!==o?(pe=o("email"),e[68]=o,e[69]=pe):pe=e[69];let ve;e[70]!==pe?(ve={head:pe,render:Gt},e[70]=pe,e[71]=ve):ve=e[71];let ye;e[72]!==o?(ye=o("role"),e[72]=o,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:Ht},e[74]=ye,e[75]=Ce):Ce=e[75];let Ie;e[76]!==o?(Ie=o("status"),e[76]=o,e[77]=Ie):Ie=e[77];let xe;e[78]!==Ie?(xe={head:Ie,render:Wt},e[78]=Ie,e[79]=xe):xe=e[79];let tt;e[80]!==ve||e[81]!==Ce||e[82]!==xe?(tt=[ve,Ce,xe],e[80]=ve,e[81]=Ce,e[82]=xe,e[83]=tt):tt=e[83];let mt=tt,we;e[84]!==o?(we=o("id"),e[84]=o,e[85]=we):we=e[85];let ke;e[86]!==we?(ke={className:"font-mono text-xs",head:we,render:Vt},e[86]=we,e[87]=ke):ke=e[87];let ze;e[88]!==o?(ze=o("name"),e[88]=o,e[89]=ze):ze=e[89];let Ne;e[90]!==ze?(Ne={head:ze,render:er},e[90]=ze,e[91]=Ne):Ne=e[91];let rt;e[92]!==ke||e[93]!==Ne?(rt=[ke,Ne],e[92]=ke,e[93]=Ne,e[94]=rt):rt=e[94];let dt=rt,Se;e[95]!==o?(Se=o("userId"),e[95]=o,e[96]=Se):Se=e[96];let ot;e[97]!==Se?(ot=[{head:Se,render:tr}],e[97]=Se,e[98]=ot):ot=e[98];let ct=ot,De;e[99]!==o?(De=o("role"),e[99]=o,e[100]=De):De=e[100];let Ae;e[101]!==De?(Ae={head:De,render:rr},e[101]=De,e[102]=Ae):Ae=e[102];let _e;e[103]!==o?(_e=o("Permission"),e[103]=o,e[104]=_e):_e=e[104];let Oe;e[105]!==_e?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:or},e[105]=_e,e[106]=Oe):Oe=e[106];let at;e[107]!==Ae||e[108]!==Oe?(at=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=at):at=e[109];let ut=at,Te;e[110]!==oe?(Te=oe!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe}),e[110]=oe,e[111]=Te):Te=e[111];let Me;e[112]!==g?(Me=g!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g}),e[112]=g,e[113]=Me):Me=e[113];let Re;e[114]!==i||e[115]!==le?(Re=c(G=>{le(()=>i.removeAuthOrgMember({memberId:G}))},"Te"),e[114]=i,e[115]=le,e[116]=Re):Re=e[116];let $e;e[117]!==b||e[118]!==st||e[119]!==Y||e[120]!==Re?($e=(0,a.jsx)(Ut,{actionBusy:b,memberColumns:st,members:Y,onDialog:n,onRemoveMember:Re}),e[117]=b,e[118]=st,e[119]=Y,e[120]=Re,e[121]=$e):$e=e[121];let Fe;e[122]!==b||e[123]!==i||e[124]!==mt||e[125]!==$||e[126]!==le||e[127]!==o?(Fe=$.length>0&&(0,a.jsx)(Ge,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(He,{columns:mt,rowActions:c(G=>(0,a.jsx)(L,{"data-testid":`org-cancel-invitation-${S(G.id)}`,disabled:b,onClick:c(()=>{le(()=>i.cancelAuthOrgInvitation({invitationId:S(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:$})}),e[122]=b,e[123]=i,e[124]=mt,e[125]=$,e[126]=le,e[127]=o,e[128]=Fe):Fe=e[128];let Ee;e[129]!==it||e[130]!==s||e[131]!==dt||e[132]!==ie||e[133]!==h?(Ee=h&&(0,a.jsx)(qt,{onConfirmDeleteTeam:it,onDialog:n,onSelectTeam:m,selectedTeam:s,teamColumns:dt,teams:ie}),e[129]=it,e[130]=s,e[131]=dt,e[132]=ie,e[133]=h,e[134]=Ee):Ee=e[134];let Le;e[135]!==b||e[136]!==i||e[137]!==le||e[138]!==s||e[139]!==ct||e[140]!==te||e[141]!==h?(Le=h&&s!==null&&(0,a.jsx)(Kt,{actionBusy:b,onDialog:n,onRemoveTeamMember:c(G=>{le(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:s,teamMemberColumns:ct,teamMembers:te}),e[135]=b,e[136]=i,e[137]=le,e[138]=s,e[139]=ct,e[140]=te,e[141]=h,e[142]=Le):Le=e[142];let je;e[143]!==i||e[144]!==ut||e[145]!==ee||e[146]!==d||e[147]!==o?(je=d&&(0,a.jsx)(Qt,{onConfirmDeleteRole:c(G=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:ut,roles:ee}),e[143]=i,e[144]=ut,e[145]=ee,e[146]=d,e[147]=o,e[148]=je):je=e[148];let Pe;e[149]!==l?.kind||e[150]!==r||e[151]!==_?(Pe=l?.kind==="add-member"&&(0,a.jsx)(Lt,{onClose:F,onDone:_,organizationId:r}),e[149]=l?.kind,e[150]=r,e[151]=_,e[152]=Pe):Pe=e[152];let Be;e[153]!==l?.kind||e[154]!==r||e[155]!==_?(Be=l?.kind==="invite-member"&&(0,a.jsx)(jt,{onClose:F,onDone:_,organizationId:r}),e[153]=l?.kind,e[154]=r,e[155]=_,e[156]=Be):Be=e[156];let Je;e[157]!==l||e[158]!==_?(Je=l?.kind==="member-role"&&(0,a.jsx)(Pt,{member:l.member,onClose:F,onDone:_}),e[157]=l,e[158]=_,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==_?(Ue=l?.kind==="team-create"&&(0,a.jsx)(At,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=_,e[163]=Ue):Ue=e[163];let qe;e[164]!==l||e[165]!==r||e[166]!==_?(qe=l?.kind==="team-rename"&&(0,a.jsx)(At,{mode:"edit",onClose:F,onDone:_,organizationId:r,team:l.team}),e[164]=l,e[165]=r,e[166]=_,e[167]=qe):qe=e[167];let Ke;e[168]!==l||e[169]!==_?(Ke=l?.kind==="team-add-member"&&(0,a.jsx)(Bt,{onClose:F,onDone:_,teamId:l.teamId}),e[168]=l,e[169]=_,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l?.kind||e[172]!==r||e[173]!==_?(Qe=l?.kind==="role-create"&&(0,a.jsx)(_t,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[171]=l?.kind,e[172]=r,e[173]=_,e[174]=Qe):Qe=e[174];let Xe;e[175]!==l||e[176]!==r||e[177]!==_?(Xe=l?.kind==="role-edit"&&(0,a.jsx)(_t,{mode:"edit",onClose:F,onDone:_,organizationId:r,role:l.role}),e[175]=l,e[176]=r,e[177]=_,e[178]=Xe):Xe=e[178];let Ye;e[179]!==l||e[180]!==_?(Ye=l?.kind==="confirm"&&(0,a.jsx)(Mt,{action:l.action,message:l.message,onClose:F,onDone:_,testId:l.testId,title:l.title}),e[179]=l,e[180]=_,e[181]=Ye):Ye=e[181];let lt;return e[182]!==Te||e[183]!==Me||e[184]!==$e||e[185]!==Fe||e[186]!==Ee||e[187]!==Le||e[188]!==je||e[189]!==Pe||e[190]!==Be||e[191]!==Je||e[192]!==Ue||e[193]!==qe||e[194]!==Ke||e[195]!==Qe||e[196]!==Xe||e[197]!==Ye?(lt=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Te,Me,$e,Fe,Ee,Le,je,Pe,Be,Je,Ue,qe,Ke,Qe,Xe,Ye]}),e[182]=Te,e[183]=Me,e[184]=$e,e[185]=Fe,e[186]=Ee,e[187]=Le,e[188]=je,e[189]=Pe,e[190]=Be,e[191]=Je,e[192]=Ue,e[193]=qe,e[194]=Ke,e[195]=Qe,e[196]=Xe,e[197]=Ye,e[198]=lt):lt=e[198],lt},"Ut");function Yt(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(Yt,"Ht");function Zt(t){return S(t.role)}c(Zt,"qt");function Gt(t){return S(t.email)}c(Gt,"Gt");function Ht(t){return S(t.role)}c(Ht,"Kt");function Wt(t){return S(t.status)}c(Wt,"Vt");function Vt(t){return S(t.id)}c(Vt,"Wt");function er(t){return S(t.name)}c(er,"Xt");function tr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(tr,"Yt");function rr(t){return S(t.role)}c(rr,"Zt");function or(t){return S(t.permission)}c(or,"el");var yr=c(()=>{let t=(0,U.c)(62),e=re(),r=q(),{config:d,ready:h}=Nt(),i=d.capabilities.organization,[o,l]=(0,j.useState)(null),[n,s]=(0,j.useState)(null),m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=["lunora-auth-orgs"],t[0]=m):m=t[0];let b;t[1]!==e?(b=c(()=>e.listAuthOrganizations({limit:100}),"g"),t[1]=e,t[2]=b):b=t[2];let u;t[3]!==i?(u={enabled:i},t[3]=i,t[4]=u):u=t[4];let g=ue(m,b,u),p=g.data?.rows??null,f;t[5]!==g?(f=c(()=>{g.refetch()},"h"),t[5]=g,t[6]=f):f=t[6],Ct(f,i);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{s(null)},"v"),t[7]=y):y=t[7];let k=y,v;t[8]!==g?(v=c(()=>{g.refetch()},"p"),t[8]=g,t[9]=v):v=t[9];let I=v,C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C=c(R=>{l(R)},"y"),t[10]=C):C=t[10];let z=C;if(h&&!i){let R;t[11]!==r?(R=r("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=r,t[12]=R):R=t[12];let $;t[13]!==r?($=r("Organizations are not enabled."),t[13]=r,t[14]=$):$=t[14];let K;return t[15]!==R||t[16]!==$?(K=(0,a.jsx)(ce,{description:R,testId:"org-disabled",title:$}),t[15]=R,t[16]=$,t[17]=K):K=t[17],K}let x;t[18]!==r?(x=r("Organizations"),t[18]=r,t[19]=x):x=t[19];let w;t[20]!==x?(w=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),t[20]=x,t[21]=w):w=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=c(()=>{s({kind:"create"})},"D"),t[22]=N):N=t[22];let O;t[23]!==r?(O=r("New organization"),t[23]=r,t[24]=O):O=t[24];let A;t[25]!==O?(A=(0,a.jsx)(L,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:O}),t[25]=O,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==w?(D=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[w,A]}),t[27]=A,t[28]=w,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[30]=g.error,t[31]=T):T=t[31];let M;t[32]!==p||t[33]!==r?(M=p!==null&&p.length===0&&(0,a.jsx)(ce,{testId:"org-empty",title:r("No organizations.")}),t[32]=p,t[33]=r,t[34]=M):M=t[34];let P;t[35]!==p||t[36]!==o||t[37]!==r?(P=p!==null&&p.length>0&&(0,a.jsx)(ht,{className:"overflow-hidden py-0",children:(0,a.jsx)(bt,{className:"px-0",children:(0,a.jsxs)(ft,{"data-testid":"org-table",children:[(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[(0,a.jsx)(se,{children:r("id")}),(0,a.jsx)(se,{children:r("name")}),(0,a.jsx)(se,{children:r("slug")}),(0,a.jsx)(se,{children:r("created")}),(0,a.jsx)(se,{"aria-label":r("Actions")})]})}),(0,a.jsx)(vt,{children:p.map(R=>{let $=S(R.id);return(0,a.jsxs)(Ze,{"data-testid":`org-row-${$}`,children:[(0,a.jsx)(me,{className:"font-mono text-xs",children:$}),(0,a.jsx)(me,{children:S(R.name)}),(0,a.jsx)(me,{children:S(R.slug)}),(0,a.jsx)(me,{className:"text-muted-foreground tabular-nums",children:kt(R.createdAt)}),(0,a.jsx)(me,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:c(()=>{z($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:c(()=>{s({kind:"edit",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:c(()=>{s({kind:"delete",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[35]=p,t[36]=o,t[37]=r,t[38]=P):P=t[38];let Q;t[39]!==d.organization||t[40]!==o?(Q=o!==null&&(0,a.jsx)(Xt,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[39]=d.organization,t[40]=o,t[41]=Q):Q=t[41];let B;t[42]!==n?.kind||t[43]!==I?(B=n?.kind==="create"&&(0,a.jsx)(Dt,{mode:"create",onClose:k,onDone:I}),t[42]=n?.kind,t[43]=I,t[44]=B):B=t[44];let E;t[45]!==n||t[46]!==I?(E=n?.kind==="edit"&&(0,a.jsx)(Dt,{mode:"edit",onClose:k,onDone:I,org:n.org}),t[45]=n,t[46]=I,t[47]=E):E=t[47];let J;t[48]!==e||t[49]!==n||t[50]!==I||t[51]!==r?(J=n?.kind==="delete"&&(0,a.jsx)(Mt,{action:c(async()=>{let R=S(n.org.id);await e.deleteAuthOrganization({organizationId:R}),l($=>$===R?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:k,onDone:I,testId:"org-delete",title:r("Delete organization")}),t[48]=e,t[49]=n,t[50]=I,t[51]=r,t[52]=J):J=t[52];let Y;return t[53]!==D||t[54]!==T||t[55]!==M||t[56]!==P||t[57]!==Q||t[58]!==B||t[59]!==E||t[60]!==J?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,M,P,Q,B,E,J]}),t[53]=D,t[54]=T,t[55]=M,t[56]=P,t[57]=Q,t[58]=B,t[59]=E,t[60]=J,t[61]=Y):Y=t[61],Y},"yl");export{yr as default};
|
|
1
|
+
import{a as yt}from"./chunk-EA2JKR5D.js";import{b as Nt}from"./chunk-XD6I4DFM.js";import{a as ne}from"./chunk-TIUMFAN2.js";import{a as St}from"./chunk-XZMOZFE6.js";import{a as zt}from"./chunk-IMOHEGMV.js";import{a as Ct}from"./chunk-66UGPQVC.js";import{P as Z}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as L}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{b as ue}from"./chunk-PQTHMQHP.js";import{f as re}from"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as ce}from"./chunk-FKVZRPV5.js";import{a as ft,b as pt,c as vt,d as Ze,e as se,f as me}from"./chunk-HEAQVSNS.js";import{a as ht,e as bt}from"./chunk-WUWBZPUK.js";import{d as q,h as xt,n as S,o as wt,r as kt}from"./chunk-FODLDLE2.js";import{a as c,d as gt,e as Rt,f as $t,g as Ft}from"./chunk-YKXDMIHQ.js";var U=gt($t(),1);var j=gt(Rt(),1);var a=gt(Ft(),1);var Ot=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Dt"),Et=c(t=>{let e=Ot(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Mt"),Tt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"St"),X=c(t=>{let e=(0,U.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(zt,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"G"),de=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:s})=>{let m=q();return(0,a.jsxs)(St,{label:s,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:m("Cancel")}),(0,a.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?m("Saving\u2026"):l})]})]})},"ae"),Dt=c(t=>{let e=(0,U.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=re(),l=q(),{busy:n,error:s,run:m}=ne(),b;e[0]!==i?(b=i?S(i.name):"",e[0]=i,e[1]=b):b=e[1];let[u,g]=(0,j.useState)(b),p;e[2]!==i?(p=i?S(i.slug):"",e[2]=i,e[3]=p):p=e[3];let[f,y]=(0,j.useState)(p),k;e[4]!==i?(k=i?S(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[v,I]=(0,j.useState)(k),[C,z]=(0,j.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Tt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[w,N]=(0,j.useState)(x),O;e[9]!==o||e[10]!==v||e[11]!==w||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==m||e[19]!==f?(O=c(()=>{m(async()=>{let F=w.trim()===""?void 0:Ot(w);r==="create"?await o.createAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:f.trim()===""?void 0:f.trim()}):await o.updateAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim()===""?void 0:u.trim(),organizationId:S(i?.id),slug:f.trim()===""?void 0:f.trim()}),h(),d()})},"_"),e[9]=o,e[10]=v,e[11]=w,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=m,e[19]=f,e[20]=O):O=e[20];let A=O,D;e[21]!==r||e[22]!==u?(D=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let M;e[27]!==r||e[28]!==l?(M=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=M):M=e[29];let P;e[30]!==l?(P=l("name"),e[30]=l,e[31]=P):P=e[31];let Q;e[32]===Symbol.for("react.memo_cache_sentinel")?(Q=c(F=>{g(F.target.value)},"q"),e[32]=Q):Q=e[32];let B;e[33]!==u?(B=(0,a.jsx)(Z,{"data-testid":"org-form-name",id:"org-form-name",onChange:Q,value:u}),e[33]=u,e[34]=B):B=e[34];let E;e[35]!==B||e[36]!==P?(E=(0,a.jsx)(X,{htmlFor:"org-form-name",label:P,children:B}),e[35]=B,e[36]=P,e[37]=E):E=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let Y;e[40]===Symbol.for("react.memo_cache_sentinel")?(Y=c(F=>{y(F.target.value)},"K"),e[40]=Y):Y=e[40];let R;e[41]!==f?(R=(0,a.jsx)(Z,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:Y,value:f}),e[41]=f,e[42]=R):R=e[42];let $;e[43]!==J||e[44]!==R?($=(0,a.jsx)(X,{htmlFor:"org-form-slug",label:J,children:R}),e[43]=J,e[44]=R,e[45]=$):$=e[45];let K;e[46]!==l?(K=l("Logo URL (optional)"),e[46]=l,e[47]=K):K=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=c(F=>{I(F.target.value)},"ne"),e[48]=ie):ie=e[48];let H;e[49]!==v?(H=(0,a.jsx)(Z,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:v}),e[49]=v,e[50]=H):H=e[50];let ee;e[51]!==K||e[52]!==H?(ee=(0,a.jsx)(X,{htmlFor:"org-form-logo",label:K,children:H}),e[51]=K,e[52]=H,e[53]=ee):ee=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(Z,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(F=>{z(F.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=c(F=>{N(F.target.value)},"le"),e[60]=oe):oe=e[60];let V;e[61]!==w?(V=(0,a.jsx)(yt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:w}),e[61]=w,e[62]=V):V=e[62];let _;e[63]!==te||e[64]!==V?(_=(0,a.jsx)(X,{htmlFor:"org-form-metadata",label:te,children:V}),e[63]=te,e[64]=V,e[65]=_):_=e[65];let ae;return e[66]!==n||e[67]!==s||e[68]!==d||e[69]!==A||e[70]!==E||e[71]!==$||e[72]!==ee||e[73]!==W||e[74]!==_||e[75]!==D||e[76]!==T||e[77]!==M?(ae=(0,a.jsxs)(de,{busy:n,canSubmit:D,error:s,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:M,children:[E,$,ee,W,_]}),e[66]=n,e[67]=s,e[68]=d,e[69]=A,e[70]=E,e[71]=$,e[72]=ee,e[73]=W,e[74]=_,e[75]=D,e[76]=T,e[77]=M,e[78]=ae):ae=e[78],ae},"ht"),Lt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==s||e[6]!==m?(p=c(()=>{s(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:m.trim()}),d(),r()})},"b"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=s,e[6]=m,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Add member"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:z,value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-add-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-add-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Rt"),jt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==m||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==s?(p=c(()=>{s(async()=>{await i.inviteAuthOrgMember({email:m.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"b"),e[0]=i,e[1]=m,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=s,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Send invitation"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:z,type:"email",value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-invite-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-invite-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Ft"),Pt=c(t=>{let e=(0,U.c)(32),{member:r,onClose:d,onDone:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),m;e[0]!==r.role?(m=c(()=>S(r.role),"m"),e[0]=r.role,e[1]=m):m=e[1];let[b,u]=(0,j.useState)(m),g;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==b||e[7]!==s?(g=c(()=>{s(async()=>{await i.setAuthOrgMemberRole({memberId:S(r.id),role:b.trim()}),h(),d()})},"f"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=b,e[7]=s,e[8]=g):g=e[8];let p=g,f;e[9]!==b?(f=b.trim(),e[9]=b,e[10]=f):f=e[10];let y=f!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("Change member role"),e[13]=o,e[14]=v):v=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let z;e[18]!==b?(z=(0,a.jsx)(Z,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:b}),e[18]=b,e[19]=z):z=e[19];let x;e[20]!==I||e[21]!==z?(x=(0,a.jsx)(X,{htmlFor:"org-member-role-value",label:I,children:z}),e[20]=I,e[21]=z,e[22]=x):x=e[22];let w;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==p||e[27]!==x||e[28]!==y||e[29]!==k||e[30]!==v?(w=(0,a.jsx)(de,{busy:l,canSubmit:y,error:n,onClose:d,onSubmit:p,submitLabel:k,testId:"org-member-role",title:v,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=p,e[27]=x,e[28]=y,e[29]=k,e[30]=v,e[31]=w):w=e[31],w},"Et"),At=c(t=>{let e=(0,U.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.name):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==l||e[3]!==r||e[4]!==g||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==b||e[9]!==o?.id?(f=c(()=>{b(async()=>{await(r==="create"?l.createAuthOrgTeam({name:g.trim(),organizationId:i}):l.updateAuthOrgTeam({name:g.trim(),teamId:S(o?.id)})),h(),d()})},"h"),e[2]=l,e[3]=r,e[4]=g,e[5]=d,e[6]=h,e[7]=i,e[8]=b,e[9]=o?.id,e[10]=f):f=e[10];let y=f,k;e[11]!==g?(k=g.trim(),e[11]=g,e[12]=k):k=e[12];let v=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let z;e[19]!==n?(z=n("name"),e[19]=n,e[20]=z):z=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(A=>{p(A.target.value)},"x"),e[21]=x):x=e[21];let w;e[22]!==g?(w=(0,a.jsx)(Z,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:g}),e[22]=g,e[23]=w):w=e[23];let N;e[24]!==z||e[25]!==w?(N=(0,a.jsx)(X,{htmlFor:"org-team-form-name",label:z,children:w}),e[24]=z,e[25]=w,e[26]=N):N=e[26];let O;return e[27]!==s||e[28]!==m||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==v||e[33]!==I||e[34]!==C?(O=(0,a.jsx)(de,{busy:s,canSubmit:v,error:m,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=s,e[28]=m,e[29]=d,e[30]=y,e[31]=N,e[32]=v,e[33]=I,e[34]=C,e[35]=O):O=e[35],O},"bt"),Bt=c(t=>{let e=(0,U.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==s||e[4]!==h||e[5]!==m?(u=c(()=>{s(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:m.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=s,e[4]=h,e[5]=m,e[6]=u):u=e[6];let g=u,p;e[7]!==m?(p=m.trim(),e[7]=m,e[8]=p):p=e[8];let f=p!=="",y;e[9]!==o?(y=o("Add member"),e[9]=o,e[10]=y):y=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("User id"),e[13]=o,e[14]=v):v=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(w=>{b(w.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==m?(C=(0,a.jsx)(Z,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:m}),e[16]=m,e[17]=C):C=e[17];let z;e[18]!==v||e[19]!==C?(z=(0,a.jsx)(X,{htmlFor:"org-team-add-member-user",label:v,children:C}),e[18]=v,e[19]=C,e[20]=z):z=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==g||e[25]!==f||e[26]!==y||e[27]!==k||e[28]!==z?(x=(0,a.jsx)(de,{busy:l,canSubmit:f,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:k,children:z}),e[21]=l,e[22]=n,e[23]=r,e[24]=g,e[25]=f,e[26]=y,e[27]=k,e[28]=z,e[29]=x):x=e[29],x},"jt"),_t=c(t=>{let e=(0,U.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.role):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==r||e[3]!==o?.permission?(f=r==="edit"?Tt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=f):f=e[4];let[y,k]=(0,j.useState)(f),v;e[5]!==l||e[6]!==r||e[7]!==g||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==y||e[12]!==o?.id||e[13]!==b?(v=c(()=>{b(async()=>{let M=Et(y);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:M,role:g.trim()}):l.updateAuthOrgRole({permission:M,roleId:S(o?.id)})),h(),d()})},"p"),e[5]=l,e[6]=r,e[7]=g,e[8]=d,e[9]=h,e[10]=i,e[11]=y,e[12]=o?.id,e[13]=b,e[14]=v):v=e[14];let I=v,C;e[15]!==r||e[16]!==g||e[17]!==y?(C=y.trim()!==""&&(r==="edit"||g.trim()!==""),e[15]=r,e[16]=g,e[17]=y,e[18]=C):C=e[18];let z;e[19]!==r||e[20]!==n?(z=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=z):z=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let w;e[25]!==r||e[26]!==g||e[27]!==n?(w=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(Z,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c(M=>{p(M.target.value)},"onChange"),value:g})}),e[25]=r,e[26]=g,e[27]=n,e[28]=w):w=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{k(M.target.value)},"_"),e[31]=O):O=e[31];let A;e[32]!==y?(A=(0,a.jsx)(yt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:O,value:y}),e[32]=y,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,a.jsx)(X,{htmlFor:"org-role-form-permission",label:N,children:A}),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==s||e[38]!==m||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==C||e[43]!==z||e[44]!==x||e[45]!==w?(T=(0,a.jsxs)(de,{busy:s,canSubmit:C,error:m,onClose:d,onSubmit:I,submitLabel:z,testId:"org-role-form",title:x,children:[w,D]}),e[37]=s,e[38]=m,e[39]=d,e[40]=I,e[41]=D,e[42]=C,e[43]=z,e[44]=x,e[45]=w,e[46]=T):T=e[46],T},"pt"),Mt=c(t=>{let e=(0,U.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==b?(u=c(()=>{b(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=b,e[4]=u):u=e[4];let g=u,p;e[5]!==n?(p=n("Delete"),e[5]=n,e[6]=p):p=e[6];let f;e[7]!==d?(f=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let y;return e[9]!==s||e[10]!==m||e[11]!==h||e[12]!==g||e[13]!==p||e[14]!==f||e[15]!==o||e[16]!==l?(y=(0,a.jsx)(de,{busy:s,canSubmit:!0,destructive:!0,error:m,onClose:h,onSubmit:g,submitLabel:p,testId:o,title:l,children:f}),e[9]=s,e[10]=m,e[11]=h,e[12]=g,e[13]=p,e[14]=f,e[15]=o,e[16]=l,e[17]=y):y=e[17],y},"zt"),Ge=c(t=>{let e=(0,U.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let s;e[7]!==d?(s=(0,a.jsx)(bt,{className:"px-0",children:d}),e[7]=d,e[8]=s):s=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==i?(m=(0,a.jsxs)(ht,{className:"overflow-hidden py-0","data-testid":i,children:[n,s]}),e[9]=n,e[10]=s,e[11]=i,e[12]=m):m=e[12],m},"Ve"),He=c(t=>{let e=(0,U.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=q(),l;e[0]!==r?(l=r.map(Jt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==n?(s=(0,a.jsx)(se,{"aria-label":n}),e[4]=n,e[5]=s):s=e[5];let m;e[6]!==l||e[7]!==s?(m=(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[l,s]})}),e[6]=l,e[7]=s,e[8]=m):m=e[8];let b;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let p;e[14]!==r||e[15]!==d||e[16]!==h?(p=c((f,y)=>{let k=S(f.id),v=k===""?`index-${y.toString()}`:k;return(0,a.jsxs)(Ze,{"data-testid":`${h}-${v}`,children:[r.map(I=>(0,a.jsx)(me,{className:I.className,children:I.render(f)},I.head)),(0,a.jsx)(me,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(f)})})]},v)},"b"),e[14]=r,e[15]=d,e[16]=h,e[17]=p):p=e[17],b=i.map(p),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=b}else b=e[13];let u;e[18]!==b?(u=(0,a.jsx)(vt,{children:b}),e[18]=b,e[19]=u):u=e[19];let g;return e[20]!==m||e[21]!==u?(g=(0,a.jsxs)(ft,{children:[m,u]}),e[20]=m,e[21]=u,e[22]=g):g=e[22],g},"We");function Jt(t){return(0,a.jsx)(se,{children:t.head},t.head)}c(Jt,"Lt");var Ut=c(t=>{let e=(0,U.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let s;e[2]!==l?(s=l("Add member"),e[2]=l,e[3]=s):s=e[3];let m;e[4]!==n||e[5]!==s?(m=(0,a.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:s}),e[4]=n,e[5]=s,e[6]=m):m=e[6];let b;e[7]!==o?(b=c(()=>{o({kind:"invite-member"})},"g"),e[7]=o,e[8]=b):b=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let g;e[11]!==b||e[12]!==u?(g=(0,a.jsx)(L,{"data-testid":"org-open-invite-member",onClick:b,size:"xs",type:"button",variant:"outline",children:u}),e[11]=b,e[12]=u,e[13]=g):g=e[13];let p;e[14]!==m||e[15]!==g?(p=(0,a.jsxs)(a.Fragment,{children:[m,g]}),e[14]=m,e[15]=g,e[16]=p):p=e[16];let f;e[17]!==l?(f=l("Members"),e[17]=l,e[18]=f):f=e[18];let y;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(y=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(v=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-member-role-${S(v.id)}`,onClick:c(()=>{o({kind:"member-role",member:v})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(L,{"data-testid":`org-remove-member-${S(v.id)}`,disabled:r,onClick:c(()=>{d(S(v.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=y):y=e[25];let k;return e[26]!==p||e[27]!==f||e[28]!==y?(k=(0,a.jsx)(Ge,{action:p,heading:f,testId:"org-members",children:y}),e[26]=p,e[27]=f,e[28]=y,e[29]=k):k=e[29],k},"Pt"),qt=c(t=>{let e=(0,U.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=q(),s;e[0]!==d?(s=c(()=>{d({kind:"team-create"})},"a"),e[0]=d,e[1]=s):s=e[1];let m;e[2]!==n?(m=n("New team"),e[2]=n,e[3]=m):m=e[3];let b;e[4]!==s||e[5]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-create-team",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[4]=s,e[5]=m,e[6]=b):b=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let g;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"aria-pressed":i===S(f.id),"data-testid":`org-team-select-${S(f.id)}`,onClick:c(()=>{h(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(L,{"data-testid":`org-team-rename-${S(f.id)}`,onClick:c(()=>{d({kind:"team-rename",team:f})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(L,{"data-testid":`org-team-delete-${S(f.id)}`,onClick:c(()=>{r(f)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=g):g=e[16];let p;return e[17]!==b||e[18]!==u||e[19]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-teams",children:g}),e[17]=b,e[18]=u,e[19]=g,e[20]=p):p=e[20],p},"Bt"),Kt=c(t=>{let e=(0,U.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=q(),s;e[0]!==h||e[1]!==i?(s=c(()=>{h({kind:"team-add-member",teamId:i})},"a"),e[0]=h,e[1]=i,e[2]=s):s=e[2];let m;e[3]!==n?(m=n("Add member"),e[3]=n,e[4]=m):m=e[4];let b;e[5]!==s||e[6]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[5]=s,e[6]=m,e[7]=b):b=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let g;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsx)(L,{"data-testid":`org-team-remove-member-${S(f.id)}`,disabled:r,onClick:c(()=>{d(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=g):g=e[15];let p;return e[16]!==b||e[17]!==u||e[18]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-team-members",children:g}),e[16]=b,e[17]=u,e[18]=g,e[19]=p):p=e[19],p},"Qt"),Qt=c(t=>{let e=(0,U.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"o"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==l||e[5]!==n?(s=(0,a.jsx)(L,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=s):s=e[6];let m;e[7]!==o?(m=o("Roles"),e[7]=o,e[8]=m):m=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(b=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-role-edit-${S(g.id)}`,onClick:c(()=>{d({kind:"role-edit",role:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(L,{"data-testid":`org-role-delete-${S(g.id)}`,onClick:c(()=>{r(S(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=b):b=e[14];let u;return e[15]!==s||e[16]!==m||e[17]!==b?(u=(0,a.jsx)(Ge,{action:s,heading:m,testId:"org-roles",children:b}),e[15]=s,e[16]=m,e[17]=b,e[18]=u):u=e[18],u},"Jt"),Xt=c(t=>{let e=(0,U.c)(199),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=re(),o=q(),[l,n]=(0,j.useState)(null),[s,m]=(0,j.useState)(null),[b,u]=(0,j.useState)(!1),[g,p]=(0,j.useState)(null),f;e[0]!==r?(f=["lunora-auth-org-members",r],e[0]=r,e[1]=f):f=e[1];let y;e[2]!==i||e[3]!==r?(y=c(()=>i.listAuthOrgMembers({limit:200,organizationId:r}),"v"),e[2]=i,e[3]=r,e[4]=y):y=e[4];let k=ue(f,y),v;e[5]!==r?(v=["lunora-auth-org-invitations",r],e[5]=r,e[6]=v):v=e[6];let I;e[7]!==i||e[8]!==r?(I=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"C"),e[7]=i,e[8]=r,e[9]=I):I=e[9];let C=ue(v,I),z;e[10]!==r?(z=["lunora-auth-org-teams",r],e[10]=r,e[11]=z):z=e[11];let x;e[12]!==i||e[13]!==r?(x=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"x"),e[12]=i,e[13]=r,e[14]=x):x=e[14];let w;e[15]!==h?(w={enabled:h},e[15]=h,e[16]=w):w=e[16];let N=ue(z,x,w),O;e[17]!==r?(O=["lunora-auth-org-roles",r],e[17]=r,e[18]=O):O=e[18];let A;e[19]!==i||e[20]!==r?(A=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"N"),e[19]=i,e[20]=r,e[21]=A):A=e[21];let D;e[22]!==d?(D={enabled:d},e[22]=d,e[23]=D):D=e[23];let T=ue(O,A,D),M;e[24]!==s?(M=["lunora-auth-org-team-members",s],e[24]=s,e[25]=M):M=e[25];let P;e[26]!==i||e[27]!==s?(P=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:s??""}),"P"),e[26]=i,e[27]=s,e[28]=P):P=e[28];let Q=s!==null,B;e[29]!==Q?(B={enabled:Q},e[29]=Q,e[30]=B):B=e[30];let E=ue(M,P,B),J;e[31]!==k.data?.rows?(J=k.data?.rows??[],e[31]=k.data?.rows,e[32]=J):J=e[32];let Y=J,R;e[33]!==C.data?.rows?(R=C.data?.rows??[],e[33]=C.data?.rows,e[34]=R):R=e[34];let $=R,K;e[35]!==N.data?.rows?(K=N.data?.rows??[],e[35]=N.data?.rows,e[36]=K):K=e[36];let ie=K,H;e[37]!==T.data?.rows?(H=T.data?.rows??[],e[37]=T.data?.rows,e[38]=H):H=e[38];let ee=H,W;e[39]!==s||e[40]!==E?(W=s===null?[]:E.data?.rows??[],e[39]=s,e[40]=E,e[41]=W):W=e[41];let te=W,oe=k.error??C.error??N.error??T.error??E.error,V;e[42]!==C||e[43]!==k||e[44]!==d||e[45]!==T||e[46]!==s||e[47]!==E||e[48]!==h||e[49]!==N?(V=c(()=>{k.refetch(),C.refetch(),h&&N.refetch(),d&&T.refetch(),s!==null&&E.refetch()},"Z"),e[42]=C,e[43]=k,e[44]=d,e[45]=T,e[46]=s,e[47]=E,e[48]=h,e[49]=N,e[50]=V):V=e[50];let _=V;Ct(_,!0);let ae;e[51]===Symbol.for("react.memo_cache_sentinel")?(ae=c(()=>{n(null)},"ie"),e[51]=ae):ae=e[51];let F=ae,We;e[52]!==_?(We=c(G=>{wt((async()=>{u(!0),p(null);try{await G(),_(),u(!1)}catch(nt){p(xt(nt)),u(!1)}})())},"Xe"),e[52]=_,e[53]=We):We=e[53];let le=We,Ve;e[54]!==i||e[55]!==o?(Ve=c(G=>{let nt=S(G.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:nt}),m(It=>It===nt?null:It)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"Ye"),e[54]=i,e[55]=o,e[56]=Ve):Ve=e[56];let it=Ve,ge;e[57]!==o?(ge=o("userId"),e[57]=o,e[58]=ge):ge=e[58];let he;e[59]!==ge?(he={head:ge,render:Yt},e[59]=ge,e[60]=he):he=e[60];let be;e[61]!==o?(be=o("role"),e[61]=o,e[62]=be):be=e[62];let fe;e[63]!==be?(fe={head:be,render:Zt},e[63]=be,e[64]=fe):fe=e[64];let et;e[65]!==he||e[66]!==fe?(et=[he,fe],e[65]=he,e[66]=fe,e[67]=et):et=e[67];let st=et,pe;e[68]!==o?(pe=o("email"),e[68]=o,e[69]=pe):pe=e[69];let ve;e[70]!==pe?(ve={head:pe,render:Gt},e[70]=pe,e[71]=ve):ve=e[71];let ye;e[72]!==o?(ye=o("role"),e[72]=o,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:Ht},e[74]=ye,e[75]=Ce):Ce=e[75];let Ie;e[76]!==o?(Ie=o("status"),e[76]=o,e[77]=Ie):Ie=e[77];let xe;e[78]!==Ie?(xe={head:Ie,render:Wt},e[78]=Ie,e[79]=xe):xe=e[79];let tt;e[80]!==ve||e[81]!==Ce||e[82]!==xe?(tt=[ve,Ce,xe],e[80]=ve,e[81]=Ce,e[82]=xe,e[83]=tt):tt=e[83];let mt=tt,we;e[84]!==o?(we=o("id"),e[84]=o,e[85]=we):we=e[85];let ke;e[86]!==we?(ke={className:"font-mono text-xs",head:we,render:Vt},e[86]=we,e[87]=ke):ke=e[87];let ze;e[88]!==o?(ze=o("name"),e[88]=o,e[89]=ze):ze=e[89];let Ne;e[90]!==ze?(Ne={head:ze,render:er},e[90]=ze,e[91]=Ne):Ne=e[91];let rt;e[92]!==ke||e[93]!==Ne?(rt=[ke,Ne],e[92]=ke,e[93]=Ne,e[94]=rt):rt=e[94];let dt=rt,Se;e[95]!==o?(Se=o("userId"),e[95]=o,e[96]=Se):Se=e[96];let ot;e[97]!==Se?(ot=[{head:Se,render:tr}],e[97]=Se,e[98]=ot):ot=e[98];let ct=ot,De;e[99]!==o?(De=o("role"),e[99]=o,e[100]=De):De=e[100];let Ae;e[101]!==De?(Ae={head:De,render:rr},e[101]=De,e[102]=Ae):Ae=e[102];let _e;e[103]!==o?(_e=o("Permission"),e[103]=o,e[104]=_e):_e=e[104];let Oe;e[105]!==_e?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:or},e[105]=_e,e[106]=Oe):Oe=e[106];let at;e[107]!==Ae||e[108]!==Oe?(at=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=at):at=e[109];let ut=at,Te;e[110]!==oe?(Te=oe!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe}),e[110]=oe,e[111]=Te):Te=e[111];let Me;e[112]!==g?(Me=g!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g}),e[112]=g,e[113]=Me):Me=e[113];let Re;e[114]!==i||e[115]!==le?(Re=c(G=>{le(()=>i.removeAuthOrgMember({memberId:G}))},"Te"),e[114]=i,e[115]=le,e[116]=Re):Re=e[116];let $e;e[117]!==b||e[118]!==st||e[119]!==Y||e[120]!==Re?($e=(0,a.jsx)(Ut,{actionBusy:b,memberColumns:st,members:Y,onDialog:n,onRemoveMember:Re}),e[117]=b,e[118]=st,e[119]=Y,e[120]=Re,e[121]=$e):$e=e[121];let Fe;e[122]!==b||e[123]!==i||e[124]!==mt||e[125]!==$||e[126]!==le||e[127]!==o?(Fe=$.length>0&&(0,a.jsx)(Ge,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(He,{columns:mt,rowActions:c(G=>(0,a.jsx)(L,{"data-testid":`org-cancel-invitation-${S(G.id)}`,disabled:b,onClick:c(()=>{le(()=>i.cancelAuthOrgInvitation({invitationId:S(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:$})}),e[122]=b,e[123]=i,e[124]=mt,e[125]=$,e[126]=le,e[127]=o,e[128]=Fe):Fe=e[128];let Ee;e[129]!==it||e[130]!==s||e[131]!==dt||e[132]!==ie||e[133]!==h?(Ee=h&&(0,a.jsx)(qt,{onConfirmDeleteTeam:it,onDialog:n,onSelectTeam:m,selectedTeam:s,teamColumns:dt,teams:ie}),e[129]=it,e[130]=s,e[131]=dt,e[132]=ie,e[133]=h,e[134]=Ee):Ee=e[134];let Le;e[135]!==b||e[136]!==i||e[137]!==le||e[138]!==s||e[139]!==ct||e[140]!==te||e[141]!==h?(Le=h&&s!==null&&(0,a.jsx)(Kt,{actionBusy:b,onDialog:n,onRemoveTeamMember:c(G=>{le(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:s,teamMemberColumns:ct,teamMembers:te}),e[135]=b,e[136]=i,e[137]=le,e[138]=s,e[139]=ct,e[140]=te,e[141]=h,e[142]=Le):Le=e[142];let je;e[143]!==i||e[144]!==ut||e[145]!==ee||e[146]!==d||e[147]!==o?(je=d&&(0,a.jsx)(Qt,{onConfirmDeleteRole:c(G=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:ut,roles:ee}),e[143]=i,e[144]=ut,e[145]=ee,e[146]=d,e[147]=o,e[148]=je):je=e[148];let Pe;e[149]!==l?.kind||e[150]!==r||e[151]!==_?(Pe=l?.kind==="add-member"&&(0,a.jsx)(Lt,{onClose:F,onDone:_,organizationId:r}),e[149]=l?.kind,e[150]=r,e[151]=_,e[152]=Pe):Pe=e[152];let Be;e[153]!==l?.kind||e[154]!==r||e[155]!==_?(Be=l?.kind==="invite-member"&&(0,a.jsx)(jt,{onClose:F,onDone:_,organizationId:r}),e[153]=l?.kind,e[154]=r,e[155]=_,e[156]=Be):Be=e[156];let Je;e[157]!==l||e[158]!==_?(Je=l?.kind==="member-role"&&(0,a.jsx)(Pt,{member:l.member,onClose:F,onDone:_}),e[157]=l,e[158]=_,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==_?(Ue=l?.kind==="team-create"&&(0,a.jsx)(At,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=_,e[163]=Ue):Ue=e[163];let qe;e[164]!==l||e[165]!==r||e[166]!==_?(qe=l?.kind==="team-rename"&&(0,a.jsx)(At,{mode:"edit",onClose:F,onDone:_,organizationId:r,team:l.team}),e[164]=l,e[165]=r,e[166]=_,e[167]=qe):qe=e[167];let Ke;e[168]!==l||e[169]!==_?(Ke=l?.kind==="team-add-member"&&(0,a.jsx)(Bt,{onClose:F,onDone:_,teamId:l.teamId}),e[168]=l,e[169]=_,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l?.kind||e[172]!==r||e[173]!==_?(Qe=l?.kind==="role-create"&&(0,a.jsx)(_t,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[171]=l?.kind,e[172]=r,e[173]=_,e[174]=Qe):Qe=e[174];let Xe;e[175]!==l||e[176]!==r||e[177]!==_?(Xe=l?.kind==="role-edit"&&(0,a.jsx)(_t,{mode:"edit",onClose:F,onDone:_,organizationId:r,role:l.role}),e[175]=l,e[176]=r,e[177]=_,e[178]=Xe):Xe=e[178];let Ye;e[179]!==l||e[180]!==_?(Ye=l?.kind==="confirm"&&(0,a.jsx)(Mt,{action:l.action,message:l.message,onClose:F,onDone:_,testId:l.testId,title:l.title}),e[179]=l,e[180]=_,e[181]=Ye):Ye=e[181];let lt;return e[182]!==Te||e[183]!==Me||e[184]!==$e||e[185]!==Fe||e[186]!==Ee||e[187]!==Le||e[188]!==je||e[189]!==Pe||e[190]!==Be||e[191]!==Je||e[192]!==Ue||e[193]!==qe||e[194]!==Ke||e[195]!==Qe||e[196]!==Xe||e[197]!==Ye?(lt=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Te,Me,$e,Fe,Ee,Le,je,Pe,Be,Je,Ue,qe,Ke,Qe,Xe,Ye]}),e[182]=Te,e[183]=Me,e[184]=$e,e[185]=Fe,e[186]=Ee,e[187]=Le,e[188]=je,e[189]=Pe,e[190]=Be,e[191]=Je,e[192]=Ue,e[193]=qe,e[194]=Ke,e[195]=Qe,e[196]=Xe,e[197]=Ye,e[198]=lt):lt=e[198],lt},"Ut");function Yt(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(Yt,"Ht");function Zt(t){return S(t.role)}c(Zt,"qt");function Gt(t){return S(t.email)}c(Gt,"Gt");function Ht(t){return S(t.role)}c(Ht,"Kt");function Wt(t){return S(t.status)}c(Wt,"Vt");function Vt(t){return S(t.id)}c(Vt,"Wt");function er(t){return S(t.name)}c(er,"Xt");function tr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(tr,"Yt");function rr(t){return S(t.role)}c(rr,"Zt");function or(t){return S(t.permission)}c(or,"el");var yr=c(()=>{let t=(0,U.c)(62),e=re(),r=q(),{config:d,ready:h}=Nt(),i=d.capabilities.organization,[o,l]=(0,j.useState)(null),[n,s]=(0,j.useState)(null),m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=["lunora-auth-orgs"],t[0]=m):m=t[0];let b;t[1]!==e?(b=c(()=>e.listAuthOrganizations({limit:100}),"g"),t[1]=e,t[2]=b):b=t[2];let u;t[3]!==i?(u={enabled:i},t[3]=i,t[4]=u):u=t[4];let g=ue(m,b,u),p=g.data?.rows??null,f;t[5]!==g?(f=c(()=>{g.refetch()},"h"),t[5]=g,t[6]=f):f=t[6],Ct(f,i);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{s(null)},"v"),t[7]=y):y=t[7];let k=y,v;t[8]!==g?(v=c(()=>{g.refetch()},"p"),t[8]=g,t[9]=v):v=t[9];let I=v,C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C=c(R=>{l(R)},"y"),t[10]=C):C=t[10];let z=C;if(h&&!i){let R;t[11]!==r?(R=r("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=r,t[12]=R):R=t[12];let $;t[13]!==r?($=r("Organizations are not enabled."),t[13]=r,t[14]=$):$=t[14];let K;return t[15]!==R||t[16]!==$?(K=(0,a.jsx)(ce,{description:R,testId:"org-disabled",title:$}),t[15]=R,t[16]=$,t[17]=K):K=t[17],K}let x;t[18]!==r?(x=r("Organizations"),t[18]=r,t[19]=x):x=t[19];let w;t[20]!==x?(w=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),t[20]=x,t[21]=w):w=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=c(()=>{s({kind:"create"})},"D"),t[22]=N):N=t[22];let O;t[23]!==r?(O=r("New organization"),t[23]=r,t[24]=O):O=t[24];let A;t[25]!==O?(A=(0,a.jsx)(L,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:O}),t[25]=O,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==w?(D=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[w,A]}),t[27]=A,t[28]=w,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[30]=g.error,t[31]=T):T=t[31];let M;t[32]!==p||t[33]!==r?(M=p!==null&&p.length===0&&(0,a.jsx)(ce,{testId:"org-empty",title:r("No organizations.")}),t[32]=p,t[33]=r,t[34]=M):M=t[34];let P;t[35]!==p||t[36]!==o||t[37]!==r?(P=p!==null&&p.length>0&&(0,a.jsx)(ht,{className:"overflow-hidden py-0",children:(0,a.jsx)(bt,{className:"px-0",children:(0,a.jsxs)(ft,{"data-testid":"org-table",children:[(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[(0,a.jsx)(se,{children:r("id")}),(0,a.jsx)(se,{children:r("name")}),(0,a.jsx)(se,{children:r("slug")}),(0,a.jsx)(se,{children:r("created")}),(0,a.jsx)(se,{"aria-label":r("Actions")})]})}),(0,a.jsx)(vt,{children:p.map(R=>{let $=S(R.id);return(0,a.jsxs)(Ze,{"data-testid":`org-row-${$}`,children:[(0,a.jsx)(me,{className:"font-mono text-xs",children:$}),(0,a.jsx)(me,{children:S(R.name)}),(0,a.jsx)(me,{children:S(R.slug)}),(0,a.jsx)(me,{className:"text-muted-foreground tabular-nums",children:kt(R.createdAt)}),(0,a.jsx)(me,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:c(()=>{z($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:c(()=>{s({kind:"edit",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:c(()=>{s({kind:"delete",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[35]=p,t[36]=o,t[37]=r,t[38]=P):P=t[38];let Q;t[39]!==d.organization||t[40]!==o?(Q=o!==null&&(0,a.jsx)(Xt,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[39]=d.organization,t[40]=o,t[41]=Q):Q=t[41];let B;t[42]!==n?.kind||t[43]!==I?(B=n?.kind==="create"&&(0,a.jsx)(Dt,{mode:"create",onClose:k,onDone:I}),t[42]=n?.kind,t[43]=I,t[44]=B):B=t[44];let E;t[45]!==n||t[46]!==I?(E=n?.kind==="edit"&&(0,a.jsx)(Dt,{mode:"edit",onClose:k,onDone:I,org:n.org}),t[45]=n,t[46]=I,t[47]=E):E=t[47];let J;t[48]!==e||t[49]!==n||t[50]!==I||t[51]!==r?(J=n?.kind==="delete"&&(0,a.jsx)(Mt,{action:c(async()=>{let R=S(n.org.id);await e.deleteAuthOrganization({organizationId:R}),l($=>$===R?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:k,onDone:I,testId:"org-delete",title:r("Delete organization")}),t[48]=e,t[49]=n,t[50]=I,t[51]=r,t[52]=J):J=t[52];let Y;return t[53]!==D||t[54]!==T||t[55]!==M||t[56]!==P||t[57]!==Q||t[58]!==B||t[59]!==E||t[60]!==J?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,M,P,Q,B,E,J]}),t[53]=D,t[54]=T,t[55]=M,t[56]=P,t[57]=Q,t[58]=B,t[59]=E,t[60]=J,t[61]=Y):Y=t[61],Y},"yl");export{yr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"./chunk-IMOHEGMV.js";import{a as j}from"./chunk-66UGPQVC.js";import{a as C}from"./chunk-SU737V7V.js";import{P as v}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as U}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as q}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as w}from"./chunk-4ZEL6BYL.js";import{f as L}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-IMOHEGMV.js";import{a as j}from"./chunk-66UGPQVC.js";import{a as C}from"./chunk-SU737V7V.js";import{P as v}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as U}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as q}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as w}from"./chunk-4ZEL6BYL.js";import{f as L}from"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{d as P,f as y,g as p,h,o as u}from"./chunk-FODLDLE2.js";import{a as s,d as S,e as W,g as X}from"./chunk-YKXDMIHQ.js";var a=S(W(),1);var e=S(X(),1);var B=y(w.getPitrBookmark),Y=y(w.pitrRestore),de=s(({initialShardKey:z})=>{let m=L(),t=P(),o=z??"",[A,x]=(0,a.useState)(null),[l,O]=(0,a.useState)(""),[R,I]=(0,a.useState)(null),[c,D]=(0,a.useState)(""),[k,E]=(0,a.useState)(!1),[i,K]=(0,a.useState)(null),[T,n]=(0,a.useState)(null),[b,d]=(0,a.useState)(!1),g=(0,a.useCallback)(async()=>{d(!0),n(null);try{let r=await m.query(B,{},p(o));x(r.current)}catch(r){n(h(r))}d(!1)},[m,o]);(0,a.useEffect)(()=>{u(g())},[g]),j(()=>{u((async()=>{try{let r=await m.query(B,{},p(o));x(r.current)}catch{}})())},!0);let M=s(r=>{O(r.target.value)},"A"),Z=s(r=>{D(r.target.value)},"U"),_=s(r=>{E(r.target.checked)},"q"),G=s(()=>{l.trim()!==""&&u((async()=>{d(!0),n(null);try{let r=await m.query(B,{time:l.trim()},p(o));I(r.forTime??null),x(r.current)}catch(r){I(null),n(h(r))}d(!1)})())},"K"),F=s(r=>{u((async()=>{d(!0),n(null);try{let N=await m.mutation(Y,r,p(o));K(N),await g()}catch(N){n(h(N))}d(!1)})())},"C"),H=c.trim()!==""||l.trim()!=="",J=t("Restore {shard} to {target}?",{shard:o===""?t("root"):o,target:c.trim()===""?l.trim():t("the given bookmark")}),Q=s(()=>{let r=k?{restart:!0}:{};c.trim()===""?r.time=l.trim():r.bookmark=c.trim(),F(r)},"z"),V=s(()=>{i!==null&&F(k?{bookmark:i.undoBookmark,restart:!0}:{bookmark:i.undoBookmark})},"D");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t("Shard"),": ",(0,e.jsx)("span",{className:"font-mono",children:o===""?t("root"):o})]})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.")}),T!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:T}),(0,e.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:t("Current bookmark")}),(0,e.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:A??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]}),(0,e.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:t("Restore")}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-time",children:t("Time (ISO or epoch-ms, last 30 days)")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(v,{"data-testid":"pitr-time",id:"pitr-time",onChange:M,placeholder:"2026-06-01T00:00:00.000Z",value:l}),(0,e.jsx)(U,{"data-testid":"pitr-preview",disabled:b||l.trim()==="",onClick:G,size:"sm",type:"button",variant:"outline",children:t("Preview")})]}),R!==null&&(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",R]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-bookmark",children:t("Or an explicit bookmark (wins over time)")}),(0,e.jsx)(v,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:Z,placeholder:t("bookmark string"),value:c})]}),(0,e.jsxs)(f,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[(0,e.jsx)("input",{checked:k,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:_,type:"checkbox"}),t("Restart the shard now so recovery applies immediately")]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:J,disabled:b||!H,onConfirm:Q,testId:"pitr-restore",children:t("Restore")})})]}),i!==null&&(0,e.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),(0,e.jsx)(q,{variant:i.restarted?"destructive":"secondary",children:i.restarted?t("restarted now"):t("on next restart")})]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",i.restoredTo]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",i.undoBookmark]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:t("Confirm undo"),disabled:b,onConfirm:V,testId:"pitr-undo",children:t("Undo restore")})})]})]})},"ce");export{de as PitrPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as h}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as A}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as A}from"./chunk-PQTHMQHP.js";import{f as k}from"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as y,e as S}from"./chunk-WUWBZPUK.js";import{d as I}from"./chunk-FODLDLE2.js";import{a as u,d as w,f as z,g as P}from"./chunk-YKXDMIHQ.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(L)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./chunk-
|
|
1
|
+
import{a as q}from"./chunk-Q3WZBID4.js";import{a as k}from"./chunk-2ES4GR4C.js";import"./chunk-4GTO7FL5.js";import"./chunk-UVB3R7NI.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import{a as A}from"./chunk-S3CRZLGS.js";import{a as $}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-5GFSKIB2.js";import{b as K}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as F}from"./chunk-OBRWA7NJ.js";import"./chunk-ULIQFBZU.js";import"./chunk-5QTPE32B.js";import"./chunk-35DM4JJG.js";import{a as T}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-PQTHMQHP.js";import"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as O}from"./chunk-FKVZRPV5.js";import{a as j,e as w}from"./chunk-WUWBZPUK.js";import{d as I,r as E}from"./chunk-FODLDLE2.js";import{a as p,d as C,f as D,g as H}from"./chunk-YKXDMIHQ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ge}from"./chunk-VVOVVU53.js";import{a as Qe,b as qe}from"./chunk-CXNY45A3.js";import{a as Xe}from"./chunk-TIUMFAN2.js";import{a as He}from"./chunk-XZMOZFE6.js";import{a as j}from"./chunk-IMOHEGMV.js";import{a as Ke}from"./chunk-66UGPQVC.js";import{a as Ze}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{P as E}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as U}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as D}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ve}from"./chunk-6BI6AL3F.js";import{f as V}from"./chunk-ET6VU4YM.js";import"./chunk-FSRSK4LY.js";import"./chunk-FMRAZ6MD.js";import{a as Me}from"./chunk-FKVZRPV5.js";import{a as Se,b as ze,c as Ue,d as T,e as S,f as z}from"./chunk-HEAQVSNS.js";import{a as H,e as W}from"./chunk-WUWBZPUK.js";import{d as q,h as Pe,n as Fe,o as J,r as Q}from"./chunk-FODLDLE2.js";import{a as s,d as Oe,e as tt,f as at,g as it}from"./chunk-YKXDMIHQ.js";var x=Oe(tt(),1);var X=Oe(at(),1);var t=Oe(it(),1);Qe.capabilities;var lt=s(()=>{let h=(0,X.c)(3),{config:e,ready:l}=qe(),i;return h[0]!==e.capabilities||h[1]!==l?(i={capabilities:e.capabilities,ready:l},h[0]=e.capabilities,h[1]=l,h[2]=i):i=h[2],i},"st"),st=s((h,e)=>typeof h.acceptedAt=="number"?"spent":typeof h.expiresAt=="number"&&h.expiresAt<=e?"expired":"pending","nt"),Ye=500,nt=s(()=>{let h=V(),e=q(),[l,i]=(0,x.useState)(""),[m,a]=(0,x.useState)(null),[c,n]=(0,x.useState)(null),[d,v]=(0,x.useState)(!1),f=Ve(["lunora-auth-sign-up-invitations",Ye],()=>h.listAuthSignUpInvitations({limit:Ye})),C=f.data?.rows??null,y=f.data?.total??0,A=s(()=>{let r=l.trim();r!==""&&(a(null),J((async()=>{try{let u=await h.createAuthSignUpInvitation({email:r}),p=typeof u.token=="string"?u.token:void 0;n(p===void 0?null:`${globalThis.location.origin}/sign-up?email=${encodeURIComponent(r)}&invite=${encodeURIComponent(p)}`),v(!1),i(""),f.refetch()}catch(u){a(u instanceof Error?u.message:String(u))}})()))},"A"),N=s(()=>{let r="navigator"in globalThis?globalThis.navigator.clipboard:void 0;c===null||r===void 0||J(r.writeText(c).then(()=>(v(!0),!0)))},"y"),I=s(r=>{a(null),J((async()=>{try{await h.revokeAuthSignUpInvitation({email:r}),f.refetch()}catch(u){a(u instanceof Error?u.message:String(u))}})())},"I");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"sign-up-invitations",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-base font-medium",children:e("Sign-up invitations")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Only invited addresses can create an account. Nothing is emailed \u2014 send the invitee the one-time link yourself.")})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(E,{"aria-label":e("Email address to invite"),"data-testid":"sign-up-invitation-email",onChange:s(r=>{i(r.target.value)},"onChange"),placeholder:e("ada@example.com"),type:"email",value:l}),(0,t.jsx)(U,{"data-testid":"sign-up-invitation-submit",onClick:A,type:"button",children:e("Invite")})]}),c!==null&&(0,t.jsx)(H,{children:(0,t.jsxs)(W,{className:"flex flex-col gap-2 p-4",children:[(0,t.jsx)("p",{className:"text-sm",children:e("Send this link to the invitee. It is shown once and cannot be recovered.")}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(E,{"data-testid":"sign-up-invitation-link",readOnly:!0,value:c}),(0,t.jsx)(U,{"data-testid":"sign-up-invitation-copy",onClick:N,type:"button",children:e(d?"Copied":"Copy")})]})]})}),(m??f.error)!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sign-up-invitations-error",role:"alert",children:m??f.error}),C!==null&&C.length===0&&(0,t.jsx)(Me,{testId:"sign-up-invitations-empty",title:e("Nobody has been invited yet.")}),C!==null&&y>C.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sign-up-invitations-truncated",children:e("Showing the most recent invitations. Query the signUpInvitation table directly to see the rest.")}),C!==null&&C.length>0&&(0,t.jsx)(H,{children:(0,t.jsx)(W,{className:"p-0",children:(0,t.jsxs)(Se,{children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:e("Email")}),(0,t.jsx)(S,{children:e("Status")}),(0,t.jsx)(S,{children:e("Expires")}),(0,t.jsx)(S,{children:e("Invited by")}),(0,t.jsx)(S,{})]})}),(0,t.jsx)(Ue,{children:C.map(r=>{let u=st(r,Date.now()),p=r.email??"";return(0,t.jsxs)(T,{"data-testid":`sign-up-invitation-${p}`,children:[(0,t.jsx)(z,{children:p}),(0,t.jsxs)(z,{"data-testid":`sign-up-invitation-status-${p}`,children:[u==="spent"&&e("Accepted"),u==="expired"&&e("Expired"),u==="pending"&&e("Pending")]}),(0,t.jsx)(z,{children:typeof r.expiresAt=="number"?Q(r.expiresAt):"\u2014"}),(0,t.jsx)(z,{children:r.invitedBy??"\u2014"}),(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(U,{onClick:s(()=>{I(p)},"onClick"),type:"button",variant:"ghost",children:e("Revoke")})})]},r.id)})})]})})})]})},"lt"),rt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},dt=s((h,e)=>h.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:h.type!=="number"||!Number.isNaN(Number(e.trim())),"it"),ot=s((h,e)=>{if(h.type==="boolean")return e===!0?{value:!0}:h.required?{value:!1}:void 0;let l=typeof e=="string"?e.trim():"";if(l!==""){if(h.type==="number"){let i=Number(l);return Number.isNaN(i)?void 0:{value:i}}return{value:l}}},"rt"),ct=s(h=>{let e=(0,X.c)(105),{onClose:l,onCreated:i}=h,m=V(),a=q(),{config:c}=qe(),{busy:n,error:d,run:v}=Xe(),[f,C]=(0,x.useState)(""),[y,A]=(0,x.useState)(""),[N,I]=(0,x.useState)(""),[r,u]=(0,x.useState)(""),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let[g,o]=(0,x.useState)(p),F;e[1]===Symbol.for("react.memo_cache_sentinel")?(F=s(b=>{C(b.target.value)},"F"),e[1]=F):F=e[1];let k=F,$;e[2]===Symbol.for("react.memo_cache_sentinel")?($=s(b=>{A(b.target.value)},"E"),e[2]=$):$=e[2];let L=$,_;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=s(b=>{I(b.target.value)},"D"),e[3]=_):_=e[3];let Be=_,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=s(b=>{u(b.target.value)},"Z"),e[4]=Z):Z=e[4];let De=Z,G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=s((b,R)=>{o(K=>({...K,[b]:R}))},"W"),e[5]=G):G=e[5];let _e=G,Y;e[6]!==g?(Y=s(b=>g[b.name]??(b.type==="boolean"?!1:""),"J"),e[6]=g,e[7]=Y):Y=e[7];let P=Y,ee;if(e[8]!==c.userFields||e[9]!==P){let b;e[11]!==P?(b=s(R=>!R.required||dt(R,P(R)),"g"),e[11]=P,e[12]=b):b=e[12],ee=c.userFields.every(b),e[8]=c.userFields,e[9]=P,e[10]=ee}else ee=e[10];let $e=ee,te;e[13]!==n||e[14]!==f||e[15]!==y||e[16]!==$e?(te=!n&&f.trim()!==""&&y.trim()!==""&&$e,e[13]=n,e[14]=f,e[15]=y,e[16]=$e,e[17]=te):te=e[17];let Te=te,ae;e[18]!==c.userFields||e[19]!==P?(ae=s(()=>{let b={};for(let R of c.userFields){let K=ot(R,P(R));K!==void 0&&(b[R.name]=K.value)}return Object.keys(b).length===0?void 0:b},"ee"),e[18]=c.userFields,e[19]=P,e[20]=ae):ae=e[20];let Re=ae,ie;e[21]!==Re||e[22]!==m||e[23]!==f||e[24]!==y||e[25]!==l||e[26]!==i||e[27]!==N||e[28]!==r||e[29]!==v?(ie=s(()=>{v(async()=>{await m.createAuthUser({data:Re(),email:f.trim(),name:y.trim(),password:N===""?void 0:N,role:r.trim()===""?void 0:r.trim()}),i(),l()})},"te"),e[21]=Re,e[22]=m,e[23]=f,e[24]=y,e[25]=l,e[26]=i,e[27]=N,e[28]=r,e[29]=v,e[30]=ie):ie=e[30];let w=ie,B;e[31]!==a?(B=a("Create user"),e[31]=a,e[32]=B):B=e[32];let O;e[33]!==a?(O=a("Create user"),e[33]=a,e[34]=O):O=e[34];let M;e[35]!==O?(M=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:O}),e[35]=O,e[36]=M):M=e[36];let le;e[37]!==a?(le=a("email"),e[37]=a,e[38]=le):le=e[38];let se;e[39]!==le?(se=(0,t.jsx)(j,{htmlFor:"uc-email",children:le}),e[39]=le,e[40]=se):se=e[40];let ne;e[41]!==f?(ne=(0,t.jsx)(E,{"data-testid":"uc-email",id:"uc-email",onChange:k,type:"email",value:f}),e[41]=f,e[42]=ne):ne=e[42];let re;e[43]!==se||e[44]!==ne?(re=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[se,ne]}),e[43]=se,e[44]=ne,e[45]=re):re=e[45];let de;e[46]!==a?(de=a("name"),e[46]=a,e[47]=de):de=e[47];let oe;e[48]!==de?(oe=(0,t.jsx)(j,{htmlFor:"uc-name",children:de}),e[48]=de,e[49]=oe):oe=e[49];let ce;e[50]!==y?(ce=(0,t.jsx)(E,{"data-testid":"uc-name",id:"uc-name",onChange:L,value:y}),e[50]=y,e[51]=ce):ce=e[51];let ue;e[52]!==oe||e[53]!==ce?(ue=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[oe,ce]}),e[52]=oe,e[53]=ce,e[54]=ue):ue=e[54];let he;e[55]!==a?(he=a("Password (optional)"),e[55]=a,e[56]=he):he=e[56];let me;e[57]!==he?(me=(0,t.jsx)(j,{htmlFor:"uc-password",children:he}),e[57]=he,e[58]=me):me=e[58];let pe;e[59]!==N?(pe=(0,t.jsx)(E,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:N}),e[59]=N,e[60]=pe):pe=e[60];let ve;e[61]!==me||e[62]!==pe?(ve=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[me,pe]}),e[61]=me,e[62]=pe,e[63]=ve):ve=e[63];let fe;e[64]!==a?(fe=a("Role (optional)"),e[64]=a,e[65]=fe):fe=e[65];let be;e[66]!==fe?(be=(0,t.jsx)(j,{htmlFor:"uc-role",children:fe}),e[66]=fe,e[67]=be):be=e[67];let xe;e[68]!==r?(xe=(0,t.jsx)(E,{"data-testid":"uc-role",id:"uc-role",onChange:De,value:r}),e[68]=r,e[69]=xe):xe=e[69];let ye;e[70]!==be||e[71]!==xe?(ye=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[be,xe]}),e[70]=be,e[71]=xe,e[72]=ye):ye=e[72];let ge;e[73]!==c.userFields||e[74]!==P||e[75]!==a?(ge=c.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),c.userFields.map(b=>{let R=`uc-field-${b.name}`,K=b.required?"":` (${a("optional")})`;if(b.type==="boolean"){let Le=P(b)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:R,children:[(0,t.jsx)(Ge,{checked:Le,"data-testid":R,id:R,onCheckedChange:s(et=>{_e(b.name,et)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[b.name,K]})]},b.name)}let Je=P(b);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(j,{htmlFor:R,children:[b.name,K]}),(0,t.jsx)(E,{"data-testid":R,id:R,onChange:s(Le=>{_e(b.name,Le.target.value)},"onChange"),type:rt[b.type],value:typeof Je=="string"?Je:""})]},b.name)})]}),e[73]=c.userFields,e[74]=P,e[75]=a,e[76]=ge):ge=e[76];let Ne;e[77]!==d?(Ne=d!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:d}),e[77]=d,e[78]=Ne):Ne=e[78];let ke;e[79]!==a?(ke=a("Cancel"),e[79]=a,e[80]=ke):ke=e[80];let we;e[81]!==l||e[82]!==ke?(we=(0,t.jsx)(U,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:ke}),e[81]=l,e[82]=ke,e[83]=we):we=e[83];let je=!Te,Ce;e[84]!==n||e[85]!==a?(Ce=a(n?"Creating\u2026":"Create"),e[84]=n,e[85]=a,e[86]=Ce):Ce=e[86];let Ae;e[87]!==w||e[88]!==je||e[89]!==Ce?(Ae=(0,t.jsx)(U,{"data-testid":"uc-submit",disabled:je,onClick:w,size:"sm",type:"button",children:Ce}),e[87]=w,e[88]=je,e[89]=Ce,e[90]=Ae):Ae=e[90];let Ie;e[91]!==we||e[92]!==Ae?(Ie=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[we,Ae]}),e[91]=we,e[92]=Ae,e[93]=Ie):Ie=e[93];let Ee;return e[94]!==l||e[95]!==B||e[96]!==M||e[97]!==re||e[98]!==ue||e[99]!==ve||e[100]!==ye||e[101]!==ge||e[102]!==Ne||e[103]!==Ie?(Ee=(0,t.jsxs)(He,{label:B,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[M,re,ue,ve,ye,ge,Ne,Ie]}),e[94]=l,e[95]=B,e[96]=M,e[97]=re,e[98]=ue,e[99]=ve,e[100]=ye,e[101]=ge,e[102]=Ne,e[103]=Ie,e[104]=Ee):Ee=e[104],Ee},"ot"),We=s(h=>{let e=(0,X.c)(2),{children:l}=h,i;return e[0]!==l?(i=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=i):i=e[1],i},"je"),ut=s(h=>{let e=(0,X.c)(29),{busy:l,runAction:i,userId:m,version:a}=h,c=V(),n=q(),[d,v]=(0,x.useState)(null),[f,C]=(0,x.useState)(null),y;e[0]!==c||e[1]!==m?(y=s(()=>{J((async()=>{C(null);try{let k=await c.listAuthSessions({limit:50,userId:m});v(k.rows)}catch(k){let $=k;v(null),C(Pe($))}})())},"b"),e[0]=c,e[1]=m,e[2]=y):y=e[2];let A;e[3]!==c||e[4]!==m||e[5]!==a?(A=[c,m,a],e[3]=c,e[4]=m,e[5]=a,e[6]=A):A=e[6],(0,x.useEffect)(y,A);let N;e[7]!==c||e[8]!==i?(N=s(k=>{i(()=>c.revokeAuthSession({sessionId:k}))},"y"),e[7]=c,e[8]=i,e[9]=N):N=e[9];let I=N,r;e[10]!==n?(r=n("Sessions"),e[10]=n,e[11]=r):r=e[11];let u;e[12]!==r?(u=(0,t.jsx)(We,{children:r}),e[12]=r,e[13]=u):u=e[13];let p;e[14]!==f?(p=f!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:f}),e[14]=f,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==n?(g=d!==null&&d.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:n("No active sessions.")}),e[16]=d,e[17]=n,e[18]=g):g=e[18];let o;e[19]!==l||e[20]!==I||e[21]!==d||e[22]!==n?(o=d!==null&&d.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Se,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:n("expires")}),(0,t.jsx)(S,{children:n("ip")}),(0,t.jsx)(S,{children:n("user agent")}),(0,t.jsx)(S,{"aria-label":n("Actions")})]})}),(0,t.jsx)(Ue,{children:d.map(k=>(0,t.jsxs)(T,{"data-testid":`ud-session-${k.id}`,children:[(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:Q(k.expiresAt)}),(0,t.jsx)(z,{children:k.ipAddress??""}),(0,t.jsx)(z,{className:"max-w-40 truncate",children:k.userAgent??""}),(0,t.jsx)(z,{children:(0,t.jsx)(U,{"data-testid":`ud-revoke-${k.id}`,disabled:l,onClick:s(()=>{I(k.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Revoke")})})]},k.id))})]})})}),e[19]=l,e[20]=I,e[21]=d,e[22]=n,e[23]=o):o=e[23];let F;return e[24]!==u||e[25]!==p||e[26]!==g||e[27]!==o?(F=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[u,p,g,o]}),e[24]=u,e[25]=p,e[26]=g,e[27]=o,e[28]=F):F=e[28],F},"dt"),ht=s(h=>{let e=(0,X.c)(30),{busy:l,runAction:i,userId:m,version:a}=h,c=V(),n=q(),[d,v]=(0,x.useState)(null),[f,C]=(0,x.useState)(null),y;e[0]!==c||e[1]!==m?(y=s(()=>{J((async()=>{C(null);try{v(await c.listAuthAccounts({userId:m}))}catch(k){let $=k;v(null),C(Pe($))}})())},"b"),e[0]=c,e[1]=m,e[2]=y):y=e[2];let A;e[3]!==c||e[4]!==m||e[5]!==a?(A=[c,m,a],e[3]=c,e[4]=m,e[5]=a,e[6]=A):A=e[6],(0,x.useEffect)(y,A);let N;e[7]!==c||e[8]!==i||e[9]!==m?(N=s(k=>{i(()=>c.unlinkAuthAccount({accountId:k,userId:m}))},"y"),e[7]=c,e[8]=i,e[9]=m,e[10]=N):N=e[10];let I=N,r;e[11]!==n?(r=n("Linked accounts"),e[11]=n,e[12]=r):r=e[12];let u;e[13]!==r?(u=(0,t.jsx)(We,{children:r}),e[13]=r,e[14]=u):u=e[14];let p;e[15]!==f?(p=f!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:f}),e[15]=f,e[16]=p):p=e[16];let g;e[17]!==d||e[18]!==n?(g=d!==null&&d.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("No linked accounts.")}),e[17]=d,e[18]=n,e[19]=g):g=e[19];let o;e[20]!==d||e[21]!==l||e[22]!==I||e[23]!==n?(o=d!==null&&d.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Se,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:n("provider")}),(0,t.jsx)(S,{children:n("created")}),(0,t.jsx)(S,{"aria-label":n("Actions")})]})}),(0,t.jsx)(Ue,{children:d.map(k=>{let $=Fe(k.id);return(0,t.jsxs)(T,{"data-testid":`ud-account-${$}`,children:[(0,t.jsx)(z,{children:Fe(k.providerId)}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:Q(k.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(U,{"data-testid":`ud-unlink-${$}`,disabled:l,onClick:s(()=>{I($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Unlink")})})]},$)})})]})})}),e[20]=d,e[21]=l,e[22]=I,e[23]=n,e[24]=o):o=e[24];let F;return e[25]!==u||e[26]!==p||e[27]!==g||e[28]!==o?(F=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[u,p,g,o]}),e[25]=u,e[26]=p,e[27]=g,e[28]=o,e[29]=F):F=e[29],F},"ct"),mt=s(h=>{let e=(0,X.c)(40),{busy:l,capabilities:i,runAction:m,userId:a,version:c}=h,n=V(),d=q(),[v,f]=(0,x.useState)(null),C;e[0]!==i.passkey||e[1]!==n||e[2]!==a?(C=s(()=>{i.passkey&&J((async()=>{try{f(await n.listAuthPasskeys({userId:a}))}catch{f(null)}})())},"C"),e[0]=i.passkey,e[1]=n,e[2]=a,e[3]=C):C=e[3];let y;e[4]!==i.passkey||e[5]!==n||e[6]!==a||e[7]!==c?(y=[i.passkey,n,a,c],e[4]=i.passkey,e[5]=n,e[6]=a,e[7]=c,e[8]=y):y=e[8],(0,x.useEffect)(C,y);let A;e[9]!==n||e[10]!==m||e[11]!==a?(A=s(()=>{m(()=>n.disableAuthTwoFactor({userId:a}))},"A"),e[9]=n,e[10]=m,e[11]=a,e[12]=A):A=e[12];let N=A,I;e[13]!==n||e[14]!==m?(I=s($=>{m(()=>n.deleteAuthPasskey({passkeyId:$}))},"I"),e[13]=n,e[14]=m,e[15]=I):I=e[15];let r=I,u;e[16]!==d?(u=d("Security"),e[16]=d,e[17]=u):u=e[17];let p;e[18]!==u?(p=(0,t.jsx)(We,{children:u}),e[18]=u,e[19]=p):p=e[19];let g;e[20]!==l||e[21]!==i.twoFactor||e[22]!==N||e[23]!==d?(g=i.twoFactor&&(0,t.jsx)(U,{"data-testid":"ud-disable-2fa",disabled:l,onClick:N,size:"sm",type:"button",variant:"outline",children:d("Disable two-factor")}),e[20]=l,e[21]=i.twoFactor,e[22]=N,e[23]=d,e[24]=g):g=e[24];let o;e[25]!==i.passkey||e[26]!==v||e[27]!==d?(o=i.passkey&&v!==null&&v.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:d("No passkeys.")}),e[25]=i.passkey,e[26]=v,e[27]=d,e[28]=o):o=e[28];let F;e[29]!==l||e[30]!==i.passkey||e[31]!==r||e[32]!==v||e[33]!==d?(F=i.passkey&&v!==null&&v.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Se,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:d("name")}),(0,t.jsx)(S,{children:d("created")}),(0,t.jsx)(S,{"aria-label":d("Actions")})]})}),(0,t.jsx)(Ue,{children:v.map($=>{let L=Fe($.id);return(0,t.jsxs)(T,{"data-testid":`ud-passkey-${L}`,children:[(0,t.jsx)(z,{children:Fe($.name)||L}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:Q($.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(U,{"data-testid":`ud-delete-passkey-${L}`,disabled:l,onClick:s(()=>{r(L)},"onClick"),size:"xs",type:"button",variant:"ghost",children:d("Delete")})})]},L)})})]})})}),e[29]=l,e[30]=i.passkey,e[31]=r,e[32]=v,e[33]=d,e[34]=F):F=e[34];let k;return e[35]!==p||e[36]!==g||e[37]!==o||e[38]!==F?(k=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[p,g,o,F]}),e[35]=p,e[36]=g,e[37]=o,e[38]=F,e[39]=k):k=e[39],k},"ut"),pt=/(?:at|expires)$/iu,vt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ft=s((h,e)=>typeof e=="number"&&pt.test(h)?Q(e):Fe(e),"pt"),bt=s(({capabilities:h,onChanged:e,onClose:l,user:i})=>{let m=V(),a=q(),c=i.banned===!0,[n,d]=(0,x.useState)(null),[v,f]=(0,x.useState)(!1),[C,y]=(0,x.useState)(0),[A,N]=(0,x.useState)(typeof i.role=="string"?i.role:""),[I,r]=(0,x.useState)(""),[u,p]=(0,x.useState)(""),[g,o]=(0,x.useState)(""),[F,k]=(0,x.useState)(null),[$,L]=(0,x.useState)(!1),_=s((w,B)=>{J((async()=>{f(!0),d(null);try{let O=await w();B?.refresh!==!1&&(y(M=>M+1),e()),B?.onResult?.(O)}catch(O){d(Pe(O))}f(!1)})())},"D"),Be=s(w=>{N(w.target.value)},"$e"),Z=s(w=>{r(w.target.value)},"Z"),De=s(w=>{p(w.target.value)},"Be"),G=s(w=>{o(w.target.value)},"W"),_e=s(()=>{let w=A.trim();w!==""&&_(async()=>{await m.setAuthUserRole({role:w,userId:i.id})})},"De"),Y=s(()=>{let w=Number.parseInt(u,10),B=Number.isFinite(w)&&w>0?w*86400:void 0;_(async()=>{await m.banAuthUser({expiresInSeconds:B,reason:I.trim()===""?void 0:I.trim(),userId:i.id})})},"J"),P=s(()=>{_(async()=>{await m.unbanAuthUser({userId:i.id})})},"P"),ee=s(()=>{_(async()=>{await m.setAuthUserPassword({newPassword:g,userId:i.id}),o("")})},"K"),$e=s(()=>{_(()=>m.impersonateAuthUser({userId:i.id}),{onResult:s(w=>{k(w.token)},"onResult"),refresh:!1})},"Fe"),te=s(()=>{_(async()=>{await m.revokeAuthUserSessions({userId:i.id})})},"X"),Te=s(()=>{_(async()=>{await m.removeAuthUser({userId:i.id}),l()})},"ze"),ae=s(()=>{L(!0)},"ee"),Re=s(()=>{L(!1)},"Se"),ie=Object.entries(i).filter(([w])=>!vt.has(w));return(0,t.jsxs)(He,{label:a("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:i.name??i.email??i.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:i.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof i.role=="string"&&i.role!==""&&(0,t.jsx)(D,{variant:"secondary",children:i.role}),c?(0,t.jsx)(D,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(D,{variant:"outline",children:a("Active")}),i.emailVerified===!0?(0,t.jsx)(D,{variant:"secondary",children:a("verified")}):(0,t.jsx)(D,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(U,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:n}),h.admin&&(0,t.jsxs)(H,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(W,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(j,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(E,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:A})]}),(0,t.jsx)(U,{"data-testid":"ud-set-role",disabled:v||A.trim()==="",onClick:_e,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),c?(0,t.jsx)(U,{"data-testid":"ud-unban",disabled:v,onClick:P,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(j,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),(0,t.jsx)(E,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:I})]}),(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsx)(j,{htmlFor:"ud-ban-days",children:a("Days")}),(0,t.jsx)(E,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:De,type:"number",value:u})]}),(0,t.jsx)(U,{"data-testid":"ud-ban",disabled:v,onClick:Y,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(j,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(E,{"data-testid":"ud-password",id:"ud-password",onChange:G,type:"password",value:g})]}),(0,t.jsx)(U,{"data-testid":"ud-set-password",disabled:v||g==="",onClick:ee,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(U,{"data-testid":"ud-impersonate",disabled:v,onClick:$e,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(U,{"data-testid":"ud-revoke-all",disabled:v,onClick:te,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),$?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(U,{"data-testid":"ud-delete-confirm",disabled:v,onClick:Te,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(U,{"data-testid":"ud-delete-cancel",onClick:Re,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(U,{"data-testid":"ud-delete",disabled:v,onClick:ae,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),F!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(j,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(E,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:F})]})]})]}),(0,t.jsx)(ut,{busy:v,runAction:_,userId:i.id,version:C}),h.accounts&&(0,t.jsx)(ht,{busy:v,runAction:_,userId:i.id,version:C}),(h.twoFactor||h.passkey)&&(0,t.jsx)(mt,{busy:v,capabilities:h,runAction:_,userId:i.id,version:C}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:ie.map(([w,B])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:w}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:ft(w,B)})]},w))})]})]})},"ft"),xt=50,Bt=s(({pageSize:h=xt}={})=>{let e=V(),l=q(),[i,m]=(0,x.useState)(""),[a,c]=(0,x.useState)(""),n=Ze(i),[d,v]=(0,x.useState)(null),[f,C]=(0,x.useState)(!1),{capabilities:y}=lt(),A=n.trim(),N=a.trim(),I=Ve(["lunora-auth-users",A,N,h],()=>e.listAuthUsers({filterField:N===""?void 0:"role",filterValue:N===""?void 0:N,limit:h,search:A===""?void 0:A}),{keepPreviousData:!0}),r=I.data?.rows??null,u=I.error,p=s(()=>{I.refetch()},"p");Ke(()=>{I.refetch()},!0);let g=d===null?null:r?.find(o=>o.id===d)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(E,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:s(o=>{m(o.target.value)},"onChange"),placeholder:l("Search by email or name\u2026"),value:i}),(0,t.jsx)(E,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:s(o=>{c(o.target.value)},"onChange"),placeholder:l("Filter by role"),value:a}),(0,t.jsx)(U,{"data-testid":"us-new",onClick:s(()=>{C(!0)},"onClick"),size:"sm",type:"button",children:l("New user")})]}),u!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:u}),r!==null&&r.length===0&&(0,t.jsx)(Me,{description:l("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),r!==null&&r.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Se,{"data-testid":"us-table",children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:l("id")}),(0,t.jsx)(S,{children:l("email")}),(0,t.jsx)(S,{children:l("name")}),(0,t.jsx)(S,{children:l("role")}),(0,t.jsx)(S,{children:l("status")}),(0,t.jsx)(S,{children:l("verified")}),(0,t.jsx)(S,{children:l("created")}),(0,t.jsx)(S,{"aria-label":l("Actions")})]})}),(0,t.jsx)(Ue,{children:r.map(o=>(0,t.jsxs)(T,{"data-testid":`us-row-${o.id}`,children:[(0,t.jsx)(z,{className:"font-mono text-xs",children:o.id}),(0,t.jsx)(z,{children:o.email??""}),(0,t.jsx)(z,{children:o.name??""}),(0,t.jsx)(z,{children:typeof o.role=="string"&&o.role!==""?(0,t.jsx)(D,{variant:"secondary",children:o.role}):""}),(0,t.jsx)(z,{children:o.banned===!0?(0,t.jsx)(D,{variant:"destructive",children:l("Banned")}):(0,t.jsx)(D,{variant:"success",children:l("Active")})}),(0,t.jsx)(z,{children:o.emailVerified===!0?(0,t.jsx)(D,{variant:"success",children:l("yes")}):(0,t.jsx)(D,{variant:"outline",children:l("no")})}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:Q(o.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(U,{"data-testid":`us-manage-${o.id}`,onClick:s(()=>{v(o.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},o.id))})]})})}),g!==null&&(0,t.jsx)(bt,{capabilities:y,onChanged:p,onClose:s(()=>{v(null)},"onClose"),user:g}),f&&(0,t.jsx)(ct,{onClose:s(()=>{C(!1)},"onClose"),onCreated:p}),y.inviteOnly&&(0,t.jsx)(nt,{})]})},"zt");export{Bt as UsersPanel};
|
|
1
|
+
import{a as Ge}from"./chunk-VVOVVU53.js";import{a as Qe,b as qe}from"./chunk-XD6I4DFM.js";import{a as Xe}from"./chunk-TIUMFAN2.js";import{a as He}from"./chunk-XZMOZFE6.js";import{a as j}from"./chunk-IMOHEGMV.js";import{a as Ke}from"./chunk-66UGPQVC.js";import{a as Ze}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{P as E}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as U}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as D}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ve}from"./chunk-PQTHMQHP.js";import{f as V}from"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as Me}from"./chunk-FKVZRPV5.js";import{a as Se,b as ze,c as Ue,d as T,e as S,f as z}from"./chunk-HEAQVSNS.js";import{a as H,e as W}from"./chunk-WUWBZPUK.js";import{d as q,h as Pe,n as Fe,o as J,r as Q}from"./chunk-FODLDLE2.js";import{a as s,d as Oe,e as tt,f as at,g as it}from"./chunk-YKXDMIHQ.js";var x=Oe(tt(),1);var X=Oe(at(),1);var t=Oe(it(),1);Qe.capabilities;var lt=s(()=>{let h=(0,X.c)(3),{config:e,ready:l}=qe(),i;return h[0]!==e.capabilities||h[1]!==l?(i={capabilities:e.capabilities,ready:l},h[0]=e.capabilities,h[1]=l,h[2]=i):i=h[2],i},"st"),st=s((h,e)=>typeof h.acceptedAt=="number"?"spent":typeof h.expiresAt=="number"&&h.expiresAt<=e?"expired":"pending","nt"),Ye=500,nt=s(()=>{let h=V(),e=q(),[l,i]=(0,x.useState)(""),[m,a]=(0,x.useState)(null),[c,n]=(0,x.useState)(null),[d,v]=(0,x.useState)(!1),f=Ve(["lunora-auth-sign-up-invitations",Ye],()=>h.listAuthSignUpInvitations({limit:Ye})),C=f.data?.rows??null,y=f.data?.total??0,A=s(()=>{let r=l.trim();r!==""&&(a(null),J((async()=>{try{let u=await h.createAuthSignUpInvitation({email:r}),p=typeof u.token=="string"?u.token:void 0;n(p===void 0?null:`${globalThis.location.origin}/sign-up?email=${encodeURIComponent(r)}&invite=${encodeURIComponent(p)}`),v(!1),i(""),f.refetch()}catch(u){a(u instanceof Error?u.message:String(u))}})()))},"A"),N=s(()=>{let r="navigator"in globalThis?globalThis.navigator.clipboard:void 0;c===null||r===void 0||J(r.writeText(c).then(()=>(v(!0),!0)))},"y"),I=s(r=>{a(null),J((async()=>{try{await h.revokeAuthSignUpInvitation({email:r}),f.refetch()}catch(u){a(u instanceof Error?u.message:String(u))}})())},"I");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"sign-up-invitations",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-base font-medium",children:e("Sign-up invitations")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Only invited addresses can create an account. Nothing is emailed \u2014 send the invitee the one-time link yourself.")})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(E,{"aria-label":e("Email address to invite"),"data-testid":"sign-up-invitation-email",onChange:s(r=>{i(r.target.value)},"onChange"),placeholder:e("ada@example.com"),type:"email",value:l}),(0,t.jsx)(U,{"data-testid":"sign-up-invitation-submit",onClick:A,type:"button",children:e("Invite")})]}),c!==null&&(0,t.jsx)(H,{children:(0,t.jsxs)(W,{className:"flex flex-col gap-2 p-4",children:[(0,t.jsx)("p",{className:"text-sm",children:e("Send this link to the invitee. It is shown once and cannot be recovered.")}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(E,{"data-testid":"sign-up-invitation-link",readOnly:!0,value:c}),(0,t.jsx)(U,{"data-testid":"sign-up-invitation-copy",onClick:N,type:"button",children:e(d?"Copied":"Copy")})]})]})}),(m??f.error)!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sign-up-invitations-error",role:"alert",children:m??f.error}),C!==null&&C.length===0&&(0,t.jsx)(Me,{testId:"sign-up-invitations-empty",title:e("Nobody has been invited yet.")}),C!==null&&y>C.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sign-up-invitations-truncated",children:e("Showing the most recent invitations. Query the signUpInvitation table directly to see the rest.")}),C!==null&&C.length>0&&(0,t.jsx)(H,{children:(0,t.jsx)(W,{className:"p-0",children:(0,t.jsxs)(Se,{children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:e("Email")}),(0,t.jsx)(S,{children:e("Status")}),(0,t.jsx)(S,{children:e("Expires")}),(0,t.jsx)(S,{children:e("Invited by")}),(0,t.jsx)(S,{})]})}),(0,t.jsx)(Ue,{children:C.map(r=>{let u=st(r,Date.now()),p=r.email??"";return(0,t.jsxs)(T,{"data-testid":`sign-up-invitation-${p}`,children:[(0,t.jsx)(z,{children:p}),(0,t.jsxs)(z,{"data-testid":`sign-up-invitation-status-${p}`,children:[u==="spent"&&e("Accepted"),u==="expired"&&e("Expired"),u==="pending"&&e("Pending")]}),(0,t.jsx)(z,{children:typeof r.expiresAt=="number"?Q(r.expiresAt):"\u2014"}),(0,t.jsx)(z,{children:r.invitedBy??"\u2014"}),(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(U,{onClick:s(()=>{I(p)},"onClick"),type:"button",variant:"ghost",children:e("Revoke")})})]},r.id)})})]})})})]})},"lt"),rt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},dt=s((h,e)=>h.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:h.type!=="number"||!Number.isNaN(Number(e.trim())),"it"),ot=s((h,e)=>{if(h.type==="boolean")return e===!0?{value:!0}:h.required?{value:!1}:void 0;let l=typeof e=="string"?e.trim():"";if(l!==""){if(h.type==="number"){let i=Number(l);return Number.isNaN(i)?void 0:{value:i}}return{value:l}}},"rt"),ct=s(h=>{let e=(0,X.c)(105),{onClose:l,onCreated:i}=h,m=V(),a=q(),{config:c}=qe(),{busy:n,error:d,run:v}=Xe(),[f,C]=(0,x.useState)(""),[y,A]=(0,x.useState)(""),[N,I]=(0,x.useState)(""),[r,u]=(0,x.useState)(""),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let[g,o]=(0,x.useState)(p),F;e[1]===Symbol.for("react.memo_cache_sentinel")?(F=s(b=>{C(b.target.value)},"F"),e[1]=F):F=e[1];let k=F,$;e[2]===Symbol.for("react.memo_cache_sentinel")?($=s(b=>{A(b.target.value)},"E"),e[2]=$):$=e[2];let L=$,_;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=s(b=>{I(b.target.value)},"D"),e[3]=_):_=e[3];let Be=_,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=s(b=>{u(b.target.value)},"Z"),e[4]=Z):Z=e[4];let De=Z,G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=s((b,R)=>{o(K=>({...K,[b]:R}))},"W"),e[5]=G):G=e[5];let _e=G,Y;e[6]!==g?(Y=s(b=>g[b.name]??(b.type==="boolean"?!1:""),"J"),e[6]=g,e[7]=Y):Y=e[7];let P=Y,ee;if(e[8]!==c.userFields||e[9]!==P){let b;e[11]!==P?(b=s(R=>!R.required||dt(R,P(R)),"g"),e[11]=P,e[12]=b):b=e[12],ee=c.userFields.every(b),e[8]=c.userFields,e[9]=P,e[10]=ee}else ee=e[10];let $e=ee,te;e[13]!==n||e[14]!==f||e[15]!==y||e[16]!==$e?(te=!n&&f.trim()!==""&&y.trim()!==""&&$e,e[13]=n,e[14]=f,e[15]=y,e[16]=$e,e[17]=te):te=e[17];let Te=te,ae;e[18]!==c.userFields||e[19]!==P?(ae=s(()=>{let b={};for(let R of c.userFields){let K=ot(R,P(R));K!==void 0&&(b[R.name]=K.value)}return Object.keys(b).length===0?void 0:b},"ee"),e[18]=c.userFields,e[19]=P,e[20]=ae):ae=e[20];let Re=ae,ie;e[21]!==Re||e[22]!==m||e[23]!==f||e[24]!==y||e[25]!==l||e[26]!==i||e[27]!==N||e[28]!==r||e[29]!==v?(ie=s(()=>{v(async()=>{await m.createAuthUser({data:Re(),email:f.trim(),name:y.trim(),password:N===""?void 0:N,role:r.trim()===""?void 0:r.trim()}),i(),l()})},"te"),e[21]=Re,e[22]=m,e[23]=f,e[24]=y,e[25]=l,e[26]=i,e[27]=N,e[28]=r,e[29]=v,e[30]=ie):ie=e[30];let w=ie,B;e[31]!==a?(B=a("Create user"),e[31]=a,e[32]=B):B=e[32];let O;e[33]!==a?(O=a("Create user"),e[33]=a,e[34]=O):O=e[34];let M;e[35]!==O?(M=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:O}),e[35]=O,e[36]=M):M=e[36];let le;e[37]!==a?(le=a("email"),e[37]=a,e[38]=le):le=e[38];let se;e[39]!==le?(se=(0,t.jsx)(j,{htmlFor:"uc-email",children:le}),e[39]=le,e[40]=se):se=e[40];let ne;e[41]!==f?(ne=(0,t.jsx)(E,{"data-testid":"uc-email",id:"uc-email",onChange:k,type:"email",value:f}),e[41]=f,e[42]=ne):ne=e[42];let re;e[43]!==se||e[44]!==ne?(re=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[se,ne]}),e[43]=se,e[44]=ne,e[45]=re):re=e[45];let de;e[46]!==a?(de=a("name"),e[46]=a,e[47]=de):de=e[47];let oe;e[48]!==de?(oe=(0,t.jsx)(j,{htmlFor:"uc-name",children:de}),e[48]=de,e[49]=oe):oe=e[49];let ce;e[50]!==y?(ce=(0,t.jsx)(E,{"data-testid":"uc-name",id:"uc-name",onChange:L,value:y}),e[50]=y,e[51]=ce):ce=e[51];let ue;e[52]!==oe||e[53]!==ce?(ue=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[oe,ce]}),e[52]=oe,e[53]=ce,e[54]=ue):ue=e[54];let he;e[55]!==a?(he=a("Password (optional)"),e[55]=a,e[56]=he):he=e[56];let me;e[57]!==he?(me=(0,t.jsx)(j,{htmlFor:"uc-password",children:he}),e[57]=he,e[58]=me):me=e[58];let pe;e[59]!==N?(pe=(0,t.jsx)(E,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:N}),e[59]=N,e[60]=pe):pe=e[60];let ve;e[61]!==me||e[62]!==pe?(ve=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[me,pe]}),e[61]=me,e[62]=pe,e[63]=ve):ve=e[63];let fe;e[64]!==a?(fe=a("Role (optional)"),e[64]=a,e[65]=fe):fe=e[65];let be;e[66]!==fe?(be=(0,t.jsx)(j,{htmlFor:"uc-role",children:fe}),e[66]=fe,e[67]=be):be=e[67];let xe;e[68]!==r?(xe=(0,t.jsx)(E,{"data-testid":"uc-role",id:"uc-role",onChange:De,value:r}),e[68]=r,e[69]=xe):xe=e[69];let ye;e[70]!==be||e[71]!==xe?(ye=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[be,xe]}),e[70]=be,e[71]=xe,e[72]=ye):ye=e[72];let ge;e[73]!==c.userFields||e[74]!==P||e[75]!==a?(ge=c.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),c.userFields.map(b=>{let R=`uc-field-${b.name}`,K=b.required?"":` (${a("optional")})`;if(b.type==="boolean"){let Le=P(b)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:R,children:[(0,t.jsx)(Ge,{checked:Le,"data-testid":R,id:R,onCheckedChange:s(et=>{_e(b.name,et)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[b.name,K]})]},b.name)}let Je=P(b);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(j,{htmlFor:R,children:[b.name,K]}),(0,t.jsx)(E,{"data-testid":R,id:R,onChange:s(Le=>{_e(b.name,Le.target.value)},"onChange"),type:rt[b.type],value:typeof Je=="string"?Je:""})]},b.name)})]}),e[73]=c.userFields,e[74]=P,e[75]=a,e[76]=ge):ge=e[76];let Ne;e[77]!==d?(Ne=d!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:d}),e[77]=d,e[78]=Ne):Ne=e[78];let ke;e[79]!==a?(ke=a("Cancel"),e[79]=a,e[80]=ke):ke=e[80];let we;e[81]!==l||e[82]!==ke?(we=(0,t.jsx)(U,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:ke}),e[81]=l,e[82]=ke,e[83]=we):we=e[83];let je=!Te,Ce;e[84]!==n||e[85]!==a?(Ce=a(n?"Creating\u2026":"Create"),e[84]=n,e[85]=a,e[86]=Ce):Ce=e[86];let Ae;e[87]!==w||e[88]!==je||e[89]!==Ce?(Ae=(0,t.jsx)(U,{"data-testid":"uc-submit",disabled:je,onClick:w,size:"sm",type:"button",children:Ce}),e[87]=w,e[88]=je,e[89]=Ce,e[90]=Ae):Ae=e[90];let Ie;e[91]!==we||e[92]!==Ae?(Ie=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[we,Ae]}),e[91]=we,e[92]=Ae,e[93]=Ie):Ie=e[93];let Ee;return e[94]!==l||e[95]!==B||e[96]!==M||e[97]!==re||e[98]!==ue||e[99]!==ve||e[100]!==ye||e[101]!==ge||e[102]!==Ne||e[103]!==Ie?(Ee=(0,t.jsxs)(He,{label:B,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[M,re,ue,ve,ye,ge,Ne,Ie]}),e[94]=l,e[95]=B,e[96]=M,e[97]=re,e[98]=ue,e[99]=ve,e[100]=ye,e[101]=ge,e[102]=Ne,e[103]=Ie,e[104]=Ee):Ee=e[104],Ee},"ot"),We=s(h=>{let e=(0,X.c)(2),{children:l}=h,i;return e[0]!==l?(i=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=i):i=e[1],i},"je"),ut=s(h=>{let e=(0,X.c)(29),{busy:l,runAction:i,userId:m,version:a}=h,c=V(),n=q(),[d,v]=(0,x.useState)(null),[f,C]=(0,x.useState)(null),y;e[0]!==c||e[1]!==m?(y=s(()=>{J((async()=>{C(null);try{let k=await c.listAuthSessions({limit:50,userId:m});v(k.rows)}catch(k){let $=k;v(null),C(Pe($))}})())},"b"),e[0]=c,e[1]=m,e[2]=y):y=e[2];let A;e[3]!==c||e[4]!==m||e[5]!==a?(A=[c,m,a],e[3]=c,e[4]=m,e[5]=a,e[6]=A):A=e[6],(0,x.useEffect)(y,A);let N;e[7]!==c||e[8]!==i?(N=s(k=>{i(()=>c.revokeAuthSession({sessionId:k}))},"y"),e[7]=c,e[8]=i,e[9]=N):N=e[9];let I=N,r;e[10]!==n?(r=n("Sessions"),e[10]=n,e[11]=r):r=e[11];let u;e[12]!==r?(u=(0,t.jsx)(We,{children:r}),e[12]=r,e[13]=u):u=e[13];let p;e[14]!==f?(p=f!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:f}),e[14]=f,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==n?(g=d!==null&&d.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:n("No active sessions.")}),e[16]=d,e[17]=n,e[18]=g):g=e[18];let o;e[19]!==l||e[20]!==I||e[21]!==d||e[22]!==n?(o=d!==null&&d.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Se,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:n("expires")}),(0,t.jsx)(S,{children:n("ip")}),(0,t.jsx)(S,{children:n("user agent")}),(0,t.jsx)(S,{"aria-label":n("Actions")})]})}),(0,t.jsx)(Ue,{children:d.map(k=>(0,t.jsxs)(T,{"data-testid":`ud-session-${k.id}`,children:[(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:Q(k.expiresAt)}),(0,t.jsx)(z,{children:k.ipAddress??""}),(0,t.jsx)(z,{className:"max-w-40 truncate",children:k.userAgent??""}),(0,t.jsx)(z,{children:(0,t.jsx)(U,{"data-testid":`ud-revoke-${k.id}`,disabled:l,onClick:s(()=>{I(k.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Revoke")})})]},k.id))})]})})}),e[19]=l,e[20]=I,e[21]=d,e[22]=n,e[23]=o):o=e[23];let F;return e[24]!==u||e[25]!==p||e[26]!==g||e[27]!==o?(F=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[u,p,g,o]}),e[24]=u,e[25]=p,e[26]=g,e[27]=o,e[28]=F):F=e[28],F},"dt"),ht=s(h=>{let e=(0,X.c)(30),{busy:l,runAction:i,userId:m,version:a}=h,c=V(),n=q(),[d,v]=(0,x.useState)(null),[f,C]=(0,x.useState)(null),y;e[0]!==c||e[1]!==m?(y=s(()=>{J((async()=>{C(null);try{v(await c.listAuthAccounts({userId:m}))}catch(k){let $=k;v(null),C(Pe($))}})())},"b"),e[0]=c,e[1]=m,e[2]=y):y=e[2];let A;e[3]!==c||e[4]!==m||e[5]!==a?(A=[c,m,a],e[3]=c,e[4]=m,e[5]=a,e[6]=A):A=e[6],(0,x.useEffect)(y,A);let N;e[7]!==c||e[8]!==i||e[9]!==m?(N=s(k=>{i(()=>c.unlinkAuthAccount({accountId:k,userId:m}))},"y"),e[7]=c,e[8]=i,e[9]=m,e[10]=N):N=e[10];let I=N,r;e[11]!==n?(r=n("Linked accounts"),e[11]=n,e[12]=r):r=e[12];let u;e[13]!==r?(u=(0,t.jsx)(We,{children:r}),e[13]=r,e[14]=u):u=e[14];let p;e[15]!==f?(p=f!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:f}),e[15]=f,e[16]=p):p=e[16];let g;e[17]!==d||e[18]!==n?(g=d!==null&&d.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("No linked accounts.")}),e[17]=d,e[18]=n,e[19]=g):g=e[19];let o;e[20]!==d||e[21]!==l||e[22]!==I||e[23]!==n?(o=d!==null&&d.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Se,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:n("provider")}),(0,t.jsx)(S,{children:n("created")}),(0,t.jsx)(S,{"aria-label":n("Actions")})]})}),(0,t.jsx)(Ue,{children:d.map(k=>{let $=Fe(k.id);return(0,t.jsxs)(T,{"data-testid":`ud-account-${$}`,children:[(0,t.jsx)(z,{children:Fe(k.providerId)}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:Q(k.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(U,{"data-testid":`ud-unlink-${$}`,disabled:l,onClick:s(()=>{I($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Unlink")})})]},$)})})]})})}),e[20]=d,e[21]=l,e[22]=I,e[23]=n,e[24]=o):o=e[24];let F;return e[25]!==u||e[26]!==p||e[27]!==g||e[28]!==o?(F=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[u,p,g,o]}),e[25]=u,e[26]=p,e[27]=g,e[28]=o,e[29]=F):F=e[29],F},"ct"),mt=s(h=>{let e=(0,X.c)(40),{busy:l,capabilities:i,runAction:m,userId:a,version:c}=h,n=V(),d=q(),[v,f]=(0,x.useState)(null),C;e[0]!==i.passkey||e[1]!==n||e[2]!==a?(C=s(()=>{i.passkey&&J((async()=>{try{f(await n.listAuthPasskeys({userId:a}))}catch{f(null)}})())},"C"),e[0]=i.passkey,e[1]=n,e[2]=a,e[3]=C):C=e[3];let y;e[4]!==i.passkey||e[5]!==n||e[6]!==a||e[7]!==c?(y=[i.passkey,n,a,c],e[4]=i.passkey,e[5]=n,e[6]=a,e[7]=c,e[8]=y):y=e[8],(0,x.useEffect)(C,y);let A;e[9]!==n||e[10]!==m||e[11]!==a?(A=s(()=>{m(()=>n.disableAuthTwoFactor({userId:a}))},"A"),e[9]=n,e[10]=m,e[11]=a,e[12]=A):A=e[12];let N=A,I;e[13]!==n||e[14]!==m?(I=s($=>{m(()=>n.deleteAuthPasskey({passkeyId:$}))},"I"),e[13]=n,e[14]=m,e[15]=I):I=e[15];let r=I,u;e[16]!==d?(u=d("Security"),e[16]=d,e[17]=u):u=e[17];let p;e[18]!==u?(p=(0,t.jsx)(We,{children:u}),e[18]=u,e[19]=p):p=e[19];let g;e[20]!==l||e[21]!==i.twoFactor||e[22]!==N||e[23]!==d?(g=i.twoFactor&&(0,t.jsx)(U,{"data-testid":"ud-disable-2fa",disabled:l,onClick:N,size:"sm",type:"button",variant:"outline",children:d("Disable two-factor")}),e[20]=l,e[21]=i.twoFactor,e[22]=N,e[23]=d,e[24]=g):g=e[24];let o;e[25]!==i.passkey||e[26]!==v||e[27]!==d?(o=i.passkey&&v!==null&&v.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:d("No passkeys.")}),e[25]=i.passkey,e[26]=v,e[27]=d,e[28]=o):o=e[28];let F;e[29]!==l||e[30]!==i.passkey||e[31]!==r||e[32]!==v||e[33]!==d?(F=i.passkey&&v!==null&&v.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Se,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:d("name")}),(0,t.jsx)(S,{children:d("created")}),(0,t.jsx)(S,{"aria-label":d("Actions")})]})}),(0,t.jsx)(Ue,{children:v.map($=>{let L=Fe($.id);return(0,t.jsxs)(T,{"data-testid":`ud-passkey-${L}`,children:[(0,t.jsx)(z,{children:Fe($.name)||L}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:Q($.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(U,{"data-testid":`ud-delete-passkey-${L}`,disabled:l,onClick:s(()=>{r(L)},"onClick"),size:"xs",type:"button",variant:"ghost",children:d("Delete")})})]},L)})})]})})}),e[29]=l,e[30]=i.passkey,e[31]=r,e[32]=v,e[33]=d,e[34]=F):F=e[34];let k;return e[35]!==p||e[36]!==g||e[37]!==o||e[38]!==F?(k=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[p,g,o,F]}),e[35]=p,e[36]=g,e[37]=o,e[38]=F,e[39]=k):k=e[39],k},"ut"),pt=/(?:at|expires)$/iu,vt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ft=s((h,e)=>typeof e=="number"&&pt.test(h)?Q(e):Fe(e),"pt"),bt=s(({capabilities:h,onChanged:e,onClose:l,user:i})=>{let m=V(),a=q(),c=i.banned===!0,[n,d]=(0,x.useState)(null),[v,f]=(0,x.useState)(!1),[C,y]=(0,x.useState)(0),[A,N]=(0,x.useState)(typeof i.role=="string"?i.role:""),[I,r]=(0,x.useState)(""),[u,p]=(0,x.useState)(""),[g,o]=(0,x.useState)(""),[F,k]=(0,x.useState)(null),[$,L]=(0,x.useState)(!1),_=s((w,B)=>{J((async()=>{f(!0),d(null);try{let O=await w();B?.refresh!==!1&&(y(M=>M+1),e()),B?.onResult?.(O)}catch(O){d(Pe(O))}f(!1)})())},"D"),Be=s(w=>{N(w.target.value)},"$e"),Z=s(w=>{r(w.target.value)},"Z"),De=s(w=>{p(w.target.value)},"Be"),G=s(w=>{o(w.target.value)},"W"),_e=s(()=>{let w=A.trim();w!==""&&_(async()=>{await m.setAuthUserRole({role:w,userId:i.id})})},"De"),Y=s(()=>{let w=Number.parseInt(u,10),B=Number.isFinite(w)&&w>0?w*86400:void 0;_(async()=>{await m.banAuthUser({expiresInSeconds:B,reason:I.trim()===""?void 0:I.trim(),userId:i.id})})},"J"),P=s(()=>{_(async()=>{await m.unbanAuthUser({userId:i.id})})},"P"),ee=s(()=>{_(async()=>{await m.setAuthUserPassword({newPassword:g,userId:i.id}),o("")})},"K"),$e=s(()=>{_(()=>m.impersonateAuthUser({userId:i.id}),{onResult:s(w=>{k(w.token)},"onResult"),refresh:!1})},"Fe"),te=s(()=>{_(async()=>{await m.revokeAuthUserSessions({userId:i.id})})},"X"),Te=s(()=>{_(async()=>{await m.removeAuthUser({userId:i.id}),l()})},"ze"),ae=s(()=>{L(!0)},"ee"),Re=s(()=>{L(!1)},"Se"),ie=Object.entries(i).filter(([w])=>!vt.has(w));return(0,t.jsxs)(He,{label:a("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:i.name??i.email??i.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:i.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof i.role=="string"&&i.role!==""&&(0,t.jsx)(D,{variant:"secondary",children:i.role}),c?(0,t.jsx)(D,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(D,{variant:"outline",children:a("Active")}),i.emailVerified===!0?(0,t.jsx)(D,{variant:"secondary",children:a("verified")}):(0,t.jsx)(D,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(U,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:n}),h.admin&&(0,t.jsxs)(H,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(W,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(j,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(E,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:A})]}),(0,t.jsx)(U,{"data-testid":"ud-set-role",disabled:v||A.trim()==="",onClick:_e,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),c?(0,t.jsx)(U,{"data-testid":"ud-unban",disabled:v,onClick:P,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(j,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),(0,t.jsx)(E,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:I})]}),(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsx)(j,{htmlFor:"ud-ban-days",children:a("Days")}),(0,t.jsx)(E,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:De,type:"number",value:u})]}),(0,t.jsx)(U,{"data-testid":"ud-ban",disabled:v,onClick:Y,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(j,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(E,{"data-testid":"ud-password",id:"ud-password",onChange:G,type:"password",value:g})]}),(0,t.jsx)(U,{"data-testid":"ud-set-password",disabled:v||g==="",onClick:ee,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(U,{"data-testid":"ud-impersonate",disabled:v,onClick:$e,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(U,{"data-testid":"ud-revoke-all",disabled:v,onClick:te,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),$?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(U,{"data-testid":"ud-delete-confirm",disabled:v,onClick:Te,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(U,{"data-testid":"ud-delete-cancel",onClick:Re,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(U,{"data-testid":"ud-delete",disabled:v,onClick:ae,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),F!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(j,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(E,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:F})]})]})]}),(0,t.jsx)(ut,{busy:v,runAction:_,userId:i.id,version:C}),h.accounts&&(0,t.jsx)(ht,{busy:v,runAction:_,userId:i.id,version:C}),(h.twoFactor||h.passkey)&&(0,t.jsx)(mt,{busy:v,capabilities:h,runAction:_,userId:i.id,version:C}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:ie.map(([w,B])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:w}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:ft(w,B)})]},w))})]})]})},"ft"),xt=50,Bt=s(({pageSize:h=xt}={})=>{let e=V(),l=q(),[i,m]=(0,x.useState)(""),[a,c]=(0,x.useState)(""),n=Ze(i),[d,v]=(0,x.useState)(null),[f,C]=(0,x.useState)(!1),{capabilities:y}=lt(),A=n.trim(),N=a.trim(),I=Ve(["lunora-auth-users",A,N,h],()=>e.listAuthUsers({filterField:N===""?void 0:"role",filterValue:N===""?void 0:N,limit:h,search:A===""?void 0:A}),{keepPreviousData:!0}),r=I.data?.rows??null,u=I.error,p=s(()=>{I.refetch()},"p");Ke(()=>{I.refetch()},!0);let g=d===null?null:r?.find(o=>o.id===d)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(E,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:s(o=>{m(o.target.value)},"onChange"),placeholder:l("Search by email or name\u2026"),value:i}),(0,t.jsx)(E,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:s(o=>{c(o.target.value)},"onChange"),placeholder:l("Filter by role"),value:a}),(0,t.jsx)(U,{"data-testid":"us-new",onClick:s(()=>{C(!0)},"onClick"),size:"sm",type:"button",children:l("New user")})]}),u!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:u}),r!==null&&r.length===0&&(0,t.jsx)(Me,{description:l("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),r!==null&&r.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Se,{"data-testid":"us-table",children:[(0,t.jsx)(ze,{children:(0,t.jsxs)(T,{children:[(0,t.jsx)(S,{children:l("id")}),(0,t.jsx)(S,{children:l("email")}),(0,t.jsx)(S,{children:l("name")}),(0,t.jsx)(S,{children:l("role")}),(0,t.jsx)(S,{children:l("status")}),(0,t.jsx)(S,{children:l("verified")}),(0,t.jsx)(S,{children:l("created")}),(0,t.jsx)(S,{"aria-label":l("Actions")})]})}),(0,t.jsx)(Ue,{children:r.map(o=>(0,t.jsxs)(T,{"data-testid":`us-row-${o.id}`,children:[(0,t.jsx)(z,{className:"font-mono text-xs",children:o.id}),(0,t.jsx)(z,{children:o.email??""}),(0,t.jsx)(z,{children:o.name??""}),(0,t.jsx)(z,{children:typeof o.role=="string"&&o.role!==""?(0,t.jsx)(D,{variant:"secondary",children:o.role}):""}),(0,t.jsx)(z,{children:o.banned===!0?(0,t.jsx)(D,{variant:"destructive",children:l("Banned")}):(0,t.jsx)(D,{variant:"success",children:l("Active")})}),(0,t.jsx)(z,{children:o.emailVerified===!0?(0,t.jsx)(D,{variant:"success",children:l("yes")}):(0,t.jsx)(D,{variant:"outline",children:l("no")})}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:Q(o.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(U,{"data-testid":`us-manage-${o.id}`,onClick:s(()=>{v(o.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},o.id))})]})})}),g!==null&&(0,t.jsx)(bt,{capabilities:y,onChanged:p,onClose:s(()=>{v(null)},"onClose"),user:g}),f&&(0,t.jsx)(ct,{onClose:s(()=>{C(!1)},"onClose"),onCreated:p}),y.inviteOnly&&(0,t.jsx)(nt,{})]})},"zt");export{Bt as UsersPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as T}from"./chunk-ULIQFBZU.js";import{a as S}from"./chunk-
|
|
1
|
+
import{a as T}from"./chunk-ULIQFBZU.js";import{a as S}from"./chunk-5QTPE32B.js";import{b as q}from"./chunk-35DM4JJG.js";import{b as I}from"./chunk-3LTNH237.js";import{d as A,h as E,j as H,k as O}from"./chunk-FODLDLE2.js";import{a as j,d as C,f as U,g as _}from"./chunk-YKXDMIHQ.js";var V=C(U(),1);var i=C(_(),1);var L=j(G=>{let e=(0,V.c)(38),{className:w,error:t,testId:N}=G,g=A(),r=q(),l,s,n,a,c,m,o,d;if(e[0]!==w||e[1]!==t||e[2]!==r||e[3]!==N){let y=H(t),b;e[12]!==t?(b=O(t),e[12]=t,e[13]=b):b=e[13],s=b;let x;e[14]!==t?(x=S(t),e[14]=t,e[15]=x):x=e[15];let k=x,v;e[16]!==r||e[17]!==k?(v=j(()=>{r?.openConsole({errorsOnly:!0,seq:k})},"x"),e[16]=r,e[17]=k,e[18]=v):v=e[18],n=v,l=T,a=w,c=N,m="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(o=(0,i.jsx)("p",{className:"font-medium",children:u}),e[21]=u,e[22]=o):o=e[22],d=y===void 0?null:(0,i.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(y)}),e[0]=w,e[1]=t,e[2]=r,e[3]=N,e[4]=l,e[5]=s,e[6]=n,e[7]=a,e[8]=c,e[9]=m,e[10]=o,e[11]=d}else l=e[4],s=e[5],n=e[6],a=e[7],c=e[8],m=e[9],o=e[10],d=e[11];let p;e[23]!==s?(p=s===void 0?null:(0,i.jsx)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:s,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=s,e[24]=p):p=e[24];let f;e[25]!==r||e[26]!==n||e[27]!==g?(f=r===void 0?null:(0,i.jsx)("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:n,type:"button",children:g("Show in console")}),e[25]=r,e[26]=n,e[27]=g,e[28]=f):f=e[28];let h;return e[29]!==l||e[30]!==a||e[31]!==c||e[32]!==m||e[33]!==o||e[34]!==d||e[35]!==p||e[36]!==f?(h=(0,i.jsxs)(l,{className:a,testId:c,variant:m,children:[o,d,p,f]}),e[29]=l,e[30]=a,e[31]=c,e[32]=m,e[33]=o,e[34]=d,e[35]=p,e[36]=f,e[37]=h):h=e[37],h},"G");export{L as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as re}from"./chunk-BOTGXX4H.js";import{a as X}from"./chunk-S3CRZLGS.js";import{a as V}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as R}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as O}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Y}from"./chunk-
|
|
1
|
+
import{a as re}from"./chunk-BOTGXX4H.js";import{a as X}from"./chunk-S3CRZLGS.js";import{a as V}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as R}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as O}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Y}from"./chunk-OBRWA7NJ.js";import"./chunk-ULIQFBZU.js";import"./chunk-5QTPE32B.js";import"./chunk-35DM4JJG.js";import{a as Q}from"./chunk-4ZEL6BYL.js";import{c as J}from"./chunk-PQTHMQHP.js";import"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as G}from"./chunk-FKVZRPV5.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-HEAQVSNS.js";import{a as U,e as W}from"./chunk-WUWBZPUK.js";import{d as z,r as H}from"./chunk-FODLDLE2.js";import{a as l,d as B,e as de,f as me,g as he,i as L}from"./chunk-YKXDMIHQ.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ee=l(r=>{let e=(0,se.c)(47),{functions:K,initialShardKey:ne}=r,s=z(),{queryShardKey:_,setShardKey:N,shardKey:v}=X(ne),[i,oe]=(0,le.useState)("recent"),w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];let C;e[1]!==_?(C={live:!0,shardKey:_},e[1]=_,e[2]=C):C=e[2];let{data:ie,error:c,errorSource:S,liveError:b}=J(Q.getFunctionStats,w,C),k=ie?.functions??null,$;e[3]!==K?($=new Map((K??[]).map(ge)),e[3]=K,e[4]=$):$=e[4];let T=$,F;e[5]===Symbol.for("react.memo_cache_sentinel")?(F=l(M=>{oe(M.currentTarget.dataset.sort)},"E"),e[5]=F):F=e[5];let ce=F,I;if(e[6]!==c||e[7]!==S||e[8]!==T||e[9]!==b||e[10]!==N||e[11]!==v||e[12]!==i||e[13]!==k||e[14]!==s){let M=k===null?[]:k.toSorted(xe[i]),d;e[16]!==s?(d=s("Recent"),e[16]=s,e[17]=d):d=e[17];let m;e[18]!==d?(m={key:"recent",label:d},e[18]=d,e[19]=m):m=e[19];let h;e[20]!==s?(h=s("Most called"),e[20]=s,e[21]=h):h=e[21];let u;e[22]!==h?(u={key:"calls",label:h},e[22]=h,e[23]=u):u=e[23];let f;e[24]!==s?(f=s("Slowest"),e[24]=s,e[25]=f):f=e[25];let p;e[26]!==f?(p={key:"slowest",label:f},e[26]=f,e[27]=p):p=e[27];let A;e[28]!==p||e[29]!==m||e[30]!==u?(A=[m,u,p],e[28]=p,e[29]=m,e[30]=u,e[31]=A):A=e[31];let j=A,x;e[32]!==N||e[33]!==v?(x=(0,t.jsx)(V,{onChange:N,testId:"fs-shard-input",value:v}),e[32]=N,e[33]=v,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsx)(re,{message:b,prefix:"fs"}),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==j||e[38]!==i?(y=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(R,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:i===a.key?"secondary":"ghost",children:a.label},a.key))}),e[37]=j,e[38]=i,e[39]=y):y=e[39];let D;e[40]!==x||e[41]!==g||e[42]!==y?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]}),e[40]=x,e[41]=g,e[42]=y,e[43]=D):D=e[43];let E;e[44]!==c||e[45]!==S?(E=c!==null&&(0,t.jsx)(Y,{error:S,testId:"fs-error"}),e[44]=c,e[45]=S,e[46]=E):E=e[46],I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,k!==null&&M.length===0&&c===null&&(0,t.jsx)(G,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),M.length>0&&(0,t.jsx)(U,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:M.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(O,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:H(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=c,e[7]=S,e[8]=T,e[9]=b,e[10]=N,e[11]=v,e[12]=i,e[13]=k,e[14]=s,e[15]=I}else I=e[15];return I},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{Ee as FunctionStatsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as K}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as Q}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{f as z}from"./chunk-
|
|
1
|
+
import{P as K}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as Q}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{f as z}from"./chunk-BCBNKE7J.js";import"./chunk-FSRSK4LY.js";import"./chunk-3LTNH237.js";import{a as W}from"./chunk-FKVZRPV5.js";import{a as q,b as B,c as L,d as f,e as c,f as d}from"./chunk-HEAQVSNS.js";import{a as I,e as j}from"./chunk-WUWBZPUK.js";import{d as F,h as S,n as Z,o as V}from"./chunk-FODLDLE2.js";import{a as h,d as C,e as U,f as G,g as J}from"./chunk-YKXDMIHQ.js";var A=C(G(),1);var n=C(U(),1);var e=C(J(),1);var X=10,g=h(v=>{let l=(0,A.c)(7),{label:m,value:a}=v,r;l[0]!==m?(r=(0,e.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),l[0]=m,l[1]=r):r=l[1];let p=a??"\u2014",s;l[2]!==p?(s=(0,e.jsx)("span",{className:"font-mono text-sm",children:p}),l[2]=p,l[3]=s):s=l[3];let u;return l[4]!==r||l[5]!==s?(u=(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,s]}),l[4]=r,l[5]=s,l[6]=u):u=l[6],u},"g"),se=h(({loadIndexes:v,runQuery:l}={})=>{let m=z(),a=F(),[r,p]=(0,n.useState)(null),[s,u]=(0,n.useState)(null),[N,E]=(0,n.useState)(null),[b,D]=(0,n.useState)(""),[x,y]=(0,n.useState)(null),[M,w]=(0,n.useState)(null),[T,$]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let t={cancelled:!1};return V((async()=>{try{let i=await(v??(()=>m.listVectorIndexes()))();t.cancelled||(p(i),u(null),E(k=>k??i[0]?.name??null))}catch(i){t.cancelled||(p(null),u(S(i)))}})()),()=>{t.cancelled=!0}},[m,v]);let o=r?.find(t=>t.name===N)??null,H=h(t=>{E(t.currentTarget.dataset.index??null),y(null),w(null)},"Q"),O=h(t=>{D(t.target.value)},"$"),P=h(async()=>{let t=b.trim();if(!(N===null||t==="")){$(!0),w(null);try{let i=await(l??(k=>m.queryVectorIndex(k)))({name:N,text:t,topK:X});y(i)}catch(i){y(null),w(S(i))}$(!1)}},"A"),R=h(()=>{V(P())},"D");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[s!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:s}),r!==null&&r.length===0&&(0,e.jsx)(W,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:a("No vector indexes.")}),r!==null&&r.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-table",children:[(0,e.jsx)(B,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:a("name")}),(0,e.jsx)(c,{children:a("table")}),(0,e.jsx)(c,{children:a("dimensions")}),(0,e.jsx)(c,{children:a("metric")}),(0,e.jsx)(c,{children:a("vectors")})]})}),(0,e.jsx)(L,{children:r.map(t=>(0,e.jsxs)(f,{className:t.name===N?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:H,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.table}),(0,e.jsx)(d,{className:"tabular-nums",children:t.dimensions??"\u2014"}),(0,e.jsx)(d,{children:t.metric??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:t.vectorsCount??"\u2014"})]},t.name))})]})})}),o!==null&&(0,e.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsx)(g,{label:a("field"),value:o.field}),(0,e.jsx)(g,{label:a("dimensions"),value:o.dimensions}),(0,e.jsx)(g,{label:a("metric"),value:o.metric}),(0,e.jsx)(g,{label:a("vectors"),value:o.vectorsCount})]}),o.metadata!==void 0&&o.metadata.length>0&&(0,e.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsx)("span",{className:"font-mono",children:o.metadata.join(", ")})]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsx)(K,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:O,placeholder:a("Search by similarity\u2026"),value:b}),(0,e.jsx)(Q,{"data-testid":"vector-search",disabled:T||b.trim()==="",onClick:R,children:a(T?"Searching\u2026":"Search")})]}),M!==null&&(0,e.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M}),x!==null&&x.length===0&&(0,e.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")}),x!==null&&x.length>0&&(0,e.jsx)(I,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-matches",children:[(0,e.jsx)(B,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:a("id")}),(0,e.jsx)(c,{children:a("score")}),(0,e.jsx)(c,{children:a("metadata")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(f,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.id}),(0,e.jsx)(d,{className:"tabular-nums",children:t.score.toFixed(4)}),(0,e.jsx)(d,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":Z(t.metadata)})]},t.id))})]})})})]})]})},"se");export{se as VectorBrowser};
|