@lunora/studio 1.0.0-alpha.362 → 1.0.0-alpha.363
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/standalone/{chunk-J6XQKD2F.js → chunk-32V7XGNC.js} +1 -1
- package/dist/standalone/{chunk-Q2J73V2C.js → chunk-4L55URI5.js} +1 -1
- package/dist/standalone/{chunk-FBDIQ67D.js → chunk-4N76XUNG.js} +1 -1
- package/dist/standalone/{chunk-6KE7ILEZ.js → chunk-53XKGQEE.js} +1 -1
- package/dist/standalone/{chunk-7KJCRT4B.js → chunk-5QUTVSHM.js} +1 -1
- package/dist/standalone/{chunk-MJTVTUNI.js → chunk-5RX5CQSU.js} +1 -1
- package/dist/standalone/{chunk-ZG3IUVQ2.js → chunk-5Z2U4KBN.js} +1 -1
- package/dist/standalone/{chunk-ZKEYRU5C.js → chunk-75TRPM7O.js} +1 -1
- package/dist/standalone/{chunk-GC3GKGWD.js → chunk-7MLX5CGD.js} +1 -1
- package/dist/standalone/{chunk-BO5NNWMO.js → chunk-7TQ7BZ67.js} +1 -1
- package/dist/standalone/{chunk-H7BQUL7D.js → chunk-AD5J2ANS.js} +1 -1
- package/dist/standalone/{chunk-COLSZPCE.js → chunk-ALR4VAUE.js} +1 -1
- package/dist/standalone/{chunk-5EWIOOBI.js → chunk-AXE2SDRU.js} +1 -1
- package/dist/standalone/{chunk-JENPPZFV.js → chunk-BAEIW3YS.js} +1 -1
- package/dist/standalone/{chunk-BX7TFVCC.js → chunk-BBDTJG2K.js} +1 -1
- package/dist/standalone/{chunk-ZFQ253FX.js → chunk-BI6MZHZJ.js} +1 -1
- package/dist/standalone/{chunk-EE2COWFF.js → chunk-CP7QNLR4.js} +1 -1
- package/dist/standalone/{chunk-OP4QEV27.js → chunk-D57B4MFK.js} +1 -1
- package/dist/standalone/{chunk-53CGUTRT.js → chunk-DZFXH55R.js} +1 -1
- package/dist/standalone/{chunk-J3BZWYJQ.js → chunk-EPWCW2DF.js} +1 -1
- package/dist/standalone/{chunk-PAZKX7I6.js → chunk-FJLRSFTE.js} +1 -1
- package/dist/standalone/{chunk-L26RMC2W.js → chunk-FVCBNFQW.js} +1 -1
- package/dist/standalone/{chunk-UW6QNC74.js → chunk-GVQPNM3T.js} +1 -1
- package/dist/standalone/{chunk-7WV3EPE6.js → chunk-H3EIPYRZ.js} +1 -1
- package/dist/standalone/{chunk-HCCQTUHS.js → chunk-H5TMLWIS.js} +1 -1
- package/dist/standalone/{chunk-LPFUEJZ4.js → chunk-HBG6SSE2.js} +1 -1
- package/dist/standalone/{chunk-5O7ICPWV.js → chunk-HC2B7SXW.js} +1 -1
- package/dist/standalone/{chunk-IDZLHZIA.js → chunk-HGCOTYPV.js} +1 -1
- package/dist/standalone/{chunk-Q2KL457J.js → chunk-HLHMHCXS.js} +1 -1
- package/dist/standalone/{chunk-WADY55J2.js → chunk-HSF2DCJ2.js} +1 -1
- package/dist/standalone/{chunk-QEFLZBT7.js → chunk-I3SSF2T6.js} +1 -1
- package/dist/standalone/{chunk-ALQHMFOC.js → chunk-I5QX75DE.js} +1 -1
- package/dist/standalone/{chunk-JCRFMCNP.js → chunk-ICHZ2IBL.js} +1 -1
- package/dist/standalone/{chunk-E2FFHKGI.js → chunk-IG5VD7R7.js} +1 -1
- package/dist/standalone/{chunk-ABMHWBYA.js → chunk-KKMQUBYH.js} +1 -1
- package/dist/standalone/{chunk-AEU3EF4T.js → chunk-LDHJRHPZ.js} +1 -1
- package/dist/standalone/{chunk-X54WR7FF.js → chunk-MNYDT3RH.js} +1 -1
- package/dist/standalone/{chunk-OPIMGKWU.js → chunk-MT4ICMXJ.js} +1 -1
- package/dist/standalone/{chunk-N7WQJPOM.js → chunk-MXJTD2OX.js} +1 -1
- package/dist/standalone/{chunk-WCWP4EAW.js → chunk-OZAOWE7T.js} +1 -1
- package/dist/standalone/{chunk-GVZ3VFGG.js → chunk-Q3IA6HPX.js} +1 -1
- package/dist/standalone/{chunk-3RZD6VJ7.js → chunk-RBIVXSXT.js} +1 -1
- package/dist/standalone/{chunk-JHTL3QHW.js → chunk-SDDEOSQB.js} +1 -1
- package/dist/standalone/chunk-SHHGIT7M.js +7 -0
- package/dist/standalone/{chunk-Z57KMMOK.js → chunk-SVQWZPO4.js} +1 -1
- package/dist/standalone/{chunk-YX2N5PJW.js → chunk-TEMI7MVE.js} +1 -1
- package/dist/standalone/{chunk-VHPTPEZ4.js → chunk-U5MPNEM2.js} +1 -1
- package/dist/standalone/{chunk-5NIQHOPN.js → chunk-ULQNADMJ.js} +1 -1
- package/dist/standalone/{chunk-66LYVBXB.js → chunk-UPPNZ6MI.js} +1 -1
- package/dist/standalone/{chunk-ZSLKFLWE.js → chunk-UTQLJKHH.js} +1 -1
- package/dist/standalone/{chunk-FQEZUQ36.js → chunk-UVG3ZISC.js} +1 -1
- package/dist/standalone/{chunk-2FTGLXYA.js → chunk-VQDTA4P6.js} +1 -1
- package/dist/standalone/{chunk-7O5SGABV.js → chunk-WLHQ4FKC.js} +1 -1
- package/dist/standalone/{chunk-XWWQIAF6.js → chunk-XPFVUAPX.js} +1 -1
- package/dist/standalone/{chunk-NF2Q75WM.js → chunk-Y3IGTWUE.js} +1 -1
- package/dist/standalone/{chunk-J6FR2B77.js → chunk-Y64STA6O.js} +1 -1
- package/dist/standalone/{chunk-IUGNIG6L.js → chunk-YEXTJUKQ.js} +1 -1
- package/dist/standalone/{chunk-RE7GRXBM.js → chunk-YFTPHGS2.js} +1 -1
- package/dist/standalone/{chunk-EXFERMUT.js → chunk-Z64BZNPS.js} +1 -1
- package/dist/standalone/{chunk-TMWKF4XM.js → chunk-Z6VILGGP.js} +1 -1
- package/dist/standalone/{chunk-MQTI3STP.js → chunk-ZBOB33BA.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +3 -3
- package/dist/standalone/chunk-FACXM2UB.js +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,c as D}from"./chunk-BKI3JMXQ.js";import{a as F}from"./chunk-ELSQ4FVH.js";import{a as j}from"./chunk-J45HAKBU.js";import{a as V}from"./chunk-FHLODLBC.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{i as k}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import"./chunk-UD5REVU2.js";import{a as T}from"./chunk-RCXNYW7P.js";import{b as K}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as z}from"./chunk-
|
|
1
|
+
import{a as O,c as D}from"./chunk-BKI3JMXQ.js";import{a as F}from"./chunk-ELSQ4FVH.js";import{a as j}from"./chunk-J45HAKBU.js";import{a as V}from"./chunk-FHLODLBC.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{i as k}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import"./chunk-UD5REVU2.js";import{a as T}from"./chunk-RCXNYW7P.js";import{b as K}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as z}from"./chunk-YEXTJUKQ.js";import"./chunk-LSEUUZN4.js";import{a as A,b as q,c as B,d as p,e as d,f as l}from"./chunk-7QEZ2SFW.js";import"./chunk-OZAOWE7T.js";import"./chunk-BBDTJG2K.js";import"./chunk-4PI2OSSP.js";import{a as I}from"./chunk-2W4UO5BC.js";import{c as L}from"./chunk-4N76XUNG.js";import{a as M,e as R}from"./chunk-OK2QU2EV.js";import"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as E,p as b,w as C}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import"./chunk-GWNGVKLG.js";import{a as ee,b as te}from"./chunk-6G3E4PJ2.js";import{a as i,d as y}from"./chunk-5PEAXTYQ.js";var s=y(ee(),1);var e=y(te(),1);var re=i(o=>o===void 0?"":JSON.stringify(o,b),"te"),ae=41,J=480,H=5,ie=i((o,t)=>O(o,n=>{t(n.height>0?n:{height:J,width:n.width})}),"ae"),Ne=i(({initialShardKey:o})=>{let t=E(),{queryShardKey:n,setShardKey:P,shardKey:U}=j(o),[m,W]=(0,s.useState)(""),{data:f,error:g,errorSource:Z,isLoading:_,liveError:G}=L(I.getAuditLog,{},{live:!0,shardKey:n}),c=(0,s.useMemo)(()=>f?.entries??[],[f]),h=(0,s.useMemo)(()=>{let a=m.trim().toLowerCase();return a===""?c:c.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[c,m]),x=(0,s.useRef)(null),v=D({count:h.length,estimateSize:i(()=>ae,"estimateSize"),getScrollElement:i(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),Q=v.getTotalSize(),N=u[0]?.start??0,w=Q-(u.at(-1)?.end??0),X={height:N},Y={height:w},$=i(a=>{W(a.target.value)},"k");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(V,{onChange:P,testId:"au-shard-input",value:U}),(0,e.jsx)(F,{message:G,prefix:"au"}),(0,e.jsx)(k,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:$,placeholder:t("filter op, table, id"),value:m})]}),g!==null&&(0,e.jsx)(z,{error:Z,shardKey:n,testId:"au-error"}),g===null&&!_&&h.length===0&&(0,e.jsx)(T,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),h.length>0&&(0,e.jsx)(M,{className:"overflow-hidden py-0",children:(0,e.jsx)(R,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(A,{"data-testid":"au-table",children:[(0,e.jsx)(q,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(d,{children:t("time")}),(0,e.jsx)(d,{children:t("op")}),(0,e.jsx)(d,{children:t("table")}),(0,e.jsx)(d,{children:t("id")}),(0,e.jsx)(d,{children:t("detail")})]})}),(0,e.jsxs)(B,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})}),u.map(a=>{let r=h[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(l,{className:"text-muted-foreground tabular-nums",children:C(r.ts,"\u2014")}),(0,e.jsx)(l,{children:(0,e.jsx)(K,{variant:"secondary",children:r.op})}),(0,e.jsx)(l,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(l,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(l,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Y})})]})]})})})]})},"we");export{Ne as AuditPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as A}from"./chunk-
|
|
1
|
+
import{m as A}from"./chunk-SHHGIT7M.js";import{l as v}from"./chunk-GNI37YCV.js";import{a as F}from"./chunk-GWNGVKLG.js";import{a as _}from"./chunk-6G3E4PJ2.js";import{a as o,d as R}from"./chunk-5PEAXTYQ.js";var M=R(F(),1),i=R(_(),1);var U=6e4,b=o(e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function","g"),g=5e3,x=o((e,r,s)=>{let t=(0,M.c)(9),n=s===void 0?g:s,h=A(),d=(0,i.useRef)(e),c;t[0]!==e?(c=o(()=>{d.current=e},"c"),t[0]=e,t[1]=c):c=t[1],(0,i.useEffect)(c);let u;t[2]!==r||t[3]!==n?(u=o(()=>{if(!r)return;let l=n,p=!1,T,m=o(()=>{p||(T=setTimeout(P,l))},"f"),y=o(()=>{l=n,m()},"p"),E=o(a=>{v(a)||(l=Math.max(n,Math.min(l*2,U)),m())},"_"),P=o(()=>{if(globalThis.document?.hidden===!0){m();return}let a;try{a=d.current()}catch(S){E(S);return}b(a)?Promise.resolve(a).then(y).catch(E):y()},"A");return m(),()=>{p=!0,clearTimeout(T)}},"i"),t[2]=r,t[3]=n,t[4]=u):u=t[4];let f;t[5]!==h||t[6]!==r||t[7]!==n?(f=[h,r,n],t[5]=h,t[6]=r,t[7]=n,t[8]=f):f=t[8],(0,i.useEffect)(u,f)},"U"),D=o(async e=>{let r=(await Promise.allSettled(e)).find(s=>s.status==="rejected");if(r!==void 0)throw r.reason},"v");export{x as a,D as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ne}from"./chunk-PJUVJTDR.js";import{a as A}from"./chunk-TKBTZX4K.js";import{a as re}from"./chunk-YEVTA35E.js";import{a as te}from"./chunk-FHLODLBC.js";import{b as ee}from"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{i as Q}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as w}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{b as j}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as X}from"./chunk-2W4UO5BC.js";import{
|
|
1
|
+
import{a as ne}from"./chunk-PJUVJTDR.js";import{a as A}from"./chunk-TKBTZX4K.js";import{a as re}from"./chunk-YEVTA35E.js";import{a as te}from"./chunk-FHLODLBC.js";import{b as ee}from"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{i as Q}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as w}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{b as j}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as X}from"./chunk-2W4UO5BC.js";import{c as I,d as P,m as H}from"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as Y,g as U,h as q,j as O,p as W,s as G,w as V}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import"./chunk-GWNGVKLG.js";import{a as he,b as ge}from"./chunk-6G3E4PJ2.js";import{a as o,d as M}from"./chunk-5PEAXTYQ.js";var c=M(he(),1);var n=M(ge(),1);var be=o(t=>t.kind==="id"?t.table===void 0?"id":`id<${t.table}>`:t.kind==="array"?t.element===void 0?"array":`${t.element}[]`:t.kind,"me"),xe=o(t=>t===void 0||t.length===0?"()":`(${t.map(e=>`${e.name}${e.optional?"?":""}: ${be(e)}`).join(", ")})`,"ge"),ye=o(t=>{switch(t){case"array":return[];case"bigint":return I(0n);case"boolean":return!1;case"bytes":return I(new ArrayBuffer(0));case"number":return 0;case"object":case"record":return{};default:return""}},"be"),ve=o(t=>{let e={};for(let r of t??[])r.optional||(e[r.name]=ye(r.kind));return JSON.stringify(e,void 0,2)},"xe"),Ne=q(X.runAs),h="\xABsensitive\xBB",we=o(t=>(t??[]).filter(e=>e.sensitive===!0).map(e=>e.name),"ve"),Ae=o((t,e)=>{if(e.length===0)return t;try{let r=JSON.parse(t);if(typeof r!="object"||r===null||Array.isArray(r))return"";let l={...r};for(let i of e)Object.hasOwn(l,i)&&(l[i]=h);return JSON.stringify(l,null,2)}catch{return""}},"Ne"),Se=4,ke=o(t=>{let e=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{return}},"Ae"),$e=o(t=>Array.isArray(t)?[]:Object.keys(t).filter(e=>e.length>0),"we"),Ie=o(t=>{let e=[],r=new Set,l=[t];for(;l.length>0;){let i=l.pop();if(typeof i=="string")i.length>0&&e.push(i);else if(typeof i=="number"||typeof i=="bigint")e.push(String(i));else if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)){let u=ke(i);u!==void 0&&u.length>0&&e.push(u)}else typeof i=="object"&&i!==null&&!r.has(i)&&(r.add(i),e.push(...$e(i)),l.push(...Object.values(i)))}return e},"ke"),Oe=o((t,e)=>{let r=[],l=new Set,i=[[t,e]];for(;i.length>0;){let[u,s]=i.pop()??[void 0,void 0];typeof s=="boolean"?r.push({key:u,text:s?"true":"false"}):typeof s=="object"&&s!==null&&!l.has(s)&&(l.add(s),Array.isArray(s)?i.push(...s.map(p=>[void 0,p])):i.push(...Object.entries(s)))}return r},"Re"),ae=o(t=>t.replaceAll(/[$()*+.?[\\\]^{|}]/gu,String.raw`\$&`),"P"),je=o((t,e)=>e.length>=Se?t.replaceAll(e,h):t.replaceAll(new RegExp(`(?<![A-Za-z0-9])${ae(e)}(?![A-Za-z0-9])`,"gu"),h),"Oe"),Re=o((t,e)=>{let r=t.replaceAll(`"${e.text}"`,h);if(e.key===void 0)return r;let l=ae(e.key);return r.replaceAll(new RegExp(`(?<![A-Za-z0-9_])${l}=${e.text}(?![A-Za-z0-9_])`,"gu"),`${e.key}=${h}`).replaceAll(new RegExp(String.raw`"${l}":\s*${e.text}(?![A-Za-z0-9_])`,"gu"),`"${e.key}":${h}`)},"Ie"),Ce=o((t,e,r)=>{if(r.length===0||typeof e!="object"||e===null)return t;let l=r.flatMap(s=>Oe(s,e[s])),i=r.flatMap(s=>Ie(e[s])).flatMap(s=>{let p=JSON.stringify(s).slice(1,-1);return p===s?[s]:[s,p]}).toSorted((s,p)=>p.length-s.length),u=t;for(let s of l)u=Re(u,s);for(let s of i)u=je(u,s);return u},"$e"),Te=10,Fe=o(t=>t===void 0?"undefined":JSON.stringify(t,W,2),"Ce"),ze=o((t,e)=>[{argsText:Ae(e.argsText,e.sensitive),at:Date.now(),id:(t[0]?.id??0)+1,kind:e.selected.kind,path:e.selected.path,redacted:e.sensitive.length>0,shardKey:e.shardKey,status:e.runStatus},...t].slice(0,Te),"Ee"),Ge=o(({functions:t,runAsIdentity:e=!1}={})=>{let r=Y(),l=H(),[i,u]=(0,c.useState)(null),[s,p]=(0,c.useState)(null),S=t??i??[],[R,C]=(0,c.useState)(""),[y,k]=(0,c.useState)("{}"),[g,T]=(0,c.useState)(""),[b,se]=(0,c.useState)(""),[$,x]=(0,c.useState)("idle"),[ie,v]=(0,c.useState)(void 0),[F,N]=(0,c.useState)(null),[z,oe]=(0,c.useState)([]);(0,c.useEffect)(()=>{if(t!==void 0)return;let a=!1;return l.listFunctions().then(f=>(a||u(f),f)).catch(f=>{a||p(O(f))}),()=>{a=!0}},[l,t]);let B=R===""?S[0]?.path??"":R,d=S.find(a=>a.path===B),le=o(async()=>{if(!d)return;let a;try{a=y.trim()===""?{}:P(JSON.parse(y))}catch(m){x("error"),v(void 0),N(r("Invalid JSON args: {message}",{message:m.message}));return}let f={__lunoraRef:d.path},E=g.trim()===""?{}:{shardKey:g.trim()},K=e?b.trim():"",Z=we(d.args),D=o(m=>{oe(me=>ze(me,{argsText:y,runStatus:m,selected:d,sensitive:Z,shardKey:g}))},"M");x("running"),N(null);try{let m=K===""?await U(l,d.kind,f,a,E):await l.query(Ne,{args:a,functionPath:d.path,userId:K},E);ee(g),v(m),x("success"),D("success")}catch(m){v(void 0),N(Ce(O(m),a,Z)),x("error"),D("error")}},"H"),de=o(a=>{if(C(a.path),T(a.shardKey),a.redacted){v(void 0),N(r("Re-enter the sensitive values before running this again.")),x("error");return}k(a.argsText)},"G"),ue=o(a=>{C(a.target.value)},"W"),ce=o(a=>{k(a.target.value)},"X"),fe=o(a=>{se(a.target.value)},"Y"),J=o(()=>{G(le())},"j"),L=e?b.trim():"",_=$==="running"||d===void 0,pe=o(()=>{k(ve(d?.args))},"_");return(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[s!==null&&(0,n.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:s}),(0,n.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsx)(A,{htmlFor:"function-select",children:r("Function")}),(0,n.jsx)("select",{"aria-label":r("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:ue,value:B,children:S.map(a=>(0,n.jsxs)("option",{value:a.path,children:[a.path," (",a.kind,")"]},a.path))}),d!==void 0&&(0,n.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,n.jsx)("span",{className:"mr-1.5 font-medium",children:r("Signature")}),(0,n.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:xe(d.args)})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)(A,{htmlFor:"args-input",children:r("Arguments")}),(0,n.jsx)(w,{"data-testid":"prefill-button",disabled:d===void 0,onClick:pe,size:"xs",type:"button",variant:"ghost",children:r("Prefill")})]}),(0,n.jsx)(ne,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:ce,value:y})]}),(0,n.jsx)(te,{onChange:T,testId:"shard-input",value:g}),e&&(0,n.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,n.jsx)(A,{htmlFor:"run-as-input",children:r("Run as identity (userId)")}),(0,n.jsx)(Q,{"aria-label":r("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:fe,placeholder:r("Leave empty to run as admin"),value:b}),(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground",children:r("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[L!==""&&d!==void 0&&d.kind!=="query"?(0,n.jsx)(re,{confirmLabel:r("This will execute `{functionPath}` as user `{userId}`.",{functionPath:d.path,userId:L}),disabled:_,onConfirm:J,testId:"run-button",children:r("Run")}):(0,n.jsx)(w,{"data-testid":"run-button",disabled:_,onClick:J,type:"button",children:r("Run")}),d!==void 0&&(0,n.jsx)(j,{variant:"outline",children:d.kind}),e&&b.trim()!==""&&(0,n.jsx)(j,{"data-testid":"run-as-badge",variant:"secondary",children:r("as {userId}",{userId:b.trim()})})]})]}),$==="error"&&F!==null&&(0,n.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:F}),$==="success"&&(0,n.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:Fe(ie)}),z.length>0&&(0,n.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:z.map((a,f)=>(0,n.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,n.jsx)("span",{className:a.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${f.toString()}`,children:a.status==="success"?"\u2713":"\u2717"})," ",(0,n.jsxs)("span",{className:"font-mono text-xs",children:[a.path," (",a.kind,")"]})," ",(0,n.jsx)("time",{className:"text-xs text-muted-foreground",children:V(a.at)})," ",(0,n.jsx)(w,{className:"ml-auto","data-testid":`fn-history-load-${f.toString()}`,onClick:o(()=>{de(a)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Load")})]},a.id))})]})},"Ge");export{Ge as FunctionRunner};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ue}from"./chunk-P6VNMPWR.js";import{a as ke}from"./chunk-GJXCPZDN.js";import{a as Re}from"./chunk-
|
|
1
|
+
import{c as Ue}from"./chunk-P6VNMPWR.js";import{a as ke}from"./chunk-GJXCPZDN.js";import{a as Re}from"./chunk-EPWCW2DF.js";import{e as _e}from"./chunk-KH6OXCG3.js";import"./chunk-66BMMNUR.js";import"./chunk-JD6PRRFO.js";import"./chunk-NGZNXNRD.js";import"./chunk-2SNHKJXK.js";import"./chunk-BCUOQNI2.js";import"./chunk-P5EVJEGC.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import{a as Ie}from"./chunk-YEVTA35E.js";import{a as Fe}from"./chunk-FHLODLBC.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import{i as Te}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as ee}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as ve}from"./chunk-RCXNYW7P.js";import{b as ae}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as Oe,b as Ee,c as Le,d as de,e as te,f as X}from"./chunk-7QEZ2SFW.js";import{a as xe}from"./chunk-2W4UO5BC.js";import{a as $e,e as Ke}from"./chunk-OK2QU2EV.js";import{m as ze}from"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as De,h as pe,i as be,j as le,o as ye,s as Z,v as je}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as yt}from"./chunk-GWNGVKLG.js";import{a as bt,b as xt}from"./chunk-6G3E4PJ2.js";import{a as h,d as ge}from"./chunk-5PEAXTYQ.js";var B=ge(yt(),1),z=ge(bt(),1);var o=ge(xt(),1);var Ae=h((d,e,t)=>{let{onCopy:r,onDelete:l,onDownload:n,onToggleSelect:c}=t,i=h(()=>{r(d.key)},"c"),s=h(()=>{n(d.key)},"o"),u=h(()=>{l(d.key)},"f"),m=h(()=>{c(d.key)},"h");return{copy:i,download:s,name:d.key.slice(e.length),remove:u,toggle:m}},"Re"),We=h(d=>{let e=(0,B.c)(31),{busy:t,buttonClassName:r,copied:l,objectKey:n,onCopy:c,onDelete:i,onDownload:s,t:u}=d,m=`storage-copy-${n}`,f;e[0]!==l||e[1]!==u?(f=u(l?"Copied":"Copy URL"),e[0]=l,e[1]=u,e[2]=f):f=e[2];let g;e[3]!==t||e[4]!==r||e[5]!==c||e[6]!==m||e[7]!==f?(g=(0,o.jsx)(ee,{className:r,"data-testid":m,disabled:t,onClick:c,size:"sm",type:"button",variant:"ghost",children:f}),e[3]=t,e[4]=r,e[5]=c,e[6]=m,e[7]=f,e[8]=g):g=e[8];let w=`storage-download-${n}`,a;e[9]!==u?(a=u("Download"),e[9]=u,e[10]=a):a=e[10];let k;e[11]!==t||e[12]!==r||e[13]!==s||e[14]!==w||e[15]!==a?(k=(0,o.jsx)(ee,{className:r,"data-testid":w,disabled:t,onClick:s,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=t,e[12]=r,e[13]=s,e[14]=w,e[15]=a,e[16]=k):k=e[16];let S;e[17]!==u?(S=u("Delete object?"),e[17]=u,e[18]=S):S=e[18];let x=`storage-delete-${n}`,b;e[19]!==u?(b=u("Delete"),e[19]=u,e[20]=b):b=e[20];let y;e[21]!==t||e[22]!==i||e[23]!==S||e[24]!==x||e[25]!==b?(y=(0,o.jsx)(Ie,{confirmLabel:S,disabled:t,onConfirm:i,testId:x,children:b}),e[21]=t,e[22]=i,e[23]=S,e[24]=x,e[25]=b,e[26]=y):y=e[26];let v;return e[27]!==y||e[28]!==g||e[29]!==k?(v=(0,o.jsxs)(o.Fragment,{children:[g,k,y]}),e[27]=y,e[28]=g,e[29]=k,e[30]=v):v=e[30],v},"ze"),He=h(d=>{let e=(0,B.c)(14),{objectKey:t,references:r,t:l}=d;if(r===void 0)return null;if(r.length===0){let m=`storage-orphan-${t}`,f;e[0]!==l?(f=l("Orphan"),e[0]=l,e[1]=f):f=e[1];let g;return e[2]!==m||e[3]!==f?(g=(0,o.jsx)(ae,{"data-testid":m,variant:"warning",children:f}),e[2]=m,e[3]=f,e[4]=g):g=e[4],g}let n;e[5]!==r?(n=r.map(vt).join(`
|
|
2
2
|
`),e[5]=r,e[6]=n):n=e[6];let c=n,i=`storage-refs-${t}`,s;e[7]!==r.length||e[8]!==l?(s=r.length===1?l("1 record"):l("{count} records",{count:r.length}),e[7]=r.length,e[8]=l,e[9]=s):s=e[9];let u;return e[10]!==c||e[11]!==i||e[12]!==s?(u=(0,o.jsx)(ae,{"data-testid":i,title:c,variant:"secondary",children:s}),e[10]=c,e[11]=i,e[12]=s,e[13]=u):u=e[13],u},"De"),Ze=h(d=>{let e=(0,B.c)(7),{objectKey:t,onToggle:r,selected:l,t:n}=d,c;e[0]!==n?(c=n("Select row"),e[0]=n,e[1]=c):c=e[1];let i=`storage-select-${t}`,s;return e[2]!==r||e[3]!==l||e[4]!==c||e[5]!==i?(s=(0,o.jsx)(ke,{"aria-label":c,checked:l,"data-testid":i,onCheckedChange:r}),e[2]=r,e[3]=l,e[4]=c,e[5]=i,e[6]=s):s=e[6],s},"je");function vt(d){return`${d.table}\xB7${d.id}`}h(vt,"kt");var kt=h(d=>{let e=(0,B.c)(10),{colSpan:t,name:r,onEnter:l}=d,n;e[0]!==r||e[1]!==l?(n=h(()=>{l(r)},"l"),e[0]=r,e[1]=l,e[2]=n):n=e[2];let c=n,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})}),e[3]=i):i=e[3];let s;e[4]!==c||e[5]!==r?(s=(0,o.jsxs)("button",{className:"inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground","data-testid":"fb-folder",onClick:c,type:"button",children:[i,r]}),e[4]=c,e[5]=r,e[6]=s):s=e[6];let u;return e[7]!==t||e[8]!==s?(u=(0,o.jsx)(de,{children:(0,o.jsx)(X,{colSpan:t,children:s})}),e[7]=t,e[8]=s,e[9]=u):u=e[9],u},"St"),wt=h(d=>{let e=(0,B.c)(37),{busy:t,copiedKey:r,handlers:l,object:n,prefix:c,references:i,selected:s,showReferences:u,t:m}=d,f;e[0]!==l||e[1]!==n||e[2]!==c?(f=Ae(n,c,l),e[0]=l,e[1]=n,e[2]=c,e[3]=f):f=e[3];let{copy:g,download:w,name:a,remove:k,toggle:S}=f,x;e[4]!==n.key||e[5]!==s||e[6]!==m||e[7]!==S?(x=(0,o.jsx)(X,{className:"w-8",children:(0,o.jsx)(Ze,{objectKey:n.key,onToggle:S,selected:s,t:m})}),e[4]=n.key,e[5]=s,e[6]=m,e[7]=S,e[8]=x):x=e[8];let b;e[9]!==a?(b=(0,o.jsx)(X,{className:"font-mono text-xs",children:a}),e[9]=a,e[10]=b):b=e[10];let y;e[11]!==n.size?(y=ye(n.size),e[11]=n.size,e[12]=y):y=e[12];let v;e[13]!==y?(v=(0,o.jsx)(X,{className:"tabular-nums text-muted-foreground",children:y}),e[13]=y,e[14]=v):v=e[14];let j=n.httpMetadata?.contentType??"",N;e[15]!==j?(N=(0,o.jsx)(X,{children:j}),e[15]=j,e[16]=N):N=e[16];let C;e[17]!==n.key||e[18]!==i||e[19]!==u||e[20]!==m?(C=u&&(0,o.jsx)(X,{children:(0,o.jsx)(He,{objectKey:n.key,references:i,t:m})}),e[17]=n.key,e[18]=i,e[19]=u,e[20]=m,e[21]=C):C=e[21];let T=r===n.key,D;e[22]!==t||e[23]!==g||e[24]!==w||e[25]!==n.key||e[26]!==k||e[27]!==m||e[28]!==T?(D=(0,o.jsx)(X,{className:"text-right",children:(0,o.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,o.jsx)(We,{busy:t,copied:T,objectKey:n.key,onCopy:g,onDelete:k,onDownload:w,t:m})})}),e[22]=t,e[23]=g,e[24]=w,e[25]=n.key,e[26]=k,e[27]=m,e[28]=T,e[29]=D):D=e[29];let F;return e[30]!==D||e[31]!==x||e[32]!==b||e[33]!==v||e[34]!==N||e[35]!==C?(F=(0,o.jsxs)(de,{"data-testid":"fb-row",children:[x,b,v,N,C,D]}),e[30]=D,e[31]=x,e[32]=b,e[33]=v,e[34]=N,e[35]=C,e[36]=F):F=e[36],F},"wt"),St=h(d=>{let e=(0,B.c)(65),{allSelected:t,busy:r,copiedKey:l,files:n,folders:c,handlers:i,onEnterFolder:s,prefix:u,references:m,selected:f,showReferences:g,someSelected:w,t:a,toggleSelectAll:k}=d,S;e[0]!==a?(S=a("Select all rows"),e[0]=a,e[1]=S):S=e[1];let x;e[2]!==t||e[3]!==w||e[4]!==S||e[5]!==k?(x=(0,o.jsx)(te,{className:"w-8",children:(0,o.jsx)(ke,{"aria-label":S,checked:t,"data-testid":"storage-select-all",indeterminate:w,onCheckedChange:k})}),e[2]=t,e[3]=w,e[4]=S,e[5]=k,e[6]=x):x=e[6];let b;e[7]!==a?(b=a("key"),e[7]=a,e[8]=b):b=e[8];let y;e[9]!==b?(y=(0,o.jsx)(te,{children:b}),e[9]=b,e[10]=y):y=e[10];let v;e[11]!==a?(v=a("size"),e[11]=a,e[12]=v):v=e[12];let j;e[13]!==v?(j=(0,o.jsx)(te,{children:v}),e[13]=v,e[14]=j):j=e[14];let N;e[15]!==a?(N=a("content-type"),e[15]=a,e[16]=N):N=e[16];let C;e[17]!==N?(C=(0,o.jsx)(te,{children:N}),e[17]=N,e[18]=C):C=e[18];let T;e[19]!==g||e[20]!==a?(T=g&&(0,o.jsx)(te,{children:a("used by")}),e[19]=g,e[20]=a,e[21]=T):T=e[21];let D;e[22]!==a?(D=a("Actions"),e[22]=a,e[23]=D):D=e[23];let F;e[24]!==D?(F=(0,o.jsx)(te,{"aria-label":D}),e[24]=D,e[25]=F):F=e[25];let $;e[26]!==F||e[27]!==x||e[28]!==y||e[29]!==j||e[30]!==C||e[31]!==T?($=(0,o.jsx)(Ee,{children:(0,o.jsxs)(de,{children:[x,y,j,C,T,F]})}),e[26]=F,e[27]=x,e[28]=y,e[29]=j,e[30]=C,e[31]=T,e[32]=$):$=e[32];let O;if(e[33]!==c||e[34]!==s||e[35]!==g){let E;e[37]!==s||e[38]!==g?(E=h(I=>(0,o.jsx)(kt,{colSpan:g?6:5,name:I,onEnter:s},I),"D"),e[37]=s,e[38]=g,e[39]=E):E=e[39],O=c.map(E),e[33]=c,e[34]=s,e[35]=g,e[36]=O}else O=e[36];let R;if(e[40]!==r||e[41]!==l||e[42]!==n||e[43]!==i||e[44]!==u||e[45]!==m||e[46]!==f||e[47]!==g||e[48]!==a){let E;e[50]!==r||e[51]!==l||e[52]!==i||e[53]!==u||e[54]!==m||e[55]!==f||e[56]!==g||e[57]!==a?(E=h(I=>(0,o.jsx)(wt,{busy:r,copiedKey:l,handlers:i,object:I,prefix:u,references:m[I.key],selected:f.has(I.key),showReferences:g,t:a},I.key),"D"),e[50]=r,e[51]=l,e[52]=i,e[53]=u,e[54]=m,e[55]=f,e[56]=g,e[57]=a,e[58]=E):E=e[58],R=n.map(E),e[40]=r,e[41]=l,e[42]=n,e[43]=i,e[44]=u,e[45]=m,e[46]=f,e[47]=g,e[48]=a,e[49]=R}else R=e[49];let L;e[59]!==O||e[60]!==R?(L=(0,o.jsxs)(Le,{children:[O,R]}),e[59]=O,e[60]=R,e[61]=L):L=e[61];let _;return e[62]!==$||e[63]!==L?(_=(0,o.jsx)($e,{className:"overflow-hidden py-0",children:(0,o.jsx)(Ke,{className:"px-0",children:(0,o.jsxs)(Oe,{"data-testid":"fb-table",children:[$,L]})})}),e[62]=$,e[63]=L,e[64]=_):_=e[64],_},"Ct"),Nt=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],Ct=3600,Me=h((d,e)=>{if(e==="size")return d.size;if(e==="type")return d.httpMetadata?.contentType??"";if(e==="date"){if(d.uploaded===void 0)return 0;let t=new Date(d.uploaded).getTime();return Number.isNaN(t)?0:t}return e.startsWith("tag:")?d.customMetadata?.[e.slice(4)]??"":d.key},"we"),jt=h((d,e,t)=>{let r=t==="desc"?-1:1;return d.toSorted((l,n)=>{let c=Me(l,e),i=Me(n,e);return(typeof c=="number"&&typeof i=="number"?c-i:String(c).localeCompare(String(i)))*r})},"Et"),zt=h((d,e)=>{let t=new Set,r=[];for(let l of d){let n=l.key.slice(e.length),c=n.indexOf("/");c===-1?r.push(l):t.add(n.slice(0,c+1))}return{files:r,folders:[...t].toSorted((l,n)=>l.localeCompare(n))}},"_t"),Dt=h(d=>{let e=(0,B.c)(59),{bucket:t,buckets:r,busy:l,draftPrefix:n,expiry:c,fileInputRef:i,onBucketChange:s,onExpiryChange:u,onFileChange:m,onList:f,onPrefixChange:g,onUploadClick:w,t:a}=d,k;e[0]!==g?(k=h(A=>{g(A.target.value)},"v"),e[0]=g,e[1]=k):k=e[1];let S=k,x;e[2]!==s?(x=h(A=>{s(A.target.value)},"y"),e[2]=s,e[3]=x):x=e[3];let b=x,y;e[4]!==u?(y=h(A=>{u(Number.parseInt(A.target.value,10))},"b"),e[4]=u,e[5]=y):y=e[5];let v=y,j;e[6]!==t||e[7]!==r||e[8]!==b||e[9]!==a?(j=r.length>0&&(0,o.jsx)("select",{"aria-label":a("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:b,value:t,children:r.map($t)}),e[6]=t,e[7]=r,e[8]=b,e[9]=a,e[10]=j):j=e[10];let N;e[11]!==a?(N=a("Key prefix"),e[11]=a,e[12]=N):N=e[12];let C;e[13]!==a?(C=a("key prefix (optional)"),e[13]=a,e[14]=C):C=e[14];let T;e[15]!==n||e[16]!==S||e[17]!==N||e[18]!==C?(T=(0,o.jsx)(Te,{"aria-label":N,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:S,placeholder:C,value:n}),e[15]=n,e[16]=S,e[17]=N,e[18]=C,e[19]=T):T=e[19];let D;e[20]!==a?(D=a("List"),e[20]=a,e[21]=D):D=e[21];let F;e[22]!==l||e[23]!==f||e[24]!==D?(F=(0,o.jsx)(ee,{"data-testid":"fb-list",disabled:l,onClick:f,size:"sm",type:"button",children:D}),e[22]=l,e[23]=f,e[24]=D,e[25]=F):F=e[25];let $;e[26]!==l||e[27]!==a?($=a(l?"Uploading\u2026":"Upload"),e[26]=l,e[27]=a,e[28]=$):$=e[28];let O;e[29]!==l||e[30]!==w||e[31]!==$?(O=(0,o.jsx)(ee,{"data-testid":"storage-upload",disabled:l,onClick:w,size:"sm",type:"button",variant:"outline",children:$}),e[29]=l,e[30]=w,e[31]=$,e[32]=O):O=e[32];let R;e[33]!==i||e[34]!==m?(R=(0,o.jsx)("input",{className:"hidden","data-testid":"storage-file-input",onChange:m,ref:i,type:"file"}),e[33]=i,e[34]=m,e[35]=R):R=e[35];let L;e[36]!==a?(L=a("Link expiry"),e[36]=a,e[37]=L):L=e[37];let _;e[38]!==a?(_=Nt.map(A=>(0,o.jsx)("option",{value:A.seconds,children:a(A.label)},A.seconds)),e[38]=a,e[39]=_):_=e[39];let E;e[40]!==c||e[41]!==v||e[42]!==_?(E=(0,o.jsx)("select",{className:"h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":"storage-expiry",id:"storage-expiry",onChange:v,value:c,children:_}),e[40]=c,e[41]=v,e[42]=_,e[43]=E):E=e[43];let I;e[44]!==L||e[45]!==E?(I=(0,o.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[L,E]}),e[44]=L,e[45]=E,e[46]=I):I=e[46];let M;e[47]!==a?(M=a("Open in Cloudflare"),e[47]=a,e[48]=M):M=e[48];let P;e[49]!==M?(P=(0,o.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:Ue,rel:"noreferrer",target:"_blank",children:M}),e[49]=M,e[50]=P):P=e[50];let W;return e[51]!==O||e[52]!==R||e[53]!==I||e[54]!==P||e[55]!==j||e[56]!==T||e[57]!==F?(W=(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[j,T,F,O,R,I,P]}),e[51]=O,e[52]=R,e[53]=I,e[54]=P,e[55]=j,e[56]=T,e[57]=F,e[58]=W):W=e[58],W},"$t"),Tt=h(d=>{let e=(0,B.c)(66),{onSortKeyChange:t,onThumbSizeChange:r,showGrid:l,showList:n,sortDirection:c,sortKey:i,t:s,tagKeys:u,thumbSize:m,toggleSortDirection:f,view:g}=d,w;e[0]!==t?(w=h(q=>{t(q.target.value)},"k"),e[0]=t,e[1]=w):w=e[1];let a=w,k;e[2]!==r?(k=h(q=>{r(Number.parseInt(q.target.value,10))},"v"),e[2]=r,e[3]=k):k=e[3];let S=k,x=g==="list",b;e[4]!==s?(b=s("List"),e[4]=s,e[5]=b):b=e[5];let y;e[6]!==n||e[7]!==x||e[8]!==b?(y=(0,o.jsx)("button",{"aria-pressed":x,className:"px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-list",onClick:n,type:"button",children:b}),e[6]=n,e[7]=x,e[8]=b,e[9]=y):y=e[9];let v=g==="grid",j;e[10]!==s?(j=s("Grid"),e[10]=s,e[11]=j):j=e[11];let N;e[12]!==l||e[13]!==v||e[14]!==j?(N=(0,o.jsx)("button",{"aria-pressed":v,className:"border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-grid",onClick:l,type:"button",children:j}),e[12]=l,e[13]=v,e[14]=j,e[15]=N):N=e[15];let C;e[16]!==y||e[17]!==N?(C=(0,o.jsxs)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[y,N]}),e[16]=y,e[17]=N,e[18]=C):C=e[18];let T;e[19]!==s?(T=s("Sort"),e[19]=s,e[20]=T):T=e[20];let D;e[21]!==s?(D=s("Name"),e[21]=s,e[22]=D):D=e[22];let F;e[23]!==D?(F=(0,o.jsx)("option",{value:"name",children:D}),e[23]=D,e[24]=F):F=e[24];let $;e[25]!==s?($=s("size"),e[25]=s,e[26]=$):$=e[26];let O;e[27]!==$?(O=(0,o.jsx)("option",{value:"size",children:$}),e[27]=$,e[28]=O):O=e[28];let R;e[29]!==s?(R=s("Type"),e[29]=s,e[30]=R):R=e[30];let L;e[31]!==R?(L=(0,o.jsx)("option",{value:"type",children:R}),e[31]=R,e[32]=L):L=e[32];let _;e[33]!==s?(_=s("Modified"),e[33]=s,e[34]=_):_=e[34];let E;e[35]!==_?(E=(0,o.jsx)("option",{value:"date",children:_}),e[35]=_,e[36]=E):E=e[36];let I;e[37]!==u?(I=u.map(Kt),e[37]=u,e[38]=I):I=e[38];let M;e[39]!==a||e[40]!==i||e[41]!==F||e[42]!==O||e[43]!==L||e[44]!==E||e[45]!==I?(M=(0,o.jsxs)("select",{className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-sort",id:"fb-sort",onChange:a,value:i,children:[F,O,L,E,I]}),e[39]=a,e[40]=i,e[41]=F,e[42]=O,e[43]=L,e[44]=E,e[45]=I,e[46]=M):M=e[46];let P;e[47]!==T||e[48]!==M?(P=(0,o.jsxs)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[T,M]}),e[47]=T,e[48]=M,e[49]=P):P=e[49];let W;e[50]!==s?(W=s("Toggle sort direction"),e[50]=s,e[51]=W):W=e[51];let A=c==="asc"?"\u2191":"\u2193",H;e[52]!==W||e[53]!==A||e[54]!==f?(H=(0,o.jsx)("button",{"aria-label":W,className:"flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"fb-sort-dir",onClick:f,type:"button",children:A}),e[52]=W,e[53]=A,e[54]=f,e[55]=H):H=e[55];let V;e[56]!==S||e[57]!==s||e[58]!==m||e[59]!==g?(V=g==="grid"&&(0,o.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[s("Thumbnail size"),(0,o.jsx)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:S,step:8,type:"range",value:m})]}),e[56]=S,e[57]=s,e[58]=m,e[59]=g,e[60]=V):V=e[60];let re;return e[61]!==P||e[62]!==H||e[63]!==V||e[64]!==C?(re=(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[C,P,H,V]}),e[61]=P,e[62]=H,e[63]=V,e[64]=C,e[65]=re):re=e[65],re},"Ft");function $t(d){return(0,o.jsx)("option",{value:d,children:d},d)}h($t,"Rt");function Kt(d){return(0,o.jsx)("option",{value:`tag:${d}`,children:d},d)}h(Kt,"zt");var Ft=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,Ot=h(d=>(d.httpMetadata?.contentType??"").startsWith("image/")||Ft.test(d.key),"jt"),Et=h(()=>{let d=(0,B.c)(1),e;return d[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,o.jsx)("svg",{"aria-hidden":"true",className:"size-8 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"})}),d[0]=e):e=d[0],e},"Kt"),Lt=h(d=>{let e=(0,B.c)(13),{object:t,resolveUrl:r}=d,[l,n]=(0,z.useState)(null),[c,i]=(0,z.useState)(!1),s;e[0]!==t?(s=Ot(t),e[0]=t,e[1]=s):s=e[1];let u=s,m,f;e[2]!==u||e[3]!==t.key||e[4]!==r?(m=h(()=>{if(!u)return;let k={cancelled:!1};return Z((async()=>{try{let S=await r(t.key);k.cancelled||n(S)}catch{k.cancelled||i(!0)}})()),()=>{k.cancelled=!0}},"h"),f=[u,t.key,r],e[2]=u,e[3]=t.key,e[4]=r,e[5]=m,e[6]=f):(m=e[5],f=e[6]),(0,z.useEffect)(m,f);let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=h(()=>{i(!0)},"m"),e[7]=g):g=e[7];let w=g,a;return e[8]!==c||e[9]!==u||e[10]!==t.key||e[11]!==l?(a=(0,o.jsx)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:u&&l!==null&&!c?(0,o.jsx)("img",{alt:t.key,className:"size-full object-cover",loading:"lazy",onError:w,src:l}):(0,o.jsx)(Et,{})}),e[8]=c,e[9]=u,e[10]=t.key,e[11]=l,e[12]=a):a=e[12],a},"Bt"),It=h(d=>{let e=(0,B.c)(42),{busy:t,copiedKey:r,handlers:l,object:n,prefix:c,references:i,resolveUrl:s,selected:u,showReferences:m,t:f}=d,g;e[0]!==l||e[1]!==n||e[2]!==c?(g=Ae(n,c,l),e[0]=l,e[1]=n,e[2]=c,e[3]=g):g=e[3];let{copy:w,download:a,name:k,remove:S,toggle:x}=g,b;e[4]!==n||e[5]!==s?(b=(0,o.jsx)(Lt,{object:n,resolveUrl:s}),e[4]=n,e[5]=s,e[6]=b):b=e[6];let y;e[7]!==n.key||e[8]!==u||e[9]!==f||e[10]!==x?(y=(0,o.jsx)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,o.jsx)(Ze,{objectKey:n.key,onToggle:x,selected:u,t:f})}),e[7]=n.key,e[8]=u,e[9]=f,e[10]=x,e[11]=y):y=e[11];let v;e[12]!==b||e[13]!==y?(v=(0,o.jsxs)("div",{className:"relative",children:[b,y]}),e[12]=b,e[13]=y,e[14]=v):v=e[14];let j;e[15]!==k?(j=(0,o.jsx)("p",{className:"truncate font-mono text-xs",title:k,children:k}),e[15]=k,e[16]=j):j=e[16];let N;e[17]!==n.size?(N=ye(n.size),e[17]=n.size,e[18]=N):N=e[18];let C;e[19]!==N?(C=(0,o.jsx)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:N}),e[19]=N,e[20]=C):C=e[20];let T;e[21]!==n.key||e[22]!==i||e[23]!==m||e[24]!==f?(T=m&&(0,o.jsx)("div",{className:"mt-1",children:(0,o.jsx)(He,{objectKey:n.key,references:i,t:f})}),e[21]=n.key,e[22]=i,e[23]=m,e[24]=f,e[25]=T):T=e[25];let D;e[26]!==j||e[27]!==C||e[28]!==T?(D=(0,o.jsxs)("div",{className:"min-w-0",children:[j,C,T]}),e[26]=j,e[27]=C,e[28]=T,e[29]=D):D=e[29];let F=r===n.key,$;e[30]!==t||e[31]!==w||e[32]!==a||e[33]!==n.key||e[34]!==S||e[35]!==f||e[36]!==F?($=(0,o.jsx)("div",{className:"flex items-center gap-1",children:(0,o.jsx)(We,{busy:t,buttonClassName:"h-7 px-2 text-xs",copied:F,objectKey:n.key,onCopy:w,onDelete:S,onDownload:a,t:f})}),e[30]=t,e[31]=w,e[32]=a,e[33]=n.key,e[34]=S,e[35]=f,e[36]=F,e[37]=$):$=e[37];let O;return e[38]!==$||e[39]!==v||e[40]!==D?(O=(0,o.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[v,D,$]}),e[38]=$,e[39]=v,e[40]=D,e[41]=O):O=e[41],O},"Lt"),Rt=h(d=>{let e=(0,B.c)(9),{name:t,onEnter:r}=d,l;e[0]!==t||e[1]!==r?(l=h(()=>{r(t)},"n"),e[0]=t,e[1]=r,e[2]=l):l=e[2];let n=l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=(0,o.jsx)("span",{className:"flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",children:(0,o.jsx)("svg",{"aria-hidden":"true",className:"size-10 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})})}),e[3]=c):c=e[3];let i;e[4]!==t?(i=(0,o.jsx)("span",{className:"truncate font-mono text-xs",title:t,children:t}),e[4]=t,e[5]=i):i=e[5];let s;return e[6]!==n||e[7]!==i?(s=(0,o.jsxs)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:n,type:"button",children:[c,i]}),e[6]=n,e[7]=i,e[8]=s):s=e[8],s},"It"),_t=h(d=>{let e=(0,B.c)(34),{busy:t,copiedKey:r,files:l,folders:n,handlers:c,onEnterFolder:i,prefix:s,references:u,resolveUrl:m,selected:f,showReferences:g,size:w,t:a}=d,k;e[0]!==w?(k=w.toString(),e[0]=w,e[1]=k):k=e[1];let S=`repeat(auto-fill, minmax(${k}px, 1fr))`,x;e[2]!==S?(x={gridTemplateColumns:S},e[2]=S,e[3]=x):x=e[3];let b=x,y;if(e[4]!==n||e[5]!==i){let N;e[7]!==i?(N=h(C=>(0,o.jsx)(Rt,{name:C,onEnter:i},C),"w"),e[7]=i,e[8]=N):N=e[8],y=n.map(N),e[4]=n,e[5]=i,e[6]=y}else y=e[6];let v;if(e[9]!==t||e[10]!==r||e[11]!==l||e[12]!==c||e[13]!==s||e[14]!==u||e[15]!==m||e[16]!==f||e[17]!==g||e[18]!==a){let N;e[20]!==t||e[21]!==r||e[22]!==c||e[23]!==s||e[24]!==u||e[25]!==m||e[26]!==f||e[27]!==g||e[28]!==a?(N=h(C=>(0,o.jsx)(It,{busy:t,copiedKey:r,handlers:c,object:C,prefix:s,references:u[C.key],resolveUrl:m,selected:f.has(C.key),showReferences:g,t:a},C.key),"w"),e[20]=t,e[21]=r,e[22]=c,e[23]=s,e[24]=u,e[25]=m,e[26]=f,e[27]=g,e[28]=a,e[29]=N):N=e[29],v=l.map(N),e[9]=t,e[10]=r,e[11]=l,e[12]=c,e[13]=s,e[14]=u,e[15]=m,e[16]=f,e[17]=g,e[18]=a,e[19]=v}else v=e[19];let j;return e[30]!==b||e[31]!==y||e[32]!==v?(j=(0,o.jsxs)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:b,children:[y,v]}),e[30]=b,e[31]=y,e[32]=v,e[33]=j):j=e[33],j},"Ot"),Ut=h(d=>{let e=(0,B.c)(23),{reference:t,t:r}=d,l=`fb-dangling-${t.table}-${t.id}-${t.column}`,n=`${t.table}\xB7${t.id}`,c;e[0]!==n?(c=(0,o.jsx)(ae,{variant:"secondary",children:n}),e[0]=n,e[1]=c):c=e[1];let i;e[2]!==t.column?(i=(0,o.jsx)("span",{className:"text-muted-foreground",children:t.column}),e[2]=t.column,e[3]=i):i=e[3];let s;e[4]!==r?(s=r("\u2192"),e[4]=r,e[5]=s):s=e[5];let u;e[6]!==s?(u=(0,o.jsx)("span",{className:"text-muted-foreground/60",children:s}),e[6]=s,e[7]=u):u=e[7];let m;e[8]!==t.key?(m=(0,o.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:t.key}),e[8]=t.key,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==i||e[12]!==u||e[13]!==m?(f=(0,o.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[c,i,u,m]}),e[10]=c,e[11]=i,e[12]=u,e[13]=m,e[14]=f):f=e[14];let g;e[15]!==r?(g=r("Missing object"),e[15]=r,e[16]=g):g=e[16];let w;e[17]!==g?(w=(0,o.jsx)(ae,{className:"border-destructive/40 text-destructive",variant:"outline",children:g}),e[17]=g,e[18]=w):w=e[18];let a;return e[19]!==l||e[20]!==w||e[21]!==f?(a=(0,o.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs","data-testid":l,children:[f,w]}),e[19]=l,e[20]=w,e[21]=f,e[22]=a):a=e[22],a},"At"),Mt=h(d=>{let e=(0,B.c)(42),{busy:t,onCheck:r,references:l,t:n,truncated:c}=d,i;e[0]!==n?(i=n("Integrity"),e[0]=n,e[1]=i):i=e[1];let s;e[2]!==i?(s=(0,o.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[2]=i,e[3]=s):s=e[3];let u;e[4]!==n?(u=n("Orphaned objects"),e[4]=n,e[5]=u):u=e[5];let m;e[6]!==u?(m=(0,o.jsx)("span",{className:"text-sm font-medium text-foreground",children:u}),e[6]=u,e[7]=m):m=e[7];let f;e[8]!==n?(f=n("Find records whose file reference points at an object the bucket no longer has."),e[8]=n,e[9]=f):f=e[9];let g;e[10]!==f?(g=(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[10]=f,e[11]=g):g=e[11];let w;e[12]!==s||e[13]!==m||e[14]!==g?(w=(0,o.jsxs)("div",{className:"flex flex-col gap-1",children:[s,m,g]}),e[12]=s,e[13]=m,e[14]=g,e[15]=w):w=e[15];let a;e[16]!==t||e[17]!==n?(a=n(t?"Checking\u2026":"Check for orphans"),e[16]=t,e[17]=n,e[18]=a):a=e[18];let k;e[19]!==t||e[20]!==r||e[21]!==a?(k=(0,o.jsx)(ee,{"data-testid":"fb-orphans-check",disabled:t,onClick:r,size:"sm",type:"button",variant:"outline",children:a}),e[19]=t,e[20]=r,e[21]=a,e[22]=k):k=e[22];let S;e[23]!==w||e[24]!==k?(S=(0,o.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[w,k]}),e[23]=w,e[24]=k,e[25]=S):S=e[25];let x;e[26]!==l||e[27]!==n||e[28]!==c?(x=c&&(0,o.jsx)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:l===void 0||l.length===0?n("The bucket is larger than the scan's key limit, so dangling references could not be checked."):n("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:l.length})}),e[26]=l,e[27]=n,e[28]=c,e[29]=x):x=e[29];let b;e[30]!==l?.length||e[31]!==n||e[32]!==c?(b=l?.length===0&&!c&&(0,o.jsx)(ve,{description:n("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:n("No dangling references.")}),e[30]=l?.length,e[31]=n,e[32]=c,e[33]=b):b=e[33];let y;e[34]!==l||e[35]!==n?(y=l!==void 0&&l.length>0&&(0,o.jsx)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:l.map(j=>(0,o.jsx)(Ut,{reference:j,t:n},`${j.table}\xB7${j.id}\xB7${j.column}`))}),e[34]=l,e[35]=n,e[36]=y):y=e[36];let v;return e[37]!==S||e[38]!==x||e[39]!==b||e[40]!==y?(v=(0,o.jsxs)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[S,x,b,y]}),e[37]=S,e[38]=x,e[39]=b,e[40]=y,e[41]=v):v=e[41],v},"Ut"),Bt=h(function(d,e){let t=(0,B.c)(18),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=new Set,t[0]=r):r=t[0];let[l,n]=(0,z.useState)(r),c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=h(x=>{n(b=>{let y=new Set(b);return y.has(x)?y.delete(x):y.add(x),y})},"a"),t[1]=c):c=t[1];let i=c,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=h(()=>{n(new Set)},"o"),t[2]=s):s=t[2];let u=s,m,f,g;if(t[3]!==d||t[4]!==e||t[5]!==l){let x;t[9]!==e?(x=h(b=>e(b),"y"),t[9]=e,t[10]=x):x=t[10],f=d.map(x),m=f.length>0&&f.every(b=>l.has(b)),g=!m&&f.some(b=>l.has(b)),t[3]=d,t[4]=e,t[5]=l,t[6]=m,t[7]=f,t[8]=g}else m=t[6],f=t[7],g=t[8];let w=g,a;t[11]!==f?(a=h(()=>{n(x=>f.every(b=>x.has(b))?new Set:new Set(f))},"i"),t[11]=f,t[12]=a):a=t[12];let k=a,S;return t[13]!==m||t[14]!==l||t[15]!==w||t[16]!==k?(S={allSelected:m,clear:u,selected:l,someSelected:w,toggle:i,toggleAll:k},t[13]=m,t[14]=l,t[15]=w,t[16]=k,t[17]=S):S=t[17],S},"Mt"),Pt=pe(xe.storageReferences),At=pe(xe.storageOrphans),Be=1e4,Wt=1e3,Ht=h(async d=>{let e=[],t,r=!0,l=!1;for(;r&&e.length<Be;){let n=await d.list({cursor:t,limit:Wt}),c=Be-e.length;for(let i of n.objects.slice(0,c))e.push(i.key);l||=n.objects.length>c,t=n.cursor,r=t!==void 0}return{liveKeys:e,truncated:l||r}},"qt"),Zt=3600,qt=h((d,e)=>{if(!("document"in globalThis))return;let t=globalThis.document.createElement("a");t.href=d,t.download=e,t.rel="noopener",globalThis.document.body.append(t),t.click(),t.remove()},"Vt"),Gt=h(d=>d.key,"Zt"),Vt=h(({initialPrefix:d,pageSize:e})=>{let t=ze(),[r,l]=(0,z.useState)(d??""),[n,c]=(0,z.useState)(d??""),[i,s]=(0,z.useState)(Ct),[u,m]=(0,z.useState)("list"),[f,g]=(0,z.useState)(128),[w,a]=(0,z.useState)("name"),[k,S]=(0,z.useState)("asc"),[x,b]=(0,z.useState)(void 0),[y,v]=(0,z.useState)(void 0),[j,N]=(0,z.useState)(!1),[C,T]=(0,z.useState)(void 0),[D,F]=(0,z.useState)(void 0),[$,O]=(0,z.useState)(""),[R,L]=(0,z.useState)({}),[_,E]=(0,z.useState)(!1),[I,M]=(0,z.useState)(void 0),[P,W]=(0,z.useState)(!1),[A,H]=(0,z.useState)(!1),[V,re]=(0,z.useState)([]),[q,we]=(0,z.useState)(""),ne=(0,z.useRef)(0),Q=(0,z.useRef)(0),ce=(0,z.useRef)(0);(0,z.useEffect)(()=>{let p={cancelled:!1};return Z((async()=>{try{let K=await t.listStorageBuckets();if(!p.cancelled){re(K);let[U]=K;U!==void 0&&we(J=>J===""?U:J)}}catch{}})()),()=>{p.cancelled=!0}},[t]);let G=(0,z.useMemo)(()=>({list:h(p=>t.listStorageObjects({...p,bucket:q}),"list"),remove:h(p=>t.deleteStorageObject(p,{bucket:q}),"remove"),signedUrl:h((p,K)=>t.signedStorageUrl(p,{...K,bucket:q}),"signedUrl"),upload:h(p=>t.uploadStorageObject({...p,bucket:q}),"upload")}),[q,t]),Y=(0,z.useCallback)(async(p,K,U,J=!1)=>{ne.current+=1;let me=ne.current;v(void 0),N(!0);try{let oe=await G.list({cursor:K,limit:e,prefix:p});if(me!==ne.current)return;b(Ce=>U&&Ce!==void 0?[...Ce,...oe.objects]:oe.objects),F(oe.cursor)}catch(oe){if(me!==ne.current)return;if(U||b(void 0),v(le(oe)),J)throw oe}finally{me===ne.current&&N(!1)}},[e,G]);(0,z.useEffect)(()=>{Z(Y(d??"",void 0,!1))},[Y,d]);let qe=(x?.length??0)<=e;Re(()=>Y(r,void 0,!1,!0),qe);let{files:ue,folders:Ge}=zt(x??[],r),Ve=(0,z.useMemo)(()=>{let p=new Set;for(let K of ue)for(let U of Object.keys(K.customMetadata??{}))p.add(U);return[...p].toSorted((K,U)=>K.localeCompare(U))},[ue]),ie=jt(ue,w,k),fe=(0,z.useMemo)(()=>[...new Set(ie.map(p=>p.key))].toSorted((p,K)=>p.localeCompare(K)).join(`
|
|
3
3
|
`),[ie]);(0,z.useEffect)(()=>{let p=fe===""?[]:fe.split(`
|
|
4
4
|
`);if(p.length===0){L({});return}let K={current:!0};return Z((async()=>{try{let U=await t.query(Pt,{keys:p},be($));K.current&&(L(U.references??{}),E(Object.keys(U.storageColumns??{}).length>0))}catch{K.current&&(L({}),E(!1))}})()),()=>{K.current=!1}},[t,fe,$]);let{allSelected:Qe,clear:se,selected:Se,someSelected:Xe,toggle:Ye,toggleAll:Je}=Bt(ie,Gt),et=h(()=>{l(n),se(),Z(Y(n,void 0,!1))},"Me"),tt=h(()=>{Z(Y(r,D,!0))},"Ge"),Ne=h(p=>{l(p),c(p),se(),Z(Y(p,void 0,!1))},"ve"),rt=h(p=>{Ne(`${r}${p}`)},"He"),nt=h(p=>G.signedUrl(p,{expiresInSeconds:Zt}),"Pe"),ot=h(()=>{m("list")},"qe"),lt=h(()=>{m("grid")},"We"),st=h(p=>{a(p)},"Ve"),at=h(()=>{S(p=>p==="asc"?"desc":"asc")},"Ze"),ct=h(p=>{g(p)},"Xe"),it=h(p=>{s(p)},"Ye"),he=h(p=>{let K=ce.current;v(void 0),N(!0),Z((async()=>{try{await p(),K===ce.current&&await Y(r,void 0,!1)}catch(U){v(le(U))}K===ce.current&&N(!1)})())},"me"),dt=h(()=>{he(async()=>{for(let p of Se)await G.remove(p);se()})},"Je"),ut=h(p=>{v(void 0),Z((async()=>{try{let K=await G.signedUrl(p,{expiresInSeconds:i});je(K)&&T(p)}catch(K){v(le(K))}})())},"Qe"),ft=h(p=>{v(void 0),Z((async()=>{try{let K=await G.signedUrl(p,{expiresInSeconds:i}),U=p.slice(p.lastIndexOf("/")+1)||p;qt(K,U)}catch(K){v(le(K))}})())},"et");(0,z.useEffect)(()=>{if(C===void 0)return;let p=globalThis.setTimeout(()=>{T(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[C]);let ht=h(p=>{he(async()=>{await G.remove(p)})},"tt"),mt=h(p=>{let K=`${r}${p.name}`;he(async()=>{let U=await p.arrayBuffer();await G.upload({body:U,contentType:p.type===""?void 0:p.type,key:K})})},"st");(0,z.useEffect)(()=>{Q.current+=1,M(void 0),H(!1)},[$]);let gt=h(()=>{Q.current+=1;let p=Q.current;v(void 0),W(!0),Z((async()=>{try{let{liveKeys:K,truncated:U}=await Ht(G);if(U)p===Q.current&&(M(void 0),H(!0));else{let J=await t.query(At,{liveKeys:K},be($));p===Q.current&&(M(J.references??[]),H(J.truncated===!0))}}catch(K){p===Q.current&&(M(void 0),H(!1),v(le(K)))}p===Q.current&&W(!1)})())},"lt"),pt=h(p=>{ne.current+=1,Q.current+=1,ce.current+=1,we(p),l(d??""),c(d??""),b(void 0),M(void 0),H(!1),se()},"nt");return{allSelected:Qe,bucket:q,buckets:V,bulkDelete:dt,busy:j,checkOrphans:gt,clearSelection:se,copiedKey:C,danglingBusy:P,danglingReferences:I,danglingTruncated:A,draftPrefix:n,enterFolder:rt,error:y,expiry:i,files:ie,folders:Ge,hasObjects:x!==void 0&&x.length>0,hasStorageColumns:_,listFirst:et,loaded:x!==void 0,loadMore:tt,navigate:Ne,nextCursor:D,onCopy:ut,onDelete:ht,onDownload:ft,onExpiryChange:it,onFile:mt,onSortKeyChange:st,onThumbSizeChange:ct,prefix:r,referenceShard:$,references:R,resolveUrl:nt,selectBucket:pt,selected:Se,setDraftPrefix:c,setReferenceShard:O,showGrid:lt,showList:ot,someSelected:Xe,sortDirection:k,sortKey:w,tagKeys:Ve,thumbSize:f,toggleSelect:Ye,toggleSelectAll:Je,toggleSortDirection:at,view:u}},"Xt"),Qt=100,Pe=h(d=>{let e=(0,B.c)(6),{label:t,onNavigate:r,target:l}=d,n;e[0]!==r||e[1]!==l?(n=h(()=>{r(l)},"l"),e[0]=r,e[1]=l,e[2]=n):n=e[2];let c=n,i;return e[3]!==c||e[4]!==t?(i=(0,o.jsx)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:c,type:"button",children:t}),e[3]=c,e[4]=t,e[5]=i):i=e[5],i},"Ne"),Xt=h(d=>{let e=(0,B.c)(11),{onNavigate:t,prefix:r,t:l}=d,n;if(e[0]!==t||e[1]!==r||e[2]!==l){let c=r.split("/").filter(Yt),i;e[4]!==l?(i=l("Folder path"),e[4]=l,e[5]=i):i=e[5];let s;e[6]!==l?(s=l("root"),e[6]=l,e[7]=s):s=e[7];let u;e[8]!==t||e[9]!==s?(u=(0,o.jsx)(Pe,{label:s,onNavigate:t,target:""}),e[8]=t,e[9]=s,e[10]=u):u=e[10],n=(0,o.jsxs)("nav",{"aria-label":i,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[u,c.map((m,f)=>(0,o.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,o.jsx)("span",{className:"text-muted-foreground/50",children:"/"}),(0,o.jsx)(Pe,{label:m,onNavigate:t,target:`${c.slice(0,f+1).join("/")}/`})]},`${m}-${f.toString()}`))]}),e[0]=t,e[1]=r,e[2]=l,e[3]=n}else n=e[3];return n},"Jt"),gr=h(({initialPrefix:d,pageSize:e=Qt})=>{let t=De(),r=Vt({initialPrefix:d,pageSize:e}),l=(0,z.useRef)(null),{onCopy:n,onDelete:c,onDownload:i,onFile:s,toggleSelect:u}=r,m={onCopy:n,onDelete:c,onDownload:i,onToggleSelect:u},f=h(()=>{l.current?.click()},"u"),g=h(a=>{let k=a.target,S=k.files?.[0];k.value="",S&&s(S)},"m"),w=r.loaded&&!r.hasObjects;return(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,o.jsx)(Dt,{bucket:r.bucket,buckets:r.buckets,busy:r.busy,draftPrefix:r.draftPrefix,expiry:r.expiry,fileInputRef:l,onBucketChange:r.selectBucket,onExpiryChange:r.onExpiryChange,onFileChange:g,onList:r.listFirst,onPrefixChange:r.setDraftPrefix,onUploadClick:f,t}),r.loaded&&(0,o.jsx)(Xt,{onNavigate:r.navigate,prefix:r.prefix,t}),r.hasObjects&&(0,o.jsx)(Tt,{onSortKeyChange:r.onSortKeyChange,onThumbSizeChange:r.onThumbSizeChange,showGrid:r.showGrid,showList:r.showList,sortDirection:r.sortDirection,sortKey:r.sortKey,t,tagKeys:r.tagKeys,thumbSize:r.thumbSize,toggleSortDirection:r.toggleSortDirection,view:r.view}),r.hasStorageColumns&&(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,o.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:t("References shard")}),(0,o.jsx)(Fe,{id:"fb-reference-shard-input",onChange:r.setReferenceShard,testId:"fb-reference-shard-input",value:r.referenceShard}),(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:t("Which shard's records are checked for references to these files. Empty = root shard.")})]}),r.hasStorageColumns&&(0,o.jsx)(Mt,{busy:r.danglingBusy,onCheck:r.checkOrphans,references:r.danglingReferences,t,truncated:r.danglingTruncated}),r.selected.size>0&&(0,o.jsx)(_e,{count:r.selected.size,editable:!0,onClear:r.clearSelection,onDelete:r.bulkDelete}),r.error!==void 0&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:r.error}),w&&(0,o.jsx)(ve,{description:t("Objects you upload to your R2 buckets will appear here."),icon:(0,o.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,o.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"}),(0,o.jsx)("path",{d:"M12 11v5m-2.5-2.5h5"})]}),testId:"fb-empty",title:t("No objects.")}),r.hasObjects&&r.view==="list"&&(0,o.jsx)(St,{allSelected:r.allSelected,busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:m,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,selected:r.selected,showReferences:r.hasStorageColumns,someSelected:r.someSelected,t,toggleSelectAll:r.toggleSelectAll}),r.hasObjects&&r.view==="grid"&&(0,o.jsx)(_t,{busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:m,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,resolveUrl:r.resolveUrl,selected:r.selected,showReferences:r.hasStorageColumns,size:r.thumbSize,t}),r.nextCursor!==void 0&&(0,o.jsx)("div",{children:(0,o.jsx)(ee,{"data-testid":"fb-next",disabled:r.busy,onClick:r.loadMore,size:"sm",type:"button",variant:"outline",children:t("Load more")})})]})},"xs");function Yt(d){return d!==""}h(Yt,"Qt");export{gr as FileBrowser};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as X}from"./chunk-CVSIFPI5.js";import{a as Q}from"./chunk-
|
|
1
|
+
import{a as X}from"./chunk-CVSIFPI5.js";import{a as Q}from"./chunk-YFTPHGS2.js";import{d as O}from"./chunk-TW4O2BA5.js";import{i as J}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as R}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import"./chunk-T3ZCW3RG.js";import"./chunk-2W4UO5BC.js";import"./chunk-4N76XUNG.js";import"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as H,s as Y,v as G}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as st}from"./chunk-GWNGVKLG.js";import{a as et,b as at}from"./chunk-6G3E4PJ2.js";import{a as u,d as V}from"./chunk-5PEAXTYQ.js";var B=V(st(),1);var d=V(at(),1);var z=V(et(),1);var nt=u(h=>{let t=(0,B.c)(28),{draft:e,onDraftChange:r,onSend:n,pending:a}=h,l=H(),s;t[0]!==l?(s=l("Ask about your data"),t[0]=l,t[1]=s):s=t[1];let o;t[2]!==r?(o=u(v=>{r(v.target.value)},"o"),t[2]=r,t[3]=o):o=t[3];let i;t[4]!==n?(i=u(v=>{v.key==="Enter"&&(v.preventDefault(),n())},"r"),t[4]=n,t[5]=i):i=t[5];let c;t[6]!==l?(c=l("Ask about your data"),t[6]=l,t[7]=c):c=t[7];let p;t[8]!==e||t[9]!==a||t[10]!==s||t[11]!==o||t[12]!==i||t[13]!==c?(p=(0,d.jsx)(J,{"aria-label":s,"data-testid":"assistant-input",disabled:a,onChange:o,onKeyDown:i,placeholder:c,value:e}),t[8]=e,t[9]=a,t[10]=s,t[11]=o,t[12]=i,t[13]=c,t[14]=p):p=t[14];let x;t[15]!==e||t[16]!==a?(x=a||e.trim()==="",t[15]=e,t[16]=a,t[17]=x):x=t[17];let m;t[18]!==a||t[19]!==l?(m=l(a?"Thinking\u2026":"Send"),t[18]=a,t[19]=l,t[20]=m):m=t[20];let f;t[21]!==n||t[22]!==x||t[23]!==m?(f=(0,d.jsx)(R,{"data-testid":"assistant-send",disabled:x,onClick:n,size:"xs",type:"button",children:m}),t[21]=n,t[22]=x,t[23]=m,t[24]=f):f=t[24];let g;return t[25]!==p||t[26]!==f?(g=(0,d.jsxs)("div",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[p,f]}),t[25]=p,t[26]=f,t[27]=g):g=t[27],g},"nt"),lt=u(h=>{let t=(0,B.c)(17),{onClose:e}=h,r=H(),n;t[0]!==r?(n=r("Assistant"),t[0]=r,t[1]=n):n=t[1];let a;t[2]!==n?(a=(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:n}),t[2]=n,t[3]=a):a=t[3];let l;t[4]!==r?(l=r("Answers are suggestions \u2014 nothing runs until you insert and run it."),t[4]=r,t[5]=l):l=t[5];let s;t[6]!==l?(s=(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l}),t[6]=l,t[7]=s):s=t[7];let o;t[8]!==r?(o=r("Close assistant"),t[8]=r,t[9]=o):o=t[9];let i;t[10]!==e||t[11]!==o?(i=(0,d.jsx)(R,{"aria-label":o,className:"ms-auto","data-testid":"assistant-close",onClick:e,size:"xs",type:"button",variant:"ghost",children:"\xD7"}),t[10]=e,t[11]=o,t[12]=i):i=t[12];let c;return t[13]!==a||t[14]!==s||t[15]!==i?(c=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[a,s,i]}),t[13]=a,t[14]=s,t[15]=i,t[16]=c):c=t[16],c},"lt"),ot={img:u(()=>null,"img")},Z=u(h=>{let t=(0,B.c)(2),{text:e}=h,r;return t[0]!==e?(r=(0,d.jsx)("div",{className:"prose-sm max-w-none text-xs","data-testid":"assistant-turn-body",children:(0,d.jsx)(O,{components:ot,children:e})}),t[0]=e,t[1]=r):r=t[1],r},"U"),_=u(h=>{let t=(0,B.c)(6),{children:e,label:r,testId:n}=h,a;t[0]!==r?(a=(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:r}),t[0]=r,t[1]=a):a=t[1];let l;return t[2]!==e||t[3]!==a||t[4]!==n?(l=(0,d.jsxs)("li",{className:"flex flex-col gap-1 border-b border-border px-3 py-2 last:border-b-0","data-testid":n,children:[a,e]}),t[2]=e,t[3]=a,t[4]=n,t[5]=l):l=t[5],l},"W"),rt=u(h=>{let t=(0,B.c)(7),{text:e}=h,r=H(),n;t[0]!==r?(n=r("Assistant"),t[0]=r,t[1]=n):n=t[1];let a;t[2]!==e?(a=(0,d.jsx)(Z,{text:e}),t[2]=e,t[3]=a):a=t[3];let l;return t[4]!==n||t[5]!==a?(l=(0,d.jsx)(_,{label:n,testId:"assistant-turn-live",children:a}),t[4]=n,t[5]=a,t[6]=l):l=t[6],l},"ot"),it=u(h=>{let t=(0,B.c)(20),{activeId:e,onDelete:r,onNew:n,onSelect:a,sessions:l}=h,s=H(),o;if(t[0]!==e||t[1]!==r||t[2]!==a||t[3]!==l||t[4]!==s){let x;t[6]!==e||t[7]!==r||t[8]!==a||t[9]!==l.length||t[10]!==s?(x=u(m=>(0,d.jsxs)("span",{className:"flex shrink-0 items-center",children:[(0,d.jsx)(R,{"data-testid":"assistant-session",onClick:u(()=>{a(m.id)},"onClick"),size:"xs",type:"button",variant:m.id===e?"secondary":"ghost",children:m.name}),l.length>1&&(0,d.jsx)(R,{"aria-label":s("Close chat"),"data-testid":"assistant-session-close",onClick:u(()=>{r(m.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:"\xD7"})]},m.id),"p"),t[6]=e,t[7]=r,t[8]=a,t[9]=l.length,t[10]=s,t[11]=x):x=t[11],o=l.map(x),t[0]=e,t[1]=r,t[2]=a,t[3]=l,t[4]=s,t[5]=o}else o=t[5];let i;t[12]!==s?(i=s("New chat"),t[12]=s,t[13]=i):i=t[13];let c;t[14]!==n||t[15]!==i?(c=(0,d.jsx)(R,{"aria-label":i,className:"shrink-0","data-testid":"assistant-session-new",onClick:n,size:"xs",type:"button",variant:"ghost",children:"+"}),t[14]=n,t[15]=i,t[16]=c):c=t[16];let p;return t[17]!==o||t[18]!==c?(p=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1 overflow-x-auto border-b border-border px-2 py-1","data-testid":"assistant-sessions",children:[o,c]}),t[17]=o,t[18]=c,t[19]=p):p=t[19],p},"at"),dt=u(h=>{let t=(0,B.c)(9),{reason:e,truncated:r}=h,n=H(),a;t[0]!==n||t[1]!==r?(a=r&&(0,d.jsx)("p",{className:"px-3 py-1 text-[11px] text-muted-foreground","data-testid":"assistant-truncated",children:n("Older turns were dropped to fit the context budget.")}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let l;t[3]!==e||t[4]!==n?(l=e!==void 0&&(0,d.jsx)("p",{className:"px-3 py-1 text-[11px] text-destructive","data-testid":"assistant-error",children:X(e,n)}),t[3]=e,t[4]=n,t[5]=l):l=t[5];let s;return t[6]!==a||t[7]!==l?(s=(0,d.jsxs)(d.Fragment,{children:[a,l]}),t[6]=a,t[7]=l,t[8]=s):s=t[8],s},"rt"),ct=u(h=>{let t=(0,B.c)(12),{onPick:e,suggestions:r}=h,n=H(),a;t[0]!==n?(a=n("Try asking"),t[0]=n,t[1]=a):a=t[1];let l;t[2]!==a?(l=(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:a}),t[2]=a,t[3]=l):l=t[3];let s;if(t[4]!==e||t[5]!==r){let i;t[7]!==e?(i=u(c=>(0,d.jsx)("button",{className:"self-start rounded-md border border-border px-2 py-1 text-start text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"assistant-suggestion",onClick:u(()=>{e(c)},"onClick"),type:"button",children:c},c),"r"),t[7]=e,t[8]=i):i=t[8],s=r.map(i),t[4]=e,t[5]=r,t[6]=s}else s=t[6];let o;return t[9]!==l||t[10]!==s?(o=(0,d.jsxs)("div",{className:"flex flex-col gap-1 px-3 py-2","data-testid":"assistant-suggestions",children:[l,s]}),t[9]=l,t[10]=s,t[11]=o):o=t[11],o},"dt"),L="```",ut=u(h=>{if(h.startsWith(L))return h.slice(L.length).trim().toLowerCase()==="sql"?"sql":"foreign"},"ct"),pt=u(h=>{let t=[],e=h.split(`
|
|
2
2
|
`),r,n=!1;for(let a of e){let l=a.trim();if(n){n=l!==L;continue}if(r===void 0){let s=ut(l);s==="sql"?r=[]:s==="foreign"&&(n=!0);continue}if(l===L){let s=r.join(`
|
|
3
3
|
`).trim();s!==""&&t.push(s),r=void 0;continue}r.push(a)}return t},"ft"),mt=u(h=>{let t=(0,B.c)(29),{approval:e,onDecide:r}=h,n=H(),a;t[0]!==n?(a=n("The assistant wants to read rows before answering. Nothing runs until you allow it."),t[0]=n,t[1]=a):a=t[1];let l;t[2]!==a?(l=(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:a}),t[2]=a,t[3]=l):l=t[3];let s;t[4]!==e.sql?(s=(0,d.jsx)("pre",{className:"overflow-x-auto rounded bg-background p-1.5 font-mono text-[11px]","data-testid":"assistant-approval-sql",children:e.sql}),t[4]=e.sql,t[5]=s):s=t[5];let o;t[6]!==e||t[7]!==r?(o=u(()=>{r(!0,e)},"o"),t[6]=e,t[7]=r,t[8]=o):o=t[8];let i;t[9]!==n?(i=n("Allow"),t[9]=n,t[10]=i):i=t[10];let c;t[11]!==o||t[12]!==i?(c=(0,d.jsx)(R,{"data-testid":"assistant-approval-allow",onClick:o,size:"xs",type:"button",children:i}),t[11]=o,t[12]=i,t[13]=c):c=t[13];let p;t[14]!==e||t[15]!==r?(p=u(()=>{r(!1,e)},"f"),t[14]=e,t[15]=r,t[16]=p):p=t[16];let x;t[17]!==n?(x=n("Deny"),t[17]=n,t[18]=x):x=t[18];let m;t[19]!==p||t[20]!==x?(m=(0,d.jsx)(R,{"data-testid":"assistant-approval-deny",onClick:p,size:"xs",type:"button",variant:"secondary",children:x}),t[19]=p,t[20]=x,t[21]=m):m=t[21];let f;t[22]!==c||t[23]!==m?(f=(0,d.jsxs)("div",{className:"flex gap-2",children:[c,m]}),t[22]=c,t[23]=m,t[24]=f):f=t[24];let g;return t[25]!==f||t[26]!==l||t[27]!==s?(g=(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-md border border-border bg-muted/40 p-2","data-testid":"assistant-approval",children:[l,s,f]}),t[25]=f,t[26]=l,t[27]=s,t[28]=g):g=t[28],g},"ut"),xt=u(h=>{let t=(0,B.c)(15),{level:e,turn:r}=h,n=H(),a;t[0]!==r.toolCalls?(a=r.toolCalls??[],t[0]=r.toolCalls,t[1]=a):a=t[1];let l=a;if(l.length===0&&r.partial!==!0)return null;let s;if(t[2]!==l||t[3]!==e||t[4]!==n){let c;t[6]!==e||t[7]!==n?(c=u((p,x)=>(0,d.jsxs)("li",{children:[(0,d.jsx)("span",{className:"font-mono",children:p.name??n("(no such tool)")}),p.sql===void 0?null:(0,d.jsx)("span",{className:"ms-1 font-mono opacity-80",children:p.sql}),p.refused===void 0?null:(0,d.jsx)("span",{className:"ms-1 text-destructive",children:n("refused")}),p.needs===void 0?null:(0,d.jsx)("span",{className:"block text-muted-foreground","data-testid":"assistant-tool-needs",children:n("Needs the {needs} data-sharing level; this deployment is set to {level}. Change LUNORA_AI_OPT_IN in wrangler.jsonc.",{level:e??n("a lower level"),needs:p.needs})})]},`${String(x)}:${p.name??"?"}`),"d"),t[6]=e,t[7]=n,t[8]=c):c=t[8],s=l.map(c),t[2]=l,t[3]=e,t[4]=n,t[5]=s}else s=t[5];let o;t[9]!==n||t[10]!==r.partial?(o=r.partial===!0&&(0,d.jsx)("li",{"data-testid":"assistant-turn-partial",children:n("Stopped early \u2014 this answer is incomplete.")}),t[9]=n,t[10]=r.partial,t[11]=o):o=t[11];let i;return t[12]!==s||t[13]!==o?(i=(0,d.jsxs)("ul",{className:"flex flex-col gap-0.5 border-s border-border ps-2 text-[11px] text-muted-foreground","data-testid":"assistant-tool-calls",children:[s,o]}),t[12]=s,t[13]=o,t[14]=i):i=t[14],i},"pt"),ht=u(h=>{let t=(0,B.c)(60),{index:e,level:r,onBranch:n,onDecide:a,onInsert:l,onTruncate:s,turn:o}=h,i=H(),c,p,x,m,f;if(t[0]!==l||t[1]!==i||t[2]!==o.role||t[3]!==o.text){let $=o.role==="assistant"&&l!==void 0?pt(o.text):[];c=_,t[9]!==i||t[10]!==o.role?(p=o.role==="user"?i("You"):i("Assistant"),t[9]=i,t[10]=o.role,t[11]=p):p=t[11],x=`assistant-turn-${o.role}`,t[12]!==o.role||t[13]!==o.text?(m=o.role==="assistant"?(0,d.jsx)(Z,{text:o.text}):(0,d.jsx)("p",{className:"text-xs whitespace-pre-wrap","data-testid":"assistant-turn-body",children:o.text}),t[12]=o.role,t[13]=o.text,t[14]=m):m=t[14];let F;t[15]!==l||t[16]!==i?(F=u((T,j)=>(0,d.jsx)(R,{className:"self-start","data-testid":"assistant-insert",onClick:u(()=>{l?.(T)},"onClick"),size:"xs",type:"button",variant:"secondary",children:i("Insert into editor")},`${String(j)}:${T.slice(0,32)}`),"R"),t[15]=l,t[16]=i,t[17]=F):F=t[17],f=$.map(F),t[0]=l,t[1]=i,t[2]=o.role,t[3]=o.text,t[4]=c,t[5]=p,t[6]=x,t[7]=m,t[8]=f}else c=t[4],p=t[5],x=t[6],m=t[7],f=t[8];let g;t[18]!==a||t[19]!==o.pendingApproval?(g=o.pendingApproval!==void 0&&a!==void 0&&(0,d.jsx)(mt,{approval:o.pendingApproval,onDecide:a}),t[18]=a,t[19]=o.pendingApproval,t[20]=g):g=t[20];let v;t[21]!==r||t[22]!==o?(v=o.role==="assistant"&&(0,d.jsx)(xt,{level:r,turn:o}),t[21]=r,t[22]=o,t[23]=v):v=t[23];let S;t[24]!==o.text?(S=u(()=>{G(o.text)},"q"),t[24]=o.text,t[25]=S):S=t[25];let q;t[26]!==i?(q=i("Copy"),t[26]=i,t[27]=q):q=t[27];let k;t[28]!==S||t[29]!==q?(k=(0,d.jsx)("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"assistant-copy",onClick:S,type:"button",children:q}),t[28]=S,t[29]=q,t[30]=k):k=t[30];let y;t[31]!==e||t[32]!==n?(y=u(()=>{n(e)},"y"),t[31]=e,t[32]=n,t[33]=y):y=t[33];let b;t[34]!==i?(b=i("Branch from here"),t[34]=i,t[35]=b):b=t[35];let w;t[36]!==y||t[37]!==b?(w=(0,d.jsx)("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"assistant-branch",onClick:y,type:"button",children:b}),t[36]=y,t[37]=b,t[38]=w):w=t[38];let N;t[39]!==e||t[40]!==s?(N=u(()=>{s(e)},"k"),t[39]=e,t[40]=s,t[41]=N):N=t[41];let I;t[42]!==i?(I=i("Delete from here"),t[42]=i,t[43]=I):I=t[43];let A;t[44]!==N||t[45]!==I?(A=(0,d.jsx)("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"assistant-truncate",onClick:N,type:"button",children:I}),t[44]=N,t[45]=I,t[46]=A):A=t[46];let C;t[47]!==w||t[48]!==A||t[49]!==k?(C=(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[k,w,A]}),t[47]=w,t[48]=A,t[49]=k,t[50]=C):C=t[50];let P;return t[51]!==c||t[52]!==p||t[53]!==C||t[54]!==x||t[55]!==m||t[56]!==f||t[57]!==g||t[58]!==v?(P=(0,d.jsxs)(c,{label:p,testId:x,children:[m,f,g,v,C]}),t[51]=c,t[52]=p,t[53]=C,t[54]=x,t[55]=m,t[56]=f,t[57]=g,t[58]=v,t[59]=P):P=t[59],P},"ht"),ft=u(({assistant:h,ops:t,session:e})=>{let[r,n]=(0,z.useState)(""),[a,l]=(0,z.useState)(e?.id);e?.id!==a&&(l(e?.id),n(""));let[s,o]=(0,z.useState)(void 0),[i,c]=(0,z.useState)(void 0),[p,x]=(0,z.useState)(void 0),[m,f]=(0,z.useState)(void 0),g=(0,z.useRef)(void 0);(0,z.useEffect)(()=>()=>{g.current?.abort()},[]);let v=t.pending("chat"),S=t.reason("chat"),{setTurns:q,takeAsk:k,unavailable:y}=h,b=e?.id,w=S==="ai-disabled"||S==="no-ai-binding"||p===b?S:void 0,N=u(T=>{b!==void 0&&h.branchFrom(b,T)},"k"),I=u(T=>{b!==void 0&&h.truncateFrom(b,T)},"A"),A=u((T,j,K)=>{if(T===""||v||g.current!==void 0||e===void 0)return;let E=new AbortController;g.current=E;let W={role:"user",text:T},tt=[...j,W];q(e.id,tt),o({sessionId:e.id,text:""}),x(e.id),Y(t.chat(T,j.map(D=>({role:D.role,text:D.text})),e.schema,K,D=>{o(M=>M?.sessionId===e.id?{sessionId:e.id,text:D.type==="delta"?`${M.text}${D.text}`:""}:M)},E.signal).then(D=>{if(D!==void 0&&!E.signal.aborted){c(D.truncated?e.id:void 0);let M={partial:D.partial,...D.pendingApproval===void 0?{}:{pendingApproval:D.pendingApproval},role:"assistant",text:D.reply,toolCalls:D.toolCalls};q(e.id,U=>U.at(-1)===W?[...U,M]:U)}return D}).finally(()=>{g.current=void 0,o(void 0)}))},"I"),C=u(T=>{let j=(T??r).trim();j===""||v||g.current!==void 0||e===void 0||(n(""),A(j,e.turns))},"C"),P=u((T,j)=>{if(e===void 0||v||g.current!==void 0)return;let K=e.turns.slice(0,-1),E=K.at(-1);E?.role==="user"&&A(E.text,K.slice(0,-1),{allow:T,sql:j.sql,ticket:j.ticket})},"F"),$=h.draft;$!==void 0&&$.id!==m&&(f($.id),n($.text));let F=h.pendingAsk;return(0,z.useEffect)(()=>{F===void 0||F.sessionId!==b||v||y||(k(F.id),queueMicrotask(()=>{C(F.text)}))},[F,b,k,v,y]),{branchHere:N,decide:P,draft:r,live:s,pending:v,reason:w,send:C,setDraft:n,truncatedFor:i,truncateHere:I}},"mt"),Zt=u(h=>{let t=(0,B.c)(39),{assistant:e}=h,r=H(),n;t[0]!==e.activeId?(n=u(C=>C.id===e.activeId,"l"),t[0]=e.activeId,t[1]=n):n=t[1];let a=e.sessions.find(n),l=Q(a?.shardKey??""),s=ft({assistant:e,ops:l,session:a});if(l.unavailable||a===void 0)return null;let{turns:o}=a,i;t[2]!==r?(i=r("Assistant"),t[2]=r,t[3]=i):i=t[3];let c="flex h-full w-96 min-w-0 shrink-0 flex-col border-s border-border bg-card",p="assistant-panel",x;t[4]!==e.close?(x=(0,d.jsx)(lt,{onClose:e.close}),t[4]=e.close,t[5]=x):x=t[5];let m;t[6]!==e||t[7]!==r?(m=u(()=>{e.newChat({title:r("New chat")})},"u"),t[6]=e,t[7]=r,t[8]=m):m=t[8];let f;t[9]!==e.activeId||t[10]!==e.deleteChat||t[11]!==e.selectChat||t[12]!==e.sessions||t[13]!==m?(f=(0,d.jsx)(it,{activeId:e.activeId,onDelete:e.deleteChat,onNew:m,onSelect:e.selectChat,sessions:e.sessions}),t[9]=e.activeId,t[10]=e.deleteChat,t[11]=e.selectChat,t[12]=e.sessions,t[13]=m,t[14]=f):f=t[14];let g=o.length===0&&a.suggestions.length>0&&(0,d.jsx)(ct,{onPick:u(C=>{s.send(C)},"onPick"),suggestions:a.suggestions}),v="min-h-0 flex-1 overflow-y-auto",S="assistant-turns",q=o.map((C,P)=>(0,d.jsx)(ht,{index:P,level:l.level,onBranch:s.branchHere,onDecide:P===o.length-1?s.decide:void 0,onInsert:e.hasEditor?e.requestInsert:void 0,onTruncate:s.truncateHere,turn:C},`${String(P)}:${C.role}`)),k;t[15]!==s.live||t[16]!==a.id?(k=s.live?.sessionId===a.id&&s.live.text!==""&&(0,d.jsx)(rt,{text:s.live.text}),t[15]=s.live,t[16]=a.id,t[17]=k):k=t[17];let y;t[18]!==q||t[19]!==k?(y=(0,d.jsxs)("ul",{className:v,"data-testid":S,children:[q,k]}),t[18]=q,t[19]=k,t[20]=y):y=t[20];let b=s.truncatedFor===a.id,w;t[21]!==s.reason||t[22]!==b?(w=(0,d.jsx)(dt,{reason:s.reason,truncated:b}),t[21]=s.reason,t[22]=b,t[23]=w):w=t[23];let N;t[24]!==s?(N=u(()=>{s.send()},"k"),t[24]=s,t[25]=N):N=t[25];let I;t[26]!==s.draft||t[27]!==s.pending||t[28]!==s.setDraft||t[29]!==N?(I=(0,d.jsx)(nt,{draft:s.draft,onDraftChange:s.setDraft,onSend:N,pending:s.pending}),t[26]=s.draft,t[27]=s.pending,t[28]=s.setDraft,t[29]=N,t[30]=I):I=t[30];let A;return t[31]!==y||t[32]!==w||t[33]!==I||t[34]!==i||t[35]!==x||t[36]!==f||t[37]!==g?(A=(0,d.jsxs)("section",{"aria-label":i,className:c,"data-testid":p,children:[x,f,g,y,w,I]}),t[31]=y,t[32]=w,t[33]=I,t[34]=i,t[35]=x,t[36]=f,t[37]=g,t[38]=A):A=t[38],A},"It");export{Zt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as je}from"./chunk-JOPNP4EO.js";import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-2H6VLY2M.js";import"./chunk-O3AZ7JKE.js";import{a as qe}from"./chunk-ELSQ4FVH.js";import"./chunk-2SNHKJXK.js";import"./chunk-P5EVJEGC.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-FHLODLBC.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import{i as Ae}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as le}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as Ee}from"./chunk-RCXNYW7P.js";import{b as me}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as Le,b as Re,c as Ve,d as pe,e as B,f as L}from"./chunk-7QEZ2SFW.js";import"./chunk-4PI2OSSP.js";import{a as U}from"./chunk-2W4UO5BC.js";import{c as Ce}from"./chunk-FBDIQ67D.js";import{a as Ke,e as Te}from"./chunk-OK2QU2EV.js";import{m as be}from"./chunk-FACXM2UB.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-GNI37YCV.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-JOPNP4EO.js";import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-2H6VLY2M.js";import"./chunk-O3AZ7JKE.js";import{a as qe}from"./chunk-ELSQ4FVH.js";import"./chunk-2SNHKJXK.js";import"./chunk-P5EVJEGC.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-FHLODLBC.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import{i as Ae}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as le}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as Ee}from"./chunk-RCXNYW7P.js";import{b as me}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as Le,b as Re,c as Ve,d as pe,e as B,f as L}from"./chunk-7QEZ2SFW.js";import"./chunk-4PI2OSSP.js";import{a as U}from"./chunk-2W4UO5BC.js";import{c as Ce}from"./chunk-4N76XUNG.js";import{a as Ke,e as Te}from"./chunk-OK2QU2EV.js";import{m as be}from"./chunk-SHHGIT7M.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-GNI37YCV.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{a as de}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as ee}from"./chunk-RCXNYW7P.js";import{b as Z}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as te}from"./chunk-
|
|
1
|
+
import{a as de}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as ee}from"./chunk-RCXNYW7P.js";import{b as Z}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as te}from"./chunk-YEXTJUKQ.js";import"./chunk-LSEUUZN4.js";import{a as ne,b as ce,c as oe,d as re,e as O,f as S}from"./chunk-7QEZ2SFW.js";import"./chunk-OZAOWE7T.js";import"./chunk-BBDTJG2K.js";import"./chunk-4PI2OSSP.js";import"./chunk-2W4UO5BC.js";import"./chunk-4N76XUNG.js";import{h as se,i as ie,j as ae}from"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as Y,w as X,x as le}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as me}from"./chunk-GWNGVKLG.js";import{a as ve,b as pe}from"./chunk-6G3E4PJ2.js";import{a as o,d as $}from"./chunk-5PEAXTYQ.js";var _=$(me(),1);var ue=$(ve(),1);var s=$(pe(),1);var ye=new Set(["cancelled","completed","expired"]),he=o(i=>ye.has(i),"fe"),fe=o(i=>i.extendedDueAt??i.dueAt,"me"),xe=o(i=>!he(i)&&i!=="ready","ve"),ge=o((i,e)=>xe(i.status)&&e.getTime()>fe(i).getTime(),"pe"),qe=o((i,e)=>ge({dueAt:new Date(i.dueAt),status:i.status,...i.extendedDueAt===void 0||i.extendedDueAt===null?{}:{extendedDueAt:new Date(i.extendedDueAt)}},new Date(e)),"ye"),Ae=["studio","privacy-requests"],De={cancelled:"outline",completed:"success",expired:"outline",failed:"destructive",grace:"secondary",processing:"warning",ready:"success",received:"info"},be=o(i=>X(i??void 0,"\u2014"),"Ae"),Pe=o(i=>{let e=(0,_.c)(55),{asOf:u,retrying:t,row:r,onRetry:b}=i,d=Y(),n,c,I;e[0]!==u||e[1]!==r?(c=qe(r,u),n=re,I=le(c&&"bg-destructive/5"),e[0]=u,e[1]=r,e[2]=n,e[3]=c,e[4]=I):(n=e[2],c=e[3],I=e[4]);let N=c?"true":"false",v;e[5]!==r.id?(v=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.id}),e[5]=r.id,e[6]=v):v=e[6];let m;e[7]!==r.type||e[8]!==d?(m=r.type==="export"?d("Export"):d("Erasure"),e[7]=r.type,e[8]=d,e[9]=m):m=e[9];let E;e[10]!==m?(E=(0,s.jsx)(S,{children:(0,s.jsx)(Z,{variant:"secondary",children:m})}),e[10]=m,e[11]=E):E=e[11];let l;e[12]!==r.subjectId?(l=(0,s.jsx)(S,{className:"font-mono text-xs",children:r.subjectId}),e[12]=r.subjectId,e[13]=l):l=e[13];let T=De[r.status],P;e[14]!==r.status||e[15]!==T?(P=(0,s.jsx)(S,{children:(0,s.jsx)(Z,{variant:T,children:r.status})}),e[14]=r.status,e[15]=T,e[16]=P):P=e[16];let w;e[17]!==r.receivedAt?(w=X(r.receivedAt),e[17]=r.receivedAt,e[18]=w):w=e[18];let R;e[19]!==w?(R=(0,s.jsx)(S,{children:w}),e[19]=w,e[20]=R):R=e[20];let p;e[21]!==r.dueAt?(p=X(r.dueAt),e[21]=r.dueAt,e[22]=p):p=e[22];let y;e[23]!==p?(y=(0,s.jsx)(S,{children:p}),e[23]=p,e[24]=y):y=e[24];let h;e[25]!==r.extendedDueAt?(h=be(r.extendedDueAt),e[25]=r.extendedDueAt,e[26]=h):h=e[26];let f;e[27]!==h?(f=(0,s.jsx)(S,{children:h}),e[27]=h,e[28]=f):f=e[28];let x;e[29]!==c||e[30]!==d?(x=c&&(0,s.jsx)(Z,{"data-testid":"privacy-overdue",variant:"destructive",children:d("Overdue")}),e[29]=c,e[30]=d,e[31]=x):x=e[31];let g;e[32]!==x?(g=(0,s.jsx)(S,{children:x}),e[32]=x,e[33]=g):g=e[33];let q;e[34]!==b||e[35]!==t||e[36]!==r.id||e[37]!==r.status||e[38]!==d?(q=r.status==="failed"&&(0,s.jsx)(de,{disabled:t,onClick:o(()=>{b(r.id)},"onClick"),size:"xs",variant:"outline",children:d("Retry")}),e[34]=b,e[35]=t,e[36]=r.id,e[37]=r.status,e[38]=d,e[39]=q):q=e[39];let A;e[40]!==q?(A=(0,s.jsx)(S,{children:q}),e[40]=q,e[41]=A):A=e[41];let j;return e[42]!==n||e[43]!==I||e[44]!==R||e[45]!==y||e[46]!==f||e[47]!==g||e[48]!==A||e[49]!==N||e[50]!==v||e[51]!==E||e[52]!==l||e[53]!==P?(j=(0,s.jsxs)(n,{className:I,"data-overdue":N,"data-testid":"privacy-request-row",children:[v,E,l,P,R,y,f,g,A]}),e[42]=n,e[43]=I,e[44]=R,e[45]=y,e[46]=f,e[47]=g,e[48]=A,e[49]=N,e[50]=v,e[51]=E,e[52]=l,e[53]=P,e[54]=j):j=e[54],j},"ge"),we=o(i=>{let e=(0,_.c)(95),{source:u}=i,t=Y(),r=se(),b=(0,ue.useId)(),d;e[0]!==b?(d=[...Ae,b],e[0]=b,e[1]=d):d=e[1];let n=d,c;e[2]!==u?(c=o(async()=>({asOf:Date.now(),requests:await u.listOpenPrivacyRequests()}),"c"),e[2]=u,e[3]=c):c=e[3];let I;e[4]!==n||e[5]!==c?(I={queryKey:n,refetchInterval:6e4,queryFn:c,staleTime:0},e[4]=n,e[5]=c,e[6]=I):I=e[6];let N=ie(I),v;e[7]!==u?(v=o(a=>u.retryPrivacyRequest(a),"u"),e[7]=u,e[8]=v):v=e[8];let m;e[9]!==r||e[10]!==n?(m=o(async()=>{await r.invalidateQueries({queryKey:n})},"f"),e[9]=r,e[10]=n,e[11]=m):m=e[11];let E;e[12]!==v||e[13]!==m?(E={mutationFn:v,onSuccess:m},e[12]=v,e[13]=m,e[14]=E):E=e[14];let l=ae(E),T;e[15]!==l?(T=o(a=>{l.mutate(a)},"N"),e[15]=l,e[16]=T):T=e[16];let P=T;if(N.isPending){let a;e[17]!==t?(a=t("Loading privacy requests\u2026"),e[17]=t,e[18]=a):a=e[18];let D;return e[19]!==a?(D=(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"privacy-requests-loading",role:"status",children:a}),e[19]=a,e[20]=D):D=e[20],D}if(N.isError){let a;return e[21]!==N.error?(a=(0,s.jsx)(te,{error:N.error,testId:"privacy-requests-error"}),e[21]=N.error,e[22]=a):a=e[22],a}let{asOf:w,requests:R}=N.data;if(R.length===0){let a;e[23]!==t?(a=t("No open privacy requests."),e[23]=t,e[24]=a):a=e[24];let D;return e[25]!==a?(D=(0,s.jsx)(ee,{testId:"privacy-requests-empty",title:a}),e[25]=a,e[26]=D):D=e[26],D}let p;e[27]!==l.error||e[28]!==l.isError?(p=l.isError&&(0,s.jsx)(te,{error:l.error,testId:"privacy-retry-error"}),e[27]=l.error,e[28]=l.isError,e[29]=p):p=e[29];let y;e[30]!==t?(y=t("ID"),e[30]=t,e[31]=y):y=e[31];let h;e[32]!==y?(h=(0,s.jsx)(O,{children:y}),e[32]=y,e[33]=h):h=e[33];let f;e[34]!==t?(f=t("Type"),e[34]=t,e[35]=f):f=e[35];let x;e[36]!==f?(x=(0,s.jsx)(O,{children:f}),e[36]=f,e[37]=x):x=e[37];let g;e[38]!==t?(g=t("Subject"),e[38]=t,e[39]=g):g=e[39];let q;e[40]!==g?(q=(0,s.jsx)(O,{children:g}),e[40]=g,e[41]=q):q=e[41];let A;e[42]!==t?(A=t("Status"),e[42]=t,e[43]=A):A=e[43];let j;e[44]!==A?(j=(0,s.jsx)(O,{children:A}),e[44]=A,e[45]=j):j=e[45];let B;e[46]!==t?(B=t("Received"),e[46]=t,e[47]=B):B=e[47];let Q;e[48]!==B?(Q=(0,s.jsx)(O,{children:B}),e[48]=B,e[49]=Q):Q=e[49];let C;e[50]!==t?(C=t("Due"),e[50]=t,e[51]=C):C=e[51];let F;e[52]!==C?(F=(0,s.jsx)(O,{children:C}),e[52]=C,e[53]=F):F=e[53];let K;e[54]!==t?(K=t("Extended due"),e[54]=t,e[55]=K):K=e[55];let k;e[56]!==K?(k=(0,s.jsx)(O,{children:K}),e[56]=K,e[57]=k):k=e[57];let z;e[58]!==t?(z=t("Overdue"),e[58]=t,e[59]=z):z=e[59];let L;e[60]!==z?(L=(0,s.jsx)(O,{children:z}),e[60]=z,e[61]=L):L=e[61];let M;e[62]!==t?(M=t("Actions"),e[62]=t,e[63]=M):M=e[63];let G;e[64]!==M?(G=(0,s.jsx)(O,{children:M}),e[64]=M,e[65]=G):G=e[65];let H;e[66]!==h||e[67]!==x||e[68]!==q||e[69]!==j||e[70]!==Q||e[71]!==F||e[72]!==k||e[73]!==L||e[74]!==G?(H=(0,s.jsx)(ce,{children:(0,s.jsxs)(re,{children:[h,x,q,j,Q,F,k,L,G]})}),e[66]=h,e[67]=x,e[68]=q,e[69]=j,e[70]=Q,e[71]=F,e[72]=k,e[73]=L,e[74]=G,e[75]=H):H=e[75];let J;if(e[76]!==w||e[77]!==P||e[78]!==R||e[79]!==l.isPending||e[80]!==l.variables){let a;e[82]!==w||e[83]!==P||e[84]!==l.isPending||e[85]!==l.variables?(a=o(D=>(0,s.jsx)(Pe,{asOf:w,onRetry:P,retrying:l.isPending&&l.variables===D.id,row:D},D.id),"l"),e[82]=w,e[83]=P,e[84]=l.isPending,e[85]=l.variables,e[86]=a):a=e[86],J=R.map(a),e[76]=w,e[77]=P,e[78]=R,e[79]=l.isPending,e[80]=l.variables,e[81]=J}else J=e[81];let U;e[87]!==J?(U=(0,s.jsx)(oe,{children:J}),e[87]=J,e[88]=U):U=e[88];let V;e[89]!==H||e[90]!==U?(V=(0,s.jsxs)(ne,{children:[H,U]}),e[89]=H,e[90]=U,e[91]=V):V=e[91];let W;return e[92]!==V||e[93]!==p?(W=(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[p,V]}),e[92]=V,e[93]=p,e[94]=W):W=e[94],W},"Te"),Qe=o(i=>{let e=(0,_.c)(11),u;e[0]!==i?(u=i===void 0?{}:i,e[0]=i,e[1]=u):u=e[1];let{source:t}=u,r=Y();if(t===void 0){let d;e[2]!==r?(d=r("Pass privacyRequests to the Studio to list and retry data-subject requests."),e[2]=r,e[3]=d):d=e[3];let n;e[4]!==r?(n=r("Privacy requests not configured"),e[4]=r,e[5]=n):n=e[5];let c;return e[6]!==d||e[7]!==n?(c=(0,s.jsx)(ee,{description:d,testId:"privacy-requests-not-configured",title:n}),e[6]=d,e[7]=n,e[8]=c):c=e[8],c}let b;return e[9]!==t?(b=(0,s.jsx)(we,{source:t}),e[9]=t,e[10]=b):b=e[10],b},"Be");export{Qe as PrivacyRequestsPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Pe}from"./chunk-PJUVJTDR.js";import{a as he}from"./chunk-TKBTZX4K.js";import{a as le}from"./chunk-HZDLUAWS.js";import{a as V}from"./chunk-QKUVJIRX.js";import{d as Ie,f as Oe,g as $e,k as ie}from"./chunk-QAOZXPLU.js";import{a as Ce}from"./chunk-FHLODLBC.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{i as Se}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as U}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as E}from"./chunk-RCXNYW7P.js";import{b as we}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as ke}from"./chunk-2W4UO5BC.js";import{m as F}from"./chunk-
|
|
1
|
+
import{a as Pe}from"./chunk-PJUVJTDR.js";import{a as he}from"./chunk-TKBTZX4K.js";import{a as le}from"./chunk-HZDLUAWS.js";import{a as V}from"./chunk-QKUVJIRX.js";import{d as Ie,f as Oe,g as $e,k as ie}from"./chunk-QAOZXPLU.js";import{a as Ce}from"./chunk-FHLODLBC.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{i as Se}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as U}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as E}from"./chunk-RCXNYW7P.js";import{b as we}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as ke}from"./chunk-2W4UO5BC.js";import{m as F}from"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as M,b as be,g as ye,h as oe,i as se,j as ue,p as ve,s as Ne,v as ae,x as fe}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as te}from"./chunk-GWNGVKLG.js";import{a as me,b as re}from"./chunk-6G3E4PJ2.js";import{a as u,d as L}from"./chunk-5PEAXTYQ.js";var Qe=L(te(),1),xe=L(me(),1);var Y=L(te(),1),X=L(me(),1);var R=L(re(),1);var Xe=oe(ke.listTables),Ye=["react","client","cli"],Ze={action:"action",mutation:"mutation",query:"query"},Te=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"Q"),et=u(({file:t,fn:e,kind:a})=>`await client.${Ze[a]}(api.${t}.${e}, { /* args */ });`,"ae"),tt=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return`const { call: ${t.fn} } = useAction(${e});`;case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"se"),rt=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"oe"),at=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
|
|
2
2
|
`),"ce"),nt=u((t,e)=>{switch(t){case"cli":return rt(e);case"client":return et(e);default:return tt(e)}},"re"),Re=u(t=>{let e=(0,Y.c)(19),{code:a,label:r,testId:n}=t,s=M(),o;e[0]!==a?(o=u(()=>{ae(a)},"c"),e[0]=a,e[1]=o):o=e[1];let i=o,c;e[2]!==r?(c=(0,R.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:r}),e[2]=r,e[3]=c):c=e[3];let m=`${n}-copy`,l;e[4]!==s?(l=s("Copy"),e[4]=s,e[5]=l):l=e[5];let p;e[6]!==i||e[7]!==m||e[8]!==l?(p=(0,R.jsx)(U,{"data-testid":m,onClick:i,size:"xs",type:"button",variant:"ghost",children:l}),e[6]=i,e[7]=m,e[8]=l,e[9]=p):p=e[9];let f;e[10]!==c||e[11]!==p?(f=(0,R.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[c,p]}),e[10]=c,e[11]=p,e[12]=f):f=e[12];let h;e[13]!==a||e[14]!==n?(h=(0,R.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:a}),e[13]=a,e[14]=n,e[15]=h):h=e[15];let g;return e[16]!==f||e[17]!==h?(g=(0,R.jsxs)("div",{className:"flex flex-col gap-1.5",children:[f,h]}),e[16]=f,e[17]=h,e[18]=g):g=e[18],g},"U"),ot=u(t=>{let e=(0,Y.c)(46),{file:a,fn:r,kind:n}=t,s=M(),[o,i]=(0,X.useState)("react"),c,m,l;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==s||e[4]!==o){let w={file:a,fn:r,kind:n},P;e[8]!==s?(P=s("CLI"),e[8]=s,e[9]=P):P=e[9];let O;e[10]!==s?(O=s("Client"),e[10]=s,e[11]=O):O=e[11];let S;e[12]!==s?(S=s("React"),e[12]=s,e[13]=S):S=e[13];let T;e[14]!==P||e[15]!==O||e[16]!==S?(T={cli:P,client:O,react:S},e[14]=P,e[15]=O,e[16]=S,e[17]=T):T=e[17],l=T;let A;e[18]===Symbol.for("react.memo_cache_sentinel")?(A=u(_=>{i(_.currentTarget.dataset.tab)},"B"),e[18]=A):A=e[18],c=A,m=nt(o,w),e[0]=a,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=c,e[6]=m,e[7]=l}else c=e[5],m=e[6],l=e[7];let p=m,f=`api.${a}.${r}`,h;e[19]!==f?(h=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:f}),e[19]=f,e[20]=h):h=e[20];let g;e[21]!==n||e[22]!==s?(g=s("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=s,e[23]=g):g=e[23];let x;e[24]!==g?(x=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),e[24]=g,e[25]=x):x=e[25];let v;e[26]!==h||e[27]!==x?(v=(0,R.jsxs)("div",{children:[h,x]}),e[26]=h,e[27]=x,e[28]=v):v=e[28];let N;e[29]!==s?(N=s("Snippet flavour"),e[29]=s,e[30]=N):N=e[30];let y;e[31]!==c||e[32]!==o||e[33]!==l?(y=Ye.map(w=>(0,R.jsx)(U,{"aria-selected":o===w,"data-tab":w,"data-testid":`api-tab-${w}`,onClick:c,role:"tab",size:"xs",type:"button",variant:o===w?"default":"outline",children:l[w]},w)),e[31]=c,e[32]=o,e[33]=l,e[34]=y):y=e[34];let b;e[35]!==N||e[36]!==y?(b=(0,R.jsx)("div",{"aria-label":N,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:y}),e[35]=N,e[36]=y,e[37]=b):b=e[37];let I=l[o],C=`api-snippet-${o}`,$;e[38]!==p||e[39]!==I||e[40]!==C?($=(0,R.jsx)(Re,{code:p,label:I,testId:C}),e[38]=p,e[39]=I,e[40]=C,e[41]=$):$=e[41];let k;return e[42]!==$||e[43]!==v||e[44]!==b?(k=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[v,b,$]}),e[42]=$,e[43]=v,e[44]=b,e[45]=k):k=e[45],k},"de"),st=u(t=>{let e=(0,Y.c)(19),{name:a}=t,r=M(),n;e[0]!==a?(n=at(a),e[0]=a,e[1]=n):n=e[1];let s=n,o;e[2]!==a?(o=(0,R.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:a}),e[2]=a,e[3]=o):o=e[3];let i;e[4]!==r?(i=r("Read and write this table through the typed data model."),e[4]=r,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==o||e[9]!==c?(m=(0,R.jsxs)("div",{children:[o,c]}),e[8]=o,e[9]=c,e[10]=m):m=e[10];let l;e[11]!==r?(l=r("Data model"),e[11]=r,e[12]=l):l=e[12];let p;e[13]!==s||e[14]!==l?(p=(0,R.jsx)(Re,{code:s,label:l,testId:"api-snippet-table"}),e[13]=s,e[14]=l,e[15]=p):p=e[15];let f;return e[16]!==m||e[17]!==p?(f=(0,R.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[m,p]}),e[16]=m,e[17]=p,e[18]=f):f=e[18],f},"fe"),je=u(t=>{let e=(0,Y.c)(8),{active:a,label:r,onSelect:n,testId:s,value:o}=t,i;e[0]!==n||e[1]!==o?(i=u(()=>{n(o)},"m"),e[0]=n,e[1]=o,e[2]=i):i=e[2];let c=i,m=a?"page":void 0,l;return e[3]!==r||e[4]!==c||e[5]!==m||e[6]!==s?(l=(0,R.jsx)("button",{"aria-current":m,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":s,onClick:c,type:"button",children:r}),e[3]=r,e[4]=c,e[5]=m,e[6]=s,e[7]=l):l=e[7],l},"G"),it=u(t=>{let e=new Map;for(let a of t){let{file:r,fn:n}=Te(a.path),s=e.get(r)??[];s.push({fn:n,kind:a.kind,path:a.path}),e.set(r,s)}return[...e.entries()].map(([a,r])=>({file:a,items:r.toSorted((n,s)=>n.fn.localeCompare(s.fn))})).toSorted((a,r)=>a.file.localeCompare(r.file))},"pe"),Ae=u(t=>{let e=(0,Y.c)(58),{functions:a,initialShardKey:r}=t,n=M(),s=F(),[o,i]=(0,X.useState)(null),[c,m]=(0,X.useState)(null),l,p;e[0]!==s||e[1]!==r?(l=u(()=>{let _=!1;return s.query(Xe,{},se(r??"")).then(j=>(_||i(j),j)).catch(()=>{_||i([])}),()=>{_=!0}},"o"),p=[s,r],e[0]=s,e[1]=r,e[2]=l,e[3]=p):(l=e[2],p=e[3]),(0,X.useEffect)(l,p);let f,h,g,x,v,N,y,b,I,C;if(e[4]!==a||e[5]!==c||e[6]!==n||e[7]!==o){let _=a??[],j=it(_),q=(o??[]).map(lt).toSorted(dt),J;e[18]===Symbol.for("react.memo_cache_sentinel")?(J=u(K=>{m({kind:"fn",path:K})},"P"),e[18]=J):J=e[18];let W=J,Q;e[19]===Symbol.for("react.memo_cache_sentinel")?(Q=u(K=>{m({kind:"table",name:K})},"j"),e[19]=Q):Q=e[19];let Ve=Q;h=c?.kind==="fn"?_.find(K=>K.path===c.path):void 0,f=_.length>0||q.length>0,g=h===void 0?void 0:Te(h.path),I="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",C="lunora-api-docs",e[20]!==n?(x=n("API resources"),e[20]=n,e[21]=x):x=e[21],v="flex flex-col gap-4 overflow-y-auto",N="api-rail";let ne;e[22]!==c||e[23]!==n?(ne=u(K=>(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:K.file||n("(root)")}),K.items.map(ee=>(0,R.jsx)(je,{active:c?.kind==="fn"&&c.path===ee.path,label:ee.fn,onSelect:W,testId:`api-rail-fn-${ee.path}`,value:ee.path},ee.path))]},K.file),"q"),e[22]=c,e[23]=n,e[24]=ne):ne=e[24],y=j.map(ne),b=q.length>0&&(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")}),q.map(K=>(0,R.jsx)(je,{active:c?.kind==="table"&&c.name===K,label:K,onSelect:Ve,testId:`api-rail-table-${K}`,value:K},K))]}),e[4]=a,e[5]=c,e[6]=n,e[7]=o,e[8]=f,e[9]=h,e[10]=g,e[11]=x,e[12]=v,e[13]=N,e[14]=y,e[15]=b,e[16]=I,e[17]=C}else f=e[8],h=e[9],g=e[10],x=e[11],v=e[12],N=e[13],y=e[14],b=e[15],I=e[16],C=e[17];let $;e[25]!==f||e[26]!==n?($=!f&&(0,R.jsx)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")}),e[25]=f,e[26]=n,e[27]=$):$=e[27];let k;e[28]!==$||e[29]!==x||e[30]!==v||e[31]!==N||e[32]!==y||e[33]!==b?(k=(0,R.jsxs)("nav",{"aria-label":x,className:v,"data-testid":N,children:[y,b,$]}),e[28]=$,e[29]=x,e[30]=v,e[31]=N,e[32]=y,e[33]=b,e[34]=k):k=e[34];let w;e[35]!==c||e[36]!==n?(w=c===null&&(0,R.jsx)(E,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")}),e[35]=c,e[36]=n,e[37]=w):w=e[37];let P;e[38]!==c?.kind||e[39]!==h||e[40]!==g?(P=c?.kind==="fn"&&h!==void 0&&g!==void 0&&(0,R.jsx)(ot,{file:g.file,fn:g.fn,kind:h.kind},h.path),e[38]=c?.kind,e[39]=h,e[40]=g,e[41]=P):P=e[41];let O;e[42]!==c?.kind||e[43]!==h||e[44]!==n?(O=c?.kind==="fn"&&h===void 0&&(0,R.jsx)(E,{testId:"api-empty",title:n("API usage snippets")}),e[42]=c?.kind,e[43]=h,e[44]=n,e[45]=O):O=e[45];let S;e[46]!==c?(S=c?.kind==="table"&&(0,R.jsx)(st,{name:c.name}),e[46]=c,e[47]=S):S=e[47];let T;e[48]!==w||e[49]!==P||e[50]!==O||e[51]!==S?(T=(0,R.jsxs)("div",{className:"min-w-0",children:[w,P,O,S]}),e[48]=w,e[49]=P,e[50]=O,e[51]=S,e[52]=T):T=e[52];let A;return e[53]!==k||e[54]!==T||e[55]!==I||e[56]!==C?(A=(0,R.jsxs)("div",{className:I,"data-testid":C,children:[k,T]}),e[53]=k,e[54]=T,e[55]=I,e[56]=C,e[57]=A):A=e[57],A},"ke");function lt(t){return t.name}u(lt,"ue");function dt(t,e){return t.localeCompare(e)}u(dt,"me");var We=L(te(),1);var B=L(te(),1);var z=L(me(),1);var d=L(re(),1);var ct=u(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","we"),Me=u(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"Q"),ce=u(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>ce(e)).join(" | "):t.type==="array"?`array<${ce(t.items)}>`:t.type??"any","z"),pt=u(t=>{let e=Me(t);return e!==void 0?t.type??ct(e[0]):ce(t)},"ke"),mt=u(t=>{let e=Me(t);return e===void 0?void 0:e.map(a=>JSON.stringify(a)).join(" | ")},"Oe"),ut=u(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let a=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let r=e.length>(a?2:1);return a||r?e.join(" "):void 0},"$e"),ft=u(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"Te"),Z=u(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return Z(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[a,r]of Object.entries(t.properties??{}))e[a]=Z(r);return e}case"string":return"";default:return null}},"D"),de=u(t=>{let e=(0,B.c)(7),{label:a,value:r}=t,n;e[0]!==a?(n=(0,d.jsx)("span",{className:"text-muted-foreground",children:a}),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==r?(s=(0,d.jsx)("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"K"),ht=u(t=>{let e=(0,B.c)(40),{name:a,required:r,schema:n}=t,s=M(),o;e[0]!==n?(o=ut(n),e[0]=n,e[1]=o):o=e[1];let i=o,c;e[2]!==n?(c=mt(n),e[2]=n,e[3]=c):c=e[3];let m=c,l=n["x-lunora-table"],p=n.format!==void 0||i!==void 0||m!==void 0||l!==void 0,f;e[4]!==n?(f=ft(n),e[4]=n,e[5]=f):f=e[5];let h=f,g=r?"*":"?",x;e[6]!==g?(x=(0,d.jsx)("span",{className:"text-muted-foreground",children:g}),e[6]=g,e[7]=x):x=e[7];let v;e[8]!==a||e[9]!==x?(v=(0,d.jsxs)("span",{className:"font-mono text-foreground",children:[a,x]}),e[8]=a,e[9]=x,e[10]=v):v=e[10];let N;e[11]!==n?(N=pt(n),e[11]=n,e[12]=N):N=e[12];let y;e[13]!==N?(y=(0,d.jsx)("span",{className:"font-mono text-muted-foreground",children:N}),e[13]=N,e[14]=y):y=e[14];let b;e[15]!==v||e[16]!==y?(b=(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[v,y]}),e[15]=v,e[16]=y,e[17]=b):b=e[17];let I;e[18]!==n.description?(I=n.description!==void 0&&(0,d.jsx)("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=I):I=e[19];let C;e[20]!==p||e[21]!==i||e[22]!==l||e[23]!==n.format||e[24]!==s||e[25]!==m?(C=p&&(0,d.jsxs)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,d.jsx)(de,{label:s("Format"),value:n.format}),i!==void 0&&(0,d.jsx)(de,{label:s("Range"),value:i}),m!==void 0&&(0,d.jsx)(de,{label:s("Value in"),value:m}),l!==void 0&&(0,d.jsx)(de,{label:s("relation"),value:l})]}),e[20]=p,e[21]=i,e[22]=l,e[23]=n.format,e[24]=s,e[25]=m,e[26]=C):C=e[26];let $;e[27]!==I||e[28]!==C||e[29]!==b?($=(0,d.jsxs)("div",{className:"flex flex-col gap-1 py-2",children:[b,I,C]}),e[27]=I,e[28]=C,e[29]=b,e[30]=$):$=e[30];let k=$;if(h===void 0){let S;return e[31]!==k?(S=(0,d.jsx)("div",{className:"border-b border-border/50 last:border-b-0",children:k}),e[31]=k,e[32]=S):S=e[32],S}let w;e[33]!==k?(w=(0,d.jsx)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:k}),e[33]=k,e[34]=w):w=e[34];let P;e[35]!==h?(P=(0,d.jsx)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,d.jsx)(qe,{schema:h})}),e[35]=h,e[36]=P):P=e[36];let O;return e[37]!==w||e[38]!==P?(O=(0,d.jsxs)("details",{className:"border-b border-border/50 last:border-b-0",children:[w,P]}),e[37]=w,e[38]=P,e[39]=O):O=e[39],O},"Ce"),qe=u(t=>{let e=(0,B.c)(7),{schema:a}=t,r;e[0]!==a.required?(r=new Set(a.required),e[0]=a.required,e[1]=r):r=e[1];let n=r,s;e[2]!==a.properties?(s=Object.entries(a.properties??{}),e[2]=a.properties,e[3]=s):s=e[3];let o=s,i;return e[4]!==n||e[5]!==o?(i=(0,d.jsx)("div",{className:"flex flex-col",children:o.map(c=>{let[m,l]=c;return(0,d.jsx)(ht,{name:m,required:n.has(m),schema:l},m)})}),e[4]=n,e[5]=o,e[6]=i):i=e[6],i},"Z"),_e=u(t=>{let e=(0,B.c)(10),{schema:a,testId:r}=t;if(a?.type!=="object"||Object.keys(a.properties??{}).length===0){let o;e[0]!==a?(o=ce(a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==o||e[3]!==r?(i=(0,d.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":r,children:o}),e[2]=o,e[3]=r,e[4]=i):i=e[4],i}let n;e[5]!==a?(n=(0,d.jsx)(qe,{schema:a}),e[5]=a,e[6]=n):n=e[6];let s;return e[7]!==n||e[8]!==r?(s=(0,d.jsx)("div",{className:"text-xs","data-testid":r,children:n}),e[7]=n,e[8]=r,e[9]=s):s=e[9],s},"V"),gt=["curl","javascript","lunora"],xt={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},bt=u(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"Ae"),yt=u(t=>{let e=Z(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"je"),vt=u((t,e,a)=>{let r=`${a}${e.httpPath}`,n=JSON.stringify(yt(e),void 0,2),s=JSON.stringify(Z(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let o=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(r)}`];return o&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
|
|
3
3
|
`)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
|
|
4
4
|
import { api } from "./_generated/api";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Y}from"./chunk-J3BZWYJQ.js";import{a as ce}from"./chunk-RE7GRXBM.js";import{a as X}from"./chunk-YEVTA35E.js";import{i as de}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as re}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as z}from"./chunk-RCXNYW7P.js";import{b as oe}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as G,b as H,c as O,d as _,e as C,f as j}from"./chunk-7QEZ2SFW.js";import"./chunk-2W4UO5BC.js";import{b as V}from"./chunk-FBDIQ67D.js";import{a as R,e as P}from"./chunk-OK2QU2EV.js";import{m as K}from"./chunk-FACXM2UB.js";import"./chunk-ZPQBVYNN.js";import{B as M,j as U,s as F,w as te,x as ie}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as ne}from"./chunk-GWNGVKLG.js";import{a as le,b as se}from"./chunk-6G3E4PJ2.js";import{a as c,d as E}from"./chunk-5PEAXTYQ.js";var Q=E(ne(),1),W=E(le(),1);var o=E(se(),1);var me=E(ne(),1),Z=E(le(),1);var p=E(se(),1);var fe=c(t=>Number.isFinite(t)?te(t,"\u2014"):"\u2014","X"),he=c(t=>t.toSorted((e,d)=>e.scheduledFor-d.scheduledFor),"F"),be=c((t,e,d)=>e!==void 0?e:d===void 0?l=>t.cancelScheduledJob(l):void 0,"Y"),ue=c(t=>{let e=(0,me.c)(16),{cancelJob:d,loadJobs:l}=t===void 0?{}:t,g=K(),r=M(),n=l===void 0,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["lunora-scheduled-jobs"],e[0]=a):a=e[0];let w=V(a,async()=>{let u=await(l??(()=>g.listScheduledJobs()))();return he(u)}),[f,i]=(0,Z.useState)(void 0),[s,h]=(0,Z.useState)(void 0),N,v;e[1]!==g||e[2]!==n?(N=c(()=>{if(n)return g.subscribeScheduledJobs(u=>{h(void 0),i(he(u))})},"v"),v=[n,g],e[1]=g,e[2]=n,e[3]=N,e[4]=v):(N=e[3],v=e[4]),(0,Z.useEffect)(N,v);let b;e[5]!==w?(b=c(()=>w.poll(),"y"),e[5]=w,e[6]=b):b=e[6],Y(b,!n);let S=be(g,d,l),m=f??w.data,J=s??w.error,L=c(async u=>{if(S!==void 0){h(void 0);try{await S(u),n||w.refetch()}catch(D){h(U(D))}}},"E"),I="flex flex-col gap-3",q="lunora-scheduled-jobs",$;e[7]!==J?($=J!==null&&(0,p.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:J}),e[7]=J,e[8]=$):$=e[8];let k;e[9]!==m?.length||e[10]!==r?(k=m?.length===0&&(0,p.jsx)(z,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,p.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,p.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,p.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=m?.length,e[10]=r,e[11]=k):k=e[11];let T=m!==void 0&&m.length>0&&(0,p.jsx)(R,{className:"overflow-hidden py-0",children:(0,p.jsx)(P,{className:"px-0",children:(0,p.jsxs)(G,{"data-testid":"sj-table",children:[(0,p.jsx)(H,{children:(0,p.jsxs)(_,{children:[(0,p.jsx)(C,{children:r("function")}),(0,p.jsx)(C,{children:r("scheduled for")}),(0,p.jsx)(C,{children:r("pool")}),(0,p.jsx)(C,{children:r("attempts")}),(0,p.jsx)(C,{children:r("shard")}),(0,p.jsx)(C,{children:r("id")}),S!==void 0&&(0,p.jsx)(C,{"aria-label":r("Actions")})]})}),(0,p.jsx)(O,{children:m.map(u=>(0,p.jsxs)(_,{"data-testid":`sj-row-${u.id}`,children:[(0,p.jsx)(j,{className:"font-mono text-xs",children:u.workflow??u.functionPath}),(0,p.jsx)(j,{className:"text-muted-foreground tabular-nums",children:fe(u.scheduledFor)}),(0,p.jsx)(j,{className:"font-mono text-xs",children:u.pool??""}),(0,p.jsx)(j,{className:"tabular-nums",children:u.attempts??0}),(0,p.jsx)(j,{children:u.shardKey??""}),(0,p.jsx)(j,{className:"font-mono text-xs",children:u.id}),S!==void 0&&(0,p.jsx)(j,{className:"text-right",children:(0,p.jsx)(X,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{F(L(u.id))},"onConfirm"),testId:`sj-cancel-${u.id}`,children:r("Cancel")})})]},u.id))})]})})}),x;return e[12]!==T||e[13]!==$||e[14]!==k?(x=(0,p.jsxs)("div",{className:I,"data-testid":q,children:[$,k,T]}),e[12]=T,e[13]=$,e[14]=k,e[15]=x):x=e[15],x},"he");var ve=c(()=>{let t=(0,Q.c)(50),e=M(),d=ce(""),[l,g]=(0,W.useState)(""),[r,n]=(0,W.useState)(void 0),[a,w]=(0,W.useState)(!1);if(d.unavailable)return null;let f;t[0]!==d?(f=d.pending("cron"),t[0]=d,t[1]=f):f=t[1];let i=f,s;t[2]!==d?(s=d.reason("cron"),t[2]=d,t[3]=s):s=t[3];let h=s,N;t[4]!==l||t[5]!==d?(N=c(()=>{let A=l.trim();A!==""&&F((async()=>{let pe=await d.suggestCron(A);w(!1),n(pe)})())},"v"),t[4]=l,t[5]=d,t[6]=N):N=t[6];let v=N,b;t[7]!==r?(b=c(()=>{let A="navigator"in globalThis?globalThis.navigator.clipboard:void 0;A===void 0||r===void 0||F((async()=>{try{await A.writeText(r),w(!0)}catch{w(!1)}})())},"f"),t[7]=r,t[8]=b):b=t[8];let S=b,m;t[9]!==e?(m=e("Describe a schedule"),t[9]=e,t[10]=m):m=t[10];let J;t[11]===Symbol.for("react.memo_cache_sentinel")?(J=c(A=>{g(A.target.value)},"y"),t[11]=J):J=t[11];let L;t[12]!==v?(L=c(A=>{A.key==="Enter"&&(A.preventDefault(),v())},"N"),t[12]=v,t[13]=L):L=t[13];let I;t[14]!==e?(I=e("Describe a schedule"),t[14]=e,t[15]=I):I=t[15];let q;t[16]!==i||t[17]!==l||t[18]!==m||t[19]!==L||t[20]!==I?(q=(0,o.jsx)(de,{"aria-label":m,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:i,onChange:J,onKeyDown:L,placeholder:I,value:l}),t[16]=i,t[17]=l,t[18]=m,t[19]=L,t[20]=I,t[21]=q):q=t[21];let $=i&&"opacity-60",k;t[22]!==$?(k=ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",$),t[22]=$,t[23]=k):k=t[23];let T;t[24]!==i||t[25]!==l?(T=i||l.trim()==="",t[24]=i,t[25]=l,t[26]=T):T=t[26];let x;t[27]!==i||t[28]!==e?(x=e(i?"Thinking\u2026":"Suggest schedule"),t[27]=i,t[28]=e,t[29]=x):x=t[29];let u;t[30]!==v||t[31]!==k||t[32]!==T||t[33]!==x?(u=(0,o.jsx)("button",{className:k,"data-testid":"cron-assistant-generate",disabled:T,onClick:v,type:"button",children:x}),t[30]=v,t[31]=k,t[32]=T,t[33]=x,t[34]=u):u=t[34];let D;t[35]!==u||t[36]!==q?(D=(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[q,u]}),t[35]=u,t[36]=q,t[37]=D):D=t[37];let y;t[38]!==a||t[39]!==S||t[40]!==r||t[41]!==e?(y=r!==void 0&&(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:r}),(0,o.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:S,type:"button",children:e(a?"Copied":"Copy")}),(0,o.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),t[38]=a,t[39]=S,t[40]=r,t[41]=e,t[42]=y):y=t[42];let B;t[43]!==h||t[44]!==e?(B=h!==void 0&&(0,o.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(h==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),t[43]=h,t[44]=e,t[45]=B):B=t[45];let ee;return t[46]!==D||t[47]!==y||t[48]!==B?(ee=(0,o.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[D,y,B]}),t[46]=D,t[47]=y,t[48]=B,t[49]=ee):ee=t[49],ee},"ie"),xe={kind:"idle"},ge=c((t,e,d)=>d!==void 0?d:e===void 0?l=>t.runCronJob(l):void 0,"ce"),Ne=c(({loadCronJobs:t,runCronJob:e}={})=>{let d=K(),l=M(),[g,r]=(0,W.useState)({}),n=V(["lunora-cron-jobs",t?"custom":"default"],()=>(t??(()=>d.getCronJobs()))()),{data:a,error:w}=n,f=ge(d,t,e),i=c(async s=>{if(f!==void 0){r(h=>({...h,[s]:{kind:"running"}}));try{await f(s),r(h=>({...h,[s]:{kind:"ok"}})),n.refetch()}catch(h){r(N=>({...N,[s]:{kind:"error",message:U(h)}}))}}},"a");return(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,o.jsx)(ve,{}),w!==null&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:w}),a?.length===0&&(0,o.jsx)(z,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,o.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,o.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),a!==void 0&&a.length>0&&(0,o.jsx)(R,{className:"overflow-hidden py-0",children:(0,o.jsx)(P,{className:"px-0",children:(0,o.jsxs)(G,{"data-testid":"cron-table",children:[(0,o.jsx)(H,{children:(0,o.jsxs)(_,{children:[(0,o.jsx)(C,{children:l("name")}),(0,o.jsx)(C,{children:l("schedule")}),(0,o.jsx)(C,{children:l("target")}),(0,o.jsx)(C,{children:l("shard")}),f!==void 0&&(0,o.jsx)(C,{"aria-label":l("Actions")})]})}),(0,o.jsx)(O,{children:a.map(s=>{let h=g[s.name]??xe;return(0,o.jsxs)(_,{"data-testid":`cron-row-${s.name}`,children:[(0,o.jsx)(j,{children:s.name}),(0,o.jsx)(j,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,o.jsx)(j,{children:(0,o.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,o.jsx)(oe,{variant:"outline",children:l("function")}):(0,o.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,o.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,o.jsx)(j,{children:s.shardKey??""}),f!==void 0&&(0,o.jsx)(j,{className:"text-right",children:(0,o.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[h.kind==="ok"&&(0,o.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:l("ran")}),h.kind==="error"&&(0,o.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:h.message}),(0,o.jsx)(X,{confirmLabel:l("Run now?"),disabled:h.kind==="running",onConfirm:c(()=>{F(i(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:h.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"ue"),ye=c(t=>Number.isFinite(t)?te(t,"\u2014"):"\u2014","he"),we=c(t=>{let e=(0,Q.c)(34),d;e[0]!==t?(d=t===void 0?{}:t,e[0]=t,e[1]=d):d=e[1];let{loadJobs:l,removeJob:g,retryJob:r}=d,n=K(),a=M(),w;e[2]===Symbol.for("react.memo_cache_sentinel")?(w=["lunora-dead-jobs"],e[2]=w):w=e[2];let f;e[3]!==n||e[4]!==l?(f=c(async()=>(await(l??(()=>n.listDeadJobs()))()).toSorted(ke),"h"),e[3]=n,e[4]=l,e[5]=f):f=e[5];let i=V(w,f),s=i.data,[h,N]=(0,W.useState)(void 0),v=i.error??h,b=l===void 0,S;e[6]!==n||e[7]!==b||e[8]!==r?(S=r??(b?y=>n.retryDeadJob(y):void 0),e[6]=n,e[7]=b,e[8]=r,e[9]=S):S=e[9];let m=S,J;e[10]!==n||e[11]!==b||e[12]!==g?(J=g??(b?y=>n.removeDeadJob(y):void 0),e[10]=n,e[11]=b,e[12]=g,e[13]=J):J=e[13];let L=J,I;e[14]!==i?(I=c(()=>i.poll(),"k"),e[14]=i,e[15]=I):I=e[15],Y(I,!0);let q;e[16]!==i?(q=c(async y=>{N(void 0);try{await y,i.refetch()}catch(B){N(U(B))}},"C"),e[16]=i,e[17]=q):q=e[17];let $=q,k=m!==void 0||L!==void 0,T;e[18]!==v?(T=v!==void 0&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:v}),e[18]=v,e[19]=T):T=e[19];let x;e[20]!==s?.length||e[21]!==a?(x=s?.length===0&&(0,o.jsx)(z,{description:a("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,o.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:a("No dead-letter jobs.")}),e[20]=s?.length,e[21]=a,e[22]=x):x=e[22];let u;e[23]!==$||e[24]!==k||e[25]!==s||e[26]!==L||e[27]!==m||e[28]!==a?(u=s!==void 0&&s.length>0&&(0,o.jsx)(R,{className:"overflow-hidden py-0",children:(0,o.jsx)(P,{className:"px-0",children:(0,o.jsxs)(G,{"data-testid":"dlq-table",children:[(0,o.jsx)(H,{children:(0,o.jsxs)(_,{children:[(0,o.jsx)(C,{children:a("function")}),(0,o.jsx)(C,{children:a("attempts")}),(0,o.jsx)(C,{children:a("last tried")}),(0,o.jsx)(C,{children:a("pool")}),(0,o.jsx)(C,{children:a("shard")}),(0,o.jsx)(C,{children:a("id")}),k&&(0,o.jsx)(C,{"aria-label":a("Actions")})]})}),(0,o.jsx)(O,{children:s.map(y=>(0,o.jsxs)(_,{"data-testid":`dlq-row-${y.id}`,children:[(0,o.jsx)(j,{className:"font-mono text-xs",children:y.workflow??y.functionPath}),(0,o.jsx)(j,{className:"tabular-nums",children:y.attempts??0}),(0,o.jsx)(j,{className:"text-muted-foreground tabular-nums",children:ye(y.scheduledFor)}),(0,o.jsx)(j,{className:"font-mono text-xs",children:y.pool??""}),(0,o.jsx)(j,{children:y.shardKey??""}),(0,o.jsx)(j,{className:"font-mono text-xs",children:y.id}),k&&(0,o.jsx)(j,{className:"text-right",children:(0,o.jsxs)("div",{className:"flex justify-end gap-1.5",children:[m!==void 0&&(0,o.jsx)(re,{"data-testid":`dlq-retry-${y.id}`,onClick:c(()=>{F($(m(y.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Retry")}),L!==void 0&&(0,o.jsx)(X,{confirmLabel:a("Drop job?"),onConfirm:c(()=>{F($(L(y.id)))},"onConfirm"),testId:`dlq-remove-${y.id}`,children:a("Drop")})]})})]},y.id))})]})})}),e[23]=$,e[24]=k,e[25]=s,e[26]=L,e[27]=m,e[28]=a,e[29]=u):u=e[29];let D;return e[30]!==u||e[31]!==T||e[32]!==x?(D=(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[T,x,u]}),e[30]=u,e[31]=T,e[32]=x,e[33]=D):D=e[33],D},"me");function ke(t,e){return(e.attempts??0)-(t.attempts??0)}c(ke,"fe");var ae=c(t=>{let e=(0,Q.c)(8),{label:d,testId:l,value:g}=t,r;e[0]!==d?(r=(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:d}),e[0]=d,e[1]=r):r=e[1];let n;e[2]!==l||e[3]!==g?(n=(0,o.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":l,children:g}),e[2]=l,e[3]=g,e[4]=n):n=e[4];let a;return e[5]!==r||e[6]!==n?(a=(0,o.jsx)(R,{className:"flex-1 py-0",children:(0,o.jsxs)(P,{className:"flex flex-col gap-1 p-4",children:[r,n]})}),e[5]=r,e[6]=n,e[7]=a):a=e[7],a},"K"),Ce=c(t=>{let e=(0,Q.c)(25),d;e[0]!==t?(d=t===void 0?{}:t,e[0]=t,e[1]=d):d=e[1];let{loadStatus:l}=d,g=K(),r=M(),n=l===void 0,a;e[2]!==n?(a=["lunora-scheduler-status",n],e[2]=n,e[3]=a):a=e[3];let w;e[4]!==g||e[5]!==l?(w=c(async()=>{let J=await(l??(()=>g.schedulerStatus()))();return{...J,pools:J.pools.toSorted(je)}},"w"),e[4]=g,e[5]=l,e[6]=w):w=e[6];let f=V(a,w),{data:i,error:s}=f,h;e[7]!==f?(h=c(()=>f.poll(),"c"),e[7]=f,e[8]=h):h=e[8],Y(h,!0);let N;e[9]!==s?(N=s!==null&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=N):N=e[10];let v;e[11]!==i||e[12]!==r?(v=i!==void 0&&(0,o.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,o.jsx)(ae,{label:r("backlog"),testId:"pools-backlog",value:i.backlog}),(0,o.jsx)(ae,{label:r("in flight"),testId:"pools-inflight",value:i.inFlight}),(0,o.jsx)(ae,{label:r("pools"),testId:"pools-count",value:i.pools.length})]}),e[11]=i,e[12]=r,e[13]=v):v=e[13];let b;e[14]!==i?.pools.length||e[15]!==r?(b=i?.pools.length===0&&(0,o.jsx)(z,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,o.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=i?.pools.length,e[15]=r,e[16]=b):b=e[16];let S;e[17]!==i||e[18]!==r?(S=i!==void 0&&i.pools.length>0&&(0,o.jsx)(R,{className:"overflow-hidden py-0",children:(0,o.jsx)(P,{className:"px-0",children:(0,o.jsxs)(G,{"data-testid":"pools-table",children:[(0,o.jsx)(H,{children:(0,o.jsxs)(_,{children:[(0,o.jsx)(C,{children:r("pool")}),(0,o.jsx)(C,{children:r("queued")}),(0,o.jsx)(C,{children:r("in flight")}),(0,o.jsx)(C,{children:r("max concurrency")})]})}),(0,o.jsx)(O,{children:i.pools.map(Je)})]})})}),e[17]=i,e[18]=r,e[19]=S):S=e[19];let m;return e[20]!==N||e[21]!==v||e[22]!==b||e[23]!==S?(m=(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[N,v,b,S]}),e[20]=N,e[21]=v,e[22]=b,e[23]=S,e[24]=m):m=e[24],m},"pe");function je(t,e){return e.queued-t.queued}c(je,"ge");function Je(t){return(0,o.jsxs)(_,{"data-testid":`pools-row-${t.name}`,children:[(0,o.jsx)(j,{className:"font-mono text-xs",children:t.name}),(0,o.jsx)(j,{className:"tabular-nums",children:t.queued}),(0,o.jsxs)(j,{className:"tabular-nums",children:[t.inFlight," / ",t.maxConcurrency]}),(0,o.jsx)(j,{className:"tabular-nums",children:t.maxConcurrency})]},t.name)}c(Je,"xe");var Se=["jobs","dead","pools","cron"],et=c(t=>{let e=(0,Q.c)(41),d;e[0]!==t?(d=t===void 0?{}:t,e[0]=t,e[1]=d):d=e[1];let{loadCronJobs:l,scheduledCancel:g,scheduledLoad:r}=d,n=M(),[a,w]=(0,W.useState)("jobs"),f;e[2]!==n?(f=n("Cron triggers"),e[2]=n,e[3]=f):f=e[3];let i;e[4]!==n?(i=n("Dead letter"),e[4]=n,e[5]=i):i=e[5];let s;e[6]!==n?(s=n("Scheduled jobs"),e[6]=n,e[7]=s):s=e[7];let h;e[8]!==n?(h=n("Pools"),e[8]=n,e[9]=h):h=e[9];let N;e[10]!==f||e[11]!==i||e[12]!==s||e[13]!==h?(N={cron:f,dead:i,jobs:s,pools:h},e[10]=f,e[11]=i,e[12]=s,e[13]=h,e[14]=N):N=e[14];let v=N,b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=c(x=>{w(x.currentTarget.dataset.view)},"f"),e[15]=b):b=e[15];let S=b,m;e[16]!==n?(m=n("Schedule view"),e[16]=n,e[17]=m):m=e[17];let J;e[18]!==a||e[19]!==v?(J=Se.map(x=>(0,o.jsx)(re,{"aria-selected":a===x,"data-testid":`schedule-view-${x}`,"data-view":x,onClick:S,role:"tab",size:"sm",type:"button",variant:a===x?"default":"outline",children:v[x]},x)),e[18]=a,e[19]=v,e[20]=J):J=e[20];let L;e[21]!==m||e[22]!==J?(L=(0,o.jsx)("div",{"aria-label":m,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:J}),e[21]=m,e[22]=J,e[23]=L):L=e[23];let I;e[24]!==g||e[25]!==r||e[26]!==a?(I=a==="jobs"&&(0,o.jsx)(ue,{cancelJob:g,loadJobs:r}),e[24]=g,e[25]=r,e[26]=a,e[27]=I):I=e[27];let q;e[28]!==a?(q=a==="dead"&&(0,o.jsx)(we,{}),e[28]=a,e[29]=q):q=e[29];let $;e[30]!==a?($=a==="pools"&&(0,o.jsx)(Ce,{}),e[30]=a,e[31]=$):$=e[31];let k;e[32]!==l||e[33]!==a?(k=a==="cron"&&(0,o.jsx)(Ne,{loadCronJobs:l}),e[32]=l,e[33]=a,e[34]=k):k=e[34];let T;return e[35]!==L||e[36]!==I||e[37]!==q||e[38]!==$||e[39]!==k?(T=(0,o.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[L,I,q,$,k]}),e[35]=L,e[36]=I,e[37]=q,e[38]=$,e[39]=k,e[40]=T):T=e[40],T},"Re");export{et as SchedulePanel};
|
|
1
|
+
import{a as Y}from"./chunk-EPWCW2DF.js";import{a as ce}from"./chunk-YFTPHGS2.js";import{a as X}from"./chunk-YEVTA35E.js";import{i as de}from"./chunk-IHGRWY3Y.js";import"./chunk-OWRKSQPE.js";import"./chunk-4EPW63HS.js";import{a as re}from"./chunk-V3BE427M.js";import"./chunk-CKEQX655.js";import"./chunk-UD5REVU2.js";import{a as z}from"./chunk-RCXNYW7P.js";import{b as oe}from"./chunk-UQA2AJGI.js";import"./chunk-T3ZCW3RG.js";import{a as G,b as H,c as O,d as _,e as C,f as j}from"./chunk-7QEZ2SFW.js";import"./chunk-2W4UO5BC.js";import{b as V}from"./chunk-4N76XUNG.js";import{a as R,e as P}from"./chunk-OK2QU2EV.js";import{m as K}from"./chunk-SHHGIT7M.js";import"./chunk-ZPQBVYNN.js";import{B as M,j as U,s as F,w as te,x as ie}from"./chunk-GNI37YCV.js";import"./chunk-PDBW6GTJ.js";import{a as ne}from"./chunk-GWNGVKLG.js";import{a as le,b as se}from"./chunk-6G3E4PJ2.js";import{a as c,d as E}from"./chunk-5PEAXTYQ.js";var Q=E(ne(),1),W=E(le(),1);var o=E(se(),1);var me=E(ne(),1),Z=E(le(),1);var p=E(se(),1);var fe=c(t=>Number.isFinite(t)?te(t,"\u2014"):"\u2014","X"),he=c(t=>t.toSorted((e,d)=>e.scheduledFor-d.scheduledFor),"F"),be=c((t,e,d)=>e!==void 0?e:d===void 0?l=>t.cancelScheduledJob(l):void 0,"Y"),ue=c(t=>{let e=(0,me.c)(16),{cancelJob:d,loadJobs:l}=t===void 0?{}:t,g=K(),r=M(),n=l===void 0,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["lunora-scheduled-jobs"],e[0]=a):a=e[0];let w=V(a,async()=>{let u=await(l??(()=>g.listScheduledJobs()))();return he(u)}),[f,i]=(0,Z.useState)(void 0),[s,h]=(0,Z.useState)(void 0),N,v;e[1]!==g||e[2]!==n?(N=c(()=>{if(n)return g.subscribeScheduledJobs(u=>{h(void 0),i(he(u))})},"v"),v=[n,g],e[1]=g,e[2]=n,e[3]=N,e[4]=v):(N=e[3],v=e[4]),(0,Z.useEffect)(N,v);let b;e[5]!==w?(b=c(()=>w.poll(),"y"),e[5]=w,e[6]=b):b=e[6],Y(b,!n);let S=be(g,d,l),m=f??w.data,J=s??w.error,L=c(async u=>{if(S!==void 0){h(void 0);try{await S(u),n||w.refetch()}catch(D){h(U(D))}}},"E"),I="flex flex-col gap-3",q="lunora-scheduled-jobs",$;e[7]!==J?($=J!==null&&(0,p.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:J}),e[7]=J,e[8]=$):$=e[8];let k;e[9]!==m?.length||e[10]!==r?(k=m?.length===0&&(0,p.jsx)(z,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,p.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,p.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,p.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=m?.length,e[10]=r,e[11]=k):k=e[11];let T=m!==void 0&&m.length>0&&(0,p.jsx)(R,{className:"overflow-hidden py-0",children:(0,p.jsx)(P,{className:"px-0",children:(0,p.jsxs)(G,{"data-testid":"sj-table",children:[(0,p.jsx)(H,{children:(0,p.jsxs)(_,{children:[(0,p.jsx)(C,{children:r("function")}),(0,p.jsx)(C,{children:r("scheduled for")}),(0,p.jsx)(C,{children:r("pool")}),(0,p.jsx)(C,{children:r("attempts")}),(0,p.jsx)(C,{children:r("shard")}),(0,p.jsx)(C,{children:r("id")}),S!==void 0&&(0,p.jsx)(C,{"aria-label":r("Actions")})]})}),(0,p.jsx)(O,{children:m.map(u=>(0,p.jsxs)(_,{"data-testid":`sj-row-${u.id}`,children:[(0,p.jsx)(j,{className:"font-mono text-xs",children:u.workflow??u.functionPath}),(0,p.jsx)(j,{className:"text-muted-foreground tabular-nums",children:fe(u.scheduledFor)}),(0,p.jsx)(j,{className:"font-mono text-xs",children:u.pool??""}),(0,p.jsx)(j,{className:"tabular-nums",children:u.attempts??0}),(0,p.jsx)(j,{children:u.shardKey??""}),(0,p.jsx)(j,{className:"font-mono text-xs",children:u.id}),S!==void 0&&(0,p.jsx)(j,{className:"text-right",children:(0,p.jsx)(X,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{F(L(u.id))},"onConfirm"),testId:`sj-cancel-${u.id}`,children:r("Cancel")})})]},u.id))})]})})}),x;return e[12]!==T||e[13]!==$||e[14]!==k?(x=(0,p.jsxs)("div",{className:I,"data-testid":q,children:[$,k,T]}),e[12]=T,e[13]=$,e[14]=k,e[15]=x):x=e[15],x},"he");var ve=c(()=>{let t=(0,Q.c)(50),e=M(),d=ce(""),[l,g]=(0,W.useState)(""),[r,n]=(0,W.useState)(void 0),[a,w]=(0,W.useState)(!1);if(d.unavailable)return null;let f;t[0]!==d?(f=d.pending("cron"),t[0]=d,t[1]=f):f=t[1];let i=f,s;t[2]!==d?(s=d.reason("cron"),t[2]=d,t[3]=s):s=t[3];let h=s,N;t[4]!==l||t[5]!==d?(N=c(()=>{let A=l.trim();A!==""&&F((async()=>{let pe=await d.suggestCron(A);w(!1),n(pe)})())},"v"),t[4]=l,t[5]=d,t[6]=N):N=t[6];let v=N,b;t[7]!==r?(b=c(()=>{let A="navigator"in globalThis?globalThis.navigator.clipboard:void 0;A===void 0||r===void 0||F((async()=>{try{await A.writeText(r),w(!0)}catch{w(!1)}})())},"f"),t[7]=r,t[8]=b):b=t[8];let S=b,m;t[9]!==e?(m=e("Describe a schedule"),t[9]=e,t[10]=m):m=t[10];let J;t[11]===Symbol.for("react.memo_cache_sentinel")?(J=c(A=>{g(A.target.value)},"y"),t[11]=J):J=t[11];let L;t[12]!==v?(L=c(A=>{A.key==="Enter"&&(A.preventDefault(),v())},"N"),t[12]=v,t[13]=L):L=t[13];let I;t[14]!==e?(I=e("Describe a schedule"),t[14]=e,t[15]=I):I=t[15];let q;t[16]!==i||t[17]!==l||t[18]!==m||t[19]!==L||t[20]!==I?(q=(0,o.jsx)(de,{"aria-label":m,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:i,onChange:J,onKeyDown:L,placeholder:I,value:l}),t[16]=i,t[17]=l,t[18]=m,t[19]=L,t[20]=I,t[21]=q):q=t[21];let $=i&&"opacity-60",k;t[22]!==$?(k=ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",$),t[22]=$,t[23]=k):k=t[23];let T;t[24]!==i||t[25]!==l?(T=i||l.trim()==="",t[24]=i,t[25]=l,t[26]=T):T=t[26];let x;t[27]!==i||t[28]!==e?(x=e(i?"Thinking\u2026":"Suggest schedule"),t[27]=i,t[28]=e,t[29]=x):x=t[29];let u;t[30]!==v||t[31]!==k||t[32]!==T||t[33]!==x?(u=(0,o.jsx)("button",{className:k,"data-testid":"cron-assistant-generate",disabled:T,onClick:v,type:"button",children:x}),t[30]=v,t[31]=k,t[32]=T,t[33]=x,t[34]=u):u=t[34];let D;t[35]!==u||t[36]!==q?(D=(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[q,u]}),t[35]=u,t[36]=q,t[37]=D):D=t[37];let y;t[38]!==a||t[39]!==S||t[40]!==r||t[41]!==e?(y=r!==void 0&&(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:r}),(0,o.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:S,type:"button",children:e(a?"Copied":"Copy")}),(0,o.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),t[38]=a,t[39]=S,t[40]=r,t[41]=e,t[42]=y):y=t[42];let B;t[43]!==h||t[44]!==e?(B=h!==void 0&&(0,o.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(h==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),t[43]=h,t[44]=e,t[45]=B):B=t[45];let ee;return t[46]!==D||t[47]!==y||t[48]!==B?(ee=(0,o.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[D,y,B]}),t[46]=D,t[47]=y,t[48]=B,t[49]=ee):ee=t[49],ee},"ie"),xe={kind:"idle"},ge=c((t,e,d)=>d!==void 0?d:e===void 0?l=>t.runCronJob(l):void 0,"ce"),Ne=c(({loadCronJobs:t,runCronJob:e}={})=>{let d=K(),l=M(),[g,r]=(0,W.useState)({}),n=V(["lunora-cron-jobs",t?"custom":"default"],()=>(t??(()=>d.getCronJobs()))()),{data:a,error:w}=n,f=ge(d,t,e),i=c(async s=>{if(f!==void 0){r(h=>({...h,[s]:{kind:"running"}}));try{await f(s),r(h=>({...h,[s]:{kind:"ok"}})),n.refetch()}catch(h){r(N=>({...N,[s]:{kind:"error",message:U(h)}}))}}},"a");return(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,o.jsx)(ve,{}),w!==null&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:w}),a?.length===0&&(0,o.jsx)(z,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,o.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,o.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),a!==void 0&&a.length>0&&(0,o.jsx)(R,{className:"overflow-hidden py-0",children:(0,o.jsx)(P,{className:"px-0",children:(0,o.jsxs)(G,{"data-testid":"cron-table",children:[(0,o.jsx)(H,{children:(0,o.jsxs)(_,{children:[(0,o.jsx)(C,{children:l("name")}),(0,o.jsx)(C,{children:l("schedule")}),(0,o.jsx)(C,{children:l("target")}),(0,o.jsx)(C,{children:l("shard")}),f!==void 0&&(0,o.jsx)(C,{"aria-label":l("Actions")})]})}),(0,o.jsx)(O,{children:a.map(s=>{let h=g[s.name]??xe;return(0,o.jsxs)(_,{"data-testid":`cron-row-${s.name}`,children:[(0,o.jsx)(j,{children:s.name}),(0,o.jsx)(j,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,o.jsx)(j,{children:(0,o.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,o.jsx)(oe,{variant:"outline",children:l("function")}):(0,o.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,o.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,o.jsx)(j,{children:s.shardKey??""}),f!==void 0&&(0,o.jsx)(j,{className:"text-right",children:(0,o.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[h.kind==="ok"&&(0,o.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:l("ran")}),h.kind==="error"&&(0,o.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:h.message}),(0,o.jsx)(X,{confirmLabel:l("Run now?"),disabled:h.kind==="running",onConfirm:c(()=>{F(i(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:h.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"ue"),ye=c(t=>Number.isFinite(t)?te(t,"\u2014"):"\u2014","he"),we=c(t=>{let e=(0,Q.c)(34),d;e[0]!==t?(d=t===void 0?{}:t,e[0]=t,e[1]=d):d=e[1];let{loadJobs:l,removeJob:g,retryJob:r}=d,n=K(),a=M(),w;e[2]===Symbol.for("react.memo_cache_sentinel")?(w=["lunora-dead-jobs"],e[2]=w):w=e[2];let f;e[3]!==n||e[4]!==l?(f=c(async()=>(await(l??(()=>n.listDeadJobs()))()).toSorted(ke),"h"),e[3]=n,e[4]=l,e[5]=f):f=e[5];let i=V(w,f),s=i.data,[h,N]=(0,W.useState)(void 0),v=i.error??h,b=l===void 0,S;e[6]!==n||e[7]!==b||e[8]!==r?(S=r??(b?y=>n.retryDeadJob(y):void 0),e[6]=n,e[7]=b,e[8]=r,e[9]=S):S=e[9];let m=S,J;e[10]!==n||e[11]!==b||e[12]!==g?(J=g??(b?y=>n.removeDeadJob(y):void 0),e[10]=n,e[11]=b,e[12]=g,e[13]=J):J=e[13];let L=J,I;e[14]!==i?(I=c(()=>i.poll(),"k"),e[14]=i,e[15]=I):I=e[15],Y(I,!0);let q;e[16]!==i?(q=c(async y=>{N(void 0);try{await y,i.refetch()}catch(B){N(U(B))}},"C"),e[16]=i,e[17]=q):q=e[17];let $=q,k=m!==void 0||L!==void 0,T;e[18]!==v?(T=v!==void 0&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:v}),e[18]=v,e[19]=T):T=e[19];let x;e[20]!==s?.length||e[21]!==a?(x=s?.length===0&&(0,o.jsx)(z,{description:a("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,o.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:a("No dead-letter jobs.")}),e[20]=s?.length,e[21]=a,e[22]=x):x=e[22];let u;e[23]!==$||e[24]!==k||e[25]!==s||e[26]!==L||e[27]!==m||e[28]!==a?(u=s!==void 0&&s.length>0&&(0,o.jsx)(R,{className:"overflow-hidden py-0",children:(0,o.jsx)(P,{className:"px-0",children:(0,o.jsxs)(G,{"data-testid":"dlq-table",children:[(0,o.jsx)(H,{children:(0,o.jsxs)(_,{children:[(0,o.jsx)(C,{children:a("function")}),(0,o.jsx)(C,{children:a("attempts")}),(0,o.jsx)(C,{children:a("last tried")}),(0,o.jsx)(C,{children:a("pool")}),(0,o.jsx)(C,{children:a("shard")}),(0,o.jsx)(C,{children:a("id")}),k&&(0,o.jsx)(C,{"aria-label":a("Actions")})]})}),(0,o.jsx)(O,{children:s.map(y=>(0,o.jsxs)(_,{"data-testid":`dlq-row-${y.id}`,children:[(0,o.jsx)(j,{className:"font-mono text-xs",children:y.workflow??y.functionPath}),(0,o.jsx)(j,{className:"tabular-nums",children:y.attempts??0}),(0,o.jsx)(j,{className:"text-muted-foreground tabular-nums",children:ye(y.scheduledFor)}),(0,o.jsx)(j,{className:"font-mono text-xs",children:y.pool??""}),(0,o.jsx)(j,{children:y.shardKey??""}),(0,o.jsx)(j,{className:"font-mono text-xs",children:y.id}),k&&(0,o.jsx)(j,{className:"text-right",children:(0,o.jsxs)("div",{className:"flex justify-end gap-1.5",children:[m!==void 0&&(0,o.jsx)(re,{"data-testid":`dlq-retry-${y.id}`,onClick:c(()=>{F($(m(y.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Retry")}),L!==void 0&&(0,o.jsx)(X,{confirmLabel:a("Drop job?"),onConfirm:c(()=>{F($(L(y.id)))},"onConfirm"),testId:`dlq-remove-${y.id}`,children:a("Drop")})]})})]},y.id))})]})})}),e[23]=$,e[24]=k,e[25]=s,e[26]=L,e[27]=m,e[28]=a,e[29]=u):u=e[29];let D;return e[30]!==u||e[31]!==T||e[32]!==x?(D=(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[T,x,u]}),e[30]=u,e[31]=T,e[32]=x,e[33]=D):D=e[33],D},"me");function ke(t,e){return(e.attempts??0)-(t.attempts??0)}c(ke,"fe");var ae=c(t=>{let e=(0,Q.c)(8),{label:d,testId:l,value:g}=t,r;e[0]!==d?(r=(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:d}),e[0]=d,e[1]=r):r=e[1];let n;e[2]!==l||e[3]!==g?(n=(0,o.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":l,children:g}),e[2]=l,e[3]=g,e[4]=n):n=e[4];let a;return e[5]!==r||e[6]!==n?(a=(0,o.jsx)(R,{className:"flex-1 py-0",children:(0,o.jsxs)(P,{className:"flex flex-col gap-1 p-4",children:[r,n]})}),e[5]=r,e[6]=n,e[7]=a):a=e[7],a},"K"),Ce=c(t=>{let e=(0,Q.c)(25),d;e[0]!==t?(d=t===void 0?{}:t,e[0]=t,e[1]=d):d=e[1];let{loadStatus:l}=d,g=K(),r=M(),n=l===void 0,a;e[2]!==n?(a=["lunora-scheduler-status",n],e[2]=n,e[3]=a):a=e[3];let w;e[4]!==g||e[5]!==l?(w=c(async()=>{let J=await(l??(()=>g.schedulerStatus()))();return{...J,pools:J.pools.toSorted(je)}},"w"),e[4]=g,e[5]=l,e[6]=w):w=e[6];let f=V(a,w),{data:i,error:s}=f,h;e[7]!==f?(h=c(()=>f.poll(),"c"),e[7]=f,e[8]=h):h=e[8],Y(h,!0);let N;e[9]!==s?(N=s!==null&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=N):N=e[10];let v;e[11]!==i||e[12]!==r?(v=i!==void 0&&(0,o.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,o.jsx)(ae,{label:r("backlog"),testId:"pools-backlog",value:i.backlog}),(0,o.jsx)(ae,{label:r("in flight"),testId:"pools-inflight",value:i.inFlight}),(0,o.jsx)(ae,{label:r("pools"),testId:"pools-count",value:i.pools.length})]}),e[11]=i,e[12]=r,e[13]=v):v=e[13];let b;e[14]!==i?.pools.length||e[15]!==r?(b=i?.pools.length===0&&(0,o.jsx)(z,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,o.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=i?.pools.length,e[15]=r,e[16]=b):b=e[16];let S;e[17]!==i||e[18]!==r?(S=i!==void 0&&i.pools.length>0&&(0,o.jsx)(R,{className:"overflow-hidden py-0",children:(0,o.jsx)(P,{className:"px-0",children:(0,o.jsxs)(G,{"data-testid":"pools-table",children:[(0,o.jsx)(H,{children:(0,o.jsxs)(_,{children:[(0,o.jsx)(C,{children:r("pool")}),(0,o.jsx)(C,{children:r("queued")}),(0,o.jsx)(C,{children:r("in flight")}),(0,o.jsx)(C,{children:r("max concurrency")})]})}),(0,o.jsx)(O,{children:i.pools.map(Je)})]})})}),e[17]=i,e[18]=r,e[19]=S):S=e[19];let m;return e[20]!==N||e[21]!==v||e[22]!==b||e[23]!==S?(m=(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[N,v,b,S]}),e[20]=N,e[21]=v,e[22]=b,e[23]=S,e[24]=m):m=e[24],m},"pe");function je(t,e){return e.queued-t.queued}c(je,"ge");function Je(t){return(0,o.jsxs)(_,{"data-testid":`pools-row-${t.name}`,children:[(0,o.jsx)(j,{className:"font-mono text-xs",children:t.name}),(0,o.jsx)(j,{className:"tabular-nums",children:t.queued}),(0,o.jsxs)(j,{className:"tabular-nums",children:[t.inFlight," / ",t.maxConcurrency]}),(0,o.jsx)(j,{className:"tabular-nums",children:t.maxConcurrency})]},t.name)}c(Je,"xe");var Se=["jobs","dead","pools","cron"],et=c(t=>{let e=(0,Q.c)(41),d;e[0]!==t?(d=t===void 0?{}:t,e[0]=t,e[1]=d):d=e[1];let{loadCronJobs:l,scheduledCancel:g,scheduledLoad:r}=d,n=M(),[a,w]=(0,W.useState)("jobs"),f;e[2]!==n?(f=n("Cron triggers"),e[2]=n,e[3]=f):f=e[3];let i;e[4]!==n?(i=n("Dead letter"),e[4]=n,e[5]=i):i=e[5];let s;e[6]!==n?(s=n("Scheduled jobs"),e[6]=n,e[7]=s):s=e[7];let h;e[8]!==n?(h=n("Pools"),e[8]=n,e[9]=h):h=e[9];let N;e[10]!==f||e[11]!==i||e[12]!==s||e[13]!==h?(N={cron:f,dead:i,jobs:s,pools:h},e[10]=f,e[11]=i,e[12]=s,e[13]=h,e[14]=N):N=e[14];let v=N,b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=c(x=>{w(x.currentTarget.dataset.view)},"f"),e[15]=b):b=e[15];let S=b,m;e[16]!==n?(m=n("Schedule view"),e[16]=n,e[17]=m):m=e[17];let J;e[18]!==a||e[19]!==v?(J=Se.map(x=>(0,o.jsx)(re,{"aria-selected":a===x,"data-testid":`schedule-view-${x}`,"data-view":x,onClick:S,role:"tab",size:"sm",type:"button",variant:a===x?"default":"outline",children:v[x]},x)),e[18]=a,e[19]=v,e[20]=J):J=e[20];let L;e[21]!==m||e[22]!==J?(L=(0,o.jsx)("div",{"aria-label":m,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:J}),e[21]=m,e[22]=J,e[23]=L):L=e[23];let I;e[24]!==g||e[25]!==r||e[26]!==a?(I=a==="jobs"&&(0,o.jsx)(ue,{cancelJob:g,loadJobs:r}),e[24]=g,e[25]=r,e[26]=a,e[27]=I):I=e[27];let q;e[28]!==a?(q=a==="dead"&&(0,o.jsx)(we,{}),e[28]=a,e[29]=q):q=e[29];let $;e[30]!==a?($=a==="pools"&&(0,o.jsx)(Ce,{}),e[30]=a,e[31]=$):$=e[31];let k;e[32]!==l||e[33]!==a?(k=a==="cron"&&(0,o.jsx)(Ne,{loadCronJobs:l}),e[32]=l,e[33]=a,e[34]=k):k=e[34];let T;return e[35]!==L||e[36]!==I||e[37]!==q||e[38]!==$||e[39]!==k?(T=(0,o.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[L,I,q,$,k]}),e[35]=L,e[36]=I,e[37]=q,e[38]=$,e[39]=k,e[40]=T):T=e[40],T},"Re");export{et as SchedulePanel};
|