@lunora/studio 1.0.0-alpha.40 → 1.0.0-alpha.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/standalone/{chunk-AAVIFQ4Y.js → chunk-25AYY4H7.js} +1 -1
  2. package/dist/standalone/{chunk-Q52CHOSY.js → chunk-2ANAF4ZM.js} +1 -1
  3. package/dist/standalone/{chunk-BKW7FFEO.js → chunk-3OIHOXVV.js} +1 -1
  4. package/dist/standalone/{chunk-AJFQ3LNM.js → chunk-447TAUFD.js} +1 -1
  5. package/dist/standalone/{chunk-SSI4G2MY.js → chunk-5C4TSNE6.js} +1 -1
  6. package/dist/standalone/{chunk-DC72CQY4.js → chunk-6HSHEMZV.js} +1 -1
  7. package/dist/standalone/{chunk-676HEBIR.js → chunk-6JIZ34MB.js} +1 -1
  8. package/dist/standalone/{chunk-YTO65GHS.js → chunk-7MVSQS7B.js} +1 -1
  9. package/dist/standalone/{chunk-P5HJXCZS.js → chunk-BX5MKYOC.js} +1 -1
  10. package/dist/standalone/{chunk-V6IWFYAQ.js → chunk-EQZQOTJY.js} +1 -1
  11. package/dist/standalone/{chunk-ZE6FT5Z3.js → chunk-GTLEWM5Y.js} +1 -1
  12. package/dist/standalone/{chunk-N746FOQP.js → chunk-GUI5GFFI.js} +1 -1
  13. package/dist/standalone/{chunk-CACB34RQ.js → chunk-HN6KJXYQ.js} +1 -1
  14. package/dist/standalone/{chunk-J46WXQYL.js → chunk-HYDJNCGW.js} +1 -1
  15. package/dist/standalone/{chunk-DECHEGIC.js → chunk-HZK5RQHG.js} +1 -1
  16. package/dist/standalone/{chunk-FSGCANAU.js → chunk-IN2SYVJB.js} +1 -1
  17. package/dist/standalone/{chunk-JVODY4EP.js → chunk-IOANPSJN.js} +1 -1
  18. package/dist/standalone/{chunk-NC6MBMSI.js → chunk-ISDZPW3V.js} +1 -1
  19. package/dist/standalone/{chunk-QDBOPDJ7.js → chunk-J73VHFCL.js} +1 -1
  20. package/dist/standalone/{chunk-GMSGZDDH.js → chunk-JHKMUTIF.js} +5 -5
  21. package/dist/standalone/{chunk-CICVBMEN.js → chunk-JPRH6DPK.js} +1 -1
  22. package/dist/standalone/{chunk-PTS5TW3J.js → chunk-KA5YB3VP.js} +1 -1
  23. package/dist/standalone/{chunk-SG3ALJJU.js → chunk-KBB75WNT.js} +1 -1
  24. package/dist/standalone/{chunk-LYB5L53X.js → chunk-KQV4NGH3.js} +1 -1
  25. package/dist/standalone/{chunk-I7ZZRM7I.js → chunk-KUH4P5F5.js} +1 -1
  26. package/dist/standalone/{chunk-5ZAA2PVR.js → chunk-KYJPPVGB.js} +1 -1
  27. package/dist/standalone/{chunk-HZTGDL4L.js → chunk-L2TJVSDQ.js} +1 -1
  28. package/dist/standalone/{chunk-ERJNDIXC.js → chunk-LBN7LPVK.js} +1 -1
  29. package/dist/standalone/{chunk-NY6GDADQ.js → chunk-MLZYX5CQ.js} +1 -1
  30. package/dist/standalone/{chunk-TH45YG6Q.js → chunk-N2X2OO4V.js} +1 -1
  31. package/dist/standalone/{chunk-BXOYVWJR.js → chunk-NGKITPQP.js} +1 -1
  32. package/dist/standalone/{chunk-YNZ7ARWW.js → chunk-OZACQNKG.js} +1 -1
  33. package/dist/standalone/{chunk-NN27EDQB.js → chunk-PNDNXS5Z.js} +1 -1
  34. package/dist/standalone/{chunk-CWEAJUHW.js → chunk-Q7DMUTUE.js} +1 -1
  35. package/dist/standalone/{chunk-C7WTJLC3.js → chunk-RHZ4M2NZ.js} +1 -1
  36. package/dist/standalone/{chunk-QHFTGJPS.js → chunk-TDZ44E5I.js} +1 -1
  37. package/dist/standalone/{chunk-X33MSJPP.js → chunk-THNBTMUF.js} +1 -1
  38. package/dist/standalone/{chunk-FKACHRWO.js → chunk-TIQISBGK.js} +1 -1
  39. package/dist/standalone/{chunk-H6RKXQZU.js → chunk-TMYVNQ66.js} +1 -1
  40. package/dist/standalone/{chunk-AJULNB46.js → chunk-UJB2LEI4.js} +1 -1
  41. package/dist/standalone/{chunk-23C4TCRO.js → chunk-W3JK4YWR.js} +1 -1
  42. package/dist/standalone/{chunk-MT2J3H7O.js → chunk-W3SHEIAL.js} +2 -2
  43. package/dist/standalone/chunk-WIHXMNUY.js +1 -0
  44. package/dist/standalone/{chunk-XRNXOIVZ.js → chunk-WLDVXVI2.js} +1 -1
  45. package/dist/standalone/{chunk-GLUNBZRI.js → chunk-XLXNLJ4N.js} +1 -1
  46. package/dist/standalone/{chunk-OY3HD7BJ.js → chunk-YJAPWSDC.js} +1 -1
  47. package/dist/standalone/{chunk-7RE5UW27.js → chunk-ZEJB6DXU.js} +1 -1
  48. package/dist/standalone/{chunk-V7SRH36W.js → chunk-ZFNBPAIZ.js} +1 -1
  49. package/dist/standalone/studio.js +1 -1
  50. package/package.json +6 -6
  51. package/dist/standalone/chunk-WPNXY7IS.js +0 -1
@@ -1 +1 @@
1
- import{a as At,b as re}from"./chunk-PTS5TW3J.js";import{a as Dt}from"./chunk-AHILM3ZP.js";import{a as It}from"./chunk-J6J54MBP.js";import{a as pt,b as yt,c as Ct,d as Ze,e as ae,f as ne}from"./chunk-GTM65MVX.js";import{a as xt}from"./chunk-VLXV72QE.js";import{a as zt}from"./chunk-JSEXCW5Q.js";import{R as Y}from"./chunk-3CJW6NWG.js";import{c as E}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as me}from"./chunk-TAD43CG5.js";import{a as ce}from"./chunk-C7WTJLC3.js";import{a as ht,e as bt}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as ie}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as X,j as z,k as St,o as Nt}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a as n,e as vt,f as Rt,g as Et,h as Lt}from"./chunk-RRCPZMC2.js";var W=vt(Et(),1);var L=vt(Rt(),1);var o=vt(Lt(),1);var Tt=n(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"parseJsonObject"),jt=n(t=>{let e=Tt(t),l={};for(let[d,f]of Object.entries(e)){if(!Array.isArray(f)||f.some(r=>typeof r!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=f}return l},"parsePermission"),Mt=n(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jsonInitial"),K=n(t=>{let e=(0,W.c)(6),{children:l,htmlFor:d,label:f}=t,r;e[0]!==d||e[1]!==f?(r=(0,o.jsxDEV)(zt,{htmlFor:d,children:f},void 0,!1),e[0]=d,e[1]=f,e[2]=r):r=e[2];let i;return e[3]!==l||e[4]!==r?(i=(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,l]},void 0,!0),e[3]=l,e[4]=r,e[5]=i):i=e[5],i},"Field"),de=n(({busy:t,canSubmit:e,children:l,destructive:d=!1,error:f,onClose:r,onSubmit:i,submitLabel:s,testId:a,title:m})=>{let c=X();return(0,o.jsxDEV)(Dt,{label:m,onClose:r,panelTestId:`${a}-panel`,testId:`${a}-overlay`,variant:"dialog",children:[(0,o.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:m},void 0,!1),l,f!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${a}-error`,role:"alert",children:f},void 0,!1),(0,o.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,o.jsxDEV)(E,{"data-testid":`${a}-cancel`,onClick:r,size:"sm",type:"button",variant:"outline",children:c("Cancel")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`${a}-submit`,disabled:t||!e,onClick:i,size:"sm",type:"button",variant:d?"destructive":"default",children:t?c("Saving\u2026"):s},void 0,!1)]},void 0,!0)]},void 0,!0)},"DialogForm"),Ot=n(t=>{let e=(0,W.c)(79),{mode:l,onClose:d,onDone:f,org:r}=t,i=ie(),s=X(),{busy:a,error:m,run:c}=re(),k;e[0]!==r?(k=r?z(r.name):"",e[0]=r,e[1]=k):k=e[1];let[u,g]=(0,L.useState)(k),y;e[2]!==r?(y=r?z(r.slug):"",e[2]=r,e[3]=y):y=e[3];let[h,b]=(0,L.useState)(y),w;e[4]!==r?(w=r?z(r.logo):"",e[4]=r,e[5]=w):w=e[5];let[p,I]=(0,L.useState)(w),[v,S]=(0,L.useState)(""),C;e[6]!==l||e[7]!==r?.metadata?(C=l==="edit"?Mt(r?.metadata):"",e[6]=l,e[7]=r?.metadata,e[8]=C):C=e[8];let[x,N]=(0,L.useState)(C),_;e[9]!==i||e[10]!==p||e[11]!==x||e[12]!==l||e[13]!==u||e[14]!==d||e[15]!==f||e[16]!==r?.id||e[17]!==v||e[18]!==c||e[19]!==h?(_=n(()=>{c(async()=>{let V=x.trim()===""?void 0:Tt(x);l==="create"?await i.createAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim(),ownerId:v.trim()===""?void 0:v.trim(),slug:h.trim()===""?void 0:h.trim()}):await i.updateAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim()===""?void 0:u.trim(),organizationId:z(r?.id),slug:h.trim()===""?void 0:h.trim()}),f(),d()})},"t5"),e[9]=i,e[10]=p,e[11]=x,e[12]=l,e[13]=u,e[14]=d,e[15]=f,e[16]=r?.id,e[17]=v,e[18]=c,e[19]=h,e[20]=_):_=e[20];let A=_,D;e[21]!==l||e[22]!==u?(D=u.trim()!==""||l==="edit",e[21]=l,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==l||e[25]!==s?(T=s(l==="create"?"Create":"Save"),e[24]=l,e[25]=s,e[26]=T):T=e[26];let $;e[27]!==l||e[28]!==s?($=s(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=s,e[29]=$):$=e[29];let j;e[30]!==s?(j=s("name"),e[30]=s,e[31]=j):j=e[31];let U;e[32]===Symbol.for("react.memo_cache_sentinel")?(U=n(V=>{g(V.target.value)},"t10"),e[32]=U):U=e[32];let P;e[33]!==u?(P=(0,o.jsxDEV)(Y,{"data-testid":"org-form-name",id:"org-form-name",onChange:U,value:u},void 0,!1),e[33]=u,e[34]=P):P=e[34];let Q;e[35]!==P||e[36]!==j?(Q=(0,o.jsxDEV)(K,{htmlFor:"org-form-name",label:j,children:P},void 0,!1),e[35]=P,e[36]=j,e[37]=Q):Q=e[37];let J;e[38]!==s?(J=s("Slug (optional \u2014 derived from name)"),e[38]=s,e[39]=J):J=e[39];let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=n(V=>{b(V.target.value)},"t14"),e[40]=q):q=e[40];let M;e[41]!==h?(M=(0,o.jsxDEV)(Y,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:q,value:h},void 0,!1),e[41]=h,e[42]=M):M=e[42];let F;e[43]!==J||e[44]!==M?(F=(0,o.jsxDEV)(K,{htmlFor:"org-form-slug",label:J,children:M},void 0,!1),e[43]=J,e[44]=M,e[45]=F):F=e[45];let B;e[46]!==s?(B=s("Logo URL (optional)"),e[46]=s,e[47]=B):B=e[47];let oe;e[48]===Symbol.for("react.memo_cache_sentinel")?(oe=n(V=>{I(V.target.value)},"t18"),e[48]=oe):oe=e[48];let Z;e[49]!==p?(Z=(0,o.jsxDEV)(Y,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:oe,value:p},void 0,!1),e[49]=p,e[50]=Z):Z=e[50];let ee;e[51]!==B||e[52]!==Z?(ee=(0,o.jsxDEV)(K,{htmlFor:"org-form-logo",label:B,children:Z},void 0,!1),e[51]=B,e[52]=Z,e[53]=ee):ee=e[53];let O;e[54]!==l||e[55]!==v||e[56]!==s?(O=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-form-owner",label:s("Owner user id (optional)"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:n(V=>{S(V.target.value)},"onChange"),value:v},void 0,!1)},void 0,!1),e[54]=l,e[55]=v,e[56]=s,e[57]=O):O=e[57];let te;e[58]!==s?(te=s("Metadata (JSON, optional)"),e[58]=s,e[59]=te):te=e[59];let G;e[60]===Symbol.for("react.memo_cache_sentinel")?(G=n(V=>{N(V.target.value)},"t23"),e[60]=G):G=e[60];let le;e[61]!==x?(le=(0,o.jsxDEV)(xt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:G,value:x},void 0,!1),e[61]=x,e[62]=le):le=e[62];let H;e[63]!==te||e[64]!==le?(H=(0,o.jsxDEV)(K,{htmlFor:"org-form-metadata",label:te,children:le},void 0,!1),e[63]=te,e[64]=le,e[65]=H):H=e[65];let se;return e[66]!==a||e[67]!==m||e[68]!==d||e[69]!==A||e[70]!==Q||e[71]!==F||e[72]!==ee||e[73]!==O||e[74]!==H||e[75]!==D||e[76]!==T||e[77]!==$?(se=(0,o.jsxDEV)(de,{busy:a,canSubmit:D,error:m,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:$,children:[Q,F,ee,O,H]},void 0,!0),e[66]=a,e[67]=m,e[68]=d,e[69]=A,e[70]=Q,e[71]=F,e[72]=ee,e[73]=O,e[74]=H,e[75]=D,e[76]=T,e[77]=$,e[78]=se):se=e[78],se},"OrgFormDialog"),Pt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==f||e[4]!==u||e[5]!==m||e[6]!==c?(y=n(()=>{m(async()=>{await r.addAuthOrgMember({organizationId:f,role:u.trim()===""?void 0:u.trim(),userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=f,e[4]=u,e[5]=m,e[6]=c,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Add member"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Add member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("User id"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:S,value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-user",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-add-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberAddDialog"),Qt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==d||e[4]!==f||e[5]!==u||e[6]!==m?(y=n(()=>{m(async()=>{await r.inviteAuthOrgMember({email:c.trim(),organizationId:f,role:u.trim()===""?void 0:u.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=c,e[2]=l,e[3]=d,e[4]=f,e[5]=u,e[6]=m,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Send invitation"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Invite member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("email"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:S,type:"email",value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-email",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-invite-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberInviteDialog"),Jt=n(t=>{let e=(0,W.c)(32),{member:l,onClose:d,onDone:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),c;e[0]!==l.role?(c=z(l.role),e[0]=l.role,e[1]=c):c=e[1];let[k,u]=(0,L.useState)(c),g;e[2]!==r||e[3]!==l.id||e[4]!==d||e[5]!==f||e[6]!==k||e[7]!==m?(g=n(()=>{m(async()=>{await r.setAuthOrgMemberRole({memberId:z(l.id),role:k.trim()}),f(),d()})},"t2"),e[2]=r,e[3]=l.id,e[4]=d,e[5]=f,e[6]=k,e[7]=m,e[8]=g):g=e[8];let y=g,h;e[9]!==k?(h=k.trim(),e[9]=k,e[10]=h):h=e[10];let b=h!=="",w;e[11]!==i?(w=i("Save"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("Change member role"),e[13]=i,e[14]=p):p=e[14];let I;e[15]!==i?(I=i("Role"),e[15]=i,e[16]=I):I=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=n(N=>{u(N.target.value)},"t8"),e[17]=v):v=e[17];let S;e[18]!==k?(S=(0,o.jsxDEV)(Y,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:v,value:k},void 0,!1),e[18]=k,e[19]=S):S=e[19];let C;e[20]!==I||e[21]!==S?(C=(0,o.jsxDEV)(K,{htmlFor:"org-member-role-value",label:I,children:S},void 0,!1),e[20]=I,e[21]=S,e[22]=C):C=e[22];let x;return e[23]!==s||e[24]!==a||e[25]!==d||e[26]!==y||e[27]!==C||e[28]!==b||e[29]!==w||e[30]!==p?(x=(0,o.jsxDEV)(de,{busy:s,canSubmit:b,error:a,onClose:d,onSubmit:y,submitLabel:w,testId:"org-member-role",title:p,children:C},void 0,!1),e[23]=s,e[24]=a,e[25]=d,e[26]=y,e[27]=C,e[28]=b,e[29]=w,e[30]=p,e[31]=x):x=e[31],x},"MemberRoleDialog"),_t=n(t=>{let e=(0,W.c)(36),{mode:l,onClose:d,onDone:f,organizationId:r,team:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.name):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==s||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==f||e[7]!==r||e[8]!==k||e[9]!==i?.id?(h=n(()=>{k(async()=>{await(l==="create"?s.createAuthOrgTeam({name:g.trim(),organizationId:r}):s.updateAuthOrgTeam({name:g.trim(),teamId:z(i?.id)})),f(),d()})},"t2"),e[2]=s,e[3]=l,e[4]=g,e[5]=d,e[6]=f,e[7]=r,e[8]=k,e[9]=i?.id,e[10]=h):h=e[10];let b=h,w;e[11]!==g?(w=g.trim(),e[11]=g,e[12]=w):w=e[12];let p=w!=="",I;e[13]!==l||e[14]!==a?(I=a(l==="create"?"Create":"Save"),e[13]=l,e[14]=a,e[15]=I):I=e[15];let v;e[16]!==l||e[17]!==a?(v=a(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=a,e[18]=v):v=e[18];let S;e[19]!==a?(S=a("name"),e[19]=a,e[20]=S):S=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=n(A=>{y(A.target.value)},"t8"),e[21]=C):C=e[21];let x;e[22]!==g?(x=(0,o.jsxDEV)(Y,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g},void 0,!1),e[22]=g,e[23]=x):x=e[23];let N;e[24]!==S||e[25]!==x?(N=(0,o.jsxDEV)(K,{htmlFor:"org-team-form-name",label:S,children:x},void 0,!1),e[24]=S,e[25]=x,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==c||e[29]!==d||e[30]!==b||e[31]!==N||e[32]!==p||e[33]!==I||e[34]!==v?(_=(0,o.jsxDEV)(de,{busy:m,canSubmit:p,error:c,onClose:d,onSubmit:b,submitLabel:I,testId:"org-team-form",title:v,children:N},void 0,!1),e[27]=m,e[28]=c,e[29]=d,e[30]=b,e[31]=N,e[32]=p,e[33]=I,e[34]=v,e[35]=_):_=e[35],_},"TeamFormDialog"),Ut=n(t=>{let e=(0,W.c)(30),{onClose:l,onDone:d,teamId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),u;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==f||e[5]!==c?(u=n(()=>{m(async()=>{await r.addAuthOrgTeamMember({teamId:f,userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=f,e[5]=c,e[6]=u):u=e[6];let g=u,y;e[7]!==c?(y=c.trim(),e[7]=c,e[8]=y):y=e[8];let h=y!=="",b;e[9]!==i?(b=i("Add member"),e[9]=i,e[10]=b):b=e[10];let w;e[11]!==i?(w=i("Add team member"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("User id"),e[13]=i,e[14]=p):p=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=n(x=>{k(x.target.value)},"t7"),e[15]=I):I=e[15];let v;e[16]!==c?(v=(0,o.jsxDEV)(Y,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:c},void 0,!1),e[16]=c,e[17]=v):v=e[17];let S;e[18]!==p||e[19]!==v?(S=(0,o.jsxDEV)(K,{htmlFor:"org-team-add-member-user",label:p,children:v},void 0,!1),e[18]=p,e[19]=v,e[20]=S):S=e[20];let C;return e[21]!==s||e[22]!==a||e[23]!==l||e[24]!==g||e[25]!==h||e[26]!==b||e[27]!==w||e[28]!==S?(C=(0,o.jsxDEV)(de,{busy:s,canSubmit:h,error:a,onClose:l,onSubmit:g,submitLabel:b,testId:"org-team-add-member",title:w,children:S},void 0,!1),e[21]=s,e[22]=a,e[23]=l,e[24]=g,e[25]=h,e[26]=b,e[27]=w,e[28]=S,e[29]=C):C=e[29],C},"TeamMemberAddDialog"),$t=n(t=>{let e=(0,W.c)(47),{mode:l,onClose:d,onDone:f,organizationId:r,role:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.role):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==l||e[3]!==i?.permission?(h=l==="edit"?Mt(i?.permission):"",e[2]=l,e[3]=i?.permission,e[4]=h):h=e[4];let[b,w]=(0,L.useState)(h),p;e[5]!==s||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==f||e[10]!==r||e[11]!==b||e[12]!==i?.id||e[13]!==k?(p=n(()=>{k(async()=>{let $=jt(b);await(l==="create"?s.createAuthOrgRole({organizationId:r,permission:$,role:g.trim()}):s.updateAuthOrgRole({permission:$,roleId:z(i?.id)})),f(),d()})},"t3"),e[5]=s,e[6]=l,e[7]=g,e[8]=d,e[9]=f,e[10]=r,e[11]=b,e[12]=i?.id,e[13]=k,e[14]=p):p=e[14];let I=p,v;e[15]!==l||e[16]!==g||e[17]!==b?(v=b.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=b,e[18]=v):v=e[18];let S;e[19]!==l||e[20]!==a?(S=a(l==="create"?"Create":"Save"),e[19]=l,e[20]=a,e[21]=S):S=e[21];let C;e[22]!==l||e[23]!==a?(C=a(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=a,e[24]=C):C=e[24];let x;e[25]!==l||e[26]!==g||e[27]!==a?(x=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-role-form-name",label:a("Role name"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:n($=>{y($.target.value)},"onChange"),value:g},void 0,!1)},void 0,!1),e[25]=l,e[26]=g,e[27]=a,e[28]=x):x=e[28];let N;e[29]!==a?(N=a('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=a,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{w($.target.value)},"t9"),e[31]=_):_=e[31];let A;e[32]!==b?(A=(0,o.jsxDEV)(xt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:b},void 0,!1),e[32]=b,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,o.jsxDEV)(K,{htmlFor:"org-role-form-permission",label:N,children:A},void 0,!1),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==m||e[38]!==c||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==v||e[43]!==S||e[44]!==C||e[45]!==x?(T=(0,o.jsxDEV)(de,{busy:m,canSubmit:v,error:c,onClose:d,onSubmit:I,submitLabel:S,testId:"org-role-form",title:C,children:[x,D]},void 0,!0),e[37]=m,e[38]=c,e[39]=d,e[40]=I,e[41]=D,e[42]=v,e[43]=S,e[44]=C,e[45]=x,e[46]=T):T=e[46],T},"RoleFormDialog"),Ft=n(t=>{let e=(0,W.c)(18),{action:l,message:d,onClose:f,onDone:r,testId:i,title:s}=t,a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==l||e[1]!==f||e[2]!==r||e[3]!==k?(u=n(()=>{k(async()=>{await l(),r(),f()})},"t1"),e[0]=l,e[1]=f,e[2]=r,e[3]=k,e[4]=u):u=e[4];let g=u,y;e[5]!==a?(y=a("Delete"),e[5]=a,e[6]=y):y=e[6];let h;e[7]!==d?(h=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d},void 0,!1),e[7]=d,e[8]=h):h=e[8];let b;return e[9]!==m||e[10]!==c||e[11]!==f||e[12]!==g||e[13]!==y||e[14]!==h||e[15]!==i||e[16]!==s?(b=(0,o.jsxDEV)(de,{busy:m,canSubmit:!0,destructive:!0,error:c,onClose:f,onSubmit:g,submitLabel:y,testId:i,title:s,children:h},void 0,!1),e[9]=m,e[10]=c,e[11]=f,e[12]=g,e[13]=y,e[14]=h,e[15]=i,e[16]=s,e[17]=b):b=e[17],b},"ConfirmDialog"),et=n(t=>{let e=(0,W.c)(13),{action:l,children:d,heading:f,testId:r}=t,i;e[0]!==f?(i=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1),e[0]=f,e[1]=i):i=e[1];let s;e[2]!==l?(s=l!==void 0&&(0,o.jsxDEV)("div",{className:"flex items-center gap-2",children:l},void 0,!1),e[2]=l,e[3]=s):s=e[3];let a;e[4]!==i||e[5]!==s?(a=(0,o.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,s]},void 0,!0),e[4]=i,e[5]=s,e[6]=a):a=e[6];let m;e[7]!==d?(m=(0,o.jsxDEV)(bt,{className:"px-0",children:d},void 0,!1),e[7]=d,e[8]=m):m=e[8];let c;return e[9]!==a||e[10]!==m||e[11]!==r?(c=(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0","data-testid":r,children:[a,m]},void 0,!0),e[9]=a,e[10]=m,e[11]=r,e[12]=c):c=e[12],c},"SectionCard"),tt=n(t=>{let e=(0,W.c)(23),{columns:l,rowActions:d,rowPrefix:f,rows:r}=t,i=X(),s;e[0]!==l?(s=l.map(Ht),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==i?(a=i("Actions"),e[2]=i,e[3]=a):a=e[3];let m;e[4]!==a?(m=(0,o.jsxDEV)(ae,{"aria-label":a},void 0,!1),e[4]=a,e[5]=m):m=e[5];let c;e[6]!==s||e[7]!==m?(c=(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[s,m]},void 0,!0)},void 0,!1),e[6]=s,e[7]=m,e[8]=c):c=e[8];let k;if(e[9]!==l||e[10]!==d||e[11]!==f||e[12]!==r){let y;e[14]!==l||e[15]!==d||e[16]!==f?(y=n(h=>{let b=z(h.id);return(0,o.jsxDEV)(Ze,{"data-testid":`${f}-${b}`,children:[l.map(w=>(0,o.jsxDEV)(ne,{className:w.className,children:w.render(h)},w.head,!1)),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:d(h)},void 0,!1)},void 0,!1)]},b,!0)},"t62"),e[14]=l,e[15]=d,e[16]=f,e[17]=y):y=e[17],k=r.map(y),e[9]=l,e[10]=d,e[11]=f,e[12]=r,e[13]=k}else k=e[13];let u;e[18]!==k?(u=(0,o.jsxDEV)(Ct,{children:k},void 0,!1),e[18]=k,e[19]=u):u=e[19];let g;return e[20]!==c||e[21]!==u?(g=(0,o.jsxDEV)(pt,{children:[c,u]},void 0,!0),e[20]=c,e[21]=u,e[22]=g):g=e[22],g},"ManagedTable"),Bt=n(t=>{let e=(0,W.c)(213),{organizationId:l,rolesEnabled:d,teamsEnabled:f}=t,r=ie(),i=X(),[s,a]=(0,L.useState)(null),[m,c]=(0,L.useState)(null),k;e[0]!==l?(k=["lunora-auth-org-members",l],e[0]=l,e[1]=k):k=e[1];let u;e[2]!==r||e[3]!==l?(u=n(()=>r.listAuthOrgMembers({limit:200,organizationId:l}),"t2"),e[2]=r,e[3]=l,e[4]=u):u=e[4];let g=ce(k,u),y;e[5]!==l?(y=["lunora-auth-org-invitations",l],e[5]=l,e[6]=y):y=e[6];let h;e[7]!==r||e[8]!==l?(h=n(()=>r.listAuthOrgInvitations({limit:200,organizationId:l}),"t4"),e[7]=r,e[8]=l,e[9]=h):h=e[9];let b=ce(y,h),w;e[10]!==l?(w=["lunora-auth-org-teams",l],e[10]=l,e[11]=w):w=e[11];let p;e[12]!==r||e[13]!==l?(p=n(()=>r.listAuthOrgTeams({limit:200,organizationId:l}),"t6"),e[12]=r,e[13]=l,e[14]=p):p=e[14];let I;e[15]!==f?(I={enabled:f},e[15]=f,e[16]=I):I=e[16];let v=ce(w,p,I),S;e[17]!==l?(S=["lunora-auth-org-roles",l],e[17]=l,e[18]=S):S=e[18];let C;e[19]!==r||e[20]!==l?(C=n(()=>r.listAuthOrgRoles({limit:200,organizationId:l}),"t9"),e[19]=r,e[20]=l,e[21]=C):C=e[21];let x;e[22]!==d?(x={enabled:d},e[22]=d,e[23]=x):x=e[23];let N=ce(S,C,x),_;e[24]!==m?(_=["lunora-auth-org-team-members",m],e[24]=m,e[25]=_):_=e[25];let A;e[26]!==r||e[27]!==m?(A=n(()=>r.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"t12"),e[26]=r,e[27]=m,e[28]=A):A=e[28];let D=m!==null,T;e[29]!==D?(T={enabled:D},e[29]=D,e[30]=T):T=e[30];let $=ce(_,A,T),j;e[31]!==g.data?.rows?(j=g.data?.rows??[],e[31]=g.data?.rows,e[32]=j):j=e[32];let U=j,P;e[33]!==b.data?.rows?(P=b.data?.rows??[],e[33]=b.data?.rows,e[34]=P):P=e[34];let Q=P,J;e[35]!==v.data?.rows?(J=v.data?.rows??[],e[35]=v.data?.rows,e[36]=J):J=e[36];let q=J,M;e[37]!==N.data?.rows?(M=N.data?.rows??[],e[37]=N.data?.rows,e[38]=M):M=e[38];let F=M,B;e[39]!==m||e[40]!==$?(B=m===null?[]:$.data?.rows??[],e[39]=m,e[40]=$,e[41]=B):B=e[41];let oe=B,Z=g.error??b.error??v.error??N.error??$.error,ee;e[42]!==b||e[43]!==g||e[44]!==d||e[45]!==N||e[46]!==m||e[47]!==$||e[48]!==f||e[49]!==v?(ee=n(()=>{g.refetch(),b.refetch(),f&&v.refetch(),d&&N.refetch(),m!==null&&$.refetch()},"t20"),e[42]=b,e[43]=g,e[44]=d,e[45]=N,e[46]=m,e[47]=$,e[48]=f,e[49]=v,e[50]=ee):ee=e[50];let O=ee;It(O,!0);let te;e[51]===Symbol.for("react.memo_cache_sentinel")?(te=n(()=>{a(null)},"t21"),e[51]=te):te=e[51];let G=te,le;e[52]!==O?(le=n(R=>{St((async()=>{await R(),O()})())},"t22"),e[52]=O,e[53]=le):le=e[53];let H=le,se;e[54]!==r||e[55]!==i?(se=n(R=>{let kt=z(R.id);a({action:n(async()=>{await r.removeAuthOrgTeam({teamId:kt}),c(wt=>wt===kt?null:wt)},"action"),kind:"confirm",message:i("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:i("Delete team")})},"t23"),e[54]=r,e[55]=i,e[56]=se):se=e[56];let V=se,fe;e[57]!==i?(fe=i("userId"),e[57]=i,e[58]=fe):fe=e[58];let ue;e[59]!==fe?(ue={head:fe,render:Vt},e[59]=fe,e[60]=ue):ue=e[60];let ge;e[61]!==i?(ge=i("role"),e[61]=i,e[62]=ge):ge=e[62];let ve;e[63]!==ge?(ve={head:ge,render:qt},e[63]=ge,e[64]=ve):ve=e[64];let lt;e[65]!==ue||e[66]!==ve?(lt=[ue,ve],e[65]=ue,e[66]=ve,e[67]=lt):lt=e[67];let mt=lt,he;e[68]!==i?(he=i("email"),e[68]=i,e[69]=he):he=e[69];let be;e[70]!==he?(be={head:he,render:Gt},e[70]=he,e[71]=be):be=e[71];let pe;e[72]!==i?(pe=i("role"),e[72]=i,e[73]=pe):pe=e[73];let ye;e[74]!==pe?(ye={head:pe,render:Kt},e[74]=pe,e[75]=ye):ye=e[75];let Ce;e[76]!==i?(Ce=i("status"),e[76]=i,e[77]=Ce):Ce=e[77];let xe;e[78]!==Ce?(xe={head:Ce,render:Wt},e[78]=Ce,e[79]=xe):xe=e[79];let it;e[80]!==be||e[81]!==ye||e[82]!==xe?(it=[be,ye,xe],e[80]=be,e[81]=ye,e[82]=xe,e[83]=it):it=e[83];let ct=it,Ie;e[84]!==i?(Ie=i("id"),e[84]=i,e[85]=Ie):Ie=e[85];let ke;e[86]!==Ie?(ke={className:"font-mono text-xs",head:Ie,render:Xt},e[86]=Ie,e[87]=ke):ke=e[87];let we;e[88]!==i?(we=i("name"),e[88]=i,e[89]=we):we=e[89];let Se;e[90]!==we?(Se={head:we,render:Yt},e[90]=we,e[91]=Se):Se=e[91];let ot;e[92]!==ke||e[93]!==Se?(ot=[ke,Se],e[92]=ke,e[93]=Se,e[94]=ot):ot=e[94];let ft=ot,Ne;e[95]!==i?(Ne=i("userId"),e[95]=i,e[96]=Ne):Ne=e[96];let st;e[97]!==Ne?(st=[{head:Ne,render:Zt}],e[97]=Ne,e[98]=st):st=e[98];let ut=st,ze;e[99]!==i?(ze=i("role"),e[99]=i,e[100]=ze):ze=e[100];let Ae;e[101]!==ze?(Ae={head:ze,render:el},e[101]=ze,e[102]=Ae):Ae=e[102];let De;e[103]!==i?(De=i("Permission"),e[103]=i,e[104]=De):De=e[104];let Oe;e[105]!==De?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:De,render:tl},e[105]=De,e[106]=Oe):Oe=e[106];let rt;e[107]!==Ae||e[108]!==Oe?(rt=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=rt):rt=e[109];let gt=rt,_e;e[110]!==Z?(_e=Z!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:Z},void 0,!1),e[110]=Z,e[111]=_e):_e=e[111];let at;e[112]===Symbol.for("react.memo_cache_sentinel")?(at=n(()=>{a({kind:"add-member"})},"t49"),e[112]=at):at=e[112];let $e;e[113]!==i?($e=i("Add member"),e[113]=i,e[114]=$e):$e=e[114];let Te;e[115]!==$e?(Te=(0,o.jsxDEV)(E,{"data-testid":"org-open-add-member",onClick:at,size:"xs",type:"button",variant:"outline",children:$e},void 0,!1),e[115]=$e,e[116]=Te):Te=e[116];let nt;e[117]===Symbol.for("react.memo_cache_sentinel")?(nt=n(()=>{a({kind:"invite-member"})},"t52"),e[117]=nt):nt=e[117];let Me;e[118]!==i?(Me=i("Invite member"),e[118]=i,e[119]=Me):Me=e[119];let Fe;e[120]!==Me?(Fe=(0,o.jsxDEV)(E,{"data-testid":"org-open-invite-member",onClick:nt,size:"xs",type:"button",variant:"outline",children:Me},void 0,!1),e[120]=Me,e[121]=Fe):Fe=e[121];let Re;e[122]!==Te||e[123]!==Fe?(Re=(0,o.jsxDEV)(o.Fragment,{children:[Te,Fe]},void 0,!0),e[122]=Te,e[123]=Fe,e[124]=Re):Re=e[124];let Ee;e[125]!==i?(Ee=i("Members"),e[125]=i,e[126]=Ee):Ee=e[126];let Le;e[127]!==r||e[128]!==mt||e[129]!==U||e[130]!==H||e[131]!==i?(Le=U.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-members-empty",title:i("No members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:mt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-member-role-${z(R.id)}`,onClick:n(()=>{a({kind:"member-role",member:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Change role")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgMember({memberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-member",rows:U},void 0,!1),e[127]=r,e[128]=mt,e[129]=U,e[130]=H,e[131]=i,e[132]=Le):Le=e[132];let je;e[133]!==Re||e[134]!==Ee||e[135]!==Le?(je=(0,o.jsxDEV)(et,{action:Re,heading:Ee,testId:"org-members",children:Le},void 0,!1),e[133]=Re,e[134]=Ee,e[135]=Le,e[136]=je):je=e[136];let Pe;e[137]!==r||e[138]!==ct||e[139]!==Q||e[140]!==H||e[141]!==i?(Pe=Q.length>0&&(0,o.jsxDEV)(et,{heading:i("Invitations"),testId:"org-invitations",children:(0,o.jsxDEV)(tt,{columns:ct,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-cancel-invitation-${z(R.id)}`,onClick:n(()=>{H(()=>r.cancelAuthOrgInvitation({invitationId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Cancel")},void 0,!1),"rowActions"),rowPrefix:"org-invitation",rows:Q},void 0,!1)},void 0,!1),e[137]=r,e[138]=ct,e[139]=Q,e[140]=H,e[141]=i,e[142]=Pe):Pe=e[142];let Qe;e[143]!==V||e[144]!==m||e[145]!==i||e[146]!==ft||e[147]!==q||e[148]!==f?(Qe=f&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-team",onClick:n(()=>{a({kind:"team-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New team")},void 0,!1),heading:i("Teams"),testId:"org-teams",children:q.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-teams-empty",title:i("No teams.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ft,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"aria-pressed":m===z(R.id),"data-testid":`org-team-select-${z(R.id)}`,onClick:n(()=>{c(z(R.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Members")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-rename-${z(R.id)}`,onClick:n(()=>{a({kind:"team-rename",team:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Rename")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-delete-${z(R.id)}`,onClick:n(()=>{V(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-team",rows:q},void 0,!1)},void 0,!1),e[143]=V,e[144]=m,e[145]=i,e[146]=ft,e[147]=q,e[148]=f,e[149]=Qe):Qe=e[149];let Je;e[150]!==r||e[151]!==H||e[152]!==m||e[153]!==i||e[154]!==ut||e[155]!==oe||e[156]!==f?(Je=f&&m!==null&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-add-team-member",onClick:n(()=>{a({kind:"team-add-member",teamId:m})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("Add member")},void 0,!1),heading:i("Team members"),testId:"org-team-members",children:oe.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-team-members-empty",title:i("No team members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ut,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-team-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgTeamMember({teamMemberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1),"rowActions"),rowPrefix:"org-team-member",rows:oe},void 0,!1)},void 0,!1),e[150]=r,e[151]=H,e[152]=m,e[153]=i,e[154]=ut,e[155]=oe,e[156]=f,e[157]=Je):Je=e[157];let Ue;e[158]!==r||e[159]!==gt||e[160]!==F||e[161]!==d||e[162]!==i?(Ue=d&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-role",onClick:n(()=>{a({kind:"role-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New role")},void 0,!1),heading:i("Roles"),testId:"org-roles",children:F.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-roles-empty",title:i("No custom roles.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:gt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-role-edit-${z(R.id)}`,onClick:n(()=>{a({kind:"role-edit",role:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-role-delete-${z(R.id)}`,onClick:n(()=>{a({action:n(()=>r.deleteAuthOrgRole({roleId:z(R.id)}),"action"),kind:"confirm",message:i("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:i("Delete role")})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-role",rows:F},void 0,!1)},void 0,!1),e[158]=r,e[159]=gt,e[160]=F,e[161]=d,e[162]=i,e[163]=Ue):Ue=e[163];let Be;e[164]!==s?.kind||e[165]!==l||e[166]!==O?(Be=s?.kind==="add-member"&&(0,o.jsxDEV)(Pt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[164]=s?.kind,e[165]=l,e[166]=O,e[167]=Be):Be=e[167];let He;e[168]!==s?.kind||e[169]!==l||e[170]!==O?(He=s?.kind==="invite-member"&&(0,o.jsxDEV)(Qt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[168]=s?.kind,e[169]=l,e[170]=O,e[171]=He):He=e[171];let Ve;e[172]!==s||e[173]!==O?(Ve=s?.kind==="member-role"&&(0,o.jsxDEV)(Jt,{member:s.member,onClose:G,onDone:O},void 0,!1),e[172]=s,e[173]=O,e[174]=Ve):Ve=e[174];let qe;e[175]!==s?.kind||e[176]!==l||e[177]!==O?(qe=s?.kind==="team-create"&&(0,o.jsxDEV)(_t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[175]=s?.kind,e[176]=l,e[177]=O,e[178]=qe):qe=e[178];let Ge;e[179]!==s||e[180]!==l||e[181]!==O?(Ge=s?.kind==="team-rename"&&(0,o.jsxDEV)(_t,{mode:"edit",onClose:G,onDone:O,organizationId:l,team:s.team},void 0,!1),e[179]=s,e[180]=l,e[181]=O,e[182]=Ge):Ge=e[182];let Ke;e[183]!==s||e[184]!==O?(Ke=s?.kind==="team-add-member"&&(0,o.jsxDEV)(Ut,{onClose:G,onDone:O,teamId:s.teamId},void 0,!1),e[183]=s,e[184]=O,e[185]=Ke):Ke=e[185];let We;e[186]!==s?.kind||e[187]!==l||e[188]!==O?(We=s?.kind==="role-create"&&(0,o.jsxDEV)($t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[186]=s?.kind,e[187]=l,e[188]=O,e[189]=We):We=e[189];let Xe;e[190]!==s||e[191]!==l||e[192]!==O?(Xe=s?.kind==="role-edit"&&(0,o.jsxDEV)($t,{mode:"edit",onClose:G,onDone:O,organizationId:l,role:s.role},void 0,!1),e[190]=s,e[191]=l,e[192]=O,e[193]=Xe):Xe=e[193];let Ye;e[194]!==s||e[195]!==O?(Ye=s?.kind==="confirm"&&(0,o.jsxDEV)(Ft,{action:s.action,message:s.message,onClose:G,onDone:O,testId:s.testId,title:s.title},void 0,!1),e[194]=s,e[195]=O,e[196]=Ye):Ye=e[196];let dt;return e[197]!==_e||e[198]!==je||e[199]!==Pe||e[200]!==Qe||e[201]!==Je||e[202]!==Ue||e[203]!==Be||e[204]!==He||e[205]!==Ve||e[206]!==qe||e[207]!==Ge||e[208]!==Ke||e[209]!==We||e[210]!==Xe||e[211]!==Ye?(dt=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[_e,je,Pe,Qe,Je,Ue,Be,He,Ve,qe,Ge,Ke,We,Xe,Ye]},void 0,!0),e[197]=_e,e[198]=je,e[199]=Pe,e[200]=Qe,e[201]=Je,e[202]=Ue,e[203]=Be,e[204]=He,e[205]=Ve,e[206]=qe,e[207]=Ge,e[208]=Ke,e[209]=We,e[210]=Xe,e[211]=Ye,e[212]=dt):dt=e[212],dt},"OrganizationDetail");function Ht(t){return(0,o.jsxDEV)(ae,{children:t.head},t.head,!1)}n(Ht,"_temp");function Vt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Vt,"_temp2");function qt(t){return z(t.role)}n(qt,"_temp3");function Gt(t){return z(t.email)}n(Gt,"_temp4");function Kt(t){return z(t.role)}n(Kt,"_temp5");function Wt(t){return z(t.status)}n(Wt,"_temp6");function Xt(t){return z(t.id)}n(Xt,"_temp7");function Yt(t){return z(t.name)}n(Yt,"_temp8");function Zt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Zt,"_temp9");function el(t){return z(t.role)}n(el,"_temp0");function tl(t){return z(t.permission)}n(tl,"_temp1");var hl=n(()=>{let t=(0,W.c)(62),e=ie(),l=X(),{config:d,ready:f}=At(),r=d.capabilities.organization,[i,s]=(0,L.useState)(null),[a,m]=(0,L.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let k;t[1]!==e?(k=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=k):k=t[2];let u;t[3]!==r?(u={enabled:r},t[3]=r,t[4]=u):u=t[4];let g=ce(c,k,u),y=g.data?.rows??null,h;t[5]!==g?(h=n(()=>{g.refetch()},"t3"),t[5]=g,t[6]=h):h=t[6],It(h,r);let b;t[7]===Symbol.for("react.memo_cache_sentinel")?(b=n(()=>{m(null)},"t4"),t[7]=b):b=t[7];let w=b,p;t[8]!==g?(p=n(()=>{g.refetch()},"t5"),t[8]=g,t[9]=p):p=t[9];let I=p,v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n(M=>{s(M)},"t6"),t[10]=v):v=t[10];let S=v;if(f&&!r){let M;t[11]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=l,t[12]=M):M=t[12];let F;t[13]!==l?(F=l("Organizations are not enabled."),t[13]=l,t[14]=F):F=t[14];let B;return t[15]!==M||t[16]!==F?(B=(0,o.jsxDEV)(me,{description:M,testId:"org-disabled",title:F},void 0,!1),t[15]=M,t[16]=F,t[17]=B):B=t[17],B}let C;t[18]!==l?(C=l("Organizations"),t[18]=l,t[19]=C):C=t[19];let x;t[20]!==C?(x=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C},void 0,!1),t[20]=C,t[21]=x):x=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(()=>{m({kind:"create"})},"t9"),t[22]=N):N=t[22];let _;t[23]!==l?(_=l("New organization"),t[23]=l,t[24]=_):_=t[24];let A;t[25]!==_?(A=(0,o.jsxDEV)(E,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:_},void 0,!1),t[25]=_,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==x?(D=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[x,A]},void 0,!0),t[27]=A,t[28]=x,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error},void 0,!1),t[30]=g.error,t[31]=T):T=t[31];let $;t[32]!==y||t[33]!==l?($=y!==null&&y.length===0&&(0,o.jsxDEV)(me,{testId:"org-empty",title:l("No organizations.")},void 0,!1),t[32]=y,t[33]=l,t[34]=$):$=t[34];let j;t[35]!==y||t[36]!==i||t[37]!==l?(j=y!==null&&y.length>0&&(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0",children:(0,o.jsxDEV)(bt,{className:"px-0",children:(0,o.jsxDEV)(pt,{"data-testid":"org-table",children:[(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[(0,o.jsxDEV)(ae,{children:l("id")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("name")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("slug")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("created")},void 0,!1),(0,o.jsxDEV)(ae,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,o.jsxDEV)(Ct,{children:y.map(M=>{let F=z(M.id);return(0,o.jsxDEV)(Ze,{"data-testid":`org-row-${F}`,children:[(0,o.jsxDEV)(ne,{className:"font-mono text-xs",children:F},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.name)},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.slug)},void 0,!1),(0,o.jsxDEV)(ne,{className:"text-muted-foreground tabular-nums",children:Nt(M.createdAt)},void 0,!1),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:[(0,o.jsxDEV)(E,{"aria-pressed":i===F,"data-testid":`org-select-${F}`,onClick:n(()=>{S(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-edit-${F}`,onClick:n(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-delete-${F}`,onClick:n(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Delete")},void 0,!1)]},void 0,!0)},void 0,!1)]},F,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[35]=y,t[36]=i,t[37]=l,t[38]=j):j=t[38];let U;t[39]!==d.organization||t[40]!==i?(U=i!==null&&(0,o.jsxDEV)(Bt,{organizationId:i,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams},void 0,!1),t[39]=d.organization,t[40]=i,t[41]=U):U=t[41];let P;t[42]!==a?.kind||t[43]!==I?(P=a?.kind==="create"&&(0,o.jsxDEV)(Ot,{mode:"create",onClose:w,onDone:I},void 0,!1),t[42]=a?.kind,t[43]=I,t[44]=P):P=t[44];let Q;t[45]!==a||t[46]!==I?(Q=a?.kind==="edit"&&(0,o.jsxDEV)(Ot,{mode:"edit",onClose:w,onDone:I,org:a.org},void 0,!1),t[45]=a,t[46]=I,t[47]=Q):Q=t[47];let J;t[48]!==e||t[49]!==a||t[50]!==I||t[51]!==l?(J=a?.kind==="delete"&&(0,o.jsxDEV)(Ft,{action:n(async()=>{let M=z(a.org.id);await e.deleteAuthOrganization({organizationId:M}),s(F=>F===M?null:F)},"action"),message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:w,onDone:I,testId:"org-delete",title:l("Delete organization")},void 0,!1),t[48]=e,t[49]=a,t[50]=I,t[51]=l,t[52]=J):J=t[52];let q;return t[53]!==D||t[54]!==T||t[55]!==$||t[56]!==j||t[57]!==U||t[58]!==P||t[59]!==Q||t[60]!==J?(q=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,$,j,U,P,Q,J]},void 0,!0),t[53]=D,t[54]=T,t[55]=$,t[56]=j,t[57]=U,t[58]=P,t[59]=Q,t[60]=J,t[61]=q):q=t[61],q},"OrganizationsPanel");export{hl as OrganizationsPanel};
1
+ import{a as At,b as re}from"./chunk-KA5YB3VP.js";import{a as Dt}from"./chunk-AHILM3ZP.js";import{a as It}from"./chunk-J6J54MBP.js";import{a as pt,b as yt,c as Ct,d as Ze,e as ae,f as ne}from"./chunk-GTM65MVX.js";import{a as xt}from"./chunk-VLXV72QE.js";import{a as zt}from"./chunk-JSEXCW5Q.js";import{R as Y}from"./chunk-3CJW6NWG.js";import{c as E}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as me}from"./chunk-TAD43CG5.js";import{a as ce}from"./chunk-RHZ4M2NZ.js";import{a as ht,e as bt}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as ie}from"./chunk-XLXNLJ4N.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as X,j as z,k as St,o as Nt}from"./chunk-E75ANNWX.js";import"./chunk-JHKMUTIF.js";import{a as n,e as vt,f as Rt,g as Et,h as Lt}from"./chunk-RRCPZMC2.js";var W=vt(Et(),1);var L=vt(Rt(),1);var o=vt(Lt(),1);var Tt=n(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"parseJsonObject"),jt=n(t=>{let e=Tt(t),l={};for(let[d,f]of Object.entries(e)){if(!Array.isArray(f)||f.some(r=>typeof r!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=f}return l},"parsePermission"),Mt=n(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"jsonInitial"),K=n(t=>{let e=(0,W.c)(6),{children:l,htmlFor:d,label:f}=t,r;e[0]!==d||e[1]!==f?(r=(0,o.jsxDEV)(zt,{htmlFor:d,children:f},void 0,!1),e[0]=d,e[1]=f,e[2]=r):r=e[2];let i;return e[3]!==l||e[4]!==r?(i=(0,o.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,l]},void 0,!0),e[3]=l,e[4]=r,e[5]=i):i=e[5],i},"Field"),de=n(({busy:t,canSubmit:e,children:l,destructive:d=!1,error:f,onClose:r,onSubmit:i,submitLabel:s,testId:a,title:m})=>{let c=X();return(0,o.jsxDEV)(Dt,{label:m,onClose:r,panelTestId:`${a}-panel`,testId:`${a}-overlay`,variant:"dialog",children:[(0,o.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:m},void 0,!1),l,f!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${a}-error`,role:"alert",children:f},void 0,!1),(0,o.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,o.jsxDEV)(E,{"data-testid":`${a}-cancel`,onClick:r,size:"sm",type:"button",variant:"outline",children:c("Cancel")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`${a}-submit`,disabled:t||!e,onClick:i,size:"sm",type:"button",variant:d?"destructive":"default",children:t?c("Saving\u2026"):s},void 0,!1)]},void 0,!0)]},void 0,!0)},"DialogForm"),Ot=n(t=>{let e=(0,W.c)(79),{mode:l,onClose:d,onDone:f,org:r}=t,i=ie(),s=X(),{busy:a,error:m,run:c}=re(),k;e[0]!==r?(k=r?z(r.name):"",e[0]=r,e[1]=k):k=e[1];let[u,g]=(0,L.useState)(k),y;e[2]!==r?(y=r?z(r.slug):"",e[2]=r,e[3]=y):y=e[3];let[h,b]=(0,L.useState)(y),w;e[4]!==r?(w=r?z(r.logo):"",e[4]=r,e[5]=w):w=e[5];let[p,I]=(0,L.useState)(w),[v,S]=(0,L.useState)(""),C;e[6]!==l||e[7]!==r?.metadata?(C=l==="edit"?Mt(r?.metadata):"",e[6]=l,e[7]=r?.metadata,e[8]=C):C=e[8];let[x,N]=(0,L.useState)(C),_;e[9]!==i||e[10]!==p||e[11]!==x||e[12]!==l||e[13]!==u||e[14]!==d||e[15]!==f||e[16]!==r?.id||e[17]!==v||e[18]!==c||e[19]!==h?(_=n(()=>{c(async()=>{let V=x.trim()===""?void 0:Tt(x);l==="create"?await i.createAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim(),ownerId:v.trim()===""?void 0:v.trim(),slug:h.trim()===""?void 0:h.trim()}):await i.updateAuthOrganization({logo:p.trim()===""?void 0:p.trim(),metadata:V,name:u.trim()===""?void 0:u.trim(),organizationId:z(r?.id),slug:h.trim()===""?void 0:h.trim()}),f(),d()})},"t5"),e[9]=i,e[10]=p,e[11]=x,e[12]=l,e[13]=u,e[14]=d,e[15]=f,e[16]=r?.id,e[17]=v,e[18]=c,e[19]=h,e[20]=_):_=e[20];let A=_,D;e[21]!==l||e[22]!==u?(D=u.trim()!==""||l==="edit",e[21]=l,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==l||e[25]!==s?(T=s(l==="create"?"Create":"Save"),e[24]=l,e[25]=s,e[26]=T):T=e[26];let $;e[27]!==l||e[28]!==s?($=s(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=s,e[29]=$):$=e[29];let j;e[30]!==s?(j=s("name"),e[30]=s,e[31]=j):j=e[31];let U;e[32]===Symbol.for("react.memo_cache_sentinel")?(U=n(V=>{g(V.target.value)},"t10"),e[32]=U):U=e[32];let P;e[33]!==u?(P=(0,o.jsxDEV)(Y,{"data-testid":"org-form-name",id:"org-form-name",onChange:U,value:u},void 0,!1),e[33]=u,e[34]=P):P=e[34];let Q;e[35]!==P||e[36]!==j?(Q=(0,o.jsxDEV)(K,{htmlFor:"org-form-name",label:j,children:P},void 0,!1),e[35]=P,e[36]=j,e[37]=Q):Q=e[37];let J;e[38]!==s?(J=s("Slug (optional \u2014 derived from name)"),e[38]=s,e[39]=J):J=e[39];let q;e[40]===Symbol.for("react.memo_cache_sentinel")?(q=n(V=>{b(V.target.value)},"t14"),e[40]=q):q=e[40];let M;e[41]!==h?(M=(0,o.jsxDEV)(Y,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:q,value:h},void 0,!1),e[41]=h,e[42]=M):M=e[42];let F;e[43]!==J||e[44]!==M?(F=(0,o.jsxDEV)(K,{htmlFor:"org-form-slug",label:J,children:M},void 0,!1),e[43]=J,e[44]=M,e[45]=F):F=e[45];let B;e[46]!==s?(B=s("Logo URL (optional)"),e[46]=s,e[47]=B):B=e[47];let oe;e[48]===Symbol.for("react.memo_cache_sentinel")?(oe=n(V=>{I(V.target.value)},"t18"),e[48]=oe):oe=e[48];let Z;e[49]!==p?(Z=(0,o.jsxDEV)(Y,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:oe,value:p},void 0,!1),e[49]=p,e[50]=Z):Z=e[50];let ee;e[51]!==B||e[52]!==Z?(ee=(0,o.jsxDEV)(K,{htmlFor:"org-form-logo",label:B,children:Z},void 0,!1),e[51]=B,e[52]=Z,e[53]=ee):ee=e[53];let O;e[54]!==l||e[55]!==v||e[56]!==s?(O=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-form-owner",label:s("Owner user id (optional)"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:n(V=>{S(V.target.value)},"onChange"),value:v},void 0,!1)},void 0,!1),e[54]=l,e[55]=v,e[56]=s,e[57]=O):O=e[57];let te;e[58]!==s?(te=s("Metadata (JSON, optional)"),e[58]=s,e[59]=te):te=e[59];let G;e[60]===Symbol.for("react.memo_cache_sentinel")?(G=n(V=>{N(V.target.value)},"t23"),e[60]=G):G=e[60];let le;e[61]!==x?(le=(0,o.jsxDEV)(xt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:G,value:x},void 0,!1),e[61]=x,e[62]=le):le=e[62];let H;e[63]!==te||e[64]!==le?(H=(0,o.jsxDEV)(K,{htmlFor:"org-form-metadata",label:te,children:le},void 0,!1),e[63]=te,e[64]=le,e[65]=H):H=e[65];let se;return e[66]!==a||e[67]!==m||e[68]!==d||e[69]!==A||e[70]!==Q||e[71]!==F||e[72]!==ee||e[73]!==O||e[74]!==H||e[75]!==D||e[76]!==T||e[77]!==$?(se=(0,o.jsxDEV)(de,{busy:a,canSubmit:D,error:m,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:$,children:[Q,F,ee,O,H]},void 0,!0),e[66]=a,e[67]=m,e[68]=d,e[69]=A,e[70]=Q,e[71]=F,e[72]=ee,e[73]=O,e[74]=H,e[75]=D,e[76]=T,e[77]=$,e[78]=se):se=e[78],se},"OrgFormDialog"),Pt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==f||e[4]!==u||e[5]!==m||e[6]!==c?(y=n(()=>{m(async()=>{await r.addAuthOrgMember({organizationId:f,role:u.trim()===""?void 0:u.trim(),userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=f,e[4]=u,e[5]=m,e[6]=c,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Add member"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Add member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("User id"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:S,value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-user",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-add-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-add-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberAddDialog"),Qt=n(t=>{let e=(0,W.c)(40),{onClose:l,onDone:d,organizationId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),[u,g]=(0,L.useState)(""),y;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==d||e[4]!==f||e[5]!==u||e[6]!==m?(y=n(()=>{m(async()=>{await r.inviteAuthOrgMember({email:c.trim(),organizationId:f,role:u.trim()===""?void 0:u.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=c,e[2]=l,e[3]=d,e[4]=f,e[5]=u,e[6]=m,e[7]=y):y=e[7];let h=y,b;e[8]!==c?(b=c.trim(),e[8]=c,e[9]=b):b=e[9];let w=b!=="",p;e[10]!==i?(p=i("Send invitation"),e[10]=i,e[11]=p):p=e[11];let I;e[12]!==i?(I=i("Invite member"),e[12]=i,e[13]=I):I=e[13];let v;e[14]!==i?(v=i("email"),e[14]=i,e[15]=v):v=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n($=>{k($.target.value)},"t7"),e[16]=S):S=e[16];let C;e[17]!==c?(C=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:S,type:"email",value:c},void 0,!1),e[17]=c,e[18]=C):C=e[18];let x;e[19]!==v||e[20]!==C?(x=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-email",label:v,children:C},void 0,!1),e[19]=v,e[20]=C,e[21]=x):x=e[21];let N;e[22]!==i?(N=i("Role (optional)"),e[22]=i,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{g($.target.value)},"t11"),e[24]=_):_=e[24];let A;e[25]!==u?(A=(0,o.jsxDEV)(Y,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u},void 0,!1),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,o.jsxDEV)(K,{htmlFor:"org-invite-member-role",label:N,children:A},void 0,!1),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==s||e[31]!==a||e[32]!==l||e[33]!==h||e[34]!==D||e[35]!==w||e[36]!==p||e[37]!==I||e[38]!==x?(T=(0,o.jsxDEV)(de,{busy:s,canSubmit:w,error:a,onClose:l,onSubmit:h,submitLabel:p,testId:"org-invite-member",title:I,children:[x,D]},void 0,!0),e[30]=s,e[31]=a,e[32]=l,e[33]=h,e[34]=D,e[35]=w,e[36]=p,e[37]=I,e[38]=x,e[39]=T):T=e[39],T},"MemberInviteDialog"),Jt=n(t=>{let e=(0,W.c)(32),{member:l,onClose:d,onDone:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),c;e[0]!==l.role?(c=z(l.role),e[0]=l.role,e[1]=c):c=e[1];let[k,u]=(0,L.useState)(c),g;e[2]!==r||e[3]!==l.id||e[4]!==d||e[5]!==f||e[6]!==k||e[7]!==m?(g=n(()=>{m(async()=>{await r.setAuthOrgMemberRole({memberId:z(l.id),role:k.trim()}),f(),d()})},"t2"),e[2]=r,e[3]=l.id,e[4]=d,e[5]=f,e[6]=k,e[7]=m,e[8]=g):g=e[8];let y=g,h;e[9]!==k?(h=k.trim(),e[9]=k,e[10]=h):h=e[10];let b=h!=="",w;e[11]!==i?(w=i("Save"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("Change member role"),e[13]=i,e[14]=p):p=e[14];let I;e[15]!==i?(I=i("Role"),e[15]=i,e[16]=I):I=e[16];let v;e[17]===Symbol.for("react.memo_cache_sentinel")?(v=n(N=>{u(N.target.value)},"t8"),e[17]=v):v=e[17];let S;e[18]!==k?(S=(0,o.jsxDEV)(Y,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:v,value:k},void 0,!1),e[18]=k,e[19]=S):S=e[19];let C;e[20]!==I||e[21]!==S?(C=(0,o.jsxDEV)(K,{htmlFor:"org-member-role-value",label:I,children:S},void 0,!1),e[20]=I,e[21]=S,e[22]=C):C=e[22];let x;return e[23]!==s||e[24]!==a||e[25]!==d||e[26]!==y||e[27]!==C||e[28]!==b||e[29]!==w||e[30]!==p?(x=(0,o.jsxDEV)(de,{busy:s,canSubmit:b,error:a,onClose:d,onSubmit:y,submitLabel:w,testId:"org-member-role",title:p,children:C},void 0,!1),e[23]=s,e[24]=a,e[25]=d,e[26]=y,e[27]=C,e[28]=b,e[29]=w,e[30]=p,e[31]=x):x=e[31],x},"MemberRoleDialog"),_t=n(t=>{let e=(0,W.c)(36),{mode:l,onClose:d,onDone:f,organizationId:r,team:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.name):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==s||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==f||e[7]!==r||e[8]!==k||e[9]!==i?.id?(h=n(()=>{k(async()=>{await(l==="create"?s.createAuthOrgTeam({name:g.trim(),organizationId:r}):s.updateAuthOrgTeam({name:g.trim(),teamId:z(i?.id)})),f(),d()})},"t2"),e[2]=s,e[3]=l,e[4]=g,e[5]=d,e[6]=f,e[7]=r,e[8]=k,e[9]=i?.id,e[10]=h):h=e[10];let b=h,w;e[11]!==g?(w=g.trim(),e[11]=g,e[12]=w):w=e[12];let p=w!=="",I;e[13]!==l||e[14]!==a?(I=a(l==="create"?"Create":"Save"),e[13]=l,e[14]=a,e[15]=I):I=e[15];let v;e[16]!==l||e[17]!==a?(v=a(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=a,e[18]=v):v=e[18];let S;e[19]!==a?(S=a("name"),e[19]=a,e[20]=S):S=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=n(A=>{y(A.target.value)},"t8"),e[21]=C):C=e[21];let x;e[22]!==g?(x=(0,o.jsxDEV)(Y,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g},void 0,!1),e[22]=g,e[23]=x):x=e[23];let N;e[24]!==S||e[25]!==x?(N=(0,o.jsxDEV)(K,{htmlFor:"org-team-form-name",label:S,children:x},void 0,!1),e[24]=S,e[25]=x,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==c||e[29]!==d||e[30]!==b||e[31]!==N||e[32]!==p||e[33]!==I||e[34]!==v?(_=(0,o.jsxDEV)(de,{busy:m,canSubmit:p,error:c,onClose:d,onSubmit:b,submitLabel:I,testId:"org-team-form",title:v,children:N},void 0,!1),e[27]=m,e[28]=c,e[29]=d,e[30]=b,e[31]=N,e[32]=p,e[33]=I,e[34]=v,e[35]=_):_=e[35],_},"TeamFormDialog"),Ut=n(t=>{let e=(0,W.c)(30),{onClose:l,onDone:d,teamId:f}=t,r=ie(),i=X(),{busy:s,error:a,run:m}=re(),[c,k]=(0,L.useState)(""),u;e[0]!==r||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==f||e[5]!==c?(u=n(()=>{m(async()=>{await r.addAuthOrgTeamMember({teamId:f,userId:c.trim()}),d(),l()})},"t1"),e[0]=r,e[1]=l,e[2]=d,e[3]=m,e[4]=f,e[5]=c,e[6]=u):u=e[6];let g=u,y;e[7]!==c?(y=c.trim(),e[7]=c,e[8]=y):y=e[8];let h=y!=="",b;e[9]!==i?(b=i("Add member"),e[9]=i,e[10]=b):b=e[10];let w;e[11]!==i?(w=i("Add team member"),e[11]=i,e[12]=w):w=e[12];let p;e[13]!==i?(p=i("User id"),e[13]=i,e[14]=p):p=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=n(x=>{k(x.target.value)},"t7"),e[15]=I):I=e[15];let v;e[16]!==c?(v=(0,o.jsxDEV)(Y,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:c},void 0,!1),e[16]=c,e[17]=v):v=e[17];let S;e[18]!==p||e[19]!==v?(S=(0,o.jsxDEV)(K,{htmlFor:"org-team-add-member-user",label:p,children:v},void 0,!1),e[18]=p,e[19]=v,e[20]=S):S=e[20];let C;return e[21]!==s||e[22]!==a||e[23]!==l||e[24]!==g||e[25]!==h||e[26]!==b||e[27]!==w||e[28]!==S?(C=(0,o.jsxDEV)(de,{busy:s,canSubmit:h,error:a,onClose:l,onSubmit:g,submitLabel:b,testId:"org-team-add-member",title:w,children:S},void 0,!1),e[21]=s,e[22]=a,e[23]=l,e[24]=g,e[25]=h,e[26]=b,e[27]=w,e[28]=S,e[29]=C):C=e[29],C},"TeamMemberAddDialog"),$t=n(t=>{let e=(0,W.c)(47),{mode:l,onClose:d,onDone:f,organizationId:r,role:i}=t,s=ie(),a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==i?(u=i?z(i.role):"",e[0]=i,e[1]=u):u=e[1];let[g,y]=(0,L.useState)(u),h;e[2]!==l||e[3]!==i?.permission?(h=l==="edit"?Mt(i?.permission):"",e[2]=l,e[3]=i?.permission,e[4]=h):h=e[4];let[b,w]=(0,L.useState)(h),p;e[5]!==s||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==f||e[10]!==r||e[11]!==b||e[12]!==i?.id||e[13]!==k?(p=n(()=>{k(async()=>{let $=jt(b);await(l==="create"?s.createAuthOrgRole({organizationId:r,permission:$,role:g.trim()}):s.updateAuthOrgRole({permission:$,roleId:z(i?.id)})),f(),d()})},"t3"),e[5]=s,e[6]=l,e[7]=g,e[8]=d,e[9]=f,e[10]=r,e[11]=b,e[12]=i?.id,e[13]=k,e[14]=p):p=e[14];let I=p,v;e[15]!==l||e[16]!==g||e[17]!==b?(v=b.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=b,e[18]=v):v=e[18];let S;e[19]!==l||e[20]!==a?(S=a(l==="create"?"Create":"Save"),e[19]=l,e[20]=a,e[21]=S):S=e[21];let C;e[22]!==l||e[23]!==a?(C=a(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=a,e[24]=C):C=e[24];let x;e[25]!==l||e[26]!==g||e[27]!==a?(x=l==="create"&&(0,o.jsxDEV)(K,{htmlFor:"org-role-form-name",label:a("Role name"),children:(0,o.jsxDEV)(Y,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:n($=>{y($.target.value)},"onChange"),value:g},void 0,!1)},void 0,!1),e[25]=l,e[26]=g,e[27]=a,e[28]=x):x=e[28];let N;e[29]!==a?(N=a('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=a,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=n($=>{w($.target.value)},"t9"),e[31]=_):_=e[31];let A;e[32]!==b?(A=(0,o.jsxDEV)(xt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:b},void 0,!1),e[32]=b,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,o.jsxDEV)(K,{htmlFor:"org-role-form-permission",label:N,children:A},void 0,!1),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==m||e[38]!==c||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==v||e[43]!==S||e[44]!==C||e[45]!==x?(T=(0,o.jsxDEV)(de,{busy:m,canSubmit:v,error:c,onClose:d,onSubmit:I,submitLabel:S,testId:"org-role-form",title:C,children:[x,D]},void 0,!0),e[37]=m,e[38]=c,e[39]=d,e[40]=I,e[41]=D,e[42]=v,e[43]=S,e[44]=C,e[45]=x,e[46]=T):T=e[46],T},"RoleFormDialog"),Ft=n(t=>{let e=(0,W.c)(18),{action:l,message:d,onClose:f,onDone:r,testId:i,title:s}=t,a=X(),{busy:m,error:c,run:k}=re(),u;e[0]!==l||e[1]!==f||e[2]!==r||e[3]!==k?(u=n(()=>{k(async()=>{await l(),r(),f()})},"t1"),e[0]=l,e[1]=f,e[2]=r,e[3]=k,e[4]=u):u=e[4];let g=u,y;e[5]!==a?(y=a("Delete"),e[5]=a,e[6]=y):y=e[6];let h;e[7]!==d?(h=(0,o.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:d},void 0,!1),e[7]=d,e[8]=h):h=e[8];let b;return e[9]!==m||e[10]!==c||e[11]!==f||e[12]!==g||e[13]!==y||e[14]!==h||e[15]!==i||e[16]!==s?(b=(0,o.jsxDEV)(de,{busy:m,canSubmit:!0,destructive:!0,error:c,onClose:f,onSubmit:g,submitLabel:y,testId:i,title:s,children:h},void 0,!1),e[9]=m,e[10]=c,e[11]=f,e[12]=g,e[13]=y,e[14]=h,e[15]=i,e[16]=s,e[17]=b):b=e[17],b},"ConfirmDialog"),et=n(t=>{let e=(0,W.c)(13),{action:l,children:d,heading:f,testId:r}=t,i;e[0]!==f?(i=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f},void 0,!1),e[0]=f,e[1]=i):i=e[1];let s;e[2]!==l?(s=l!==void 0&&(0,o.jsxDEV)("div",{className:"flex items-center gap-2",children:l},void 0,!1),e[2]=l,e[3]=s):s=e[3];let a;e[4]!==i||e[5]!==s?(a=(0,o.jsxDEV)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,s]},void 0,!0),e[4]=i,e[5]=s,e[6]=a):a=e[6];let m;e[7]!==d?(m=(0,o.jsxDEV)(bt,{className:"px-0",children:d},void 0,!1),e[7]=d,e[8]=m):m=e[8];let c;return e[9]!==a||e[10]!==m||e[11]!==r?(c=(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0","data-testid":r,children:[a,m]},void 0,!0),e[9]=a,e[10]=m,e[11]=r,e[12]=c):c=e[12],c},"SectionCard"),tt=n(t=>{let e=(0,W.c)(23),{columns:l,rowActions:d,rowPrefix:f,rows:r}=t,i=X(),s;e[0]!==l?(s=l.map(Ht),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==i?(a=i("Actions"),e[2]=i,e[3]=a):a=e[3];let m;e[4]!==a?(m=(0,o.jsxDEV)(ae,{"aria-label":a},void 0,!1),e[4]=a,e[5]=m):m=e[5];let c;e[6]!==s||e[7]!==m?(c=(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[s,m]},void 0,!0)},void 0,!1),e[6]=s,e[7]=m,e[8]=c):c=e[8];let k;if(e[9]!==l||e[10]!==d||e[11]!==f||e[12]!==r){let y;e[14]!==l||e[15]!==d||e[16]!==f?(y=n(h=>{let b=z(h.id);return(0,o.jsxDEV)(Ze,{"data-testid":`${f}-${b}`,children:[l.map(w=>(0,o.jsxDEV)(ne,{className:w.className,children:w.render(h)},w.head,!1)),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:d(h)},void 0,!1)},void 0,!1)]},b,!0)},"t62"),e[14]=l,e[15]=d,e[16]=f,e[17]=y):y=e[17],k=r.map(y),e[9]=l,e[10]=d,e[11]=f,e[12]=r,e[13]=k}else k=e[13];let u;e[18]!==k?(u=(0,o.jsxDEV)(Ct,{children:k},void 0,!1),e[18]=k,e[19]=u):u=e[19];let g;return e[20]!==c||e[21]!==u?(g=(0,o.jsxDEV)(pt,{children:[c,u]},void 0,!0),e[20]=c,e[21]=u,e[22]=g):g=e[22],g},"ManagedTable"),Bt=n(t=>{let e=(0,W.c)(213),{organizationId:l,rolesEnabled:d,teamsEnabled:f}=t,r=ie(),i=X(),[s,a]=(0,L.useState)(null),[m,c]=(0,L.useState)(null),k;e[0]!==l?(k=["lunora-auth-org-members",l],e[0]=l,e[1]=k):k=e[1];let u;e[2]!==r||e[3]!==l?(u=n(()=>r.listAuthOrgMembers({limit:200,organizationId:l}),"t2"),e[2]=r,e[3]=l,e[4]=u):u=e[4];let g=ce(k,u),y;e[5]!==l?(y=["lunora-auth-org-invitations",l],e[5]=l,e[6]=y):y=e[6];let h;e[7]!==r||e[8]!==l?(h=n(()=>r.listAuthOrgInvitations({limit:200,organizationId:l}),"t4"),e[7]=r,e[8]=l,e[9]=h):h=e[9];let b=ce(y,h),w;e[10]!==l?(w=["lunora-auth-org-teams",l],e[10]=l,e[11]=w):w=e[11];let p;e[12]!==r||e[13]!==l?(p=n(()=>r.listAuthOrgTeams({limit:200,organizationId:l}),"t6"),e[12]=r,e[13]=l,e[14]=p):p=e[14];let I;e[15]!==f?(I={enabled:f},e[15]=f,e[16]=I):I=e[16];let v=ce(w,p,I),S;e[17]!==l?(S=["lunora-auth-org-roles",l],e[17]=l,e[18]=S):S=e[18];let C;e[19]!==r||e[20]!==l?(C=n(()=>r.listAuthOrgRoles({limit:200,organizationId:l}),"t9"),e[19]=r,e[20]=l,e[21]=C):C=e[21];let x;e[22]!==d?(x={enabled:d},e[22]=d,e[23]=x):x=e[23];let N=ce(S,C,x),_;e[24]!==m?(_=["lunora-auth-org-team-members",m],e[24]=m,e[25]=_):_=e[25];let A;e[26]!==r||e[27]!==m?(A=n(()=>r.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"t12"),e[26]=r,e[27]=m,e[28]=A):A=e[28];let D=m!==null,T;e[29]!==D?(T={enabled:D},e[29]=D,e[30]=T):T=e[30];let $=ce(_,A,T),j;e[31]!==g.data?.rows?(j=g.data?.rows??[],e[31]=g.data?.rows,e[32]=j):j=e[32];let U=j,P;e[33]!==b.data?.rows?(P=b.data?.rows??[],e[33]=b.data?.rows,e[34]=P):P=e[34];let Q=P,J;e[35]!==v.data?.rows?(J=v.data?.rows??[],e[35]=v.data?.rows,e[36]=J):J=e[36];let q=J,M;e[37]!==N.data?.rows?(M=N.data?.rows??[],e[37]=N.data?.rows,e[38]=M):M=e[38];let F=M,B;e[39]!==m||e[40]!==$?(B=m===null?[]:$.data?.rows??[],e[39]=m,e[40]=$,e[41]=B):B=e[41];let oe=B,Z=g.error??b.error??v.error??N.error??$.error,ee;e[42]!==b||e[43]!==g||e[44]!==d||e[45]!==N||e[46]!==m||e[47]!==$||e[48]!==f||e[49]!==v?(ee=n(()=>{g.refetch(),b.refetch(),f&&v.refetch(),d&&N.refetch(),m!==null&&$.refetch()},"t20"),e[42]=b,e[43]=g,e[44]=d,e[45]=N,e[46]=m,e[47]=$,e[48]=f,e[49]=v,e[50]=ee):ee=e[50];let O=ee;It(O,!0);let te;e[51]===Symbol.for("react.memo_cache_sentinel")?(te=n(()=>{a(null)},"t21"),e[51]=te):te=e[51];let G=te,le;e[52]!==O?(le=n(R=>{St((async()=>{await R(),O()})())},"t22"),e[52]=O,e[53]=le):le=e[53];let H=le,se;e[54]!==r||e[55]!==i?(se=n(R=>{let kt=z(R.id);a({action:n(async()=>{await r.removeAuthOrgTeam({teamId:kt}),c(wt=>wt===kt?null:wt)},"action"),kind:"confirm",message:i("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:i("Delete team")})},"t23"),e[54]=r,e[55]=i,e[56]=se):se=e[56];let V=se,fe;e[57]!==i?(fe=i("userId"),e[57]=i,e[58]=fe):fe=e[58];let ue;e[59]!==fe?(ue={head:fe,render:Vt},e[59]=fe,e[60]=ue):ue=e[60];let ge;e[61]!==i?(ge=i("role"),e[61]=i,e[62]=ge):ge=e[62];let ve;e[63]!==ge?(ve={head:ge,render:qt},e[63]=ge,e[64]=ve):ve=e[64];let lt;e[65]!==ue||e[66]!==ve?(lt=[ue,ve],e[65]=ue,e[66]=ve,e[67]=lt):lt=e[67];let mt=lt,he;e[68]!==i?(he=i("email"),e[68]=i,e[69]=he):he=e[69];let be;e[70]!==he?(be={head:he,render:Gt},e[70]=he,e[71]=be):be=e[71];let pe;e[72]!==i?(pe=i("role"),e[72]=i,e[73]=pe):pe=e[73];let ye;e[74]!==pe?(ye={head:pe,render:Kt},e[74]=pe,e[75]=ye):ye=e[75];let Ce;e[76]!==i?(Ce=i("status"),e[76]=i,e[77]=Ce):Ce=e[77];let xe;e[78]!==Ce?(xe={head:Ce,render:Wt},e[78]=Ce,e[79]=xe):xe=e[79];let it;e[80]!==be||e[81]!==ye||e[82]!==xe?(it=[be,ye,xe],e[80]=be,e[81]=ye,e[82]=xe,e[83]=it):it=e[83];let ct=it,Ie;e[84]!==i?(Ie=i("id"),e[84]=i,e[85]=Ie):Ie=e[85];let ke;e[86]!==Ie?(ke={className:"font-mono text-xs",head:Ie,render:Xt},e[86]=Ie,e[87]=ke):ke=e[87];let we;e[88]!==i?(we=i("name"),e[88]=i,e[89]=we):we=e[89];let Se;e[90]!==we?(Se={head:we,render:Yt},e[90]=we,e[91]=Se):Se=e[91];let ot;e[92]!==ke||e[93]!==Se?(ot=[ke,Se],e[92]=ke,e[93]=Se,e[94]=ot):ot=e[94];let ft=ot,Ne;e[95]!==i?(Ne=i("userId"),e[95]=i,e[96]=Ne):Ne=e[96];let st;e[97]!==Ne?(st=[{head:Ne,render:Zt}],e[97]=Ne,e[98]=st):st=e[98];let ut=st,ze;e[99]!==i?(ze=i("role"),e[99]=i,e[100]=ze):ze=e[100];let Ae;e[101]!==ze?(Ae={head:ze,render:el},e[101]=ze,e[102]=Ae):Ae=e[102];let De;e[103]!==i?(De=i("Permission"),e[103]=i,e[104]=De):De=e[104];let Oe;e[105]!==De?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:De,render:tl},e[105]=De,e[106]=Oe):Oe=e[106];let rt;e[107]!==Ae||e[108]!==Oe?(rt=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=rt):rt=e[109];let gt=rt,_e;e[110]!==Z?(_e=Z!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:Z},void 0,!1),e[110]=Z,e[111]=_e):_e=e[111];let at;e[112]===Symbol.for("react.memo_cache_sentinel")?(at=n(()=>{a({kind:"add-member"})},"t49"),e[112]=at):at=e[112];let $e;e[113]!==i?($e=i("Add member"),e[113]=i,e[114]=$e):$e=e[114];let Te;e[115]!==$e?(Te=(0,o.jsxDEV)(E,{"data-testid":"org-open-add-member",onClick:at,size:"xs",type:"button",variant:"outline",children:$e},void 0,!1),e[115]=$e,e[116]=Te):Te=e[116];let nt;e[117]===Symbol.for("react.memo_cache_sentinel")?(nt=n(()=>{a({kind:"invite-member"})},"t52"),e[117]=nt):nt=e[117];let Me;e[118]!==i?(Me=i("Invite member"),e[118]=i,e[119]=Me):Me=e[119];let Fe;e[120]!==Me?(Fe=(0,o.jsxDEV)(E,{"data-testid":"org-open-invite-member",onClick:nt,size:"xs",type:"button",variant:"outline",children:Me},void 0,!1),e[120]=Me,e[121]=Fe):Fe=e[121];let Re;e[122]!==Te||e[123]!==Fe?(Re=(0,o.jsxDEV)(o.Fragment,{children:[Te,Fe]},void 0,!0),e[122]=Te,e[123]=Fe,e[124]=Re):Re=e[124];let Ee;e[125]!==i?(Ee=i("Members"),e[125]=i,e[126]=Ee):Ee=e[126];let Le;e[127]!==r||e[128]!==mt||e[129]!==U||e[130]!==H||e[131]!==i?(Le=U.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-members-empty",title:i("No members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:mt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-member-role-${z(R.id)}`,onClick:n(()=>{a({kind:"member-role",member:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Change role")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgMember({memberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-member",rows:U},void 0,!1),e[127]=r,e[128]=mt,e[129]=U,e[130]=H,e[131]=i,e[132]=Le):Le=e[132];let je;e[133]!==Re||e[134]!==Ee||e[135]!==Le?(je=(0,o.jsxDEV)(et,{action:Re,heading:Ee,testId:"org-members",children:Le},void 0,!1),e[133]=Re,e[134]=Ee,e[135]=Le,e[136]=je):je=e[136];let Pe;e[137]!==r||e[138]!==ct||e[139]!==Q||e[140]!==H||e[141]!==i?(Pe=Q.length>0&&(0,o.jsxDEV)(et,{heading:i("Invitations"),testId:"org-invitations",children:(0,o.jsxDEV)(tt,{columns:ct,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-cancel-invitation-${z(R.id)}`,onClick:n(()=>{H(()=>r.cancelAuthOrgInvitation({invitationId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Cancel")},void 0,!1),"rowActions"),rowPrefix:"org-invitation",rows:Q},void 0,!1)},void 0,!1),e[137]=r,e[138]=ct,e[139]=Q,e[140]=H,e[141]=i,e[142]=Pe):Pe=e[142];let Qe;e[143]!==V||e[144]!==m||e[145]!==i||e[146]!==ft||e[147]!==q||e[148]!==f?(Qe=f&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-team",onClick:n(()=>{a({kind:"team-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New team")},void 0,!1),heading:i("Teams"),testId:"org-teams",children:q.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-teams-empty",title:i("No teams.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ft,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"aria-pressed":m===z(R.id),"data-testid":`org-team-select-${z(R.id)}`,onClick:n(()=>{c(z(R.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Members")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-rename-${z(R.id)}`,onClick:n(()=>{a({kind:"team-rename",team:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Rename")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-team-delete-${z(R.id)}`,onClick:n(()=>{V(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-team",rows:q},void 0,!1)},void 0,!1),e[143]=V,e[144]=m,e[145]=i,e[146]=ft,e[147]=q,e[148]=f,e[149]=Qe):Qe=e[149];let Je;e[150]!==r||e[151]!==H||e[152]!==m||e[153]!==i||e[154]!==ut||e[155]!==oe||e[156]!==f?(Je=f&&m!==null&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-add-team-member",onClick:n(()=>{a({kind:"team-add-member",teamId:m})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("Add member")},void 0,!1),heading:i("Team members"),testId:"org-team-members",children:oe.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-team-members-empty",title:i("No team members.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:ut,rowActions:n(R=>(0,o.jsxDEV)(E,{"data-testid":`org-team-remove-member-${z(R.id)}`,onClick:n(()=>{H(()=>r.removeAuthOrgTeamMember({teamMemberId:z(R.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Remove")},void 0,!1),"rowActions"),rowPrefix:"org-team-member",rows:oe},void 0,!1)},void 0,!1),e[150]=r,e[151]=H,e[152]=m,e[153]=i,e[154]=ut,e[155]=oe,e[156]=f,e[157]=Je):Je=e[157];let Ue;e[158]!==r||e[159]!==gt||e[160]!==F||e[161]!==d||e[162]!==i?(Ue=d&&(0,o.jsxDEV)(et,{action:(0,o.jsxDEV)(E,{"data-testid":"org-open-create-role",onClick:n(()=>{a({kind:"role-create"})},"onClick"),size:"xs",type:"button",variant:"outline",children:i("New role")},void 0,!1),heading:i("Roles"),testId:"org-roles",children:F.length===0?(0,o.jsxDEV)("div",{className:"p-3",children:(0,o.jsxDEV)(me,{testId:"org-roles-empty",title:i("No custom roles.")},void 0,!1)},void 0,!1):(0,o.jsxDEV)(tt,{columns:gt,rowActions:n(R=>(0,o.jsxDEV)(o.Fragment,{children:[(0,o.jsxDEV)(E,{"data-testid":`org-role-edit-${z(R.id)}`,onClick:n(()=>{a({kind:"role-edit",role:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-role-delete-${z(R.id)}`,onClick:n(()=>{a({action:n(()=>r.deleteAuthOrgRole({roleId:z(R.id)}),"action"),kind:"confirm",message:i("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:i("Delete role")})},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Delete")},void 0,!1)]},void 0,!0),"rowActions"),rowPrefix:"org-role",rows:F},void 0,!1)},void 0,!1),e[158]=r,e[159]=gt,e[160]=F,e[161]=d,e[162]=i,e[163]=Ue):Ue=e[163];let Be;e[164]!==s?.kind||e[165]!==l||e[166]!==O?(Be=s?.kind==="add-member"&&(0,o.jsxDEV)(Pt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[164]=s?.kind,e[165]=l,e[166]=O,e[167]=Be):Be=e[167];let He;e[168]!==s?.kind||e[169]!==l||e[170]!==O?(He=s?.kind==="invite-member"&&(0,o.jsxDEV)(Qt,{onClose:G,onDone:O,organizationId:l},void 0,!1),e[168]=s?.kind,e[169]=l,e[170]=O,e[171]=He):He=e[171];let Ve;e[172]!==s||e[173]!==O?(Ve=s?.kind==="member-role"&&(0,o.jsxDEV)(Jt,{member:s.member,onClose:G,onDone:O},void 0,!1),e[172]=s,e[173]=O,e[174]=Ve):Ve=e[174];let qe;e[175]!==s?.kind||e[176]!==l||e[177]!==O?(qe=s?.kind==="team-create"&&(0,o.jsxDEV)(_t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[175]=s?.kind,e[176]=l,e[177]=O,e[178]=qe):qe=e[178];let Ge;e[179]!==s||e[180]!==l||e[181]!==O?(Ge=s?.kind==="team-rename"&&(0,o.jsxDEV)(_t,{mode:"edit",onClose:G,onDone:O,organizationId:l,team:s.team},void 0,!1),e[179]=s,e[180]=l,e[181]=O,e[182]=Ge):Ge=e[182];let Ke;e[183]!==s||e[184]!==O?(Ke=s?.kind==="team-add-member"&&(0,o.jsxDEV)(Ut,{onClose:G,onDone:O,teamId:s.teamId},void 0,!1),e[183]=s,e[184]=O,e[185]=Ke):Ke=e[185];let We;e[186]!==s?.kind||e[187]!==l||e[188]!==O?(We=s?.kind==="role-create"&&(0,o.jsxDEV)($t,{mode:"create",onClose:G,onDone:O,organizationId:l},void 0,!1),e[186]=s?.kind,e[187]=l,e[188]=O,e[189]=We):We=e[189];let Xe;e[190]!==s||e[191]!==l||e[192]!==O?(Xe=s?.kind==="role-edit"&&(0,o.jsxDEV)($t,{mode:"edit",onClose:G,onDone:O,organizationId:l,role:s.role},void 0,!1),e[190]=s,e[191]=l,e[192]=O,e[193]=Xe):Xe=e[193];let Ye;e[194]!==s||e[195]!==O?(Ye=s?.kind==="confirm"&&(0,o.jsxDEV)(Ft,{action:s.action,message:s.message,onClose:G,onDone:O,testId:s.testId,title:s.title},void 0,!1),e[194]=s,e[195]=O,e[196]=Ye):Ye=e[196];let dt;return e[197]!==_e||e[198]!==je||e[199]!==Pe||e[200]!==Qe||e[201]!==Je||e[202]!==Ue||e[203]!==Be||e[204]!==He||e[205]!==Ve||e[206]!==qe||e[207]!==Ge||e[208]!==Ke||e[209]!==We||e[210]!==Xe||e[211]!==Ye?(dt=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[_e,je,Pe,Qe,Je,Ue,Be,He,Ve,qe,Ge,Ke,We,Xe,Ye]},void 0,!0),e[197]=_e,e[198]=je,e[199]=Pe,e[200]=Qe,e[201]=Je,e[202]=Ue,e[203]=Be,e[204]=He,e[205]=Ve,e[206]=qe,e[207]=Ge,e[208]=Ke,e[209]=We,e[210]=Xe,e[211]=Ye,e[212]=dt):dt=e[212],dt},"OrganizationDetail");function Ht(t){return(0,o.jsxDEV)(ae,{children:t.head},t.head,!1)}n(Ht,"_temp");function Vt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Vt,"_temp2");function qt(t){return z(t.role)}n(qt,"_temp3");function Gt(t){return z(t.email)}n(Gt,"_temp4");function Kt(t){return z(t.role)}n(Kt,"_temp5");function Wt(t){return z(t.status)}n(Wt,"_temp6");function Xt(t){return z(t.id)}n(Xt,"_temp7");function Yt(t){return z(t.name)}n(Yt,"_temp8");function Zt(t){return(0,o.jsxDEV)("span",{className:"font-mono text-xs",children:z(t.userId)},void 0,!1)}n(Zt,"_temp9");function el(t){return z(t.role)}n(el,"_temp0");function tl(t){return z(t.permission)}n(tl,"_temp1");var hl=n(()=>{let t=(0,W.c)(62),e=ie(),l=X(),{config:d,ready:f}=At(),r=d.capabilities.organization,[i,s]=(0,L.useState)(null),[a,m]=(0,L.useState)(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-auth-orgs"],t[0]=c):c=t[0];let k;t[1]!==e?(k=n(()=>e.listAuthOrganizations({limit:100}),"t1"),t[1]=e,t[2]=k):k=t[2];let u;t[3]!==r?(u={enabled:r},t[3]=r,t[4]=u):u=t[4];let g=ce(c,k,u),y=g.data?.rows??null,h;t[5]!==g?(h=n(()=>{g.refetch()},"t3"),t[5]=g,t[6]=h):h=t[6],It(h,r);let b;t[7]===Symbol.for("react.memo_cache_sentinel")?(b=n(()=>{m(null)},"t4"),t[7]=b):b=t[7];let w=b,p;t[8]!==g?(p=n(()=>{g.refetch()},"t5"),t[8]=g,t[9]=p):p=t[9];let I=p,v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n(M=>{s(M)},"t6"),t[10]=v):v=t[10];let S=v;if(f&&!r){let M;t[11]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=l,t[12]=M):M=t[12];let F;t[13]!==l?(F=l("Organizations are not enabled."),t[13]=l,t[14]=F):F=t[14];let B;return t[15]!==M||t[16]!==F?(B=(0,o.jsxDEV)(me,{description:M,testId:"org-disabled",title:F},void 0,!1),t[15]=M,t[16]=F,t[17]=B):B=t[17],B}let C;t[18]!==l?(C=l("Organizations"),t[18]=l,t[19]=C):C=t[19];let x;t[20]!==C?(x=(0,o.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C},void 0,!1),t[20]=C,t[21]=x):x=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=n(()=>{m({kind:"create"})},"t9"),t[22]=N):N=t[22];let _;t[23]!==l?(_=l("New organization"),t[23]=l,t[24]=_):_=t[24];let A;t[25]!==_?(A=(0,o.jsxDEV)(E,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:_},void 0,!1),t[25]=_,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==x?(D=(0,o.jsxDEV)("div",{className:"flex items-center justify-between",children:[x,A]},void 0,!0),t[27]=A,t[28]=x,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,o.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error},void 0,!1),t[30]=g.error,t[31]=T):T=t[31];let $;t[32]!==y||t[33]!==l?($=y!==null&&y.length===0&&(0,o.jsxDEV)(me,{testId:"org-empty",title:l("No organizations.")},void 0,!1),t[32]=y,t[33]=l,t[34]=$):$=t[34];let j;t[35]!==y||t[36]!==i||t[37]!==l?(j=y!==null&&y.length>0&&(0,o.jsxDEV)(ht,{className:"overflow-hidden py-0",children:(0,o.jsxDEV)(bt,{className:"px-0",children:(0,o.jsxDEV)(pt,{"data-testid":"org-table",children:[(0,o.jsxDEV)(yt,{children:(0,o.jsxDEV)(Ze,{children:[(0,o.jsxDEV)(ae,{children:l("id")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("name")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("slug")},void 0,!1),(0,o.jsxDEV)(ae,{children:l("created")},void 0,!1),(0,o.jsxDEV)(ae,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,o.jsxDEV)(Ct,{children:y.map(M=>{let F=z(M.id);return(0,o.jsxDEV)(Ze,{"data-testid":`org-row-${F}`,children:[(0,o.jsxDEV)(ne,{className:"font-mono text-xs",children:F},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.name)},void 0,!1),(0,o.jsxDEV)(ne,{children:z(M.slug)},void 0,!1),(0,o.jsxDEV)(ne,{className:"text-muted-foreground tabular-nums",children:Nt(M.createdAt)},void 0,!1),(0,o.jsxDEV)(ne,{children:(0,o.jsxDEV)("div",{className:"flex justify-end gap-1",children:[(0,o.jsxDEV)(E,{"aria-pressed":i===F,"data-testid":`org-select-${F}`,onClick:n(()=>{S(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-edit-${F}`,onClick:n(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Edit")},void 0,!1),(0,o.jsxDEV)(E,{"data-testid":`org-delete-${F}`,onClick:n(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Delete")},void 0,!1)]},void 0,!0)},void 0,!1)]},F,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),t[35]=y,t[36]=i,t[37]=l,t[38]=j):j=t[38];let U;t[39]!==d.organization||t[40]!==i?(U=i!==null&&(0,o.jsxDEV)(Bt,{organizationId:i,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams},void 0,!1),t[39]=d.organization,t[40]=i,t[41]=U):U=t[41];let P;t[42]!==a?.kind||t[43]!==I?(P=a?.kind==="create"&&(0,o.jsxDEV)(Ot,{mode:"create",onClose:w,onDone:I},void 0,!1),t[42]=a?.kind,t[43]=I,t[44]=P):P=t[44];let Q;t[45]!==a||t[46]!==I?(Q=a?.kind==="edit"&&(0,o.jsxDEV)(Ot,{mode:"edit",onClose:w,onDone:I,org:a.org},void 0,!1),t[45]=a,t[46]=I,t[47]=Q):Q=t[47];let J;t[48]!==e||t[49]!==a||t[50]!==I||t[51]!==l?(J=a?.kind==="delete"&&(0,o.jsxDEV)(Ft,{action:n(async()=>{let M=z(a.org.id);await e.deleteAuthOrganization({organizationId:M}),s(F=>F===M?null:F)},"action"),message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:w,onDone:I,testId:"org-delete",title:l("Delete organization")},void 0,!1),t[48]=e,t[49]=a,t[50]=I,t[51]=l,t[52]=J):J=t[52];let q;return t[53]!==D||t[54]!==T||t[55]!==$||t[56]!==j||t[57]!==U||t[58]!==P||t[59]!==Q||t[60]!==J?(q=(0,o.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,$,j,U,P,Q,J]},void 0,!0),t[53]=D,t[54]=T,t[55]=$,t[56]=j,t[57]=U,t[58]=P,t[59]=Q,t[60]=J,t[61]=q):q=t[61],q},"OrganizationsPanel");export{hl as OrganizationsPanel};
@@ -1 +1 @@
1
- import{a as Q}from"./chunk-CACB34RQ.js";import"./chunk-XNJNSCLM.js";import{a as O,b as $,c as j,d as S,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as L}from"./chunk-BOXSWNXZ.js";import{a as _}from"./chunk-TAD43CG5.js";import{b as F}from"./chunk-C7WTJLC3.js";import{a as B,e as D}from"./chunk-SEU5V7I6.js";import{b as k}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as U}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a as R,e as M,g as z,h as J}from"./chunk-RRCPZMC2.js";var q=M(z(),1);var l=M(J(),1);var V=["read","insert","update","delete"],K=R((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"operationLabel"),W=R(e=>{let s=new Map;for(let t of e){let r=s.get(t.table)??{operations:new Set,procedures:[],table:t.table};r.operations.add(t.on),r.procedures.includes(t.procedure)||r.procedures.push(t.procedure),s.set(t.table,r)}return[...s.values()].toSorted((t,r)=>t.table.localeCompare(r.table))},"groupByTable"),ie=R(()=>{let e=(0,q.c)(49),s=U(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={},e[0]=t):t=e[0];let{data:r,error:C,errorSource:I}=F(L.rlsPolicies,t),f=r!==void 0,p,d,m,a,u,h,v,b,o;if(e[1]!==r||e[2]!==C||e[3]!==I||e[4]!==f||e[5]!==s){let G=W(Array.isArray(r?.policies)?r.policies:[]),P;e[15]!==r?(P=Array.isArray(r?.roles)?r.roles:[],e[15]=r,e[16]=P):P=e[16],d=P,v="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==C||e[18]!==I?(o=C!==null&&(0,l.jsxDEV)(Q,{error:I,testId:"rls-error"},void 0,!1),e[17]=C,e[18]=I,e[19]=o):o=e[19],h="flex flex-col gap-2",p=B,m="overflow-hidden py-0";let A;e[20]!==s?(A=s("Policies"),e[20]=s,e[21]=A):A=e[21],e[22]!==A?(a=(0,l.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,l.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A},void 0,!1)},void 0,!1),e[22]=A,e[23]=a):a=e[23],u=f&&G.length===0?(0,l.jsxDEV)(_,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")},void 0,!1):(0,l.jsxDEV)(D,{className:"px-0",children:(0,l.jsxDEV)(O,{"data-testid":"rls-policies-table",children:[(0,l.jsxDEV)($,{children:(0,l.jsxDEV)(S,{children:[(0,l.jsxDEV)(n,{children:s("Table")},void 0,!1),V.map(i=>(0,l.jsxDEV)(n,{children:K(s,i)},i,!1)),(0,l.jsxDEV)(n,{children:s("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(j,{children:G.map(i=>(0,l.jsxDEV)(S,{"data-testid":`rls-table-${i.table}`,children:[(0,l.jsxDEV)(c,{className:"font-mono text-xs",children:i.table},void 0,!1),V.map(H=>(0,l.jsxDEV)(c,{children:i.operations.has(H)?(0,l.jsxDEV)(k,{variant:"secondary",children:s("Guarded")},void 0,!1):(0,l.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1)},H,!1)),(0,l.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:i.procedures.join(", ")},void 0,!1)]},i.table,!0))},void 0,!1)]},void 0,!0)},void 0,!1),e[1]=r,e[2]=C,e[3]=I,e[4]=f,e[5]=s,e[6]=p,e[7]=d,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=v,e[13]=b,e[14]=o}else p=e[6],d=e[7],m=e[8],a=e[9],u=e[10],h=e[11],v=e[12],b=e[13],o=e[14];let x;e[24]!==p||e[25]!==m||e[26]!==a||e[27]!==u?(x=(0,l.jsxDEV)(p,{className:m,children:[a,u]},void 0,!0),e[24]=p,e[25]=m,e[26]=a,e[27]=u,e[28]=x):x=e[28];let N;e[29]!==h||e[30]!==x?(N=(0,l.jsxDEV)("section",{className:h,children:x},void 0,!1),e[29]=h,e[30]=x,e[31]=N):N=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let g;e[34]!==y?(g=(0,l.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,l.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y},void 0,!1)},void 0,!1),e[34]=y,e[35]=g):g=e[35];let T;e[36]!==f||e[37]!==d||e[38]!==s?(T=f&&d.length===0?(0,l.jsxDEV)(_,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")},void 0,!1):(0,l.jsxDEV)(D,{className:"px-0",children:(0,l.jsxDEV)(O,{"data-testid":"rls-roles-table",children:[(0,l.jsxDEV)($,{children:(0,l.jsxDEV)(S,{children:[(0,l.jsxDEV)(n,{children:s("Role")},void 0,!1),(0,l.jsxDEV)(n,{children:s("Description")},void 0,!1),(0,l.jsxDEV)(n,{children:s("Permissions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(j,{children:d.map(Y)},void 0,!1)]},void 0,!0)},void 0,!1),e[36]=f,e[37]=d,e[38]=s,e[39]=T):T=e[39];let w;e[40]!==g||e[41]!==T?(w=(0,l.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,l.jsxDEV)(B,{className:"overflow-hidden py-0",children:[g,T]},void 0,!0)},void 0,!1),e[40]=g,e[41]=T,e[42]=w):w=e[42];let E;return e[43]!==w||e[44]!==v||e[45]!==b||e[46]!==o||e[47]!==N?(E=(0,l.jsxDEV)("div",{className:v,"data-testid":b,children:[o,N,w]},void 0,!0),e[43]=w,e[44]=v,e[45]=b,e[46]=o,e[47]=N,e[48]=E):E=e[48],E},"RlsPanel");function X(e){return(0,l.jsxDEV)(k,{variant:"outline",children:e},e,!1)}R(X,"_temp");function Y(e){return(0,l.jsxDEV)(S,{"data-testid":`rls-role-${e.name}`,children:[(0,l.jsxDEV)(c,{className:"font-mono text-xs",children:e.name},void 0,!1),(0,l.jsxDEV)(c,{className:"text-muted-foreground",children:e.description??""},void 0,!1),(0,l.jsxDEV)(c,{children:e.permissions.length===0?(0,l.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,l.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)},void 0,!1)},void 0,!1)]},e.name,!0)}R(Y,"_temp2");export{ie as default};
1
+ import{a as Q}from"./chunk-HN6KJXYQ.js";import"./chunk-XNJNSCLM.js";import{a as O,b as $,c as j,d as S,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as L}from"./chunk-BOXSWNXZ.js";import{a as _}from"./chunk-TAD43CG5.js";import{b as F}from"./chunk-RHZ4M2NZ.js";import{a as B,e as D}from"./chunk-SEU5V7I6.js";import{b as k}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-XLXNLJ4N.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as U}from"./chunk-E75ANNWX.js";import"./chunk-JHKMUTIF.js";import{a as R,e as M,g as z,h as J}from"./chunk-RRCPZMC2.js";var q=M(z(),1);var l=M(J(),1);var V=["read","insert","update","delete"],K=R((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"operationLabel"),W=R(e=>{let s=new Map;for(let t of e){let r=s.get(t.table)??{operations:new Set,procedures:[],table:t.table};r.operations.add(t.on),r.procedures.includes(t.procedure)||r.procedures.push(t.procedure),s.set(t.table,r)}return[...s.values()].toSorted((t,r)=>t.table.localeCompare(r.table))},"groupByTable"),ie=R(()=>{let e=(0,q.c)(49),s=U(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={},e[0]=t):t=e[0];let{data:r,error:C,errorSource:I}=F(L.rlsPolicies,t),f=r!==void 0,p,d,m,a,u,h,v,b,o;if(e[1]!==r||e[2]!==C||e[3]!==I||e[4]!==f||e[5]!==s){let G=W(Array.isArray(r?.policies)?r.policies:[]),P;e[15]!==r?(P=Array.isArray(r?.roles)?r.roles:[],e[15]=r,e[16]=P):P=e[16],d=P,v="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==C||e[18]!==I?(o=C!==null&&(0,l.jsxDEV)(Q,{error:I,testId:"rls-error"},void 0,!1),e[17]=C,e[18]=I,e[19]=o):o=e[19],h="flex flex-col gap-2",p=B,m="overflow-hidden py-0";let A;e[20]!==s?(A=s("Policies"),e[20]=s,e[21]=A):A=e[21],e[22]!==A?(a=(0,l.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,l.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A},void 0,!1)},void 0,!1),e[22]=A,e[23]=a):a=e[23],u=f&&G.length===0?(0,l.jsxDEV)(_,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")},void 0,!1):(0,l.jsxDEV)(D,{className:"px-0",children:(0,l.jsxDEV)(O,{"data-testid":"rls-policies-table",children:[(0,l.jsxDEV)($,{children:(0,l.jsxDEV)(S,{children:[(0,l.jsxDEV)(n,{children:s("Table")},void 0,!1),V.map(i=>(0,l.jsxDEV)(n,{children:K(s,i)},i,!1)),(0,l.jsxDEV)(n,{children:s("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(j,{children:G.map(i=>(0,l.jsxDEV)(S,{"data-testid":`rls-table-${i.table}`,children:[(0,l.jsxDEV)(c,{className:"font-mono text-xs",children:i.table},void 0,!1),V.map(H=>(0,l.jsxDEV)(c,{children:i.operations.has(H)?(0,l.jsxDEV)(k,{variant:"secondary",children:s("Guarded")},void 0,!1):(0,l.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1)},H,!1)),(0,l.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:i.procedures.join(", ")},void 0,!1)]},i.table,!0))},void 0,!1)]},void 0,!0)},void 0,!1),e[1]=r,e[2]=C,e[3]=I,e[4]=f,e[5]=s,e[6]=p,e[7]=d,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=v,e[13]=b,e[14]=o}else p=e[6],d=e[7],m=e[8],a=e[9],u=e[10],h=e[11],v=e[12],b=e[13],o=e[14];let x;e[24]!==p||e[25]!==m||e[26]!==a||e[27]!==u?(x=(0,l.jsxDEV)(p,{className:m,children:[a,u]},void 0,!0),e[24]=p,e[25]=m,e[26]=a,e[27]=u,e[28]=x):x=e[28];let N;e[29]!==h||e[30]!==x?(N=(0,l.jsxDEV)("section",{className:h,children:x},void 0,!1),e[29]=h,e[30]=x,e[31]=N):N=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let g;e[34]!==y?(g=(0,l.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,l.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y},void 0,!1)},void 0,!1),e[34]=y,e[35]=g):g=e[35];let T;e[36]!==f||e[37]!==d||e[38]!==s?(T=f&&d.length===0?(0,l.jsxDEV)(_,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")},void 0,!1):(0,l.jsxDEV)(D,{className:"px-0",children:(0,l.jsxDEV)(O,{"data-testid":"rls-roles-table",children:[(0,l.jsxDEV)($,{children:(0,l.jsxDEV)(S,{children:[(0,l.jsxDEV)(n,{children:s("Role")},void 0,!1),(0,l.jsxDEV)(n,{children:s("Description")},void 0,!1),(0,l.jsxDEV)(n,{children:s("Permissions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,l.jsxDEV)(j,{children:d.map(Y)},void 0,!1)]},void 0,!0)},void 0,!1),e[36]=f,e[37]=d,e[38]=s,e[39]=T):T=e[39];let w;e[40]!==g||e[41]!==T?(w=(0,l.jsxDEV)("section",{className:"flex flex-col gap-2",children:(0,l.jsxDEV)(B,{className:"overflow-hidden py-0",children:[g,T]},void 0,!0)},void 0,!1),e[40]=g,e[41]=T,e[42]=w):w=e[42];let E;return e[43]!==w||e[44]!==v||e[45]!==b||e[46]!==o||e[47]!==N?(E=(0,l.jsxDEV)("div",{className:v,"data-testid":b,children:[o,N,w]},void 0,!0),e[43]=w,e[44]=v,e[45]=b,e[46]=o,e[47]=N,e[48]=E):E=e[48],E},"RlsPanel");function X(e){return(0,l.jsxDEV)(k,{variant:"outline",children:e},e,!1)}R(X,"_temp");function Y(e){return(0,l.jsxDEV)(S,{"data-testid":`rls-role-${e.name}`,children:[(0,l.jsxDEV)(c,{className:"font-mono text-xs",children:e.name},void 0,!1),(0,l.jsxDEV)(c,{className:"text-muted-foreground",children:e.description??""},void 0,!1),(0,l.jsxDEV)(c,{children:e.permissions.length===0?(0,l.jsxDEV)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,l.jsxDEV)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)},void 0,!1)},void 0,!1)]},e.name,!0)}R(Y,"_temp2");export{ie as default};
@@ -1 +1 @@
1
- import{a as w}from"./chunk-CACB34RQ.js";import"./chunk-XNJNSCLM.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as S}from"./chunk-BOXSWNXZ.js";import{a as T}from"./chunk-TAD43CG5.js";import{b as k}from"./chunk-C7WTJLC3.js";import{a as N,e as R}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a as p,e as x,g as O,h as B}from"./chunk-RRCPZMC2.js";var I=x(O(),1);var t=x(B(),1);var D=p((e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],"operationLabel"),E={delete:2,list:3,read:0,write:1},_=p(e=>[...e].toSorted((r,a)=>r.bucket.localeCompare(a.bucket)||E[r.on]-E[a.on]||(r.prefix??"").localeCompare(a.prefix??"")),"sortRules"),Q=p(()=>{let e=(0,I.c)(14),r=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:d,errorSource:i}=k(S.storageRules,a),h=l!==void 0,f;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==r){let g=_(Array.isArray(l?.rules)?l.rules:[]),m;e[7]!==d||e[8]!==i?(m=d!==null&&(0,t.jsxDEV)(w,{error:i,testId:"storage-rules-error"},void 0,!1),e[7]=d,e[8]=i,e[9]=m):m=e[9];let s;e[10]!==r?(s=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=s):s=e[11];let u;e[12]!==s?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s},void 0,!1),e[12]=s,e[13]=u):u=e[13],f=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[m,u,h&&g.length===0?(0,t.jsxDEV)(T,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")},void 0,!1):(0,t.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(R,{className:"px-0",children:(0,t.jsxDEV)(C,{"data-testid":"storage-rules-table",children:[(0,t.jsxDEV)($,{children:(0,t.jsxDEV)(v,{children:[(0,t.jsxDEV)(n,{children:r("Bucket")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Operation")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Key prefix")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(A,{children:g.map(o=>(0,t.jsxDEV)(v,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.bucket},void 0,!1),(0,t.jsxDEV)(c,{children:(0,t.jsxDEV)(y,{variant:"secondary",children:D(r,o.on)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.prefix??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("(whole bucket)")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:o.procedure},void 0,!1)]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=r,e[6]=f}else f=e[6];return f},"StorageRulesPanel");export{Q as StorageRulesPanel};
1
+ import{a as w}from"./chunk-HN6KJXYQ.js";import"./chunk-XNJNSCLM.js";import{a as C,b as $,c as A,d as v,e as n,f as c}from"./chunk-GTM65MVX.js";import{a as S}from"./chunk-BOXSWNXZ.js";import{a as T}from"./chunk-TAD43CG5.js";import{b as k}from"./chunk-RHZ4M2NZ.js";import{a as N,e as R}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-XLXNLJ4N.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b}from"./chunk-E75ANNWX.js";import"./chunk-JHKMUTIF.js";import{a as p,e as x,g as O,h as B}from"./chunk-RRCPZMC2.js";var I=x(O(),1);var t=x(B(),1);var D=p((e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],"operationLabel"),E={delete:2,list:3,read:0,write:1},_=p(e=>[...e].toSorted((r,a)=>r.bucket.localeCompare(a.bucket)||E[r.on]-E[a.on]||(r.prefix??"").localeCompare(a.prefix??"")),"sortRules"),Q=p(()=>{let e=(0,I.c)(14),r=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:d,errorSource:i}=k(S.storageRules,a),h=l!==void 0,f;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==r){let g=_(Array.isArray(l?.rules)?l.rules:[]),m;e[7]!==d||e[8]!==i?(m=d!==null&&(0,t.jsxDEV)(w,{error:i,testId:"storage-rules-error"},void 0,!1),e[7]=d,e[8]=i,e[9]=m):m=e[9];let s;e[10]!==r?(s=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=s):s=e[11];let u;e[12]!==s?(u=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s},void 0,!1),e[12]=s,e[13]=u):u=e[13],f=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[m,u,h&&g.length===0?(0,t.jsxDEV)(T,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")},void 0,!1):(0,t.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(R,{className:"px-0",children:(0,t.jsxDEV)(C,{"data-testid":"storage-rules-table",children:[(0,t.jsxDEV)($,{children:(0,t.jsxDEV)(v,{children:[(0,t.jsxDEV)(n,{children:r("Bucket")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Operation")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Key prefix")},void 0,!1),(0,t.jsxDEV)(n,{children:r("Guarded by")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(A,{children:g.map(o=>(0,t.jsxDEV)(v,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.bucket},void 0,!1),(0,t.jsxDEV)(c,{children:(0,t.jsxDEV)(y,{variant:"secondary",children:D(r,o.on)},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs",children:o.prefix??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("(whole bucket)")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(c,{className:"font-mono text-xs text-muted-foreground",children:o.procedure},void 0,!1)]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=r,e[6]=f}else f=e[6];return f},"StorageRulesPanel");export{Q as StorageRulesPanel};
@@ -1 +1 @@
1
- import{a as V}from"./chunk-XNJNSCLM.js";import{g as w,h as A,i as E}from"./chunk-E75ANNWX.js";import{a as b}from"./chunk-GMSGZDDH.js";import{a as x,e as N,g as D,h as H}from"./chunk-RRCPZMC2.js";var g=N(D(),1);var d=N(H(),1);var y=x(k=>{let e=(0,g.c)(26),{className:u,error:t,testId:h}=k,o,l,i,s,a,r,n;if(e[0]!==u||e[1]!==t||e[2]!==h){let v=A(t),p;e[10]!==t?(p=E(t),e[10]=t,e[11]=p):p=e[11],l=p,o=V,i=u,s=h,a="destructive";let m;e[12]!==t?(m=w(t),e[12]=t,e[13]=m):m=e[13],e[14]!==m?(r=(0,d.jsxDEV)("p",{className:"font-medium",children:m},void 0,!1),e[14]=m,e[15]=r):r=e[15],n=v===void 0?null:(0,d.jsxDEV)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:b(v)},void 0,!1),e[0]=u,e[1]=t,e[2]=h,e[3]=o,e[4]=l,e[5]=i,e[6]=s,e[7]=a,e[8]=r,e[9]=n}else o=e[3],l=e[4],i=e[5],s=e[6],a=e[7],r=e[8],n=e[9];let c;e[16]!==l?(c=l===void 0?null:(0,d.jsxDEV)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"},void 0,!1),e[16]=l,e[17]=c):c=e[17];let f;return e[18]!==o||e[19]!==i||e[20]!==s||e[21]!==a||e[22]!==r||e[23]!==n||e[24]!==c?(f=(0,d.jsxDEV)(o,{className:i,testId:s,variant:a,children:[r,n,c]},void 0,!0),e[18]=o,e[19]=i,e[20]=s,e[21]=a,e[22]=r,e[23]=n,e[24]=c,e[25]=f):f=e[25],f},"ErrorAlert");export{y as a};
1
+ import{a as V}from"./chunk-XNJNSCLM.js";import{g as w,h as A,i as E}from"./chunk-E75ANNWX.js";import{a as b}from"./chunk-JHKMUTIF.js";import{a as x,e as N,g as D,h as H}from"./chunk-RRCPZMC2.js";var g=N(D(),1);var d=N(H(),1);var y=x(k=>{let e=(0,g.c)(26),{className:u,error:t,testId:h}=k,o,l,i,s,a,r,n;if(e[0]!==u||e[1]!==t||e[2]!==h){let v=A(t),p;e[10]!==t?(p=E(t),e[10]=t,e[11]=p):p=e[11],l=p,o=V,i=u,s=h,a="destructive";let m;e[12]!==t?(m=w(t),e[12]=t,e[13]=m):m=e[13],e[14]!==m?(r=(0,d.jsxDEV)("p",{className:"font-medium",children:m},void 0,!1),e[14]=m,e[15]=r):r=e[15],n=v===void 0?null:(0,d.jsxDEV)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:b(v)},void 0,!1),e[0]=u,e[1]=t,e[2]=h,e[3]=o,e[4]=l,e[5]=i,e[6]=s,e[7]=a,e[8]=r,e[9]=n}else o=e[3],l=e[4],i=e[5],s=e[6],a=e[7],r=e[8],n=e[9];let c;e[16]!==l?(c=l===void 0?null:(0,d.jsxDEV)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"},void 0,!1),e[16]=l,e[17]=c):c=e[17];let f;return e[18]!==o||e[19]!==i||e[20]!==s||e[21]!==a||e[22]!==r||e[23]!==n||e[24]!==c?(f=(0,d.jsxDEV)(o,{className:i,testId:s,variant:a,children:[r,n,c]},void 0,!0),e[18]=o,e[19]=i,e[20]=s,e[21]=a,e[22]=r,e[23]=n,e[24]=c,e[25]=f):f=e[25],f},"ErrorAlert");export{y as a};
@@ -1 +1 @@
1
- import{a as le}from"./chunk-UGUEC6BC.js";import{a as Y}from"./chunk-2K47A3P6.js";import{a as Z}from"./chunk-CACB34RQ.js";import"./chunk-XNJNSCLM.js";import{a as ee,b as te,c as re,d as j,e as o,f as i}from"./chunk-GTM65MVX.js";import{a as X}from"./chunk-UKDJ4H7I.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as J}from"./chunk-BOXSWNXZ.js";import{a as U}from"./chunk-TAD43CG5.js";import{b as G}from"./chunk-C7WTJLC3.js";import{a as z,e as Q}from"./chunk-SEU5V7I6.js";import{b as O}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as H,o as W}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a,e as L,f as fe,g as me,h as ue,j as P}from"./chunk-RRCPZMC2.js";var ae=L(me(),1),q=L(fe(),1);var t=L(ue(),1);var he={action:"outline",mutation:"default",query:"secondary"},se=a(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"formatMs"),ve=a(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"errorCell"),pe=a(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"conflictCell"),xe={calls:a((r,e)=>e.calls-r.calls,"calls"),recent:a((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:a((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ie=a(r=>{let e=(0,ae.c)(47),{functions:I,initialShardKey:oe}=r,s=H(),[n,ie]=(0,q.useState)(oe??""),[d,ne]=(0,q.useState)("recent"),C;e[0]!==n?(C=n.trim(),e[0]=n,e[1]=C):C=e[1];let F=Y(C,400),M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M={},e[2]=M):M=e[2];let T;e[3]!==F?(T={live:!0,shardKey:F},e[3]=F,e[4]=T):T=e[4];let{data:de,error:c,errorSource:N,liveError:b}=G(J.getFunctionStats,M,T),S=de?.functions??null,w;e[5]!==I?(w=new Map((I??[]).map(ge)),e[5]=I,e[6]=w):w=e[6];let K=w,E;e[7]===Symbol.for("react.memo_cache_sentinel")?(E=a(k=>{ne(k.currentTarget.dataset.sort)},"t5"),e[7]=E):E=e[7];let ce=E,$;if(e[8]!==c||e[9]!==N||e[10]!==K||e[11]!==b||e[12]!==n||e[13]!==d||e[14]!==S||e[15]!==s){let k=S===null?[]:S.toSorted(xe[d]),f;e[17]!==s?(f=s("Recent"),e[17]=s,e[18]=f):f=e[18];let m;e[19]!==f?(m={key:"recent",label:f},e[19]=f,e[20]=m):m=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let h;e[23]!==u?(h={key:"calls",label:u},e[23]=u,e[24]=h):h=e[24];let v;e[25]!==s?(v=s("Slowest"),e[25]=s,e[26]=v):v=e[26];let p;e[27]!==v?(p={key:"slowest",label:v},e[27]=v,e[28]=p):p=e[28];let A;e[29]!==h||e[30]!==p||e[31]!==m?(A=[m,h,p],e[29]=h,e[30]=p,e[31]=m,e[32]=A):A=e[32];let _=A,x;e[33]!==n?(x=(0,t.jsxDEV)(X,{onChange:ie,testId:"fs-shard-input",value:n},void 0,!1),e[33]=n,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsxDEV)(le,{message:b,prefix:"fs"},void 0,!1),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==_||e[38]!==d?(y=(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:_.map(l=>(0,t.jsxDEV)(V,{"data-sort":l.key,"data-testid":`fs-sort-${l.key}`,onClick:ce,size:"sm",type:"button",variant:d===l.key?"secondary":"ghost",children:l.label},l.key,!1))},void 0,!1),e[37]=_,e[38]=d,e[39]=y):y=e[39];let B;e[40]!==x||e[41]!==g||e[42]!==y?(B=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]},void 0,!0),e[40]=x,e[41]=g,e[42]=y,e[43]=B):B=e[43];let D;e[44]!==c||e[45]!==N?(D=c!==null&&(0,t.jsxDEV)(Z,{error:N,testId:"fs-error"},void 0,!1),e[44]=c,e[45]=N,e[46]=D):D=e[46],$=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[B,D,S!==null&&k.length===0&&c===null&&(0,t.jsxDEV)(U,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsxDEV)("path",{d:"M3 3v18h18"},void 0,!1),(0,t.jsxDEV)("path",{d:"M7 14l4-4 3 3 5-6"},void 0,!1)]},void 0,!0),testId:"fs-empty",title:s("No functions have run on this shard yet.")},void 0,!1),k.length>0&&(0,t.jsxDEV)(z,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Q,{className:"px-0",children:(0,t.jsxDEV)(ee,{"data-testid":"fs-table",children:[(0,t.jsxDEV)(te,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(o,{children:s("function")},void 0,!1),(0,t.jsxDEV)(o,{children:s("kind")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("calls")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("errors")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("conflicts")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("avg")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("max")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last run")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(re,{children:k.map(l=>{let R=K.get(l.path);return(0,t.jsxDEV)(j,{"data-testid":`fs-row-${l.path}`,children:[(0,t.jsxDEV)(i,{className:"font-medium",children:l.path},void 0,!1),(0,t.jsxDEV)(i,{children:R===void 0?(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,t.jsxDEV)(O,{variant:he[R],children:R},void 0,!1)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",l.errors>0&&"text-destructive"),children:ve(l)},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",(l.conflicts??0)>0&&"text-warning"),children:pe(l)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.totalDurationMs/l.calls)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.maxDurationMs)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-muted-foreground",children:W(l.lastCalledAt,"\u2014")},void 0,!1),(0,t.jsxDEV)(i,{className:"max-w-[24ch] truncate text-destructive",title:l.lastErrorMessage??void 0,children:l.lastErrorMessage??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},l.path,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[8]=c,e[9]=N,e[10]=K,e[11]=b,e[12]=n,e[13]=d,e[14]=S,e[15]=s,e[16]=$}else $=e[16];return $},"FunctionStatsPanel");function ge(r){return[r.path,r.kind]}a(ge,"_temp");export{Ie as FunctionStatsPanel};
1
+ import{a as le}from"./chunk-UGUEC6BC.js";import{a as Y}from"./chunk-2K47A3P6.js";import{a as Z}from"./chunk-HN6KJXYQ.js";import"./chunk-XNJNSCLM.js";import{a as ee,b as te,c as re,d as j,e as o,f as i}from"./chunk-GTM65MVX.js";import{a as X}from"./chunk-UKDJ4H7I.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import{c as V}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as J}from"./chunk-BOXSWNXZ.js";import{a as U}from"./chunk-TAD43CG5.js";import{b as G}from"./chunk-RHZ4M2NZ.js";import{a as z,e as Q}from"./chunk-SEU5V7I6.js";import{b as O}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-XLXNLJ4N.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as H,o as W}from"./chunk-E75ANNWX.js";import"./chunk-JHKMUTIF.js";import{a,e as L,f as fe,g as me,h as ue,j as P}from"./chunk-RRCPZMC2.js";var ae=L(me(),1),q=L(fe(),1);var t=L(ue(),1);var he={action:"outline",mutation:"default",query:"secondary"},se=a(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"formatMs"),ve=a(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"errorCell"),pe=a(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"conflictCell"),xe={calls:a((r,e)=>e.calls-r.calls,"calls"),recent:a((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:a((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ie=a(r=>{let e=(0,ae.c)(47),{functions:I,initialShardKey:oe}=r,s=H(),[n,ie]=(0,q.useState)(oe??""),[d,ne]=(0,q.useState)("recent"),C;e[0]!==n?(C=n.trim(),e[0]=n,e[1]=C):C=e[1];let F=Y(C,400),M;e[2]===Symbol.for("react.memo_cache_sentinel")?(M={},e[2]=M):M=e[2];let T;e[3]!==F?(T={live:!0,shardKey:F},e[3]=F,e[4]=T):T=e[4];let{data:de,error:c,errorSource:N,liveError:b}=G(J.getFunctionStats,M,T),S=de?.functions??null,w;e[5]!==I?(w=new Map((I??[]).map(ge)),e[5]=I,e[6]=w):w=e[6];let K=w,E;e[7]===Symbol.for("react.memo_cache_sentinel")?(E=a(k=>{ne(k.currentTarget.dataset.sort)},"t5"),e[7]=E):E=e[7];let ce=E,$;if(e[8]!==c||e[9]!==N||e[10]!==K||e[11]!==b||e[12]!==n||e[13]!==d||e[14]!==S||e[15]!==s){let k=S===null?[]:S.toSorted(xe[d]),f;e[17]!==s?(f=s("Recent"),e[17]=s,e[18]=f):f=e[18];let m;e[19]!==f?(m={key:"recent",label:f},e[19]=f,e[20]=m):m=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let h;e[23]!==u?(h={key:"calls",label:u},e[23]=u,e[24]=h):h=e[24];let v;e[25]!==s?(v=s("Slowest"),e[25]=s,e[26]=v):v=e[26];let p;e[27]!==v?(p={key:"slowest",label:v},e[27]=v,e[28]=p):p=e[28];let A;e[29]!==h||e[30]!==p||e[31]!==m?(A=[m,h,p],e[29]=h,e[30]=p,e[31]=m,e[32]=A):A=e[32];let _=A,x;e[33]!==n?(x=(0,t.jsxDEV)(X,{onChange:ie,testId:"fs-shard-input",value:n},void 0,!1),e[33]=n,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsxDEV)(le,{message:b,prefix:"fs"},void 0,!1),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==_||e[38]!==d?(y=(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:_.map(l=>(0,t.jsxDEV)(V,{"data-sort":l.key,"data-testid":`fs-sort-${l.key}`,onClick:ce,size:"sm",type:"button",variant:d===l.key?"secondary":"ghost",children:l.label},l.key,!1))},void 0,!1),e[37]=_,e[38]=d,e[39]=y):y=e[39];let B;e[40]!==x||e[41]!==g||e[42]!==y?(B=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]},void 0,!0),e[40]=x,e[41]=g,e[42]=y,e[43]=B):B=e[43];let D;e[44]!==c||e[45]!==N?(D=c!==null&&(0,t.jsxDEV)(Z,{error:N,testId:"fs-error"},void 0,!1),e[44]=c,e[45]=N,e[46]=D):D=e[46],$=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[B,D,S!==null&&k.length===0&&c===null&&(0,t.jsxDEV)(U,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsxDEV)("path",{d:"M3 3v18h18"},void 0,!1),(0,t.jsxDEV)("path",{d:"M7 14l4-4 3 3 5-6"},void 0,!1)]},void 0,!0),testId:"fs-empty",title:s("No functions have run on this shard yet.")},void 0,!1),k.length>0&&(0,t.jsxDEV)(z,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(Q,{className:"px-0",children:(0,t.jsxDEV)(ee,{"data-testid":"fs-table",children:[(0,t.jsxDEV)(te,{children:(0,t.jsxDEV)(j,{children:[(0,t.jsxDEV)(o,{children:s("function")},void 0,!1),(0,t.jsxDEV)(o,{children:s("kind")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("calls")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("errors")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("conflicts")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("avg")},void 0,!1),(0,t.jsxDEV)(o,{className:"text-right",children:s("max")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last run")},void 0,!1),(0,t.jsxDEV)(o,{children:s("last error")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(re,{children:k.map(l=>{let R=K.get(l.path);return(0,t.jsxDEV)(j,{"data-testid":`fs-row-${l.path}`,children:[(0,t.jsxDEV)(i,{className:"font-medium",children:l.path},void 0,!1),(0,t.jsxDEV)(i,{children:R===void 0?(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1):(0,t.jsxDEV)(O,{variant:he[R],children:R},void 0,!1)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",l.errors>0&&"text-destructive"),children:ve(l)},void 0,!1),(0,t.jsxDEV)(i,{className:P("text-right tabular-nums",(l.conflicts??0)>0&&"text-warning"),children:pe(l)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.totalDurationMs/l.calls)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-right tabular-nums",children:l.calls===0?"\u2014":se(l.maxDurationMs)},void 0,!1),(0,t.jsxDEV)(i,{className:"text-muted-foreground",children:W(l.lastCalledAt,"\u2014")},void 0,!1),(0,t.jsxDEV)(i,{className:"max-w-[24ch] truncate text-destructive",title:l.lastErrorMessage??void 0,children:l.lastErrorMessage??(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},l.path,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[8]=c,e[9]=N,e[10]=K,e[11]=b,e[12]=n,e[13]=d,e[14]=S,e[15]=s,e[16]=$}else $=e[16];return $},"FunctionStatsPanel");function ge(r){return[r.path,r.kind]}a(ge,"_temp");export{Ie as FunctionStatsPanel};
@@ -1 +1 @@
1
- import{a as k,b as j}from"./chunk-KJJ3WM6H.js";import{a as D}from"./chunk-UGUEC6BC.js";import{a as O}from"./chunk-2K47A3P6.js";import{a as V}from"./chunk-CACB34RQ.js";import"./chunk-XNJNSCLM.js";import{a as _,b as z,c as B,d as f,e as l,f as n}from"./chunk-GTM65MVX.js";import{a as M}from"./chunk-UKDJ4H7I.js";import"./chunk-TBMYIZIO.js";import{R as L}from"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-BOXSWNXZ.js";import{a as I}from"./chunk-TAD43CG5.js";import{b as A}from"./chunk-C7WTJLC3.js";import{a as y,e as E}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C,o as R}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a as i,e as w,f as ee,h as te}from"./chunk-RRCPZMC2.js";var o=w(ee(),1);var e=w(te(),1);var K=80,ae=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>K?`${t.slice(0,K)}\u2026`:t},"formatDetail"),re=41,F=480,U=5,oe=i((s,t)=>k(s,d=>{t(d.height>0?d:{height:F,width:d.width})}),"observeViewportRect"),Se=i(({initialShardKey:s})=>{let t=C(),[d,G]=(0,o.useState)(s??""),[m,W]=(0,o.useState)(""),q=O(d.trim(),400),{data:v,error:p,errorSource:J,isLoading:P,liveError:Q}=A(H.getAuditLog,{},{live:!0,shardKey:q}),u=(0,o.useMemo)(()=>v?.entries??[],[v]),c=(0,o.useMemo)(()=>{let r=m.trim().toLowerCase();return r===""?u:u.filter(a=>a.op.toLowerCase().includes(r)||(a.table??"").toLowerCase().includes(r)||(a.id??"").toLowerCase().includes(r))},[u,m]),g=(0,o.useRef)(null),x=j({count:c.length,estimateSize:i(()=>re,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:F,width:800},observeElementRect:oe,overscan:8}),h=x.getVirtualItems(),X=x.getTotalSize(),S=h[0]?.start??0,b=X-(h.at(-1)?.end??0),Z={height:S},$={height:b},Y=i(r=>{W(r.target.value)},"onSearchChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(M,{onChange:G,testId:"au-shard-input",value:d},void 0,!1),(0,e.jsxDEV)(D,{message:Q,prefix:"au"},void 0,!1),(0,e.jsxDEV)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m},void 0,!1)]},void 0,!0),p!==null&&(0,e.jsxDEV)(V,{error:J,testId:"au-error"},void 0,!1),p===null&&!P&&c.length===0&&(0,e.jsxDEV)(I,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"},void 0,!1)},void 0,!1),testId:"au-empty",title:t("No audit entries.")},void 0,!1),c.length>0&&(0,e.jsxDEV)(y,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:g,children:(0,e.jsxDEV)(_,{"data-testid":"au-table",children:[(0,e.jsxDEV)(z,{children:(0,e.jsxDEV)(f,{children:[(0,e.jsxDEV)(l,{children:t("time")},void 0,!1),(0,e.jsxDEV)(l,{children:t("op")},void 0,!1),(0,e.jsxDEV)(l,{children:t("table")},void 0,!1),(0,e.jsxDEV)(l,{children:t("id")},void 0,!1),(0,e.jsxDEV)(l,{children:t("detail")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(B,{children:[S>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:Z},void 0,!1)},void 0,!1),h.map(r=>{let a=c[r.index],N=ae(a.detail);return(0,e.jsxDEV)(f,{"data-testid":"au-row",children:[(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:R(a.ts,"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:a.op},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"font-medium",children:a.table??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[20ch] truncate font-mono text-xs",children:a.id??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:N||void 0,children:N||(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.seq,!0)}),b>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:$},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AuditPanel");export{Se as AuditPanel};
1
+ import{a as k,b as j}from"./chunk-KJJ3WM6H.js";import{a as D}from"./chunk-UGUEC6BC.js";import{a as O}from"./chunk-2K47A3P6.js";import{a as V}from"./chunk-HN6KJXYQ.js";import"./chunk-XNJNSCLM.js";import{a as _,b as z,c as B,d as f,e as l,f as n}from"./chunk-GTM65MVX.js";import{a as M}from"./chunk-UKDJ4H7I.js";import"./chunk-TBMYIZIO.js";import{R as L}from"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-BOXSWNXZ.js";import{a as I}from"./chunk-TAD43CG5.js";import{b as A}from"./chunk-RHZ4M2NZ.js";import{a as y,e as E}from"./chunk-SEU5V7I6.js";import{b as T}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-XLXNLJ4N.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as C,o as R}from"./chunk-E75ANNWX.js";import"./chunk-JHKMUTIF.js";import{a as i,e as w,f as ee,h as te}from"./chunk-RRCPZMC2.js";var o=w(ee(),1);var e=w(te(),1);var K=80,ae=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>K?`${t.slice(0,K)}\u2026`:t},"formatDetail"),re=41,F=480,U=5,oe=i((s,t)=>k(s,d=>{t(d.height>0?d:{height:F,width:d.width})}),"observeViewportRect"),Se=i(({initialShardKey:s})=>{let t=C(),[d,G]=(0,o.useState)(s??""),[m,W]=(0,o.useState)(""),q=O(d.trim(),400),{data:v,error:p,errorSource:J,isLoading:P,liveError:Q}=A(H.getAuditLog,{},{live:!0,shardKey:q}),u=(0,o.useMemo)(()=>v?.entries??[],[v]),c=(0,o.useMemo)(()=>{let r=m.trim().toLowerCase();return r===""?u:u.filter(a=>a.op.toLowerCase().includes(r)||(a.table??"").toLowerCase().includes(r)||(a.id??"").toLowerCase().includes(r))},[u,m]),g=(0,o.useRef)(null),x=j({count:c.length,estimateSize:i(()=>re,"estimateSize"),getScrollElement:i(()=>g.current,"getScrollElement"),initialRect:{height:F,width:800},observeElementRect:oe,overscan:8}),h=x.getVirtualItems(),X=x.getTotalSize(),S=h[0]?.start??0,b=X-(h.at(-1)?.end??0),Z={height:S},$={height:b},Y=i(r=>{W(r.target.value)},"onSearchChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(M,{onChange:G,testId:"au-shard-input",value:d},void 0,!1),(0,e.jsxDEV)(D,{message:Q,prefix:"au"},void 0,!1),(0,e.jsxDEV)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m},void 0,!1)]},void 0,!0),p!==null&&(0,e.jsxDEV)(V,{error:J,testId:"au-error"},void 0,!1),p===null&&!P&&c.length===0&&(0,e.jsxDEV)(I,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"},void 0,!1)},void 0,!1),testId:"au-empty",title:t("No audit entries.")},void 0,!1),c.length>0&&(0,e.jsxDEV)(y,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:g,children:(0,e.jsxDEV)(_,{"data-testid":"au-table",children:[(0,e.jsxDEV)(z,{children:(0,e.jsxDEV)(f,{children:[(0,e.jsxDEV)(l,{children:t("time")},void 0,!1),(0,e.jsxDEV)(l,{children:t("op")},void 0,!1),(0,e.jsxDEV)(l,{children:t("table")},void 0,!1),(0,e.jsxDEV)(l,{children:t("id")},void 0,!1),(0,e.jsxDEV)(l,{children:t("detail")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(B,{children:[S>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:Z},void 0,!1)},void 0,!1),h.map(r=>{let a=c[r.index],N=ae(a.detail);return(0,e.jsxDEV)(f,{"data-testid":"au-row",children:[(0,e.jsxDEV)(n,{className:"text-muted-foreground tabular-nums",children:R(a.ts,"\u2014")},void 0,!1),(0,e.jsxDEV)(n,{children:(0,e.jsxDEV)(T,{variant:"secondary",children:a.op},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"font-medium",children:a.table??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[20ch] truncate font-mono text-xs",children:a.id??(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:N||void 0,children:N||(0,e.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.seq,!0)}),b>0&&(0,e.jsxDEV)("tr",{"aria-hidden":"true",children:(0,e.jsxDEV)("td",{colSpan:U,style:$},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AuditPanel");export{Se as AuditPanel};
@@ -1 +1 @@
1
- import{a as V}from"./chunk-J6J54MBP.js";import{a as L}from"./chunk-2K47A3P6.js";import{a as W}from"./chunk-CACB34RQ.js";import"./chunk-XNJNSCLM.js";import{a as O,b as Q,c as U,d as K,e as R,f as D}from"./chunk-GTM65MVX.js";import{a as j}from"./chunk-UKDJ4H7I.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-BOXSWNXZ.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as _}from"./chunk-C7WTJLC3.js";import{a as E}from"./chunk-SEU5V7I6.js";import{b as w}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as A}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a as C,e as F,f as J,g as X,h as Y}from"./chunk-RRCPZMC2.js";var P=F(X(),1),G=F(J(),1);var t=F(Y(),1);var q=C(r=>`${r.toString()} ms`,"formatMs"),Z=C(r=>r.totalConnections===0&&r.shapePoke.passes===0&&r.whisper.passes===0,"isFanoutIdle"),$=C(r=>{let e=(0,P.c)(8),{label:o,testId:s,value:i}=r,l;e[0]!==o?(l=(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=l):l=e[1];let d;e[2]!==s||e[3]!==i?(d=(0,t.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":s,children:i},void 0,!1),e[2]=s,e[3]=i,e[4]=d):d=e[4];let v;return e[5]!==l||e[6]!==d?(v=(0,t.jsxDEV)(E,{className:"gap-0 py-0",children:(0,t.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[l,d]},void 0,!0)},void 0,!1),e[5]=l,e[6]=d,e[7]=v):v=e[7],v},"StatCard"),z=C(r=>{let e=(0,P.c)(48),{counters:o,includeTiming:s,prefix:i,t:l,title:d}=r,v=`${i}-section`,h;e[0]!==d?(h=(0,t.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:d},void 0,!1),e[0]=d,e[1]=h):h=e[1];let k=`${i}-stats`,a;e[2]!==l?(a=l("Passes"),e[2]=l,e[3]=a):a=e[3];let n=`${i}-passes`,g;e[4]!==o.passes||e[5]!==a||e[6]!==n?(g=(0,t.jsxDEV)($,{label:a,testId:n,value:o.passes},void 0,!1),e[4]=o.passes,e[5]=a,e[6]=n,e[7]=g):g=e[7];let N;e[8]!==l?(N=l("Sockets iterated"),e[8]=l,e[9]=N):N=e[9];let I=`${i}-iterated`,c;e[10]!==o.socketsIterated||e[11]!==N||e[12]!==I?(c=(0,t.jsxDEV)($,{label:N,testId:I,value:o.socketsIterated},void 0,!1),e[10]=o.socketsIterated,e[11]=N,e[12]=I,e[13]=c):c=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${i}-delivered`,u;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(u=(0,t.jsxDEV)($,{label:f,testId:y,value:o.socketsDelivered},void 0,!1),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=u):u=e[19];let m;e[20]!==l?(m=l("Peak width"),e[20]=l,e[21]=m):m=e[21];let b=`${i}-peak`,p;e[22]!==o.peakSocketsIterated||e[23]!==m||e[24]!==b?(p=(0,t.jsxDEV)($,{label:m,testId:b,value:o.peakSocketsIterated},void 0,!1),e[22]=o.peakSocketsIterated,e[23]=m,e[24]=b,e[25]=p):p=e[25];let x;e[26]!==o.totalMs||e[27]!==s||e[28]!==i||e[29]!==l?(x=s&&(0,t.jsxDEV)($,{label:l("Total time"),testId:`${i}-total-ms`,value:q(o.totalMs)},void 0,!1),e[26]=o.totalMs,e[27]=s,e[28]=i,e[29]=l,e[30]=x):x=e[30];let S;e[31]!==o.maxMs||e[32]!==s||e[33]!==i||e[34]!==l?(S=s&&(0,t.jsxDEV)($,{label:l("Max time"),testId:`${i}-max-ms`,value:q(o.maxMs)},void 0,!1),e[31]=o.maxMs,e[32]=s,e[33]=i,e[34]=l,e[35]=S):S=e[35];let T;e[36]!==u||e[37]!==p||e[38]!==x||e[39]!==S||e[40]!==k||e[41]!==g||e[42]!==c?(T=(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":k,children:[g,c,u,p,x,S]},void 0,!0),e[36]=u,e[37]=p,e[38]=x,e[39]=S,e[40]=k,e[41]=g,e[42]=c,e[43]=T):T=e[43];let M;return e[44]!==v||e[45]!==T||e[46]!==h?(M=(0,t.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":v,children:[h,T]},void 0,!0),e[44]=v,e[45]=T,e[46]=h,e[47]=M):M=e[47],M},"PathCounters"),ue=C(r=>{let e=(0,P.c)(32),{initialShardKey:o}=r,s=A(),[i,l]=(0,G.useState)(o??""),d;e[0]!==i?(d=i.trim(),e[0]=i,e[1]=d):d=e[1];let v=L(d,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let k;e[3]!==v?(k={keepPreviousData:!0,shardKey:v},e[3]=v,e[4]=k):k=e[4];let{data:a,error:n,errorSource:g,refetch:N}=_(H.getFanoutMetrics,h,k);V(N,!0);let I;e[5]!==a?(I=a!==void 0&&Z(a),e[5]=a,e[6]=I):I=e[6];let c=I,f;e[7]!==i?(f=(0,t.jsxDEV)(j,{onChange:l,testId:"fanout-shard-input",value:i},void 0,!1),e[7]=i,e[8]=f):f=e[8];let y;e[9]!==a||e[10]!==s?(y=a!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[a.promoted&&(0,t.jsxDEV)(w,{"data-testid":"fanout-promoted",variant:a.relayCount>=a.maxRelays?"destructive":"default",children:a.relayCount>=a.maxRelays?s("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:a.maxRelays,relayCount:a.relayCount}):s("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:a.maxRelays,relayCount:a.relayCount})},void 0,!1),(0,t.jsxDEV)(w,{variant:"secondary",children:s("{count} connections",{count:a.totalConnections})},void 0,!1),(0,t.jsxDEV)(w,{variant:"secondary",children:s("peak {count} subscribers",{count:a.peakSubscribers})},void 0,!1)]},void 0,!0),e[9]=a,e[10]=s,e[11]=y):y=e[11];let u;e[12]!==f||e[13]!==y?(u=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[f,y]},void 0,!0),e[12]=f,e[13]=y,e[14]=u):u=e[14];let m;e[15]!==n||e[16]!==g?(m=n!==null&&(0,t.jsxDEV)(W,{error:g,testId:"fanout-error"},void 0,!1),e[15]=n,e[16]=g,e[17]=m):m=e[17];let b;e[18]!==n||e[19]!==c||e[20]!==s?(b=n===null&&c&&(0,t.jsxDEV)(B,{description:s("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M4 12h4l3 7 4-14 3 7h2"},void 0,!1)},void 0,!1),testId:"fanout-empty",title:s("No fan-out activity yet.")},void 0,!1),e[18]=n,e[19]=c,e[20]=s,e[21]=b):b=e[21];let p;e[22]!==n||e[23]!==c||e[24]!==a||e[25]!==s?(p=n===null&&a!==void 0&&!c&&(0,t.jsxDEV)(t.Fragment,{children:[a.topics.length>0&&(0,t.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:s("Hot topics")},void 0,!1),(0,t.jsxDEV)(E,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(O,{"data-testid":"fanout-topics-table",children:[(0,t.jsxDEV)(Q,{children:(0,t.jsxDEV)(K,{children:[(0,t.jsxDEV)(R,{children:s("Topic")},void 0,!1),(0,t.jsxDEV)(R,{children:s("Kind")},void 0,!1),(0,t.jsxDEV)(R,{className:"text-right",children:s("Subscribers")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(U,{children:a.topics.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("Fan-out cost since this instance woke")},void 0,!1),(0,t.jsxDEV)(z,{counters:a.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:s,title:s("Shape pokes")},void 0,!1),(0,t.jsxDEV)(z,{counters:a.whisper,includeTiming:!1,prefix:"fanout-whisper",t:s,title:s("Whisper broadcasts")},void 0,!1)]},void 0,!0)]},void 0,!0),e[22]=n,e[23]=c,e[24]=a,e[25]=s,e[26]=p):p=e[26];let x;return e[27]!==p||e[28]!==u||e[29]!==m||e[30]!==b?(x=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[u,m,b,p]},void 0,!0),e[27]=p,e[28]=u,e[29]=m,e[30]=b,e[31]=x):x=e[31],x},"FanoutPanel");function ee(r){return(0,t.jsxDEV)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsxDEV)(D,{className:"font-mono text-xs",children:r.topic},void 0,!1),(0,t.jsxDEV)(D,{children:(0,t.jsxDEV)(w,{variant:"outline",children:r.kind},void 0,!1)},void 0,!1),(0,t.jsxDEV)(D,{className:"text-right font-medium tabular-nums",children:r.subscribers},void 0,!1)]},`${r.kind}:${r.topic}`,!0)}C(ee,"_temp");export{ue as default};
1
+ import{a as V}from"./chunk-J6J54MBP.js";import{a as L}from"./chunk-2K47A3P6.js";import{a as W}from"./chunk-HN6KJXYQ.js";import"./chunk-XNJNSCLM.js";import{a as O,b as Q,c as U,d as K,e as R,f as D}from"./chunk-GTM65MVX.js";import{a as j}from"./chunk-UKDJ4H7I.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-BOXSWNXZ.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as _}from"./chunk-RHZ4M2NZ.js";import{a as E}from"./chunk-SEU5V7I6.js";import{b as w}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-XLXNLJ4N.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as A}from"./chunk-E75ANNWX.js";import"./chunk-JHKMUTIF.js";import{a as C,e as F,f as J,g as X,h as Y}from"./chunk-RRCPZMC2.js";var P=F(X(),1),G=F(J(),1);var t=F(Y(),1);var q=C(r=>`${r.toString()} ms`,"formatMs"),Z=C(r=>r.totalConnections===0&&r.shapePoke.passes===0&&r.whisper.passes===0,"isFanoutIdle"),$=C(r=>{let e=(0,P.c)(8),{label:o,testId:s,value:i}=r,l;e[0]!==o?(l=(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o},void 0,!1),e[0]=o,e[1]=l):l=e[1];let d;e[2]!==s||e[3]!==i?(d=(0,t.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":s,children:i},void 0,!1),e[2]=s,e[3]=i,e[4]=d):d=e[4];let v;return e[5]!==l||e[6]!==d?(v=(0,t.jsxDEV)(E,{className:"gap-0 py-0",children:(0,t.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[l,d]},void 0,!0)},void 0,!1),e[5]=l,e[6]=d,e[7]=v):v=e[7],v},"StatCard"),z=C(r=>{let e=(0,P.c)(48),{counters:o,includeTiming:s,prefix:i,t:l,title:d}=r,v=`${i}-section`,h;e[0]!==d?(h=(0,t.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:d},void 0,!1),e[0]=d,e[1]=h):h=e[1];let k=`${i}-stats`,a;e[2]!==l?(a=l("Passes"),e[2]=l,e[3]=a):a=e[3];let n=`${i}-passes`,g;e[4]!==o.passes||e[5]!==a||e[6]!==n?(g=(0,t.jsxDEV)($,{label:a,testId:n,value:o.passes},void 0,!1),e[4]=o.passes,e[5]=a,e[6]=n,e[7]=g):g=e[7];let N;e[8]!==l?(N=l("Sockets iterated"),e[8]=l,e[9]=N):N=e[9];let I=`${i}-iterated`,c;e[10]!==o.socketsIterated||e[11]!==N||e[12]!==I?(c=(0,t.jsxDEV)($,{label:N,testId:I,value:o.socketsIterated},void 0,!1),e[10]=o.socketsIterated,e[11]=N,e[12]=I,e[13]=c):c=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${i}-delivered`,u;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(u=(0,t.jsxDEV)($,{label:f,testId:y,value:o.socketsDelivered},void 0,!1),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=u):u=e[19];let m;e[20]!==l?(m=l("Peak width"),e[20]=l,e[21]=m):m=e[21];let b=`${i}-peak`,p;e[22]!==o.peakSocketsIterated||e[23]!==m||e[24]!==b?(p=(0,t.jsxDEV)($,{label:m,testId:b,value:o.peakSocketsIterated},void 0,!1),e[22]=o.peakSocketsIterated,e[23]=m,e[24]=b,e[25]=p):p=e[25];let x;e[26]!==o.totalMs||e[27]!==s||e[28]!==i||e[29]!==l?(x=s&&(0,t.jsxDEV)($,{label:l("Total time"),testId:`${i}-total-ms`,value:q(o.totalMs)},void 0,!1),e[26]=o.totalMs,e[27]=s,e[28]=i,e[29]=l,e[30]=x):x=e[30];let S;e[31]!==o.maxMs||e[32]!==s||e[33]!==i||e[34]!==l?(S=s&&(0,t.jsxDEV)($,{label:l("Max time"),testId:`${i}-max-ms`,value:q(o.maxMs)},void 0,!1),e[31]=o.maxMs,e[32]=s,e[33]=i,e[34]=l,e[35]=S):S=e[35];let T;e[36]!==u||e[37]!==p||e[38]!==x||e[39]!==S||e[40]!==k||e[41]!==g||e[42]!==c?(T=(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":k,children:[g,c,u,p,x,S]},void 0,!0),e[36]=u,e[37]=p,e[38]=x,e[39]=S,e[40]=k,e[41]=g,e[42]=c,e[43]=T):T=e[43];let M;return e[44]!==v||e[45]!==T||e[46]!==h?(M=(0,t.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":v,children:[h,T]},void 0,!0),e[44]=v,e[45]=T,e[46]=h,e[47]=M):M=e[47],M},"PathCounters"),ue=C(r=>{let e=(0,P.c)(32),{initialShardKey:o}=r,s=A(),[i,l]=(0,G.useState)(o??""),d;e[0]!==i?(d=i.trim(),e[0]=i,e[1]=d):d=e[1];let v=L(d,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let k;e[3]!==v?(k={keepPreviousData:!0,shardKey:v},e[3]=v,e[4]=k):k=e[4];let{data:a,error:n,errorSource:g,refetch:N}=_(H.getFanoutMetrics,h,k);V(N,!0);let I;e[5]!==a?(I=a!==void 0&&Z(a),e[5]=a,e[6]=I):I=e[6];let c=I,f;e[7]!==i?(f=(0,t.jsxDEV)(j,{onChange:l,testId:"fanout-shard-input",value:i},void 0,!1),e[7]=i,e[8]=f):f=e[8];let y;e[9]!==a||e[10]!==s?(y=a!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[a.promoted&&(0,t.jsxDEV)(w,{"data-testid":"fanout-promoted",variant:a.relayCount>=a.maxRelays?"destructive":"default",children:a.relayCount>=a.maxRelays?s("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:a.maxRelays,relayCount:a.relayCount}):s("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:a.maxRelays,relayCount:a.relayCount})},void 0,!1),(0,t.jsxDEV)(w,{variant:"secondary",children:s("{count} connections",{count:a.totalConnections})},void 0,!1),(0,t.jsxDEV)(w,{variant:"secondary",children:s("peak {count} subscribers",{count:a.peakSubscribers})},void 0,!1)]},void 0,!0),e[9]=a,e[10]=s,e[11]=y):y=e[11];let u;e[12]!==f||e[13]!==y?(u=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[f,y]},void 0,!0),e[12]=f,e[13]=y,e[14]=u):u=e[14];let m;e[15]!==n||e[16]!==g?(m=n!==null&&(0,t.jsxDEV)(W,{error:g,testId:"fanout-error"},void 0,!1),e[15]=n,e[16]=g,e[17]=m):m=e[17];let b;e[18]!==n||e[19]!==c||e[20]!==s?(b=n===null&&c&&(0,t.jsxDEV)(B,{description:s("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M4 12h4l3 7 4-14 3 7h2"},void 0,!1)},void 0,!1),testId:"fanout-empty",title:s("No fan-out activity yet.")},void 0,!1),e[18]=n,e[19]=c,e[20]=s,e[21]=b):b=e[21];let p;e[22]!==n||e[23]!==c||e[24]!==a||e[25]!==s?(p=n===null&&a!==void 0&&!c&&(0,t.jsxDEV)(t.Fragment,{children:[a.topics.length>0&&(0,t.jsxDEV)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsxDEV)("h3",{className:"text-sm font-medium text-foreground",children:s("Hot topics")},void 0,!1),(0,t.jsxDEV)(E,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(O,{"data-testid":"fanout-topics-table",children:[(0,t.jsxDEV)(Q,{children:(0,t.jsxDEV)(K,{children:[(0,t.jsxDEV)(R,{children:s("Topic")},void 0,!1),(0,t.jsxDEV)(R,{children:s("Kind")},void 0,!1),(0,t.jsxDEV)(R,{className:"text-right",children:s("Subscribers")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(U,{children:a.topics.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("Fan-out cost since this instance woke")},void 0,!1),(0,t.jsxDEV)(z,{counters:a.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:s,title:s("Shape pokes")},void 0,!1),(0,t.jsxDEV)(z,{counters:a.whisper,includeTiming:!1,prefix:"fanout-whisper",t:s,title:s("Whisper broadcasts")},void 0,!1)]},void 0,!0)]},void 0,!0),e[22]=n,e[23]=c,e[24]=a,e[25]=s,e[26]=p):p=e[26];let x;return e[27]!==p||e[28]!==u||e[29]!==m||e[30]!==b?(x=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[u,m,b,p]},void 0,!0),e[27]=p,e[28]=u,e[29]=m,e[30]=b,e[31]=x):x=e[31],x},"FanoutPanel");function ee(r){return(0,t.jsxDEV)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsxDEV)(D,{className:"font-mono text-xs",children:r.topic},void 0,!1),(0,t.jsxDEV)(D,{children:(0,t.jsxDEV)(w,{variant:"outline",children:r.kind},void 0,!1)},void 0,!1),(0,t.jsxDEV)(D,{className:"text-right font-medium tabular-nums",children:r.subscribers},void 0,!1)]},`${r.kind}:${r.topic}`,!0)}C(ee,"_temp");export{ue as default};
@@ -1 +1 @@
1
- import{a as O}from"./chunk-J6J54MBP.js";import{a as j}from"./chunk-2K47A3P6.js";import{a as H}from"./chunk-CACB34RQ.js";import"./chunk-XNJNSCLM.js";import{a as P,b as F,c as L,d as k,e as u,f as m}from"./chunk-GTM65MVX.js";import{a as _}from"./chunk-UKDJ4H7I.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as R}from"./chunk-BOXSWNXZ.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as K}from"./chunk-C7WTJLC3.js";import{a as M,e as $}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as D}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a as S,e as T,f as U,g as V,h as X}from"./chunk-RRCPZMC2.js";var G=T(V(),1),J=T(U(),1);var t=T(X(),1);var W=80,Z=S(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>W?`${e.slice(0,W)}\u2026`:e},"formatArguments"),q=S(a=>{let e=[];for(let n of a){let o=n.id.toString();if(n.subscriptions.length===0){e.push({admin:n.admin,connectionId:n.id,key:`c${o}`,subscription:null});continue}n.subscriptions.forEach((s,N)=>{e.push({admin:n.admin,connectionId:n.id,key:`c${o}-s${N.toString()}`,subscription:s})})}return e},"toRows"),w=(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),de=S(a=>{let e=(0,G.c)(22),{initialShardKey:n}=a,o=D(),[s,N]=(0,J.useState)(n??""),f;e[0]!==s?(f=s.trim(),e[0]=s,e[1]=f):f=e[1];let A=j(f,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let p;e[3]!==A?(p={keepPreviousData:!0,shardKey:A},e[3]=A,e[4]=p):p=e[4];let{data:i,error:r,errorSource:c,refetch:Q}=K(R.listSubscriptions,h,p);O(Q,!0);let v;if(e[5]!==r||e[6]!==c||e[7]!==i||e[8]!==s||e[9]!==o){let C=i===void 0?[]:q(i.connections),l;e[11]!==s?(l=(0,t.jsxDEV)(_,{onChange:N,testId:"subs-shard-input",value:s},void 0,!1),e[11]=s,e[12]=l):l=e[12];let d;e[13]!==i||e[14]!==o?(d=i!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} connections",{count:i.totalConnections})},void 0,!1),(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} subscriptions",{count:i.totalSubscriptions})},void 0,!1)]},void 0,!0),e[13]=i,e[14]=o,e[15]=d):d=e[15];let b;e[16]!==l||e[17]!==d?(b=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[l,d]},void 0,!0),e[16]=l,e[17]=d,e[18]=b):b=e[18];let g;e[19]!==r||e[20]!==c?(g=r!==null&&(0,t.jsxDEV)(H,{error:c,testId:"subs-error"},void 0,!1),e[19]=r,e[20]=c,e[21]=g):g=e[21],v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[b,g,r===null&&i!==void 0&&C.length===0&&(0,t.jsxDEV)(B,{description:o("Active WebSocket subscriptions on this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1)},void 0,!1),testId:"subs-empty",title:o("No active subscriptions.")},void 0,!1),r===null&&C.length>0&&(0,t.jsxDEV)(M,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)($,{className:"px-0",children:(0,t.jsxDEV)(P,{"data-testid":"subs-table",children:[(0,t.jsxDEV)(F,{children:(0,t.jsxDEV)(k,{children:[(0,t.jsxDEV)(u,{children:o("Connection")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Function path")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Table")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(L,{children:C.map(x=>{let{subscription:I}=x,E=Z(I?.args);return(0,t.jsxDEV)(k,{"data-testid":"subs-row",children:[(0,t.jsxDEV)(m,{className:"font-medium tabular-nums",children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,t.jsxDEV)(y,{variant:"outline",children:o("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(m,{className:"font-mono text-xs",children:I?.functionPath??w},void 0,!1),(0,t.jsxDEV)(m,{children:I?.table??w},void 0,!1),(0,t.jsxDEV)(m,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:E||void 0,children:E||w},void 0,!1)]},x.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=r,e[6]=c,e[7]=i,e[8]=s,e[9]=o,e[10]=v}else v=e[10];return v},"SubscriptionsPanel");export{de as default};
1
+ import{a as O}from"./chunk-J6J54MBP.js";import{a as j}from"./chunk-2K47A3P6.js";import{a as H}from"./chunk-HN6KJXYQ.js";import"./chunk-XNJNSCLM.js";import{a as P,b as F,c as L,d as k,e as u,f as m}from"./chunk-GTM65MVX.js";import{a as _}from"./chunk-UKDJ4H7I.js";import"./chunk-TBMYIZIO.js";import"./chunk-3CJW6NWG.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as R}from"./chunk-BOXSWNXZ.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as K}from"./chunk-RHZ4M2NZ.js";import{a as M,e as $}from"./chunk-SEU5V7I6.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import"./chunk-XLXNLJ4N.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as D}from"./chunk-E75ANNWX.js";import"./chunk-JHKMUTIF.js";import{a as S,e as T,f as U,g as V,h as X}from"./chunk-RRCPZMC2.js";var G=T(V(),1),J=T(U(),1);var t=T(X(),1);var W=80,Z=S(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>W?`${e.slice(0,W)}\u2026`:e},"formatArguments"),q=S(a=>{let e=[];for(let n of a){let o=n.id.toString();if(n.subscriptions.length===0){e.push({admin:n.admin,connectionId:n.id,key:`c${o}`,subscription:null});continue}n.subscriptions.forEach((s,N)=>{e.push({admin:n.admin,connectionId:n.id,key:`c${o}-s${N.toString()}`,subscription:s})})}return e},"toRows"),w=(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),de=S(a=>{let e=(0,G.c)(22),{initialShardKey:n}=a,o=D(),[s,N]=(0,J.useState)(n??""),f;e[0]!==s?(f=s.trim(),e[0]=s,e[1]=f):f=e[1];let A=j(f,400),h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={},e[2]=h):h=e[2];let p;e[3]!==A?(p={keepPreviousData:!0,shardKey:A},e[3]=A,e[4]=p):p=e[4];let{data:i,error:r,errorSource:c,refetch:Q}=K(R.listSubscriptions,h,p);O(Q,!0);let v;if(e[5]!==r||e[6]!==c||e[7]!==i||e[8]!==s||e[9]!==o){let C=i===void 0?[]:q(i.connections),l;e[11]!==s?(l=(0,t.jsxDEV)(_,{onChange:N,testId:"subs-shard-input",value:s},void 0,!1),e[11]=s,e[12]=l):l=e[12];let d;e[13]!==i||e[14]!==o?(d=i!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} connections",{count:i.totalConnections})},void 0,!1),(0,t.jsxDEV)(y,{variant:"secondary",children:o("{count} subscriptions",{count:i.totalSubscriptions})},void 0,!1)]},void 0,!0),e[13]=i,e[14]=o,e[15]=d):d=e[15];let b;e[16]!==l||e[17]!==d?(b=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[l,d]},void 0,!0),e[16]=l,e[17]=d,e[18]=b):b=e[18];let g;e[19]!==r||e[20]!==c?(g=r!==null&&(0,t.jsxDEV)(H,{error:c,testId:"subs-error"},void 0,!1),e[19]=r,e[20]=c,e[21]=g):g=e[21],v=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[b,g,r===null&&i!==void 0&&C.length===0&&(0,t.jsxDEV)(B,{description:o("Active WebSocket subscriptions on this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1)},void 0,!1),testId:"subs-empty",title:o("No active subscriptions.")},void 0,!1),r===null&&C.length>0&&(0,t.jsxDEV)(M,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)($,{className:"px-0",children:(0,t.jsxDEV)(P,{"data-testid":"subs-table",children:[(0,t.jsxDEV)(F,{children:(0,t.jsxDEV)(k,{children:[(0,t.jsxDEV)(u,{children:o("Connection")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Function path")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Table")},void 0,!1),(0,t.jsxDEV)(u,{children:o("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(L,{children:C.map(x=>{let{subscription:I}=x,E=Z(I?.args);return(0,t.jsxDEV)(k,{"data-testid":"subs-row",children:[(0,t.jsxDEV)(m,{className:"font-medium tabular-nums",children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,t.jsxDEV)(y,{variant:"outline",children:o("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(m,{className:"font-mono text-xs",children:I?.functionPath??w},void 0,!1),(0,t.jsxDEV)(m,{children:I?.table??w},void 0,!1),(0,t.jsxDEV)(m,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:E||void 0,children:E||w},void 0,!1)]},x.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=r,e[6]=c,e[7]=i,e[8]=s,e[9]=o,e[10]=v}else v=e[10];return v},"SubscriptionsPanel");export{de as default};
@@ -1 +1 @@
1
- import{a as H}from"./chunk-J6J54MBP.js";import{a as R,b as _,c as $,d as N,e as o,f as r}from"./chunk-GTM65MVX.js";import{c as S}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as w}from"./chunk-TAD43CG5.js";import{a as E}from"./chunk-C7WTJLC3.js";import{a as C,e as k}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as A}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as g,k as I,o as B}from"./chunk-E75ANNWX.js";import"./chunk-GMSGZDDH.js";import{a as m,e as T,g as j,h as z}from"./chunk-RRCPZMC2.js";var Q=T(j(),1);var t=T(z(),1);var L=200,K=m(()=>{let e=(0,Q.c)(21),d=A(),s=g(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=["lunora-auth-sessions",L],e[0]=u):u=e[0];let h;e[1]!==d?(h=m(()=>d.listAuthSessions({limit:L}),"t1"),e[1]=d,e[2]=h):h=e[2];let l=E(u,h),{error:v}=l,i=l.data?.rows??null,p;e[3]!==l?(p=m(()=>{l.refetch()},"t2"),e[3]=l,e[4]=p):p=e[4],H(p,!0);let x;e[5]!==d||e[6]!==l?(x=m(a=>{I((async()=>{await d.revokeAuthSession({sessionId:a}),l.refetch()})())},"t3"),e[5]=d,e[6]=l,e[7]=x):x=e[7];let y=x,n;e[8]!==v?(n=v!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:v},void 0,!1),e[8]=v,e[9]=n):n=e[9];let c;e[10]!==i||e[11]!==s?(c=i!==null&&i.length===0&&(0,t.jsxDEV)(w,{testId:"auth-sessions-empty",title:s("No active sessions.")},void 0,!1),e[10]=i,e[11]=s,e[12]=c):c=e[12];let f;e[13]!==y||e[14]!==i||e[15]!==s?(f=i!==null&&i.length>0&&(0,t.jsxDEV)(C,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(k,{className:"px-0",children:(0,t.jsxDEV)(R,{"data-testid":"auth-sessions-table",children:[(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(N,{children:[(0,t.jsxDEV)(o,{children:s("user")},void 0,!1),(0,t.jsxDEV)(o,{children:s("expires")},void 0,!1),(0,t.jsxDEV)(o,{children:s("ip")},void 0,!1),(0,t.jsxDEV)(o,{children:s("user agent")},void 0,!1),(0,t.jsxDEV)(o,{children:s("impersonated by")},void 0,!1),(0,t.jsxDEV)(o,{"aria-label":s("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($,{children:i.map(a=>(0,t.jsxDEV)(N,{"data-testid":`auth-session-${a.id}`,children:[(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.userId},void 0,!1),(0,t.jsxDEV)(r,{className:"text-muted-foreground tabular-nums",children:B(a.expiresAt)},void 0,!1),(0,t.jsxDEV)(r,{children:a.ipAddress??""},void 0,!1),(0,t.jsxDEV)(r,{className:"max-w-40 truncate",children:a.userAgent??""},void 0,!1),(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.impersonatedBy??""},void 0,!1),(0,t.jsxDEV)(r,{children:(0,t.jsxDEV)(S,{"data-testid":`auth-session-revoke-${a.id}`,onClick:m(()=>{y(a.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Revoke")},void 0,!1)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[13]=y,e[14]=i,e[15]=s,e[16]=f):f=e[16];let b;return e[17]!==n||e[18]!==c||e[19]!==f?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[n,c,f]},void 0,!0),e[17]=n,e[18]=c,e[19]=f,e[20]=b):b=e[20],b},"AuthSessionsPanel");export{K as AuthSessionsPanel};
1
+ import{a as H}from"./chunk-J6J54MBP.js";import{a as R,b as _,c as $,d as N,e as o,f as r}from"./chunk-GTM65MVX.js";import{c as S}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as w}from"./chunk-TAD43CG5.js";import{a as E}from"./chunk-RHZ4M2NZ.js";import{a as C,e as k}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as A}from"./chunk-XLXNLJ4N.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as g,k as I,o as B}from"./chunk-E75ANNWX.js";import"./chunk-JHKMUTIF.js";import{a as m,e as T,g as j,h as z}from"./chunk-RRCPZMC2.js";var Q=T(j(),1);var t=T(z(),1);var L=200,K=m(()=>{let e=(0,Q.c)(21),d=A(),s=g(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=["lunora-auth-sessions",L],e[0]=u):u=e[0];let h;e[1]!==d?(h=m(()=>d.listAuthSessions({limit:L}),"t1"),e[1]=d,e[2]=h):h=e[2];let l=E(u,h),{error:v}=l,i=l.data?.rows??null,p;e[3]!==l?(p=m(()=>{l.refetch()},"t2"),e[3]=l,e[4]=p):p=e[4],H(p,!0);let x;e[5]!==d||e[6]!==l?(x=m(a=>{I((async()=>{await d.revokeAuthSession({sessionId:a}),l.refetch()})())},"t3"),e[5]=d,e[6]=l,e[7]=x):x=e[7];let y=x,n;e[8]!==v?(n=v!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:v},void 0,!1),e[8]=v,e[9]=n):n=e[9];let c;e[10]!==i||e[11]!==s?(c=i!==null&&i.length===0&&(0,t.jsxDEV)(w,{testId:"auth-sessions-empty",title:s("No active sessions.")},void 0,!1),e[10]=i,e[11]=s,e[12]=c):c=e[12];let f;e[13]!==y||e[14]!==i||e[15]!==s?(f=i!==null&&i.length>0&&(0,t.jsxDEV)(C,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(k,{className:"px-0",children:(0,t.jsxDEV)(R,{"data-testid":"auth-sessions-table",children:[(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(N,{children:[(0,t.jsxDEV)(o,{children:s("user")},void 0,!1),(0,t.jsxDEV)(o,{children:s("expires")},void 0,!1),(0,t.jsxDEV)(o,{children:s("ip")},void 0,!1),(0,t.jsxDEV)(o,{children:s("user agent")},void 0,!1),(0,t.jsxDEV)(o,{children:s("impersonated by")},void 0,!1),(0,t.jsxDEV)(o,{"aria-label":s("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($,{children:i.map(a=>(0,t.jsxDEV)(N,{"data-testid":`auth-session-${a.id}`,children:[(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.userId},void 0,!1),(0,t.jsxDEV)(r,{className:"text-muted-foreground tabular-nums",children:B(a.expiresAt)},void 0,!1),(0,t.jsxDEV)(r,{children:a.ipAddress??""},void 0,!1),(0,t.jsxDEV)(r,{className:"max-w-40 truncate",children:a.userAgent??""},void 0,!1),(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.impersonatedBy??""},void 0,!1),(0,t.jsxDEV)(r,{children:(0,t.jsxDEV)(S,{"data-testid":`auth-session-revoke-${a.id}`,onClick:m(()=>{y(a.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Revoke")},void 0,!1)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[13]=y,e[14]=i,e[15]=s,e[16]=f):f=e[16];let b;return e[17]!==n||e[18]!==c||e[19]!==f?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[n,c,f]},void 0,!0),e[17]=n,e[18]=c,e[19]=f,e[20]=b):b=e[20],b},"AuthSessionsPanel");export{K as AuthSessionsPanel};