@lunora/studio 1.0.0-alpha.369 → 1.0.0-alpha.370
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/packem_chunks/migrations-route.mjs +1 -1
- package/dist/standalone/{chunk-IXS7MHHM.js → chunk-2JD7ZSZV.js} +1 -1
- package/dist/standalone/{chunk-WYXSCWNG.js → chunk-2TBMJ7XV.js} +1 -1
- package/dist/standalone/{chunk-KPTRMV5Y.js → chunk-36RORAX3.js} +1 -1
- package/dist/standalone/{chunk-NQK3Y5UV.js → chunk-3IMLG2OT.js} +1 -1
- package/dist/standalone/{chunk-BCJWWHAX.js → chunk-5BXW4BR6.js} +1 -1
- package/dist/standalone/{chunk-WSKN5NCB.js → chunk-5KZIXB6E.js} +1 -1
- package/dist/standalone/{chunk-AW532XQ3.js → chunk-5QUEED5Z.js} +1 -1
- package/dist/standalone/{chunk-PACPUEWB.js → chunk-5SKGLIO5.js} +1 -1
- package/dist/standalone/{chunk-RL5SUZ6J.js → chunk-5X6BEWUI.js} +1 -1
- package/dist/standalone/{chunk-UWVPGEJM.js → chunk-5XN5GQP5.js} +1 -1
- package/dist/standalone/{chunk-HUIW5YJW.js → chunk-62XXKQH3.js} +1 -1
- package/dist/standalone/{chunk-3526X23C.js → chunk-6FLYVL6K.js} +1 -1
- package/dist/standalone/{chunk-UDDIUQ2F.js → chunk-6FNFOTRR.js} +1 -1
- package/dist/standalone/{chunk-LPNUYR43.js → chunk-6LLUZFDD.js} +1 -1
- package/dist/standalone/{chunk-YTZ7LWZ4.js → chunk-6VLPJOPR.js} +1 -1
- package/dist/standalone/{chunk-XC3XUPB7.js → chunk-6XL3EV2X.js} +1 -1
- package/dist/standalone/{chunk-UA3LPAFC.js → chunk-7N2OPADC.js} +1 -1
- package/dist/standalone/{chunk-HUFK6COH.js → chunk-7TTX42IR.js} +1 -1
- package/dist/standalone/{chunk-HCN5COJB.js → chunk-7YZKGLGA.js} +1 -1
- package/dist/standalone/{chunk-FZTPC7NT.js → chunk-AA3R3QNN.js} +1 -1
- package/dist/standalone/{chunk-2XVH2EXL.js → chunk-AMOPLAX6.js} +1 -1
- package/dist/standalone/{chunk-JULHAFJ4.js → chunk-ARGGBECJ.js} +1 -1
- package/dist/standalone/{chunk-5D3H63PI.js → chunk-B4K4IET7.js} +1 -1
- package/dist/standalone/{chunk-4M3NH7JL.js → chunk-CLYI7JF2.js} +1 -1
- package/dist/standalone/{chunk-E7INALU3.js → chunk-CNQBTB5C.js} +1 -1
- package/dist/standalone/{chunk-CB7ZTKPV.js → chunk-DBLSNTHL.js} +1 -1
- package/dist/standalone/{chunk-DK53RZKN.js → chunk-E5LR7G22.js} +1 -1
- package/dist/standalone/{chunk-QJQESOSM.js → chunk-E6FH3ZOB.js} +1 -1
- package/dist/standalone/{chunk-E2YYGOOQ.js → chunk-E6NWADUS.js} +1 -1
- package/dist/standalone/{chunk-QNWL62VF.js → chunk-F7EKRF7I.js} +1 -1
- package/dist/standalone/{chunk-4RB2U4LR.js → chunk-FHKZP25N.js} +1 -1
- package/dist/standalone/{chunk-DAQ5MG2K.js → chunk-FTJ6RR64.js} +1 -1
- package/dist/standalone/{chunk-D65BU7FE.js → chunk-G2Z7WFAT.js} +1 -1
- package/dist/standalone/{chunk-7PMFQ2MH.js → chunk-G6PUHYKD.js} +1 -1
- package/dist/standalone/{chunk-Z2OFUUXB.js → chunk-GM7MBMYI.js} +1 -1
- package/dist/standalone/{chunk-DJNIAP4K.js → chunk-H6KIDQ6V.js} +1 -1
- package/dist/standalone/{chunk-AZ4XQOCL.js → chunk-HGNPJO7S.js} +1 -1
- package/dist/standalone/{chunk-5H7O5AAH.js → chunk-HLWDT5VZ.js} +1 -1
- package/dist/standalone/{chunk-MTQ2AME6.js → chunk-HWFV5UCF.js} +1 -1
- package/dist/standalone/{chunk-OX4CGBCH.js → chunk-IDHU47FP.js} +1 -1
- package/dist/standalone/{chunk-3DSYXWHK.js → chunk-IDNHNCZV.js} +1 -1
- package/dist/standalone/{chunk-RJBL7JY4.js → chunk-IHWSRI72.js} +1 -1
- package/dist/standalone/{chunk-YPNUYWQA.js → chunk-J77YDVBD.js} +1 -1
- package/dist/standalone/{chunk-D7G6QZVG.js → chunk-JG74C6DH.js} +1 -1
- package/dist/standalone/{chunk-645TBHJ5.js → chunk-JT7UYB6L.js} +1 -1
- package/dist/standalone/{chunk-7AJWGPWM.js → chunk-JWQOB4EW.js} +1 -1
- package/dist/standalone/{chunk-SVFX7F32.js → chunk-K5BAERB3.js} +1 -1
- package/dist/standalone/{chunk-SBK3TAAB.js → chunk-KAK3HS5E.js} +1 -1
- package/dist/standalone/{chunk-Z5FIGWZI.js → chunk-KZ6YQ234.js} +1 -1
- package/dist/standalone/{chunk-KFQGXMDN.js → chunk-LZHT6UGJ.js} +1 -1
- package/dist/standalone/{chunk-MQ5QAANP.js → chunk-MGJZKA6O.js} +1 -1
- package/dist/standalone/{chunk-VRBDHZHG.js → chunk-MQBQBEGM.js} +1 -1
- package/dist/standalone/{chunk-4CP3Z5RO.js → chunk-NEFVDZHP.js} +1 -1
- package/dist/standalone/{chunk-FRAL2RO2.js → chunk-NHUEXULQ.js} +1 -1
- package/dist/standalone/{chunk-BDSMWSCC.js → chunk-NSAQ3EDS.js} +1 -1
- package/dist/standalone/{chunk-F3ZG77WE.js → chunk-NYJXRBOK.js} +1 -1
- package/dist/standalone/{chunk-R47IHY6Y.js → chunk-O24UFHUY.js} +1 -1
- package/dist/standalone/{chunk-LTUZJBOU.js → chunk-O6W2YLME.js} +1 -1
- package/dist/standalone/{chunk-2JI25KW2.js → chunk-O7XG7DTU.js} +1 -1
- package/dist/standalone/{chunk-CHRUVO6R.js → chunk-OBYE3IXP.js} +1 -1
- package/dist/standalone/{chunk-BRSAZHDR.js → chunk-OCYIIOBX.js} +1 -1
- package/dist/standalone/{chunk-BVANRUU4.js → chunk-OOOT4H45.js} +6 -6
- package/dist/standalone/{chunk-P37PUSCM.js → chunk-OQOKF4LL.js} +1 -1
- package/dist/standalone/{chunk-LT4GBBFX.js → chunk-OS5DOPZW.js} +1 -1
- package/dist/standalone/{chunk-ZHH5ZUAS.js → chunk-PDBCAPP6.js} +1 -1
- package/dist/standalone/{chunk-CVXWRAOE.js → chunk-PFNK2MGW.js} +1 -1
- package/dist/standalone/{chunk-SLEA53CP.js → chunk-PMDLNIHA.js} +1 -1
- package/dist/standalone/{chunk-PXVIHVAC.js → chunk-PZGLD7G7.js} +1 -1
- package/dist/standalone/{chunk-EU4ZGNNW.js → chunk-Q3WMP7OA.js} +1 -1
- package/dist/standalone/{chunk-XTU27CFW.js → chunk-Q65X2ZIP.js} +1 -1
- package/dist/standalone/{chunk-L2IIDFS6.js → chunk-QBRBGDCL.js} +1 -1
- package/dist/standalone/{chunk-YUJEQHLF.js → chunk-QR6RYVUD.js} +1 -1
- package/dist/standalone/{chunk-JKUOZ7WC.js → chunk-QSUQAWEP.js} +1 -1
- package/dist/standalone/{chunk-CEQ5CLF7.js → chunk-RLJYW6TY.js} +1 -1
- package/dist/standalone/{chunk-AJQGPPJL.js → chunk-SGIBDCPB.js} +1 -1
- package/dist/standalone/{chunk-VZGMGBF2.js → chunk-STK3KLLV.js} +1 -1
- package/dist/standalone/{chunk-NCHRXGHE.js → chunk-TDPAITW5.js} +1 -1
- package/dist/standalone/{chunk-J66QR7WA.js → chunk-TZ5PSNZW.js} +1 -1
- package/dist/standalone/{chunk-3CHB2JV2.js → chunk-UCJWHNUJ.js} +1 -1
- package/dist/standalone/{chunk-JMFIJ3RC.js → chunk-V3SVDOVD.js} +1 -1
- package/dist/standalone/{chunk-FJMFQ5AG.js → chunk-V6YA4TAL.js} +1 -1
- package/dist/standalone/{chunk-JK3WW3ZA.js → chunk-VB2XDTVB.js} +1 -1
- package/dist/standalone/{chunk-YWBYKFUD.js → chunk-VFB22IM2.js} +1 -1
- package/dist/standalone/{chunk-P4FZSY2J.js → chunk-VGIDGJ5K.js} +1 -1
- package/dist/standalone/{chunk-WRP4JGYX.js → chunk-VJC5PQ7D.js} +1 -1
- package/dist/standalone/{chunk-UXLXNYF2.js → chunk-W42GZL6T.js} +1 -1
- package/dist/standalone/{chunk-AHGTRV37.js → chunk-WGGSW4E2.js} +1 -1
- package/dist/standalone/{chunk-LJKB6B3H.js → chunk-XMOG3LIP.js} +1 -1
- package/dist/standalone/{chunk-HAJH74RY.js → chunk-Y2JFJP4B.js} +1 -1
- package/dist/standalone/{chunk-DAKKBHGF.js → chunk-YLXNXB7E.js} +1 -1
- package/dist/standalone/{chunk-7CCJOJJB.js → chunk-YYIW5EKO.js} +1 -1
- package/dist/standalone/{chunk-FAQYDT7O.js → chunk-ZCN4YUCA.js} +1 -1
- package/dist/standalone/{chunk-SPSYM34I.js → chunk-ZEWRYBCB.js} +1 -1
- package/dist/standalone/{chunk-DAO4DQDP.js → chunk-ZGZSTTKN.js} +1 -1
- package/dist/standalone/{chunk-UUWJUMOH.js → chunk-ZM3A5WO5.js} +1 -1
- package/dist/standalone/chunk-ZYZ5ATT2.js +1 -0
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
- package/dist/standalone/chunk-ZPOWCFQA.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,b as D}from"./chunk-HCOF7HOM.js";import{a as _,b as z,c as j,d as E,e as B,f as H,g as L,h as V,i as O,j as T,k as Z,l as q}from"./chunk-XC3XUPB7.js";import{i as I}from"./chunk-EU4ZGNNW.js";import{a as k}from"./chunk-PACPUEWB.js";import{b as w}from"./chunk-SVFX7F32.js";import{B as $,s as P,x as N}from"./chunk-BVANRUU4.js";import{a as se}from"./chunk-GWNGVKLG.js";import{a as le,b as de}from"./chunk-6G3E4PJ2.js";import{a as u,d as S}from"./chunk-5PEAXTYQ.js";var v=S(se(),1);var b=S(le(),1);var s=S(de(),1);function ie(a){let e=(0,v.c)(10),t,n,r;e[0]!==a?({className:t,selected:r,...n}=a,e[0]=a,e[1]=t,e[2]=n,e[3]=r):(t=e[1],n=e[2],r=e[3]);let l=r===!0?"":void 0,o;e[4]!==t?(o=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==n||e[7]!==l||e[8]!==o?(d=(0,s.jsx)("div",{"data-slot":"base-node","data-selected":l,className:o,...n}),e[6]=n,e[7]=l,e[8]=o,e[9]=d):d=e[9],d}u(ie,"ie");function ce(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-header",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(ce,"ce");function me(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex flex-col",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-content",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(me,"de");var ue=3,fe=u((a,e,t)=>{let n=e?a:a.slice(0,ue),r=n.map(o=>JSON.stringify(o)).join(" | "),l=a.length-n.length;return l>0?`${r} ${t("+{count} more",{count:l})}`:r},"fe"),J=u((a,e,t)=>{let n=a.enumValues??[],r=n.length===0?a.type:fe(n,e,t),l=a.ref===void 0?r:`${r} \u2192 ${a.ref}`;return a.optional===!0?`${l}?`:l},"H"),pe=u(a=>{let e=(0,v.c)(23),{data:t,selected:n}=a,r=$(),l;e[0]!==t.label||e[1]!==t.loadError||e[2]!==r?(l=t.loadError===!0?(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:r("Columns unavailable")}):(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"\u2014"}),e[0]=t.label,e[1]=t.loadError,e[2]=r,e[3]=l):l=e[3];let o=l,d=`sd-node-${t.label}`,c;e[4]!==t.label?(c=(0,s.jsx)("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=c):c=e[5];let m;e[6]!==t.tier?(m=(0,s.jsx)("span",{className:"ms-auto",children:(0,s.jsx)(D,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==c||e[9]!==m?(i=(0,s.jsxs)(ce,{children:[c,m]}),e[8]=c,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==o||e[14]!==r?(f=t.columns.length===0?o:t.columns.map(h=>(0,s.jsxs)("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",h.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${h.name}`,children:[(0,s.jsx)(E,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Left,type:"target"}),(0,s.jsx)("span",{className:"truncate font-mono",title:h.name,children:h.name}),h.pk===!0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),h.ref!==void 0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),(0,s.jsx)("span",{className:"ms-auto truncate text-muted-foreground",title:J(h,!0,r),children:J(h,!1,r)}),(0,s.jsx)(E,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Right,type:"source"})]},h.name)),e[11]=t.columns,e[12]=t.label,e[13]=o,e[14]=r,e[15]=f):f=e[15];let p;e[16]!==f?(p=(0,s.jsx)(me,{children:f}),e[16]=f,e[17]=p):p=e[17];let x;return e[18]!==n||e[19]!==d||e[20]!==i||e[21]!==p?(x=(0,s.jsxs)(ie,{className:"w-64 overflow-hidden","data-testid":d,selected:n,children:[i,p]}),e[18]=n,e[19]=d,e[20]=i,e[21]=p,e[22]=x):x=e[22],x},"ue"),G=256,Q=112,W=36,M=24,he=480,be=1.4,ge=u(a=>{let e=Math.max(1,Math.round(Math.sqrt(be*a/(G+Q))));return Math.max(he,a/e)},"ge"),xe=38,Ne=28,A=u(a=>xe+Math.max(1,a)*Ne,"B"),ye=u((a,e)=>{let t=new Map;for(let o of a)t.set(o,[]);for(let o of e)o.to!==o.from&&t.has(o.from)&&t.has(o.to)&&t.get(o.from)?.push(o.to);let n=new Map,r=new Set,l=u(o=>{let d=n.get(o);if(d!==void 0)return d;if(r.has(o))return 0;r.add(o);let c=0;for(let m of t.get(o)??[])c=Math.max(c,l(m)+1);return r.delete(o),n.set(o,c),c},"r");for(let o of a)l(o);return n},"Ne"),ve=u((a,e,t)=>{let n=ye(a,e),r=new Map;for(let m of a){let i=n.get(m)??0,f=r.get(i);f===void 0?r.set(i,[m]):f.push(m)}let l=a.reduce((m,i)=>m+A(t.get(i)??0)+W,0),o=ge(l),d=[],c=0;for(let m of[...r.keys()].toSorted((i,f)=>i-f)){let i=0,f=M;for(let p of r.get(m)??[]){let x=A(t.get(p)??0);f>M&&f+x>o&&(i+=1,f=M),d.push({name:p,x:M+(c+i)*(G+Q),y:f}),f+=x+W}c+=i+1}return d},"ye"),we={databaseSchema:pe},U={backgroundColor:y.shard.color},X={backgroundColor:y.global.color},$e={global:!0,shard:!0},Me={},Ce=u(a=>{let e=a.find(t=>t.pk===!0)?.name;return e!==void 0?e:a.some(t=>t.name==="_id")?"_id":a.some(t=>t.name==="id")?"id":a[0]?.name??"_id"},"_e"),Y=u(a=>a.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),"K"),Se=u((a,e,t)=>{let n=a.map(d=>d.name),r=new Map(a.map(d=>[d.name,d.columns.length])),l=ve(n,Y(a),r),o=new Map(a.map(d=>[d.name,d]));return l.flatMap(({name:d,x:c,y:m})=>{let i=o.get(d);return i===void 0?[]:[{className:t[d],data:{columns:i.columns,label:d,loadError:e,tier:i.tier},id:d,position:{x:c,y:m},type:"databaseSchema"}]})},"we"),ke=u(a=>{let e=new Map(a.map(t=>[t.name,t.columns]));return Y(a).flatMap(t=>{let n=e.get(t.to)??[],r=e.get(t.from)??[],l=Ce(n);return!n.some(o=>o.name===l)||!r.some(o=>o.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:l,target:t.from,targetHandle:t.column}]})},"Me"),_e=u(()=>{let a=(0,v.c)(15),e=$(),t;a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),a[0]=t):t=a[0];let n;a[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]}),a[1]=n):n=a[1];let r;a[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),a[2]=r):r=a[2];let l;a[3]!==e?(l=e("Primary key"),a[3]=e,a[4]=l):l=a[4];let o;a[5]!==l?(o=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[r,l]}),a[5]=l,a[6]=o):o=a[6];let d;a[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),a[7]=d):d=a[7];let c;a[8]!==e?(c=e("Foreign key"),a[8]=e,a[9]=c):c=a[9];let m;a[10]!==c?(m=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[d,c]}),a[10]=c,a[11]=m):m=a[11];let i;return a[12]!==o||a[13]!==m?(i=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,n,o,m]}),a[12]=o,a[13]=m,a[14]=i):i=a[14],i},"Ce"),ze=12,Ee=u(a=>{let e=(0,v.c)(9),{containerRef:t,seedKey:n}=a,r=V(),{fitView:l}=j(),o;e[0]!==t||e[1]!==l||e[2]!==r?(o=u(()=>{if(!r)return;let c=u(()=>{P(l({duration:0,maxZoom:1.6,padding:.14}))},"d");c();let m=t.current;if(m===null)return;let i=new ResizeObserver(()=>{c()});return i.observe(m),()=>{i.disconnect()}},"a"),e[0]=t,e[1]=l,e[2]=r,e[3]=o):o=e[3];let d;return e[4]!==t||e[5]!==l||e[6]!==r||e[7]!==n?(d=[t,l,r,n],e[4]=t,e[5]=l,e[6]=r,e[7]=n,e[8]=d):d=e[8],(0,b.useEffect)(o,d),null},"Te"),Ve=u(({columnsError:a,fill:e=!1,nodeClasses:t,tables:n,testIdPrefix:r})=>{let l=$(),[o,d]=(0,b.useState)($e),[c,m]=(0,b.useState)(""),i=(0,b.useMemo)(()=>{let g=c.trim().toLowerCase();return n.filter(K=>o[K.tier]&&K.name.toLowerCase().includes(g))},[n,o,c]),f=(0,b.useMemo)(()=>Se(i,a??!1,t??Me),[i,a,t]),p=(0,b.useMemo)(()=>ke(i),[i]),x=i.map(g=>g.name).join(","),[h,R,ee]=H(f),[te,F,ae]=L(p),C=(0,b.useRef)(null);(0,b.useEffect)(()=>{R(f)},[f,R]),(0,b.useEffect)(()=>{F(p)},[p,F]);let re=u(g=>{m(g.target.value)},"V"),oe=u(()=>{d(g=>({...g,shard:!g.shard}))},"W"),ne=u(()=>{d(g=>({...g,global:!g.global}))},"Y");return n.length===0?(0,s.jsx)("section",{className:"flex flex-col gap-2","data-testid":`${r}-section`,children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":`${r}-empty`,children:l("No tables to graph.")})}):(0,s.jsx)("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${r}-section`,children:(0,s.jsx)("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${r}-canvas`,ref:C,children:(0,s.jsxs)(B,{edges:te,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:h,nodesConnectable:!1,nodeTypes:we,onEdgesChange:ae,onNodesChange:ee,children:[(0,s.jsx)(O,{}),(0,s.jsx)(z,{position:"top-left",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[(0,s.jsx)(I,{"aria-label":l("Find table\u2026"),className:"h-7 w-44 text-xs","data-testid":`${r}-find`,onChange:re,placeholder:l("Find table\u2026"),value:c}),(0,s.jsxs)("div",{"aria-label":l("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[(0,s.jsxs)(k,{"aria-pressed":o.shard,className:"gap-1.5","data-testid":`${r}-tier-shard`,onClick:oe,size:"xs",type:"button",variant:o.shard?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),(0,s.jsxs)(k,{"aria-pressed":o.global,className:"gap-1.5","data-testid":`${r}-tier-global`,onClick:ne,size:"xs",type:"button",variant:o.global?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]})]})]})}),(0,s.jsx)(z,{position:"bottom-center",children:(0,s.jsx)(_e,{})}),(0,s.jsx)(T,{showInteractive:!1}),i.length>ze&&(0,s.jsx)(Z,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),(0,s.jsx)(q,{containerRef:C,filenameBase:`${r}-schema-diagram`,testIdPrefix:r}),(0,s.jsx)(Ee,{containerRef:C,seedKey:x})]})})})},"Ke");export{Ve as a};
|
|
1
|
+
import{a as y,b as D}from"./chunk-HCOF7HOM.js";import{a as _,b as z,c as j,d as E,e as B,f as H,g as L,h as V,i as O,j as T,k as Z,l as q}from"./chunk-6XL3EV2X.js";import{i as I}from"./chunk-Q3WMP7OA.js";import{a as k}from"./chunk-5SKGLIO5.js";import{b as w}from"./chunk-K5BAERB3.js";import{B as $,s as P,x as N}from"./chunk-OOOT4H45.js";import{a as se}from"./chunk-GWNGVKLG.js";import{a as le,b as de}from"./chunk-6G3E4PJ2.js";import{a as u,d as S}from"./chunk-5PEAXTYQ.js";var v=S(se(),1);var b=S(le(),1);var s=S(de(),1);function ie(a){let e=(0,v.c)(10),t,n,r;e[0]!==a?({className:t,selected:r,...n}=a,e[0]=a,e[1]=t,e[2]=n,e[3]=r):(t=e[1],n=e[2],r=e[3]);let l=r===!0?"":void 0,o;e[4]!==t?(o=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==n||e[7]!==l||e[8]!==o?(d=(0,s.jsx)("div",{"data-slot":"base-node","data-selected":l,className:o,...n}),e[6]=n,e[7]=l,e[8]=o,e[9]=d):d=e[9],d}u(ie,"ie");function ce(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-header",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(ce,"ce");function me(a){let e=(0,v.c)(8),t,n;e[0]!==a?({className:t,...n}=a,e[0]=a,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let r;e[3]!==t?(r=N("flex flex-col",t),e[3]=t,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=(0,s.jsx)("div",{"data-slot":"base-node-content",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}u(me,"de");var ue=3,fe=u((a,e,t)=>{let n=e?a:a.slice(0,ue),r=n.map(o=>JSON.stringify(o)).join(" | "),l=a.length-n.length;return l>0?`${r} ${t("+{count} more",{count:l})}`:r},"fe"),J=u((a,e,t)=>{let n=a.enumValues??[],r=n.length===0?a.type:fe(n,e,t),l=a.ref===void 0?r:`${r} \u2192 ${a.ref}`;return a.optional===!0?`${l}?`:l},"H"),pe=u(a=>{let e=(0,v.c)(23),{data:t,selected:n}=a,r=$(),l;e[0]!==t.label||e[1]!==t.loadError||e[2]!==r?(l=t.loadError===!0?(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:r("Columns unavailable")}):(0,s.jsx)("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"\u2014"}),e[0]=t.label,e[1]=t.loadError,e[2]=r,e[3]=l):l=e[3];let o=l,d=`sd-node-${t.label}`,c;e[4]!==t.label?(c=(0,s.jsx)("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=c):c=e[5];let m;e[6]!==t.tier?(m=(0,s.jsx)("span",{className:"ms-auto",children:(0,s.jsx)(D,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==c||e[9]!==m?(i=(0,s.jsxs)(ce,{children:[c,m]}),e[8]=c,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==o||e[14]!==r?(f=t.columns.length===0?o:t.columns.map(h=>(0,s.jsxs)("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",h.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${h.name}`,children:[(0,s.jsx)(E,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Left,type:"target"}),(0,s.jsx)("span",{className:"truncate font-mono",title:h.name,children:h.name}),h.pk===!0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),h.ref!==void 0&&(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),(0,s.jsx)("span",{className:"ms-auto truncate text-muted-foreground",title:J(h,!0,r),children:J(h,!1,r)}),(0,s.jsx)(E,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:h.name,isConnectable:!1,position:_.Right,type:"source"})]},h.name)),e[11]=t.columns,e[12]=t.label,e[13]=o,e[14]=r,e[15]=f):f=e[15];let p;e[16]!==f?(p=(0,s.jsx)(me,{children:f}),e[16]=f,e[17]=p):p=e[17];let x;return e[18]!==n||e[19]!==d||e[20]!==i||e[21]!==p?(x=(0,s.jsxs)(ie,{className:"w-64 overflow-hidden","data-testid":d,selected:n,children:[i,p]}),e[18]=n,e[19]=d,e[20]=i,e[21]=p,e[22]=x):x=e[22],x},"ue"),G=256,Q=112,W=36,M=24,he=480,be=1.4,ge=u(a=>{let e=Math.max(1,Math.round(Math.sqrt(be*a/(G+Q))));return Math.max(he,a/e)},"ge"),xe=38,Ne=28,A=u(a=>xe+Math.max(1,a)*Ne,"B"),ye=u((a,e)=>{let t=new Map;for(let o of a)t.set(o,[]);for(let o of e)o.to!==o.from&&t.has(o.from)&&t.has(o.to)&&t.get(o.from)?.push(o.to);let n=new Map,r=new Set,l=u(o=>{let d=n.get(o);if(d!==void 0)return d;if(r.has(o))return 0;r.add(o);let c=0;for(let m of t.get(o)??[])c=Math.max(c,l(m)+1);return r.delete(o),n.set(o,c),c},"r");for(let o of a)l(o);return n},"Ne"),ve=u((a,e,t)=>{let n=ye(a,e),r=new Map;for(let m of a){let i=n.get(m)??0,f=r.get(i);f===void 0?r.set(i,[m]):f.push(m)}let l=a.reduce((m,i)=>m+A(t.get(i)??0)+W,0),o=ge(l),d=[],c=0;for(let m of[...r.keys()].toSorted((i,f)=>i-f)){let i=0,f=M;for(let p of r.get(m)??[]){let x=A(t.get(p)??0);f>M&&f+x>o&&(i+=1,f=M),d.push({name:p,x:M+(c+i)*(G+Q),y:f}),f+=x+W}c+=i+1}return d},"ye"),we={databaseSchema:pe},U={backgroundColor:y.shard.color},X={backgroundColor:y.global.color},$e={global:!0,shard:!0},Me={},Ce=u(a=>{let e=a.find(t=>t.pk===!0)?.name;return e!==void 0?e:a.some(t=>t.name==="_id")?"_id":a.some(t=>t.name==="id")?"id":a[0]?.name??"_id"},"_e"),Y=u(a=>a.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),"K"),Se=u((a,e,t)=>{let n=a.map(d=>d.name),r=new Map(a.map(d=>[d.name,d.columns.length])),l=ve(n,Y(a),r),o=new Map(a.map(d=>[d.name,d]));return l.flatMap(({name:d,x:c,y:m})=>{let i=o.get(d);return i===void 0?[]:[{className:t[d],data:{columns:i.columns,label:d,loadError:e,tier:i.tier},id:d,position:{x:c,y:m},type:"databaseSchema"}]})},"we"),ke=u(a=>{let e=new Map(a.map(t=>[t.name,t.columns]));return Y(a).flatMap(t=>{let n=e.get(t.to)??[],r=e.get(t.from)??[],l=Ce(n);return!n.some(o=>o.name===l)||!r.some(o=>o.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:l,target:t.from,targetHandle:t.column}]})},"Me"),_e=u(()=>{let a=(0,v.c)(15),e=$(),t;a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),a[0]=t):t=a[0];let n;a[1]===Symbol.for("react.memo_cache_sentinel")?(n=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]}),a[1]=n):n=a[1];let r;a[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),a[2]=r):r=a[2];let l;a[3]!==e?(l=e("Primary key"),a[3]=e,a[4]=l):l=a[4];let o;a[5]!==l?(o=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[r,l]}),a[5]=l,a[6]=o):o=a[6];let d;a[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),a[7]=d):d=a[7];let c;a[8]!==e?(c=e("Foreign key"),a[8]=e,a[9]=c):c=a[9];let m;a[10]!==c?(m=(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[d,c]}),a[10]=c,a[11]=m):m=a[11];let i;return a[12]!==o||a[13]!==m?(i=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,n,o,m]}),a[12]=o,a[13]=m,a[14]=i):i=a[14],i},"Ce"),ze=12,Ee=u(a=>{let e=(0,v.c)(9),{containerRef:t,seedKey:n}=a,r=V(),{fitView:l}=j(),o;e[0]!==t||e[1]!==l||e[2]!==r?(o=u(()=>{if(!r)return;let c=u(()=>{P(l({duration:0,maxZoom:1.6,padding:.14}))},"d");c();let m=t.current;if(m===null)return;let i=new ResizeObserver(()=>{c()});return i.observe(m),()=>{i.disconnect()}},"a"),e[0]=t,e[1]=l,e[2]=r,e[3]=o):o=e[3];let d;return e[4]!==t||e[5]!==l||e[6]!==r||e[7]!==n?(d=[t,l,r,n],e[4]=t,e[5]=l,e[6]=r,e[7]=n,e[8]=d):d=e[8],(0,b.useEffect)(o,d),null},"Te"),Ve=u(({columnsError:a,fill:e=!1,nodeClasses:t,tables:n,testIdPrefix:r})=>{let l=$(),[o,d]=(0,b.useState)($e),[c,m]=(0,b.useState)(""),i=(0,b.useMemo)(()=>{let g=c.trim().toLowerCase();return n.filter(K=>o[K.tier]&&K.name.toLowerCase().includes(g))},[n,o,c]),f=(0,b.useMemo)(()=>Se(i,a??!1,t??Me),[i,a,t]),p=(0,b.useMemo)(()=>ke(i),[i]),x=i.map(g=>g.name).join(","),[h,R,ee]=H(f),[te,F,ae]=L(p),C=(0,b.useRef)(null);(0,b.useEffect)(()=>{R(f)},[f,R]),(0,b.useEffect)(()=>{F(p)},[p,F]);let re=u(g=>{m(g.target.value)},"V"),oe=u(()=>{d(g=>({...g,shard:!g.shard}))},"W"),ne=u(()=>{d(g=>({...g,global:!g.global}))},"Y");return n.length===0?(0,s.jsx)("section",{className:"flex flex-col gap-2","data-testid":`${r}-section`,children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":`${r}-empty`,children:l("No tables to graph.")})}):(0,s.jsx)("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${r}-section`,children:(0,s.jsx)("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${r}-canvas`,ref:C,children:(0,s.jsxs)(B,{edges:te,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:h,nodesConnectable:!1,nodeTypes:we,onEdgesChange:ae,onNodesChange:ee,children:[(0,s.jsx)(O,{}),(0,s.jsx)(z,{position:"top-left",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[(0,s.jsx)(I,{"aria-label":l("Find table\u2026"),className:"h-7 w-44 text-xs","data-testid":`${r}-find`,onChange:re,placeholder:l("Find table\u2026"),value:c}),(0,s.jsxs)("div",{"aria-label":l("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[(0,s.jsxs)(k,{"aria-pressed":o.shard,className:"gap-1.5","data-testid":`${r}-tier-shard`,onClick:oe,size:"xs",type:"button",variant:o.shard?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),(0,s.jsxs)(k,{"aria-pressed":o.global,className:"gap-1.5","data-testid":`${r}-tier-global`,onClick:ne,size:"xs",type:"button",variant:o.global?"default":"outline",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]})]})]})}),(0,s.jsx)(z,{position:"bottom-center",children:(0,s.jsx)(_e,{})}),(0,s.jsx)(T,{showInteractive:!1}),i.length>ze&&(0,s.jsx)(Z,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),(0,s.jsx)(q,{containerRef:C,filenameBase:`${r}-schema-diagram`,testIdPrefix:r}),(0,s.jsx)(Ee,{containerRef:C,seedKey:x})]})})})},"Ke");export{Ve as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as je}from"./chunk-JULHAFJ4.js";import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-F3ZG77WE.js";import"./chunk-O3AZ7JKE.js";import{a as qe}from"./chunk-Z2OFUUXB.js";import"./chunk-VNH4OBJS.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import{a as ze}from"./chunk-J45HAKBU.js";import{a as _e}from"./chunk-4RB2U4LR.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import{i as Ae}from"./chunk-EU4ZGNNW.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as le}from"./chunk-PACPUEWB.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as Ee}from"./chunk-LJKB6B3H.js";import{b as me}from"./chunk-SVFX7F32.js";import"./chunk-YUVGMKHG.js";import{a as Le,b as Re,c as Ve,d as pe,e as B,f as L}from"./chunk-J66QR7WA.js";import"./chunk-4PI2OSSP.js";import{a as U}from"./chunk-2W4UO5BC.js";import{c as Ce}from"./chunk-RL5SUZ6J.js";import{a as Ke,e as Te}from"./chunk-ZHH5ZUAS.js";import{m as be}from"./chunk-7AJWGPWM.js";import"./chunk-ZPQBVYNN.js";import{B as ue,e as Se,f as $e,h as ie,i as Ne,j as ke,s as re,w as Me}from"./chunk-BVANRUU4.js";import"./chunk-PDBW6GTJ.js";import{a as Ge}from"./chunk-GWNGVKLG.js";import{a as Oe,b as He}from"./chunk-6G3E4PJ2.js";import{a as d,d as ye}from"./chunk-5PEAXTYQ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Ie="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=ie(U.resolveIssue),Xe=ie(U.ignoreIssue),Fe=ie(U.assignIssue),Ye=ie(U.setIssueSeverity),Ze=ie(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=be(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=je(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},S=await i.query(Ze,g,Ne($));o(S)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let z=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Se(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==z||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(le,{"data-testid":b,disabled:_,onClick:z,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=z,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(L,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let I;return e[41]!==c||e[42]!==E?(I=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=I):I=e[43],I},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Ie?null:ae;re(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let z=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();re(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(L,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let I=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let S;e[33]!==s.status||e[34]!==I||e[35]!==g?(S=(0,t.jsx)(L,{children:(0,t.jsx)(me,{"data-testid":I,variant:g,children:s.status})}),e[33]=s.status,e[34]=I,e[35]=g,e[36]=S):S=e[36];let V=s.severity??Ie,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,j;e[39]!==a?(j=a("\u2014"),e[39]=a,e[40]=j):j=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==j||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:j,children:N}),e[44]=j,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Ie,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==z||e[58]!==V||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(L,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:z,value:V,children:[q,D]})}),e[56]=u,e[57]=z,e[58]=V,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(L,{children:(0,t.jsx)(Ae,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Me(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(L,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(le,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(le,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(le,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==S||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,S,F,H,J,Q,ee]}),e[103]=c,e[104]=S,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=be(),{queryShardKey:i,setShardKey:l,shardKey:a}=ze(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,z]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ce(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,j)=>{z(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...j,hash:r},Ne(i))}catch(N){let C=ke(N);z(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"v"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let I;e[27]!==x?(I=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=I):I=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(le,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let S;e[32]!==g?(S=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=S):S=e[33];let V;e[34]!==S||e[35]!==c||e[36]!==I?(V=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,I,S]}),e[34]=S,e[35]=c,e[36]=I,e[37]=V):V=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,V,M&&y.length===0?(0,t.jsx)(Ee,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Ke,{className:"overflow-hidden py-0",children:(0,t.jsx)(Te,{className:"px-0",children:(0,t.jsxs)(Le,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(Ve,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
|
|
1
|
+
import{a as je}from"./chunk-ARGGBECJ.js";import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-NYJXRBOK.js";import"./chunk-O3AZ7JKE.js";import{a as qe}from"./chunk-GM7MBMYI.js";import"./chunk-VNH4OBJS.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import{a as ze}from"./chunk-J45HAKBU.js";import{a as _e}from"./chunk-FHKZP25N.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import{i as Ae}from"./chunk-Q3WMP7OA.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as le}from"./chunk-5SKGLIO5.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as Ee}from"./chunk-XMOG3LIP.js";import{b as me}from"./chunk-K5BAERB3.js";import"./chunk-YUVGMKHG.js";import{a as Le,b as Re,c as Ve,d as pe,e as B,f as L}from"./chunk-TZ5PSNZW.js";import"./chunk-4PI2OSSP.js";import{a as U}from"./chunk-2W4UO5BC.js";import{c as Ce}from"./chunk-5X6BEWUI.js";import{a as Ke,e as Te}from"./chunk-PDBCAPP6.js";import{m as be}from"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as ue,e as Se,f as $e,h as ie,i as Ne,j as ke,s as re,w as Me}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import{a as Ge}from"./chunk-GWNGVKLG.js";import{a as Oe,b as He}from"./chunk-6G3E4PJ2.js";import{a as d,d as ye}from"./chunk-5PEAXTYQ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Ie="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=ie(U.resolveIssue),Xe=ie(U.ignoreIssue),Fe=ie(U.assignIssue),Ye=ie(U.setIssueSeverity),Ze=ie(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=be(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=je(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},S=await i.query(Ze,g,Ne($));o(S)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let z=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Se(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==z||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(le,{"data-testid":b,disabled:_,onClick:z,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=z,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(L,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let I;return e[41]!==c||e[42]!==E?(I=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=I):I=e[43],I},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Ie?null:ae;re(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let z=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();re(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(L,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let I=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let S;e[33]!==s.status||e[34]!==I||e[35]!==g?(S=(0,t.jsx)(L,{children:(0,t.jsx)(me,{"data-testid":I,variant:g,children:s.status})}),e[33]=s.status,e[34]=I,e[35]=g,e[36]=S):S=e[36];let V=s.severity??Ie,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,j;e[39]!==a?(j=a("\u2014"),e[39]=a,e[40]=j):j=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==j||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:j,children:N}),e[44]=j,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Ie,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==z||e[58]!==V||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(L,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:z,value:V,children:[q,D]})}),e[56]=u,e[57]=z,e[58]=V,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(L,{children:(0,t.jsx)(Ae,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Me(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(L,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(le,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(le,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(le,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{re(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(L,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==S||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,S,F,H,J,Q,ee]}),e[103]=c,e[104]=S,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=be(),{queryShardKey:i,setShardKey:l,shardKey:a}=ze(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,z]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ce(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,j)=>{z(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...j,hash:r},Ne(i))}catch(N){let C=ke(N);z(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"v"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let I;e[27]!==x?(I=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=I):I=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(le,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let S;e[32]!==g?(S=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=S):S=e[33];let V;e[34]!==S||e[35]!==c||e[36]!==I?(V=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,I,S]}),e[34]=S,e[35]=c,e[36]=I,e[37]=V):V=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,V,M&&y.length===0?(0,t.jsx)(Ee,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Ke,{className:"overflow-hidden py-0",children:(0,t.jsx)(Te,{className:"px-0",children:(0,t.jsxs)(Le,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(Ve,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as g}from"./chunk-
|
|
1
|
+
import{j as g}from"./chunk-OOOT4H45.js";import{a as y}from"./chunk-GWNGVKLG.js";import{a as x}from"./chunk-6G3E4PJ2.js";import{a,d as b}from"./chunk-5PEAXTYQ.js";var k=b(y(),1),n=b(x(),1);var _=a(function(o,d,s){let t=(0,k.c)(15),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={kind:"loading"},t[0]=c):c=t[0];let[h,E]=(0,n.useState)(c),r;t[1]!==d?(r=a(async()=>d(),"f"),t[1]=d,t[2]=r):r=t[2];let p=(0,n.useEffectEvent)(r),f;t[3]!==s?(f=a(e=>s(e),"m"),t[3]=s,t[4]=f):f=t[4];let v=(0,n.useEffectEvent)(f),i;t[5]!==v||t[6]!==p||t[7]!==o?(i=a(()=>{if(o!==void 0)return;let e=!1;return p().then(l=>(e||E(v(l)),l)).catch(l=>{e||E({kind:"error",message:g(l)})}),()=>{e=!0}},"u"),t[5]=v,t[6]=p,t[7]=o,t[8]=i):i=t[8];let m;t[9]!==o?(m=[o],t[9]=o,t[10]=m):m=t[10],(0,n.useEffect)(i,m);let u;return t[11]!==s||t[12]!==h||t[13]!==o?(u=o===void 0?h:s(o),t[11]=s,t[12]=h,t[13]=o,t[14]=u):u=t[14],u},"$");export{_ as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as u,s as f}from"./chunk-
|
|
1
|
+
import{j as u,s as f}from"./chunk-OOOT4H45.js";import{a as S}from"./chunk-GWNGVKLG.js";import{a as h}from"./chunk-6G3E4PJ2.js";import{a as s,d as l}from"./chunk-5PEAXTYQ.js";var i=l(S(),1),c=l(h(),1);var g=s(()=>{let t=(0,i.c)(4),[a,n]=(0,c.useState)(!1),[e,m]=(0,c.useState)(null),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s(p=>{f((async()=>{n(!0),m(null);try{await p()}catch(b){m(u(b))}n(!1)})())},"e"),t[0]=r):r=t[0];let y=r,o;return t[1]!==a||t[2]!==e?(o={busy:a,error:e,run:y},t[1]=a,t[2]=e,t[3]=o):o=t[3],o},"g");export{g as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./chunk-
|
|
1
|
+
import{a as q}from"./chunk-5BXW4BR6.js";import"./chunk-SGIBDCPB.js";import{a as k}from"./chunk-JG74C6DH.js";import"./chunk-ONTGYVAN.js";import"./chunk-Y2YLTUMD.js";import"./chunk-BG2CJOVS.js";import{a as A}from"./chunk-J45HAKBU.js";import{a as $}from"./chunk-FHKZP25N.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import"./chunk-Q3WMP7OA.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import"./chunk-VUOEJJUH.js";import{a as E}from"./chunk-XMOG3LIP.js";import{b as j}from"./chunk-K5BAERB3.js";import"./chunk-YUVGMKHG.js";import{a as F}from"./chunk-E5LR7G22.js";import"./chunk-F7EKRF7I.js";import"./chunk-O7XG7DTU.js";import"./chunk-O24UFHUY.js";import"./chunk-4PI2OSSP.js";import{a as S}from"./chunk-2W4UO5BC.js";import{c as I}from"./chunk-5X6BEWUI.js";import{a as w,e as O}from"./chunk-PDBCAPP6.js";import"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as T,w as C}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import{a as D}from"./chunk-GWNGVKLG.js";import{b as H}from"./chunk-6G3E4PJ2.js";import{a as p,d as _}from"./chunk-5PEAXTYQ.js";var K=_(D(),1);var m=_(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,K.c)(34),{card:t,onOpenTrace:n}=s,a=T(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[C(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(j,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(w,{"data-testid":"ev-card",children:(0,m.jsxs)(O,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,K.c)(21),{initialShardKey:t}=s,n=T(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=I(S.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=I(S.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==a||e[11]!==l||e[12]!==o||e[13]!==n){let f=R(P(U(d)),Q(g)),y;e[15]!==l||e[16]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[15]=l,e[16]=o,e[17]=y):y=e[17];let b;e[18]!==u||e[19]!==a?(b=u===null?null:(0,m.jsx)(F,{error:u,shardKey:a,testId:"ev-error"}),e[18]=u,e[19]=a,e[20]=b):b=e[20],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(E,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(M=>(0,m.jsx)(z,{card:M,onOpenTrace:i},M.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=a,e[11]=l,e[12]=o,e[13]=n,e[14]=v}else v=e[14];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as z}from"./chunk-
|
|
1
|
+
import{a as z}from"./chunk-Q65X2ZIP.js";import{a as _}from"./chunk-XMOG3LIP.js";import{b as x}from"./chunk-K5BAERB3.js";import"./chunk-YUVGMKHG.js";import{a as B,b as E,c as L,d as S,e as i,f as s}from"./chunk-TZ5PSNZW.js";import{b as W}from"./chunk-5X6BEWUI.js";import{a as A,e as q}from"./chunk-PDBCAPP6.js";import{m as O}from"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as H}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import{a as $}from"./chunk-GWNGVKLG.js";import{b as D}from"./chunk-6G3E4PJ2.js";import{a as R,d as M}from"./chunk-5PEAXTYQ.js";var I=M($(),1);var n=M(D(),1);var F=2e3,G=new Set(["open"]),ie=R(Q=>{let e=(0,I.c)(41),{read:y}=Q,t=H(),j=O(),v;e[0]!==j||e[1]!==y?(v=R(()=>Promise.resolve(y?y():j.debug()),"T"),e[0]=j,e[1]=y,e[2]=v):v=e[2];let V=v,K=y?"injected":"live",b;e[3]!==K?(b=["lunora-studio","sync-client-debug",K],e[3]=K,e[4]=b):b=e[4];let{data:c,poll:Y}=W(b,V);if(z(Y,!0,F),!c){let r;e[5]!==t?(r=t("Reading the sync client's state\u2026"),e[5]=t,e[6]=r):r=e[6];let g;e[7]!==t?(g=t("Sync client"),e[7]=t,e[8]=g):g=e[8];let T;return e[9]!==r||e[10]!==g?(T=(0,n.jsx)(A,{children:(0,n.jsx)(q,{children:(0,n.jsx)(_,{description:r,title:g})})}),e[9]=r,e[10]=g,e[11]=T):T=e[11],T}let{pendingWrites:k,shards:N,subscriptions:w}=c,l;e[12]!==t?(l=t("This Studio session's sync client"),e[12]=t,e[13]=l):l=e[13];let a;e[14]!==l?(a=(0,n.jsx)("span",{className:"text-sm font-medium",children:l}),e[14]=l,e[15]=a):a=e[15];let P=c.connectionStatus==="connected"?"default":"secondary",o;e[16]!==c.connectionStatus||e[17]!==P?(o=(0,n.jsx)(x,{variant:P,children:c.connectionStatus}),e[16]=c.connectionStatus,e[17]=P,e[18]=o):o=e[18];let d;e[19]!==k||e[20]!==t?(d=k>0?(0,n.jsx)(x,{variant:"secondary",children:t("{count} pending writes",{count:k})}):null,e[19]=k,e[20]=t,e[21]=d):d=e[21];let h;e[22]!==a||e[23]!==o||e[24]!==d?(h=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a,o,d]}),e[22]=a,e[23]=o,e[24]=d,e[25]=h):h=e[25];let u;e[26]!==t?(u=t("Reads client.debug() for the client running in this page \u2014 not your application's client. Call client.debug() in your app to diagnose a specific stuck overlay there."),e[26]=t,e[27]=u):u=e[27];let m;e[28]!==u?(m=(0,n.jsx)("p",{className:"text-muted-foreground text-xs",children:u}),e[28]=u,e[29]=m):m=e[29];let p;e[30]!==N||e[31]!==t?(p=N.length===0?(0,n.jsx)(_,{description:t("No shard connection has been opened yet."),title:t("No shards")}):(0,n.jsxs)(B,{children:[(0,n.jsx)(E,{children:(0,n.jsxs)(S,{children:[(0,n.jsx)(i,{children:t("Shard")}),(0,n.jsx)(i,{children:t("Socket")}),(0,n.jsx)(i,{children:t("Confirmed watermark")})]})}),(0,n.jsx)(L,{children:N.map(r=>(0,n.jsxs)(S,{children:[(0,n.jsx)(s,{children:r.shardKey??t("(default)")}),(0,n.jsx)(s,{children:(0,n.jsx)(x,{variant:G.has(r.wsState)?"default":"secondary",children:r.wsState})}),(0,n.jsx)(s,{children:r.confirmedMutationWatermark})]},r.shardKey??"__default__"))})]}),e[30]=N,e[31]=t,e[32]=p):p=e[32];let f;e[33]!==w||e[34]!==t?(f=w.length===0?(0,n.jsx)(_,{description:t("This client holds no live queries or shapes."),title:t("No subscriptions")}):(0,n.jsxs)(B,{children:[(0,n.jsx)(E,{children:(0,n.jsxs)(S,{children:[(0,n.jsx)(i,{children:t("Subscription")}),(0,n.jsx)(i,{children:t("Kind")}),(0,n.jsx)(i,{children:t("Acked")}),(0,n.jsx)(i,{children:t("Cursor")}),(0,n.jsx)(i,{children:t("Pending overlays")})]})}),(0,n.jsx)(L,{children:w.map(r=>(0,n.jsxs)(S,{children:[(0,n.jsx)(s,{className:"font-mono text-xs",children:r.functionPath}),(0,n.jsx)(s,{children:r.kind}),(0,n.jsx)(s,{children:(0,n.jsx)(x,{variant:r.acked?"default":"secondary",children:r.acked?t("yes"):t("no")})}),(0,n.jsx)(s,{children:r.serverCursor??"\u2014"}),(0,n.jsx)(s,{children:r.pendingOptimisticLayers})]},r.id))})]}),e[33]=w,e[34]=t,e[35]=f):f=e[35];let C;return e[36]!==m||e[37]!==p||e[38]!==f||e[39]!==h?(C=(0,n.jsx)(A,{children:(0,n.jsxs)(q,{className:"flex flex-col gap-4",children:[h,m,p,f]})}),e[36]=m,e[37]=p,e[38]=f,e[39]=h,e[40]=C):C=e[40],C},"ie");export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ke}from"./chunk-CHRUVO6R.js";import{g as we}from"./chunk-UUWJUMOH.js";import"./chunk-GXTSE66Z.js";import"./chunk-YPNUYWQA.js";import"./chunk-CL3JOU6F.js";import{a as ne}from"./chunk-XTU27CFW.js";import"./chunk-KTK4NDWQ.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-HUFK6COH.js";import"./chunk-QAOZXPLU.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-VRBDHZHG.js";import"./chunk-ZSWW2UGP.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import{i as ye}from"./chunk-EU4ZGNNW.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as me}from"./chunk-PACPUEWB.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as de}from"./chunk-LJKB6B3H.js";import{b as oe}from"./chunk-SVFX7F32.js";import"./chunk-YUVGMKHG.js";import{a as re,b as le,c as ae,d as B,e as S,f as J}from"./chunk-J66QR7WA.js";import"./chunk-R47IHY6Y.js";import"./chunk-4PI2OSSP.js";import"./chunk-2W4UO5BC.js";import{b as te}from"./chunk-RL5SUZ6J.js";import{a as Q,e as X}from"./chunk-ZHH5ZUAS.js";import{m as se}from"./chunk-7AJWGPWM.js";import"./chunk-ZPQBVYNN.js";import{B as V,j as ce,k as ge,s as G,w as ee,x as Ne}from"./chunk-BVANRUU4.js";import"./chunk-PDBW6GTJ.js";import{a as ve}from"./chunk-GWNGVKLG.js";import{a as xe,b as be}from"./chunk-6G3E4PJ2.js";import{a as b,d as ie}from"./chunk-5PEAXTYQ.js";var Y=ie(ve(),1),U=ie(xe(),1);var t=ie(be(),1);var Ce=ie(ve(),1),he=ie(xe(),1);var F=ie(be(),1);var Ae=b(r=>Number.isFinite(r)?ee(r,"\u2014"):"\u2014","X"),je=b(r=>r.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),"F"),Ie=b((r,e,u)=>e!==void 0?e:u===void 0?a=>r.cancelScheduledJob(a):void 0,"Y"),Se=b(r=>{let e=(0,Ce.c)(16),{cancelJob:u,loadJobs:a}=r===void 0?{}:r,o=se(),l=V(),n=a===void 0,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=["lunora-scheduled-jobs"],e[0]=s):s=e[0];let N=te(s,async()=>{let p=await(a??(()=>o.listScheduledJobs()))();return je(p)}),[y,i]=(0,he.useState)(void 0),[h,g]=(0,he.useState)(void 0),v,f;e[1]!==o||e[2]!==n?(v=b(()=>{if(n)return o.subscribeScheduledJobs(p=>{g(void 0),i(je(p))})},"v"),f=[n,o],e[1]=o,e[2]=n,e[3]=v,e[4]=f):(v=e[3],f=e[4]),(0,he.useEffect)(v,f);let d;e[5]!==N?(d=b(()=>N.poll(),"y"),e[5]=N,e[6]=d):d=e[6],ne(d,!n);let c=Ie(o,u,a),m=y??N.data,k=h??N.error,w=b(async p=>{if(c!==void 0){g(void 0);try{await c(p),n||N.refetch()}catch(L){g(ce(L))}}},"E"),T="flex flex-col gap-3",j="lunora-scheduled-jobs",$;e[7]!==k?($=k!==null&&(0,F.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:k}),e[7]=k,e[8]=$):$=e[8];let C;e[9]!==m?.length||e[10]!==l?(C=m?.length===0&&(0,F.jsx)(de,{description:l("Jobs queued with runAfter / runAt will appear here."),icon:(0,F.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,F.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,F.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:l("No scheduled jobs.")}),e[9]=m?.length,e[10]=l,e[11]=C):C=e[11];let I=m!==void 0&&m.length>0&&(0,F.jsx)(Q,{className:"overflow-hidden py-0",children:(0,F.jsx)(X,{className:"px-0",children:(0,F.jsxs)(re,{"data-testid":"sj-table",children:[(0,F.jsx)(le,{children:(0,F.jsxs)(B,{children:[(0,F.jsx)(S,{children:l("function")}),(0,F.jsx)(S,{children:l("scheduled for")}),(0,F.jsx)(S,{children:l("pool")}),(0,F.jsx)(S,{children:l("attempts")}),(0,F.jsx)(S,{children:l("shard")}),(0,F.jsx)(S,{children:l("id")}),c!==void 0&&(0,F.jsx)(S,{"aria-label":l("Actions")})]})}),(0,F.jsx)(ae,{children:m.map(p=>(0,F.jsxs)(B,{"data-testid":`sj-row-${p.id}`,children:[(0,F.jsx)(J,{className:"font-mono text-xs",children:p.workflow??p.functionPath}),(0,F.jsx)(J,{className:"text-muted-foreground tabular-nums",children:Ae(p.scheduledFor)}),(0,F.jsx)(J,{className:"font-mono text-xs",children:p.pool??""}),(0,F.jsx)(J,{className:"tabular-nums",children:p.attempts??0}),(0,F.jsx)(J,{children:p.shardKey??""}),(0,F.jsx)(J,{className:"font-mono text-xs",children:p.id}),c!==void 0&&(0,F.jsx)(J,{className:"text-right",children:(0,F.jsx)(ue,{confirmLabel:l("Cancel job?"),onConfirm:b(()=>{G(w(p.id))},"onConfirm"),testId:`sj-cancel-${p.id}`,children:l("Cancel")})})]},p.id))})]})})}),A;return e[12]!==I||e[13]!==$||e[14]!==C?(A=(0,F.jsxs)("div",{className:T,"data-testid":j,children:[$,C,I]}),e[12]=I,e[13]=$,e[14]=C,e[15]=A):A=e[15],A},"he");var Je={failed:"destructive",skipped:"warning",succeeded:"success"},Le=25,Te=b(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"we"),Fe=b(r=>{let e=(0,Y.c)(39),{inFlight:u,last:a}=r,o=V();if(u!==void 0){let c;e[0]!==o?(c=o("running"),e[0]=o,e[1]=c):c=e[1];let m;e[2]!==c?(m=(0,t.jsx)(oe,{variant:"info",children:c}),e[2]=c,e[3]=m):m=e[3];let k;e[4]!==u.startedAt?(k=ee(u.startedAt,"\u2014"),e[4]=u.startedAt,e[5]=k):k=e[5];let w;e[6]!==k?(w=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[6]=k,e[7]=w):w=e[7];let T;e[8]!==u.skipped||e[9]!==o?(T=u.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o("{count} ticks skipped",{count:u.skipped})}),e[8]=u.skipped,e[9]=o,e[10]=T):T=e[10];let j;return e[11]!==m||e[12]!==w||e[13]!==T?(j=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,w,T]}),e[11]=m,e[12]=w,e[13]=T,e[14]=j):j=e[14],j}if(a===void 0){let c;e[15]!==o?(c=o("never"),e[15]=o,e[16]=c):c=e[16];let m;return e[17]!==c?(m=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=m):m=e[18],m}let l;e[19]!==o?(l=o("failed"),e[19]=o,e[20]=l):l=e[20];let n;e[21]!==o?(n=o("skipped"),e[21]=o,e[22]=n):n=e[22];let s;e[23]!==o?(s=o("succeeded"),e[23]=o,e[24]=s):s=e[24];let N;e[25]!==l||e[26]!==n||e[27]!==s?(N={failed:l,skipped:n,succeeded:s},e[25]=l,e[26]=n,e[27]=s,e[28]=N):N=e[28];let y=N,i=Je[a.status],h=y[a.status],g;e[29]!==i||e[30]!==h?(g=(0,t.jsx)(oe,{variant:i,children:h}),e[29]=i,e[30]=h,e[31]=g):g=e[31];let v;e[32]!==a.startedAt?(v=ee(a.startedAt,"\u2014"),e[32]=a.startedAt,e[33]=v):v=e[33];let f;e[34]!==v?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:v}),e[34]=v,e[35]=f):f=e[35];let d;return e[36]!==g||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[g,f]}),e[36]=g,e[37]=f,e[38]=d):d=e[38],d},"ke"),De=b(r=>{let e=(0,Y.c)(80),{runs:u}=r,a=V();if(u.length===0)return;let o,l,n,s,N,y,i,h,g,v,f;if(e[0]!==u||e[1]!==a){let T=u.toSorted(qe).slice(0,Le),j;e[13]!==a?(j=a("failed"),e[13]=a,e[14]=j):j=e[14];let $;e[15]!==a?($=a("skipped"),e[15]=a,e[16]=$):$=e[16];let C;e[17]!==a?(C=a("succeeded"),e[17]=a,e[18]=C):C=e[18];let I;e[19]!==C||e[20]!==j||e[21]!==$?(I={failed:j,skipped:$,succeeded:C},e[19]=C,e[20]=j,e[21]=$,e[22]=I):I=e[22];let A=I;g="flex flex-col gap-2",v="cron-run-history";let p;e[23]!==a?(p=a("Recent runs"),e[23]=a,e[24]=p):p=e[24],e[25]!==p?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:p}),e[25]=p,e[26]=f):f=e[26],s=Q,h="overflow-hidden py-0",n=X,i="px-0",l=re;let L;e[27]!==a?(L=a("name"),e[27]=a,e[28]=L):L=e[28];let x;e[29]!==L?(x=(0,t.jsx)(S,{children:L}),e[29]=L,e[30]=x):x=e[30];let D;e[31]!==a?(D=a("status"),e[31]=a,e[32]=D):D=e[32];let E;e[33]!==D?(E=(0,t.jsx)(S,{children:D}),e[33]=D,e[34]=E):E=e[34];let R;e[35]!==a?(R=a("started"),e[35]=a,e[36]=R):R=e[36];let P;e[37]!==R?(P=(0,t.jsx)(S,{children:R}),e[37]=R,e[38]=P):P=e[38];let Z;e[39]!==a?(Z=a("duration"),e[39]=a,e[40]=Z):Z=e[40];let O;e[41]!==Z?(O=(0,t.jsx)(S,{children:Z}),e[41]=Z,e[42]=O):O=e[42];let H;e[43]!==a?(H=a("skipped"),e[43]=a,e[44]=H):H=e[44];let _;e[45]!==H?(_=(0,t.jsx)(S,{children:H}),e[45]=H,e[46]=_):_=e[46];let z;e[47]!==a?(z=a("error"),e[47]=a,e[48]=z):z=e[48];let K;e[49]!==z?(K=(0,t.jsx)(S,{children:z}),e[49]=z,e[50]=K):K=e[50],e[51]!==x||e[52]!==E||e[53]!==P||e[54]!==O||e[55]!==_||e[56]!==K?(y=(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[x,E,P,O,_,K]})}),e[51]=x,e[52]=E,e[53]=P,e[54]=O,e[55]=_,e[56]=K,e[57]=y):y=e[57],o=ae;let W;e[58]!==A?(W=b(M=>(0,t.jsxs)(B,{"data-testid":`cron-run-row-${M.runId}`,children:[(0,t.jsx)(J,{children:M.name}),(0,t.jsx)(J,{children:(0,t.jsx)(oe,{variant:Je[M.status],children:A[M.status]})}),(0,t.jsx)(J,{className:"text-muted-foreground tabular-nums",children:ee(M.startedAt,"\u2014")}),(0,t.jsx)(J,{className:"tabular-nums",children:M.status==="skipped"?"":Te(M.durationMs)}),(0,t.jsx)(J,{className:"tabular-nums",children:M.skipped>0?M.skipped:""}),(0,t.jsx)(J,{className:"text-xs text-destructive",children:M.error??""})]},M.runId),"B"),e[58]=A,e[59]=W):W=e[59],N=T.map(W),e[0]=u,e[1]=a,e[2]=o,e[3]=l,e[4]=n,e[5]=s,e[6]=N,e[7]=y,e[8]=i,e[9]=h,e[10]=g,e[11]=v,e[12]=f}else o=e[2],l=e[3],n=e[4],s=e[5],N=e[6],y=e[7],i=e[8],h=e[9],g=e[10],v=e[11],f=e[12];let d;e[60]!==o||e[61]!==N?(d=(0,t.jsx)(o,{children:N}),e[60]=o,e[61]=N,e[62]=d):d=e[62];let c;e[63]!==l||e[64]!==y||e[65]!==d?(c=(0,t.jsxs)(l,{children:[y,d]}),e[63]=l,e[64]=y,e[65]=d,e[66]=c):c=e[66];let m;e[67]!==n||e[68]!==i||e[69]!==c?(m=(0,t.jsx)(n,{className:i,children:c}),e[67]=n,e[68]=i,e[69]=c,e[70]=m):m=e[70];let k;e[71]!==s||e[72]!==m||e[73]!==h?(k=(0,t.jsx)(s,{className:h,children:m}),e[71]=s,e[72]=m,e[73]=h,e[74]=k):k=e[74];let w;return e[75]!==k||e[76]!==g||e[77]!==v||e[78]!==f?(w=(0,t.jsxs)("div",{className:g,"data-testid":v,children:[f,k]}),e[75]=k,e[76]=g,e[77]=v,e[78]=f,e[79]=w):w=e[79],w},"Ce");function qe(r,e){return e.startedAt-r.startedAt}b(qe,"Te");var Re=b(()=>{let r=(0,Y.c)(50),e=V(),u=ke(""),[a,o]=(0,U.useState)(""),[l,n]=(0,U.useState)(void 0),[s,N]=(0,U.useState)(!1);if(u.unavailable)return null;let y;r[0]!==u?(y=u.pending("cron"),r[0]=u,r[1]=y):y=r[1];let i=y,h;r[2]!==u?(h=u.reason("cron"),r[2]=u,r[3]=h):h=r[3];let g=h,v;r[4]!==a||r[5]!==u?(v=b(()=>{let R=a.trim();R!==""&&G((async()=>{let P=await u.suggestCron(R);N(!1),n(P)})())},"x"),r[4]=a,r[5]=u,r[6]=v):v=r[6];let f=v,d;r[7]!==l?(d=b(()=>{let R="navigator"in globalThis?globalThis.navigator.clipboard:void 0;R===void 0||l===void 0||G((async()=>{try{await R.writeText(l),N(!0)}catch{N(!1)}})())},"o"),r[7]=l,r[8]=d):d=r[8];let c=d,m;r[9]!==e?(m=e("Describe a schedule"),r[9]=e,r[10]=m):m=r[10];let k;r[11]===Symbol.for("react.memo_cache_sentinel")?(k=b(R=>{o(R.target.value)},"b"),r[11]=k):k=r[11];let w;r[12]!==f?(w=b(R=>{R.key==="Enter"&&(R.preventDefault(),f())},"y"),r[12]=f,r[13]=w):w=r[13];let T;r[14]!==e?(T=e("Describe a schedule"),r[14]=e,r[15]=T):T=r[15];let j;r[16]!==i||r[17]!==a||r[18]!==m||r[19]!==w||r[20]!==T?(j=(0,t.jsx)(ye,{"aria-label":m,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:i,onChange:k,onKeyDown:w,placeholder:T,value:a}),r[16]=i,r[17]=a,r[18]=m,r[19]=w,r[20]=T,r[21]=j):j=r[21];let $=i&&"opacity-60",C;r[22]!==$?(C=Ne("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",$),r[22]=$,r[23]=C):C=r[23];let I;r[24]!==i||r[25]!==a?(I=i||a.trim()==="",r[24]=i,r[25]=a,r[26]=I):I=r[26];let A;r[27]!==i||r[28]!==e?(A=e(i?"Thinking\u2026":"Suggest schedule"),r[27]=i,r[28]=e,r[29]=A):A=r[29];let p;r[30]!==f||r[31]!==C||r[32]!==I||r[33]!==A?(p=(0,t.jsx)("button",{className:C,"data-testid":"cron-assistant-generate",disabled:I,onClick:f,type:"button",children:A}),r[30]=f,r[31]=C,r[32]=I,r[33]=A,r[34]=p):p=r[34];let L;r[35]!==p||r[36]!==j?(L=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j,p]}),r[35]=p,r[36]=j,r[37]=L):L=r[37];let x;r[38]!==s||r[39]!==c||r[40]!==l||r[41]!==e?(x=l!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:l}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:c,type:"button",children:e(s?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=s,r[39]=c,r[40]=l,r[41]=e,r[42]=x):x=r[42];let D;r[43]!==g||r[44]!==e?(D=g!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(g==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=g,r[44]=e,r[45]=D):D=r[45];let E;return r[46]!==L||r[47]!==x||r[48]!==D?(E=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[L,x,D]}),r[46]=L,r[47]=x,r[48]=D,r[49]=E):E=r[49],E},"Se"),Ee={kind:"idle"},Me="SCHEDULER_NOT_CONFIGURED",pe={inFlight:[],runs:[]},Be=b((r,e,u)=>u!==void 0?u:e===void 0?a=>r.runCronJob(a):void 0,"Ae"),Pe=b(({loadCronJobs:r,loadCronRuns:e,runCronJob:u}={})=>{let a=se(),o=V(),[l,n]=(0,U.useState)({}),s=te(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>a.getCronJobs()))()),{data:N,error:y}=s,i=e??(r===void 0?()=>a.listCronRuns():void 0),h=te(["lunora-cron-runs",e?"custom":"default"],async()=>i===void 0?pe:i().catch(d=>{if(ge(d)===Me)return pe;throw d})),g=h.data??pe;ne(()=>h.poll(),i!==void 0);let v=Be(a,r,u),f=b(async d=>{if(v!==void 0){n(c=>({...c,[d]:{kind:"running"}}));try{await v(d),n(c=>({...c,[d]:{kind:"ok"}})),s.refetch(),h.refetch()}catch(c){n(m=>({...m,[d]:{kind:"error",message:ce(c)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(Re,{}),y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:y}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),N?.length===0&&(0,t.jsx)(de,{description:o("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:o("No cron triggers.")}),N!==void 0&&N.length>0&&(0,t.jsx)(Q,{className:"overflow-hidden py-0",children:(0,t.jsx)(X,{className:"px-0",children:(0,t.jsxs)(re,{"data-testid":"cron-table",children:[(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(S,{children:o("name")}),(0,t.jsx)(S,{children:o("schedule")}),(0,t.jsx)(S,{children:o("target")}),(0,t.jsx)(S,{children:o("shard")}),(0,t.jsx)(S,{children:o("last run")}),v!==void 0&&(0,t.jsx)(S,{"aria-label":o("Actions")})]})}),(0,t.jsx)(ae,{children:N.map(d=>{let c=l[d.name]??Ee;return(0,t.jsxs)(B,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(J,{children:d.name}),(0,t.jsx)(J,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(J,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:o("function")}):(0,t.jsx)(oe,{variant:"secondary",children:o("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(J,{children:d.shardKey??""}),(0,t.jsx)(J,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Fe,{inFlight:g.inFlight.find(m=>m.name===d.name),last:g.runs.find(m=>m.name===d.name)})}),v!==void 0&&(0,t.jsx)(J,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[c.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:o("ran")}),c.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:c.message}),(0,t.jsx)(ue,{confirmLabel:o("Run now?"),disabled:c.kind==="running",onConfirm:b(()=>{G(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:c.kind==="running"?o("Running\u2026"):o("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(De,{runs:g.runs})]})},"Le"),He=b(r=>Number.isFinite(r)?ee(r,"\u2014"):"\u2014","Re"),Ke=b(r=>{let e=(0,Y.c)(34),u;e[0]!==r?(u=r===void 0?{}:r,e[0]=r,e[1]=u):u=e[1];let{loadJobs:a,removeJob:o,retryJob:l}=u,n=se(),s=V(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let y;e[3]!==n||e[4]!==a?(y=b(async()=>(await(a??(()=>n.listDeadJobs()))()).toSorted(We),"v"),e[3]=n,e[4]=a,e[5]=y):y=e[5];let i=te(N,y),h=i.data,[g,v]=(0,U.useState)(void 0),f=i.error??g,d=a===void 0,c;e[6]!==n||e[7]!==d||e[8]!==l?(c=l??(d?x=>n.retryDeadJob(x):void 0),e[6]=n,e[7]=d,e[8]=l,e[9]=c):c=e[9];let m=c,k;e[10]!==n||e[11]!==d||e[12]!==o?(k=o??(d?x=>n.removeDeadJob(x):void 0),e[10]=n,e[11]=d,e[12]=o,e[13]=k):k=e[13];let w=k,T;e[14]!==i?(T=b(()=>i.poll(),"I"),e[14]=i,e[15]=T):T=e[15],ne(T,!0);let j;e[16]!==i?(j=b(async x=>{v(void 0);try{await x,i.refetch()}catch(D){v(ce(D))}},"w"),e[16]=i,e[17]=j):j=e[17];let $=j,C=m!==void 0||w!==void 0,I;e[18]!==f?(I=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=I):I=e[19];let A;e[20]!==h?.length||e[21]!==s?(A=h?.length===0&&(0,t.jsx)(de,{description:s("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:s("No dead-letter jobs.")}),e[20]=h?.length,e[21]=s,e[22]=A):A=e[22];let p;e[23]!==$||e[24]!==C||e[25]!==h||e[26]!==w||e[27]!==m||e[28]!==s?(p=h!==void 0&&h.length>0&&(0,t.jsx)(Q,{className:"overflow-hidden py-0",children:(0,t.jsx)(X,{className:"px-0",children:(0,t.jsxs)(re,{"data-testid":"dlq-table",children:[(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(S,{children:s("function")}),(0,t.jsx)(S,{children:s("attempts")}),(0,t.jsx)(S,{children:s("last tried")}),(0,t.jsx)(S,{children:s("pool")}),(0,t.jsx)(S,{children:s("shard")}),(0,t.jsx)(S,{children:s("id")}),C&&(0,t.jsx)(S,{"aria-label":s("Actions")})]})}),(0,t.jsx)(ae,{children:h.map(x=>(0,t.jsxs)(B,{"data-testid":`dlq-row-${x.id}`,children:[(0,t.jsx)(J,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,t.jsx)(J,{className:"tabular-nums",children:x.attempts??0}),(0,t.jsx)(J,{className:"text-muted-foreground tabular-nums",children:He(x.scheduledFor)}),(0,t.jsx)(J,{className:"font-mono text-xs",children:x.pool??""}),(0,t.jsx)(J,{children:x.shardKey??""}),(0,t.jsx)(J,{className:"font-mono text-xs",children:x.id}),C&&(0,t.jsx)(J,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[m!==void 0&&(0,t.jsx)(me,{"data-testid":`dlq-retry-${x.id}`,onClick:b(()=>{G($(m(x.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Retry")}),w!==void 0&&(0,t.jsx)(ue,{confirmLabel:s("Drop job?"),onConfirm:b(()=>{G($(w(x.id)))},"onConfirm"),testId:`dlq-remove-${x.id}`,children:s("Drop")})]})})]},x.id))})]})})}),e[23]=$,e[24]=C,e[25]=h,e[26]=w,e[27]=m,e[28]=s,e[29]=p):p=e[29];let L;return e[30]!==p||e[31]!==I||e[32]!==A?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[I,A,p]}),e[30]=p,e[31]=I,e[32]=A,e[33]=L):L=e[33],L},"De");function We(r,e){return(e.attempts??0)-(r.attempts??0)}b(We,"Ee");var Ve={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},_e=b(r=>{let e=(0,Y.c)(47),u;e[0]!==r?(u=r===void 0?{}:r,e[0]=r,e[1]=u):u=e[1];let{loadJobs:a}=u,o=se(),l=V(),n;e[2]!==o||e[3]!==a?(n=a??(async q=>o.listScheduledHistory(q===void 0?{}:{cursor:q})),e[2]=o,e[3]=a,e[4]=n):n=e[4];let s=n,N=a?"custom":"default",y;e[5]!==N?(y=["lunora-job-history",N],e[5]=N,e[6]=y):y=e[6];let i;e[7]!==s?(i=b(async()=>s(),"d"),e[7]=s,e[8]=i):i=e[8];let h=te(y,i),[g,v]=(0,U.useState)(void 0),[f,d]=(0,U.useState)(!1),[c,m]=(0,U.useState)(void 0),k=h.data?.records,w;e[9]!==k?(w=new Set(k?.map(ze)),e[9]=k,e[10]=w):w=e[10];let T=w,j=k===void 0?void 0:[...k,...(g?.records??[]).filter(q=>!T.has(q.id))],$=g===void 0?h.data?.cursor:g.cursor,C;e[11]!==s||e[12]!==$?(C=b(async()=>{d(!0),m(void 0);try{let q=await s($);v($e=>({cursor:q.cursor,records:[...$e?.records??[],...q.records]})),d(!1)}catch(q){m(ce(q)),d(!1)}},"S"),e[11]=s,e[12]=$,e[13]=C):C=e[13];let I=C,A;e[14]!==l?(A=l("canceled"),e[14]=l,e[15]=A):A=e[15];let p;e[16]!==l?(p=l("failed"),e[16]=l,e[17]=p):p=e[17];let L;e[18]!==l?(L=l("pending"),e[18]=l,e[19]=L):L=e[19];let x;e[20]!==l?(x=l("running"),e[20]=l,e[21]=x):x=e[21];let D;e[22]!==l?(D=l("succeeded"),e[22]=l,e[23]=D):D=e[23];let E;e[24]!==L||e[25]!==x||e[26]!==D||e[27]!==A||e[28]!==p?(E={canceled:A,failed:p,pending:L,running:x,succeeded:D},e[24]=L,e[25]=x,e[26]=D,e[27]=A,e[28]=p,e[29]=E):E=e[29];let R=E,P;e[30]!==h?(P=b(()=>h.poll(),"P"),e[30]=h,e[31]=P):P=e[31],ne(P,g===void 0);let Z="flex flex-col gap-3",O="lunora-job-history",H;e[32]!==h.error?(H=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=H):H=e[33];let _=j?.length===0&&(0,t.jsx)(de,{description:l("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:l("No finished jobs.")}),z=j!==void 0&&j.length>0&&(0,t.jsx)(Q,{className:"overflow-hidden py-0",children:(0,t.jsx)(X,{className:"px-0",children:(0,t.jsxs)(re,{"data-testid":"job-history-table",children:[(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(S,{children:l("function")}),(0,t.jsx)(S,{children:l("state")}),(0,t.jsx)(S,{children:l("finished")}),(0,t.jsx)(S,{children:l("error")}),(0,t.jsx)(S,{children:l("id")})]})}),(0,t.jsx)(ae,{children:j.map(q=>(0,t.jsxs)(B,{"data-testid":`job-history-row-${q.id}`,children:[(0,t.jsx)(J,{className:"font-mono text-xs",children:q.workflow??q.functionPath}),(0,t.jsx)(J,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${q.id}`,variant:Ve[q.state],children:R[q.state]})}),(0,t.jsx)(J,{className:"text-muted-foreground tabular-nums",children:ee(q.completedAt,"\u2014")}),(0,t.jsx)(J,{className:"text-xs text-destructive",children:q.error??""}),(0,t.jsx)(J,{className:"font-mono text-xs",children:q.id})]},q.id))})]})})}),K;e[34]!==c?(K=c!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:c}),e[34]=c,e[35]=K):K=e[35];let W;e[36]!==f||e[37]!==$||e[38]!==I||e[39]!==l?(W=$!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(me,{"data-testid":"job-history-load-more",disabled:f,onClick:b(()=>{G(I())},"onClick"),variant:"outline",children:l(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=$,e[38]=I,e[39]=l,e[40]=W):W=e[40];let M;return e[41]!==H||e[42]!==_||e[43]!==z||e[44]!==K||e[45]!==W?(M=(0,t.jsxs)("div",{className:Z,"data-testid":O,children:[H,_,z,K,W]}),e[41]=H,e[42]=_,e[43]=z,e[44]=K,e[45]=W,e[46]=M):M=e[46],M},"Je");function ze(r){return r.id}b(ze,"Fe");var fe=b(r=>{let e=(0,Y.c)(8),{label:u,testId:a,value:o}=r,l;e[0]!==u?(l=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[0]=u,e[1]=l):l=e[1];let n;e[2]!==a||e[3]!==o?(n=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":a,children:o}),e[2]=a,e[3]=o,e[4]=n):n=e[4];let s;return e[5]!==l||e[6]!==n?(s=(0,t.jsx)(Q,{className:"flex-1 py-0",children:(0,t.jsxs)(X,{className:"flex flex-col gap-1 p-4",children:[l,n]})}),e[5]=l,e[6]=n,e[7]=s):s=e[7],s},"de"),Ue=b(r=>{let e=(0,Y.c)(25),u;e[0]!==r?(u=r===void 0?{}:r,e[0]=r,e[1]=u):u=e[1];let{loadStatus:a}=u,o=se(),l=V(),n=a===void 0,s;e[2]!==n?(s=["lunora-scheduler-status",n],e[2]=n,e[3]=s):s=e[3];let N;e[4]!==o||e[5]!==a?(N=b(async()=>{let k=await(a??(()=>o.schedulerStatus()))();return{...k,pools:k.pools.toSorted(Ge)}},"N"),e[4]=o,e[5]=a,e[6]=N):N=e[6];let y=te(s,N),{data:i,error:h}=y,g;e[7]!==y?(g=b(()=>y.poll(),"g"),e[7]=y,e[8]=g):g=e[8],ne(g,!0);let v;e[9]!==h?(v=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:h}),e[9]=h,e[10]=v):v=e[10];let f;e[11]!==i||e[12]!==l?(f=i!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(fe,{label:l("backlog"),testId:"pools-backlog",value:i.backlog}),(0,t.jsx)(fe,{label:l("in flight"),testId:"pools-inflight",value:i.inFlight}),(0,t.jsx)(fe,{label:l("pools"),testId:"pools-count",value:i.pools.length})]}),e[11]=i,e[12]=l,e[13]=f):f=e[13];let d;e[14]!==i?.pools.length||e[15]!==l?(d=i?.pools.length===0&&(0,t.jsx)(de,{description:l("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:l("No workpools.")}),e[14]=i?.pools.length,e[15]=l,e[16]=d):d=e[16];let c;e[17]!==i||e[18]!==l?(c=i!==void 0&&i.pools.length>0&&(0,t.jsx)(Q,{className:"overflow-hidden py-0",children:(0,t.jsx)(X,{className:"px-0",children:(0,t.jsxs)(re,{"data-testid":"pools-table",children:[(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(S,{children:l("pool")}),(0,t.jsx)(S,{children:l("queued")}),(0,t.jsx)(S,{children:l("in flight")}),(0,t.jsx)(S,{children:l("max concurrency")})]})}),(0,t.jsx)(ae,{children:i.pools.map(Qe)})]})})}),e[17]=i,e[18]=l,e[19]=c):c=e[19];let m;return e[20]!==v||e[21]!==f||e[22]!==d||e[23]!==c?(m=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[v,f,d,c]}),e[20]=v,e[21]=f,e[22]=d,e[23]=c,e[24]=m):m=e[24],m},"Oe");function Ge(r,e){return e.queued-r.queued}b(Ge,"Pe");function Qe(r){return(0,t.jsxs)(B,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(J,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(J,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(J,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(J,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}b(Qe,"qe");var Xe=["jobs","history","dead","pools","cron"],jt=b(r=>{let e=(0,Y.c)(48),u;e[0]!==r?(u=r===void 0?{}:r,e[0]=r,e[1]=u):u=e[1];let{loadCronJobs:a,scheduledCancel:o,scheduledLoad:l}=u,n=V(),[s,N]=(0,U.useState)("jobs"),y;e[2]!==n?(y=n("Cron triggers"),e[2]=n,e[3]=y):y=e[3];let i;e[4]!==n?(i=n("Dead letter"),e[4]=n,e[5]=i):i=e[5];let h;e[6]!==n?(h=n("History"),e[6]=n,e[7]=h):h=e[7];let g;e[8]!==n?(g=n("Scheduled jobs"),e[8]=n,e[9]=g):g=e[9];let v;e[10]!==n?(v=n("Pools"),e[10]=n,e[11]=v):v=e[11];let f;e[12]!==y||e[13]!==i||e[14]!==h||e[15]!==g||e[16]!==v?(f={cron:y,dead:i,history:h,jobs:g,pools:v},e[12]=y,e[13]=i,e[14]=h,e[15]=g,e[16]=v,e[17]=f):f=e[17];let d=f,c;e[18]===Symbol.for("react.memo_cache_sentinel")?(c=b(x=>{N(x.currentTarget.dataset.view)},"c"),e[18]=c):c=e[18];let m=c,k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=(0,t.jsx)(we,{}),e[19]=k):k=e[19];let w;e[20]!==n?(w=n("Schedule view"),e[20]=n,e[21]=w):w=e[21];let T;e[22]!==s||e[23]!==d?(T=Xe.map(x=>(0,t.jsx)(me,{"aria-selected":s===x,"data-testid":`schedule-view-${x}`,"data-view":x,onClick:m,role:"tab",size:"sm",type:"button",variant:s===x?"default":"outline",children:d[x]},x)),e[22]=s,e[23]=d,e[24]=T):T=e[24];let j;e[25]!==w||e[26]!==T?(j=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:T}),e[25]=w,e[26]=T,e[27]=j):j=e[27];let $;e[28]!==o||e[29]!==l||e[30]!==s?($=s==="jobs"&&(0,t.jsx)(Se,{cancelJob:o,loadJobs:l}),e[28]=o,e[29]=l,e[30]=s,e[31]=$):$=e[31];let C;e[32]!==s?(C=s==="history"&&(0,t.jsx)(_e,{}),e[32]=s,e[33]=C):C=e[33];let I;e[34]!==s?(I=s==="dead"&&(0,t.jsx)(Ke,{}),e[34]=s,e[35]=I):I=e[35];let A;e[36]!==s?(A=s==="pools"&&(0,t.jsx)(Ue,{}),e[36]=s,e[37]=A):A=e[37];let p;e[38]!==a||e[39]!==s?(p=s==="cron"&&(0,t.jsx)(Pe,{loadCronJobs:a}),e[38]=a,e[39]=s,e[40]=p):p=e[40];let L;return e[41]!==j||e[42]!==$||e[43]!==C||e[44]!==I||e[45]!==A||e[46]!==p?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[k,j,$,C,I,A,p]}),e[41]=j,e[42]=$,e[43]=C,e[44]=I,e[45]=A,e[46]=p,e[47]=L):L=e[47],L},"it");export{jt as SchedulePanel};
|
|
1
|
+
import{a as ke}from"./chunk-OBYE3IXP.js";import{g as we}from"./chunk-ZM3A5WO5.js";import"./chunk-GXTSE66Z.js";import"./chunk-J77YDVBD.js";import"./chunk-CL3JOU6F.js";import{a as ne}from"./chunk-Q65X2ZIP.js";import"./chunk-KTK4NDWQ.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-7TTX42IR.js";import"./chunk-QAOZXPLU.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-MQBQBEGM.js";import"./chunk-ZSWW2UGP.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import{i as ye}from"./chunk-Q3WMP7OA.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as me}from"./chunk-5SKGLIO5.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as de}from"./chunk-XMOG3LIP.js";import{b as oe}from"./chunk-K5BAERB3.js";import"./chunk-YUVGMKHG.js";import{a as re,b as le,c as ae,d as B,e as S,f as J}from"./chunk-TZ5PSNZW.js";import"./chunk-O24UFHUY.js";import"./chunk-4PI2OSSP.js";import"./chunk-2W4UO5BC.js";import{b as te}from"./chunk-5X6BEWUI.js";import{a as Q,e as X}from"./chunk-PDBCAPP6.js";import{m as se}from"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as V,j as ce,k as ge,s as G,w as ee,x as Ne}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import{a as ve}from"./chunk-GWNGVKLG.js";import{a as xe,b as be}from"./chunk-6G3E4PJ2.js";import{a as b,d as ie}from"./chunk-5PEAXTYQ.js";var Y=ie(ve(),1),U=ie(xe(),1);var t=ie(be(),1);var Ce=ie(ve(),1),he=ie(xe(),1);var F=ie(be(),1);var Ae=b(r=>Number.isFinite(r)?ee(r,"\u2014"):"\u2014","X"),je=b(r=>r.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),"F"),Ie=b((r,e,u)=>e!==void 0?e:u===void 0?a=>r.cancelScheduledJob(a):void 0,"Y"),Se=b(r=>{let e=(0,Ce.c)(16),{cancelJob:u,loadJobs:a}=r===void 0?{}:r,o=se(),l=V(),n=a===void 0,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=["lunora-scheduled-jobs"],e[0]=s):s=e[0];let N=te(s,async()=>{let p=await(a??(()=>o.listScheduledJobs()))();return je(p)}),[y,i]=(0,he.useState)(void 0),[h,g]=(0,he.useState)(void 0),v,f;e[1]!==o||e[2]!==n?(v=b(()=>{if(n)return o.subscribeScheduledJobs(p=>{g(void 0),i(je(p))})},"v"),f=[n,o],e[1]=o,e[2]=n,e[3]=v,e[4]=f):(v=e[3],f=e[4]),(0,he.useEffect)(v,f);let d;e[5]!==N?(d=b(()=>N.poll(),"y"),e[5]=N,e[6]=d):d=e[6],ne(d,!n);let c=Ie(o,u,a),m=y??N.data,k=h??N.error,w=b(async p=>{if(c!==void 0){g(void 0);try{await c(p),n||N.refetch()}catch(L){g(ce(L))}}},"E"),T="flex flex-col gap-3",j="lunora-scheduled-jobs",$;e[7]!==k?($=k!==null&&(0,F.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:k}),e[7]=k,e[8]=$):$=e[8];let C;e[9]!==m?.length||e[10]!==l?(C=m?.length===0&&(0,F.jsx)(de,{description:l("Jobs queued with runAfter / runAt will appear here."),icon:(0,F.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,F.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,F.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:l("No scheduled jobs.")}),e[9]=m?.length,e[10]=l,e[11]=C):C=e[11];let I=m!==void 0&&m.length>0&&(0,F.jsx)(Q,{className:"overflow-hidden py-0",children:(0,F.jsx)(X,{className:"px-0",children:(0,F.jsxs)(re,{"data-testid":"sj-table",children:[(0,F.jsx)(le,{children:(0,F.jsxs)(B,{children:[(0,F.jsx)(S,{children:l("function")}),(0,F.jsx)(S,{children:l("scheduled for")}),(0,F.jsx)(S,{children:l("pool")}),(0,F.jsx)(S,{children:l("attempts")}),(0,F.jsx)(S,{children:l("shard")}),(0,F.jsx)(S,{children:l("id")}),c!==void 0&&(0,F.jsx)(S,{"aria-label":l("Actions")})]})}),(0,F.jsx)(ae,{children:m.map(p=>(0,F.jsxs)(B,{"data-testid":`sj-row-${p.id}`,children:[(0,F.jsx)(J,{className:"font-mono text-xs",children:p.workflow??p.functionPath}),(0,F.jsx)(J,{className:"text-muted-foreground tabular-nums",children:Ae(p.scheduledFor)}),(0,F.jsx)(J,{className:"font-mono text-xs",children:p.pool??""}),(0,F.jsx)(J,{className:"tabular-nums",children:p.attempts??0}),(0,F.jsx)(J,{children:p.shardKey??""}),(0,F.jsx)(J,{className:"font-mono text-xs",children:p.id}),c!==void 0&&(0,F.jsx)(J,{className:"text-right",children:(0,F.jsx)(ue,{confirmLabel:l("Cancel job?"),onConfirm:b(()=>{G(w(p.id))},"onConfirm"),testId:`sj-cancel-${p.id}`,children:l("Cancel")})})]},p.id))})]})})}),A;return e[12]!==I||e[13]!==$||e[14]!==C?(A=(0,F.jsxs)("div",{className:T,"data-testid":j,children:[$,C,I]}),e[12]=I,e[13]=$,e[14]=C,e[15]=A):A=e[15],A},"he");var Je={failed:"destructive",skipped:"warning",succeeded:"success"},Le=25,Te=b(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"we"),Fe=b(r=>{let e=(0,Y.c)(39),{inFlight:u,last:a}=r,o=V();if(u!==void 0){let c;e[0]!==o?(c=o("running"),e[0]=o,e[1]=c):c=e[1];let m;e[2]!==c?(m=(0,t.jsx)(oe,{variant:"info",children:c}),e[2]=c,e[3]=m):m=e[3];let k;e[4]!==u.startedAt?(k=ee(u.startedAt,"\u2014"),e[4]=u.startedAt,e[5]=k):k=e[5];let w;e[6]!==k?(w=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[6]=k,e[7]=w):w=e[7];let T;e[8]!==u.skipped||e[9]!==o?(T=u.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o("{count} ticks skipped",{count:u.skipped})}),e[8]=u.skipped,e[9]=o,e[10]=T):T=e[10];let j;return e[11]!==m||e[12]!==w||e[13]!==T?(j=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,w,T]}),e[11]=m,e[12]=w,e[13]=T,e[14]=j):j=e[14],j}if(a===void 0){let c;e[15]!==o?(c=o("never"),e[15]=o,e[16]=c):c=e[16];let m;return e[17]!==c?(m=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=m):m=e[18],m}let l;e[19]!==o?(l=o("failed"),e[19]=o,e[20]=l):l=e[20];let n;e[21]!==o?(n=o("skipped"),e[21]=o,e[22]=n):n=e[22];let s;e[23]!==o?(s=o("succeeded"),e[23]=o,e[24]=s):s=e[24];let N;e[25]!==l||e[26]!==n||e[27]!==s?(N={failed:l,skipped:n,succeeded:s},e[25]=l,e[26]=n,e[27]=s,e[28]=N):N=e[28];let y=N,i=Je[a.status],h=y[a.status],g;e[29]!==i||e[30]!==h?(g=(0,t.jsx)(oe,{variant:i,children:h}),e[29]=i,e[30]=h,e[31]=g):g=e[31];let v;e[32]!==a.startedAt?(v=ee(a.startedAt,"\u2014"),e[32]=a.startedAt,e[33]=v):v=e[33];let f;e[34]!==v?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:v}),e[34]=v,e[35]=f):f=e[35];let d;return e[36]!==g||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[g,f]}),e[36]=g,e[37]=f,e[38]=d):d=e[38],d},"ke"),De=b(r=>{let e=(0,Y.c)(80),{runs:u}=r,a=V();if(u.length===0)return;let o,l,n,s,N,y,i,h,g,v,f;if(e[0]!==u||e[1]!==a){let T=u.toSorted(qe).slice(0,Le),j;e[13]!==a?(j=a("failed"),e[13]=a,e[14]=j):j=e[14];let $;e[15]!==a?($=a("skipped"),e[15]=a,e[16]=$):$=e[16];let C;e[17]!==a?(C=a("succeeded"),e[17]=a,e[18]=C):C=e[18];let I;e[19]!==C||e[20]!==j||e[21]!==$?(I={failed:j,skipped:$,succeeded:C},e[19]=C,e[20]=j,e[21]=$,e[22]=I):I=e[22];let A=I;g="flex flex-col gap-2",v="cron-run-history";let p;e[23]!==a?(p=a("Recent runs"),e[23]=a,e[24]=p):p=e[24],e[25]!==p?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:p}),e[25]=p,e[26]=f):f=e[26],s=Q,h="overflow-hidden py-0",n=X,i="px-0",l=re;let L;e[27]!==a?(L=a("name"),e[27]=a,e[28]=L):L=e[28];let x;e[29]!==L?(x=(0,t.jsx)(S,{children:L}),e[29]=L,e[30]=x):x=e[30];let D;e[31]!==a?(D=a("status"),e[31]=a,e[32]=D):D=e[32];let E;e[33]!==D?(E=(0,t.jsx)(S,{children:D}),e[33]=D,e[34]=E):E=e[34];let R;e[35]!==a?(R=a("started"),e[35]=a,e[36]=R):R=e[36];let P;e[37]!==R?(P=(0,t.jsx)(S,{children:R}),e[37]=R,e[38]=P):P=e[38];let Z;e[39]!==a?(Z=a("duration"),e[39]=a,e[40]=Z):Z=e[40];let O;e[41]!==Z?(O=(0,t.jsx)(S,{children:Z}),e[41]=Z,e[42]=O):O=e[42];let H;e[43]!==a?(H=a("skipped"),e[43]=a,e[44]=H):H=e[44];let _;e[45]!==H?(_=(0,t.jsx)(S,{children:H}),e[45]=H,e[46]=_):_=e[46];let z;e[47]!==a?(z=a("error"),e[47]=a,e[48]=z):z=e[48];let K;e[49]!==z?(K=(0,t.jsx)(S,{children:z}),e[49]=z,e[50]=K):K=e[50],e[51]!==x||e[52]!==E||e[53]!==P||e[54]!==O||e[55]!==_||e[56]!==K?(y=(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[x,E,P,O,_,K]})}),e[51]=x,e[52]=E,e[53]=P,e[54]=O,e[55]=_,e[56]=K,e[57]=y):y=e[57],o=ae;let W;e[58]!==A?(W=b(M=>(0,t.jsxs)(B,{"data-testid":`cron-run-row-${M.runId}`,children:[(0,t.jsx)(J,{children:M.name}),(0,t.jsx)(J,{children:(0,t.jsx)(oe,{variant:Je[M.status],children:A[M.status]})}),(0,t.jsx)(J,{className:"text-muted-foreground tabular-nums",children:ee(M.startedAt,"\u2014")}),(0,t.jsx)(J,{className:"tabular-nums",children:M.status==="skipped"?"":Te(M.durationMs)}),(0,t.jsx)(J,{className:"tabular-nums",children:M.skipped>0?M.skipped:""}),(0,t.jsx)(J,{className:"text-xs text-destructive",children:M.error??""})]},M.runId),"B"),e[58]=A,e[59]=W):W=e[59],N=T.map(W),e[0]=u,e[1]=a,e[2]=o,e[3]=l,e[4]=n,e[5]=s,e[6]=N,e[7]=y,e[8]=i,e[9]=h,e[10]=g,e[11]=v,e[12]=f}else o=e[2],l=e[3],n=e[4],s=e[5],N=e[6],y=e[7],i=e[8],h=e[9],g=e[10],v=e[11],f=e[12];let d;e[60]!==o||e[61]!==N?(d=(0,t.jsx)(o,{children:N}),e[60]=o,e[61]=N,e[62]=d):d=e[62];let c;e[63]!==l||e[64]!==y||e[65]!==d?(c=(0,t.jsxs)(l,{children:[y,d]}),e[63]=l,e[64]=y,e[65]=d,e[66]=c):c=e[66];let m;e[67]!==n||e[68]!==i||e[69]!==c?(m=(0,t.jsx)(n,{className:i,children:c}),e[67]=n,e[68]=i,e[69]=c,e[70]=m):m=e[70];let k;e[71]!==s||e[72]!==m||e[73]!==h?(k=(0,t.jsx)(s,{className:h,children:m}),e[71]=s,e[72]=m,e[73]=h,e[74]=k):k=e[74];let w;return e[75]!==k||e[76]!==g||e[77]!==v||e[78]!==f?(w=(0,t.jsxs)("div",{className:g,"data-testid":v,children:[f,k]}),e[75]=k,e[76]=g,e[77]=v,e[78]=f,e[79]=w):w=e[79],w},"Ce");function qe(r,e){return e.startedAt-r.startedAt}b(qe,"Te");var Re=b(()=>{let r=(0,Y.c)(50),e=V(),u=ke(""),[a,o]=(0,U.useState)(""),[l,n]=(0,U.useState)(void 0),[s,N]=(0,U.useState)(!1);if(u.unavailable)return null;let y;r[0]!==u?(y=u.pending("cron"),r[0]=u,r[1]=y):y=r[1];let i=y,h;r[2]!==u?(h=u.reason("cron"),r[2]=u,r[3]=h):h=r[3];let g=h,v;r[4]!==a||r[5]!==u?(v=b(()=>{let R=a.trim();R!==""&&G((async()=>{let P=await u.suggestCron(R);N(!1),n(P)})())},"x"),r[4]=a,r[5]=u,r[6]=v):v=r[6];let f=v,d;r[7]!==l?(d=b(()=>{let R="navigator"in globalThis?globalThis.navigator.clipboard:void 0;R===void 0||l===void 0||G((async()=>{try{await R.writeText(l),N(!0)}catch{N(!1)}})())},"o"),r[7]=l,r[8]=d):d=r[8];let c=d,m;r[9]!==e?(m=e("Describe a schedule"),r[9]=e,r[10]=m):m=r[10];let k;r[11]===Symbol.for("react.memo_cache_sentinel")?(k=b(R=>{o(R.target.value)},"b"),r[11]=k):k=r[11];let w;r[12]!==f?(w=b(R=>{R.key==="Enter"&&(R.preventDefault(),f())},"y"),r[12]=f,r[13]=w):w=r[13];let T;r[14]!==e?(T=e("Describe a schedule"),r[14]=e,r[15]=T):T=r[15];let j;r[16]!==i||r[17]!==a||r[18]!==m||r[19]!==w||r[20]!==T?(j=(0,t.jsx)(ye,{"aria-label":m,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:i,onChange:k,onKeyDown:w,placeholder:T,value:a}),r[16]=i,r[17]=a,r[18]=m,r[19]=w,r[20]=T,r[21]=j):j=r[21];let $=i&&"opacity-60",C;r[22]!==$?(C=Ne("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",$),r[22]=$,r[23]=C):C=r[23];let I;r[24]!==i||r[25]!==a?(I=i||a.trim()==="",r[24]=i,r[25]=a,r[26]=I):I=r[26];let A;r[27]!==i||r[28]!==e?(A=e(i?"Thinking\u2026":"Suggest schedule"),r[27]=i,r[28]=e,r[29]=A):A=r[29];let p;r[30]!==f||r[31]!==C||r[32]!==I||r[33]!==A?(p=(0,t.jsx)("button",{className:C,"data-testid":"cron-assistant-generate",disabled:I,onClick:f,type:"button",children:A}),r[30]=f,r[31]=C,r[32]=I,r[33]=A,r[34]=p):p=r[34];let L;r[35]!==p||r[36]!==j?(L=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j,p]}),r[35]=p,r[36]=j,r[37]=L):L=r[37];let x;r[38]!==s||r[39]!==c||r[40]!==l||r[41]!==e?(x=l!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:l}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:c,type:"button",children:e(s?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=s,r[39]=c,r[40]=l,r[41]=e,r[42]=x):x=r[42];let D;r[43]!==g||r[44]!==e?(D=g!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(g==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=g,r[44]=e,r[45]=D):D=r[45];let E;return r[46]!==L||r[47]!==x||r[48]!==D?(E=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[L,x,D]}),r[46]=L,r[47]=x,r[48]=D,r[49]=E):E=r[49],E},"Se"),Ee={kind:"idle"},Me="SCHEDULER_NOT_CONFIGURED",pe={inFlight:[],runs:[]},Be=b((r,e,u)=>u!==void 0?u:e===void 0?a=>r.runCronJob(a):void 0,"Ae"),Pe=b(({loadCronJobs:r,loadCronRuns:e,runCronJob:u}={})=>{let a=se(),o=V(),[l,n]=(0,U.useState)({}),s=te(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>a.getCronJobs()))()),{data:N,error:y}=s,i=e??(r===void 0?()=>a.listCronRuns():void 0),h=te(["lunora-cron-runs",e?"custom":"default"],async()=>i===void 0?pe:i().catch(d=>{if(ge(d)===Me)return pe;throw d})),g=h.data??pe;ne(()=>h.poll(),i!==void 0);let v=Be(a,r,u),f=b(async d=>{if(v!==void 0){n(c=>({...c,[d]:{kind:"running"}}));try{await v(d),n(c=>({...c,[d]:{kind:"ok"}})),s.refetch(),h.refetch()}catch(c){n(m=>({...m,[d]:{kind:"error",message:ce(c)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(Re,{}),y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:y}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),N?.length===0&&(0,t.jsx)(de,{description:o("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:o("No cron triggers.")}),N!==void 0&&N.length>0&&(0,t.jsx)(Q,{className:"overflow-hidden py-0",children:(0,t.jsx)(X,{className:"px-0",children:(0,t.jsxs)(re,{"data-testid":"cron-table",children:[(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(S,{children:o("name")}),(0,t.jsx)(S,{children:o("schedule")}),(0,t.jsx)(S,{children:o("target")}),(0,t.jsx)(S,{children:o("shard")}),(0,t.jsx)(S,{children:o("last run")}),v!==void 0&&(0,t.jsx)(S,{"aria-label":o("Actions")})]})}),(0,t.jsx)(ae,{children:N.map(d=>{let c=l[d.name]??Ee;return(0,t.jsxs)(B,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(J,{children:d.name}),(0,t.jsx)(J,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(J,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:o("function")}):(0,t.jsx)(oe,{variant:"secondary",children:o("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(J,{children:d.shardKey??""}),(0,t.jsx)(J,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Fe,{inFlight:g.inFlight.find(m=>m.name===d.name),last:g.runs.find(m=>m.name===d.name)})}),v!==void 0&&(0,t.jsx)(J,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[c.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:o("ran")}),c.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:c.message}),(0,t.jsx)(ue,{confirmLabel:o("Run now?"),disabled:c.kind==="running",onConfirm:b(()=>{G(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:c.kind==="running"?o("Running\u2026"):o("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(De,{runs:g.runs})]})},"Le"),He=b(r=>Number.isFinite(r)?ee(r,"\u2014"):"\u2014","Re"),Ke=b(r=>{let e=(0,Y.c)(34),u;e[0]!==r?(u=r===void 0?{}:r,e[0]=r,e[1]=u):u=e[1];let{loadJobs:a,removeJob:o,retryJob:l}=u,n=se(),s=V(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let y;e[3]!==n||e[4]!==a?(y=b(async()=>(await(a??(()=>n.listDeadJobs()))()).toSorted(We),"v"),e[3]=n,e[4]=a,e[5]=y):y=e[5];let i=te(N,y),h=i.data,[g,v]=(0,U.useState)(void 0),f=i.error??g,d=a===void 0,c;e[6]!==n||e[7]!==d||e[8]!==l?(c=l??(d?x=>n.retryDeadJob(x):void 0),e[6]=n,e[7]=d,e[8]=l,e[9]=c):c=e[9];let m=c,k;e[10]!==n||e[11]!==d||e[12]!==o?(k=o??(d?x=>n.removeDeadJob(x):void 0),e[10]=n,e[11]=d,e[12]=o,e[13]=k):k=e[13];let w=k,T;e[14]!==i?(T=b(()=>i.poll(),"I"),e[14]=i,e[15]=T):T=e[15],ne(T,!0);let j;e[16]!==i?(j=b(async x=>{v(void 0);try{await x,i.refetch()}catch(D){v(ce(D))}},"w"),e[16]=i,e[17]=j):j=e[17];let $=j,C=m!==void 0||w!==void 0,I;e[18]!==f?(I=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=I):I=e[19];let A;e[20]!==h?.length||e[21]!==s?(A=h?.length===0&&(0,t.jsx)(de,{description:s("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:s("No dead-letter jobs.")}),e[20]=h?.length,e[21]=s,e[22]=A):A=e[22];let p;e[23]!==$||e[24]!==C||e[25]!==h||e[26]!==w||e[27]!==m||e[28]!==s?(p=h!==void 0&&h.length>0&&(0,t.jsx)(Q,{className:"overflow-hidden py-0",children:(0,t.jsx)(X,{className:"px-0",children:(0,t.jsxs)(re,{"data-testid":"dlq-table",children:[(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(S,{children:s("function")}),(0,t.jsx)(S,{children:s("attempts")}),(0,t.jsx)(S,{children:s("last tried")}),(0,t.jsx)(S,{children:s("pool")}),(0,t.jsx)(S,{children:s("shard")}),(0,t.jsx)(S,{children:s("id")}),C&&(0,t.jsx)(S,{"aria-label":s("Actions")})]})}),(0,t.jsx)(ae,{children:h.map(x=>(0,t.jsxs)(B,{"data-testid":`dlq-row-${x.id}`,children:[(0,t.jsx)(J,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,t.jsx)(J,{className:"tabular-nums",children:x.attempts??0}),(0,t.jsx)(J,{className:"text-muted-foreground tabular-nums",children:He(x.scheduledFor)}),(0,t.jsx)(J,{className:"font-mono text-xs",children:x.pool??""}),(0,t.jsx)(J,{children:x.shardKey??""}),(0,t.jsx)(J,{className:"font-mono text-xs",children:x.id}),C&&(0,t.jsx)(J,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[m!==void 0&&(0,t.jsx)(me,{"data-testid":`dlq-retry-${x.id}`,onClick:b(()=>{G($(m(x.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Retry")}),w!==void 0&&(0,t.jsx)(ue,{confirmLabel:s("Drop job?"),onConfirm:b(()=>{G($(w(x.id)))},"onConfirm"),testId:`dlq-remove-${x.id}`,children:s("Drop")})]})})]},x.id))})]})})}),e[23]=$,e[24]=C,e[25]=h,e[26]=w,e[27]=m,e[28]=s,e[29]=p):p=e[29];let L;return e[30]!==p||e[31]!==I||e[32]!==A?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[I,A,p]}),e[30]=p,e[31]=I,e[32]=A,e[33]=L):L=e[33],L},"De");function We(r,e){return(e.attempts??0)-(r.attempts??0)}b(We,"Ee");var Ve={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},_e=b(r=>{let e=(0,Y.c)(47),u;e[0]!==r?(u=r===void 0?{}:r,e[0]=r,e[1]=u):u=e[1];let{loadJobs:a}=u,o=se(),l=V(),n;e[2]!==o||e[3]!==a?(n=a??(async q=>o.listScheduledHistory(q===void 0?{}:{cursor:q})),e[2]=o,e[3]=a,e[4]=n):n=e[4];let s=n,N=a?"custom":"default",y;e[5]!==N?(y=["lunora-job-history",N],e[5]=N,e[6]=y):y=e[6];let i;e[7]!==s?(i=b(async()=>s(),"d"),e[7]=s,e[8]=i):i=e[8];let h=te(y,i),[g,v]=(0,U.useState)(void 0),[f,d]=(0,U.useState)(!1),[c,m]=(0,U.useState)(void 0),k=h.data?.records,w;e[9]!==k?(w=new Set(k?.map(ze)),e[9]=k,e[10]=w):w=e[10];let T=w,j=k===void 0?void 0:[...k,...(g?.records??[]).filter(q=>!T.has(q.id))],$=g===void 0?h.data?.cursor:g.cursor,C;e[11]!==s||e[12]!==$?(C=b(async()=>{d(!0),m(void 0);try{let q=await s($);v($e=>({cursor:q.cursor,records:[...$e?.records??[],...q.records]})),d(!1)}catch(q){m(ce(q)),d(!1)}},"S"),e[11]=s,e[12]=$,e[13]=C):C=e[13];let I=C,A;e[14]!==l?(A=l("canceled"),e[14]=l,e[15]=A):A=e[15];let p;e[16]!==l?(p=l("failed"),e[16]=l,e[17]=p):p=e[17];let L;e[18]!==l?(L=l("pending"),e[18]=l,e[19]=L):L=e[19];let x;e[20]!==l?(x=l("running"),e[20]=l,e[21]=x):x=e[21];let D;e[22]!==l?(D=l("succeeded"),e[22]=l,e[23]=D):D=e[23];let E;e[24]!==L||e[25]!==x||e[26]!==D||e[27]!==A||e[28]!==p?(E={canceled:A,failed:p,pending:L,running:x,succeeded:D},e[24]=L,e[25]=x,e[26]=D,e[27]=A,e[28]=p,e[29]=E):E=e[29];let R=E,P;e[30]!==h?(P=b(()=>h.poll(),"P"),e[30]=h,e[31]=P):P=e[31],ne(P,g===void 0);let Z="flex flex-col gap-3",O="lunora-job-history",H;e[32]!==h.error?(H=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=H):H=e[33];let _=j?.length===0&&(0,t.jsx)(de,{description:l("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:l("No finished jobs.")}),z=j!==void 0&&j.length>0&&(0,t.jsx)(Q,{className:"overflow-hidden py-0",children:(0,t.jsx)(X,{className:"px-0",children:(0,t.jsxs)(re,{"data-testid":"job-history-table",children:[(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(S,{children:l("function")}),(0,t.jsx)(S,{children:l("state")}),(0,t.jsx)(S,{children:l("finished")}),(0,t.jsx)(S,{children:l("error")}),(0,t.jsx)(S,{children:l("id")})]})}),(0,t.jsx)(ae,{children:j.map(q=>(0,t.jsxs)(B,{"data-testid":`job-history-row-${q.id}`,children:[(0,t.jsx)(J,{className:"font-mono text-xs",children:q.workflow??q.functionPath}),(0,t.jsx)(J,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${q.id}`,variant:Ve[q.state],children:R[q.state]})}),(0,t.jsx)(J,{className:"text-muted-foreground tabular-nums",children:ee(q.completedAt,"\u2014")}),(0,t.jsx)(J,{className:"text-xs text-destructive",children:q.error??""}),(0,t.jsx)(J,{className:"font-mono text-xs",children:q.id})]},q.id))})]})})}),K;e[34]!==c?(K=c!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:c}),e[34]=c,e[35]=K):K=e[35];let W;e[36]!==f||e[37]!==$||e[38]!==I||e[39]!==l?(W=$!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(me,{"data-testid":"job-history-load-more",disabled:f,onClick:b(()=>{G(I())},"onClick"),variant:"outline",children:l(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=$,e[38]=I,e[39]=l,e[40]=W):W=e[40];let M;return e[41]!==H||e[42]!==_||e[43]!==z||e[44]!==K||e[45]!==W?(M=(0,t.jsxs)("div",{className:Z,"data-testid":O,children:[H,_,z,K,W]}),e[41]=H,e[42]=_,e[43]=z,e[44]=K,e[45]=W,e[46]=M):M=e[46],M},"Je");function ze(r){return r.id}b(ze,"Fe");var fe=b(r=>{let e=(0,Y.c)(8),{label:u,testId:a,value:o}=r,l;e[0]!==u?(l=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[0]=u,e[1]=l):l=e[1];let n;e[2]!==a||e[3]!==o?(n=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":a,children:o}),e[2]=a,e[3]=o,e[4]=n):n=e[4];let s;return e[5]!==l||e[6]!==n?(s=(0,t.jsx)(Q,{className:"flex-1 py-0",children:(0,t.jsxs)(X,{className:"flex flex-col gap-1 p-4",children:[l,n]})}),e[5]=l,e[6]=n,e[7]=s):s=e[7],s},"de"),Ue=b(r=>{let e=(0,Y.c)(25),u;e[0]!==r?(u=r===void 0?{}:r,e[0]=r,e[1]=u):u=e[1];let{loadStatus:a}=u,o=se(),l=V(),n=a===void 0,s;e[2]!==n?(s=["lunora-scheduler-status",n],e[2]=n,e[3]=s):s=e[3];let N;e[4]!==o||e[5]!==a?(N=b(async()=>{let k=await(a??(()=>o.schedulerStatus()))();return{...k,pools:k.pools.toSorted(Ge)}},"N"),e[4]=o,e[5]=a,e[6]=N):N=e[6];let y=te(s,N),{data:i,error:h}=y,g;e[7]!==y?(g=b(()=>y.poll(),"g"),e[7]=y,e[8]=g):g=e[8],ne(g,!0);let v;e[9]!==h?(v=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:h}),e[9]=h,e[10]=v):v=e[10];let f;e[11]!==i||e[12]!==l?(f=i!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(fe,{label:l("backlog"),testId:"pools-backlog",value:i.backlog}),(0,t.jsx)(fe,{label:l("in flight"),testId:"pools-inflight",value:i.inFlight}),(0,t.jsx)(fe,{label:l("pools"),testId:"pools-count",value:i.pools.length})]}),e[11]=i,e[12]=l,e[13]=f):f=e[13];let d;e[14]!==i?.pools.length||e[15]!==l?(d=i?.pools.length===0&&(0,t.jsx)(de,{description:l("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:l("No workpools.")}),e[14]=i?.pools.length,e[15]=l,e[16]=d):d=e[16];let c;e[17]!==i||e[18]!==l?(c=i!==void 0&&i.pools.length>0&&(0,t.jsx)(Q,{className:"overflow-hidden py-0",children:(0,t.jsx)(X,{className:"px-0",children:(0,t.jsxs)(re,{"data-testid":"pools-table",children:[(0,t.jsx)(le,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(S,{children:l("pool")}),(0,t.jsx)(S,{children:l("queued")}),(0,t.jsx)(S,{children:l("in flight")}),(0,t.jsx)(S,{children:l("max concurrency")})]})}),(0,t.jsx)(ae,{children:i.pools.map(Qe)})]})})}),e[17]=i,e[18]=l,e[19]=c):c=e[19];let m;return e[20]!==v||e[21]!==f||e[22]!==d||e[23]!==c?(m=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[v,f,d,c]}),e[20]=v,e[21]=f,e[22]=d,e[23]=c,e[24]=m):m=e[24],m},"Oe");function Ge(r,e){return e.queued-r.queued}b(Ge,"Pe");function Qe(r){return(0,t.jsxs)(B,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(J,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(J,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(J,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(J,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}b(Qe,"qe");var Xe=["jobs","history","dead","pools","cron"],jt=b(r=>{let e=(0,Y.c)(48),u;e[0]!==r?(u=r===void 0?{}:r,e[0]=r,e[1]=u):u=e[1];let{loadCronJobs:a,scheduledCancel:o,scheduledLoad:l}=u,n=V(),[s,N]=(0,U.useState)("jobs"),y;e[2]!==n?(y=n("Cron triggers"),e[2]=n,e[3]=y):y=e[3];let i;e[4]!==n?(i=n("Dead letter"),e[4]=n,e[5]=i):i=e[5];let h;e[6]!==n?(h=n("History"),e[6]=n,e[7]=h):h=e[7];let g;e[8]!==n?(g=n("Scheduled jobs"),e[8]=n,e[9]=g):g=e[9];let v;e[10]!==n?(v=n("Pools"),e[10]=n,e[11]=v):v=e[11];let f;e[12]!==y||e[13]!==i||e[14]!==h||e[15]!==g||e[16]!==v?(f={cron:y,dead:i,history:h,jobs:g,pools:v},e[12]=y,e[13]=i,e[14]=h,e[15]=g,e[16]=v,e[17]=f):f=e[17];let d=f,c;e[18]===Symbol.for("react.memo_cache_sentinel")?(c=b(x=>{N(x.currentTarget.dataset.view)},"c"),e[18]=c):c=e[18];let m=c,k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=(0,t.jsx)(we,{}),e[19]=k):k=e[19];let w;e[20]!==n?(w=n("Schedule view"),e[20]=n,e[21]=w):w=e[21];let T;e[22]!==s||e[23]!==d?(T=Xe.map(x=>(0,t.jsx)(me,{"aria-selected":s===x,"data-testid":`schedule-view-${x}`,"data-view":x,onClick:m,role:"tab",size:"sm",type:"button",variant:s===x?"default":"outline",children:d[x]},x)),e[22]=s,e[23]=d,e[24]=T):T=e[24];let j;e[25]!==w||e[26]!==T?(j=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:T}),e[25]=w,e[26]=T,e[27]=j):j=e[27];let $;e[28]!==o||e[29]!==l||e[30]!==s?($=s==="jobs"&&(0,t.jsx)(Se,{cancelJob:o,loadJobs:l}),e[28]=o,e[29]=l,e[30]=s,e[31]=$):$=e[31];let C;e[32]!==s?(C=s==="history"&&(0,t.jsx)(_e,{}),e[32]=s,e[33]=C):C=e[33];let I;e[34]!==s?(I=s==="dead"&&(0,t.jsx)(Ke,{}),e[34]=s,e[35]=I):I=e[35];let A;e[36]!==s?(A=s==="pools"&&(0,t.jsx)(Ue,{}),e[36]=s,e[37]=A):A=e[37];let p;e[38]!==a||e[39]!==s?(p=s==="cron"&&(0,t.jsx)(Pe,{loadCronJobs:a}),e[38]=a,e[39]=s,e[40]=p):p=e[40];let L;return e[41]!==j||e[42]!==$||e[43]!==C||e[44]!==I||e[45]!==A||e[46]!==p?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[k,j,$,C,I,A,p]}),e[41]=j,e[42]=$,e[43]=C,e[44]=I,e[45]=A,e[46]=p,e[47]=L):L=e[47],L},"it");export{jt as SchedulePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as s}from"./chunk-
|
|
1
|
+
import{x as s}from"./chunk-OOOT4H45.js";import{a as c}from"./chunk-GWNGVKLG.js";import{b}from"./chunk-6G3E4PJ2.js";import{a as d,d as o}from"./chunk-5PEAXTYQ.js";var l=o(c(),1);var u=o(b(),1);function p(n){let i=(0,l.c)(8),r,e;i[0]!==n?({className:r,...e}=n,i[0]=n,i[1]=r,i[2]=e):(r=i[1],e=i[2]);let t;i[3]!==r?(t=s("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-xs transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",r),i[3]=r,i[4]=t):t=i[4];let a;return i[5]!==e||i[6]!==t?(a=(0,u.jsx)("textarea",{"data-slot":"textarea",className:t,...e}),i[5]=e,i[6]=t,i[7]=a):a=i[7],a}d(p,"b");export{p as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as H}from"./chunk-
|
|
1
|
+
import{a as H}from"./chunk-F7EKRF7I.js";import{a as B}from"./chunk-O7XG7DTU.js";import{b as _}from"./chunk-O24UFHUY.js";import{b as z}from"./chunk-4PI2OSSP.js";import{B as $,e as D,j as E,m as S,n as W}from"./chunk-OOOT4H45.js";import{a as F}from"./chunk-GWNGVKLG.js";import{b as G}from"./chunk-6G3E4PJ2.js";import{a as I,d as O}from"./chunk-5PEAXTYQ.js";var M=O(F(),1);var o=O(G(),1);var ee=I(U=>{let e=(0,M.c)(51),{className:T,error:t,shardKey:j,testId:K}=U,s=$(),r=z(),v=_(),V=v!==void 0&&!v.unavailable,l,c,a,m,d,u,p,i,n,h;if(e[0]!==v||e[1]!==T||e[2]!==t||e[3]!==r||e[4]!==j||e[5]!==s||e[6]!==K){let y=S(t),w;e[17]!==t?(w=W(t),e[17]=t,e[18]=w):w=e[18],a=w;let N;e[19]!==t?(N=B(t),e[19]=t,e[20]=N):N=e[20];let q=N,A=t?.why,C;e[21]!==r||e[22]!==q?(C=I(()=>{r?.openConsole({errorsOnly:!0,seq:q})},"C"),e[21]=r,e[22]=q,e[23]=C):C=e[23],m=C,c=I(()=>{let Z=y===void 0?"":`
|
|
2
2
|
|
|
3
3
|
${s("The studio suggested: {hint}",{hint:D(y)})}`;v?.openAssistant({ask:s(`The studio reported this error:
|
|
4
4
|
{message}{detail}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-DBLSNTHL.js";import{a as C}from"./chunk-JT7UYB6L.js";import{a as c}from"./chunk-XMOG3LIP.js";import{b as N}from"./chunk-K5BAERB3.js";import"./chunk-YUVGMKHG.js";import{a as k}from"./chunk-E5LR7G22.js";import"./chunk-F7EKRF7I.js";import{a as w,b as T,c as A,d as f,e as s,f as l}from"./chunk-TZ5PSNZW.js";import"./chunk-O7XG7DTU.js";import"./chunk-O24UFHUY.js";import"./chunk-4PI2OSSP.js";import{a as v}from"./chunk-2W4UO5BC.js";import{c as p}from"./chunk-5X6BEWUI.js";import{a as b,e as S}from"./chunk-PDBCAPP6.js";import"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as y}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import"./chunk-GWNGVKLG.js";import{a as R,b as V}from"./chunk-6G3E4PJ2.js";import{a as n,d as x}from"./chunk-5PEAXTYQ.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=y(),[o,j]=(0,F.useState)(""),{context:g,error:m}=$(o),I=g===void 0?{}:{context:g},{data:i,error:J,errorSource:K,liveError:E}=p(v.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)(b,{className:"overflow-hidden py-0",children:(0,e.jsx)(S,{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)(N,{"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,shardKey:a,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 C}from"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-5SKGLIO5.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as $}from"./chunk-XMOG3LIP.js";import{b as v}from"./chunk-K5BAERB3.js";import"./chunk-YUVGMKHG.js";import{a as j}from"./chunk-E5LR7G22.js";import"./chunk-F7EKRF7I.js";import{a as I,b as _,c as q,d as p,e as o,f as i}from"./chunk-TZ5PSNZW.js";import"./chunk-O7XG7DTU.js";import"./chunk-O24UFHUY.js";import"./chunk-4PI2OSSP.js";import{a as g}from"./chunk-2W4UO5BC.js";import{c as h}from"./chunk-5X6BEWUI.js";import{a as K,e as S}from"./chunk-PDBCAPP6.js";import"./chunk-JWQOB4EW.js";import"./chunk-ZPQBVYNN.js";import{B as T,w as F}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import{a as oe}from"./chunk-GWNGVKLG.js";import{a as ne,b as ie}from"./chunk-6G3E4PJ2.js";import{a as d,d as k}from"./chunk-5PEAXTYQ.js";var Q=k(oe(),1),G=k(ne(),1);var e=k(ie(),1);var H="agent_threads",de="agent_messages",L="agent_run_queue",J=100,N=250,le={},ce={filters:[],limit:J,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:H},c=d((s,t)=>{let a=s[t];return typeof a=="string"?a:void 0},"c"),B=d((s,t)=>{let a=s[t];return typeof a=="number"?a:void 0},"E"),O=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"H"),me=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"de"),ue=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"le"),he=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"ie"),ge=d(s=>{let t=(0,Q.c)(3),{fetched:a}=s,m=T(),l;return t[0]!==a||t[1]!==m?(l=a<=N?null:(0,e.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"agents-messages-truncated",children:m("Showing the latest {count} messages; older ones are not shown.",{count:N})}),t[0]=a,t[1]=m,t[2]=l):l=t[2],l},"ce"),Te=d(({initialShardKey:s=""})=>{let t=T(),[a,m]=(0,G.useState)(void 0),{data:l}=h(g.listTables,le,{live:!0,shardKey:s}),V=l!==void 0,f=Array.isArray(l)&&l.some(r=>r.name===H),W=Array.isArray(l)&&l.some(r=>r.name===L),{data:E,error:X,errorSource:Y,liveError:Z}=h(g.readTablePage,ce,{enabled:f,live:!0,shardKey:s}),ee={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:N+1,offset:0,orderBy:{column:"seq",direction:"desc"},skipCount:!0,table:de},{data:P}=h(g.readTablePage,{limit:J,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:L},{enabled:W,live:!0,shardKey:s}),{data:U,error:te,errorSource:ae}=h(g.readTablePage,ee,{enabled:f&&a!==void 0,live:!0,shardKey:s}),b=Array.isArray(E?.rows)?E.rows:[],re=Array.isArray(P?.rows)?P.rows:[],z=d(r=>re.filter(n=>c(n,"threadKey")===r).length,"C"),M=Array.isArray(U?.rows)?U.rows:[],R=M.slice(0,N).toReversed(),D=b.find(r=>c(r,"key")===a),x;return V&&!f?x=(0,e.jsx)($,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):f&&b.length===0?x=(0,e.jsx)($,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):x=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(K,{className:"overflow-hidden py-0",children:(0,e.jsx)(S,{className:"px-0",children:(0,e.jsxs)(I,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Agent")}),(0,e.jsx)(o,{children:t("Key")}),(0,e.jsx)(o,{children:t("Status")}),(0,e.jsx)(o,{children:t("Queued")}),(0,e.jsx)(o,{children:t("Messages")}),(0,e.jsx)(o,{children:t("Tokens")}),(0,e.jsx)(o,{children:t("Updated")}),(0,e.jsx)(o,{"aria-label":t("Actions")})]})}),(0,e.jsx)(q,{children:b.map(r=>{let n=c(r,"key")??"",u=c(r,"status"),y=O(r);return(0,e.jsxs)(p,{"data-active":n===a?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:c(r,"agent")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(i,{children:(0,e.jsx)(v,{"data-testid":`agents-thread-status-${n}`,variant:ue(u),children:u??"\u2014"})}),(0,e.jsx)(i,{className:"tabular-nums",children:z(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:z(n)})}),(0,e.jsx)(i,{className:"tabular-nums",children:B(r,"messageCount")??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums text-muted-foreground",children:y??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:F(B(r,"updatedAt"),"\u2014")}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsx)(C,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{m(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),te!==null&&(0,e.jsx)(j,{error:ae,shardKey:s,testId:"agents-messages-error"}),a!==void 0&&(0,e.jsx)(K,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(S,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,D!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",O(D)??0," ",t("Tokens")]})]}),(0,e.jsx)(C,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{m(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),(0,e.jsx)(ge,{fetched:M.length}),R.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(I,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(_,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(o,{children:t("Role")}),(0,e.jsx)(o,{children:t("Content")}),(0,e.jsx)(o,{children:t("Tool")}),(0,e.jsx)(o,{children:t("Approval")})]})}),(0,e.jsx)(q,{children:R.map((r,n)=>{let u=c(r,"role")??"\u2014",y=me(r),se=c(r,"toolName"),w=c(r,"status"),A=B(r,"seq")??n;return(0,e.jsxs)(p,{"data-testid":`agents-message-${String(A)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:u}),(0,e.jsx)(i,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:c(r,"content")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:se??(y.length>0?y.join(", "):"\u2014")}),(0,e.jsx)(i,{className:"align-top",children:w===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(v,{"data-testid":`agents-message-approval-${String(A)}`,variant:he(w),children:w})})]},c(r,"messageKey")??`${u}:${String(A)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[X!==null&&(0,e.jsx)(j,{error:Y,shardKey:s,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),Z!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),x]})},"Ee");export{Te as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b}from"./chunk-ZPQBVYNN.js";import{x as v}from"./chunk-
|
|
1
|
+
import{a as b}from"./chunk-ZPQBVYNN.js";import{x as v}from"./chunk-OOOT4H45.js";import{a as x}from"./chunk-GWNGVKLG.js";import{b as g}from"./chunk-6G3E4PJ2.js";import{a as c,d as l}from"./chunk-5PEAXTYQ.js";var u=l(x(),1);var s=l(g(),1);var p=b("flex items-start gap-2 rounded-md border px-3 py-2 text-sm [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0",{defaultVariants:{variant:"default"},variants:{variant:{default:"border-border bg-muted/40 text-foreground",destructive:"border-destructive/40 bg-destructive/5 text-destructive",warning:"border-amber-500/40 bg-amber-500/5 text-amber-700 dark:text-amber-400"}}}),j=c(f=>{let t=(0,u.c)(10),{children:d,className:i,icon:m,testId:o,variant:n}=f,e;t[0]!==i||t[1]!==n?(e=v(p({variant:n}),i),t[0]=i,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==d?(r=(0,s.jsx)("div",{className:"min-w-0 flex-1",children:d}),t[3]=d,t[4]=r):r=t[4];let a;return t[5]!==m||t[6]!==e||t[7]!==r||t[8]!==o?(a=(0,s.jsxs)("div",{className:e,"data-testid":o,role:"alert",children:[m,r]}),t[5]=m,t[6]=e,t[7]=r,t[8]=o,t[9]=a):a=t[9],a},"N");export{j as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-3D67ZJRW.js";import{i as j}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-3D67ZJRW.js";import{i as j}from"./chunk-Q3WMP7OA.js";import{B as b}from"./chunk-OOOT4H45.js";import{a as $}from"./chunk-GWNGVKLG.js";import{a as w,b as A}from"./chunk-6G3E4PJ2.js";import{a as m,d as S}from"./chunk-5PEAXTYQ.js";var y=S($(),1),h=S(w(),1);var a=S(A(),1);var z=m(i=>{let t=(0,y.c)(21),{id:f,onChange:g,testId:e,value:v}=i,s=b(),u=(0,h.useId)(),[d]=(0,h.useState)(F),c;t[0]!==g?(c=m(C=>{g(C.target.value)},"d"),t[0]=g,t[1]=c):c=t[1];let I=c,o;t[2]!==s?(o=s("Shard key"),t[2]=s,t[3]=o):o=t[3];let x=d.length>0?u:void 0,r;t[4]!==s?(r=s("shard key (optional)"),t[4]=s,t[5]=r):r=t[5];let l;t[6]!==f||t[7]!==I||t[8]!==o||t[9]!==x||t[10]!==r||t[11]!==e||t[12]!==v?(l=(0,a.jsx)(j,{"aria-label":o,className:"h-8 w-48","data-testid":e,id:f,list:x,onChange:I,placeholder:r,value:v}),t[6]=f,t[7]=I,t[8]=o,t[9]=x,t[10]=r,t[11]=e,t[12]=v,t[13]=l):l=t[13];let n;t[14]!==u||t[15]!==d||t[16]!==e?(n=d.length>0&&(0,a.jsx)("datalist",{"data-testid":`${e}-recents`,id:u,children:d.map(N)}),t[14]=u,t[15]=d,t[16]=e,t[17]=n):n=t[17];let p;return t[18]!==l||t[19]!==n?(p=(0,a.jsxs)(a.Fragment,{children:[l,n]}),t[18]=l,t[19]=n,t[20]=p):p=t[20],p},"A");function F(){return k()}m(F,"$");function N(i){return(0,a.jsx)("option",{"aria-label":i,value:i},i)}m(N,"w");export{z as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as fe}from"./chunk-P6VNMPWR.js";import{i as pe}from"./chunk-
|
|
1
|
+
import{a as fe}from"./chunk-P6VNMPWR.js";import{i as pe}from"./chunk-Q3WMP7OA.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as le}from"./chunk-5SKGLIO5.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import"./chunk-YUVGMKHG.js";import{a as ae,e as oe}from"./chunk-PDBCAPP6.js";import"./chunk-ZPQBVYNN.js";import{B as re,j as ce,s as me,v as ue}from"./chunk-OOOT4H45.js";import"./chunk-PDBW6GTJ.js";import{a as ke}from"./chunk-GWNGVKLG.js";import{a as be,b as ve}from"./chunk-6G3E4PJ2.js";import{a as h,d as se}from"./chunk-5PEAXTYQ.js";var ne=se(ke(),1),X=se(be(),1);var s=se(ve(),1);var we=h(e=>{let t=(0,ne.c)(23),{destination:r}=e,f=re(),x;t[0]!==r.snippet?(x=h(()=>{ue(r.snippet)},"x"),t[0]=r.snippet,t[1]=x):x=t[1];let u=x,l;t[2]!==r.title?(l=(0,s.jsx)("h4",{className:"text-sm font-semibold",children:r.title}),t[2]=r.title,t[3]=l):l=t[3];let a;t[4]!==r.description?(a=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.description}),t[4]=r.description,t[5]=a):a=t[5];let c;t[6]!==l||t[7]!==a?(c=(0,s.jsxs)("div",{children:[l,a]}),t[6]=l,t[7]=a,t[8]=c):c=t[8];let J=`drain-copy-${r.id}`,o;t[9]!==f?(o=f("Copy"),t[9]=f,t[10]=o):o=t[10];let n;t[11]!==u||t[12]!==J||t[13]!==o?(n=(0,s.jsx)(le,{"data-testid":J,onClick:u,size:"sm",variant:"outline",children:o}),t[11]=u,t[12]=J,t[13]=o,t[14]=n):n=t[14];let i;t[15]!==c||t[16]!==n?(i=(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[c,n]}),t[15]=c,t[16]=n,t[17]=i):i=t[17];let m;t[18]!==r.snippet?(m=(0,s.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:r.snippet}),t[18]=r.snippet,t[19]=m):m=t[19];let y;return t[20]!==i||t[21]!==m?(y=(0,s.jsx)(ae,{className:"py-0","data-testid":"drain-card",children:(0,s.jsxs)(oe,{className:"p-3",children:[i,m]})}),t[20]=i,t[21]=m,t[22]=y):y=t[22],y},"be"),Me=h(()=>{let e=(0,ne.c)(93),t=re(),r;e[0]!==t?(r=t("Stream every request log to R2, a SIEM, or a third-party log service."),e[0]=t,e[1]=r):r=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=["{",' "logpush": true',"}"],e[2]=f):f=e[2];let x=f.join(`
|
|
2
2
|
`),u;e[3]!==t?(u=t("Logpush"),e[3]=t,e[4]=u):u=e[4];let l;e[5]!==r||e[6]!==u?(l={description:r,id:"logpush",snippet:x,title:u},e[5]=r,e[6]=u,e[7]=l):l=e[7];let a;e[8]!==t?(a=t("Send logs programmatically to a Worker for custom capture and forwarding."),e[8]=t,e[9]=a):a=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"],e[10]=c):c=e[10];let J=c.join(`
|
|
3
3
|
`),o;e[11]!==t?(o=t("Tail Workers"),e[11]=t,e[12]=o):o=e[12];let n;e[13]!==a||e[14]!==o?(n={description:a,id:"tail-worker",snippet:J,title:o},e[13]=a,e[14]=o,e[15]=n):n=e[15];let i;e[16]!==t?(i=t("Retain and query recent request logs directly in Cloudflare's dashboard."),e[16]=t,e[17]=i):i=e[17];let m;e[18]===Symbol.for("react.memo_cache_sentinel")?(m=["{",' "observability": { "enabled": true }',"}"],e[18]=m):m=e[18];let y=m.join(`
|
|
4
4
|
`),b;e[19]!==t?(b=t("Workers Logs"),e[19]=t,e[20]=b):b=e[20];let k;e[21]!==i||e[22]!==b?(k={description:i,id:"workers-logs",snippet:y,title:b},e[21]=i,e[22]=b,e[23]=k):k=e[23];let $;e[24]!==k||e[25]!==l||e[26]!==n?($=[l,n,k],e[24]=k,e[25]=l,e[26]=n,e[27]=$):$=e[27];let Y=$,[d,he]=(0,X.useState)(""),[v,ie]=(0,X.useState)(!1),[A,G]=(0,X.useState)(null),H;e[28]!==t||e[29]!==d?(H=h(async()=>{let g=d.trim();if(g==="")return;let de="fetch"in globalThis?globalThis.fetch:void 0;if(de===void 0){G({kind:"error",message:t("fetch is unavailable in this environment."),url:g});return}let xe={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};ie(!0),G(null);let ye=performance.now();try{let te=await de(g,{body:JSON.stringify(xe),headers:{"Content-Type":"application/json"},method:"POST"});G({kind:"success",latencyMs:Math.round(performance.now()-ye),status:te.status,url:g})}catch(te){G({kind:"error",message:ce(te),url:g})}ie(!1)},"V"),e[28]=t,e[29]=d,e[30]=H):H=e[30];let Z=H,K;e[31]!==A||e[32]!==d?(K=A?.url===d.trim()?A:null,e[31]=A,e[32]=d,e[33]=K):K=e[33];let p=K,Q;e[34]!==Z?(Q=h(()=>{me(Z())},"G"),e[34]=Z,e[35]=Q):Q=e[35];let ee=Q,U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=h(g=>{he(g.target.value)},"H"),e[36]=U):U=e[36];let ge=U,w;e[37]!==t?(w=t("Open in Cloudflare"),e[37]=t,e[38]=w):w=e[38];let N;e[39]!==w?(N=(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,s.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:fe,rel:"noreferrer",target:"_blank",children:w})}),e[39]=w,e[40]=N):N=e[40];let S;e[41]!==t?(S=t("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector."),e[41]=t,e[42]=S):S=e[42];let C;e[43]!==S?(C=(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:S}),e[43]=S,e[44]=C):C=e[44];let _;e[45]!==t?(_=t("Cloudflare destinations"),e[45]=t,e[46]=_):_=e[46];let j;e[47]!==_?(j=(0,s.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:_}),e[47]=_,e[48]=j):j=e[48];let T;e[49]!==Y?(T=Y.map(Ne),e[49]=Y,e[50]=T):T=e[50];let q;e[51]!==j||e[52]!==T?(q=(0,s.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[j,T]}),e[51]=j,e[52]=T,e[53]=q):q=e[53];let M;e[54]!==t?(M=t("Webhook test"),e[54]=t,e[55]=M):M=e[55];let O;e[56]!==M?(O=(0,s.jsx)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M}),e[56]=M,e[57]=O):O=e[57];let W;e[58]!==t?(W=t("POST a sample Lunora request-log envelope to your collector to confirm it is reachable."),e[58]=t,e[59]=W):W=e[59];let L;e[60]!==W?(L=(0,s.jsx)("p",{className:"mb-2 text-sm text-muted-foreground",children:W}),e[60]=W,e[61]=L):L=e[61];let I;e[62]!==t?(I=t("https://example.com/logs"),e[62]=t,e[63]=I):I=e[63];let P;e[64]!==I||e[65]!==d?(P=(0,s.jsx)(pe,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:ge,placeholder:I,type:"url",value:d}),e[64]=I,e[65]=d,e[66]=P):P=e[66];let R;e[67]!==v||e[68]!==d?(R=v||d.trim()==="",e[67]=v,e[68]=d,e[69]=R):R=e[69];let D;e[70]!==v||e[71]!==t?(D=t(v?"Sending\u2026":"Send test event"),e[70]=v,e[71]=t,e[72]=D):D=e[72];let z;e[73]!==ee||e[74]!==R||e[75]!==D?(z=(0,s.jsx)(le,{"data-testid":"drain-webhook-test",disabled:R,onClick:ee,children:D}),e[73]=ee,e[74]=R,e[75]=D,e[76]=z):z=e[76];let B;e[77]!==P||e[78]!==z?(B=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[P,z]}),e[77]=P,e[78]=z,e[79]=B):B=e[79];let E;e[80]!==p||e[81]!==t?(E=p!==null&&(0,s.jsx)("p",{className:p.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:p.kind==="error"?"alert":void 0,children:p.kind==="success"?t("Delivered \u2014 status {status} in {latency}ms",{latency:p.latencyMs,status:p.status}):t("Failed: {message}",{message:p.message})}),e[80]=p,e[81]=t,e[82]=E):E=e[82];let F;e[83]!==O||e[84]!==L||e[85]!==B||e[86]!==E?(F=(0,s.jsx)(ae,{className:"py-0",children:(0,s.jsx)(oe,{className:"p-3",children:(0,s.jsxs)("section",{"data-testid":"drain-webhook",children:[O,L,B,E]})})}),e[83]=O,e[84]=L,e[85]=B,e[86]=E,e[87]=F):F=e[87];let V;return e[88]!==N||e[89]!==C||e[90]!==q||e[91]!==F?(V=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[N,C,q,F]}),e[88]=N,e[89]=C,e[90]=q,e[91]=F,e[92]=V):V=e[92],V},"je");function Ne(e){return(0,s.jsx)(we,{destination:e},e.id)}h(Ne,"ye");export{Me as default};
|