@lunora/studio 1.0.0-alpha.157 → 1.0.0-alpha.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1 -1
- package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
- package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_shared/{DataBrowser-FiF2tNdq.mjs → DataBrowser-DIbS5LdO.mjs} +1 -1
- package/dist/packem_shared/wire-codec-Bk4XZGE4.mjs +1 -0
- package/dist/standalone/{chunk-Y4S6PSQJ.js → chunk-2R6A5EW3.js} +1 -1
- package/dist/standalone/{chunk-3SCT7QG7.js → chunk-3AZM3E32.js} +1 -1
- package/dist/standalone/{chunk-HETDJ4ZA.js → chunk-4R4TLEW4.js} +1 -1
- package/dist/standalone/{chunk-YVNA6TPB.js → chunk-4RPIDBYG.js} +1 -1
- package/dist/standalone/chunk-4U4NQF6Z.js +11 -0
- package/dist/standalone/{chunk-KEXRHVLN.js → chunk-4VIIFF27.js} +1 -1
- package/dist/standalone/{chunk-SZD6O7K2.js → chunk-4XET6RVK.js} +1 -1
- package/dist/standalone/{chunk-57JVL7N6.js → chunk-54DXA67B.js} +1 -1
- package/dist/standalone/{chunk-KJGAW36O.js → chunk-5YW4HMKS.js} +1 -1
- package/dist/standalone/{chunk-CNBQXYLI.js → chunk-6WU5TU4K.js} +1 -1
- package/dist/standalone/{chunk-6BI6AL3F.js → chunk-6XDE6XBT.js} +1 -1
- package/dist/standalone/{chunk-M2KEQODB.js → chunk-75WY42CK.js} +1 -1
- package/dist/standalone/{chunk-BFPZHZ5M.js → chunk-7J3BP6A2.js} +1 -1
- package/dist/standalone/{chunk-BNMKGBRO.js → chunk-A7STWYAF.js} +1 -1
- package/dist/standalone/{chunk-L2PBRJ7G.js → chunk-AFQFZUSP.js} +1 -1
- package/dist/standalone/{chunk-VVIGMZZI.js → chunk-ALA3CMOP.js} +2 -2
- package/dist/standalone/{chunk-ENE4N6ZV.js → chunk-B4Y5TD2V.js} +1 -1
- package/dist/standalone/{chunk-LPTEXH2G.js → chunk-C4JJO35X.js} +1 -1
- package/dist/standalone/{chunk-T3NZUPJT.js → chunk-CCTHN7Y5.js} +1 -1
- package/dist/standalone/{chunk-UAA6K2G3.js → chunk-DKZVR6OX.js} +1 -1
- package/dist/standalone/{chunk-CJMZSHN3.js → chunk-EEARNRS4.js} +1 -1
- package/dist/standalone/{chunk-NJSJI7SX.js → chunk-EESOT5SI.js} +1 -1
- package/dist/standalone/{chunk-7VYWS2FY.js → chunk-ENAJ7ZGF.js} +1 -1
- package/dist/standalone/{chunk-3BOMO6FO.js → chunk-FINSZ5UO.js} +1 -1
- package/dist/standalone/{chunk-FFSMP4KF.js → chunk-GOWMX76X.js} +1 -1
- package/dist/standalone/{chunk-MAIRKGBC.js → chunk-HO2JCLD3.js} +1 -1
- package/dist/standalone/{chunk-BHRODRCE.js → chunk-HTNMN5BE.js} +1 -1
- package/dist/standalone/{chunk-M5ITKPZN.js → chunk-JAO5VFWP.js} +1 -1
- package/dist/standalone/{chunk-4YPDEUPJ.js → chunk-KHD4GTIN.js} +1 -1
- package/dist/standalone/{chunk-BI3WYQT4.js → chunk-KW5HOSVL.js} +1 -1
- package/dist/standalone/{chunk-JXZBR6KQ.js → chunk-LAYMTAJV.js} +1 -1
- package/dist/standalone/{chunk-ZUFIKCHC.js → chunk-LFB3N7PK.js} +1 -1
- package/dist/standalone/{chunk-BF4ANX7Y.js → chunk-LWEYPOIZ.js} +1 -1
- package/dist/standalone/{chunk-7SPAXZ55.js → chunk-MQ42VLOS.js} +1 -1
- package/dist/standalone/{chunk-YMWPOBTZ.js → chunk-MTCI2I76.js} +1 -1
- package/dist/standalone/{chunk-IBCJ44SS.js → chunk-OUEBKYP6.js} +1 -1
- package/dist/standalone/{chunk-PEC7L2M2.js → chunk-PBDVZTOX.js} +1 -1
- package/dist/standalone/{chunk-CXNY45A3.js → chunk-PH5MPNFE.js} +1 -1
- package/dist/standalone/{chunk-J2REGA6E.js → chunk-RGFVCR5I.js} +1 -1
- package/dist/standalone/{chunk-B7IXABRK.js → chunk-RUS2PBWB.js} +1 -1
- package/dist/standalone/chunk-RZNN2EJU.js +15 -0
- package/dist/standalone/{chunk-Q2XPCZNR.js → chunk-S4OCAMLF.js} +1 -1
- package/dist/standalone/{chunk-2GUY4BYT.js → chunk-SAYKLOOF.js} +1 -1
- package/dist/standalone/{chunk-HMRLSE2Y.js → chunk-SC4UPHXM.js} +1 -1
- package/dist/standalone/{chunk-ODULTMQE.js → chunk-TAPHCTSY.js} +1 -1
- package/dist/standalone/{chunk-FAIPFZHS.js → chunk-TF32L7YZ.js} +1 -1
- package/dist/standalone/{chunk-RBUZXGW4.js → chunk-TIQWHHFJ.js} +1 -1
- package/dist/standalone/{chunk-7SA3C6AD.js → chunk-U34AMIA7.js} +1 -1
- package/dist/standalone/{chunk-D722YMVG.js → chunk-UOKSBFK6.js} +1 -1
- package/dist/standalone/{chunk-WO3CKCCK.js → chunk-UVMBAAA6.js} +1 -1
- package/dist/standalone/{chunk-O3OLYWXH.js → chunk-V7GKCAFR.js} +1 -1
- package/dist/standalone/{chunk-KHIJLXVN.js → chunk-X6EMHQ2B.js} +1 -1
- package/dist/standalone/{chunk-M55KXW5Z.js → chunk-XCJ4YXJG.js} +1 -1
- package/dist/standalone/{chunk-Y7BODRFB.js → chunk-XR7EQN5W.js} +1 -1
- package/dist/standalone/{chunk-73S4ZMSC.js → chunk-XY5FPTLJ.js} +1 -1
- package/dist/standalone/{chunk-VHFBBAB3.js → chunk-Y4TVOZQP.js} +1 -1
- package/dist/standalone/chunk-YOB2X3FZ.js +1 -0
- package/dist/standalone/{chunk-EFXL7F5E.js → chunk-Z2GX4OZF.js} +1 -1
- package/dist/standalone/{chunk-JXCWNZ7T.js → chunk-ZC46MF52.js} +1 -1
- package/dist/standalone/{chunk-MMYETC7K.js → chunk-ZKJTX5ET.js} +1 -1
- package/dist/standalone/{chunk-X6XVQUHD.js → chunk-ZM3EAFOC.js} +2 -2
- package/dist/standalone/{chunk-PBMIQYWZ.js → chunk-ZT2XSTH3.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +6 -6
- package/dist/packem_shared/wire-codec-DnslZGxC.mjs +0 -1
- package/dist/standalone/chunk-ET6VU4YM.js +0 -11
- package/dist/standalone/chunk-FMRAZ6MD.js +0 -15
- package/dist/standalone/chunk-XAG625PN.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ve}from"./chunk-UDCVU3Z5.js";import"./chunk-I52I2DJG.js";import{a as He}from"./chunk-EA2JKR5D.js";import{a as Ke}from"./chunk-66UGPQVC.js";import"./chunk-D27D4UUI.js";import{a as Ge}from"./chunk-SU737V7V.js";import{P as je}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as le}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as de}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Pe}from"./chunk-NJSJI7SX.js";import{a as Ue}from"./chunk-ULIQFBZU.js";import"./chunk-7SPAXZ55.js";import"./chunk-35DM4JJG.js";import{a as F}from"./chunk-4ZEL6BYL.js";import{c as Me}from"./chunk-6BI6AL3F.js";import{f as We}from"./chunk-ET6VU4YM.js";import"./chunk-FSRSK4LY.js";import"./chunk-FMRAZ6MD.js";import{a as ue}from"./chunk-FKVZRPV5.js";import{a as _e,b as Be,c as ke,d as G,e as C,f as w}from"./chunk-HEAQVSNS.js";import{a as Te,e as De}from"./chunk-WUWBZPUK.js";import{d as $,f as ie,g as ce,h as me,o as he,r as ze}from"./chunk-FODLDLE2.js";import{a as h,d as Ee,e as rt,f as nt,g as ot}from"./chunk-YKXDMIHQ.js";var W=Ee(nt(),1);var A=Ee(rt(),1);var t=Ee(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,ut=ie(F.sendQueueMessage),it=ie(F.replayQueueMessage),ct=ie(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ct"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ut"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,W.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ue,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsxs)(_e,{"data-testid":"queues-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(ke,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ft"),xt=h(n=>{let e=(0,W.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,c,x,N,y,u,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let j=mt(a.body);r=G,N=`queues-message-${a.id}`;let z=a.exportName??a.queue;e[19]!==z?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:z}),e[19]=z,e[20]=y):y=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let T=`queues-outcome-${a.id}`,D;e[25]!==a.outcome?(D=pt(a.outcome),e[25]=a.outcome,e[26]=D):D=e[26];let I;e[27]!==a.outcome||e[28]!==T||e[29]!==D?(I=(0,t.jsx)(de,{"data-testid":T,variant:D,children:a.outcome}),e[27]=a.outcome,e[28]=T,e[29]=D,e[30]=I):I=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==I||e[36]!==M?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,M]})}),e[35]=I,e[36]=M,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=j,x=ht(j),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=c,e[13]=x,e[14]=N,e[15]=y,e[16]=u,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],c=e[12],x=e[13],N=e[14],y=e[15],u=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==c||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:c,children:x}),e[38]=o,e[39]=p,e[40]=c,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=ze(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==E||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:E,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=E,e[55]=Q,e[56]=L):L=e[56];let _;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==u||e[63]!==m||e[64]!==f||e[65]!==g?(_=(0,t.jsxs)(r,{"data-testid":N,children:[y,u,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=u,e[63]=m,e[64]=f,e[65]=g,e[66]=_):_=e[66],_},"ht"),yt=h(n=>{let e=(0,W.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let u;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=u):u=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==c||e[18]!==u||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,m]}),e[17]=c,e[18]=u,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ue,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(_e,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(ke,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"pt"),Nt=h(n=>{let e=(0,W.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:c,queues:x,selectedExportName:N,sending:y}=n,u=$(),m;e[0]!==u?(m=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==u?(g=x.length===0?(0,t.jsx)(ue,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(je,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:u("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:c,type:"button",children:u(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=c,e[12]=x,e[13]=N,e[14]=y,e[15]=u,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"gt"),Ft=h(n=>{let e=(0,W.c)(59),{limit:a}=n,l=a??lt,d=We(),s=$(),[o,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:u}=Me(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=Me(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],E=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:_}=dt(S,E),[j,z]=(0,A.useState)(""),[T,D]=(0,A.useState)(""),[I,M]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(i=>i.exportName===j)?j:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:u,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{c(null);let i=H;if(i==="")return;let v=null,$e=T.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:i}:{body:v,delaySeconds:Ae,exportName:i};try{await d.query(ut,st,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"ue"),V;e[5]!==d||e[6]!==b?(V=h(async i=>{c(null),Re(i);try{await d.query(it,{id:i},ce("")),b()}catch(v){c(me(v))}Re(null)},"V"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{c(null);try{await d.query(ct,{},ce("")),b()}catch(i){c(me(i))}},"Y"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(i=>{let v=i.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(i=>{z(i.currentTarget.value)},"K"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(i=>{D(i.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(i=>{M(i.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(i=>{Ye(i.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"se"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(i=>{let{id:v}=i.currentTarget.dataset;v!==void 0&&he(Ne(v))},"ae"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",B;e[22]!==s||e[23]!==o?(B=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsx)(le,{"aria-selected":o===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===i?"secondary":"ghost",children:gt(i,s)},i))}),e[22]=s,e[23]=o,e[24]=B):B=e[24];let k;e[25]!==fe||e[26]!==xe?(k=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=k):k=e[27];let Le=_&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:E,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=E,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==T||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:T,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=T,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==B||e[53]!==k||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[B,k,Le,O,R,J]}),e[52]=B,e[53]=k,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"bt");function St(n){return n.name}h(St,"Nt");export{Ft as default};
|
|
1
|
+
import{a as Ve}from"./chunk-UDCVU3Z5.js";import"./chunk-I52I2DJG.js";import{a as He}from"./chunk-EA2JKR5D.js";import{a as Ke}from"./chunk-66UGPQVC.js";import"./chunk-D27D4UUI.js";import{a as Ge}from"./chunk-SU737V7V.js";import{P as je}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as le}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as de}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Pe}from"./chunk-EESOT5SI.js";import{a as Ue}from"./chunk-ULIQFBZU.js";import"./chunk-MQ42VLOS.js";import"./chunk-35DM4JJG.js";import{a as F}from"./chunk-4ZEL6BYL.js";import{c as Me}from"./chunk-6XDE6XBT.js";import{f as We}from"./chunk-4U4NQF6Z.js";import"./chunk-FSRSK4LY.js";import"./chunk-RZNN2EJU.js";import{a as ue}from"./chunk-FKVZRPV5.js";import{a as _e,b as Be,c as ke,d as G,e as C,f as w}from"./chunk-HEAQVSNS.js";import{a as Te,e as De}from"./chunk-WUWBZPUK.js";import{d as $,f as ie,g as ce,h as me,o as he,r as ze}from"./chunk-FODLDLE2.js";import{a as h,d as Ee,e as rt,f as nt,g as ot}from"./chunk-YKXDMIHQ.js";var W=Ee(nt(),1);var A=Ee(rt(),1);var t=Ee(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,ut=ie(F.sendQueueMessage),it=ie(F.replayQueueMessage),ct=ie(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ct"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ut"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,W.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ue,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsxs)(_e,{"data-testid":"queues-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(ke,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ft"),xt=h(n=>{let e=(0,W.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,c,x,N,y,u,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let j=mt(a.body);r=G,N=`queues-message-${a.id}`;let z=a.exportName??a.queue;e[19]!==z?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:z}),e[19]=z,e[20]=y):y=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let T=`queues-outcome-${a.id}`,D;e[25]!==a.outcome?(D=pt(a.outcome),e[25]=a.outcome,e[26]=D):D=e[26];let I;e[27]!==a.outcome||e[28]!==T||e[29]!==D?(I=(0,t.jsx)(de,{"data-testid":T,variant:D,children:a.outcome}),e[27]=a.outcome,e[28]=T,e[29]=D,e[30]=I):I=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==I||e[36]!==M?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,M]})}),e[35]=I,e[36]=M,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=j,x=ht(j),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=c,e[13]=x,e[14]=N,e[15]=y,e[16]=u,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],c=e[12],x=e[13],N=e[14],y=e[15],u=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==c||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:c,children:x}),e[38]=o,e[39]=p,e[40]=c,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=ze(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==E||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:E,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=E,e[55]=Q,e[56]=L):L=e[56];let _;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==u||e[63]!==m||e[64]!==f||e[65]!==g?(_=(0,t.jsxs)(r,{"data-testid":N,children:[y,u,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=u,e[63]=m,e[64]=f,e[65]=g,e[66]=_):_=e[66],_},"ht"),yt=h(n=>{let e=(0,W.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let u;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=u):u=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==c||e[18]!==u||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,m]}),e[17]=c,e[18]=u,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ue,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(_e,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(ke,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"pt"),Nt=h(n=>{let e=(0,W.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:c,queues:x,selectedExportName:N,sending:y}=n,u=$(),m;e[0]!==u?(m=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==u?(g=x.length===0?(0,t.jsx)(ue,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(je,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:u("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:c,type:"button",children:u(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=c,e[12]=x,e[13]=N,e[14]=y,e[15]=u,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"gt"),Ft=h(n=>{let e=(0,W.c)(59),{limit:a}=n,l=a??lt,d=We(),s=$(),[o,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:u}=Me(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=Me(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],E=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:_}=dt(S,E),[j,z]=(0,A.useState)(""),[T,D]=(0,A.useState)(""),[I,M]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(i=>i.exportName===j)?j:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:u,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{c(null);let i=H;if(i==="")return;let v=null,$e=T.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:i}:{body:v,delaySeconds:Ae,exportName:i};try{await d.query(ut,st,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"ue"),V;e[5]!==d||e[6]!==b?(V=h(async i=>{c(null),Re(i);try{await d.query(it,{id:i},ce("")),b()}catch(v){c(me(v))}Re(null)},"V"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{c(null);try{await d.query(ct,{},ce("")),b()}catch(i){c(me(i))}},"Y"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(i=>{let v=i.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(i=>{z(i.currentTarget.value)},"K"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(i=>{D(i.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(i=>{M(i.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(i=>{Ye(i.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"se"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(i=>{let{id:v}=i.currentTarget.dataset;v!==void 0&&he(Ne(v))},"ae"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",B;e[22]!==s||e[23]!==o?(B=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsx)(le,{"aria-selected":o===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===i?"secondary":"ghost",children:gt(i,s)},i))}),e[22]=s,e[23]=o,e[24]=B):B=e[24];let k;e[25]!==fe||e[26]!==xe?(k=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=k):k=e[27];let Le=_&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:E,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=E,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==T||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:T,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=T,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==B||e[53]!==k||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[B,k,Le,O,R,J]}),e[52]=B,e[53]=k,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"bt");function St(n){return n.name}h(St,"Nt");export{Ft as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as P}from"./chunk-
|
|
1
|
+
import{b as P}from"./chunk-UOKSBFK6.js";import{c as K,d as X,e as z,f as L,h as B,i as E,j as G,k as q,l as A,m as O,n as W,o as $,p as D}from"./chunk-3AZM3E32.js";import{a as F,b as H,c as I,d as S,e as J,f as M}from"./chunk-HEAQVSNS.js";import{d as C,n as j}from"./chunk-FODLDLE2.js";import{a as f,d as T,f as U,g as V}from"./chunk-YKXDMIHQ.js";var N=T(U(),1);var t=T(V(),1);var _=50,R={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},Q=f(r=>{let a=r.columns.find(e=>r.rows.length>0&&r.rows.every(n=>typeof n[e]=="number"))??null;return{label:r.columns.find(e=>e!==a)??null,value:a}},"D"),Y=f(r=>{let a=(0,N.c)(3),{data:e,kind:n}=r,l;return a[0]!==e||a[1]!==n?(l=(0,t.jsx)(G,{className:"h-full w-full",config:R,children:n==="area"?(0,t.jsxs)(E,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(z,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):(0,t.jsxs)(B,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(X,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),a[0]=e,a[1]=n,a[2]=l):l=a[2],l},"J"),na=f(r=>{let a=(0,N.c)(21),{axes:e,kind:n,result:l}=r,u=C(),o;a[0]!==l?(o=Q(l),a[0]=l,a[1]=o):o=a[1];let d=o,m;a[2]!==l.columns?(m=new Set(l.columns),a[2]=l.columns,a[3]=m):m=a[3];let s=m,c=e!==void 0&&s.has(e.x)?e.x:d.label,p;a[4]!==e?.y||a[5]!==s?(p=e?.y.find(i=>s.has(i)),a[4]=e?.y,a[5]=s,a[6]=p):p=a[6];let x=p,y=x??d.value,b;a[7]!==c||a[8]!==l.rows||a[9]!==y?(b=y===null?[]:l.rows.slice(0,_).map((i,w)=>({label:c===null?`#${(w+1).toString()}`:j(i[c]),value:Number(i[y])||0})),a[7]=c,a[8]=l.rows,a[9]=y,a[10]=b):b=a[10];let k=b;if(y===null){let i;a[11]!==u?(i=u("No numeric column to chart."),a[11]=u,a[12]=i):i=a[12];let w;return a[13]!==i?(w=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:i}),a[13]=i,a[14]=w):w=a[14],w}let h=n??(e!==void 0&&x!==void 0?e.kind:"bar"),v;a[15]!==k||a[16]!==h?(v=h==="bar"?(0,t.jsxs)(O,{className:"h-full w-full",config:R,data:k,children:[(0,t.jsx)($,{dataKey:"label"}),(0,t.jsx)(W,{dataKey:"value"}),(0,t.jsx)(D,{})]}):(0,t.jsx)(Y,{data:k,kind:h}),a[15]=k,a[16]=h,a[17]=v):v=a[17];let g;return a[18]!==h||a[19]!==v?(g=(0,t.jsx)("div",{className:"h-80 w-full p-3","data-chart-kind":h,"data-testid":"sql-chart",children:v}),a[18]=h,a[19]=v,a[20]=g):g=a[20],g},"oe"),oa=f(r=>{let a=(0,N.c)(19),{result:e}=r,n=C();if(e.columns.length===0){let s;a[0]!==e.rowCount||a[1]!==n?(s=n("{count} rows",{count:e.rowCount}),a[0]=e.rowCount,a[1]=n,a[2]=s):s=a[2];let c;return a[3]!==s?(c=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:s}),a[3]=s,a[4]=c):c=a[4],c}let l;a[5]!==e.columns?(l=e.columns.map(Z),a[5]=e.columns,a[6]=l):l=a[6];let u;a[7]!==l?(u=(0,t.jsx)(H,{className:"sticky top-0 z-10 bg-muted",children:(0,t.jsx)(S,{children:l})}),a[7]=l,a[8]=u):u=a[8];let o;if(a[9]!==e.columns||a[10]!==e.rows){let s;a[12]!==e.columns?(s=f((c,p)=>(0,t.jsx)(S,{"data-testid":"sql-row",children:e.columns.map(x=>(0,t.jsx)(M,{className:"max-w-md truncate font-mono text-xs",children:(0,t.jsx)(P,{value:c[x]})},x))},p),"s"),a[12]=e.columns,a[13]=s):s=a[13],o=e.rows.map(s),a[9]=e.columns,a[10]=e.rows,a[11]=o}else o=a[11];let d;a[14]!==o?(d=(0,t.jsx)(I,{children:o}),a[14]=o,a[15]=d):d=a[15];let m;return a[16]!==u||a[17]!==d?(m=(0,t.jsxs)(F,{"data-testid":"sql-rows",children:[u,d]}),a[16]=u,a[17]=d,a[18]=m):m=a[18],m},"ne");function Z(r){return(0,t.jsx)(J,{children:r},r)}f(Z,"P");export{na as a,oa as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as yt}from"./chunk-EA2JKR5D.js";import{b as Nt}from"./chunk-CXNY45A3.js";import{a as ne}from"./chunk-TIUMFAN2.js";import{a as St}from"./chunk-XZMOZFE6.js";import{a as zt}from"./chunk-IMOHEGMV.js";import{a as Ct}from"./chunk-66UGPQVC.js";import{P as Z}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as L}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{b as ue}from"./chunk-6BI6AL3F.js";import{f as re}from"./chunk-ET6VU4YM.js";import"./chunk-FSRSK4LY.js";import"./chunk-FMRAZ6MD.js";import{a as ce}from"./chunk-FKVZRPV5.js";import{a as ft,b as pt,c as vt,d as Ze,e as se,f as me}from"./chunk-HEAQVSNS.js";import{a as ht,e as bt}from"./chunk-WUWBZPUK.js";import{d as q,h as xt,n as S,o as wt,r as kt}from"./chunk-FODLDLE2.js";import{a as c,d as gt,e as Rt,f as $t,g as Ft}from"./chunk-YKXDMIHQ.js";var U=gt($t(),1);var j=gt(Rt(),1);var a=gt(Ft(),1);var Ot=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Dt"),Et=c(t=>{let e=Ot(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Mt"),Tt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"St"),X=c(t=>{let e=(0,U.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(zt,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"G"),de=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:s})=>{let m=q();return(0,a.jsxs)(St,{label:s,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:m("Cancel")}),(0,a.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?m("Saving\u2026"):l})]})]})},"ae"),Dt=c(t=>{let e=(0,U.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=re(),l=q(),{busy:n,error:s,run:m}=ne(),b;e[0]!==i?(b=i?S(i.name):"",e[0]=i,e[1]=b):b=e[1];let[u,g]=(0,j.useState)(b),p;e[2]!==i?(p=i?S(i.slug):"",e[2]=i,e[3]=p):p=e[3];let[f,y]=(0,j.useState)(p),k;e[4]!==i?(k=i?S(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[v,I]=(0,j.useState)(k),[C,z]=(0,j.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Tt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[w,N]=(0,j.useState)(x),O;e[9]!==o||e[10]!==v||e[11]!==w||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==m||e[19]!==f?(O=c(()=>{m(async()=>{let F=w.trim()===""?void 0:Ot(w);r==="create"?await o.createAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:f.trim()===""?void 0:f.trim()}):await o.updateAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim()===""?void 0:u.trim(),organizationId:S(i?.id),slug:f.trim()===""?void 0:f.trim()}),h(),d()})},"_"),e[9]=o,e[10]=v,e[11]=w,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=m,e[19]=f,e[20]=O):O=e[20];let A=O,D;e[21]!==r||e[22]!==u?(D=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let M;e[27]!==r||e[28]!==l?(M=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=M):M=e[29];let P;e[30]!==l?(P=l("name"),e[30]=l,e[31]=P):P=e[31];let Q;e[32]===Symbol.for("react.memo_cache_sentinel")?(Q=c(F=>{g(F.target.value)},"q"),e[32]=Q):Q=e[32];let B;e[33]!==u?(B=(0,a.jsx)(Z,{"data-testid":"org-form-name",id:"org-form-name",onChange:Q,value:u}),e[33]=u,e[34]=B):B=e[34];let E;e[35]!==B||e[36]!==P?(E=(0,a.jsx)(X,{htmlFor:"org-form-name",label:P,children:B}),e[35]=B,e[36]=P,e[37]=E):E=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let Y;e[40]===Symbol.for("react.memo_cache_sentinel")?(Y=c(F=>{y(F.target.value)},"K"),e[40]=Y):Y=e[40];let R;e[41]!==f?(R=(0,a.jsx)(Z,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:Y,value:f}),e[41]=f,e[42]=R):R=e[42];let $;e[43]!==J||e[44]!==R?($=(0,a.jsx)(X,{htmlFor:"org-form-slug",label:J,children:R}),e[43]=J,e[44]=R,e[45]=$):$=e[45];let K;e[46]!==l?(K=l("Logo URL (optional)"),e[46]=l,e[47]=K):K=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=c(F=>{I(F.target.value)},"ne"),e[48]=ie):ie=e[48];let H;e[49]!==v?(H=(0,a.jsx)(Z,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:v}),e[49]=v,e[50]=H):H=e[50];let ee;e[51]!==K||e[52]!==H?(ee=(0,a.jsx)(X,{htmlFor:"org-form-logo",label:K,children:H}),e[51]=K,e[52]=H,e[53]=ee):ee=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(Z,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(F=>{z(F.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=c(F=>{N(F.target.value)},"le"),e[60]=oe):oe=e[60];let V;e[61]!==w?(V=(0,a.jsx)(yt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:w}),e[61]=w,e[62]=V):V=e[62];let _;e[63]!==te||e[64]!==V?(_=(0,a.jsx)(X,{htmlFor:"org-form-metadata",label:te,children:V}),e[63]=te,e[64]=V,e[65]=_):_=e[65];let ae;return e[66]!==n||e[67]!==s||e[68]!==d||e[69]!==A||e[70]!==E||e[71]!==$||e[72]!==ee||e[73]!==W||e[74]!==_||e[75]!==D||e[76]!==T||e[77]!==M?(ae=(0,a.jsxs)(de,{busy:n,canSubmit:D,error:s,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:M,children:[E,$,ee,W,_]}),e[66]=n,e[67]=s,e[68]=d,e[69]=A,e[70]=E,e[71]=$,e[72]=ee,e[73]=W,e[74]=_,e[75]=D,e[76]=T,e[77]=M,e[78]=ae):ae=e[78],ae},"ht"),Lt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==s||e[6]!==m?(p=c(()=>{s(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:m.trim()}),d(),r()})},"b"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=s,e[6]=m,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Add member"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:z,value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-add-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-add-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Rt"),jt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==m||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==s?(p=c(()=>{s(async()=>{await i.inviteAuthOrgMember({email:m.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"b"),e[0]=i,e[1]=m,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=s,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Send invitation"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:z,type:"email",value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-invite-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-invite-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Ft"),Pt=c(t=>{let e=(0,U.c)(32),{member:r,onClose:d,onDone:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),m;e[0]!==r.role?(m=c(()=>S(r.role),"m"),e[0]=r.role,e[1]=m):m=e[1];let[b,u]=(0,j.useState)(m),g;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==b||e[7]!==s?(g=c(()=>{s(async()=>{await i.setAuthOrgMemberRole({memberId:S(r.id),role:b.trim()}),h(),d()})},"f"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=b,e[7]=s,e[8]=g):g=e[8];let p=g,f;e[9]!==b?(f=b.trim(),e[9]=b,e[10]=f):f=e[10];let y=f!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("Change member role"),e[13]=o,e[14]=v):v=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let z;e[18]!==b?(z=(0,a.jsx)(Z,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:b}),e[18]=b,e[19]=z):z=e[19];let x;e[20]!==I||e[21]!==z?(x=(0,a.jsx)(X,{htmlFor:"org-member-role-value",label:I,children:z}),e[20]=I,e[21]=z,e[22]=x):x=e[22];let w;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==p||e[27]!==x||e[28]!==y||e[29]!==k||e[30]!==v?(w=(0,a.jsx)(de,{busy:l,canSubmit:y,error:n,onClose:d,onSubmit:p,submitLabel:k,testId:"org-member-role",title:v,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=p,e[27]=x,e[28]=y,e[29]=k,e[30]=v,e[31]=w):w=e[31],w},"Et"),At=c(t=>{let e=(0,U.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.name):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==l||e[3]!==r||e[4]!==g||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==b||e[9]!==o?.id?(f=c(()=>{b(async()=>{await(r==="create"?l.createAuthOrgTeam({name:g.trim(),organizationId:i}):l.updateAuthOrgTeam({name:g.trim(),teamId:S(o?.id)})),h(),d()})},"h"),e[2]=l,e[3]=r,e[4]=g,e[5]=d,e[6]=h,e[7]=i,e[8]=b,e[9]=o?.id,e[10]=f):f=e[10];let y=f,k;e[11]!==g?(k=g.trim(),e[11]=g,e[12]=k):k=e[12];let v=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let z;e[19]!==n?(z=n("name"),e[19]=n,e[20]=z):z=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(A=>{p(A.target.value)},"x"),e[21]=x):x=e[21];let w;e[22]!==g?(w=(0,a.jsx)(Z,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:g}),e[22]=g,e[23]=w):w=e[23];let N;e[24]!==z||e[25]!==w?(N=(0,a.jsx)(X,{htmlFor:"org-team-form-name",label:z,children:w}),e[24]=z,e[25]=w,e[26]=N):N=e[26];let O;return e[27]!==s||e[28]!==m||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==v||e[33]!==I||e[34]!==C?(O=(0,a.jsx)(de,{busy:s,canSubmit:v,error:m,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=s,e[28]=m,e[29]=d,e[30]=y,e[31]=N,e[32]=v,e[33]=I,e[34]=C,e[35]=O):O=e[35],O},"bt"),Bt=c(t=>{let e=(0,U.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==s||e[4]!==h||e[5]!==m?(u=c(()=>{s(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:m.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=s,e[4]=h,e[5]=m,e[6]=u):u=e[6];let g=u,p;e[7]!==m?(p=m.trim(),e[7]=m,e[8]=p):p=e[8];let f=p!=="",y;e[9]!==o?(y=o("Add member"),e[9]=o,e[10]=y):y=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("User id"),e[13]=o,e[14]=v):v=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(w=>{b(w.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==m?(C=(0,a.jsx)(Z,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:m}),e[16]=m,e[17]=C):C=e[17];let z;e[18]!==v||e[19]!==C?(z=(0,a.jsx)(X,{htmlFor:"org-team-add-member-user",label:v,children:C}),e[18]=v,e[19]=C,e[20]=z):z=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==g||e[25]!==f||e[26]!==y||e[27]!==k||e[28]!==z?(x=(0,a.jsx)(de,{busy:l,canSubmit:f,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:k,children:z}),e[21]=l,e[22]=n,e[23]=r,e[24]=g,e[25]=f,e[26]=y,e[27]=k,e[28]=z,e[29]=x):x=e[29],x},"jt"),_t=c(t=>{let e=(0,U.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.role):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==r||e[3]!==o?.permission?(f=r==="edit"?Tt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=f):f=e[4];let[y,k]=(0,j.useState)(f),v;e[5]!==l||e[6]!==r||e[7]!==g||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==y||e[12]!==o?.id||e[13]!==b?(v=c(()=>{b(async()=>{let M=Et(y);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:M,role:g.trim()}):l.updateAuthOrgRole({permission:M,roleId:S(o?.id)})),h(),d()})},"p"),e[5]=l,e[6]=r,e[7]=g,e[8]=d,e[9]=h,e[10]=i,e[11]=y,e[12]=o?.id,e[13]=b,e[14]=v):v=e[14];let I=v,C;e[15]!==r||e[16]!==g||e[17]!==y?(C=y.trim()!==""&&(r==="edit"||g.trim()!==""),e[15]=r,e[16]=g,e[17]=y,e[18]=C):C=e[18];let z;e[19]!==r||e[20]!==n?(z=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=z):z=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let w;e[25]!==r||e[26]!==g||e[27]!==n?(w=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(Z,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c(M=>{p(M.target.value)},"onChange"),value:g})}),e[25]=r,e[26]=g,e[27]=n,e[28]=w):w=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{k(M.target.value)},"_"),e[31]=O):O=e[31];let A;e[32]!==y?(A=(0,a.jsx)(yt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:O,value:y}),e[32]=y,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,a.jsx)(X,{htmlFor:"org-role-form-permission",label:N,children:A}),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==s||e[38]!==m||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==C||e[43]!==z||e[44]!==x||e[45]!==w?(T=(0,a.jsxs)(de,{busy:s,canSubmit:C,error:m,onClose:d,onSubmit:I,submitLabel:z,testId:"org-role-form",title:x,children:[w,D]}),e[37]=s,e[38]=m,e[39]=d,e[40]=I,e[41]=D,e[42]=C,e[43]=z,e[44]=x,e[45]=w,e[46]=T):T=e[46],T},"pt"),Mt=c(t=>{let e=(0,U.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==b?(u=c(()=>{b(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=b,e[4]=u):u=e[4];let g=u,p;e[5]!==n?(p=n("Delete"),e[5]=n,e[6]=p):p=e[6];let f;e[7]!==d?(f=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let y;return e[9]!==s||e[10]!==m||e[11]!==h||e[12]!==g||e[13]!==p||e[14]!==f||e[15]!==o||e[16]!==l?(y=(0,a.jsx)(de,{busy:s,canSubmit:!0,destructive:!0,error:m,onClose:h,onSubmit:g,submitLabel:p,testId:o,title:l,children:f}),e[9]=s,e[10]=m,e[11]=h,e[12]=g,e[13]=p,e[14]=f,e[15]=o,e[16]=l,e[17]=y):y=e[17],y},"zt"),Ge=c(t=>{let e=(0,U.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let s;e[7]!==d?(s=(0,a.jsx)(bt,{className:"px-0",children:d}),e[7]=d,e[8]=s):s=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==i?(m=(0,a.jsxs)(ht,{className:"overflow-hidden py-0","data-testid":i,children:[n,s]}),e[9]=n,e[10]=s,e[11]=i,e[12]=m):m=e[12],m},"Ve"),He=c(t=>{let e=(0,U.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=q(),l;e[0]!==r?(l=r.map(Jt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==n?(s=(0,a.jsx)(se,{"aria-label":n}),e[4]=n,e[5]=s):s=e[5];let m;e[6]!==l||e[7]!==s?(m=(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[l,s]})}),e[6]=l,e[7]=s,e[8]=m):m=e[8];let b;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let p;e[14]!==r||e[15]!==d||e[16]!==h?(p=c((f,y)=>{let k=S(f.id),v=k===""?`index-${y.toString()}`:k;return(0,a.jsxs)(Ze,{"data-testid":`${h}-${v}`,children:[r.map(I=>(0,a.jsx)(me,{className:I.className,children:I.render(f)},I.head)),(0,a.jsx)(me,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(f)})})]},v)},"b"),e[14]=r,e[15]=d,e[16]=h,e[17]=p):p=e[17],b=i.map(p),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=b}else b=e[13];let u;e[18]!==b?(u=(0,a.jsx)(vt,{children:b}),e[18]=b,e[19]=u):u=e[19];let g;return e[20]!==m||e[21]!==u?(g=(0,a.jsxs)(ft,{children:[m,u]}),e[20]=m,e[21]=u,e[22]=g):g=e[22],g},"We");function Jt(t){return(0,a.jsx)(se,{children:t.head},t.head)}c(Jt,"Lt");var Ut=c(t=>{let e=(0,U.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let s;e[2]!==l?(s=l("Add member"),e[2]=l,e[3]=s):s=e[3];let m;e[4]!==n||e[5]!==s?(m=(0,a.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:s}),e[4]=n,e[5]=s,e[6]=m):m=e[6];let b;e[7]!==o?(b=c(()=>{o({kind:"invite-member"})},"g"),e[7]=o,e[8]=b):b=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let g;e[11]!==b||e[12]!==u?(g=(0,a.jsx)(L,{"data-testid":"org-open-invite-member",onClick:b,size:"xs",type:"button",variant:"outline",children:u}),e[11]=b,e[12]=u,e[13]=g):g=e[13];let p;e[14]!==m||e[15]!==g?(p=(0,a.jsxs)(a.Fragment,{children:[m,g]}),e[14]=m,e[15]=g,e[16]=p):p=e[16];let f;e[17]!==l?(f=l("Members"),e[17]=l,e[18]=f):f=e[18];let y;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(y=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(v=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-member-role-${S(v.id)}`,onClick:c(()=>{o({kind:"member-role",member:v})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(L,{"data-testid":`org-remove-member-${S(v.id)}`,disabled:r,onClick:c(()=>{d(S(v.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=y):y=e[25];let k;return e[26]!==p||e[27]!==f||e[28]!==y?(k=(0,a.jsx)(Ge,{action:p,heading:f,testId:"org-members",children:y}),e[26]=p,e[27]=f,e[28]=y,e[29]=k):k=e[29],k},"Pt"),qt=c(t=>{let e=(0,U.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=q(),s;e[0]!==d?(s=c(()=>{d({kind:"team-create"})},"a"),e[0]=d,e[1]=s):s=e[1];let m;e[2]!==n?(m=n("New team"),e[2]=n,e[3]=m):m=e[3];let b;e[4]!==s||e[5]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-create-team",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[4]=s,e[5]=m,e[6]=b):b=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let g;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"aria-pressed":i===S(f.id),"data-testid":`org-team-select-${S(f.id)}`,onClick:c(()=>{h(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(L,{"data-testid":`org-team-rename-${S(f.id)}`,onClick:c(()=>{d({kind:"team-rename",team:f})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(L,{"data-testid":`org-team-delete-${S(f.id)}`,onClick:c(()=>{r(f)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=g):g=e[16];let p;return e[17]!==b||e[18]!==u||e[19]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-teams",children:g}),e[17]=b,e[18]=u,e[19]=g,e[20]=p):p=e[20],p},"Bt"),Kt=c(t=>{let e=(0,U.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=q(),s;e[0]!==h||e[1]!==i?(s=c(()=>{h({kind:"team-add-member",teamId:i})},"a"),e[0]=h,e[1]=i,e[2]=s):s=e[2];let m;e[3]!==n?(m=n("Add member"),e[3]=n,e[4]=m):m=e[4];let b;e[5]!==s||e[6]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[5]=s,e[6]=m,e[7]=b):b=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let g;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsx)(L,{"data-testid":`org-team-remove-member-${S(f.id)}`,disabled:r,onClick:c(()=>{d(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=g):g=e[15];let p;return e[16]!==b||e[17]!==u||e[18]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-team-members",children:g}),e[16]=b,e[17]=u,e[18]=g,e[19]=p):p=e[19],p},"Qt"),Qt=c(t=>{let e=(0,U.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"o"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==l||e[5]!==n?(s=(0,a.jsx)(L,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=s):s=e[6];let m;e[7]!==o?(m=o("Roles"),e[7]=o,e[8]=m):m=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(b=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-role-edit-${S(g.id)}`,onClick:c(()=>{d({kind:"role-edit",role:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(L,{"data-testid":`org-role-delete-${S(g.id)}`,onClick:c(()=>{r(S(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=b):b=e[14];let u;return e[15]!==s||e[16]!==m||e[17]!==b?(u=(0,a.jsx)(Ge,{action:s,heading:m,testId:"org-roles",children:b}),e[15]=s,e[16]=m,e[17]=b,e[18]=u):u=e[18],u},"Jt"),Xt=c(t=>{let e=(0,U.c)(199),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=re(),o=q(),[l,n]=(0,j.useState)(null),[s,m]=(0,j.useState)(null),[b,u]=(0,j.useState)(!1),[g,p]=(0,j.useState)(null),f;e[0]!==r?(f=["lunora-auth-org-members",r],e[0]=r,e[1]=f):f=e[1];let y;e[2]!==i||e[3]!==r?(y=c(()=>i.listAuthOrgMembers({limit:200,organizationId:r}),"v"),e[2]=i,e[3]=r,e[4]=y):y=e[4];let k=ue(f,y),v;e[5]!==r?(v=["lunora-auth-org-invitations",r],e[5]=r,e[6]=v):v=e[6];let I;e[7]!==i||e[8]!==r?(I=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"C"),e[7]=i,e[8]=r,e[9]=I):I=e[9];let C=ue(v,I),z;e[10]!==r?(z=["lunora-auth-org-teams",r],e[10]=r,e[11]=z):z=e[11];let x;e[12]!==i||e[13]!==r?(x=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"x"),e[12]=i,e[13]=r,e[14]=x):x=e[14];let w;e[15]!==h?(w={enabled:h},e[15]=h,e[16]=w):w=e[16];let N=ue(z,x,w),O;e[17]!==r?(O=["lunora-auth-org-roles",r],e[17]=r,e[18]=O):O=e[18];let A;e[19]!==i||e[20]!==r?(A=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"N"),e[19]=i,e[20]=r,e[21]=A):A=e[21];let D;e[22]!==d?(D={enabled:d},e[22]=d,e[23]=D):D=e[23];let T=ue(O,A,D),M;e[24]!==s?(M=["lunora-auth-org-team-members",s],e[24]=s,e[25]=M):M=e[25];let P;e[26]!==i||e[27]!==s?(P=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:s??""}),"P"),e[26]=i,e[27]=s,e[28]=P):P=e[28];let Q=s!==null,B;e[29]!==Q?(B={enabled:Q},e[29]=Q,e[30]=B):B=e[30];let E=ue(M,P,B),J;e[31]!==k.data?.rows?(J=k.data?.rows??[],e[31]=k.data?.rows,e[32]=J):J=e[32];let Y=J,R;e[33]!==C.data?.rows?(R=C.data?.rows??[],e[33]=C.data?.rows,e[34]=R):R=e[34];let $=R,K;e[35]!==N.data?.rows?(K=N.data?.rows??[],e[35]=N.data?.rows,e[36]=K):K=e[36];let ie=K,H;e[37]!==T.data?.rows?(H=T.data?.rows??[],e[37]=T.data?.rows,e[38]=H):H=e[38];let ee=H,W;e[39]!==s||e[40]!==E?(W=s===null?[]:E.data?.rows??[],e[39]=s,e[40]=E,e[41]=W):W=e[41];let te=W,oe=k.error??C.error??N.error??T.error??E.error,V;e[42]!==C||e[43]!==k||e[44]!==d||e[45]!==T||e[46]!==s||e[47]!==E||e[48]!==h||e[49]!==N?(V=c(()=>{k.refetch(),C.refetch(),h&&N.refetch(),d&&T.refetch(),s!==null&&E.refetch()},"Z"),e[42]=C,e[43]=k,e[44]=d,e[45]=T,e[46]=s,e[47]=E,e[48]=h,e[49]=N,e[50]=V):V=e[50];let _=V;Ct(_,!0);let ae;e[51]===Symbol.for("react.memo_cache_sentinel")?(ae=c(()=>{n(null)},"ie"),e[51]=ae):ae=e[51];let F=ae,We;e[52]!==_?(We=c(G=>{wt((async()=>{u(!0),p(null);try{await G(),_(),u(!1)}catch(nt){p(xt(nt)),u(!1)}})())},"Xe"),e[52]=_,e[53]=We):We=e[53];let le=We,Ve;e[54]!==i||e[55]!==o?(Ve=c(G=>{let nt=S(G.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:nt}),m(It=>It===nt?null:It)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"Ye"),e[54]=i,e[55]=o,e[56]=Ve):Ve=e[56];let it=Ve,ge;e[57]!==o?(ge=o("userId"),e[57]=o,e[58]=ge):ge=e[58];let he;e[59]!==ge?(he={head:ge,render:Yt},e[59]=ge,e[60]=he):he=e[60];let be;e[61]!==o?(be=o("role"),e[61]=o,e[62]=be):be=e[62];let fe;e[63]!==be?(fe={head:be,render:Zt},e[63]=be,e[64]=fe):fe=e[64];let et;e[65]!==he||e[66]!==fe?(et=[he,fe],e[65]=he,e[66]=fe,e[67]=et):et=e[67];let st=et,pe;e[68]!==o?(pe=o("email"),e[68]=o,e[69]=pe):pe=e[69];let ve;e[70]!==pe?(ve={head:pe,render:Gt},e[70]=pe,e[71]=ve):ve=e[71];let ye;e[72]!==o?(ye=o("role"),e[72]=o,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:Ht},e[74]=ye,e[75]=Ce):Ce=e[75];let Ie;e[76]!==o?(Ie=o("status"),e[76]=o,e[77]=Ie):Ie=e[77];let xe;e[78]!==Ie?(xe={head:Ie,render:Wt},e[78]=Ie,e[79]=xe):xe=e[79];let tt;e[80]!==ve||e[81]!==Ce||e[82]!==xe?(tt=[ve,Ce,xe],e[80]=ve,e[81]=Ce,e[82]=xe,e[83]=tt):tt=e[83];let mt=tt,we;e[84]!==o?(we=o("id"),e[84]=o,e[85]=we):we=e[85];let ke;e[86]!==we?(ke={className:"font-mono text-xs",head:we,render:Vt},e[86]=we,e[87]=ke):ke=e[87];let ze;e[88]!==o?(ze=o("name"),e[88]=o,e[89]=ze):ze=e[89];let Ne;e[90]!==ze?(Ne={head:ze,render:er},e[90]=ze,e[91]=Ne):Ne=e[91];let rt;e[92]!==ke||e[93]!==Ne?(rt=[ke,Ne],e[92]=ke,e[93]=Ne,e[94]=rt):rt=e[94];let dt=rt,Se;e[95]!==o?(Se=o("userId"),e[95]=o,e[96]=Se):Se=e[96];let ot;e[97]!==Se?(ot=[{head:Se,render:tr}],e[97]=Se,e[98]=ot):ot=e[98];let ct=ot,De;e[99]!==o?(De=o("role"),e[99]=o,e[100]=De):De=e[100];let Ae;e[101]!==De?(Ae={head:De,render:rr},e[101]=De,e[102]=Ae):Ae=e[102];let _e;e[103]!==o?(_e=o("Permission"),e[103]=o,e[104]=_e):_e=e[104];let Oe;e[105]!==_e?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:or},e[105]=_e,e[106]=Oe):Oe=e[106];let at;e[107]!==Ae||e[108]!==Oe?(at=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=at):at=e[109];let ut=at,Te;e[110]!==oe?(Te=oe!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe}),e[110]=oe,e[111]=Te):Te=e[111];let Me;e[112]!==g?(Me=g!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g}),e[112]=g,e[113]=Me):Me=e[113];let Re;e[114]!==i||e[115]!==le?(Re=c(G=>{le(()=>i.removeAuthOrgMember({memberId:G}))},"Te"),e[114]=i,e[115]=le,e[116]=Re):Re=e[116];let $e;e[117]!==b||e[118]!==st||e[119]!==Y||e[120]!==Re?($e=(0,a.jsx)(Ut,{actionBusy:b,memberColumns:st,members:Y,onDialog:n,onRemoveMember:Re}),e[117]=b,e[118]=st,e[119]=Y,e[120]=Re,e[121]=$e):$e=e[121];let Fe;e[122]!==b||e[123]!==i||e[124]!==mt||e[125]!==$||e[126]!==le||e[127]!==o?(Fe=$.length>0&&(0,a.jsx)(Ge,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(He,{columns:mt,rowActions:c(G=>(0,a.jsx)(L,{"data-testid":`org-cancel-invitation-${S(G.id)}`,disabled:b,onClick:c(()=>{le(()=>i.cancelAuthOrgInvitation({invitationId:S(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:$})}),e[122]=b,e[123]=i,e[124]=mt,e[125]=$,e[126]=le,e[127]=o,e[128]=Fe):Fe=e[128];let Ee;e[129]!==it||e[130]!==s||e[131]!==dt||e[132]!==ie||e[133]!==h?(Ee=h&&(0,a.jsx)(qt,{onConfirmDeleteTeam:it,onDialog:n,onSelectTeam:m,selectedTeam:s,teamColumns:dt,teams:ie}),e[129]=it,e[130]=s,e[131]=dt,e[132]=ie,e[133]=h,e[134]=Ee):Ee=e[134];let Le;e[135]!==b||e[136]!==i||e[137]!==le||e[138]!==s||e[139]!==ct||e[140]!==te||e[141]!==h?(Le=h&&s!==null&&(0,a.jsx)(Kt,{actionBusy:b,onDialog:n,onRemoveTeamMember:c(G=>{le(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:s,teamMemberColumns:ct,teamMembers:te}),e[135]=b,e[136]=i,e[137]=le,e[138]=s,e[139]=ct,e[140]=te,e[141]=h,e[142]=Le):Le=e[142];let je;e[143]!==i||e[144]!==ut||e[145]!==ee||e[146]!==d||e[147]!==o?(je=d&&(0,a.jsx)(Qt,{onConfirmDeleteRole:c(G=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:ut,roles:ee}),e[143]=i,e[144]=ut,e[145]=ee,e[146]=d,e[147]=o,e[148]=je):je=e[148];let Pe;e[149]!==l?.kind||e[150]!==r||e[151]!==_?(Pe=l?.kind==="add-member"&&(0,a.jsx)(Lt,{onClose:F,onDone:_,organizationId:r}),e[149]=l?.kind,e[150]=r,e[151]=_,e[152]=Pe):Pe=e[152];let Be;e[153]!==l?.kind||e[154]!==r||e[155]!==_?(Be=l?.kind==="invite-member"&&(0,a.jsx)(jt,{onClose:F,onDone:_,organizationId:r}),e[153]=l?.kind,e[154]=r,e[155]=_,e[156]=Be):Be=e[156];let Je;e[157]!==l||e[158]!==_?(Je=l?.kind==="member-role"&&(0,a.jsx)(Pt,{member:l.member,onClose:F,onDone:_}),e[157]=l,e[158]=_,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==_?(Ue=l?.kind==="team-create"&&(0,a.jsx)(At,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=_,e[163]=Ue):Ue=e[163];let qe;e[164]!==l||e[165]!==r||e[166]!==_?(qe=l?.kind==="team-rename"&&(0,a.jsx)(At,{mode:"edit",onClose:F,onDone:_,organizationId:r,team:l.team}),e[164]=l,e[165]=r,e[166]=_,e[167]=qe):qe=e[167];let Ke;e[168]!==l||e[169]!==_?(Ke=l?.kind==="team-add-member"&&(0,a.jsx)(Bt,{onClose:F,onDone:_,teamId:l.teamId}),e[168]=l,e[169]=_,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l?.kind||e[172]!==r||e[173]!==_?(Qe=l?.kind==="role-create"&&(0,a.jsx)(_t,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[171]=l?.kind,e[172]=r,e[173]=_,e[174]=Qe):Qe=e[174];let Xe;e[175]!==l||e[176]!==r||e[177]!==_?(Xe=l?.kind==="role-edit"&&(0,a.jsx)(_t,{mode:"edit",onClose:F,onDone:_,organizationId:r,role:l.role}),e[175]=l,e[176]=r,e[177]=_,e[178]=Xe):Xe=e[178];let Ye;e[179]!==l||e[180]!==_?(Ye=l?.kind==="confirm"&&(0,a.jsx)(Mt,{action:l.action,message:l.message,onClose:F,onDone:_,testId:l.testId,title:l.title}),e[179]=l,e[180]=_,e[181]=Ye):Ye=e[181];let lt;return e[182]!==Te||e[183]!==Me||e[184]!==$e||e[185]!==Fe||e[186]!==Ee||e[187]!==Le||e[188]!==je||e[189]!==Pe||e[190]!==Be||e[191]!==Je||e[192]!==Ue||e[193]!==qe||e[194]!==Ke||e[195]!==Qe||e[196]!==Xe||e[197]!==Ye?(lt=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Te,Me,$e,Fe,Ee,Le,je,Pe,Be,Je,Ue,qe,Ke,Qe,Xe,Ye]}),e[182]=Te,e[183]=Me,e[184]=$e,e[185]=Fe,e[186]=Ee,e[187]=Le,e[188]=je,e[189]=Pe,e[190]=Be,e[191]=Je,e[192]=Ue,e[193]=qe,e[194]=Ke,e[195]=Qe,e[196]=Xe,e[197]=Ye,e[198]=lt):lt=e[198],lt},"Ut");function Yt(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(Yt,"Ht");function Zt(t){return S(t.role)}c(Zt,"qt");function Gt(t){return S(t.email)}c(Gt,"Gt");function Ht(t){return S(t.role)}c(Ht,"Kt");function Wt(t){return S(t.status)}c(Wt,"Vt");function Vt(t){return S(t.id)}c(Vt,"Wt");function er(t){return S(t.name)}c(er,"Xt");function tr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(tr,"Yt");function rr(t){return S(t.role)}c(rr,"Zt");function or(t){return S(t.permission)}c(or,"el");var yr=c(()=>{let t=(0,U.c)(62),e=re(),r=q(),{config:d,ready:h}=Nt(),i=d.capabilities.organization,[o,l]=(0,j.useState)(null),[n,s]=(0,j.useState)(null),m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=["lunora-auth-orgs"],t[0]=m):m=t[0];let b;t[1]!==e?(b=c(()=>e.listAuthOrganizations({limit:100}),"g"),t[1]=e,t[2]=b):b=t[2];let u;t[3]!==i?(u={enabled:i},t[3]=i,t[4]=u):u=t[4];let g=ue(m,b,u),p=g.data?.rows??null,f;t[5]!==g?(f=c(()=>{g.refetch()},"h"),t[5]=g,t[6]=f):f=t[6],Ct(f,i);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{s(null)},"v"),t[7]=y):y=t[7];let k=y,v;t[8]!==g?(v=c(()=>{g.refetch()},"p"),t[8]=g,t[9]=v):v=t[9];let I=v,C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C=c(R=>{l(R)},"y"),t[10]=C):C=t[10];let z=C;if(h&&!i){let R;t[11]!==r?(R=r("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=r,t[12]=R):R=t[12];let $;t[13]!==r?($=r("Organizations are not enabled."),t[13]=r,t[14]=$):$=t[14];let K;return t[15]!==R||t[16]!==$?(K=(0,a.jsx)(ce,{description:R,testId:"org-disabled",title:$}),t[15]=R,t[16]=$,t[17]=K):K=t[17],K}let x;t[18]!==r?(x=r("Organizations"),t[18]=r,t[19]=x):x=t[19];let w;t[20]!==x?(w=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),t[20]=x,t[21]=w):w=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=c(()=>{s({kind:"create"})},"D"),t[22]=N):N=t[22];let O;t[23]!==r?(O=r("New organization"),t[23]=r,t[24]=O):O=t[24];let A;t[25]!==O?(A=(0,a.jsx)(L,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:O}),t[25]=O,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==w?(D=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[w,A]}),t[27]=A,t[28]=w,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[30]=g.error,t[31]=T):T=t[31];let M;t[32]!==p||t[33]!==r?(M=p!==null&&p.length===0&&(0,a.jsx)(ce,{testId:"org-empty",title:r("No organizations.")}),t[32]=p,t[33]=r,t[34]=M):M=t[34];let P;t[35]!==p||t[36]!==o||t[37]!==r?(P=p!==null&&p.length>0&&(0,a.jsx)(ht,{className:"overflow-hidden py-0",children:(0,a.jsx)(bt,{className:"px-0",children:(0,a.jsxs)(ft,{"data-testid":"org-table",children:[(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[(0,a.jsx)(se,{children:r("id")}),(0,a.jsx)(se,{children:r("name")}),(0,a.jsx)(se,{children:r("slug")}),(0,a.jsx)(se,{children:r("created")}),(0,a.jsx)(se,{"aria-label":r("Actions")})]})}),(0,a.jsx)(vt,{children:p.map(R=>{let $=S(R.id);return(0,a.jsxs)(Ze,{"data-testid":`org-row-${$}`,children:[(0,a.jsx)(me,{className:"font-mono text-xs",children:$}),(0,a.jsx)(me,{children:S(R.name)}),(0,a.jsx)(me,{children:S(R.slug)}),(0,a.jsx)(me,{className:"text-muted-foreground tabular-nums",children:kt(R.createdAt)}),(0,a.jsx)(me,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:c(()=>{z($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:c(()=>{s({kind:"edit",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:c(()=>{s({kind:"delete",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[35]=p,t[36]=o,t[37]=r,t[38]=P):P=t[38];let Q;t[39]!==d.organization||t[40]!==o?(Q=o!==null&&(0,a.jsx)(Xt,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[39]=d.organization,t[40]=o,t[41]=Q):Q=t[41];let B;t[42]!==n?.kind||t[43]!==I?(B=n?.kind==="create"&&(0,a.jsx)(Dt,{mode:"create",onClose:k,onDone:I}),t[42]=n?.kind,t[43]=I,t[44]=B):B=t[44];let E;t[45]!==n||t[46]!==I?(E=n?.kind==="edit"&&(0,a.jsx)(Dt,{mode:"edit",onClose:k,onDone:I,org:n.org}),t[45]=n,t[46]=I,t[47]=E):E=t[47];let J;t[48]!==e||t[49]!==n||t[50]!==I||t[51]!==r?(J=n?.kind==="delete"&&(0,a.jsx)(Mt,{action:c(async()=>{let R=S(n.org.id);await e.deleteAuthOrganization({organizationId:R}),l($=>$===R?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:k,onDone:I,testId:"org-delete",title:r("Delete organization")}),t[48]=e,t[49]=n,t[50]=I,t[51]=r,t[52]=J):J=t[52];let Y;return t[53]!==D||t[54]!==T||t[55]!==M||t[56]!==P||t[57]!==Q||t[58]!==B||t[59]!==E||t[60]!==J?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,M,P,Q,B,E,J]}),t[53]=D,t[54]=T,t[55]=M,t[56]=P,t[57]=Q,t[58]=B,t[59]=E,t[60]=J,t[61]=Y):Y=t[61],Y},"yl");export{yr as default};
|
|
1
|
+
import{a as yt}from"./chunk-EA2JKR5D.js";import{b as Nt}from"./chunk-PH5MPNFE.js";import{a as ne}from"./chunk-TIUMFAN2.js";import{a as St}from"./chunk-XZMOZFE6.js";import{a as zt}from"./chunk-IMOHEGMV.js";import{a as Ct}from"./chunk-66UGPQVC.js";import{P as Z}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as L}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{b as ue}from"./chunk-6XDE6XBT.js";import{f as re}from"./chunk-4U4NQF6Z.js";import"./chunk-FSRSK4LY.js";import"./chunk-RZNN2EJU.js";import{a as ce}from"./chunk-FKVZRPV5.js";import{a as ft,b as pt,c as vt,d as Ze,e as se,f as me}from"./chunk-HEAQVSNS.js";import{a as ht,e as bt}from"./chunk-WUWBZPUK.js";import{d as q,h as xt,n as S,o as wt,r as kt}from"./chunk-FODLDLE2.js";import{a as c,d as gt,e as Rt,f as $t,g as Ft}from"./chunk-YKXDMIHQ.js";var U=gt($t(),1);var j=gt(Rt(),1);var a=gt(Ft(),1);var Ot=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Dt"),Et=c(t=>{let e=Ot(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Mt"),Tt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"St"),X=c(t=>{let e=(0,U.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(zt,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"G"),de=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:s})=>{let m=q();return(0,a.jsxs)(St,{label:s,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(L,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:m("Cancel")}),(0,a.jsx)(L,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?m("Saving\u2026"):l})]})]})},"ae"),Dt=c(t=>{let e=(0,U.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=re(),l=q(),{busy:n,error:s,run:m}=ne(),b;e[0]!==i?(b=i?S(i.name):"",e[0]=i,e[1]=b):b=e[1];let[u,g]=(0,j.useState)(b),p;e[2]!==i?(p=i?S(i.slug):"",e[2]=i,e[3]=p):p=e[3];let[f,y]=(0,j.useState)(p),k;e[4]!==i?(k=i?S(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[v,I]=(0,j.useState)(k),[C,z]=(0,j.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Tt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[w,N]=(0,j.useState)(x),O;e[9]!==o||e[10]!==v||e[11]!==w||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==m||e[19]!==f?(O=c(()=>{m(async()=>{let F=w.trim()===""?void 0:Ot(w);r==="create"?await o.createAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:f.trim()===""?void 0:f.trim()}):await o.updateAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:F,name:u.trim()===""?void 0:u.trim(),organizationId:S(i?.id),slug:f.trim()===""?void 0:f.trim()}),h(),d()})},"_"),e[9]=o,e[10]=v,e[11]=w,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=m,e[19]=f,e[20]=O):O=e[20];let A=O,D;e[21]!==r||e[22]!==u?(D=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=D):D=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let M;e[27]!==r||e[28]!==l?(M=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=M):M=e[29];let P;e[30]!==l?(P=l("name"),e[30]=l,e[31]=P):P=e[31];let Q;e[32]===Symbol.for("react.memo_cache_sentinel")?(Q=c(F=>{g(F.target.value)},"q"),e[32]=Q):Q=e[32];let B;e[33]!==u?(B=(0,a.jsx)(Z,{"data-testid":"org-form-name",id:"org-form-name",onChange:Q,value:u}),e[33]=u,e[34]=B):B=e[34];let E;e[35]!==B||e[36]!==P?(E=(0,a.jsx)(X,{htmlFor:"org-form-name",label:P,children:B}),e[35]=B,e[36]=P,e[37]=E):E=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let Y;e[40]===Symbol.for("react.memo_cache_sentinel")?(Y=c(F=>{y(F.target.value)},"K"),e[40]=Y):Y=e[40];let R;e[41]!==f?(R=(0,a.jsx)(Z,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:Y,value:f}),e[41]=f,e[42]=R):R=e[42];let $;e[43]!==J||e[44]!==R?($=(0,a.jsx)(X,{htmlFor:"org-form-slug",label:J,children:R}),e[43]=J,e[44]=R,e[45]=$):$=e[45];let K;e[46]!==l?(K=l("Logo URL (optional)"),e[46]=l,e[47]=K):K=e[47];let ie;e[48]===Symbol.for("react.memo_cache_sentinel")?(ie=c(F=>{I(F.target.value)},"ne"),e[48]=ie):ie=e[48];let H;e[49]!==v?(H=(0,a.jsx)(Z,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:ie,value:v}),e[49]=v,e[50]=H):H=e[50];let ee;e[51]!==K||e[52]!==H?(ee=(0,a.jsx)(X,{htmlFor:"org-form-logo",label:K,children:H}),e[51]=K,e[52]=H,e[53]=ee):ee=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(Z,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(F=>{z(F.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=c(F=>{N(F.target.value)},"le"),e[60]=oe):oe=e[60];let V;e[61]!==w?(V=(0,a.jsx)(yt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:w}),e[61]=w,e[62]=V):V=e[62];let _;e[63]!==te||e[64]!==V?(_=(0,a.jsx)(X,{htmlFor:"org-form-metadata",label:te,children:V}),e[63]=te,e[64]=V,e[65]=_):_=e[65];let ae;return e[66]!==n||e[67]!==s||e[68]!==d||e[69]!==A||e[70]!==E||e[71]!==$||e[72]!==ee||e[73]!==W||e[74]!==_||e[75]!==D||e[76]!==T||e[77]!==M?(ae=(0,a.jsxs)(de,{busy:n,canSubmit:D,error:s,onClose:d,onSubmit:A,submitLabel:T,testId:"org-form",title:M,children:[E,$,ee,W,_]}),e[66]=n,e[67]=s,e[68]=d,e[69]=A,e[70]=E,e[71]=$,e[72]=ee,e[73]=W,e[74]=_,e[75]=D,e[76]=T,e[77]=M,e[78]=ae):ae=e[78],ae},"ht"),Lt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==s||e[6]!==m?(p=c(()=>{s(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:m.trim()}),d(),r()})},"b"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=s,e[6]=m,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Add member"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:z,value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-add-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-add-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Rt"),jt=c(t=>{let e=(0,U.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),[u,g]=(0,j.useState)(""),p;e[0]!==i||e[1]!==m||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==s?(p=c(()=>{s(async()=>{await i.inviteAuthOrgMember({email:m.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"b"),e[0]=i,e[1]=m,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=s,e[7]=p):p=e[7];let f=p,y;e[8]!==m?(y=m.trim(),e[8]=m,e[9]=y):y=e[9];let k=y!=="",v;e[10]!==o?(v=o("Send invitation"),e[10]=o,e[11]=v):v=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let z;e[16]===Symbol.for("react.memo_cache_sentinel")?(z=c(M=>{b(M.target.value)},"w"),e[16]=z):z=e[16];let x;e[17]!==m?(x=(0,a.jsx)(Z,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:z,type:"email",value:m}),e[17]=m,e[18]=x):x=e[18];let w;e[19]!==C||e[20]!==x?(w=(0,a.jsx)(X,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=w):w=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{g(M.target.value)},"_"),e[24]=O):O=e[24];let A;e[25]!==u?(A=(0,a.jsx)(Z,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:O,value:u}),e[25]=u,e[26]=A):A=e[26];let D;e[27]!==N||e[28]!==A?(D=(0,a.jsx)(X,{htmlFor:"org-invite-member-role",label:N,children:A}),e[27]=N,e[28]=A,e[29]=D):D=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==f||e[34]!==D||e[35]!==k||e[36]!==v||e[37]!==I||e[38]!==w?(T=(0,a.jsxs)(de,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:f,submitLabel:v,testId:"org-invite-member",title:I,children:[w,D]}),e[30]=l,e[31]=n,e[32]=r,e[33]=f,e[34]=D,e[35]=k,e[36]=v,e[37]=I,e[38]=w,e[39]=T):T=e[39],T},"Ft"),Pt=c(t=>{let e=(0,U.c)(32),{member:r,onClose:d,onDone:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),m;e[0]!==r.role?(m=c(()=>S(r.role),"m"),e[0]=r.role,e[1]=m):m=e[1];let[b,u]=(0,j.useState)(m),g;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==b||e[7]!==s?(g=c(()=>{s(async()=>{await i.setAuthOrgMemberRole({memberId:S(r.id),role:b.trim()}),h(),d()})},"f"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=b,e[7]=s,e[8]=g):g=e[8];let p=g,f;e[9]!==b?(f=b.trim(),e[9]=b,e[10]=f):f=e[10];let y=f!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("Change member role"),e[13]=o,e[14]=v):v=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let z;e[18]!==b?(z=(0,a.jsx)(Z,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:b}),e[18]=b,e[19]=z):z=e[19];let x;e[20]!==I||e[21]!==z?(x=(0,a.jsx)(X,{htmlFor:"org-member-role-value",label:I,children:z}),e[20]=I,e[21]=z,e[22]=x):x=e[22];let w;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==p||e[27]!==x||e[28]!==y||e[29]!==k||e[30]!==v?(w=(0,a.jsx)(de,{busy:l,canSubmit:y,error:n,onClose:d,onSubmit:p,submitLabel:k,testId:"org-member-role",title:v,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=p,e[27]=x,e[28]=y,e[29]=k,e[30]=v,e[31]=w):w=e[31],w},"Et"),At=c(t=>{let e=(0,U.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.name):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==l||e[3]!==r||e[4]!==g||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==b||e[9]!==o?.id?(f=c(()=>{b(async()=>{await(r==="create"?l.createAuthOrgTeam({name:g.trim(),organizationId:i}):l.updateAuthOrgTeam({name:g.trim(),teamId:S(o?.id)})),h(),d()})},"h"),e[2]=l,e[3]=r,e[4]=g,e[5]=d,e[6]=h,e[7]=i,e[8]=b,e[9]=o?.id,e[10]=f):f=e[10];let y=f,k;e[11]!==g?(k=g.trim(),e[11]=g,e[12]=k):k=e[12];let v=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let z;e[19]!==n?(z=n("name"),e[19]=n,e[20]=z):z=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(A=>{p(A.target.value)},"x"),e[21]=x):x=e[21];let w;e[22]!==g?(w=(0,a.jsx)(Z,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:g}),e[22]=g,e[23]=w):w=e[23];let N;e[24]!==z||e[25]!==w?(N=(0,a.jsx)(X,{htmlFor:"org-team-form-name",label:z,children:w}),e[24]=z,e[25]=w,e[26]=N):N=e[26];let O;return e[27]!==s||e[28]!==m||e[29]!==d||e[30]!==y||e[31]!==N||e[32]!==v||e[33]!==I||e[34]!==C?(O=(0,a.jsx)(de,{busy:s,canSubmit:v,error:m,onClose:d,onSubmit:y,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=s,e[28]=m,e[29]=d,e[30]=y,e[31]=N,e[32]=v,e[33]=I,e[34]=C,e[35]=O):O=e[35],O},"bt"),Bt=c(t=>{let e=(0,U.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=re(),o=q(),{busy:l,error:n,run:s}=ne(),[m,b]=(0,j.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==s||e[4]!==h||e[5]!==m?(u=c(()=>{s(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:m.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=s,e[4]=h,e[5]=m,e[6]=u):u=e[6];let g=u,p;e[7]!==m?(p=m.trim(),e[7]=m,e[8]=p):p=e[8];let f=p!=="",y;e[9]!==o?(y=o("Add member"),e[9]=o,e[10]=y):y=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let v;e[13]!==o?(v=o("User id"),e[13]=o,e[14]=v):v=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(w=>{b(w.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==m?(C=(0,a.jsx)(Z,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:m}),e[16]=m,e[17]=C):C=e[17];let z;e[18]!==v||e[19]!==C?(z=(0,a.jsx)(X,{htmlFor:"org-team-add-member-user",label:v,children:C}),e[18]=v,e[19]=C,e[20]=z):z=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==g||e[25]!==f||e[26]!==y||e[27]!==k||e[28]!==z?(x=(0,a.jsx)(de,{busy:l,canSubmit:f,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-team-add-member",title:k,children:z}),e[21]=l,e[22]=n,e[23]=r,e[24]=g,e[25]=f,e[26]=y,e[27]=k,e[28]=z,e[29]=x):x=e[29],x},"jt"),_t=c(t=>{let e=(0,U.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=re(),n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==o?(u=o?S(o.role):"",e[0]=o,e[1]=u):u=e[1];let[g,p]=(0,j.useState)(u),f;e[2]!==r||e[3]!==o?.permission?(f=r==="edit"?Tt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=f):f=e[4];let[y,k]=(0,j.useState)(f),v;e[5]!==l||e[6]!==r||e[7]!==g||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==y||e[12]!==o?.id||e[13]!==b?(v=c(()=>{b(async()=>{let M=Et(y);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:M,role:g.trim()}):l.updateAuthOrgRole({permission:M,roleId:S(o?.id)})),h(),d()})},"p"),e[5]=l,e[6]=r,e[7]=g,e[8]=d,e[9]=h,e[10]=i,e[11]=y,e[12]=o?.id,e[13]=b,e[14]=v):v=e[14];let I=v,C;e[15]!==r||e[16]!==g||e[17]!==y?(C=y.trim()!==""&&(r==="edit"||g.trim()!==""),e[15]=r,e[16]=g,e[17]=y,e[18]=C):C=e[18];let z;e[19]!==r||e[20]!==n?(z=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=z):z=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let w;e[25]!==r||e[26]!==g||e[27]!==n?(w=r==="create"&&(0,a.jsx)(X,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(Z,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c(M=>{p(M.target.value)},"onChange"),value:g})}),e[25]=r,e[26]=g,e[27]=n,e[28]=w):w=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=c(M=>{k(M.target.value)},"_"),e[31]=O):O=e[31];let A;e[32]!==y?(A=(0,a.jsx)(yt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:O,value:y}),e[32]=y,e[33]=A):A=e[33];let D;e[34]!==A||e[35]!==N?(D=(0,a.jsx)(X,{htmlFor:"org-role-form-permission",label:N,children:A}),e[34]=A,e[35]=N,e[36]=D):D=e[36];let T;return e[37]!==s||e[38]!==m||e[39]!==d||e[40]!==I||e[41]!==D||e[42]!==C||e[43]!==z||e[44]!==x||e[45]!==w?(T=(0,a.jsxs)(de,{busy:s,canSubmit:C,error:m,onClose:d,onSubmit:I,submitLabel:z,testId:"org-role-form",title:x,children:[w,D]}),e[37]=s,e[38]=m,e[39]=d,e[40]=I,e[41]=D,e[42]=C,e[43]=z,e[44]=x,e[45]=w,e[46]=T):T=e[46],T},"pt"),Mt=c(t=>{let e=(0,U.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=q(),{busy:s,error:m,run:b}=ne(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==b?(u=c(()=>{b(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=b,e[4]=u):u=e[4];let g=u,p;e[5]!==n?(p=n("Delete"),e[5]=n,e[6]=p):p=e[6];let f;e[7]!==d?(f=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let y;return e[9]!==s||e[10]!==m||e[11]!==h||e[12]!==g||e[13]!==p||e[14]!==f||e[15]!==o||e[16]!==l?(y=(0,a.jsx)(de,{busy:s,canSubmit:!0,destructive:!0,error:m,onClose:h,onSubmit:g,submitLabel:p,testId:o,title:l,children:f}),e[9]=s,e[10]=m,e[11]=h,e[12]=g,e[13]=p,e[14]=f,e[15]=o,e[16]=l,e[17]=y):y=e[17],y},"zt"),Ge=c(t=>{let e=(0,U.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let s;e[7]!==d?(s=(0,a.jsx)(bt,{className:"px-0",children:d}),e[7]=d,e[8]=s):s=e[8];let m;return e[9]!==n||e[10]!==s||e[11]!==i?(m=(0,a.jsxs)(ht,{className:"overflow-hidden py-0","data-testid":i,children:[n,s]}),e[9]=n,e[10]=s,e[11]=i,e[12]=m):m=e[12],m},"Ve"),He=c(t=>{let e=(0,U.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=q(),l;e[0]!==r?(l=r.map(Jt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==n?(s=(0,a.jsx)(se,{"aria-label":n}),e[4]=n,e[5]=s):s=e[5];let m;e[6]!==l||e[7]!==s?(m=(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[l,s]})}),e[6]=l,e[7]=s,e[8]=m):m=e[8];let b;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let p;e[14]!==r||e[15]!==d||e[16]!==h?(p=c((f,y)=>{let k=S(f.id),v=k===""?`index-${y.toString()}`:k;return(0,a.jsxs)(Ze,{"data-testid":`${h}-${v}`,children:[r.map(I=>(0,a.jsx)(me,{className:I.className,children:I.render(f)},I.head)),(0,a.jsx)(me,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(f)})})]},v)},"b"),e[14]=r,e[15]=d,e[16]=h,e[17]=p):p=e[17],b=i.map(p),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=b}else b=e[13];let u;e[18]!==b?(u=(0,a.jsx)(vt,{children:b}),e[18]=b,e[19]=u):u=e[19];let g;return e[20]!==m||e[21]!==u?(g=(0,a.jsxs)(ft,{children:[m,u]}),e[20]=m,e[21]=u,e[22]=g):g=e[22],g},"We");function Jt(t){return(0,a.jsx)(se,{children:t.head},t.head)}c(Jt,"Lt");var Ut=c(t=>{let e=(0,U.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let s;e[2]!==l?(s=l("Add member"),e[2]=l,e[3]=s):s=e[3];let m;e[4]!==n||e[5]!==s?(m=(0,a.jsx)(L,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:s}),e[4]=n,e[5]=s,e[6]=m):m=e[6];let b;e[7]!==o?(b=c(()=>{o({kind:"invite-member"})},"g"),e[7]=o,e[8]=b):b=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let g;e[11]!==b||e[12]!==u?(g=(0,a.jsx)(L,{"data-testid":"org-open-invite-member",onClick:b,size:"xs",type:"button",variant:"outline",children:u}),e[11]=b,e[12]=u,e[13]=g):g=e[13];let p;e[14]!==m||e[15]!==g?(p=(0,a.jsxs)(a.Fragment,{children:[m,g]}),e[14]=m,e[15]=g,e[16]=p):p=e[16];let f;e[17]!==l?(f=l("Members"),e[17]=l,e[18]=f):f=e[18];let y;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(y=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(v=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-member-role-${S(v.id)}`,onClick:c(()=>{o({kind:"member-role",member:v})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(L,{"data-testid":`org-remove-member-${S(v.id)}`,disabled:r,onClick:c(()=>{d(S(v.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=y):y=e[25];let k;return e[26]!==p||e[27]!==f||e[28]!==y?(k=(0,a.jsx)(Ge,{action:p,heading:f,testId:"org-members",children:y}),e[26]=p,e[27]=f,e[28]=y,e[29]=k):k=e[29],k},"Pt"),qt=c(t=>{let e=(0,U.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=q(),s;e[0]!==d?(s=c(()=>{d({kind:"team-create"})},"a"),e[0]=d,e[1]=s):s=e[1];let m;e[2]!==n?(m=n("New team"),e[2]=n,e[3]=m):m=e[3];let b;e[4]!==s||e[5]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-create-team",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[4]=s,e[5]=m,e[6]=b):b=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let g;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"aria-pressed":i===S(f.id),"data-testid":`org-team-select-${S(f.id)}`,onClick:c(()=>{h(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(L,{"data-testid":`org-team-rename-${S(f.id)}`,onClick:c(()=>{d({kind:"team-rename",team:f})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(L,{"data-testid":`org-team-delete-${S(f.id)}`,onClick:c(()=>{r(f)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=g):g=e[16];let p;return e[17]!==b||e[18]!==u||e[19]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-teams",children:g}),e[17]=b,e[18]=u,e[19]=g,e[20]=p):p=e[20],p},"Bt"),Kt=c(t=>{let e=(0,U.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=q(),s;e[0]!==h||e[1]!==i?(s=c(()=>{h({kind:"team-add-member",teamId:i})},"a"),e[0]=h,e[1]=i,e[2]=s):s=e[2];let m;e[3]!==n?(m=n("Add member"),e[3]=n,e[4]=m):m=e[4];let b;e[5]!==s||e[6]!==m?(b=(0,a.jsx)(L,{"data-testid":"org-open-add-team-member",onClick:s,size:"xs",type:"button",variant:"outline",children:m}),e[5]=s,e[6]=m,e[7]=b):b=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let g;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(g=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(He,{columns:o,rowActions:c(f=>(0,a.jsx)(L,{"data-testid":`org-team-remove-member-${S(f.id)}`,disabled:r,onClick:c(()=>{d(S(f.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=g):g=e[15];let p;return e[16]!==b||e[17]!==u||e[18]!==g?(p=(0,a.jsx)(Ge,{action:b,heading:u,testId:"org-team-members",children:g}),e[16]=b,e[17]=u,e[18]=g,e[19]=p):p=e[19],p},"Qt"),Qt=c(t=>{let e=(0,U.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"o"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==l||e[5]!==n?(s=(0,a.jsx)(L,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=s):s=e[6];let m;e[7]!==o?(m=o("Roles"),e[7]=o,e[8]=m):m=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(b=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ce,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(He,{columns:h,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{"data-testid":`org-role-edit-${S(g.id)}`,onClick:c(()=>{d({kind:"role-edit",role:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(L,{"data-testid":`org-role-delete-${S(g.id)}`,onClick:c(()=>{r(S(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=b):b=e[14];let u;return e[15]!==s||e[16]!==m||e[17]!==b?(u=(0,a.jsx)(Ge,{action:s,heading:m,testId:"org-roles",children:b}),e[15]=s,e[16]=m,e[17]=b,e[18]=u):u=e[18],u},"Jt"),Xt=c(t=>{let e=(0,U.c)(199),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=re(),o=q(),[l,n]=(0,j.useState)(null),[s,m]=(0,j.useState)(null),[b,u]=(0,j.useState)(!1),[g,p]=(0,j.useState)(null),f;e[0]!==r?(f=["lunora-auth-org-members",r],e[0]=r,e[1]=f):f=e[1];let y;e[2]!==i||e[3]!==r?(y=c(()=>i.listAuthOrgMembers({limit:200,organizationId:r}),"v"),e[2]=i,e[3]=r,e[4]=y):y=e[4];let k=ue(f,y),v;e[5]!==r?(v=["lunora-auth-org-invitations",r],e[5]=r,e[6]=v):v=e[6];let I;e[7]!==i||e[8]!==r?(I=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"C"),e[7]=i,e[8]=r,e[9]=I):I=e[9];let C=ue(v,I),z;e[10]!==r?(z=["lunora-auth-org-teams",r],e[10]=r,e[11]=z):z=e[11];let x;e[12]!==i||e[13]!==r?(x=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"x"),e[12]=i,e[13]=r,e[14]=x):x=e[14];let w;e[15]!==h?(w={enabled:h},e[15]=h,e[16]=w):w=e[16];let N=ue(z,x,w),O;e[17]!==r?(O=["lunora-auth-org-roles",r],e[17]=r,e[18]=O):O=e[18];let A;e[19]!==i||e[20]!==r?(A=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"N"),e[19]=i,e[20]=r,e[21]=A):A=e[21];let D;e[22]!==d?(D={enabled:d},e[22]=d,e[23]=D):D=e[23];let T=ue(O,A,D),M;e[24]!==s?(M=["lunora-auth-org-team-members",s],e[24]=s,e[25]=M):M=e[25];let P;e[26]!==i||e[27]!==s?(P=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:s??""}),"P"),e[26]=i,e[27]=s,e[28]=P):P=e[28];let Q=s!==null,B;e[29]!==Q?(B={enabled:Q},e[29]=Q,e[30]=B):B=e[30];let E=ue(M,P,B),J;e[31]!==k.data?.rows?(J=k.data?.rows??[],e[31]=k.data?.rows,e[32]=J):J=e[32];let Y=J,R;e[33]!==C.data?.rows?(R=C.data?.rows??[],e[33]=C.data?.rows,e[34]=R):R=e[34];let $=R,K;e[35]!==N.data?.rows?(K=N.data?.rows??[],e[35]=N.data?.rows,e[36]=K):K=e[36];let ie=K,H;e[37]!==T.data?.rows?(H=T.data?.rows??[],e[37]=T.data?.rows,e[38]=H):H=e[38];let ee=H,W;e[39]!==s||e[40]!==E?(W=s===null?[]:E.data?.rows??[],e[39]=s,e[40]=E,e[41]=W):W=e[41];let te=W,oe=k.error??C.error??N.error??T.error??E.error,V;e[42]!==C||e[43]!==k||e[44]!==d||e[45]!==T||e[46]!==s||e[47]!==E||e[48]!==h||e[49]!==N?(V=c(()=>{k.refetch(),C.refetch(),h&&N.refetch(),d&&T.refetch(),s!==null&&E.refetch()},"Z"),e[42]=C,e[43]=k,e[44]=d,e[45]=T,e[46]=s,e[47]=E,e[48]=h,e[49]=N,e[50]=V):V=e[50];let _=V;Ct(_,!0);let ae;e[51]===Symbol.for("react.memo_cache_sentinel")?(ae=c(()=>{n(null)},"ie"),e[51]=ae):ae=e[51];let F=ae,We;e[52]!==_?(We=c(G=>{wt((async()=>{u(!0),p(null);try{await G(),_(),u(!1)}catch(nt){p(xt(nt)),u(!1)}})())},"Xe"),e[52]=_,e[53]=We):We=e[53];let le=We,Ve;e[54]!==i||e[55]!==o?(Ve=c(G=>{let nt=S(G.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:nt}),m(It=>It===nt?null:It)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"Ye"),e[54]=i,e[55]=o,e[56]=Ve):Ve=e[56];let it=Ve,ge;e[57]!==o?(ge=o("userId"),e[57]=o,e[58]=ge):ge=e[58];let he;e[59]!==ge?(he={head:ge,render:Yt},e[59]=ge,e[60]=he):he=e[60];let be;e[61]!==o?(be=o("role"),e[61]=o,e[62]=be):be=e[62];let fe;e[63]!==be?(fe={head:be,render:Zt},e[63]=be,e[64]=fe):fe=e[64];let et;e[65]!==he||e[66]!==fe?(et=[he,fe],e[65]=he,e[66]=fe,e[67]=et):et=e[67];let st=et,pe;e[68]!==o?(pe=o("email"),e[68]=o,e[69]=pe):pe=e[69];let ve;e[70]!==pe?(ve={head:pe,render:Gt},e[70]=pe,e[71]=ve):ve=e[71];let ye;e[72]!==o?(ye=o("role"),e[72]=o,e[73]=ye):ye=e[73];let Ce;e[74]!==ye?(Ce={head:ye,render:Ht},e[74]=ye,e[75]=Ce):Ce=e[75];let Ie;e[76]!==o?(Ie=o("status"),e[76]=o,e[77]=Ie):Ie=e[77];let xe;e[78]!==Ie?(xe={head:Ie,render:Wt},e[78]=Ie,e[79]=xe):xe=e[79];let tt;e[80]!==ve||e[81]!==Ce||e[82]!==xe?(tt=[ve,Ce,xe],e[80]=ve,e[81]=Ce,e[82]=xe,e[83]=tt):tt=e[83];let mt=tt,we;e[84]!==o?(we=o("id"),e[84]=o,e[85]=we):we=e[85];let ke;e[86]!==we?(ke={className:"font-mono text-xs",head:we,render:Vt},e[86]=we,e[87]=ke):ke=e[87];let ze;e[88]!==o?(ze=o("name"),e[88]=o,e[89]=ze):ze=e[89];let Ne;e[90]!==ze?(Ne={head:ze,render:er},e[90]=ze,e[91]=Ne):Ne=e[91];let rt;e[92]!==ke||e[93]!==Ne?(rt=[ke,Ne],e[92]=ke,e[93]=Ne,e[94]=rt):rt=e[94];let dt=rt,Se;e[95]!==o?(Se=o("userId"),e[95]=o,e[96]=Se):Se=e[96];let ot;e[97]!==Se?(ot=[{head:Se,render:tr}],e[97]=Se,e[98]=ot):ot=e[98];let ct=ot,De;e[99]!==o?(De=o("role"),e[99]=o,e[100]=De):De=e[100];let Ae;e[101]!==De?(Ae={head:De,render:rr},e[101]=De,e[102]=Ae):Ae=e[102];let _e;e[103]!==o?(_e=o("Permission"),e[103]=o,e[104]=_e):_e=e[104];let Oe;e[105]!==_e?(Oe={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:or},e[105]=_e,e[106]=Oe):Oe=e[106];let at;e[107]!==Ae||e[108]!==Oe?(at=[Ae,Oe],e[107]=Ae,e[108]=Oe,e[109]=at):at=e[109];let ut=at,Te;e[110]!==oe?(Te=oe!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe}),e[110]=oe,e[111]=Te):Te=e[111];let Me;e[112]!==g?(Me=g!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g}),e[112]=g,e[113]=Me):Me=e[113];let Re;e[114]!==i||e[115]!==le?(Re=c(G=>{le(()=>i.removeAuthOrgMember({memberId:G}))},"Te"),e[114]=i,e[115]=le,e[116]=Re):Re=e[116];let $e;e[117]!==b||e[118]!==st||e[119]!==Y||e[120]!==Re?($e=(0,a.jsx)(Ut,{actionBusy:b,memberColumns:st,members:Y,onDialog:n,onRemoveMember:Re}),e[117]=b,e[118]=st,e[119]=Y,e[120]=Re,e[121]=$e):$e=e[121];let Fe;e[122]!==b||e[123]!==i||e[124]!==mt||e[125]!==$||e[126]!==le||e[127]!==o?(Fe=$.length>0&&(0,a.jsx)(Ge,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(He,{columns:mt,rowActions:c(G=>(0,a.jsx)(L,{"data-testid":`org-cancel-invitation-${S(G.id)}`,disabled:b,onClick:c(()=>{le(()=>i.cancelAuthOrgInvitation({invitationId:S(G.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:$})}),e[122]=b,e[123]=i,e[124]=mt,e[125]=$,e[126]=le,e[127]=o,e[128]=Fe):Fe=e[128];let Ee;e[129]!==it||e[130]!==s||e[131]!==dt||e[132]!==ie||e[133]!==h?(Ee=h&&(0,a.jsx)(qt,{onConfirmDeleteTeam:it,onDialog:n,onSelectTeam:m,selectedTeam:s,teamColumns:dt,teams:ie}),e[129]=it,e[130]=s,e[131]=dt,e[132]=ie,e[133]=h,e[134]=Ee):Ee=e[134];let Le;e[135]!==b||e[136]!==i||e[137]!==le||e[138]!==s||e[139]!==ct||e[140]!==te||e[141]!==h?(Le=h&&s!==null&&(0,a.jsx)(Kt,{actionBusy:b,onDialog:n,onRemoveTeamMember:c(G=>{le(()=>i.removeAuthOrgTeamMember({teamMemberId:G}))},"onRemoveTeamMember"),selectedTeam:s,teamMemberColumns:ct,teamMembers:te}),e[135]=b,e[136]=i,e[137]=le,e[138]=s,e[139]=ct,e[140]=te,e[141]=h,e[142]=Le):Le=e[142];let je;e[143]!==i||e[144]!==ut||e[145]!==ee||e[146]!==d||e[147]!==o?(je=d&&(0,a.jsx)(Qt,{onConfirmDeleteRole:c(G=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:G}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:ut,roles:ee}),e[143]=i,e[144]=ut,e[145]=ee,e[146]=d,e[147]=o,e[148]=je):je=e[148];let Pe;e[149]!==l?.kind||e[150]!==r||e[151]!==_?(Pe=l?.kind==="add-member"&&(0,a.jsx)(Lt,{onClose:F,onDone:_,organizationId:r}),e[149]=l?.kind,e[150]=r,e[151]=_,e[152]=Pe):Pe=e[152];let Be;e[153]!==l?.kind||e[154]!==r||e[155]!==_?(Be=l?.kind==="invite-member"&&(0,a.jsx)(jt,{onClose:F,onDone:_,organizationId:r}),e[153]=l?.kind,e[154]=r,e[155]=_,e[156]=Be):Be=e[156];let Je;e[157]!==l||e[158]!==_?(Je=l?.kind==="member-role"&&(0,a.jsx)(Pt,{member:l.member,onClose:F,onDone:_}),e[157]=l,e[158]=_,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==_?(Ue=l?.kind==="team-create"&&(0,a.jsx)(At,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=_,e[163]=Ue):Ue=e[163];let qe;e[164]!==l||e[165]!==r||e[166]!==_?(qe=l?.kind==="team-rename"&&(0,a.jsx)(At,{mode:"edit",onClose:F,onDone:_,organizationId:r,team:l.team}),e[164]=l,e[165]=r,e[166]=_,e[167]=qe):qe=e[167];let Ke;e[168]!==l||e[169]!==_?(Ke=l?.kind==="team-add-member"&&(0,a.jsx)(Bt,{onClose:F,onDone:_,teamId:l.teamId}),e[168]=l,e[169]=_,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l?.kind||e[172]!==r||e[173]!==_?(Qe=l?.kind==="role-create"&&(0,a.jsx)(_t,{mode:"create",onClose:F,onDone:_,organizationId:r}),e[171]=l?.kind,e[172]=r,e[173]=_,e[174]=Qe):Qe=e[174];let Xe;e[175]!==l||e[176]!==r||e[177]!==_?(Xe=l?.kind==="role-edit"&&(0,a.jsx)(_t,{mode:"edit",onClose:F,onDone:_,organizationId:r,role:l.role}),e[175]=l,e[176]=r,e[177]=_,e[178]=Xe):Xe=e[178];let Ye;e[179]!==l||e[180]!==_?(Ye=l?.kind==="confirm"&&(0,a.jsx)(Mt,{action:l.action,message:l.message,onClose:F,onDone:_,testId:l.testId,title:l.title}),e[179]=l,e[180]=_,e[181]=Ye):Ye=e[181];let lt;return e[182]!==Te||e[183]!==Me||e[184]!==$e||e[185]!==Fe||e[186]!==Ee||e[187]!==Le||e[188]!==je||e[189]!==Pe||e[190]!==Be||e[191]!==Je||e[192]!==Ue||e[193]!==qe||e[194]!==Ke||e[195]!==Qe||e[196]!==Xe||e[197]!==Ye?(lt=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Te,Me,$e,Fe,Ee,Le,je,Pe,Be,Je,Ue,qe,Ke,Qe,Xe,Ye]}),e[182]=Te,e[183]=Me,e[184]=$e,e[185]=Fe,e[186]=Ee,e[187]=Le,e[188]=je,e[189]=Pe,e[190]=Be,e[191]=Je,e[192]=Ue,e[193]=qe,e[194]=Ke,e[195]=Qe,e[196]=Xe,e[197]=Ye,e[198]=lt):lt=e[198],lt},"Ut");function Yt(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(Yt,"Ht");function Zt(t){return S(t.role)}c(Zt,"qt");function Gt(t){return S(t.email)}c(Gt,"Gt");function Ht(t){return S(t.role)}c(Ht,"Kt");function Wt(t){return S(t.status)}c(Wt,"Vt");function Vt(t){return S(t.id)}c(Vt,"Wt");function er(t){return S(t.name)}c(er,"Xt");function tr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:S(t.userId)})}c(tr,"Yt");function rr(t){return S(t.role)}c(rr,"Zt");function or(t){return S(t.permission)}c(or,"el");var yr=c(()=>{let t=(0,U.c)(62),e=re(),r=q(),{config:d,ready:h}=Nt(),i=d.capabilities.organization,[o,l]=(0,j.useState)(null),[n,s]=(0,j.useState)(null),m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=["lunora-auth-orgs"],t[0]=m):m=t[0];let b;t[1]!==e?(b=c(()=>e.listAuthOrganizations({limit:100}),"g"),t[1]=e,t[2]=b):b=t[2];let u;t[3]!==i?(u={enabled:i},t[3]=i,t[4]=u):u=t[4];let g=ue(m,b,u),p=g.data?.rows??null,f;t[5]!==g?(f=c(()=>{g.refetch()},"h"),t[5]=g,t[6]=f):f=t[6],Ct(f,i);let y;t[7]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{s(null)},"v"),t[7]=y):y=t[7];let k=y,v;t[8]!==g?(v=c(()=>{g.refetch()},"p"),t[8]=g,t[9]=v):v=t[9];let I=v,C;t[10]===Symbol.for("react.memo_cache_sentinel")?(C=c(R=>{l(R)},"y"),t[10]=C):C=t[10];let z=C;if(h&&!i){let R;t[11]!==r?(R=r("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=r,t[12]=R):R=t[12];let $;t[13]!==r?($=r("Organizations are not enabled."),t[13]=r,t[14]=$):$=t[14];let K;return t[15]!==R||t[16]!==$?(K=(0,a.jsx)(ce,{description:R,testId:"org-disabled",title:$}),t[15]=R,t[16]=$,t[17]=K):K=t[17],K}let x;t[18]!==r?(x=r("Organizations"),t[18]=r,t[19]=x):x=t[19];let w;t[20]!==x?(w=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),t[20]=x,t[21]=w):w=t[21];let N;t[22]===Symbol.for("react.memo_cache_sentinel")?(N=c(()=>{s({kind:"create"})},"D"),t[22]=N):N=t[22];let O;t[23]!==r?(O=r("New organization"),t[23]=r,t[24]=O):O=t[24];let A;t[25]!==O?(A=(0,a.jsx)(L,{"data-testid":"org-new",onClick:N,size:"sm",type:"button",children:O}),t[25]=O,t[26]=A):A=t[26];let D;t[27]!==A||t[28]!==w?(D=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[w,A]}),t[27]=A,t[28]=w,t[29]=D):D=t[29];let T;t[30]!==g.error?(T=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[30]=g.error,t[31]=T):T=t[31];let M;t[32]!==p||t[33]!==r?(M=p!==null&&p.length===0&&(0,a.jsx)(ce,{testId:"org-empty",title:r("No organizations.")}),t[32]=p,t[33]=r,t[34]=M):M=t[34];let P;t[35]!==p||t[36]!==o||t[37]!==r?(P=p!==null&&p.length>0&&(0,a.jsx)(ht,{className:"overflow-hidden py-0",children:(0,a.jsx)(bt,{className:"px-0",children:(0,a.jsxs)(ft,{"data-testid":"org-table",children:[(0,a.jsx)(pt,{children:(0,a.jsxs)(Ze,{children:[(0,a.jsx)(se,{children:r("id")}),(0,a.jsx)(se,{children:r("name")}),(0,a.jsx)(se,{children:r("slug")}),(0,a.jsx)(se,{children:r("created")}),(0,a.jsx)(se,{"aria-label":r("Actions")})]})}),(0,a.jsx)(vt,{children:p.map(R=>{let $=S(R.id);return(0,a.jsxs)(Ze,{"data-testid":`org-row-${$}`,children:[(0,a.jsx)(me,{className:"font-mono text-xs",children:$}),(0,a.jsx)(me,{children:S(R.name)}),(0,a.jsx)(me,{children:S(R.slug)}),(0,a.jsx)(me,{className:"text-muted-foreground tabular-nums",children:kt(R.createdAt)}),(0,a.jsx)(me,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:c(()=>{z($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(L,{"data-testid":`org-edit-${$}`,onClick:c(()=>{s({kind:"edit",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(L,{"data-testid":`org-delete-${$}`,onClick:c(()=>{s({kind:"delete",org:R})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},$)})})]})})}),t[35]=p,t[36]=o,t[37]=r,t[38]=P):P=t[38];let Q;t[39]!==d.organization||t[40]!==o?(Q=o!==null&&(0,a.jsx)(Xt,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[39]=d.organization,t[40]=o,t[41]=Q):Q=t[41];let B;t[42]!==n?.kind||t[43]!==I?(B=n?.kind==="create"&&(0,a.jsx)(Dt,{mode:"create",onClose:k,onDone:I}),t[42]=n?.kind,t[43]=I,t[44]=B):B=t[44];let E;t[45]!==n||t[46]!==I?(E=n?.kind==="edit"&&(0,a.jsx)(Dt,{mode:"edit",onClose:k,onDone:I,org:n.org}),t[45]=n,t[46]=I,t[47]=E):E=t[47];let J;t[48]!==e||t[49]!==n||t[50]!==I||t[51]!==r?(J=n?.kind==="delete"&&(0,a.jsx)(Mt,{action:c(async()=>{let R=S(n.org.id);await e.deleteAuthOrganization({organizationId:R}),l($=>$===R?null:$)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:k,onDone:I,testId:"org-delete",title:r("Delete organization")}),t[48]=e,t[49]=n,t[50]=I,t[51]=r,t[52]=J):J=t[52];let Y;return t[53]!==D||t[54]!==T||t[55]!==M||t[56]!==P||t[57]!==Q||t[58]!==B||t[59]!==E||t[60]!==J?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[D,T,M,P,Q,B,E,J]}),t[53]=D,t[54]=T,t[55]=M,t[56]=P,t[57]=Q,t[58]=B,t[59]=E,t[60]=J,t[61]=Y):Y=t[61],Y},"yl");export{yr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"./chunk-EA2JKR5D.js";import{a as C}from"./chunk-IMOHEGMV.js";import{b as v}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as k}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-EA2JKR5D.js";import{a as C}from"./chunk-IMOHEGMV.js";import{b as v}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as k}from"./chunk-EESOT5SI.js";import"./chunk-ULIQFBZU.js";import"./chunk-MQ42VLOS.js";import"./chunk-35DM4JJG.js";import{a as S}from"./chunk-4ZEL6BYL.js";import{c as b}from"./chunk-6XDE6XBT.js";import"./chunk-4U4NQF6Z.js";import"./chunk-FSRSK4LY.js";import"./chunk-RZNN2EJU.js";import{a as c}from"./chunk-FKVZRPV5.js";import{a as w,b as T,c as A,d as f,e as s,f as l}from"./chunk-HEAQVSNS.js";import{a as y,e as N}from"./chunk-WUWBZPUK.js";import{d as p}from"./chunk-FODLDLE2.js";import{a as n,d as x,e as R,g as V}from"./chunk-YKXDMIHQ.js";var F=x(R(),1);var e=x(V(),1);var $=n(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"H"),q='{ "targetingKey": "user-123", "plan": "premium" }',D=n(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"R"),Y=n(({initialShardKey:a=""})=>{let t=p(),[o,j]=(0,F.useState)(""),{context:g,error:m}=$(o),I=g===void 0?{}:{context:g},{data:i,error:J,errorSource:K,liveError:E}=b(S.listFlags,I,{live:!0,shardKey:a}),u=i!==void 0,L=i?.configured??!1,h=Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],d;return u&&!L?d=(0,e.jsx)(c,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")}):u&&h.length===0?d=(0,e.jsx)(c,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")}):d=(0,e.jsx)(y,{className:"overflow-hidden py-0",children:(0,e.jsx)(N,{className:"px-0",children:(0,e.jsxs)(w,{"data-testid":"flags-table",children:[(0,e.jsx)(T,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(s,{children:t("Key")}),(0,e.jsx)(s,{children:t("Type")}),(0,e.jsx)(s,{children:t("Value")}),(0,e.jsx)(s,{children:t("Reason")}),(0,e.jsx)(s,{children:t("Variant")})]})}),(0,e.jsx)(A,{children:h.map(r=>(0,e.jsxs)(f,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsx)(l,{className:"font-mono text-xs",children:r.key}),(0,e.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type}),(0,e.jsx)(l,{className:"font-mono text-xs",children:D(r)}),(0,e.jsx)(l,{children:r.errorCode===void 0?(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"}):(0,e.jsx)(v,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode})}),(0,e.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"})]},r.key))})]})})}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsx)(k,{error:K,testId:"flags-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')}),(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,e.jsx)(C,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")}),(0,e.jsx)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:n(r=>{j(r.target.value)},"onChange"),placeholder:q,rows:3,value:o}),m!==null&&(0,e.jsx)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(m)}),E!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")})]}),d]})},"W");export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"./chunk-66UGPQVC.js";import{a as H}from"./chunk-SU737V7V.js";import{a as ee}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as Z}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as E}from"./chunk-6BI6AL3F.js";import{f as R}from"./chunk-ET6VU4YM.js";import"./chunk-FSRSK4LY.js";import"./chunk-FMRAZ6MD.js";import{a as _}from"./chunk-FKVZRPV5.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-HEAQVSNS.js";import{a as A,e as T}from"./chunk-WUWBZPUK.js";import{d as M,h as G,o as W,r as X}from"./chunk-FODLDLE2.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-YKXDMIHQ.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1);var Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"F"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=R(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let v=await(d??(()=>f.listScheduledJobs()))();return le(v)}),[x,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(v=>{m(void 0),n(le(v))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let g;e[5]!==N?(g=c(()=>{N.refetch()},"y"),e[5]=N,e[6]=g):g=e[6],O(g,!l);let J=ce(f,i,d),b=x??N.data,j=s??N.error,I=c(async v=>{if(J!==void 0){m(void 0);try{await J(v),l||N.refetch()}catch(D){m(G(D))}}},"A"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",S;e[7]!==j?(S=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=S):S=e[8];let L;e[9]!==b?.length||e[10]!==r?(L=b?.length===0&&(0,h.jsx)(_,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=L):L=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(v=>(0,h.jsxs)(F,{"data-testid":`sj-row-${v.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:v.workflow??v.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(v.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:v.attempts??0}),(0,h.jsx)(p,{children:v.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.id}),J!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{W(I(v.id))},"onConfirm"),testId:`sj-cancel-${v.id}`,children:r("Cancel")})})]},v.id))})]})})}),w;return e[12]!==$||e[13]!==S||e[14]!==L?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[S,L,$]}),e[12]=$,e[13]=S,e[14]=L,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=R(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,x=me(i,a,e),n=c(async s=>{if(x!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await x(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(_,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),x!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),x!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=R(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let x;e[3]!==l||e[4]!==d?(x=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=x):x=e[5];let n=E(N,x),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,g=d===void 0,J;e[6]!==l||e[7]!==g||e[8]!==r?(J=r??(g?C=>l.retryDeadJob(C):void 0),e[6]=l,e[7]=g,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==g||e[12]!==f?(j=f??(g?C=>l.removeDeadJob(C):void 0),e[10]=l,e[11]=g,e[12]=f,e[13]=j):j=e[13];let I=j,q;e[14]!==n?(q=c(()=>{n.refetch()},"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async C=>{y(void 0);try{await C,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let S=B,L=b!==void 0||I!==void 0,$;e[18]!==k?($=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=$):$=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(_,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let v;e[23]!==S||e[24]!==L||e[25]!==s||e[26]!==I||e[27]!==b||e[28]!==o?(v=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),L&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(C=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${C.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:C.workflow??C.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:C.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(C.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.pool??""}),(0,t.jsx)(p,{children:C.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.id}),L&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${C.id}`,onClick:c(()=>{W(S(b(C.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),I!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{W(S(I(C.id)))},"onConfirm"),testId:`dlq-remove-${C.id}`,children:o("Drop")})]})})]},C.id))})]})})}),e[23]=S,e[24]=L,e[25]=s,e[26]=I,e[27]=b,e[28]=o,e[29]=v):v=e[29];let D;return e[30]!==v||e[31]!==$||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,w,v]}),e[30]=v,e[31]=$,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=R(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let x=E(o,N),{data:n,error:s}=x,m;e[7]!==x?(m=c(()=>{x.refetch()},"d"),e[7]=x,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let g;e[14]!==n?.pools.length||e[15]!==r?(g=n?.pools.length===0&&(0,t.jsx)(_,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=g):g=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==g||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,g,J]}),e[20]=y,e[21]=k,e[22]=g,e[23]=J,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),x;e[2]!==l?(x=l("Cron triggers"),e[2]=l,e[3]=x):x=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==x||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:x,dead:n,jobs:s,pools:m},e[10]=x,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=g):g=e[15];let J=g,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:J,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let I;e[21]!==b||e[22]!==j?(I=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=I):I=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let S;e[30]!==o?(S=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=S):S=e[31];let L;e[32]!==d||e[33]!==o?(L=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=L):L=e[34];let $;return e[35]!==I||e[36]!==q||e[37]!==B||e[38]!==S||e[39]!==L?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,q,B,S,L]}),e[35]=I,e[36]=q,e[37]=B,e[38]=S,e[39]=L,e[40]=$):$=e[40],$},"Ie");export{Ve as SchedulePanel};
|
|
1
|
+
import{a as O}from"./chunk-66UGPQVC.js";import{a as H}from"./chunk-SU737V7V.js";import{a as ee}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as Z}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as E}from"./chunk-6XDE6XBT.js";import{f as R}from"./chunk-4U4NQF6Z.js";import"./chunk-FSRSK4LY.js";import"./chunk-RZNN2EJU.js";import{a as _}from"./chunk-FKVZRPV5.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-HEAQVSNS.js";import{a as A,e as T}from"./chunk-WUWBZPUK.js";import{d as M,h as G,o as W,r as X}from"./chunk-FODLDLE2.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-YKXDMIHQ.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1);var Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"F"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=R(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let v=await(d??(()=>f.listScheduledJobs()))();return le(v)}),[x,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(v=>{m(void 0),n(le(v))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let g;e[5]!==N?(g=c(()=>{N.refetch()},"y"),e[5]=N,e[6]=g):g=e[6],O(g,!l);let J=ce(f,i,d),b=x??N.data,j=s??N.error,I=c(async v=>{if(J!==void 0){m(void 0);try{await J(v),l||N.refetch()}catch(D){m(G(D))}}},"A"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",S;e[7]!==j?(S=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=S):S=e[8];let L;e[9]!==b?.length||e[10]!==r?(L=b?.length===0&&(0,h.jsx)(_,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=L):L=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(v=>(0,h.jsxs)(F,{"data-testid":`sj-row-${v.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:v.workflow??v.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(v.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:v.attempts??0}),(0,h.jsx)(p,{children:v.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.id}),J!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{W(I(v.id))},"onConfirm"),testId:`sj-cancel-${v.id}`,children:r("Cancel")})})]},v.id))})]})})}),w;return e[12]!==$||e[13]!==S||e[14]!==L?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[S,L,$]}),e[12]=$,e[13]=S,e[14]=L,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=R(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,x=me(i,a,e),n=c(async s=>{if(x!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await x(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(_,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),x!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),x!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=R(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let x;e[3]!==l||e[4]!==d?(x=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=x):x=e[5];let n=E(N,x),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,g=d===void 0,J;e[6]!==l||e[7]!==g||e[8]!==r?(J=r??(g?C=>l.retryDeadJob(C):void 0),e[6]=l,e[7]=g,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==g||e[12]!==f?(j=f??(g?C=>l.removeDeadJob(C):void 0),e[10]=l,e[11]=g,e[12]=f,e[13]=j):j=e[13];let I=j,q;e[14]!==n?(q=c(()=>{n.refetch()},"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async C=>{y(void 0);try{await C,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let S=B,L=b!==void 0||I!==void 0,$;e[18]!==k?($=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=$):$=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(_,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let v;e[23]!==S||e[24]!==L||e[25]!==s||e[26]!==I||e[27]!==b||e[28]!==o?(v=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),L&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(C=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${C.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:C.workflow??C.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:C.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(C.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.pool??""}),(0,t.jsx)(p,{children:C.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.id}),L&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${C.id}`,onClick:c(()=>{W(S(b(C.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),I!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{W(S(I(C.id)))},"onConfirm"),testId:`dlq-remove-${C.id}`,children:o("Drop")})]})})]},C.id))})]})})}),e[23]=S,e[24]=L,e[25]=s,e[26]=I,e[27]=b,e[28]=o,e[29]=v):v=e[29];let D;return e[30]!==v||e[31]!==$||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,w,v]}),e[30]=v,e[31]=$,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=R(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let x=E(o,N),{data:n,error:s}=x,m;e[7]!==x?(m=c(()=>{x.refetch()},"d"),e[7]=x,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let g;e[14]!==n?.pools.length||e[15]!==r?(g=n?.pools.length===0&&(0,t.jsx)(_,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=g):g=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==g||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,g,J]}),e[20]=y,e[21]=k,e[22]=g,e[23]=J,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),x;e[2]!==l?(x=l("Cron triggers"),e[2]=l,e[3]=x):x=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==x||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:x,dead:n,jobs:s,pools:m},e[10]=x,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=g):g=e[15];let J=g,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:J,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let I;e[21]!==b||e[22]!==j?(I=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=I):I=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let S;e[30]!==o?(S=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=S):S=e[31];let L;e[32]!==d||e[33]!==o?(L=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=L):L=e[34];let $;return e[35]!==I||e[36]!==q||e[37]!==B||e[38]!==S||e[39]!==L?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,q,B,S,L]}),e[35]=I,e[36]=q,e[37]=B,e[38]=S,e[39]=L,e[40]=$):$=e[40],$},"Ie");export{Ve as SchedulePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as re}from"./chunk-BOTGXX4H.js";import{a as X}from"./chunk-S3CRZLGS.js";import{a as V}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as R}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as O}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Y}from"./chunk-
|
|
1
|
+
import{a as re}from"./chunk-BOTGXX4H.js";import{a as X}from"./chunk-S3CRZLGS.js";import{a as V}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as R}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as O}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Y}from"./chunk-EESOT5SI.js";import"./chunk-ULIQFBZU.js";import"./chunk-MQ42VLOS.js";import"./chunk-35DM4JJG.js";import{a as Q}from"./chunk-4ZEL6BYL.js";import{c as J}from"./chunk-6XDE6XBT.js";import"./chunk-4U4NQF6Z.js";import"./chunk-FSRSK4LY.js";import"./chunk-RZNN2EJU.js";import{a as G}from"./chunk-FKVZRPV5.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-HEAQVSNS.js";import{a as U,e as W}from"./chunk-WUWBZPUK.js";import{d as z,r as H}from"./chunk-FODLDLE2.js";import{a as l,d as B,e as de,f as me,g as he,i as L}from"./chunk-YKXDMIHQ.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},Ee=l(r=>{let e=(0,se.c)(47),{functions:K,initialShardKey:ne}=r,s=z(),{queryShardKey:_,setShardKey:N,shardKey:v}=X(ne),[i,oe]=(0,le.useState)("recent"),w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];let C;e[1]!==_?(C={live:!0,shardKey:_},e[1]=_,e[2]=C):C=e[2];let{data:ie,error:c,errorSource:S,liveError:b}=J(Q.getFunctionStats,w,C),k=ie?.functions??null,$;e[3]!==K?($=new Map((K??[]).map(ge)),e[3]=K,e[4]=$):$=e[4];let T=$,F;e[5]===Symbol.for("react.memo_cache_sentinel")?(F=l(M=>{oe(M.currentTarget.dataset.sort)},"E"),e[5]=F):F=e[5];let ce=F,I;if(e[6]!==c||e[7]!==S||e[8]!==T||e[9]!==b||e[10]!==N||e[11]!==v||e[12]!==i||e[13]!==k||e[14]!==s){let M=k===null?[]:k.toSorted(xe[i]),d;e[16]!==s?(d=s("Recent"),e[16]=s,e[17]=d):d=e[17];let m;e[18]!==d?(m={key:"recent",label:d},e[18]=d,e[19]=m):m=e[19];let h;e[20]!==s?(h=s("Most called"),e[20]=s,e[21]=h):h=e[21];let u;e[22]!==h?(u={key:"calls",label:h},e[22]=h,e[23]=u):u=e[23];let f;e[24]!==s?(f=s("Slowest"),e[24]=s,e[25]=f):f=e[25];let p;e[26]!==f?(p={key:"slowest",label:f},e[26]=f,e[27]=p):p=e[27];let A;e[28]!==p||e[29]!==m||e[30]!==u?(A=[m,u,p],e[28]=p,e[29]=m,e[30]=u,e[31]=A):A=e[31];let j=A,x;e[32]!==N||e[33]!==v?(x=(0,t.jsx)(V,{onChange:N,testId:"fs-shard-input",value:v}),e[32]=N,e[33]=v,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsx)(re,{message:b,prefix:"fs"}),e[35]=b,e[36]=g):g=e[36];let y;e[37]!==j||e[38]!==i?(y=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(R,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:i===a.key?"secondary":"ghost",children:a.label},a.key))}),e[37]=j,e[38]=i,e[39]=y):y=e[39];let D;e[40]!==x||e[41]!==g||e[42]!==y?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,y]}),e[40]=x,e[41]=g,e[42]=y,e[43]=D):D=e[43];let E;e[44]!==c||e[45]!==S?(E=c!==null&&(0,t.jsx)(Y,{error:S,testId:"fs-error"}),e[44]=c,e[45]=S,e[46]=E):E=e[46],I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,k!==null&&M.length===0&&c===null&&(0,t.jsx)(G,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),M.length>0&&(0,t.jsx)(U,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:M.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(O,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:H(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=c,e[7]=S,e[8]=T,e[9]=b,e[10]=N,e[11]=v,e[12]=i,e[13]=k,e[14]=s,e[15]=I}else I=e[15];return I},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{Ee as FunctionStatsPanel};
|