bunqueue-dashboard 0.0.43 → 0.0.45
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/README.md +31 -12
- package/dist/.vite/manifest.json +31 -31
- package/dist/assets/{Alerts-C961Al5D.js → Alerts-vzIYtFpW.js} +1 -1
- package/dist/assets/{Benchmark-DQNZV7dM.js → Benchmark-C16tT4pF.js} +1 -1
- package/dist/assets/{CopilotPanel-Dlm8XwBj.js → CopilotPanel-FlAW3RlL.js} +3 -3
- package/dist/assets/{Database-DGM2BIHy.js → Database-DV2pcDLL.js} +1 -1
- package/dist/assets/{Diagnostics-_Sh3UyaT.js → Diagnostics-B6apZrC5.js} +1 -1
- package/dist/assets/{Dlq-mtInIoTh.js → Dlq-MRmkQrNC.js} +1 -1
- package/dist/assets/{DlqControl-Lq9ISb9b.js → DlqControl-DNJPVOTF.js} +1 -1
- package/dist/assets/{DlqPro-0_75vrd1.js → DlqPro-CwtTDwGN.js} +1 -1
- package/dist/assets/{Flows-CE7KzaFN.js → Flows-1dC8F_wx.js} +1 -1
- package/dist/assets/{JobInspector-DyWZk1eW.js → JobInspector-Ct9Ga-UT.js} +1 -1
- package/dist/assets/{Jobs-ELSH1Wbd.js → Jobs-Chqv0RuL.js} +1 -1
- package/dist/assets/{JobsPro-BlWwDeFN.js → JobsPro-CLzOhKAL.js} +1 -1
- package/dist/assets/{Logs-DMukqmHy.js → Logs-C5PNP9Wq.js} +1 -1
- package/dist/assets/{LogsPro-BfYbmZHi.js → LogsPro-B3KwTSsn.js} +1 -1
- package/dist/assets/McpServer-fVy27Mof.js +24 -0
- package/dist/assets/{Metrics-Cm5ZvfTo.js → Metrics-Ba46pdzT.js} +1 -1
- package/dist/assets/{MetricsPro-C9g1sp-u.js → MetricsPro-B9rD_KQc.js} +1 -1
- package/dist/assets/{Overview-CKAA3h9f.js → Overview-DV2qo5v3.js} +1 -1
- package/dist/assets/{QueueControl-Bvm8GUQa.js → QueueControl-DqBvuDnF.js} +1 -1
- package/dist/assets/{QueueDetail-BRDATlp0.js → QueueDetail-COSH9bJl.js} +1 -1
- package/dist/assets/{QueueDetailPro-Dkz4-1wn.js → QueueDetailPro-ClKtyHIf.js} +1 -1
- package/dist/assets/{Queues-BV99vr68.js → Queues-D2-R8nYh.js} +1 -1
- package/dist/assets/{QueuesOverview-CT6JBaim.js → QueuesOverview-tokquA3g.js} +1 -1
- package/dist/assets/{S3BackupPro-CjR0y18n.js → S3BackupPro-CDX5WQUY.js} +1 -1
- package/dist/assets/{ServerControl-BH6Doax0.js → ServerControl-BmccMNW9.js} +1 -1
- package/dist/assets/{Settings-CL7odwoU.js → Settings-UcujwvKv.js} +1 -1
- package/dist/assets/{Usage-BWZkz7Se.js → Usage-1KxG1mJ9.js} +1 -1
- package/dist/assets/{UsagePro-CoBbI-Cl.js → UsagePro-BGLufsE7.js} +1 -1
- package/dist/assets/{Workers-CBEDvXm_.js → Workers-BX1qspaQ.js} +1 -1
- package/dist/assets/{WorkersPro-Dk4NfplT.js → WorkersPro-BsUQVgQZ.js} +1 -1
- package/dist/assets/{index-BFW2_47n.js → index-8Ii-_Rml.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +17 -9
- package/patches/ai@7.0.14.patch +25 -0
- package/scripts/bunVersion.ts +1 -1
- package/scripts/embedded.gen.ts +122 -122
- package/dist/assets/McpServer-DNrOEp9j.js +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CvwrP0tU.js";import{A as r}from"./icons-BVzwsfbG.js";import{t as i}from"./api-BgWE-705.js";import{n as a}from"./usePolledData-0CVelkl2.js";import{i as o,n as s,r as c,t as l}from"./feedback-QDN1AsYt.js";import{t as u}from"./PageHeader-CvIyaFOO.js";import{l as d,s as f}from"./format-Cg7VCIZW.js";import{n as p}from"./index-
|
|
1
|
+
import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CvwrP0tU.js";import{A as r}from"./icons-BVzwsfbG.js";import{t as i}from"./api-BgWE-705.js";import{n as a}from"./usePolledData-0CVelkl2.js";import{i as o,n as s,r as c,t as l}from"./feedback-QDN1AsYt.js";import{t as u}from"./PageHeader-CvIyaFOO.js";import{l as d,s as f}from"./format-Cg7VCIZW.js";import{n as p}from"./index-8Ii-_Rml.js";import{t as m}from"./Pagination-x-Cwgrul.js";var h=e(t(),1),g=n(),_=20,v={workers:{total:0,active:0,list:[],truncated:!1}};function y(){let{data:e,error:t,loading:n,refetch:y}=a(()=>i.overview(),[]),[b,x]=(0,h.useState)(0);if(n&&!e&&!t)return(0,g.jsx)(c,{label:`Loading workers…`});if(t&&!e)return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(u,{title:`Workers`,description:`Worker inventory is unavailable.`}),(0,g.jsx)(s,{error:t,onRetry:y})]});let{workers:S}=e??v,C=Math.max(1,Math.ceil(S.list.length/_)),w=Math.min(b,C-1),T=S.list.slice(w*_,w*_+_);return(0,g.jsxs)(`div`,{children:[t&&(0,g.jsx)(o,{message:`Worker refresh failed — showing the last successful inventory.`,onRetry:y}),(0,g.jsx)(u,{title:`Workers`,description:`Registered workers and their throughput.`,live:!!e&&!t}),(0,g.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,g.jsx)(p,{label:`Total`,value:f(S.total),compact:!0}),(0,g.jsx)(p,{label:`Active`,value:f(S.active),tone:`green`,compact:!0})]}),S.list.length===0?(0,g.jsx)(l,{icon:(0,g.jsx)(r,{}),title:`No workers registered`,hint:`Workers appear here once they connect and register with the server.`}):(0,g.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,g.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Worker`}),(0,g.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queues`}),(0,g.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,g.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Processed`}),(0,g.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`}),(0,g.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Last Seen`})]})}),(0,g.jsx)(`tbody`,{children:T.map(e=>(0,g.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,g.jsxs)(`td`,{className:`px-5 py-3`,children:[(0,g.jsx)(`div`,{className:`font-medium text-fg`,children:e.name||`worker`}),(0,g.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.id})]}),(0,g.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queues.join(`, `)||`—`}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:f(e.activeJobs)}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:f(e.processedJobs)}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:f(e.failedJobs)}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:d(e.lastSeen)})]},e.id))})]})}),S.truncated&&(0,g.jsxs)(`p`,{className:`mt-3 text-xs text-amber-400`,children:[`Showing first `,f(S.list.length),` of `,f(S.total),` `,`workers.`]}),(0,g.jsx)(m,{page:w,pageSize:_,total:S.list.length,onPageChange:x,label:`workers`})]})}export{y as Workers};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,t as r}from"./react-vendor-CvwrP0tU.js";import{t as i}from"./bq-F5BbTG1T.js";import{A as a,O as o}from"./icons-BVzwsfbG.js";import{n as s}from"./usePolledData-0CVelkl2.js";import{n as c}from"./Button-Ch1W94fJ.js";import{i as l,n as u,r as d,t as f}from"./feedback-QDN1AsYt.js";import{t as p}from"./PageHeader-CvIyaFOO.js";import{l as m,s as h}from"./format-Cg7VCIZW.js";import{n as g}from"./index-
|
|
1
|
+
import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,t as r}from"./react-vendor-CvwrP0tU.js";import{t as i}from"./bq-F5BbTG1T.js";import{A as a,O as o}from"./icons-BVzwsfbG.js";import{n as s}from"./usePolledData-0CVelkl2.js";import{n as c}from"./Button-Ch1W94fJ.js";import{i as l,n as u,r as d,t as f}from"./feedback-QDN1AsYt.js";import{t as p}from"./PageHeader-CvIyaFOO.js";import{l as m,s as h}from"./format-Cg7VCIZW.js";import{n as g}from"./index-8Ii-_Rml.js";import{r as _,t as v}from"./useServerActionGuard-uGePilQQ.js";var y=e(n(),1),b=r(),x=100,S=`No heartbeat recently — derived from lastSeen`;function C(){let{data:e,error:n,loading:r,refetch:C}=s(async()=>(await i.workers()).data,[]),[T,E]=(0,y.useState)(new Set),[D,O]=(0,y.useState)(null),[k,A]=(0,y.useState)(null),j=_(`workers-pro`);if((0,y.useEffect)(()=>{E(new Set),O(null)},[j.scopeKey]),r&&!e&&!n)return(0,b.jsx)(d,{label:`Loading workers…`});if(n&&!e)return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(p,{title:`Workers`,description:`Worker inventory is unavailable.`}),(0,b.jsx)(u,{error:n,onRetry:C})]});let M=e?.workers??[],N=e?.quarantinedWorkers??[],P=(k?[...M].sort((e,t)=>{let n=k.key===`failed`?e.failedJobs??0:e.lastSeen??0,r=k.key===`failed`?t.failedJobs??0:t.lastSeen??0;return k.dir===`asc`?n-r:r-n}):M).slice(0,x),F=e=>A(t=>t?.key===e?{key:e,dir:t.dir===`desc`?`asc`:`desc`}:{key:e,dir:`desc`}),I=M.filter(e=>e.status===`active`).length,L=M.length-I,R=M.reduce((e,t)=>e+(t.activeJobs??0),0),z=async e=>{if(!window.confirm(`Remove the stale registry record for worker "${e}"? This does not stop the worker process. Continue only after confirming that process is stopped; Bunqueue v2.9.3 workers do not automatically re-register after their heartbeat record is removed.`))return;let t=j.begin(`worker:${e}`);if(t){E(t=>new Set(t).add(e)),O(null);try{if(v(await i.unregisterWorker(e),`Remove stale worker registry record`),!t.isCurrent())return;O({ok:!0,text:`Removed stale registry record for ${e} ✓`}),C()}catch(e){if(!t.isCurrent())return;O({ok:!1,text:`Removal failed: ${e.message}`})}finally{t.finish()&&E(t=>{let n=new Set(t);return n.delete(e),n})}}};return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(p,{title:`Workers`,description:`Registered workers and their throughput.`,live:!!e&&!n}),n&&(0,b.jsx)(l,{message:`Worker refresh failed — showing the last successful inventory.`,onRetry:C}),(0,b.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-5`,children:[(0,b.jsx)(g,{label:`Total`,value:h(M.length+N.length),compact:!0}),(0,b.jsx)(g,{label:`Active`,value:h(I),tone:`green`,compact:!0}),(0,b.jsx)(`div`,{title:S,children:(0,b.jsx)(g,{label:`Stale`,value:h(L),tone:L?`amber`:`default`,compact:!0})}),(0,b.jsx)(g,{label:`Active Jobs`,value:h(R),tone:`blue`,compact:!0}),(0,b.jsx)(g,{label:`Quarantined`,value:h(N.length),tone:N.length?`red`:`default`,compact:!0})]}),N.length>0&&(0,b.jsxs)(`div`,{role:`alert`,className:`mb-4 rounded-lg border border-danger/30 bg-danger/5 p-4`,children:[(0,b.jsxs)(`p`,{className:`text-sm font-medium text-danger`,children:[N.length,` worker registration(s) contain values accepted by Bunqueue 2.9.3 but unsafe to render. Healthy workers remain available below.`]}),(0,b.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:`Their status and active-job count are unknown, so this dashboard will not offer the registry-only removal action for them.`}),(0,b.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-muted`,children:N.slice(0,20).map(e=>(0,b.jsxs)(`li`,{className:`truncate font-mono`,children:[`#`,e.index+1,` `,e.id??`(unaddressable id)`,` — `,e.reason]},`${e.index}:${e.id??`unknown`}`))})]}),D&&(0,b.jsx)(`div`,{className:t(`mb-3 text-sm`,D.ok?`text-success`:`text-danger`),children:D.text}),M.length===0?(0,b.jsx)(f,{icon:(0,b.jsx)(a,{}),title:N.length?`No renderable workers`:`No workers registered`,hint:N.length?`Malformed registrations are isolated above instead of taking down the inventory.`:`Workers appear here once they connect and register with the server.`}):(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Worker`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queues`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Processed`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:(0,b.jsx)(w,{label:`Failed`,active:k?.key===`failed`?k.dir:null,onClick:()=>F(`failed`)})}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:(0,b.jsx)(w,{label:`Last Seen`,active:k?.key===`lastSeen`?k.dir:null,onClick:()=>F(`lastSeen`)})}),(0,b.jsx)(`th`,{className:`w-16 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,b.jsx)(`tbody`,{children:P.map(e=>(0,b.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,b.jsxs)(`td`,{className:`px-5 py-3`,children:[(0,b.jsx)(`div`,{className:`font-medium text-fg`,children:e.name||`worker`}),(0,b.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.id})]}),(0,b.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queues.join(`, `)||`—`}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(`span`,{title:e.status===`active`?void 0:S,className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.status===`active`?`bg-emerald-500/10 text-success`:`bg-amber-500/10 text-warning`),children:e.status})}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:h(e.activeJobs)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:h(e.processedJobs)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:h(e.failedJobs)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:m(e.lastSeen)}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(`div`,{className:`flex justify-end`,children:e.status===`stale`&&e.activeJobs===0?(0,b.jsx)(c,{"aria-label":`Remove stale registry record for worker ${e.id}`,title:`Registry cleanup only — does not stop the worker process`,disabled:T.has(e.id),onClick:()=>z(e.id),children:(0,b.jsx)(o,{className:`size-3.5`})}):(0,b.jsx)(`span`,{className:`text-xs text-faint`,title:e.status===`stale`?`Registry cleanup is blocked while active jobs are reported`:`Only stale, idle registry records can be removed`,children:`—`})})})]},e.id))})]})}),M.length>x&&(0,b.jsxs)(`p`,{className:`mt-3 text-xs text-warning`,children:[`Showing first `,h(x),` of `,h(M.length),` workers.`]})]})}function w({label:e,active:n,onClick:r}){return(0,b.jsxs)(`button`,{type:`button`,onClick:r,title:`Sort by ${e}`,className:t(`inline-flex items-center gap-1 uppercase tracking-wider transition-colors hover:text-fg`,n?`text-fg`:`text-faint`),children:[e,(0,b.jsx)(`span`,{"aria-hidden":`true`,children:n===`desc`?`↓`:n===`asc`?`↑`:``})]})}export{C as WorkersPro};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CopilotPanel-
|
|
2
|
-
import{i as e,t}from"./cn-zFEt5SO8.js";import{a as n,c as r,g as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./react-vendor-CvwrP0tU.js";import{a as h,c as g,d as _,f as v,i as y,l as b,m as x,n as ee,o as S,p as C,u as te}from"./connectionStore-BJLihGaC.js";import{t as w}from"./bq-F5BbTG1T.js";import{n as ne,t as re}from"./toastStore-IZn6OPLZ.js";import{A as T,D as ie,E as ae,S as oe,T as se,_ as ce,c as le,f as ue,g as de,h as fe,k as pe,l as me,m as he,n as ge,o as _e,p as E,r as ve,s as ye,t as be,u as D,v as xe,w as Se,y as Ce}from"./icons-BVzwsfbG.js";import{t as we}from"./api-BgWE-705.js";import{n as Te}from"./usePolledData-0CVelkl2.js";import{t as Ee}from"./Button-Ch1W94fJ.js";import{t as O}from"./Card-CWxrC8OY.js";import{i as De,n as Oe,r as ke}from"./feedback-QDN1AsYt.js";import{t as Ae}from"./PageHeader-CvIyaFOO.js";import{c as je,l as Me,n as Ne,r as Pe,s as k,t as Fe,u as Ie}from"./format-Cg7VCIZW.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var A=e(i(),1),Le=s(),Re=`bq-dash-alerts`,ze=1,Be=[`email`,`webhook`,`slack`],Ve=[`error_rate`,`p99_latency`,`waiting`,`failed`,`dlq`],He=[`>=`,`>`,`<=`,`<`],Ue=128,We=200,Ge=2048,Ke=256,qe=/^[^\s@]+@[^\s@]+\.[^\s@]+$/u,Je=()=>`${Date.now().toString(36)}${Math.floor(Math.random()*1e6).toString(36)}`;function Ye(e){let t=new Set(e.map(e=>e.id)),n=Je();if(!t.has(n))return n;let r=1;for(;t.has(`${n}-${r}`);)r+=1;return`${n}-${r}`}function Xe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ze(e){return Be.includes(e)}function Qe(e){return Ve.includes(e)}function $e(e){return He.includes(e)}function et(e,t){let n=t.trim();if(!n||n.length>Ge)return!1;if(e===`email`)return n.length<=320&&qe.test(n);try{let e=new URL(n);return[`http:`,`https:`].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}}function tt(e){if(!Xe(e)||typeof e.id!=`string`||!Ze(e.type)||typeof e.target!=`string`)return null;let t=e.id.trim(),n=e.target.trim();return!t||t.length>Ue||n.length>Ge||e.type===`email`&&!et(e.type,n)?null:{id:t,type:e.type,target:e.type===`email`?n:``}}function nt(e){if(!Xe(e)||typeof e.id!=`string`||typeof e.name!=`string`||!Qe(e.metric)||!$e(e.operator)||typeof e.threshold!=`number`||!Number.isFinite(e.threshold)||typeof e.queue!=`string`||!Ze(e.channel)||typeof e.enabled!=`boolean`)return null;let t=e.id.trim(),n=e.name.trim(),r=e.queue.trim();return!t||t.length>Ue||!n||n.length>We||r.length>Ke||e.threshold<0||e.metric===`error_rate`&&e.threshold>100?null:{id:t,name:n,metric:e.metric,operator:e.operator,threshold:e.threshold,queue:r,channel:e.channel,enabled:e.enabled}}function j(e){let t=Xe(e)?e:{},n=[],r=new Set;if(Array.isArray(t.channels))for(let e of t.channels){if(n.length>=100)break;let t=tt(e);!t||r.has(t.id)||(r.add(t.id),n.push(t))}let i=[],a=new Set;if(Array.isArray(t.rules))for(let e of t.rules){if(i.length>=500)break;let t=nt(e);!t||a.has(t.id)||(a.add(t.id),i.push(t))}return{channels:n,rules:i}}function rt(e){return j({channels:e.channels,rules:e.rules})}var it=_({key:Re,version:ze,sanitizeState:j}),M=x()(C(e=>({channels:[],rules:[],addChannel:(t,n)=>{let r={ok:!1,error:`Alert destination was rejected.`};return e(e=>{let i=n.trim();return!Ze(t)||!et(t,i)?(r={ok:!1,error:`Alert destination is invalid.`},e):e.channels.length>=100?(r={ok:!1,error:`A maximum of 100 alert destinations can be stored in this browser.`},e):(r={ok:!0},{channels:[...e.channels,{id:Ye(e.channels),type:t,target:i}]})}),r},removeChannel:t=>e(e=>({channels:e.channels.filter(e=>e.id!==t)})),addRule:t=>{let n={ok:!1,error:`Alert rule was rejected.`};return e(e=>{if(e.rules.length>=500)return n={ok:!1,error:`A maximum of 500 alert rules can be stored in this browser.`},e;let r=nt({...t,id:Ye(e.rules)});return r?(n={ok:!0},{rules:[...e.rules,r]}):(n={ok:!1,error:`Alert rule contains invalid fields.`},e)}),n},removeRule:t=>e(e=>({rules:e.rules.filter(e=>e.id!==t)})),toggleRule:t=>e(e=>({rules:e.rules.map(e=>e.id===t?{...e,enabled:!e.enabled}:e)}))}),{name:Re,version:ze,storage:v(()=>it),partialize:rt,migrate:j,merge:(e,t)=>({...t,...j(e)})})),at={error_rate:`error rate`,p99_latency:`p99 latency`,waiting:`waiting jobs`,failed:`failed jobs`,dlq:`DLQ size`},ot=10500,st=500,ct=21,lt=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0;function ut(e,t,n){return t===`>=`?e>=n:t===`>`?e>n:t===`<=`?e<=n:t===`<`&&e<n}function dt(e){if(!Array.isArray(e)||e.length>ot)return null;let t=new Set,n=[];for(let r of e){if(!r||typeof r!=`object`||Array.isArray(r))return null;let e=r,i=e.counts;if(typeof e.name!=`string`||!e.name||e.name.length>256||!/^[a-zA-Z0-9_\-.:]+$/.test(e.name)||t.has(e.name)||typeof e.paused!=`boolean`||!i||typeof i!=`object`||Array.isArray(i))return null;let a=i;if(![`waiting`,`active`,`completed`,`failed`,`delayed`].every(e=>lt(a[e])))return null;t.add(e.name),n.push(r)}return n}function ft(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;if(t.ok!==!0||!t.latency||typeof t.latency!=`object`||Array.isArray(t.latency))return null;let n=t.latency.percentiles;if(!n||typeof n!=`object`||Array.isArray(n))return null;for(let e of Object.values(n)){let t=e?.p99;if(!e||typeof e!=`object`||Array.isArray(e)||typeof t!=`number`||!Number.isFinite(t)||t<0)return null}return e}var pt=(e,t)=>{let n=e+t;return n>0?t/n*100:null};function mt(e,t){let n=e.queue.trim();if(e.metric===`waiting`||e.metric===`failed`){if(!t.summary)return null;let r=e.metric;return n?t.summary.find(e=>e.name===n)?.counts[r]??null:t.summary.reduce((e,t)=>e+t.counts[r],0)}if(e.metric===`dlq`)return t.queues?n?t.queues.find(e=>e.name===n)?.dlq??null:t.queues.reduce((e,t)=>e+(t.dlq??0),0):null;if(e.metric===`error_rate`){if(!t.summary)return null;if(n){let e=t.summary.find(e=>e.name===n);return e?pt(e.counts.completed,e.counts.failed):null}return pt(t.summary.reduce((e,t)=>e+t.counts.completed,0),t.summary.reduce((e,t)=>e+t.counts.failed,0))}let r=t.overview?.latency?.percentiles;if(!r)return null;let i=Object.values(r).map(e=>e.p99).filter(Number.isFinite);return i.length?Math.max(...i):null}function ht(e,t,n){if(typeof e!=`object`||!e||Array.isArray(e))return null;let r=e;if(r.ok!==!0||!Array.isArray(r.queues)||!Number.isSafeInteger(r.total)||r.total<0||r.total>ot||n!==null&&r.total!==n||r.offset!==t||r.limit!==st)return null;let i=r.total;if(r.queues.length!==Math.min(st,i-t))return null;let a=[];for(let e of r.queues){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;if(typeof t.name!=`string`||!t.name||t.name.length>256||!/^[a-zA-Z0-9_\-.:]+$/.test(t.name)||!lt(t.dlq))return null;a.push(e)}return{queues:a,total:i}}async function gt(e=w){try{let t=[],n=new Set,r=null;for(let i=0;i<ct;i++){let i=ht(await e.queues(st,t.length),t.length,r);if(!i)return null;r??=i.total;for(let e of i.queues){if(n.has(e.name))return null;n.add(e.name),t.push(e)}if(t.length===r)return t}return null}catch{return null}}var _t=3,vt=e=>`${e.queue||`All queues`}: ${e.metricLabel} ${e.operator} ${e.threshold} (now ${Math.round(e.value)})`;function yt(e){if(globalThis.Notification?.permission===`granted`)try{new Notification(`bunqueue alert: ${e.ruleName}`,{body:vt(e),tag:e.ruleId})}catch{}}function bt(e){if(e.length<=_t){for(let t of e)re.error(`Alert: ${t.ruleName}`,vt(t)),yt(t);return}re.error(`${e.length} alert rules breaching`,e.map(e=>e.ruleName).join(`, `));for(let t of e)yt(t)}var xt=3e4,St=(e,t)=>JSON.stringify([e,t]);function Ct(e){let t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2)throw TypeError(`Invalid alert connection identity.`);let[n,r]=t,i=g(n);if(!i||typeof r!=`string`)throw TypeError(`Invalid alert server target.`);let a=r.trim();return Object.freeze({baseUrl:i,...a?{authorization:`Bearer ${a}`}:{}})}function wt(e,t){let n=new Headers({Accept:`application/json`});e.authorization&&n.set(`Authorization`,e.authorization);let r=async r=>{t.throwIfAborted();let i=AbortSignal.any([t,AbortSignal.timeout(xt)]),a=await fetch(e.baseUrl+r,{headers:n,signal:i});if(t.throwIfAborted(),!a.ok)throw await a.body?.cancel().catch(()=>{}),a.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:`server`,auth:e.authorization,target:e.baseUrl}})),Error(`Alert metrics request failed: HTTP ${a.status}`);let o=await a.text();if(t.throwIfAborted(),!o)throw Error(`Alert metrics request returned an empty response.`);try{return JSON.parse(o)}catch{throw Error(`Alert metrics request returned invalid JSON (HTTP ${a.status}).`)}};return Object.freeze({queuesSummary:()=>r(`/queues/summary`),queues:(e=500,t=0)=>r(`/dashboard/queues?limit=${e}&offset=${t}`),overview:()=>r(`/dashboard`)})}var Tt=15e3,Et=6e4,N=x(e=>({breaching:[],status:`idle`,error:null,connectionIdentity:null,setBreaching:t=>e({breaching:t})}));async function Dt(){if(typeof Notification>`u`)return`denied`;if(Notification.permission===`granted`)return`granted`;try{return await Notification.requestPermission()}catch{return`denied`}}function Ot(){let e=M(e=>e.rules),t=S(e=>St(e.baseUrl,e.token)),n=(0,A.useRef)(new Map),r=(0,A.useRef)(new Map),i=(0,A.useRef)(new Map),a=(0,A.useRef)(new Map),o=(0,A.useRef)(t),s=(0,A.useRef)(0),c=JSON.stringify(e.filter(e=>e.enabled).map(e=>[e.id,e.metric,e.operator,e.threshold,e.queue]));(0,A.useEffect)(()=>{let e=()=>{n.current.clear(),r.current.clear(),i.current.clear(),a.current.clear()},l=o.current!==t;if(l&&(o.current=t,e()),c===`[]`){e(),N.setState({breaching:[],status:`idle`,error:null,connectionIdentity:t});return}let u=new Set(M.getState().rules.filter(e=>e.enabled).map(e=>e.id)),d=l?[]:N.getState().breaching.filter(e=>u.has(e.ruleId));N.setState({breaching:d,status:`checking`,error:null,connectionIdentity:t});let f;try{f=Ct(t)}catch(e){N.setState({breaching:[],status:`degraded`,error:`Alert evaluation failed: ${e.message}`,connectionIdentity:t});return}let p=new AbortController,m=++s.current,h=!1,g=!1,_=()=>{if(h||s.current!==m)return!1;let e=S.getState();return St(e.baseUrl,e.token)===t},v=e=>{for(let t of[...n.current.keys()])e.has(t)||(n.current.delete(t),r.current.delete(t),i.current.delete(t),a.current.delete(t))},y=async()=>{if(!g){g=!0;try{let e=wt(f,p.signal),[o,s,c]=await Promise.all([e.queuesSummary().then(dt).catch(()=>null),gt(e),e.overview().then(ft).catch(()=>null)]);if(!_())return;let l=M.getState().rules.filter(e=>e.enabled),u=new Set(l.map(e=>e.id));if(v(u),!c){let e=N.getState().breaching.filter(e=>u.has(e.ruleId));if(!_())return;N.setState({breaching:e,status:`degraded`,error:`The bunqueue overview endpoint is unavailable; alert results may be stale.`,connectionIdentity:t});return}let d=Date.now(),m=[],h=[],g=!1;for(let e of l){let t=mt(e,{summary:o,queues:s,overview:c});if(t==null){g=!0;let t=n.current.get(e.id)?a.current.get(e.id):void 0;t&&m.push(t);continue}let l=ut(t,e.operator,e.threshold),u=n.current.get(e.id)??!1;if(l){let n=u?i.current.get(e.id)??d:d;i.current.set(e.id,n);let o={ruleId:e.id,ruleName:e.name,metricLabel:at[e.metric],operator:e.operator,threshold:e.threshold,value:t,queue:e.queue,at:n};m.push(o),a.current.set(e.id,o);let s=r.current.get(e.id)??0;d-s>Et&&s<n&&(h.push(o),r.current.set(e.id,d))}else i.current.delete(e.id),a.current.delete(e.id);n.current.set(e.id,l)}if(!_())return;bt(h);let y=!o||!s||g;N.setState({breaching:m,status:y?`degraded`:`live`,error:y?`Some alert rules could not be evaluated; affected results remain unknown.`:null,connectionIdentity:t})}catch(e){if(!_())return;N.setState({status:`degraded`,error:`Alert evaluation failed: ${e.message}`,connectionIdentity:t})}finally{g=!1}}};y();let b=setInterval(y,Tt);return()=>{h=!0,s.current===m&&(s.current+=1),p.abort(),clearInterval(b)}},[c,t])}function kt(){return Ot(),null}var At={authentication:100,"command-palette":80,copilot:60,"database-row":40,"mobile-navigation":20},P=x((e,t)=>({active:null,request(n){let r=t().active;return r===n?!0:r&&At[r]>At[n]?!1:(e({active:n}),!0)},release(n){t().active===n&&e({active:null})},reset(){e({active:null})}}));function F(e){let t=P.getState().active;return t===null||t===e}var I=p();function jt(e){return{scope:e,auth:e===`agent`?ee().Authorization:y().Authorization,target:e===`agent`?w.agentBase:h()}}function L(e,t){return e?.scope===t.scope&&e.auth===t.auth&&e.target===t.target}function Mt(){let[e,t]=(0,A.useState)(!1),[n,r]=(0,A.useState)(`server`),[i,a]=(0,A.useState)(``),o=S(e=>e.baseUrl),s=S(e=>e.setToken),c=S(e=>e.setAgentToken),l=(0,A.useRef)(null),u=(0,A.useRef)(null),f=(0,A.useRef)(null),p=(0,A.useRef)(null),m=P(e=>e.active),h=e&&m===`authentication`;(0,A.useEffect)(()=>{let e=e=>{let n=e.detail;if(n?.scope!==`server`&&n?.scope!==`agent`)return;let i=jt(n.scope);n.auth!==i.auth||n.target!==i.target||(L(f.current,i)||(p.current=null,a(``)),f.current=i,P.getState().request(`authentication`),r(i.scope),t(!0),window.dispatchEvent(new window.Event(`auth:gate-opened`)))};return window.addEventListener(`auth:required`,e),()=>window.removeEventListener(`auth:required`,e)},[]),(0,A.useEffect)(()=>()=>{P.getState().release(`authentication`)},[]),(0,A.useEffect)(()=>{if(!h)return;let e=document.activeElement,t=document.getElementById(`app-shell`)?[]:[`app-nav`,`app-content`].map(e=>document.getElementById(e)).filter(e=>e!==null),n=t.map(e=>({element:e,inert:e.inert,ariaHidden:e.getAttribute(`aria-hidden`)}));for(let e of t)e.inert=!0,e.setAttribute(`aria-hidden`,`true`);let r=window.requestAnimationFrame(()=>l.current?.focus()),i=()=>u.current?Array.from(u.current.querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`)):[],a=e=>{if(e.key!==`Tab`)return;let t=i();if(!t.length){e.preventDefault();return}let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return window.addEventListener(`keydown`,a),()=>{window.cancelAnimationFrame(r),window.removeEventListener(`keydown`,a);for(let e of n)e.element.inert=e.inert,e.ariaHidden===null?e.element.removeAttribute(`aria-hidden`):e.element.setAttribute(`aria-hidden`,e.ariaHidden);F(`authentication`)&&e?.isConnected&&e.focus()}},[h]);let g=()=>{f.current=null,p.current=null,a(``),t(!1),P.getState().release(`authentication`)};return h?(0,I.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,children:(0,I.jsxs)(`form`,{ref:u,onSubmit:e=>{e.preventDefault();let t=f.current,n=p.current;if(!t||!n||!L(n.identity,t)||!L(t,jt(t.scope))){g();return}let r=n.value.trim();r&&(t.scope===`agent`?c(r):s(r),g())},role:`dialog`,"aria-modal":`true`,"aria-label":`Authentication required`,className:`w-full max-w-sm rounded-xl border border-line-strong bg-surface p-6 shadow-2xl`,children:[(0,I.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:`Authentication required`}),n===`agent`?(0,I.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[`The control agent at `,(0,I.jsx)(`span`,{className:`break-all font-mono text-fg`,children:w.agentBase}),` `,`rejected the request (401). Enter its`,` `,(0,I.jsx)(`span`,{className:`font-mono text-fg`,children:`AGENT_TOKEN`}),` to continue.`]}):(0,I.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[`The server at `,(0,I.jsx)(`span`,{className:`break-all font-mono text-fg`,children:o}),` rejected the request (401). Enter its bearer token to continue.`]}),(0,I.jsx)(`input`,{ref:l,type:`password`,value:i,onInput:e=>{let t=e.currentTarget.value;a(t);let n=f.current;p.current=n?{identity:n,value:t}:null},placeholder:n===`agent`?`AGENT_TOKEN`:`Bearer token`,"aria-label":n===`agent`?`Agent token`:`Bearer token`,name:n===`agent`?`agent-token`:`server-token`,autoComplete:`current-password`,className:`mt-4 w-full rounded-lg border border-line bg-surface-2 px-3 py-2 text-sm text-fg outline-none placeholder:text-faint focus-visible:ring-2 focus-visible:ring-accent/50`}),(0,I.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-3`,children:[(0,I.jsx)(d,{to:`/settings`,onClick:g,className:`text-xs text-muted underline-offset-2 hover:text-fg hover:underline`,children:`Open Settings instead`}),(0,I.jsx)(`button`,{type:`submit`,disabled:!i.trim(),className:`rounded-lg bg-accent px-4 py-2 text-sm font-medium text-accent-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-50`,children:`Unlock`})]})]})}):null}var Nt=`bq-dash-theme`,Pt=1;function R(e){return e===`light`?`light`:`dark`}function z(){try{return globalThis.localStorage??null}catch{return null}}var Ft={getItem(e){let t=z();if(!t)return null;try{let n=t.getItem(e);if(n===null||e!==Nt)return n;let r=JSON.parse(n),i=r&&typeof r==`object`&&!Array.isArray(r)?r:{},a=i.state&&typeof i.state==`object`&&!Array.isArray(i.state)?i.state:{},o=JSON.stringify({state:{theme:R(a.theme)},version:Pt});if(n!==o)try{t.setItem(e,o)}catch{}return o}catch{try{t.removeItem(e)}catch{}return null}},setItem(e,t){try{z()?.setItem(e,t)}catch{}},removeItem(e){try{z()?.removeItem(e)}catch{}}};function B(e){typeof document<`u`&&(document.documentElement.dataset.theme=e,document.documentElement.style.colorScheme=e)}var V=x()(C((e,t)=>({theme:`dark`,toggle:()=>{let n=t().theme===`dark`?`light`:`dark`;B(n),e({theme:n})},setTheme:t=>{let n=R(t);B(n),e({theme:n})}}),{name:Nt,version:Pt,storage:v(()=>Ft),partialize:e=>({theme:R(e.theme)}),merge:(e,t)=>{let n=e&&typeof e==`object`&&!Array.isArray(e)?e:{};return{...t,theme:R(n.theme)}},onRehydrateStorage:()=>e=>{e&&B(R(e.theme))}}));function It(){B(R(V.getState().theme))}var Lt={connecting:{dot:`bg-zinc-500`,label:`connecting`},connected:{dot:`bg-emerald-400`,label:`connected`},degraded:{dot:`bg-amber-400`,label:`reachable, degraded`},offline:{dot:`bg-red-400`,label:`offline`}};function Rt(){let e=S(e=>e.baseUrl),n=S(e=>e.profiles),r=S(e=>e.activeProfileId),i=S(e=>e.activateProfile),{data:a,error:o,loading:s}=Te(async()=>{let e=await we.health();if(typeof e.ok!=`boolean`)throw Error(`Malformed health response`);return{healthy:e.ok}},[],{intervalMs:15e3}),c=Lt[s?`connecting`:o||!a?`offline`:a.healthy?`connected`:`degraded`],l=e.replace(/^https?:\/\//,``)||`local`;return(0,I.jsxs)(`div`,{className:`mx-3 mb-4 flex items-center gap-2 rounded-lg border border-line bg-surface px-3 py-1.5`,children:[(0,I.jsx)(`span`,{className:t(`size-1.5 rounded-full`,c.dot),title:c.label}),(0,I.jsx)(`label`,{className:`sr-only`,htmlFor:`active-bunqueue-node`,children:`Active Bunqueue node`}),(0,I.jsx)(`select`,{id:`active-bunqueue-node`,"aria-label":`Active Bunqueue node`,value:r,onChange:e=>i(e.target.value),title:`${n.length} configured node${n.length===1?``:`s`} · ${e}`,className:`min-w-0 flex-1 truncate bg-transparent text-[11px] font-medium text-muted outline-none`,children:n.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,I.jsx)(`span`,{className:`sr-only`,title:e,children:l}),(0,I.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-faint`,"aria-label":`${n.length} nodes`,children:[n.length,`×`]}),(0,I.jsx)(`span`,{className:`sr-only`,children:c.label})]})}function zt(e){let t=null;try{return t=document.createElement(`textarea`),t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`)}catch{return!1}finally{t?.remove()}}function Bt({value:e,className:n}){let[r,i]=(0,A.useState)(`idle`),a=(0,A.useRef)(null);(0,A.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]);let o=async()=>{let t=!1;if(navigator.clipboard)try{await navigator.clipboard.writeText(e),t=!0}catch{}t||=zt(e),i(t?`copied`:`failed`),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(`idle`),1500)},s=r===`copied`?`Copied to clipboard`:r===`failed`?`Copy failed`:`Copy to clipboard`;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,onClick:o,"aria-label":s,title:s,className:t(`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-faint transition-colors hover:bg-surface-2 hover:text-fg`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,n),children:r===`copied`?(0,I.jsx)(ve,{className:`size-3.5 text-success`}):r===`failed`?(0,I.jsx)(_e,{className:`size-3.5 text-danger`}):(0,I.jsx)(ye,{className:`size-3.5`})}),(0,I.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:r===`idle`?``:s})]})}var Vt;function H(){return Vt===void 0&&(Vt=Ht()),Vt}function Ht(){if(typeof window>`u`)return!1;let{search:e,hash:t}=window.location;return new URLSearchParams(e).has(`demo`)||t.replace(/^#/,``)===`demo`}var Ut=`https://github.com/egeominotti/bunqueue-dashboard`,Wt=`https://egeominotti.github.io/bunqueue-dashboard/docs/`,Gt=`bunx bunqueue-dashboard`;function Kt(){return(0,I.jsxs)(`div`,{className:`mx-3 mb-2 rounded-lg border border-accent/30 bg-accent/5 p-3`,children:[(0,I.jsx)(`p`,{className:`mb-2 text-[11px] font-medium leading-snug text-fg`,children:`Like it? Run it on your own bunqueue server.`}),(0,I.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 rounded-md border border-line bg-surface-2 px-2 py-1`,children:[(0,I.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-fg`,children:Gt}),(0,I.jsx)(Bt,{value:Gt})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(`a`,{href:Ut,target:`_blank`,rel:`noreferrer`,className:`flex flex-1 items-center justify-center gap-1 rounded-md bg-accent px-2 py-1.5 text-[11px] font-semibold text-accent-fg transition-opacity hover:opacity-90`,children:[(0,I.jsx)(`span`,{"aria-hidden":!0,children:`★`}),` Star`]}),(0,I.jsx)(`a`,{href:Wt,target:`_blank`,rel:`noreferrer`,className:`flex flex-1 items-center justify-center rounded-md border border-line px-2 py-1.5 text-[11px] font-medium text-muted transition-colors hover:bg-surface-2 hover:text-fg`,children:`Docs`})]})]})}function qt(){let e=S(e=>e.baseUrl),t=S(e=>e.profiles),n=S(e=>e.activeProfileId),r=t.find(e=>e.id===n),i=e===`/api`?`localhost:6790`:e.replace(/^https?:\/\//,``);return(0,I.jsxs)(I.Fragment,{children:[H()&&(0,I.jsx)(Kt,{}),(0,I.jsxs)(`div`,{className:`mx-3 mb-3 flex items-center gap-2.5 rounded-lg border border-line bg-surface px-3 py-2`,children:[(0,I.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-accent to-fuchsia-600 text-[11px] font-bold text-white`,children:`bq`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`truncate text-xs font-medium text-fg`,children:r?.name??`bunqueue`}),(0,I.jsx)(`div`,{className:`truncate font-mono text-[10px] text-faint`,title:e,children:i}),(0,I.jsxs)(`div`,{className:`text-[9px] text-faint`,children:[t.length,` configured node`,t.length===1?``:`s`]})]}),(0,I.jsx)(d,{to:`/settings`,"aria-label":`Settings`,className:`text-faint transition-colors hover:text-fg`,children:(0,I.jsx)(ae,{className:`size-4`})})]})]})}var Jt=[{section:null,items:[{to:`/`,label:`Overview`,icon:Ce,end:!0},{to:`/fleet`,label:`Fleet`,icon:T,end:!0}]},{section:`Queues`,items:[{to:`/queues`,label:`Queues`,icon:oe,end:!0},{to:`/jobs`,label:`Jobs`,icon:E,end:!0},{to:`/dlq`,label:`Dead Letter Queue`,icon:D},{to:`/cron`,label:`Cron Jobs`,icon:le}]},{section:`Workflow`,items:[{to:`/workflows`,label:`Overview`,icon:Ce,end:!0},{to:`/flows`,label:`Job Flows`,icon:ge,end:!0},{to:`/workflows/executions`,label:`Executions`,icon:E,end:!0},{to:`/workflows/waiting`,label:`Waiting & Signals`,icon:le,end:!0},{to:`/workflows/compensation`,label:`Compensation`,icon:D,end:!0},{to:`/workflows/archive`,label:`Archive`,icon:me,end:!0}]},{section:`Monitoring`,items:[{to:`/metrics`,label:`Metrics`,icon:ce},{to:`/workers`,label:`Workers`,icon:T},{to:`/logs`,label:`Logs`,icon:fe},{to:`/alerts`,label:`Alerts`,icon:be}]},{section:`Control`,items:[{to:`/server`,label:`Server`,icon:T},{to:`/add-job`,label:`Add Job`,icon:E},{to:`/jobs/bulk-add`,label:`Bulk Add`,icon:E},{to:`/job`,label:`Job Inspector`,icon:ue},{to:`/queue-control`,label:`Queue Control`,icon:oe},{to:`/dlq-control`,label:`DLQ Control`,icon:D},{to:`/webhooks`,label:`Webhooks`,icon:he},{to:`/diagnostics`,label:`Diagnostics`,icon:ce},{to:`/benchmark`,label:`Benchmark`,icon:he}]},{section:`Management`,items:[{to:`/database`,label:`Database`,icon:me},{to:`/mcp`,label:`MCP`,icon:he},{to:`/usage`,label:`Usage`,icon:pe},{to:`/s3`,label:`S3 Backup`,icon:Se},{to:`/settings`,label:`Settings`,icon:ae}]}];function Yt(){let e=V(e=>e.theme),t=V(e=>e.toggle),n=e===`dark`;return(0,I.jsxs)(`button`,{type:`button`,onClick:t,className:`mx-3 mb-3 flex items-center gap-3 rounded-lg px-3 py-2 text-sm text-muted transition-colors hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[n?(0,I.jsx)(ie,{className:`size-4`}):(0,I.jsx)(xe,{className:`size-4`}),n?`Light Mode`:`Dark Mode`]})}function Xt({open:e=!1,blocked:n=!1,onClose:r}){return(0,I.jsxs)(I.Fragment,{children:[e&&(0,I.jsx)(`button`,{type:`button`,"aria-label":`Close navigation`,tabIndex:-1,onClick:r,className:`fixed inset-0 z-40 bg-black/50 lg:hidden`}),(0,I.jsxs)(`div`,{id:`app-nav`,role:e?`dialog`:`complementary`,"aria-modal":e||void 0,"aria-label":e?`Navigation menu`:void 0,inert:n?!0:void 0,"aria-hidden":n||void 0,className:t(`flex w-60 shrink-0 flex-col border-r border-line bg-sidebar`,`fixed inset-y-0 left-0 z-50 transition-[transform,visibility] lg:static lg:z-auto lg:translate-x-0`,e?`translate-x-0`:`-translate-x-full lg:translate-x-0 invisible lg:visible`),children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-5`,children:[(0,I.jsx)(`span`,{className:`text-lg font-bold tracking-tight text-fg`,children:`bunqueue`}),(0,I.jsx)(`span`,{className:`rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-accent`,children:`dash`}),(0,I.jsx)(`span`,{title:`Beta — under active development`,className:`rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-warning`,children:`beta`})]}),(0,I.jsx)(`nav`,{className:`flex-1 overscroll-contain overflow-y-auto px-3 pb-4`,children:Jt.map(e=>(0,I.jsxs)(`div`,{className:`mb-4`,children:[e.section&&(0,I.jsx)(`div`,{className:`px-2 pb-2 pt-1 text-[10px] font-semibold uppercase tracking-wider text-faint`,children:e.section}),(0,I.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.items.map(({to:e,label:n,icon:r,end:i})=>(0,I.jsx)(a,{to:e,end:i,className:({isActive:e})=>t(`group relative flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,e?`bg-surface-2 text-fg`:`text-muted hover:bg-surface-2/60 hover:text-fg`),children:({isActive:e})=>(0,I.jsxs)(I.Fragment,{children:[e&&(0,I.jsx)(`span`,{className:`absolute inset-y-1.5 left-0 w-0.5 rounded-full bg-accent`}),(0,I.jsx)(r,{className:`size-[18px] shrink-0`}),(0,I.jsx)(`span`,{className:`truncate`,children:n})]})},e))})]},e.section??`root`))}),(0,I.jsx)(Rt,{}),(0,I.jsx)(Yt,{}),(0,I.jsx)(qt,{})]})]})}var Zt=`https://egeominotti.github.io/bunqueue-dashboard/docs/`,Qt=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function $t(e){let t=e.parentElement;if(!t)return()=>{};let n=Array.from(t.children).filter(t=>t!==e),r=n.map(e=>({node:e,inert:e.inert,ariaHidden:e.getAttribute(`aria-hidden`)}));for(let e of n)e.inert=!0,e.setAttribute(`aria-hidden`,`true`);return()=>{for(let{node:e,inert:t,ariaHidden:n}of r)e.inert=t,n==null?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,n)}}function en(){let[e,t]=(0,A.useState)(``),[n,r]=(0,A.useState)(0),i=P(e=>e.active===`command-palette`),a=P(e=>e.release),o=m(),s=V(e=>e.toggle),c=(0,A.useRef)(null),l=(0,A.useRef)(null),u=(0,A.useRef)(null),d=(0,A.useRef)(null),f=(0,A.useCallback)(()=>a(`command-palette`),[a]),p=(0,A.useMemo)(()=>{let e=Jt.flatMap(e=>e.items.map(t=>({id:`nav:${t.to}`,label:t.label,hint:e.section??`Home`,run:()=>o(t.to)}))),t=[{id:`act:theme`,label:`Toggle theme (dark / light)`,hint:`Action`,run:s},{id:`act:docs`,label:`Open documentation`,hint:`Action`,run:()=>window.open(Zt,`_blank`,`noopener`)}];return[...e,...t]},[o,s]),h=(0,A.useMemo)(()=>{let t=e.trim().toLowerCase();return t?p.filter(e=>`${e.label} ${e.hint}`.toLowerCase().includes(t)):p},[p,e]);(0,A.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`){e.preventDefault();let t=P.getState();t.active===`command-palette`?t.release(`command-palette`):t.request(`command-palette`)}},t=()=>P.getState().request(`command-palette`);return window.addEventListener(`keydown`,e),window.addEventListener(`command-palette:open`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`command-palette:open`,t)}},[]),(0,A.useEffect)(()=>{if(!i)return;let e=document.activeElement;t(``),r(0);let n=u.current&&!document.getElementById(`app-shell`)?$t(u.current):()=>{},a=requestAnimationFrame(()=>c.current?.focus()),o=e=>{if(e.key===`Escape`){e.preventDefault(),f();return}if(e.key!==`Tab`)return;let t=d.current;if(!t)return;let n=Array.from(t.querySelectorAll(Qt));if(n.length===0){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===i||!t.contains(a))&&(e.preventDefault(),r.focus())};return document.addEventListener(`keydown`,o),()=>{cancelAnimationFrame(a),document.removeEventListener(`keydown`,o),n(),F(`command-palette`)&&e?.isConnected&&e.focus()}},[i,f]),(0,A.useEffect)(()=>{l.current?.querySelector(`[data-idx="${n}"]`)?.scrollIntoView({block:`nearest`})},[n]);let g=(0,A.useCallback)(e=>{e&&(e.run(),f())},[f]);return i?(0,I.jsxs)(`div`,{ref:u,className:`fixed inset-0 z-50 flex items-start justify-center p-4 pt-[12vh]`,children:[(0,I.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Close command palette`,onClick:f,className:`fixed inset-0 bg-black/50`}),(0,I.jsxs)(`div`,{ref:d,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,className:`relative z-10 w-full max-w-lg overflow-hidden rounded-xl border border-line-strong bg-surface shadow-2xl`,children:[(0,I.jsx)(`input`,{ref:c,role:`combobox`,value:e,onChange:e=>{t(e.target.value),r(0)},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),f()):e.key===`ArrowDown`?(e.preventDefault(),r(e=>Math.min(e+1,Math.max(0,h.length-1)))):e.key===`ArrowUp`?(e.preventDefault(),r(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),g(h[n]))},placeholder:`Search pages and actions…`,"aria-label":`Search pages and actions`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":`command-palette-results`,"aria-activedescendant":h[n]?`command-palette-option-${n}`:void 0,autoComplete:`off`,name:`command-palette-search`,className:`w-full border-b border-line bg-transparent px-4 py-3 text-sm text-fg outline-none placeholder:text-faint focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/50`}),(0,I.jsxs)(`div`,{ref:l,id:`command-palette-results`,role:`listbox`,className:`max-h-80 overflow-y-auto overscroll-contain py-2`,"aria-label":`Results`,children:[h.length===0&&(0,I.jsx)(`div`,{role:`presentation`,className:`px-4 py-6 text-center text-sm text-faint`,children:`No matches`}),h.map((e,t)=>(0,I.jsx)(`div`,{role:`presentation`,children:(0,I.jsxs)(`button`,{type:`button`,id:`command-palette-option-${t}`,role:`option`,"aria-selected":t===n,tabIndex:-1,"data-idx":t,onMouseEnter:()=>r(t),onClick:()=>g(e),className:`flex w-full items-center justify-between gap-3 px-4 py-2 text-left text-sm transition-colors ${t===n?`bg-accent/15 text-fg`:`text-muted`}`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:e.label}),(0,I.jsx)(`span`,{className:`shrink-0 text-xs text-faint`,children:e.hint})]})},e.id))]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between border-t border-line px-4 py-2 text-xs text-faint`,children:[(0,I.jsx)(`span`,{children:`↑↓ navigate · ↵ open · esc close`}),(0,I.jsx)(`span`,{className:`font-mono`,children:`⌘K`})]})]})]}):null}var tn=`bq-dash-copilot`,nn=1,rn=new Set([`anthropic`,`openai`,`google`,`zai`,`openrouter`,`custom`]),U={provider:`anthropic`,baseURL:``,model:`claude-opus-4-8`,apiKey:``};function an(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function on(e,t){return typeof e==`string`?e:t}function sn(e){return typeof e==`string`&&rn.has(e)?e:U.provider}function cn(e,t=``){let n=an(e)?e:{},r=sn(n.provider);return{provider:r,baseURL:r===`custom`?on(n.baseURL,U.baseURL):U.baseURL,model:on(n.model,U.model),apiKey:t}}function W(e){let t=cn((an(e)?e:{}).config);return{config:{provider:t.provider,baseURL:t.baseURL,model:t.model}}}var ln=0,un=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${(ln++).toString(36)}-${Math.random().toString(36).slice(2,8)}`,G=new Map,K=(e,t,n)=>e.map(e=>e.id===t?n(e):e);function dn(e){return W(e)}var fn=_({key:tn,version:nn,sanitizeState:W}),pn=x()(C(e=>({open:!1,config:{...U},messages:[],pending:[],busy:!1,setOpen:t=>e({open:t}),toggle:()=>e(e=>({open:!e.open})),setConfig:t=>e(e=>{let n={...e.config,...t};return{config:cn(n,on(n.apiKey,``))}}),clear:()=>{for(let e of G.values())e(!1);G.clear(),e({messages:[],pending:[]})},cancelPending:()=>{for(let e of G.values())e(!1);G.clear(),e({pending:[]})},setBusy:t=>e({busy:t}),addUser:t=>e(e=>({messages:[...e.messages,{id:un(),role:`user`,content:t}]})),startAssistant:()=>{let t=un();return e(e=>({messages:[...e.messages,{id:t,role:`assistant`,content:``,tools:[]}]})),t},appendAssistant:(t,n)=>e(e=>({messages:K(e.messages,t,e=>({...e,content:e.content+n}))})),finishAssistant:(t,n)=>e(e=>({messages:K(e.messages,t,e=>({...e,done:!0,error:!!n?.error,content:n?.error?e.content?`${e.content}\n\n${n.error}`:n.error:e.content}))})),addTool:(t,n)=>e(e=>({messages:K(e.messages,t,e=>({...e,tools:[...e.tools??[],n]}))})),updateTool:(t,n,r)=>e(e=>({messages:K(e.messages,t,e=>({...e,tools:(e.tools??[]).map(e=>e.id===n?{...e,...r}:e)}))})),requestConfirm:t=>new Promise(n=>{let r=un();G.set(r,n),e(e=>({pending:[...e.pending,{...t,id:r}]}))}),resolveConfirm:(t,n)=>{let r=G.get(t);r&&(G.delete(t),r(n)),e(e=>({pending:e.pending.filter(e=>e.id!==t)}))}}),{name:tn,version:nn,storage:v(()=>fn),partialize:e=>dn(e),migrate:W,merge:(e,t)=>{let n=W(e);return{...t,config:{...n.config,apiKey:``}}}})),mn=(0,A.lazy)(()=>u(()=>import(`./CopilotPanel-Dlm8XwBj.js`).then(e=>({default:e.CopilotPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),hn=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function gn(e,t){requestAnimationFrame(()=>{F(`copilot`)&&(e?.isConnected?e.focus():t.current?.focus())})}function _n(e){let t=[],n=e;for(;n?.parentElement&&n.parentElement!==document.documentElement;){let e=n.parentElement;for(let r of Array.from(e.children))r===n||!(r instanceof window.HTMLElement)||(t.push({node:r,inert:r.inert,ariaHidden:r.getAttribute(`aria-hidden`)}),r.inert=!0,r.setAttribute(`aria-hidden`,`true`));n=e}return()=>{for(let{node:e,inert:n,ariaHidden:r}of t)e.inert=n,r==null?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,r)}}function vn({className:e}){return(0,I.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[(0,I.jsx)(`path`,{d:`M12 3l1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3z`,fill:`currentColor`}),(0,I.jsx)(`path`,{d:`M19 14l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8.8-2z`,fill:`currentColor`,opacity:`0.7`})]})}var yn=class extends A.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,I.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Copilot failed to load`,tabIndex:-1,className:`fixed inset-y-0 right-0 z-[60] flex w-full max-w-md flex-col items-center justify-center gap-3 border-l border-line bg-surface px-6 text-center`,children:[(0,I.jsx)(`p`,{className:`text-sm text-fg`,children:`Copilot failed to load.`}),(0,I.jsx)(`p`,{className:`text-xs text-muted`,children:`The panel is loaded on demand; the request failed. If the dashboard was just redeployed, reload the page. The rest of the dashboard is unaffected.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{this.setState({failed:!1}),this.props.onClose()},className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Close`})]}):this.props.children}};function bn(){let e=pn(e=>e.open),t=pn(e=>e.setOpen),n=P(e=>e.active),r=e&&n===`copilot`,i=(0,A.useRef)(null),a=(0,A.useRef)(null),o=(0,A.useRef)(null);return(0,A.useEffect)(()=>{let r=P.getState();if(e){if(n===`copilot`)return;r.request(`copilot`)||t(!1);return}r.release(`copilot`)},[e,n,t]),(0,A.useEffect)(()=>()=>{P.getState().release(`copilot`)},[]),(0,A.useEffect)(()=>{if(!r||!i.current)return;let e=i.current,n=document.getElementById(`app-shell`)?()=>{}:_n(e),s=requestAnimationFrame(()=>{let t=e.querySelector(hn),n=e.querySelector(`[role="dialog"]`);(t??n??e).focus()}),c=n=>{if(n.key===`Escape`){n.preventDefault(),t(!1);return}if(n.key!==`Tab`)return;let r=Array.from(e.querySelectorAll(hn));if(r.length===0){n.preventDefault(),(e.querySelector(`[role="dialog"]`)??e).focus();return}let i=r[0],a=r[r.length-1],o=document.activeElement;n.shiftKey&&(o===i||!e.contains(o))?(n.preventDefault(),a.focus()):!n.shiftKey&&(o===a||!e.contains(o))&&(n.preventDefault(),i.focus())};document.addEventListener(`keydown`,c);let l=a.current;return()=>{cancelAnimationFrame(s),document.removeEventListener(`keydown`,c),n(),gn(l,o)}},[r,t]),(0,I.jsxs)(I.Fragment,{children:[!r&&(0,I.jsxs)(`button`,{ref:o,type:`button`,onClick:e=>{a.current=e.currentTarget,P.getState().request(`copilot`)&&t(!0)},className:`fixed bottom-5 right-5 z-40 flex items-center gap-2 rounded-full border border-line bg-surface px-4 py-2.5 text-sm font-medium text-fg shadow-lg transition-colors hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,"aria-label":`Open Copilot`,children:[(0,I.jsx)(vn,{className:`size-4 text-accent`}),`Copilot`,(0,I.jsx)(`span`,{className:`rounded bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-accent`,children:`beta`})]}),r&&(0,I.jsx)(`div`,{ref:i,tabIndex:-1,className:`contents`,children:(0,I.jsx)(yn,{onClose:()=>t(!1),children:(0,I.jsx)(A.Suspense,{fallback:(0,I.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Loading Copilot`,tabIndex:-1,className:`fixed inset-y-0 right-0 z-[60] flex w-full max-w-md items-center justify-center border-l border-line bg-surface text-sm text-muted`,children:`Loading Copilot…`}),children:(0,I.jsx)(mn,{})})})})]})}var xn=class extends A.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught an error`,e,t.componentStack)}componentDidUpdate(e){this.state.error&&e.resetKey!==this.props.resetKey&&this.setState({error:null})}render(){let{error:e}=this.state;return e?(0,I.jsx)(`div`,{className:`flex min-h-screen items-center justify-center p-6`,children:(0,I.jsxs)(O,{className:`w-full max-w-lg`,children:[(0,I.jsx)(Oe,{error:e}),(0,I.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,I.jsx)(Ee,{onClick:()=>window.location.reload(),children:`Reload`})})]})}):this.props.children}},Sn={success:{bar:`bg-emerald-500`,title:`text-success`},error:{bar:`bg-red-500`,title:`text-danger`},info:{bar:`bg-accent`,title:`text-accent`}};function Cn({toast:e,dismiss:n}){(0,A.useEffect)(()=>{let t=window.setTimeout(()=>n(e.id),e.ttlMs);return()=>window.clearTimeout(t)},[e.id,e.ttlMs,n]);let r=Sn[e.level];return(0,I.jsxs)(`div`,{className:`pointer-events-auto flex w-80 max-w-[calc(100vw-2rem)] overflow-hidden rounded-lg border border-line bg-surface shadow-lg`,children:[(0,I.jsx)(`span`,{className:t(`w-1 shrink-0`,r.bar),"aria-hidden":`true`}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 px-3 py-2.5`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:t(`text-sm font-medium`,r.title),children:e.title}),e.detail&&(0,I.jsx)(`div`,{className:`mt-0.5 break-words text-xs text-muted`,children:e.detail})]}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>n(e.id),"aria-label":`Dismiss notification`,className:`-mr-1 shrink-0 rounded p-0.5 text-faint hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:(0,I.jsx)(_e,{className:`size-4`})})]})]})}function wn(){let e=ne(e=>e.toasts),t=ne(e=>e.dismiss);return e.length===0?null:(0,I.jsx)(`section`,{className:`pointer-events-none fixed bottom-4 right-4 z-[60] flex flex-col gap-2`,"aria-label":`Notifications`,"aria-live":`polite`,children:e.map(e=>(0,I.jsx)(Cn,{toast:e,dismiss:t},e.id))})}function Tn(e,t){(0,A.useLayoutEffect)(()=>{let t=e.current;t&&(t.scrollTop=0,t.scrollLeft=0)},[t,e])}var En={"/":`Overview`,"/fleet":`Fleet`,"/queues":`Queues`,"/jobs":`Jobs`,"/dlq":`Dead Letter Queue`,"/cron":`Cron Jobs`,"/flows":`Flows`,"/workflows":`Workflow · Overview`,"/workflows/executions":`Workflow · Executions`,"/workflows/waiting":`Workflow · Waiting & Signals`,"/workflows/compensation":`Workflow · Compensation`,"/workflows/archive":`Workflow · Archive`,"/metrics":`Metrics`,"/workers":`Workers`,"/logs":`Logs`,"/server":`Server`,"/add-job":`Add Job`,"/jobs/bulk-add":`Bulk Add Jobs`,"/job":`Job Inspector`,"/queue-control":`Queue Control`,"/dlq-control":`DLQ Control`,"/webhooks":`Webhooks`,"/diagnostics":`Diagnostics`,"/alerts":`Alerts`,"/benchmark":`Benchmark`,"/database":`Database`,"/mcp":`MCP`,"/usage":`Usage`,"/s3":`S3 Backup`,"/settings":`Settings`,"/overview-classic":`Overview (classic)`,"/queues-classic":`Queues (classic)`,"/jobs-classic":`Jobs (classic)`,"/dlq-classic":`DLQ (classic)`,"/cron-classic":`Cron Jobs (classic)`,"/metrics-classic":`Metrics (classic)`,"/workers-classic":`Workers (classic)`,"/logs-classic":`Logs (classic)`,"/usage-classic":`Usage (classic)`,"/s3-classic":`S3 Backup (classic)`};function Dn(e){let t=e.length>1?e.replace(/\/+$/,``):e;if(En[t])return En[t];let n=t.startsWith(`/queues-classic/`);if(n||t.startsWith(`/queues/`)){let e=t.slice(n?16:8);try{e=decodeURIComponent(e)}catch{}return`${e} · Queue${n?` (classic)`:``}`}return`Page not found`}function On(e){(0,A.useEffect)(()=>{document.title=`${e} · bunqueue`},[e])}var kn=H();function An({onMenu:e,navOpen:t=!1}){let{pathname:n}=o(),r=Dn(n);return On(r),(0,I.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-14 items-center justify-between gap-3 border-b border-line bg-bg/80 px-4 backdrop-blur sm:px-6 lg:px-8`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-label":`Open navigation`,"aria-expanded":t,"aria-controls":`app-nav`,onClick:t=>e?.(t.currentTarget),className:`-ml-1 flex size-9 shrink-0 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 lg:hidden`,children:(0,I.jsx)(de,{className:`size-5`})}),(0,I.jsxs)(`div`,{className:`truncate text-sm text-muted`,children:[(0,I.jsx)(`span`,{className:`text-faint`,children:r}),(0,I.jsx)(`span`,{className:`mx-2 hidden text-faint sm:inline`,children:`·`}),(0,I.jsx)(`span`,{className:`hidden text-faint sm:inline`,children:`bunqueue`})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[kn&&(0,I.jsxs)(`span`,{title:`Showing canned sample data. No real bunqueue server is connected.`,className:`hidden items-center gap-1.5 rounded-full border border-accent/40 bg-accent/10 px-2.5 py-1 text-xs font-medium text-accent sm:inline-flex`,children:[(0,I.jsx)(`span`,{className:`size-1.5 rounded-full bg-accent`}),`Live demo`]}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>window.dispatchEvent(new Event(`command-palette:open`)),title:`Command palette`,"aria-label":`Open command palette`,className:`flex size-9 shrink-0 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:hidden`,children:(0,I.jsx)(se,{className:`size-5`})}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>window.dispatchEvent(new Event(`command-palette:open`)),title:`Command palette (⌘K)`,"aria-label":`Open command palette`,className:`hidden items-center gap-2 rounded-lg border border-line px-2.5 py-1.5 text-xs text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:flex`,children:[(0,I.jsx)(`span`,{children:`Search`}),(0,I.jsx)(`kbd`,{className:`rounded border border-line bg-surface-2 px-1 font-mono text-[10px]`,children:`⌘K`})]}),(0,I.jsx)(d,{to:`/settings`,title:`Settings`,"aria-label":`Open settings`,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-accent to-fuchsia-600 text-xs font-bold text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`bq`})]})]})}function jn(){let[e,n]=(0,A.useState)(!1),{pathname:r,key:i}=o(),a=(0,A.useRef)(null),s=(0,A.useRef)(null),c=P(e=>e.active),u=P(e=>e.request),d=P(e=>e.release),f=e&&c===`mobile-navigation`,p=(0,A.useCallback)(()=>{n(!1),d(`mobile-navigation`)},[d]);return Tn(a,i),(0,A.useEffect)(()=>p(),[r,p]),(0,A.useEffect)(()=>{let e=window.matchMedia(`(min-width: 1024px)`),t=()=>e.matches&&p();return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[p]),(0,A.useEffect)(()=>{if(!f)return;let e=e=>{e.key===`Escape`&&p()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,p]),(0,A.useEffect)(()=>{if(!f)return;let e=document.getElementById(`app-nav`),t=()=>e?Array.from(e.querySelectorAll(`a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])`)):[],n=()=>t()[0]?.focus(),r=setTimeout(n,0),i=setTimeout(()=>{e?.contains(document.activeElement)||n()},200),a=n=>{if(n.key!==`Tab`)return;let r=t();if(!r.length)return;let i=r[0],a=r[r.length-1];e?.contains(document.activeElement)?n.shiftKey&&document.activeElement===i?(n.preventDefault(),a.focus()):!n.shiftKey&&document.activeElement===a&&(n.preventDefault(),i.focus()):(n.preventDefault(),(n.shiftKey?a:i).focus())};return window.addEventListener(`keydown`,a),()=>{clearTimeout(r),clearTimeout(i),window.removeEventListener(`keydown`,a);let e=s.current;F(`mobile-navigation`)&&e?.isConnected&&e.focus()}},[f]),(0,A.useEffect)(()=>{e&&c!==`mobile-navigation`&&n(!1)},[e,c]),(0,A.useEffect)(()=>{let e=()=>p();return window.addEventListener(`auth:gate-opened`,e),window.addEventListener(`command-palette:open`,e),()=>{window.removeEventListener(`auth:gate-opened`,e),window.removeEventListener(`command-palette:open`,e)}},[p]),(0,A.useEffect)(()=>()=>{P.getState().release(`mobile-navigation`)},[]),(0,I.jsx)(xn,{children:(0,I.jsxs)(`div`,{id:`app-shell`,className:`flex h-screen overflow-hidden bg-bg text-fg`,children:[(0,I.jsx)(`a`,{href:`#main`,inert:c!==null||void 0,tabIndex:c===null?void 0:-1,className:`sr-only rounded-md bg-accent px-3 py-2 text-sm font-medium text-accent-fg shadow-lg focus:not-sr-only focus:absolute focus:left-4 focus:top-3 focus:z-50`,children:`Skip to content`}),(0,I.jsx)(Xt,{open:f,blocked:c!==null&&c!==`mobile-navigation`,onClose:p}),(0,I.jsxs)(`div`,{id:`app-content`,className:`flex min-w-0 flex-1 flex-col`,inert:c!==null||void 0,"aria-hidden":c!==null||void 0,children:[(0,I.jsx)(An,{navOpen:f,onMenu:e=>{u(`mobile-navigation`)&&(s.current=e,n(!0))}}),(0,I.jsx)(`main`,{ref:a,id:`main`,tabIndex:-1,className:t(`flex-1 px-4 pt-5 pb-24 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent sm:px-6 lg:px-8 lg:pt-6`,f?`overflow-hidden`:`overflow-y-auto`),children:(0,I.jsx)(A.Suspense,{fallback:(0,I.jsx)(`div`,{className:`p-2 text-sm text-muted`,children:`Loading…`}),children:(0,I.jsx)(xn,{resetKey:i,children:(0,I.jsx)(l,{})})})})]}),(0,I.jsx)(en,{}),(0,I.jsx)(Mt,{}),(0,I.jsx)(`div`,{id:`copilot-layer`,inert:c!==null&&c!==`copilot`||void 0,"aria-hidden":c!==null&&c!==`copilot`||void 0,children:(0,I.jsx)(bn,{})}),(0,I.jsx)(wn,{}),(0,I.jsx)(kt,{})]})})}var Mn={default:`text-fg`,green:`text-success`,red:`text-danger`,blue:`text-blue-400 light:text-blue-700`,amber:`text-warning`,accent:`text-accent`};function q({label:e,value:n,tone:r=`default`,hint:i,compact:a}){return(0,I.jsxs)(`div`,{className:t(`rounded-xl border border-line bg-surface`,a?`px-4 py-3`:`px-5 py-4`),children:[(0,I.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e}),(0,I.jsx)(`div`,{className:t(`mt-2 font-semibold tnum`,a?`text-xl`:`text-3xl`,Mn[r]),children:n}),i!=null&&(0,I.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:i})]})}var Nn={overview:{stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},throughput:{pushPerSec:0,pullPerSec:0,completePerSec:0,failPerSec:0},memory:{heapUsed:0,heapTotal:0,rss:0},crons:{total:0}},queuesTotal:0,details:[],failedTotal:0,readyTotal:0};function Pn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J(e,t){return Pn(e)&&t.every(t=>typeof e[t]==`number`&&Number.isFinite(e[t]))}function Fn(e){if(!Pn(e)||!J(e.stats,[`waiting`,`active`,`completed`,`dlq`,`totalPushed`,`totalPulled`,`uptime`])||!J(e.throughput,[`pushPerSec`,`pullPerSec`])||!J(e.memory,[`rss`])||!J(e.crons,[`total`]))throw Error(`Malformed /dashboard response: required overview metrics are missing or non-numeric.`)}var In=class extends Error{status;lastEventIdSent;constructor(e,t,n=!1){super(e),this.status=t,this.lastEventIdSent=n,this.name=`SseConnectError`}},Ln=new Set([400,409,413,431]);function Rn(e){return e instanceof In&&e.lastEventIdSent&&Ln.has(e.status)}function zn(e){return!e.includes(`\0`)&&e.length<=4096}function Bn(e){return!0}function Vn(e){let t=`message`,n,r=[];for(let i of e.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CopilotPanel-FlAW3RlL.js","./cn-zFEt5SO8.js","./react-vendor-CvwrP0tU.js","./bq-F5BbTG1T.js","./connectionStore-BJLihGaC.js","./upstreamPaths-DQeKSxGc.js","./dist-DZL8soAh.js","./form-C4oby9pI.js","./AddJob-FNaPbs_V.js","./toastStore-IZn6OPLZ.js","./usePolledData-0CVelkl2.js","./Button-Ch1W94fJ.js","./Card-CWxrC8OY.js","./PageHeader-CvIyaFOO.js","./StatusBadge-BoOVTnKu.js","./useServerActionGuard-uGePilQQ.js","./responses-BkR2JTH9.js","./Benchmark-C16tT4pF.js","./icons-BVzwsfbG.js","./format-Cg7VCIZW.js","./AreaChart-DEAalJ6P.js","./BulkAddJobs-IiL1uud0.js","./CronManager-B6xLLgI5.js","./feedback-QDN1AsYt.js","./Pagination-x-Cwgrul.js","./Database-DV2pcDLL.js","./Diagnostics-B6apZrC5.js","./api-BgWE-705.js","./useControlActionGuard-B-bzKZKI.js","./controlConnectionEpoch-CZsS0wAb.js","./DlqControl-DNJPVOTF.js","./flowMutationSafety-YKTHxqKv.js","./exportFile-C7xhE8Yh.js","./QueueControl-DqBvuDnF.js","./QueueActions-BWnmNEqV.js","./DlqPro-CwtTDwGN.js","./Flows-1dC8F_wx.js","./flowOperationPolicy-B2Etcb3f.js","./JobInspector-Ct9Ga-UT.js","./JobsPro-CLzOhKAL.js","./LogsPro-B3KwTSsn.js","./McpServer-fVy27Mof.js","./MetricsPro-B9rD_KQc.js","./useThroughputSeries-DgO8uicf.js","./QueueDetailPro-ClKtyHIf.js","./QueuesOverview-tokquA3g.js","./promisePool-BVfQ9n9Q.js","./S3BackupPro-CDX5WQUY.js","./ServerControl-BmccMNW9.js","./UsagePro-BGLufsE7.js","./Webhooks-DT2LK17V.js","./WorkersPro-BsUQVgQZ.js","./Workflows-DZZA6aGW.js","./Alerts-vzIYtFpW.js","./Fleet-Bdrj9bLI.js","./Cron-1DZTZWXO.js","./Dlq-MRmkQrNC.js","./Jobs-Chqv0RuL.js","./Logs-C5PNP9Wq.js","./Metrics-Ba46pdzT.js","./Overview-DV2qo5v3.js","./QueueDetail-COSH9bJl.js","./Queues-D2-R8nYh.js","./S3Backup-DNABHR2Q.js","./Settings-UcujwvKv.js","./Usage-1KxG1mJ9.js","./Workers-BX1qspaQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,t}from"./cn-zFEt5SO8.js";import{a as n,c as r,g as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./react-vendor-CvwrP0tU.js";import{a as h,c as g,d as _,f as v,i as y,l as b,m as x,n as ee,o as S,p as C,u as te}from"./connectionStore-BJLihGaC.js";import{t as w}from"./bq-F5BbTG1T.js";import{n as ne,t as re}from"./toastStore-IZn6OPLZ.js";import{A as T,D as ie,E as ae,S as oe,T as se,_ as ce,c as le,f as ue,g as de,h as fe,k as pe,l as me,m as he,n as ge,o as _e,p as E,r as ve,s as ye,t as be,u as D,v as xe,w as Se,y as Ce}from"./icons-BVzwsfbG.js";import{t as we}from"./api-BgWE-705.js";import{n as Te}from"./usePolledData-0CVelkl2.js";import{t as Ee}from"./Button-Ch1W94fJ.js";import{t as O}from"./Card-CWxrC8OY.js";import{i as De,n as Oe,r as ke}from"./feedback-QDN1AsYt.js";import{t as Ae}from"./PageHeader-CvIyaFOO.js";import{c as je,l as Me,n as Ne,r as Pe,s as k,t as Fe,u as Ie}from"./format-Cg7VCIZW.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var A=e(i(),1),Le=s(),Re=`bq-dash-alerts`,ze=1,Be=[`email`,`webhook`,`slack`],Ve=[`error_rate`,`p99_latency`,`waiting`,`failed`,`dlq`],He=[`>=`,`>`,`<=`,`<`],Ue=128,We=200,Ge=2048,Ke=256,qe=/^[^\s@]+@[^\s@]+\.[^\s@]+$/u,Je=()=>`${Date.now().toString(36)}${Math.floor(Math.random()*1e6).toString(36)}`;function Ye(e){let t=new Set(e.map(e=>e.id)),n=Je();if(!t.has(n))return n;let r=1;for(;t.has(`${n}-${r}`);)r+=1;return`${n}-${r}`}function Xe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ze(e){return Be.includes(e)}function Qe(e){return Ve.includes(e)}function $e(e){return He.includes(e)}function et(e,t){let n=t.trim();if(!n||n.length>Ge)return!1;if(e===`email`)return n.length<=320&&qe.test(n);try{let e=new URL(n);return[`http:`,`https:`].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}}function tt(e){if(!Xe(e)||typeof e.id!=`string`||!Ze(e.type)||typeof e.target!=`string`)return null;let t=e.id.trim(),n=e.target.trim();return!t||t.length>Ue||n.length>Ge||e.type===`email`&&!et(e.type,n)?null:{id:t,type:e.type,target:e.type===`email`?n:``}}function nt(e){if(!Xe(e)||typeof e.id!=`string`||typeof e.name!=`string`||!Qe(e.metric)||!$e(e.operator)||typeof e.threshold!=`number`||!Number.isFinite(e.threshold)||typeof e.queue!=`string`||!Ze(e.channel)||typeof e.enabled!=`boolean`)return null;let t=e.id.trim(),n=e.name.trim(),r=e.queue.trim();return!t||t.length>Ue||!n||n.length>We||r.length>Ke||e.threshold<0||e.metric===`error_rate`&&e.threshold>100?null:{id:t,name:n,metric:e.metric,operator:e.operator,threshold:e.threshold,queue:r,channel:e.channel,enabled:e.enabled}}function j(e){let t=Xe(e)?e:{},n=[],r=new Set;if(Array.isArray(t.channels))for(let e of t.channels){if(n.length>=100)break;let t=tt(e);!t||r.has(t.id)||(r.add(t.id),n.push(t))}let i=[],a=new Set;if(Array.isArray(t.rules))for(let e of t.rules){if(i.length>=500)break;let t=nt(e);!t||a.has(t.id)||(a.add(t.id),i.push(t))}return{channels:n,rules:i}}function rt(e){return j({channels:e.channels,rules:e.rules})}var it=_({key:Re,version:ze,sanitizeState:j}),M=x()(C(e=>({channels:[],rules:[],addChannel:(t,n)=>{let r={ok:!1,error:`Alert destination was rejected.`};return e(e=>{let i=n.trim();return!Ze(t)||!et(t,i)?(r={ok:!1,error:`Alert destination is invalid.`},e):e.channels.length>=100?(r={ok:!1,error:`A maximum of 100 alert destinations can be stored in this browser.`},e):(r={ok:!0},{channels:[...e.channels,{id:Ye(e.channels),type:t,target:i}]})}),r},removeChannel:t=>e(e=>({channels:e.channels.filter(e=>e.id!==t)})),addRule:t=>{let n={ok:!1,error:`Alert rule was rejected.`};return e(e=>{if(e.rules.length>=500)return n={ok:!1,error:`A maximum of 500 alert rules can be stored in this browser.`},e;let r=nt({...t,id:Ye(e.rules)});return r?(n={ok:!0},{rules:[...e.rules,r]}):(n={ok:!1,error:`Alert rule contains invalid fields.`},e)}),n},removeRule:t=>e(e=>({rules:e.rules.filter(e=>e.id!==t)})),toggleRule:t=>e(e=>({rules:e.rules.map(e=>e.id===t?{...e,enabled:!e.enabled}:e)}))}),{name:Re,version:ze,storage:v(()=>it),partialize:rt,migrate:j,merge:(e,t)=>({...t,...j(e)})})),at={error_rate:`error rate`,p99_latency:`p99 latency`,waiting:`waiting jobs`,failed:`failed jobs`,dlq:`DLQ size`},ot=10500,st=500,ct=21,lt=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0;function ut(e,t,n){return t===`>=`?e>=n:t===`>`?e>n:t===`<=`?e<=n:t===`<`&&e<n}function dt(e){if(!Array.isArray(e)||e.length>ot)return null;let t=new Set,n=[];for(let r of e){if(!r||typeof r!=`object`||Array.isArray(r))return null;let e=r,i=e.counts;if(typeof e.name!=`string`||!e.name||e.name.length>256||!/^[a-zA-Z0-9_\-.:]+$/.test(e.name)||t.has(e.name)||typeof e.paused!=`boolean`||!i||typeof i!=`object`||Array.isArray(i))return null;let a=i;if(![`waiting`,`active`,`completed`,`failed`,`delayed`].every(e=>lt(a[e])))return null;t.add(e.name),n.push(r)}return n}function ft(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;if(t.ok!==!0||!t.latency||typeof t.latency!=`object`||Array.isArray(t.latency))return null;let n=t.latency.percentiles;if(!n||typeof n!=`object`||Array.isArray(n))return null;for(let e of Object.values(n)){let t=e?.p99;if(!e||typeof e!=`object`||Array.isArray(e)||typeof t!=`number`||!Number.isFinite(t)||t<0)return null}return e}var pt=(e,t)=>{let n=e+t;return n>0?t/n*100:null};function mt(e,t){let n=e.queue.trim();if(e.metric===`waiting`||e.metric===`failed`){if(!t.summary)return null;let r=e.metric;return n?t.summary.find(e=>e.name===n)?.counts[r]??null:t.summary.reduce((e,t)=>e+t.counts[r],0)}if(e.metric===`dlq`)return t.queues?n?t.queues.find(e=>e.name===n)?.dlq??null:t.queues.reduce((e,t)=>e+(t.dlq??0),0):null;if(e.metric===`error_rate`){if(!t.summary)return null;if(n){let e=t.summary.find(e=>e.name===n);return e?pt(e.counts.completed,e.counts.failed):null}return pt(t.summary.reduce((e,t)=>e+t.counts.completed,0),t.summary.reduce((e,t)=>e+t.counts.failed,0))}let r=t.overview?.latency?.percentiles;if(!r)return null;let i=Object.values(r).map(e=>e.p99).filter(Number.isFinite);return i.length?Math.max(...i):null}function ht(e,t,n){if(typeof e!=`object`||!e||Array.isArray(e))return null;let r=e;if(r.ok!==!0||!Array.isArray(r.queues)||!Number.isSafeInteger(r.total)||r.total<0||r.total>ot||n!==null&&r.total!==n||r.offset!==t||r.limit!==st)return null;let i=r.total;if(r.queues.length!==Math.min(st,i-t))return null;let a=[];for(let e of r.queues){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;if(typeof t.name!=`string`||!t.name||t.name.length>256||!/^[a-zA-Z0-9_\-.:]+$/.test(t.name)||!lt(t.dlq))return null;a.push(e)}return{queues:a,total:i}}async function gt(e=w){try{let t=[],n=new Set,r=null;for(let i=0;i<ct;i++){let i=ht(await e.queues(st,t.length),t.length,r);if(!i)return null;r??=i.total;for(let e of i.queues){if(n.has(e.name))return null;n.add(e.name),t.push(e)}if(t.length===r)return t}return null}catch{return null}}var _t=3,vt=e=>`${e.queue||`All queues`}: ${e.metricLabel} ${e.operator} ${e.threshold} (now ${Math.round(e.value)})`;function yt(e){if(globalThis.Notification?.permission===`granted`)try{new Notification(`bunqueue alert: ${e.ruleName}`,{body:vt(e),tag:e.ruleId})}catch{}}function bt(e){if(e.length<=_t){for(let t of e)re.error(`Alert: ${t.ruleName}`,vt(t)),yt(t);return}re.error(`${e.length} alert rules breaching`,e.map(e=>e.ruleName).join(`, `));for(let t of e)yt(t)}var xt=3e4,St=(e,t)=>JSON.stringify([e,t]);function Ct(e){let t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2)throw TypeError(`Invalid alert connection identity.`);let[n,r]=t,i=g(n);if(!i||typeof r!=`string`)throw TypeError(`Invalid alert server target.`);let a=r.trim();return Object.freeze({baseUrl:i,...a?{authorization:`Bearer ${a}`}:{}})}function wt(e,t){let n=new Headers({Accept:`application/json`});e.authorization&&n.set(`Authorization`,e.authorization);let r=async r=>{t.throwIfAborted();let i=AbortSignal.any([t,AbortSignal.timeout(xt)]),a=await fetch(e.baseUrl+r,{headers:n,signal:i});if(t.throwIfAborted(),!a.ok)throw await a.body?.cancel().catch(()=>{}),a.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:`server`,auth:e.authorization,target:e.baseUrl}})),Error(`Alert metrics request failed: HTTP ${a.status}`);let o=await a.text();if(t.throwIfAborted(),!o)throw Error(`Alert metrics request returned an empty response.`);try{return JSON.parse(o)}catch{throw Error(`Alert metrics request returned invalid JSON (HTTP ${a.status}).`)}};return Object.freeze({queuesSummary:()=>r(`/queues/summary`),queues:(e=500,t=0)=>r(`/dashboard/queues?limit=${e}&offset=${t}`),overview:()=>r(`/dashboard`)})}var Tt=15e3,Et=6e4,N=x(e=>({breaching:[],status:`idle`,error:null,connectionIdentity:null,setBreaching:t=>e({breaching:t})}));async function Dt(){if(typeof Notification>`u`)return`denied`;if(Notification.permission===`granted`)return`granted`;try{return await Notification.requestPermission()}catch{return`denied`}}function Ot(){let e=M(e=>e.rules),t=S(e=>St(e.baseUrl,e.token)),n=(0,A.useRef)(new Map),r=(0,A.useRef)(new Map),i=(0,A.useRef)(new Map),a=(0,A.useRef)(new Map),o=(0,A.useRef)(t),s=(0,A.useRef)(0),c=JSON.stringify(e.filter(e=>e.enabled).map(e=>[e.id,e.metric,e.operator,e.threshold,e.queue]));(0,A.useEffect)(()=>{let e=()=>{n.current.clear(),r.current.clear(),i.current.clear(),a.current.clear()},l=o.current!==t;if(l&&(o.current=t,e()),c===`[]`){e(),N.setState({breaching:[],status:`idle`,error:null,connectionIdentity:t});return}let u=new Set(M.getState().rules.filter(e=>e.enabled).map(e=>e.id)),d=l?[]:N.getState().breaching.filter(e=>u.has(e.ruleId));N.setState({breaching:d,status:`checking`,error:null,connectionIdentity:t});let f;try{f=Ct(t)}catch(e){N.setState({breaching:[],status:`degraded`,error:`Alert evaluation failed: ${e.message}`,connectionIdentity:t});return}let p=new AbortController,m=++s.current,h=!1,g=!1,_=()=>{if(h||s.current!==m)return!1;let e=S.getState();return St(e.baseUrl,e.token)===t},v=e=>{for(let t of[...n.current.keys()])e.has(t)||(n.current.delete(t),r.current.delete(t),i.current.delete(t),a.current.delete(t))},y=async()=>{if(!g){g=!0;try{let e=wt(f,p.signal),[o,s,c]=await Promise.all([e.queuesSummary().then(dt).catch(()=>null),gt(e),e.overview().then(ft).catch(()=>null)]);if(!_())return;let l=M.getState().rules.filter(e=>e.enabled),u=new Set(l.map(e=>e.id));if(v(u),!c){let e=N.getState().breaching.filter(e=>u.has(e.ruleId));if(!_())return;N.setState({breaching:e,status:`degraded`,error:`The bunqueue overview endpoint is unavailable; alert results may be stale.`,connectionIdentity:t});return}let d=Date.now(),m=[],h=[],g=!1;for(let e of l){let t=mt(e,{summary:o,queues:s,overview:c});if(t==null){g=!0;let t=n.current.get(e.id)?a.current.get(e.id):void 0;t&&m.push(t);continue}let l=ut(t,e.operator,e.threshold),u=n.current.get(e.id)??!1;if(l){let n=u?i.current.get(e.id)??d:d;i.current.set(e.id,n);let o={ruleId:e.id,ruleName:e.name,metricLabel:at[e.metric],operator:e.operator,threshold:e.threshold,value:t,queue:e.queue,at:n};m.push(o),a.current.set(e.id,o);let s=r.current.get(e.id)??0;d-s>Et&&s<n&&(h.push(o),r.current.set(e.id,d))}else i.current.delete(e.id),a.current.delete(e.id);n.current.set(e.id,l)}if(!_())return;bt(h);let y=!o||!s||g;N.setState({breaching:m,status:y?`degraded`:`live`,error:y?`Some alert rules could not be evaluated; affected results remain unknown.`:null,connectionIdentity:t})}catch(e){if(!_())return;N.setState({status:`degraded`,error:`Alert evaluation failed: ${e.message}`,connectionIdentity:t})}finally{g=!1}}};y();let b=setInterval(y,Tt);return()=>{h=!0,s.current===m&&(s.current+=1),p.abort(),clearInterval(b)}},[c,t])}function kt(){return Ot(),null}var At={authentication:100,"command-palette":80,copilot:60,"database-row":40,"mobile-navigation":20},P=x((e,t)=>({active:null,request(n){let r=t().active;return r===n?!0:r&&At[r]>At[n]?!1:(e({active:n}),!0)},release(n){t().active===n&&e({active:null})},reset(){e({active:null})}}));function F(e){let t=P.getState().active;return t===null||t===e}var I=p();function jt(e){return{scope:e,auth:e===`agent`?ee().Authorization:y().Authorization,target:e===`agent`?w.agentBase:h()}}function L(e,t){return e?.scope===t.scope&&e.auth===t.auth&&e.target===t.target}function Mt(){let[e,t]=(0,A.useState)(!1),[n,r]=(0,A.useState)(`server`),[i,a]=(0,A.useState)(``),o=S(e=>e.baseUrl),s=S(e=>e.setToken),c=S(e=>e.setAgentToken),l=(0,A.useRef)(null),u=(0,A.useRef)(null),f=(0,A.useRef)(null),p=(0,A.useRef)(null),m=P(e=>e.active),h=e&&m===`authentication`;(0,A.useEffect)(()=>{let e=e=>{let n=e.detail;if(n?.scope!==`server`&&n?.scope!==`agent`)return;let i=jt(n.scope);n.auth!==i.auth||n.target!==i.target||(L(f.current,i)||(p.current=null,a(``)),f.current=i,P.getState().request(`authentication`),r(i.scope),t(!0),window.dispatchEvent(new window.Event(`auth:gate-opened`)))};return window.addEventListener(`auth:required`,e),()=>window.removeEventListener(`auth:required`,e)},[]),(0,A.useEffect)(()=>()=>{P.getState().release(`authentication`)},[]),(0,A.useEffect)(()=>{if(!h)return;let e=document.activeElement,t=document.getElementById(`app-shell`)?[]:[`app-nav`,`app-content`].map(e=>document.getElementById(e)).filter(e=>e!==null),n=t.map(e=>({element:e,inert:e.inert,ariaHidden:e.getAttribute(`aria-hidden`)}));for(let e of t)e.inert=!0,e.setAttribute(`aria-hidden`,`true`);let r=window.requestAnimationFrame(()=>l.current?.focus()),i=()=>u.current?Array.from(u.current.querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`)):[],a=e=>{if(e.key!==`Tab`)return;let t=i();if(!t.length){e.preventDefault();return}let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return window.addEventListener(`keydown`,a),()=>{window.cancelAnimationFrame(r),window.removeEventListener(`keydown`,a);for(let e of n)e.element.inert=e.inert,e.ariaHidden===null?e.element.removeAttribute(`aria-hidden`):e.element.setAttribute(`aria-hidden`,e.ariaHidden);F(`authentication`)&&e?.isConnected&&e.focus()}},[h]);let g=()=>{f.current=null,p.current=null,a(``),t(!1),P.getState().release(`authentication`)};return h?(0,I.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,children:(0,I.jsxs)(`form`,{ref:u,onSubmit:e=>{e.preventDefault();let t=f.current,n=p.current;if(!t||!n||!L(n.identity,t)||!L(t,jt(t.scope))){g();return}let r=n.value.trim();r&&(t.scope===`agent`?c(r):s(r),g())},role:`dialog`,"aria-modal":`true`,"aria-label":`Authentication required`,className:`w-full max-w-sm rounded-xl border border-line-strong bg-surface p-6 shadow-2xl`,children:[(0,I.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:`Authentication required`}),n===`agent`?(0,I.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[`The control agent at `,(0,I.jsx)(`span`,{className:`break-all font-mono text-fg`,children:w.agentBase}),` `,`rejected the request (401). Enter its`,` `,(0,I.jsx)(`span`,{className:`font-mono text-fg`,children:`AGENT_TOKEN`}),` to continue.`]}):(0,I.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[`The server at `,(0,I.jsx)(`span`,{className:`break-all font-mono text-fg`,children:o}),` rejected the request (401). Enter its bearer token to continue.`]}),(0,I.jsx)(`input`,{ref:l,type:`password`,value:i,onInput:e=>{let t=e.currentTarget.value;a(t);let n=f.current;p.current=n?{identity:n,value:t}:null},placeholder:n===`agent`?`AGENT_TOKEN`:`Bearer token`,"aria-label":n===`agent`?`Agent token`:`Bearer token`,name:n===`agent`?`agent-token`:`server-token`,autoComplete:`current-password`,className:`mt-4 w-full rounded-lg border border-line bg-surface-2 px-3 py-2 text-sm text-fg outline-none placeholder:text-faint focus-visible:ring-2 focus-visible:ring-accent/50`}),(0,I.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-3`,children:[(0,I.jsx)(d,{to:`/settings`,onClick:g,className:`text-xs text-muted underline-offset-2 hover:text-fg hover:underline`,children:`Open Settings instead`}),(0,I.jsx)(`button`,{type:`submit`,disabled:!i.trim(),className:`rounded-lg bg-accent px-4 py-2 text-sm font-medium text-accent-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-50`,children:`Unlock`})]})]})}):null}var Nt=`bq-dash-theme`,Pt=1;function R(e){return e===`light`?`light`:`dark`}function z(){try{return globalThis.localStorage??null}catch{return null}}var Ft={getItem(e){let t=z();if(!t)return null;try{let n=t.getItem(e);if(n===null||e!==Nt)return n;let r=JSON.parse(n),i=r&&typeof r==`object`&&!Array.isArray(r)?r:{},a=i.state&&typeof i.state==`object`&&!Array.isArray(i.state)?i.state:{},o=JSON.stringify({state:{theme:R(a.theme)},version:Pt});if(n!==o)try{t.setItem(e,o)}catch{}return o}catch{try{t.removeItem(e)}catch{}return null}},setItem(e,t){try{z()?.setItem(e,t)}catch{}},removeItem(e){try{z()?.removeItem(e)}catch{}}};function B(e){typeof document<`u`&&(document.documentElement.dataset.theme=e,document.documentElement.style.colorScheme=e)}var V=x()(C((e,t)=>({theme:`dark`,toggle:()=>{let n=t().theme===`dark`?`light`:`dark`;B(n),e({theme:n})},setTheme:t=>{let n=R(t);B(n),e({theme:n})}}),{name:Nt,version:Pt,storage:v(()=>Ft),partialize:e=>({theme:R(e.theme)}),merge:(e,t)=>{let n=e&&typeof e==`object`&&!Array.isArray(e)?e:{};return{...t,theme:R(n.theme)}},onRehydrateStorage:()=>e=>{e&&B(R(e.theme))}}));function It(){B(R(V.getState().theme))}var Lt={connecting:{dot:`bg-zinc-500`,label:`connecting`},connected:{dot:`bg-emerald-400`,label:`connected`},degraded:{dot:`bg-amber-400`,label:`reachable, degraded`},offline:{dot:`bg-red-400`,label:`offline`}};function Rt(){let e=S(e=>e.baseUrl),n=S(e=>e.profiles),r=S(e=>e.activeProfileId),i=S(e=>e.activateProfile),{data:a,error:o,loading:s}=Te(async()=>{let e=await we.health();if(typeof e.ok!=`boolean`)throw Error(`Malformed health response`);return{healthy:e.ok}},[],{intervalMs:15e3}),c=Lt[s?`connecting`:o||!a?`offline`:a.healthy?`connected`:`degraded`],l=e.replace(/^https?:\/\//,``)||`local`;return(0,I.jsxs)(`div`,{className:`mx-3 mb-4 flex items-center gap-2 rounded-lg border border-line bg-surface px-3 py-1.5`,children:[(0,I.jsx)(`span`,{className:t(`size-1.5 rounded-full`,c.dot),title:c.label}),(0,I.jsx)(`label`,{className:`sr-only`,htmlFor:`active-bunqueue-node`,children:`Active Bunqueue node`}),(0,I.jsx)(`select`,{id:`active-bunqueue-node`,"aria-label":`Active Bunqueue node`,value:r,onChange:e=>i(e.target.value),title:`${n.length} configured node${n.length===1?``:`s`} · ${e}`,className:`min-w-0 flex-1 truncate bg-transparent text-[11px] font-medium text-muted outline-none`,children:n.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,I.jsx)(`span`,{className:`sr-only`,title:e,children:l}),(0,I.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-faint`,"aria-label":`${n.length} nodes`,children:[n.length,`×`]}),(0,I.jsx)(`span`,{className:`sr-only`,children:c.label})]})}function zt(e){let t=null;try{return t=document.createElement(`textarea`),t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`)}catch{return!1}finally{t?.remove()}}function Bt({value:e,className:n}){let[r,i]=(0,A.useState)(`idle`),a=(0,A.useRef)(null);(0,A.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]);let o=async()=>{let t=!1;if(navigator.clipboard)try{await navigator.clipboard.writeText(e),t=!0}catch{}t||=zt(e),i(t?`copied`:`failed`),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(`idle`),1500)},s=r===`copied`?`Copied to clipboard`:r===`failed`?`Copy failed`:`Copy to clipboard`;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,onClick:o,"aria-label":s,title:s,className:t(`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-faint transition-colors hover:bg-surface-2 hover:text-fg`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,n),children:r===`copied`?(0,I.jsx)(ve,{className:`size-3.5 text-success`}):r===`failed`?(0,I.jsx)(_e,{className:`size-3.5 text-danger`}):(0,I.jsx)(ye,{className:`size-3.5`})}),(0,I.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:r===`idle`?``:s})]})}var Vt;function H(){return Vt===void 0&&(Vt=Ht()),Vt}function Ht(){if(typeof window>`u`)return!1;let{search:e,hash:t}=window.location;return new URLSearchParams(e).has(`demo`)||t.replace(/^#/,``)===`demo`}var Ut=`https://github.com/egeominotti/bunqueue-dashboard`,Wt=`https://egeominotti.github.io/bunqueue-dashboard/docs/`,Gt=`bunx bunqueue-dashboard`;function Kt(){return(0,I.jsxs)(`div`,{className:`mx-3 mb-2 rounded-lg border border-accent/30 bg-accent/5 p-3`,children:[(0,I.jsx)(`p`,{className:`mb-2 text-[11px] font-medium leading-snug text-fg`,children:`Like it? Run it on your own bunqueue server.`}),(0,I.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 rounded-md border border-line bg-surface-2 px-2 py-1`,children:[(0,I.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-fg`,children:Gt}),(0,I.jsx)(Bt,{value:Gt})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsxs)(`a`,{href:Ut,target:`_blank`,rel:`noreferrer`,className:`flex flex-1 items-center justify-center gap-1 rounded-md bg-accent px-2 py-1.5 text-[11px] font-semibold text-accent-fg transition-opacity hover:opacity-90`,children:[(0,I.jsx)(`span`,{"aria-hidden":!0,children:`★`}),` Star`]}),(0,I.jsx)(`a`,{href:Wt,target:`_blank`,rel:`noreferrer`,className:`flex flex-1 items-center justify-center rounded-md border border-line px-2 py-1.5 text-[11px] font-medium text-muted transition-colors hover:bg-surface-2 hover:text-fg`,children:`Docs`})]})]})}function qt(){let e=S(e=>e.baseUrl),t=S(e=>e.profiles),n=S(e=>e.activeProfileId),r=t.find(e=>e.id===n),i=e===`/api`?`localhost:6790`:e.replace(/^https?:\/\//,``);return(0,I.jsxs)(I.Fragment,{children:[H()&&(0,I.jsx)(Kt,{}),(0,I.jsxs)(`div`,{className:`mx-3 mb-3 flex items-center gap-2.5 rounded-lg border border-line bg-surface px-3 py-2`,children:[(0,I.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-accent to-fuchsia-600 text-[11px] font-bold text-white`,children:`bq`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`truncate text-xs font-medium text-fg`,children:r?.name??`bunqueue`}),(0,I.jsx)(`div`,{className:`truncate font-mono text-[10px] text-faint`,title:e,children:i}),(0,I.jsxs)(`div`,{className:`text-[9px] text-faint`,children:[t.length,` configured node`,t.length===1?``:`s`]})]}),(0,I.jsx)(d,{to:`/settings`,"aria-label":`Settings`,className:`text-faint transition-colors hover:text-fg`,children:(0,I.jsx)(ae,{className:`size-4`})})]})]})}var Jt=[{section:null,items:[{to:`/`,label:`Overview`,icon:Ce,end:!0},{to:`/fleet`,label:`Fleet`,icon:T,end:!0}]},{section:`Queues`,items:[{to:`/queues`,label:`Queues`,icon:oe,end:!0},{to:`/jobs`,label:`Jobs`,icon:E,end:!0},{to:`/dlq`,label:`Dead Letter Queue`,icon:D},{to:`/cron`,label:`Cron Jobs`,icon:le}]},{section:`Workflow`,items:[{to:`/workflows`,label:`Overview`,icon:Ce,end:!0},{to:`/flows`,label:`Job Flows`,icon:ge,end:!0},{to:`/workflows/executions`,label:`Executions`,icon:E,end:!0},{to:`/workflows/waiting`,label:`Waiting & Signals`,icon:le,end:!0},{to:`/workflows/compensation`,label:`Compensation`,icon:D,end:!0},{to:`/workflows/archive`,label:`Archive`,icon:me,end:!0}]},{section:`Monitoring`,items:[{to:`/metrics`,label:`Metrics`,icon:ce},{to:`/workers`,label:`Workers`,icon:T},{to:`/logs`,label:`Logs`,icon:fe},{to:`/alerts`,label:`Alerts`,icon:be}]},{section:`Control`,items:[{to:`/server`,label:`Server`,icon:T},{to:`/add-job`,label:`Add Job`,icon:E},{to:`/jobs/bulk-add`,label:`Bulk Add`,icon:E},{to:`/job`,label:`Job Inspector`,icon:ue},{to:`/queue-control`,label:`Queue Control`,icon:oe},{to:`/dlq-control`,label:`DLQ Control`,icon:D},{to:`/webhooks`,label:`Webhooks`,icon:he},{to:`/diagnostics`,label:`Diagnostics`,icon:ce},{to:`/benchmark`,label:`Benchmark`,icon:he}]},{section:`Management`,items:[{to:`/database`,label:`Database`,icon:me},{to:`/mcp`,label:`MCP`,icon:he},{to:`/usage`,label:`Usage`,icon:pe},{to:`/s3`,label:`S3 Backup`,icon:Se},{to:`/settings`,label:`Settings`,icon:ae}]}];function Yt(){let e=V(e=>e.theme),t=V(e=>e.toggle),n=e===`dark`;return(0,I.jsxs)(`button`,{type:`button`,onClick:t,className:`mx-3 mb-3 flex items-center gap-3 rounded-lg px-3 py-2 text-sm text-muted transition-colors hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[n?(0,I.jsx)(ie,{className:`size-4`}):(0,I.jsx)(xe,{className:`size-4`}),n?`Light Mode`:`Dark Mode`]})}function Xt({open:e=!1,blocked:n=!1,onClose:r}){return(0,I.jsxs)(I.Fragment,{children:[e&&(0,I.jsx)(`button`,{type:`button`,"aria-label":`Close navigation`,tabIndex:-1,onClick:r,className:`fixed inset-0 z-40 bg-black/50 lg:hidden`}),(0,I.jsxs)(`div`,{id:`app-nav`,role:e?`dialog`:`complementary`,"aria-modal":e||void 0,"aria-label":e?`Navigation menu`:void 0,inert:n?!0:void 0,"aria-hidden":n||void 0,className:t(`flex w-60 shrink-0 flex-col border-r border-line bg-sidebar`,`fixed inset-y-0 left-0 z-50 transition-[transform,visibility] lg:static lg:z-auto lg:translate-x-0`,e?`translate-x-0`:`-translate-x-full lg:translate-x-0 invisible lg:visible`),children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-5`,children:[(0,I.jsx)(`span`,{className:`text-lg font-bold tracking-tight text-fg`,children:`bunqueue`}),(0,I.jsx)(`span`,{className:`rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-accent`,children:`dash`}),(0,I.jsx)(`span`,{title:`Beta — under active development`,className:`rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-warning`,children:`beta`})]}),(0,I.jsx)(`nav`,{className:`flex-1 overscroll-contain overflow-y-auto px-3 pb-4`,children:Jt.map(e=>(0,I.jsxs)(`div`,{className:`mb-4`,children:[e.section&&(0,I.jsx)(`div`,{className:`px-2 pb-2 pt-1 text-[10px] font-semibold uppercase tracking-wider text-faint`,children:e.section}),(0,I.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.items.map(({to:e,label:n,icon:r,end:i})=>(0,I.jsx)(a,{to:e,end:i,className:({isActive:e})=>t(`group relative flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,e?`bg-surface-2 text-fg`:`text-muted hover:bg-surface-2/60 hover:text-fg`),children:({isActive:e})=>(0,I.jsxs)(I.Fragment,{children:[e&&(0,I.jsx)(`span`,{className:`absolute inset-y-1.5 left-0 w-0.5 rounded-full bg-accent`}),(0,I.jsx)(r,{className:`size-[18px] shrink-0`}),(0,I.jsx)(`span`,{className:`truncate`,children:n})]})},e))})]},e.section??`root`))}),(0,I.jsx)(Rt,{}),(0,I.jsx)(Yt,{}),(0,I.jsx)(qt,{})]})]})}var Zt=`https://egeominotti.github.io/bunqueue-dashboard/docs/`,Qt=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function $t(e){let t=e.parentElement;if(!t)return()=>{};let n=Array.from(t.children).filter(t=>t!==e),r=n.map(e=>({node:e,inert:e.inert,ariaHidden:e.getAttribute(`aria-hidden`)}));for(let e of n)e.inert=!0,e.setAttribute(`aria-hidden`,`true`);return()=>{for(let{node:e,inert:t,ariaHidden:n}of r)e.inert=t,n==null?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,n)}}function en(){let[e,t]=(0,A.useState)(``),[n,r]=(0,A.useState)(0),i=P(e=>e.active===`command-palette`),a=P(e=>e.release),o=m(),s=V(e=>e.toggle),c=(0,A.useRef)(null),l=(0,A.useRef)(null),u=(0,A.useRef)(null),d=(0,A.useRef)(null),f=(0,A.useCallback)(()=>a(`command-palette`),[a]),p=(0,A.useMemo)(()=>{let e=Jt.flatMap(e=>e.items.map(t=>({id:`nav:${t.to}`,label:t.label,hint:e.section??`Home`,run:()=>o(t.to)}))),t=[{id:`act:theme`,label:`Toggle theme (dark / light)`,hint:`Action`,run:s},{id:`act:docs`,label:`Open documentation`,hint:`Action`,run:()=>window.open(Zt,`_blank`,`noopener`)}];return[...e,...t]},[o,s]),h=(0,A.useMemo)(()=>{let t=e.trim().toLowerCase();return t?p.filter(e=>`${e.label} ${e.hint}`.toLowerCase().includes(t)):p},[p,e]);(0,A.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`){e.preventDefault();let t=P.getState();t.active===`command-palette`?t.release(`command-palette`):t.request(`command-palette`)}},t=()=>P.getState().request(`command-palette`);return window.addEventListener(`keydown`,e),window.addEventListener(`command-palette:open`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`command-palette:open`,t)}},[]),(0,A.useEffect)(()=>{if(!i)return;let e=document.activeElement;t(``),r(0);let n=u.current&&!document.getElementById(`app-shell`)?$t(u.current):()=>{},a=requestAnimationFrame(()=>c.current?.focus()),o=e=>{if(e.key===`Escape`){e.preventDefault(),f();return}if(e.key!==`Tab`)return;let t=d.current;if(!t)return;let n=Array.from(t.querySelectorAll(Qt));if(n.length===0){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===i||!t.contains(a))&&(e.preventDefault(),r.focus())};return document.addEventListener(`keydown`,o),()=>{cancelAnimationFrame(a),document.removeEventListener(`keydown`,o),n(),F(`command-palette`)&&e?.isConnected&&e.focus()}},[i,f]),(0,A.useEffect)(()=>{l.current?.querySelector(`[data-idx="${n}"]`)?.scrollIntoView({block:`nearest`})},[n]);let g=(0,A.useCallback)(e=>{e&&(e.run(),f())},[f]);return i?(0,I.jsxs)(`div`,{ref:u,className:`fixed inset-0 z-50 flex items-start justify-center p-4 pt-[12vh]`,children:[(0,I.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Close command palette`,onClick:f,className:`fixed inset-0 bg-black/50`}),(0,I.jsxs)(`div`,{ref:d,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,className:`relative z-10 w-full max-w-lg overflow-hidden rounded-xl border border-line-strong bg-surface shadow-2xl`,children:[(0,I.jsx)(`input`,{ref:c,role:`combobox`,value:e,onChange:e=>{t(e.target.value),r(0)},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),f()):e.key===`ArrowDown`?(e.preventDefault(),r(e=>Math.min(e+1,Math.max(0,h.length-1)))):e.key===`ArrowUp`?(e.preventDefault(),r(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),g(h[n]))},placeholder:`Search pages and actions…`,"aria-label":`Search pages and actions`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":`command-palette-results`,"aria-activedescendant":h[n]?`command-palette-option-${n}`:void 0,autoComplete:`off`,name:`command-palette-search`,className:`w-full border-b border-line bg-transparent px-4 py-3 text-sm text-fg outline-none placeholder:text-faint focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/50`}),(0,I.jsxs)(`div`,{ref:l,id:`command-palette-results`,role:`listbox`,className:`max-h-80 overflow-y-auto overscroll-contain py-2`,"aria-label":`Results`,children:[h.length===0&&(0,I.jsx)(`div`,{role:`presentation`,className:`px-4 py-6 text-center text-sm text-faint`,children:`No matches`}),h.map((e,t)=>(0,I.jsx)(`div`,{role:`presentation`,children:(0,I.jsxs)(`button`,{type:`button`,id:`command-palette-option-${t}`,role:`option`,"aria-selected":t===n,tabIndex:-1,"data-idx":t,onMouseEnter:()=>r(t),onClick:()=>g(e),className:`flex w-full items-center justify-between gap-3 px-4 py-2 text-left text-sm transition-colors ${t===n?`bg-accent/15 text-fg`:`text-muted`}`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:e.label}),(0,I.jsx)(`span`,{className:`shrink-0 text-xs text-faint`,children:e.hint})]})},e.id))]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between border-t border-line px-4 py-2 text-xs text-faint`,children:[(0,I.jsx)(`span`,{children:`↑↓ navigate · ↵ open · esc close`}),(0,I.jsx)(`span`,{className:`font-mono`,children:`⌘K`})]})]})]}):null}var tn=`bq-dash-copilot`,nn=1,rn=new Set([`anthropic`,`openai`,`google`,`zai`,`openrouter`,`custom`]),U={provider:`anthropic`,baseURL:``,model:`claude-opus-4-8`,apiKey:``};function an(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function on(e,t){return typeof e==`string`?e:t}function sn(e){return typeof e==`string`&&rn.has(e)?e:U.provider}function cn(e,t=``){let n=an(e)?e:{},r=sn(n.provider);return{provider:r,baseURL:r===`custom`?on(n.baseURL,U.baseURL):U.baseURL,model:on(n.model,U.model),apiKey:t}}function W(e){let t=cn((an(e)?e:{}).config);return{config:{provider:t.provider,baseURL:t.baseURL,model:t.model}}}var ln=0,un=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${(ln++).toString(36)}-${Math.random().toString(36).slice(2,8)}`,G=new Map,K=(e,t,n)=>e.map(e=>e.id===t?n(e):e);function dn(e){return W(e)}var fn=_({key:tn,version:nn,sanitizeState:W}),pn=x()(C(e=>({open:!1,config:{...U},messages:[],pending:[],busy:!1,setOpen:t=>e({open:t}),toggle:()=>e(e=>({open:!e.open})),setConfig:t=>e(e=>{let n={...e.config,...t};return{config:cn(n,on(n.apiKey,``))}}),clear:()=>{for(let e of G.values())e(!1);G.clear(),e({messages:[],pending:[]})},cancelPending:()=>{for(let e of G.values())e(!1);G.clear(),e({pending:[]})},setBusy:t=>e({busy:t}),addUser:t=>e(e=>({messages:[...e.messages,{id:un(),role:`user`,content:t}]})),startAssistant:()=>{let t=un();return e(e=>({messages:[...e.messages,{id:t,role:`assistant`,content:``,tools:[]}]})),t},appendAssistant:(t,n)=>e(e=>({messages:K(e.messages,t,e=>({...e,content:e.content+n}))})),finishAssistant:(t,n)=>e(e=>({messages:K(e.messages,t,e=>({...e,done:!0,error:!!n?.error,content:n?.error?e.content?`${e.content}\n\n${n.error}`:n.error:e.content}))})),addTool:(t,n)=>e(e=>({messages:K(e.messages,t,e=>({...e,tools:[...e.tools??[],n]}))})),updateTool:(t,n,r)=>e(e=>({messages:K(e.messages,t,e=>({...e,tools:(e.tools??[]).map(e=>e.id===n?{...e,...r}:e)}))})),requestConfirm:t=>new Promise(n=>{let r=un();G.set(r,n),e(e=>({pending:[...e.pending,{...t,id:r}]}))}),resolveConfirm:(t,n)=>{let r=G.get(t);r&&(G.delete(t),r(n)),e(e=>({pending:e.pending.filter(e=>e.id!==t)}))}}),{name:tn,version:nn,storage:v(()=>fn),partialize:e=>dn(e),migrate:W,merge:(e,t)=>{let n=W(e);return{...t,config:{...n.config,apiKey:``}}}})),mn=(0,A.lazy)(()=>u(()=>import(`./CopilotPanel-FlAW3RlL.js`).then(e=>({default:e.CopilotPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),hn=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function gn(e,t){requestAnimationFrame(()=>{F(`copilot`)&&(e?.isConnected?e.focus():t.current?.focus())})}function _n(e){let t=[],n=e;for(;n?.parentElement&&n.parentElement!==document.documentElement;){let e=n.parentElement;for(let r of Array.from(e.children))r===n||!(r instanceof window.HTMLElement)||(t.push({node:r,inert:r.inert,ariaHidden:r.getAttribute(`aria-hidden`)}),r.inert=!0,r.setAttribute(`aria-hidden`,`true`));n=e}return()=>{for(let{node:e,inert:n,ariaHidden:r}of t)e.inert=n,r==null?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,r)}}function vn({className:e}){return(0,I.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[(0,I.jsx)(`path`,{d:`M12 3l1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3z`,fill:`currentColor`}),(0,I.jsx)(`path`,{d:`M19 14l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8.8-2z`,fill:`currentColor`,opacity:`0.7`})]})}var yn=class extends A.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,I.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Copilot failed to load`,tabIndex:-1,className:`fixed inset-y-0 right-0 z-[60] flex w-full max-w-md flex-col items-center justify-center gap-3 border-l border-line bg-surface px-6 text-center`,children:[(0,I.jsx)(`p`,{className:`text-sm text-fg`,children:`Copilot failed to load.`}),(0,I.jsx)(`p`,{className:`text-xs text-muted`,children:`The panel is loaded on demand; the request failed. If the dashboard was just redeployed, reload the page. The rest of the dashboard is unaffected.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{this.setState({failed:!1}),this.props.onClose()},className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Close`})]}):this.props.children}};function bn(){let e=pn(e=>e.open),t=pn(e=>e.setOpen),n=P(e=>e.active),r=e&&n===`copilot`,i=(0,A.useRef)(null),a=(0,A.useRef)(null),o=(0,A.useRef)(null);return(0,A.useEffect)(()=>{let r=P.getState();if(e){if(n===`copilot`)return;r.request(`copilot`)||t(!1);return}r.release(`copilot`)},[e,n,t]),(0,A.useEffect)(()=>()=>{P.getState().release(`copilot`)},[]),(0,A.useEffect)(()=>{if(!r||!i.current)return;let e=i.current,n=document.getElementById(`app-shell`)?()=>{}:_n(e),s=requestAnimationFrame(()=>{let t=e.querySelector(hn),n=e.querySelector(`[role="dialog"]`);(t??n??e).focus()}),c=n=>{if(n.key===`Escape`){n.preventDefault(),t(!1);return}if(n.key!==`Tab`)return;let r=Array.from(e.querySelectorAll(hn));if(r.length===0){n.preventDefault(),(e.querySelector(`[role="dialog"]`)??e).focus();return}let i=r[0],a=r[r.length-1],o=document.activeElement;n.shiftKey&&(o===i||!e.contains(o))?(n.preventDefault(),a.focus()):!n.shiftKey&&(o===a||!e.contains(o))&&(n.preventDefault(),i.focus())};document.addEventListener(`keydown`,c);let l=a.current;return()=>{cancelAnimationFrame(s),document.removeEventListener(`keydown`,c),n(),gn(l,o)}},[r,t]),(0,I.jsxs)(I.Fragment,{children:[!r&&(0,I.jsxs)(`button`,{ref:o,type:`button`,onClick:e=>{a.current=e.currentTarget,P.getState().request(`copilot`)&&t(!0)},className:`fixed bottom-5 right-5 z-40 flex items-center gap-2 rounded-full border border-line bg-surface px-4 py-2.5 text-sm font-medium text-fg shadow-lg transition-colors hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,"aria-label":`Open Copilot`,children:[(0,I.jsx)(vn,{className:`size-4 text-accent`}),`Copilot`,(0,I.jsx)(`span`,{className:`rounded bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-accent`,children:`beta`})]}),r&&(0,I.jsx)(`div`,{ref:i,tabIndex:-1,className:`contents`,children:(0,I.jsx)(yn,{onClose:()=>t(!1),children:(0,I.jsx)(A.Suspense,{fallback:(0,I.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Loading Copilot`,tabIndex:-1,className:`fixed inset-y-0 right-0 z-[60] flex w-full max-w-md items-center justify-center border-l border-line bg-surface text-sm text-muted`,children:`Loading Copilot…`}),children:(0,I.jsx)(mn,{})})})})]})}var xn=class extends A.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught an error`,e,t.componentStack)}componentDidUpdate(e){this.state.error&&e.resetKey!==this.props.resetKey&&this.setState({error:null})}render(){let{error:e}=this.state;return e?(0,I.jsx)(`div`,{className:`flex min-h-screen items-center justify-center p-6`,children:(0,I.jsxs)(O,{className:`w-full max-w-lg`,children:[(0,I.jsx)(Oe,{error:e}),(0,I.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,I.jsx)(Ee,{onClick:()=>window.location.reload(),children:`Reload`})})]})}):this.props.children}},Sn={success:{bar:`bg-emerald-500`,title:`text-success`},error:{bar:`bg-red-500`,title:`text-danger`},info:{bar:`bg-accent`,title:`text-accent`}};function Cn({toast:e,dismiss:n}){(0,A.useEffect)(()=>{let t=window.setTimeout(()=>n(e.id),e.ttlMs);return()=>window.clearTimeout(t)},[e.id,e.ttlMs,n]);let r=Sn[e.level];return(0,I.jsxs)(`div`,{className:`pointer-events-auto flex w-80 max-w-[calc(100vw-2rem)] overflow-hidden rounded-lg border border-line bg-surface shadow-lg`,children:[(0,I.jsx)(`span`,{className:t(`w-1 shrink-0`,r.bar),"aria-hidden":`true`}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 px-3 py-2.5`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:t(`text-sm font-medium`,r.title),children:e.title}),e.detail&&(0,I.jsx)(`div`,{className:`mt-0.5 break-words text-xs text-muted`,children:e.detail})]}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>n(e.id),"aria-label":`Dismiss notification`,className:`-mr-1 shrink-0 rounded p-0.5 text-faint hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:(0,I.jsx)(_e,{className:`size-4`})})]})]})}function wn(){let e=ne(e=>e.toasts),t=ne(e=>e.dismiss);return e.length===0?null:(0,I.jsx)(`section`,{className:`pointer-events-none fixed bottom-4 right-4 z-[60] flex flex-col gap-2`,"aria-label":`Notifications`,"aria-live":`polite`,children:e.map(e=>(0,I.jsx)(Cn,{toast:e,dismiss:t},e.id))})}function Tn(e,t){(0,A.useLayoutEffect)(()=>{let t=e.current;t&&(t.scrollTop=0,t.scrollLeft=0)},[t,e])}var En={"/":`Overview`,"/fleet":`Fleet`,"/queues":`Queues`,"/jobs":`Jobs`,"/dlq":`Dead Letter Queue`,"/cron":`Cron Jobs`,"/flows":`Flows`,"/workflows":`Workflow · Overview`,"/workflows/executions":`Workflow · Executions`,"/workflows/waiting":`Workflow · Waiting & Signals`,"/workflows/compensation":`Workflow · Compensation`,"/workflows/archive":`Workflow · Archive`,"/metrics":`Metrics`,"/workers":`Workers`,"/logs":`Logs`,"/server":`Server`,"/add-job":`Add Job`,"/jobs/bulk-add":`Bulk Add Jobs`,"/job":`Job Inspector`,"/queue-control":`Queue Control`,"/dlq-control":`DLQ Control`,"/webhooks":`Webhooks`,"/diagnostics":`Diagnostics`,"/alerts":`Alerts`,"/benchmark":`Benchmark`,"/database":`Database`,"/mcp":`MCP`,"/usage":`Usage`,"/s3":`S3 Backup`,"/settings":`Settings`,"/overview-classic":`Overview (classic)`,"/queues-classic":`Queues (classic)`,"/jobs-classic":`Jobs (classic)`,"/dlq-classic":`DLQ (classic)`,"/cron-classic":`Cron Jobs (classic)`,"/metrics-classic":`Metrics (classic)`,"/workers-classic":`Workers (classic)`,"/logs-classic":`Logs (classic)`,"/usage-classic":`Usage (classic)`,"/s3-classic":`S3 Backup (classic)`};function Dn(e){let t=e.length>1?e.replace(/\/+$/,``):e;if(En[t])return En[t];let n=t.startsWith(`/queues-classic/`);if(n||t.startsWith(`/queues/`)){let e=t.slice(n?16:8);try{e=decodeURIComponent(e)}catch{}return`${e} · Queue${n?` (classic)`:``}`}return`Page not found`}function On(e){(0,A.useEffect)(()=>{document.title=`${e} · bunqueue`},[e])}var kn=H();function An({onMenu:e,navOpen:t=!1}){let{pathname:n}=o(),r=Dn(n);return On(r),(0,I.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-14 items-center justify-between gap-3 border-b border-line bg-bg/80 px-4 backdrop-blur sm:px-6 lg:px-8`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-label":`Open navigation`,"aria-expanded":t,"aria-controls":`app-nav`,onClick:t=>e?.(t.currentTarget),className:`-ml-1 flex size-9 shrink-0 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 lg:hidden`,children:(0,I.jsx)(de,{className:`size-5`})}),(0,I.jsxs)(`div`,{className:`truncate text-sm text-muted`,children:[(0,I.jsx)(`span`,{className:`text-faint`,children:r}),(0,I.jsx)(`span`,{className:`mx-2 hidden text-faint sm:inline`,children:`·`}),(0,I.jsx)(`span`,{className:`hidden text-faint sm:inline`,children:`bunqueue`})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[kn&&(0,I.jsxs)(`span`,{title:`Showing canned sample data. No real bunqueue server is connected.`,className:`hidden items-center gap-1.5 rounded-full border border-accent/40 bg-accent/10 px-2.5 py-1 text-xs font-medium text-accent sm:inline-flex`,children:[(0,I.jsx)(`span`,{className:`size-1.5 rounded-full bg-accent`}),`Live demo`]}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>window.dispatchEvent(new Event(`command-palette:open`)),title:`Command palette`,"aria-label":`Open command palette`,className:`flex size-9 shrink-0 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:hidden`,children:(0,I.jsx)(se,{className:`size-5`})}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>window.dispatchEvent(new Event(`command-palette:open`)),title:`Command palette (⌘K)`,"aria-label":`Open command palette`,className:`hidden items-center gap-2 rounded-lg border border-line px-2.5 py-1.5 text-xs text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:flex`,children:[(0,I.jsx)(`span`,{children:`Search`}),(0,I.jsx)(`kbd`,{className:`rounded border border-line bg-surface-2 px-1 font-mono text-[10px]`,children:`⌘K`})]}),(0,I.jsx)(d,{to:`/settings`,title:`Settings`,"aria-label":`Open settings`,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-accent to-fuchsia-600 text-xs font-bold text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`bq`})]})]})}function jn(){let[e,n]=(0,A.useState)(!1),{pathname:r,key:i}=o(),a=(0,A.useRef)(null),s=(0,A.useRef)(null),c=P(e=>e.active),u=P(e=>e.request),d=P(e=>e.release),f=e&&c===`mobile-navigation`,p=(0,A.useCallback)(()=>{n(!1),d(`mobile-navigation`)},[d]);return Tn(a,i),(0,A.useEffect)(()=>p(),[r,p]),(0,A.useEffect)(()=>{let e=window.matchMedia(`(min-width: 1024px)`),t=()=>e.matches&&p();return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[p]),(0,A.useEffect)(()=>{if(!f)return;let e=e=>{e.key===`Escape`&&p()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,p]),(0,A.useEffect)(()=>{if(!f)return;let e=document.getElementById(`app-nav`),t=()=>e?Array.from(e.querySelectorAll(`a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])`)):[],n=()=>t()[0]?.focus(),r=setTimeout(n,0),i=setTimeout(()=>{e?.contains(document.activeElement)||n()},200),a=n=>{if(n.key!==`Tab`)return;let r=t();if(!r.length)return;let i=r[0],a=r[r.length-1];e?.contains(document.activeElement)?n.shiftKey&&document.activeElement===i?(n.preventDefault(),a.focus()):!n.shiftKey&&document.activeElement===a&&(n.preventDefault(),i.focus()):(n.preventDefault(),(n.shiftKey?a:i).focus())};return window.addEventListener(`keydown`,a),()=>{clearTimeout(r),clearTimeout(i),window.removeEventListener(`keydown`,a);let e=s.current;F(`mobile-navigation`)&&e?.isConnected&&e.focus()}},[f]),(0,A.useEffect)(()=>{e&&c!==`mobile-navigation`&&n(!1)},[e,c]),(0,A.useEffect)(()=>{let e=()=>p();return window.addEventListener(`auth:gate-opened`,e),window.addEventListener(`command-palette:open`,e),()=>{window.removeEventListener(`auth:gate-opened`,e),window.removeEventListener(`command-palette:open`,e)}},[p]),(0,A.useEffect)(()=>()=>{P.getState().release(`mobile-navigation`)},[]),(0,I.jsx)(xn,{children:(0,I.jsxs)(`div`,{id:`app-shell`,className:`flex h-screen overflow-hidden bg-bg text-fg`,children:[(0,I.jsx)(`a`,{href:`#main`,inert:c!==null||void 0,tabIndex:c===null?void 0:-1,className:`sr-only rounded-md bg-accent px-3 py-2 text-sm font-medium text-accent-fg shadow-lg focus:not-sr-only focus:absolute focus:left-4 focus:top-3 focus:z-50`,children:`Skip to content`}),(0,I.jsx)(Xt,{open:f,blocked:c!==null&&c!==`mobile-navigation`,onClose:p}),(0,I.jsxs)(`div`,{id:`app-content`,className:`flex min-w-0 flex-1 flex-col`,inert:c!==null||void 0,"aria-hidden":c!==null||void 0,children:[(0,I.jsx)(An,{navOpen:f,onMenu:e=>{u(`mobile-navigation`)&&(s.current=e,n(!0))}}),(0,I.jsx)(`main`,{ref:a,id:`main`,tabIndex:-1,className:t(`flex-1 px-4 pt-5 pb-24 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent sm:px-6 lg:px-8 lg:pt-6`,f?`overflow-hidden`:`overflow-y-auto`),children:(0,I.jsx)(A.Suspense,{fallback:(0,I.jsx)(`div`,{className:`p-2 text-sm text-muted`,children:`Loading…`}),children:(0,I.jsx)(xn,{resetKey:i,children:(0,I.jsx)(l,{})})})})]}),(0,I.jsx)(en,{}),(0,I.jsx)(Mt,{}),(0,I.jsx)(`div`,{id:`copilot-layer`,inert:c!==null&&c!==`copilot`||void 0,"aria-hidden":c!==null&&c!==`copilot`||void 0,children:(0,I.jsx)(bn,{})}),(0,I.jsx)(wn,{}),(0,I.jsx)(kt,{})]})})}var Mn={default:`text-fg`,green:`text-success`,red:`text-danger`,blue:`text-blue-400 light:text-blue-700`,amber:`text-warning`,accent:`text-accent`};function q({label:e,value:n,tone:r=`default`,hint:i,compact:a}){return(0,I.jsxs)(`div`,{className:t(`rounded-xl border border-line bg-surface`,a?`px-4 py-3`:`px-5 py-4`),children:[(0,I.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e}),(0,I.jsx)(`div`,{className:t(`mt-2 font-semibold tnum`,a?`text-xl`:`text-3xl`,Mn[r]),children:n}),i!=null&&(0,I.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:i})]})}var Nn={overview:{stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},throughput:{pushPerSec:0,pullPerSec:0,completePerSec:0,failPerSec:0},memory:{heapUsed:0,heapTotal:0,rss:0},crons:{total:0}},queuesTotal:0,details:[],failedTotal:0,readyTotal:0};function Pn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J(e,t){return Pn(e)&&t.every(t=>typeof e[t]==`number`&&Number.isFinite(e[t]))}function Fn(e){if(!Pn(e)||!J(e.stats,[`waiting`,`active`,`completed`,`dlq`,`totalPushed`,`totalPulled`,`uptime`])||!J(e.throughput,[`pushPerSec`,`pullPerSec`])||!J(e.memory,[`rss`])||!J(e.crons,[`total`]))throw Error(`Malformed /dashboard response: required overview metrics are missing or non-numeric.`)}var In=class extends Error{status;lastEventIdSent;constructor(e,t,n=!1){super(e),this.status=t,this.lastEventIdSent=n,this.name=`SseConnectError`}},Ln=new Set([400,409,413,431]);function Rn(e){return e instanceof In&&e.lastEventIdSent&&Ln.has(e.status)}function zn(e){return!e.includes(`\0`)&&e.length<=4096}function Bn(e){return!0}function Vn(e){let t=`message`,n,r=[];for(let i of e.split(`
|
|
3
3
|
`)){if(!i||i.startsWith(`:`))continue;let e=i.indexOf(`:`),a=e===-1?i:i.slice(0,e),o=e===-1?``:i.slice(e+1).replace(/^ /,``);a===`event`?t=o:a===`data`?r.push(o):a===`id`&&zn(o)&&(n=o)}if(r.length===0)return null;let i=r.join(`
|
|
4
4
|
`),a=i;try{a=JSON.parse(i)}catch{}return{id:n,event:t,data:a}}var Hn=45e3,Un=256*1024;async function Wn(e,t,n,r=Hn,i){let a=new AbortController,o=()=>a.abort(n.reason);n.aborted?a.abort(n.reason):n.addEventListener(`abort`,o,{once:!0});let s,c=()=>{clearTimeout(s),s=setTimeout(()=>a.abort(Error(`SSE idle timeout`)),r)};try{c();let n=new Headers({Accept:`text/event-stream`,...y()}),r=!1;if(i&&zn(i))try{n.set(`Last-Event-ID`,i),r=!0}catch{n.delete(`Last-Event-ID`)}let o=await fetch(e,{headers:n,signal:a.signal});if(!o.ok||!o.body)throw await o.body?.cancel().catch(()=>{}),new In(o.ok?`SSE connect failed: empty response body`:`SSE connect failed: HTTP ${o.status}`,o.status,r);let s=o.headers.get(`content-type`)?.split(`;`,1)[0]?.trim().toLowerCase();if(s!==`text/event-stream`)throw await o.body.cancel().catch(()=>{}),new In(`SSE connect failed: expected text/event-stream, received ${s||`no Content-Type`}`,o.status,r);let l=o.body.getReader(),u=new TextDecoder,d=``;try{for(;;){let{done:e,value:n}=await l.read();if(e)break;for(c(),d+=u.decode(n,{stream:!0});;){let e=d.indexOf(`
|
|
5
5
|
|
|
6
6
|
`),n=d.indexOf(`\r
|
|
7
7
|
\r
|
|
8
|
-
`),r,i;if(e!==-1&&(n===-1||e<=n))r=e,i=2;else if(n!==-1)r=n,i=4;else{if(d.length>262144)throw Error(`SSE frame exceeds the ${Un}-character limit`);break}if(r>262144)throw Error(`SSE frame exceeds the ${Un}-character limit`);let a=d.slice(0,r);d=d.slice(r+i);let o=Vn(a.replace(/\r/g,``));o&&t(o)}}}finally{l.releaseLock()}}finally{clearTimeout(s),n.removeEventListener(`abort`,o),a.abort()}}var Y={total:0,completed:0,failed:0,waiting:0,active:0},Gn=250,Kn=()=>typeof performance<`u`?performance.now():Date.now();function qn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X(e,t){return typeof e==`string`&&e.length<=t?e:void 0}function Jn(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Yn(e,t){let n=Jn(e);return n!==void 0&&Math.abs(n)<=864e13?n:Number.isFinite(t)&&Math.abs(t)<=864e13?t:0}function Xn(e){let t=qn(e)?e:{},n=Date.now();return{queue:X(t.queue,256),jobId:X(t.jobId,1024),name:X(t.name,512),timestamp:Yn(t.timestamp,n),error:X(t.error,4096),progress:Jn(t.progress)}}function Zn(e){let t=e.includes(`:`)?e.split(`:`)[1]:e;switch(t){case`pushed`:case`added`:return`waiting`;case`pulled`:return`active`;case`progress`:return`active`;default:return t}}function Qn(e){let t=S(e=>e.baseUrl),n=S(e=>e.token),[r,i]=(0,A.useState)([]),[a,o]=(0,A.useState)(Y),[s,c]=(0,A.useState)(0),[l,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)(null),p=(0,A.useRef)([]),m=(0,A.useRef)(0),h=JSON.stringify([t,n,e??null]),g=(0,A.useRef)(h),_=g.current===h,v=_?r:[],y=_?a:Y,b=_?s:0,x=_?l:!1,ee=_?d:null;return(0,A.useEffect)(()=>{let t=new AbortController,n=++m.current,r=0,a=!1,s=[],l={...Y},d,_=()=>!a&&m.current===n;g.current=h,i([]),o(Y),c(0),u(!1),f(null),p.current=[];let v=e=>new Promise(n=>{let r=()=>{clearTimeout(i),n()},i=setTimeout(()=>{t.signal.removeEventListener(`abort`,r),n()},e);t.signal.addEventListener(`abort`,r,{once:!0})}),y=e=>{if(!_()||(e.id!==void 0&&(d=e.id||void 0),Bn(e)&&(u(e=>_()?!0:e),f(e=>_()?null:e)),!e.event.startsWith(`job:`)))return;let t=Xn(e.data),n=Zn(e.event),i={seq:++r,event:e.event,queue:t.queue,jobId:t.jobId,name:t.name,status:n,timestamp:t.timestamp,error:t.error,progress:t.progress};s.push(i);let a=l;a.total+=1,n===`completed`?a.completed+=1:n===`failed`?a.failed+=1:n===`waiting`?a.waiting+=1:n===`active`&&(a.active+=1),p.current.push(Kn())};(async()=>{let n=0;for(;!a;){let r=null,i=d,a=!1;try{await Wn(we.eventsUrl(e),e=>{a=!0,y(e)},t.signal,void 0,i)}catch(e){r=e instanceof Error?e:Error(String(e))}if(i&&!a&&d===i&&Rn(r)&&(d=void 0),!_())break;u(e=>!_()&&e),f(e=>_()?r:e),n=r?Math.min(n+1,8):0,await v(2e3*Math.max(1,n))}})();let b=setInterval(()=>{if(!_())return;if(s.length){let e=s;s=[],e.reverse(),i(t=>_()?[...e,...t].slice(0,Gn):t)}let e=l;e.total&&(l={...Y},o(t=>_()?{total:t.total+e.total,completed:t.completed+e.completed,failed:t.failed+e.failed,waiting:t.waiting+e.waiting,active:t.active+e.active}:t))},150);return()=>{a=!0,m.current===n&&(m.current+=1),t.abort(),clearInterval(b)}},[e,t,n,h]),(0,A.useEffect)(()=>{let e=setInterval(()=>{let e=Kn();p.current=p.current.filter(t=>t<=e&&e-t<5e3),c(p.current.length/5)},1e3);return()=>clearInterval(e)},[]),{events:v,counters:y,throughput:b,connected:x,error:ee}}function $n(){let{events:e,connected:n,error:r}=Qn();return(0,I.jsxs)(`div`,{className:`mt-8`,children:[(0,I.jsx)(er,{title:`Recent Activity`,to:`/logs`}),(0,I.jsxs)(O,{padded:!1,children:[r&&e.length>0&&(0,I.jsxs)(`p`,{className:`border-b border-line px-5 py-2 text-xs text-warning`,children:[`Event stream unavailable — `,r.message,`. Reconnecting…`]}),e.length===0?(0,I.jsx)(`p`,{role:r?`alert`:void 0,className:t(`py-8 text-center text-sm`,r?`text-warning`:`text-faint`),children:r?`Event stream unavailable — ${r.message}. Reconnecting…`:n?`Waiting for live activity…`:`Connecting to the event stream…`}):(0,I.jsx)(`ul`,{className:`divide-y divide-line`,children:e.slice(0,8).map(e=>(0,I.jsxs)(`li`,{className:`flex items-center justify-between px-5 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`span`,{className:t(`size-2 rounded-full`,tr(e.status))}),(0,I.jsxs)(`div`,{className:`text-sm`,children:[(0,I.jsx)(`span`,{className:`font-mono font-medium text-fg`,children:e.queue||`—`}),(0,I.jsx)(`span`,{className:`text-faint`,children:` · `}),(0,I.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:e.jobId?e.jobId.slice(0,8):`—`}),(0,I.jsx)(`span`,{className:`text-faint`,children:` · `}),(0,I.jsx)(`span`,{className:`capitalize text-muted`,children:e.status})]})]}),(0,I.jsx)(`span`,{className:`text-xs text-faint`,children:Me(e.timestamp)})]},e.seq))})]})]})}function er({title:e,to:t}){return(0,I.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,I.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:e}),(0,I.jsxs)(d,{to:t,className:`flex items-center gap-1 text-sm text-muted hover:text-fg`,children:[`View All `,(0,I.jsx)(ge,{className:`size-3.5`})]})]})}function Z({label:e,value:n,tone:r}){return(0,I.jsxs)(`span`,{children:[e,` `,(0,I.jsx)(`span`,{className:t(`tnum font-semibold`,r),children:n==null?`—`:k(n)})]})}function tr(e){return e===`completed`?`bg-emerald-400`:e===`failed`?`bg-red-400`:e===`active`?`bg-blue-400`:e===`waiting`?`bg-amber-400`:`bg-accent`}function nr(){let e=S(e=>e.baseUrl),n=(0,A.useRef)(null),{data:r,error:i,loading:a,refetch:o}=Te(async()=>{let[e,t]=await Promise.all([w.overview(),w.queuesSummary()]);Fn(e);let r=[...t].sort((e,t)=>(t.counts?.failed??0)-(e.counts?.failed??0)||(t.counts?.waiting??0)+(t.counts?.prioritized??0)-((e.counts?.waiting??0)+(e.counts?.prioritized??0))).slice(0,6).map(e=>({name:e.name,paused:e.paused,counts:e.counts})),i=t.reduce((e,t)=>e+(t.counts?.failed??0),0),a=t.reduce((e,t)=>e+t.counts.waiting+t.counts.prioritized,0);return n.current=Date.now(),{overview:e,queuesTotal:t.length,details:r,failedTotal:i,readyTotal:a}},[]);if(a&&!r&&!i)return(0,I.jsx)(ke,{label:`Loading overview…`});if(i&&!r)return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(Ae,{title:`Overview`,description:`Real-time system health is unavailable.`}),(0,I.jsx)(Oe,{error:i,onRetry:o})]});let{overview:s,queuesTotal:c,details:l,failedTotal:u,readyTotal:f}=r??Nn,{stats:p,throughput:m,memory:h,crons:g}=s,_=Fe(p.completed,u),v=e===`/api`?`localhost:6790`:e.replace(/^https?:\/\//,``),y=p.uptime?Ie(p.uptime/1e3):`—`,b=Ne(h.rss*1024*1024),x=!!i;return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(Ae,{title:`Overview`,description:`Real-time system health at a glance.`,live:!!r&&!i}),i&&(0,I.jsx)(De,{message:`Connection lost — showing the last successful overview snapshot.`,onRetry:o}),(0,I.jsxs)(`div`,{className:t(`mb-6 flex flex-wrap items-center justify-between gap-y-2 rounded-xl border px-5 py-4`,x?`border-amber-500/25 bg-amber-500/[0.06]`:`border-emerald-500/25 bg-emerald-500/[0.06]`),children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,I.jsxs)(`span`,{className:`relative flex size-2.5`,children:[!x&&(0,I.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-emerald-400 opacity-60`}),(0,I.jsx)(`span`,{className:t(`relative inline-flex size-2.5 rounded-full`,x?`bg-amber-400`:`bg-emerald-400`)})]}),(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:t(`font-semibold`,x?`text-warning`:`text-success`),children:x?`Connection lost — showing last known data`:`bunqueue server connected`}),(0,I.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted`,children:[v,` · uptime `,y,` · `,b,` RAM`,x&&(0,I.jsxs)(I.Fragment,{children:[` `,`· last updated `,n.current?Me(n.current):`never`]})]})]})]}),(0,I.jsx)(`span`,{className:t(`rounded-full px-3 py-1 text-xs font-medium`,x?`bg-amber-500/15 text-warning`:`bg-emerald-500/15 text-success`),children:x?`Stale`:`Online`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-3`,children:[(0,I.jsx)(q,{label:`Error Rate`,value:_==null?`—`:je(_),tone:_==null?`default`:_>.05?`red`:`green`,hint:`failed / processed`}),(0,I.jsx)(q,{label:`Failed`,value:k(u),tone:u?`red`:`default`,hint:`recorded across queues`}),(0,I.jsx)(q,{label:`DLQ`,value:k(p.dlq),tone:p.dlq?`red`:`default`,hint:`dead-lettered jobs`})]}),(0,I.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,I.jsx)(q,{label:`Completed`,value:k(p.completed),tone:`green`,compact:!0}),(0,I.jsx)(q,{label:`Active`,value:k(p.active),tone:`blue`,compact:!0}),(0,I.jsx)(q,{label:`Ready backlog`,value:k(f),tone:f>100?`amber`:`default`,hint:`waiting + prioritized`,compact:!0}),(0,I.jsx)(q,{label:`Push/sec`,value:m.pushPerSec.toFixed(1),tone:`accent`,hint:`${Pe(p.totalPushed)} since restart`,compact:!0}),(0,I.jsx)(q,{label:`Pull/sec`,value:m.pullPerSec.toFixed(1),tone:`accent`,hint:`${Pe(p.totalPulled)} since restart`,compact:!0}),(0,I.jsx)(q,{label:`Queues`,value:k(c),hint:`${g.total} cron active`,compact:!0})]}),(0,I.jsxs)(`div`,{className:`mt-8`,children:[(0,I.jsx)(er,{title:`Queue Health — most loaded`,to:`/queues`}),l.length===0?(0,I.jsx)(O,{children:(0,I.jsx)(`p`,{className:`py-4 text-center text-sm text-faint`,children:`No queues yet.`})}):(0,I.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:l.map(e=>(0,I.jsxs)(d,{to:`/queues/${encodeURIComponent(e.name)}`,className:`rounded-xl border border-line bg-surface p-4 transition-colors hover:border-line-strong`,children:[(0,I.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,I.jsx)(`span`,{className:`truncate font-mono text-sm font-medium text-accent`,children:e.name}),(0,I.jsx)(`span`,{className:t(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-success`),children:e.paused?`paused`:`active`})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs text-faint`,children:[(0,I.jsx)(Z,{label:`W`,value:e.counts?.waiting,tone:`text-warning`}),(0,I.jsx)(Z,{label:`P`,value:e.counts?.prioritized,tone:`text-orange-400`}),(0,I.jsx)(Z,{label:`A`,value:e.counts?.active,tone:`text-blue-400`}),(0,I.jsx)(Z,{label:`C`,value:e.counts?.completed,tone:`text-success`}),(0,I.jsx)(Z,{label:`F`,value:e.counts?.failed,tone:`text-danger`})]})]},e.name))})]}),(0,I.jsx)($n,{})]})}function rr(){return(0,I.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 py-24 text-center`,children:[(0,I.jsx)(`h1`,{className:`text-5xl font-bold text-faint`,children:`404`}),(0,I.jsx)(`p`,{className:`text-sm text-muted`,children:`This page does not exist.`}),(0,I.jsx)(d,{to:`/`,className:`rounded-lg border border-line bg-surface-2 px-4 py-2 text-sm font-medium text-fg hover:border-line-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`Back to Overview`})]})}var ir=(0,A.lazy)(()=>u(()=>import(`./AddJob-FNaPbs_V.js`).then(e=>e.t).then(e=>({default:e.AddJob})),__vite__mapDeps([8,1,2,5,3,4,9,10,11,12,13,14,7,15,16]),import.meta.url)),ar=(0,A.lazy)(()=>u(()=>import(`./Benchmark-DQNZV7dM.js`).then(e=>({default:e.Benchmark})),__vite__mapDeps([17,1,2,4,3,5,18,10,11,12,13,14,19,7,20]),import.meta.url)),or=(0,A.lazy)(()=>u(()=>import(`./BulkAddJobs-IiL1uud0.js`).then(e=>({default:e.BulkAddJobs})),__vite__mapDeps([21,1,2,5,3,4,9,10,11,12,13,14,7,15,16]),import.meta.url)),sr=(0,A.lazy)(()=>u(()=>import(`./CronManager-B6xLLgI5.js`).then(e=>({default:e.CronManager})),__vite__mapDeps([22,1,2,5,3,4,9,18,10,11,12,23,13,14,19,7,24,15,16,8]),import.meta.url)),cr=(0,A.lazy)(()=>u(()=>import(`./Database-DGM2BIHy.js`).then(e=>({default:e.Database})),__vite__mapDeps([25,1,2,4,3,5,9,18,10,11,12,23,13,14,19,7,24]),import.meta.url)),lr=(0,A.lazy)(()=>u(()=>import(`./Diagnostics-_Sh3UyaT.js`).then(e=>({default:e.Diagnostics})),__vite__mapDeps([26,1,2,3,4,5,9,27,10,11,12,23,14,13,19,28,29]),import.meta.url)),ur=(0,A.lazy)(()=>u(()=>import(`./DlqControl-Lq9ISb9b.js`).then(e=>({default:e.DlqControl})),__vite__mapDeps([30,1,2,3,4,5,9,18,10,11,23,13,14,19,7,24,31,32,33,12,15,29,28,34]),import.meta.url)),dr=(0,A.lazy)(()=>u(()=>import(`./DlqPro-0_75vrd1.js`).then(e=>({default:e.DlqPro})),__vite__mapDeps([35,1,2,3,4,5,9,18,10,11,12,23,13,14,19,7,24,31,32,33,15,29,28,34]),import.meta.url)),fr=(0,A.lazy)(()=>u(()=>import(`./Flows-CE7KzaFN.js`).then(e=>({default:e.Flows})),__vite__mapDeps([36,1,2,4,5,3,12,23,13,14,29,28,37]),import.meta.url)),pr=(0,A.lazy)(()=>u(()=>import(`./JobInspector-DyWZk1eW.js`).then(e=>({default:e.JobInspector})),__vite__mapDeps([38,1,2,4,5,3,18,11,12,23,14,13,19,7,31,32,37]),import.meta.url)),mr=(0,A.lazy)(()=>u(()=>import(`./JobsPro-BlWwDeFN.js`).then(e=>({default:e.JobsPro})),__vite__mapDeps([39,1,2,3,4,5,9,18,10,11,23,14,13,19,7,24,15,32,37]),import.meta.url)),hr=(0,A.lazy)(()=>u(()=>import(`./LogsPro-BfYbmZHi.js`).then(e=>({default:e.LogsPro})),__vite__mapDeps([40,1,2,4,18,10,11,23,14,13,19,7,24,33,3,5,12,15,29,28,34,31]),import.meta.url)),gr=(0,A.lazy)(()=>u(()=>import(`./McpServer-DNrOEp9j.js`).then(e=>({default:e.McpServer})),__vite__mapDeps([41,2,1,12,13,14]),import.meta.url)),_r=(0,A.lazy)(()=>u(()=>import(`./MetricsPro-C9g1sp-u.js`).then(e=>({default:e.MetricsPro})),__vite__mapDeps([42,1,2,3,4,5,10,12,23,13,14,19,24,20,43]),import.meta.url)),vr=(0,A.lazy)(()=>u(()=>import(`./QueueControl-Bvm8GUQa.js`).then(e=>({default:e.QueueControl})),__vite__mapDeps([33,1,2,3,4,5,10,11,12,23,14,13,19,7,15,29,28,34,31]),import.meta.url)),yr=(0,A.lazy)(()=>u(()=>import(`./QueueDetailPro-Dkz4-1wn.js`).then(e=>({default:e.QueueDetailPro})),__vite__mapDeps([44,1,2,3,4,5,9,18,10,11,12,23,14,13,19,15,31,29,20,34,7,43]),import.meta.url)),br=(0,A.lazy)(()=>u(()=>import(`./QueuesOverview-CT6JBaim.js`).then(e=>({default:e.QueuesOverview})),__vite__mapDeps([45,1,2,3,4,5,9,18,10,11,23,13,14,19,24,15,46]),import.meta.url)),xr=(0,A.lazy)(()=>u(()=>import(`./S3BackupPro-CjR0y18n.js`).then(e=>({default:e.S3BackupPro})),__vite__mapDeps([47,1,2,4,3,5,18,10,11,12,13,14,7]),import.meta.url)),Sr=(0,A.lazy)(()=>u(()=>import(`./ServerControl-BH6Doax0.js`).then(e=>({default:e.ServerControl})),__vite__mapDeps([48,1,2,3,4,5,18,10,11,12,23,13,14,19,7,28,29]),import.meta.url)),Cr=(0,A.lazy)(()=>u(()=>import(`./UsagePro-CoBbI-Cl.js`).then(e=>({default:e.UsagePro})),__vite__mapDeps([49,2,1,3,4,5,10,12,23,13,14,19]),import.meta.url)),wr=(0,A.lazy)(()=>u(()=>import(`./Webhooks-DT2LK17V.js`).then(e=>({default:e.Webhooks})),__vite__mapDeps([50,1,2,3,4,5,9,18,10,11,12,23,13,14,19,7,24,15]),import.meta.url)),Tr=(0,A.lazy)(()=>u(()=>import(`./WorkersPro-Dk4NfplT.js`).then(e=>({default:e.WorkersPro})),__vite__mapDeps([51,1,2,3,4,5,18,10,11,23,13,14,19,15]),import.meta.url)),Q=(0,A.lazy)(()=>u(()=>import(`./Workflows-DZZA6aGW.js`).then(e=>({default:e.Workflows})),__vite__mapDeps([52,1,2,4,5,3,9,10,12,23,14,13,19,29,28]),import.meta.url)),Er=(0,A.lazy)(()=>u(()=>import(`./Alerts-C961Al5D.js`).then(e=>({default:e.Alerts})),__vite__mapDeps([53,1,2,4,18,11,12,23,13,14,19,7]),import.meta.url)),Dr=(0,A.lazy)(()=>u(()=>import(`./Fleet-Bdrj9bLI.js`).then(e=>({default:e.Fleet})),__vite__mapDeps([54,1,2,4,10,11,12,13,14,29]),import.meta.url)),Or=(0,A.lazy)(()=>u(()=>import(`./Cron-1DZTZWXO.js`).then(e=>({default:e.Cron})),__vite__mapDeps([55,1,2,18,27,4,5,10,11,23,13,14,19,24,15]),import.meta.url)),kr=(0,A.lazy)(()=>u(()=>import(`./Dlq-mtInIoTh.js`).then(e=>({default:e.Dlq})),__vite__mapDeps([56,1,2,18,27,4,5,10,11,23,13,14,19,7,24,31,57,3,46]),import.meta.url)),Ar=(0,A.lazy)(()=>u(()=>import(`./Jobs-ELSH1Wbd.js`).then(e=>({default:e.Jobs})),__vite__mapDeps([57,1,2,3,4,5,18,27,10,23,14,13,19,7,31,46]),import.meta.url)),jr=(0,A.lazy)(()=>u(()=>import(`./Logs-DMukqmHy.js`).then(e=>({default:e.Logs})),__vite__mapDeps([58,1,2,18,10,4,23,14,13,19,7,24,57,3,5,27,31,46]),import.meta.url)),Mr=(0,A.lazy)(()=>u(()=>import(`./Metrics-Cm5ZvfTo.js`).then(e=>({default:e.Metrics})),__vite__mapDeps([59,2,1,27,4,5,10,12,23,13,14,19]),import.meta.url)),Nr=(0,A.lazy)(()=>u(()=>import(`./Overview-CKAA3h9f.js`).then(e=>({default:e.Overview})),__vite__mapDeps([60,2,1,18,27,4,5,10,12,23,13,14,19]),import.meta.url)),Pr=(0,A.lazy)(()=>u(()=>import(`./QueueDetail-BRDATlp0.js`).then(e=>({default:e.QueueDetail})),__vite__mapDeps([61,1,2,3,4,5,18,27,10,11,12,23,14,19,7,15,31]),import.meta.url)),Fr=(0,A.lazy)(()=>u(()=>import(`./Queues-BV99vr68.js`).then(e=>({default:e.Queues})),__vite__mapDeps([62,1,2,18,27,4,5,10,23,13,14,19,24]),import.meta.url)),Ir=(0,A.lazy)(()=>u(()=>import(`./S3Backup-DNABHR2Q.js`).then(e=>({default:e.S3Backup})),__vite__mapDeps([63,2,1,27,4,5,10,12,23,13,14]),import.meta.url)),Lr=(0,A.lazy)(()=>u(()=>import(`./Settings-CL7odwoU.js`).then(e=>({default:e.Settings})),__vite__mapDeps([64,1,2,4,18,11,12,13,14,7]),import.meta.url)),Rr=(0,A.lazy)(()=>u(()=>import(`./Usage-BWZkz7Se.js`).then(e=>({default:e.Usage})),__vite__mapDeps([65,2,1,27,4,5,10,12,23,13,14,19]),import.meta.url)),zr=(0,A.lazy)(()=>u(()=>import(`./Workers-CBEDvXm_.js`).then(e=>({default:e.Workers})),__vite__mapDeps([66,1,2,18,27,4,5,10,23,13,14,19,24]),import.meta.url));function Br(){return(0,I.jsx)(r,{children:(0,I.jsxs)(f,{element:(0,I.jsx)(jn,{}),children:[(0,I.jsx)(f,{path:`/`,element:(0,I.jsx)(nr,{})}),(0,I.jsx)(f,{path:`/fleet`,element:(0,I.jsx)(Dr,{})}),(0,I.jsx)(f,{path:`/overview-classic`,element:(0,I.jsx)(Nr,{})}),(0,I.jsx)(f,{path:`/queues`,element:(0,I.jsx)(br,{})}),(0,I.jsx)(f,{path:`/queues-classic`,element:(0,I.jsx)(Fr,{})}),(0,I.jsx)(f,{path:`/queues/:name`,element:(0,I.jsx)(yr,{})}),(0,I.jsx)(f,{path:`/queues-classic/:name`,element:(0,I.jsx)(Pr,{})}),(0,I.jsx)(f,{path:`/jobs`,element:(0,I.jsx)(mr,{})}),(0,I.jsx)(f,{path:`/jobs-classic`,element:(0,I.jsx)(Ar,{})}),(0,I.jsx)(f,{path:`/dlq`,element:(0,I.jsx)(dr,{})}),(0,I.jsx)(f,{path:`/dlq-classic`,element:(0,I.jsx)(kr,{})}),(0,I.jsx)(f,{path:`/cron`,element:(0,I.jsx)(sr,{})}),(0,I.jsx)(f,{path:`/cron-classic`,element:(0,I.jsx)(Or,{})}),(0,I.jsx)(f,{path:`/flows`,element:(0,I.jsx)(fr,{})}),(0,I.jsx)(f,{path:`/workflows`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/workflows/executions`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/workflows/waiting`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/workflows/compensation`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/workflows/archive`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/metrics`,element:(0,I.jsx)(_r,{})}),(0,I.jsx)(f,{path:`/metrics-classic`,element:(0,I.jsx)(Mr,{})}),(0,I.jsx)(f,{path:`/workers`,element:(0,I.jsx)(Tr,{})}),(0,I.jsx)(f,{path:`/workers-classic`,element:(0,I.jsx)(zr,{})}),(0,I.jsx)(f,{path:`/logs`,element:(0,I.jsx)(hr,{})}),(0,I.jsx)(f,{path:`/logs-classic`,element:(0,I.jsx)(jr,{})}),(0,I.jsx)(f,{path:`/server`,element:(0,I.jsx)(Sr,{})}),(0,I.jsx)(f,{path:`/add-job`,element:(0,I.jsx)(ir,{})}),(0,I.jsx)(f,{path:`/jobs/bulk-add`,element:(0,I.jsx)(or,{})}),(0,I.jsx)(f,{path:`/job`,element:(0,I.jsx)(pr,{})}),(0,I.jsx)(f,{path:`/queue-control`,element:(0,I.jsx)(vr,{})}),(0,I.jsx)(f,{path:`/cron-manager`,element:(0,I.jsx)(n,{to:`/cron`,replace:!0})}),(0,I.jsx)(f,{path:`/dlq-control`,element:(0,I.jsx)(ur,{})}),(0,I.jsx)(f,{path:`/webhooks`,element:(0,I.jsx)(wr,{})}),(0,I.jsx)(f,{path:`/diagnostics`,element:(0,I.jsx)(lr,{})}),(0,I.jsx)(f,{path:`/alerts`,element:(0,I.jsx)(Er,{})}),(0,I.jsx)(f,{path:`/benchmark`,element:(0,I.jsx)(ar,{})}),(0,I.jsx)(f,{path:`/database`,element:(0,I.jsx)(cr,{})}),(0,I.jsx)(f,{path:`/mcp`,element:(0,I.jsx)(gr,{})}),(0,I.jsx)(f,{path:`/usage`,element:(0,I.jsx)(Cr,{})}),(0,I.jsx)(f,{path:`/usage-classic`,element:(0,I.jsx)(Rr,{})}),(0,I.jsx)(f,{path:`/s3`,element:(0,I.jsx)(xr,{})}),(0,I.jsx)(f,{path:`/s3-classic`,element:(0,I.jsx)(Ir,{})}),(0,I.jsx)(f,{path:`/settings`,element:(0,I.jsx)(Lr,{})}),(0,I.jsx)(f,{path:`*`,element:(0,I.jsx)(rr,{})})]})})}var $=new WeakMap;function Vr(e,t){let n=document.createElement(`div`);n.setAttribute(`role`,`alert`),n.style.cssText=`padding:2rem;font:14px/1.6 system-ui,sans-serif;max-width:44rem;margin:auto`;let r=document.createElement(`h1`);r.style.cssText=`font-size:1.1rem;font-weight:600;margin-bottom:.5rem`,r.textContent=`Demo data failed to load`;let i=document.createElement(`p`);i.textContent=`This build serves canned data from a bundled chunk that could not be fetched, so there is no backend to talk to. Reload the page (a hard refresh clears a stale cached index.html).`;let a=document.createElement(`p`);a.style.cssText=`margin-top:.75rem;opacity:.7;font-family:ui-monospace,monospace`,a.textContent=t instanceof Error?t.message:String(t),n.append(r,i,a),e.replaceChildren(n)}function Hr({root:e,demo:t,loadDemo:n,render:r,reportError:i=e=>console.error(`[demo] failed to load the demo backend`,e)}){let a=$.get(e);if(a)return a===!0?void 0:a;if(!t){$.set(e,!0);try{r()}catch(t){throw $.delete(e),t}return}let o=Promise.resolve().then(async()=>{let t;try{t=await n(),t.installDemo()}catch(t){try{i(t)}catch{}Vr(e,t);return}r()});return $.set(e,o),o}It();var Ur=document.getElementById(`root`);if(!Ur)throw Error(`Root element #root not found`);function Wr(){(0,Le.createRoot)(Ur).render((0,I.jsx)(A.StrictMode,{children:(0,I.jsx)(c,{basename:b(te(`__BUNQUEUE_BASE_PATH__`),`./`),children:(0,I.jsx)(Br,{})})}))}Hr({root:Ur,demo:H(),loadDemo:()=>u(()=>import(`./install-oydLpc1T.js`),[],import.meta.url),render:Wr});export{Bt as a,P as c,St as d,at as f,H as i,Dt as l,q as n,V as o,M as p,pn as r,F as s,Qn as t,N as u};
|
|
8
|
+
`),r,i;if(e!==-1&&(n===-1||e<=n))r=e,i=2;else if(n!==-1)r=n,i=4;else{if(d.length>262144)throw Error(`SSE frame exceeds the ${Un}-character limit`);break}if(r>262144)throw Error(`SSE frame exceeds the ${Un}-character limit`);let a=d.slice(0,r);d=d.slice(r+i);let o=Vn(a.replace(/\r/g,``));o&&t(o)}}}finally{l.releaseLock()}}finally{clearTimeout(s),n.removeEventListener(`abort`,o),a.abort()}}var Y={total:0,completed:0,failed:0,waiting:0,active:0},Gn=250,Kn=()=>typeof performance<`u`?performance.now():Date.now();function qn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X(e,t){return typeof e==`string`&&e.length<=t?e:void 0}function Jn(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function Yn(e,t){let n=Jn(e);return n!==void 0&&Math.abs(n)<=864e13?n:Number.isFinite(t)&&Math.abs(t)<=864e13?t:0}function Xn(e){let t=qn(e)?e:{},n=Date.now();return{queue:X(t.queue,256),jobId:X(t.jobId,1024),name:X(t.name,512),timestamp:Yn(t.timestamp,n),error:X(t.error,4096),progress:Jn(t.progress)}}function Zn(e){let t=e.includes(`:`)?e.split(`:`)[1]:e;switch(t){case`pushed`:case`added`:return`waiting`;case`pulled`:return`active`;case`progress`:return`active`;default:return t}}function Qn(e){let t=S(e=>e.baseUrl),n=S(e=>e.token),[r,i]=(0,A.useState)([]),[a,o]=(0,A.useState)(Y),[s,c]=(0,A.useState)(0),[l,u]=(0,A.useState)(!1),[d,f]=(0,A.useState)(null),p=(0,A.useRef)([]),m=(0,A.useRef)(0),h=JSON.stringify([t,n,e??null]),g=(0,A.useRef)(h),_=g.current===h,v=_?r:[],y=_?a:Y,b=_?s:0,x=_?l:!1,ee=_?d:null;return(0,A.useEffect)(()=>{let t=new AbortController,n=++m.current,r=0,a=!1,s=[],l={...Y},d,_=()=>!a&&m.current===n;g.current=h,i([]),o(Y),c(0),u(!1),f(null),p.current=[];let v=e=>new Promise(n=>{let r=()=>{clearTimeout(i),n()},i=setTimeout(()=>{t.signal.removeEventListener(`abort`,r),n()},e);t.signal.addEventListener(`abort`,r,{once:!0})}),y=e=>{if(!_()||(e.id!==void 0&&(d=e.id||void 0),Bn(e)&&(u(e=>_()?!0:e),f(e=>_()?null:e)),!e.event.startsWith(`job:`)))return;let t=Xn(e.data),n=Zn(e.event),i={seq:++r,event:e.event,queue:t.queue,jobId:t.jobId,name:t.name,status:n,timestamp:t.timestamp,error:t.error,progress:t.progress};s.push(i);let a=l;a.total+=1,n===`completed`?a.completed+=1:n===`failed`?a.failed+=1:n===`waiting`?a.waiting+=1:n===`active`&&(a.active+=1),p.current.push(Kn())};(async()=>{let n=0;for(;!a;){let r=null,i=d,a=!1;try{await Wn(we.eventsUrl(e),e=>{a=!0,y(e)},t.signal,void 0,i)}catch(e){r=e instanceof Error?e:Error(String(e))}if(i&&!a&&d===i&&Rn(r)&&(d=void 0),!_())break;u(e=>!_()&&e),f(e=>_()?r:e),n=r?Math.min(n+1,8):0,await v(2e3*Math.max(1,n))}})();let b=setInterval(()=>{if(!_())return;if(s.length){let e=s;s=[],e.reverse(),i(t=>_()?[...e,...t].slice(0,Gn):t)}let e=l;e.total&&(l={...Y},o(t=>_()?{total:t.total+e.total,completed:t.completed+e.completed,failed:t.failed+e.failed,waiting:t.waiting+e.waiting,active:t.active+e.active}:t))},150);return()=>{a=!0,m.current===n&&(m.current+=1),t.abort(),clearInterval(b)}},[e,t,n,h]),(0,A.useEffect)(()=>{let e=setInterval(()=>{let e=Kn();p.current=p.current.filter(t=>t<=e&&e-t<5e3),c(p.current.length/5)},1e3);return()=>clearInterval(e)},[]),{events:v,counters:y,throughput:b,connected:x,error:ee}}function $n(){let{events:e,connected:n,error:r}=Qn();return(0,I.jsxs)(`div`,{className:`mt-8`,children:[(0,I.jsx)(er,{title:`Recent Activity`,to:`/logs`}),(0,I.jsxs)(O,{padded:!1,children:[r&&e.length>0&&(0,I.jsxs)(`p`,{className:`border-b border-line px-5 py-2 text-xs text-warning`,children:[`Event stream unavailable — `,r.message,`. Reconnecting…`]}),e.length===0?(0,I.jsx)(`p`,{role:r?`alert`:void 0,className:t(`py-8 text-center text-sm`,r?`text-warning`:`text-faint`),children:r?`Event stream unavailable — ${r.message}. Reconnecting…`:n?`Waiting for live activity…`:`Connecting to the event stream…`}):(0,I.jsx)(`ul`,{className:`divide-y divide-line`,children:e.slice(0,8).map(e=>(0,I.jsxs)(`li`,{className:`flex items-center justify-between px-5 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`span`,{className:t(`size-2 rounded-full`,tr(e.status))}),(0,I.jsxs)(`div`,{className:`text-sm`,children:[(0,I.jsx)(`span`,{className:`font-mono font-medium text-fg`,children:e.queue||`—`}),(0,I.jsx)(`span`,{className:`text-faint`,children:` · `}),(0,I.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:e.jobId?e.jobId.slice(0,8):`—`}),(0,I.jsx)(`span`,{className:`text-faint`,children:` · `}),(0,I.jsx)(`span`,{className:`capitalize text-muted`,children:e.status})]})]}),(0,I.jsx)(`span`,{className:`text-xs text-faint`,children:Me(e.timestamp)})]},e.seq))})]})]})}function er({title:e,to:t}){return(0,I.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,I.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:e}),(0,I.jsxs)(d,{to:t,className:`flex items-center gap-1 text-sm text-muted hover:text-fg`,children:[`View All `,(0,I.jsx)(ge,{className:`size-3.5`})]})]})}function Z({label:e,value:n,tone:r}){return(0,I.jsxs)(`span`,{children:[e,` `,(0,I.jsx)(`span`,{className:t(`tnum font-semibold`,r),children:n==null?`—`:k(n)})]})}function tr(e){return e===`completed`?`bg-emerald-400`:e===`failed`?`bg-red-400`:e===`active`?`bg-blue-400`:e===`waiting`?`bg-amber-400`:`bg-accent`}function nr(){let e=S(e=>e.baseUrl),n=(0,A.useRef)(null),{data:r,error:i,loading:a,refetch:o}=Te(async()=>{let[e,t]=await Promise.all([w.overview(),w.queuesSummary()]);Fn(e);let r=[...t].sort((e,t)=>(t.counts?.failed??0)-(e.counts?.failed??0)||(t.counts?.waiting??0)+(t.counts?.prioritized??0)-((e.counts?.waiting??0)+(e.counts?.prioritized??0))).slice(0,6).map(e=>({name:e.name,paused:e.paused,counts:e.counts})),i=t.reduce((e,t)=>e+(t.counts?.failed??0),0),a=t.reduce((e,t)=>e+t.counts.waiting+t.counts.prioritized,0);return n.current=Date.now(),{overview:e,queuesTotal:t.length,details:r,failedTotal:i,readyTotal:a}},[]);if(a&&!r&&!i)return(0,I.jsx)(ke,{label:`Loading overview…`});if(i&&!r)return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(Ae,{title:`Overview`,description:`Real-time system health is unavailable.`}),(0,I.jsx)(Oe,{error:i,onRetry:o})]});let{overview:s,queuesTotal:c,details:l,failedTotal:u,readyTotal:f}=r??Nn,{stats:p,throughput:m,memory:h,crons:g}=s,_=Fe(p.completed,u),v=e===`/api`?`localhost:6790`:e.replace(/^https?:\/\//,``),y=p.uptime?Ie(p.uptime/1e3):`—`,b=Ne(h.rss*1024*1024),x=!!i;return(0,I.jsxs)(`div`,{children:[(0,I.jsx)(Ae,{title:`Overview`,description:`Real-time system health at a glance.`,live:!!r&&!i}),i&&(0,I.jsx)(De,{message:`Connection lost — showing the last successful overview snapshot.`,onRetry:o}),(0,I.jsxs)(`div`,{className:t(`mb-6 flex flex-wrap items-center justify-between gap-y-2 rounded-xl border px-5 py-4`,x?`border-amber-500/25 bg-amber-500/[0.06]`:`border-emerald-500/25 bg-emerald-500/[0.06]`),children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,I.jsxs)(`span`,{className:`relative flex size-2.5`,children:[!x&&(0,I.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-emerald-400 opacity-60`}),(0,I.jsx)(`span`,{className:t(`relative inline-flex size-2.5 rounded-full`,x?`bg-amber-400`:`bg-emerald-400`)})]}),(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:t(`font-semibold`,x?`text-warning`:`text-success`),children:x?`Connection lost — showing last known data`:`bunqueue server connected`}),(0,I.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted`,children:[v,` · uptime `,y,` · `,b,` RAM`,x&&(0,I.jsxs)(I.Fragment,{children:[` `,`· last updated `,n.current?Me(n.current):`never`]})]})]})]}),(0,I.jsx)(`span`,{className:t(`rounded-full px-3 py-1 text-xs font-medium`,x?`bg-amber-500/15 text-warning`:`bg-emerald-500/15 text-success`),children:x?`Stale`:`Online`})]}),(0,I.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-3`,children:[(0,I.jsx)(q,{label:`Error Rate`,value:_==null?`—`:je(_),tone:_==null?`default`:_>.05?`red`:`green`,hint:`failed / processed`}),(0,I.jsx)(q,{label:`Failed`,value:k(u),tone:u?`red`:`default`,hint:`recorded across queues`}),(0,I.jsx)(q,{label:`DLQ`,value:k(p.dlq),tone:p.dlq?`red`:`default`,hint:`dead-lettered jobs`})]}),(0,I.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,I.jsx)(q,{label:`Completed`,value:k(p.completed),tone:`green`,compact:!0}),(0,I.jsx)(q,{label:`Active`,value:k(p.active),tone:`blue`,compact:!0}),(0,I.jsx)(q,{label:`Ready backlog`,value:k(f),tone:f>100?`amber`:`default`,hint:`waiting + prioritized`,compact:!0}),(0,I.jsx)(q,{label:`Push/sec`,value:m.pushPerSec.toFixed(1),tone:`accent`,hint:`${Pe(p.totalPushed)} since restart`,compact:!0}),(0,I.jsx)(q,{label:`Pull/sec`,value:m.pullPerSec.toFixed(1),tone:`accent`,hint:`${Pe(p.totalPulled)} since restart`,compact:!0}),(0,I.jsx)(q,{label:`Queues`,value:k(c),hint:`${g.total} cron active`,compact:!0})]}),(0,I.jsxs)(`div`,{className:`mt-8`,children:[(0,I.jsx)(er,{title:`Queue Health — most loaded`,to:`/queues`}),l.length===0?(0,I.jsx)(O,{children:(0,I.jsx)(`p`,{className:`py-4 text-center text-sm text-faint`,children:`No queues yet.`})}):(0,I.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:l.map(e=>(0,I.jsxs)(d,{to:`/queues/${encodeURIComponent(e.name)}`,className:`rounded-xl border border-line bg-surface p-4 transition-colors hover:border-line-strong`,children:[(0,I.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,I.jsx)(`span`,{className:`truncate font-mono text-sm font-medium text-accent`,children:e.name}),(0,I.jsx)(`span`,{className:t(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-success`),children:e.paused?`paused`:`active`})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs text-faint`,children:[(0,I.jsx)(Z,{label:`W`,value:e.counts?.waiting,tone:`text-warning`}),(0,I.jsx)(Z,{label:`P`,value:e.counts?.prioritized,tone:`text-orange-400`}),(0,I.jsx)(Z,{label:`A`,value:e.counts?.active,tone:`text-blue-400`}),(0,I.jsx)(Z,{label:`C`,value:e.counts?.completed,tone:`text-success`}),(0,I.jsx)(Z,{label:`F`,value:e.counts?.failed,tone:`text-danger`})]})]},e.name))})]}),(0,I.jsx)($n,{})]})}function rr(){return(0,I.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 py-24 text-center`,children:[(0,I.jsx)(`h1`,{className:`text-5xl font-bold text-faint`,children:`404`}),(0,I.jsx)(`p`,{className:`text-sm text-muted`,children:`This page does not exist.`}),(0,I.jsx)(d,{to:`/`,className:`rounded-lg border border-line bg-surface-2 px-4 py-2 text-sm font-medium text-fg hover:border-line-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`Back to Overview`})]})}var ir=(0,A.lazy)(()=>u(()=>import(`./AddJob-FNaPbs_V.js`).then(e=>e.t).then(e=>({default:e.AddJob})),__vite__mapDeps([8,1,2,5,3,4,9,10,11,12,13,14,7,15,16]),import.meta.url)),ar=(0,A.lazy)(()=>u(()=>import(`./Benchmark-C16tT4pF.js`).then(e=>({default:e.Benchmark})),__vite__mapDeps([17,1,2,4,3,5,18,10,11,12,13,14,19,7,20]),import.meta.url)),or=(0,A.lazy)(()=>u(()=>import(`./BulkAddJobs-IiL1uud0.js`).then(e=>({default:e.BulkAddJobs})),__vite__mapDeps([21,1,2,5,3,4,9,10,11,12,13,14,7,15,16]),import.meta.url)),sr=(0,A.lazy)(()=>u(()=>import(`./CronManager-B6xLLgI5.js`).then(e=>({default:e.CronManager})),__vite__mapDeps([22,1,2,5,3,4,9,18,10,11,12,23,13,14,19,7,24,15,16,8]),import.meta.url)),cr=(0,A.lazy)(()=>u(()=>import(`./Database-DV2pcDLL.js`).then(e=>({default:e.Database})),__vite__mapDeps([25,1,2,4,3,5,9,18,10,11,12,23,13,14,19,7,24]),import.meta.url)),lr=(0,A.lazy)(()=>u(()=>import(`./Diagnostics-B6apZrC5.js`).then(e=>({default:e.Diagnostics})),__vite__mapDeps([26,1,2,3,4,5,9,27,10,11,12,23,14,13,19,28,29]),import.meta.url)),ur=(0,A.lazy)(()=>u(()=>import(`./DlqControl-DNJPVOTF.js`).then(e=>({default:e.DlqControl})),__vite__mapDeps([30,1,2,3,4,5,9,18,10,11,23,13,14,19,7,24,31,32,33,12,15,29,28,34]),import.meta.url)),dr=(0,A.lazy)(()=>u(()=>import(`./DlqPro-CwtTDwGN.js`).then(e=>({default:e.DlqPro})),__vite__mapDeps([35,1,2,3,4,5,9,18,10,11,12,23,13,14,19,7,24,31,32,33,15,29,28,34]),import.meta.url)),fr=(0,A.lazy)(()=>u(()=>import(`./Flows-1dC8F_wx.js`).then(e=>({default:e.Flows})),__vite__mapDeps([36,1,2,4,5,3,12,23,13,14,29,28,37]),import.meta.url)),pr=(0,A.lazy)(()=>u(()=>import(`./JobInspector-Ct9Ga-UT.js`).then(e=>({default:e.JobInspector})),__vite__mapDeps([38,1,2,4,5,3,18,11,12,23,14,13,19,7,31,32,37]),import.meta.url)),mr=(0,A.lazy)(()=>u(()=>import(`./JobsPro-CLzOhKAL.js`).then(e=>({default:e.JobsPro})),__vite__mapDeps([39,1,2,3,4,5,9,18,10,11,23,14,13,19,7,24,15,32,37]),import.meta.url)),hr=(0,A.lazy)(()=>u(()=>import(`./LogsPro-B3KwTSsn.js`).then(e=>({default:e.LogsPro})),__vite__mapDeps([40,1,2,4,18,10,11,23,14,13,19,7,24,33,3,5,12,15,29,28,34,31]),import.meta.url)),gr=(0,A.lazy)(()=>u(()=>import(`./McpServer-fVy27Mof.js`).then(e=>({default:e.McpServer})),__vite__mapDeps([41,2,1,12,13,14]),import.meta.url)),_r=(0,A.lazy)(()=>u(()=>import(`./MetricsPro-B9rD_KQc.js`).then(e=>({default:e.MetricsPro})),__vite__mapDeps([42,1,2,3,4,5,10,12,23,13,14,19,24,20,43]),import.meta.url)),vr=(0,A.lazy)(()=>u(()=>import(`./QueueControl-DqBvuDnF.js`).then(e=>({default:e.QueueControl})),__vite__mapDeps([33,1,2,3,4,5,10,11,12,23,14,13,19,7,15,29,28,34,31]),import.meta.url)),yr=(0,A.lazy)(()=>u(()=>import(`./QueueDetailPro-ClKtyHIf.js`).then(e=>({default:e.QueueDetailPro})),__vite__mapDeps([44,1,2,3,4,5,9,18,10,11,12,23,14,13,19,15,31,29,20,34,7,43]),import.meta.url)),br=(0,A.lazy)(()=>u(()=>import(`./QueuesOverview-tokquA3g.js`).then(e=>({default:e.QueuesOverview})),__vite__mapDeps([45,1,2,3,4,5,9,18,10,11,23,13,14,19,24,15,46]),import.meta.url)),xr=(0,A.lazy)(()=>u(()=>import(`./S3BackupPro-CDX5WQUY.js`).then(e=>({default:e.S3BackupPro})),__vite__mapDeps([47,1,2,4,3,5,18,10,11,12,13,14,7]),import.meta.url)),Sr=(0,A.lazy)(()=>u(()=>import(`./ServerControl-BmccMNW9.js`).then(e=>({default:e.ServerControl})),__vite__mapDeps([48,1,2,3,4,5,18,10,11,12,23,13,14,19,7,28,29]),import.meta.url)),Cr=(0,A.lazy)(()=>u(()=>import(`./UsagePro-BGLufsE7.js`).then(e=>({default:e.UsagePro})),__vite__mapDeps([49,2,1,3,4,5,10,12,23,13,14,19]),import.meta.url)),wr=(0,A.lazy)(()=>u(()=>import(`./Webhooks-DT2LK17V.js`).then(e=>({default:e.Webhooks})),__vite__mapDeps([50,1,2,3,4,5,9,18,10,11,12,23,13,14,19,7,24,15]),import.meta.url)),Tr=(0,A.lazy)(()=>u(()=>import(`./WorkersPro-BsUQVgQZ.js`).then(e=>({default:e.WorkersPro})),__vite__mapDeps([51,1,2,3,4,5,18,10,11,23,13,14,19,15]),import.meta.url)),Q=(0,A.lazy)(()=>u(()=>import(`./Workflows-DZZA6aGW.js`).then(e=>({default:e.Workflows})),__vite__mapDeps([52,1,2,4,5,3,9,10,12,23,14,13,19,29,28]),import.meta.url)),Er=(0,A.lazy)(()=>u(()=>import(`./Alerts-vzIYtFpW.js`).then(e=>({default:e.Alerts})),__vite__mapDeps([53,1,2,4,18,11,12,23,13,14,19,7]),import.meta.url)),Dr=(0,A.lazy)(()=>u(()=>import(`./Fleet-Bdrj9bLI.js`).then(e=>({default:e.Fleet})),__vite__mapDeps([54,1,2,4,10,11,12,13,14,29]),import.meta.url)),Or=(0,A.lazy)(()=>u(()=>import(`./Cron-1DZTZWXO.js`).then(e=>({default:e.Cron})),__vite__mapDeps([55,1,2,18,27,4,5,10,11,23,13,14,19,24,15]),import.meta.url)),kr=(0,A.lazy)(()=>u(()=>import(`./Dlq-MRmkQrNC.js`).then(e=>({default:e.Dlq})),__vite__mapDeps([56,1,2,18,27,4,5,10,11,23,13,14,19,7,24,31,57,3,46]),import.meta.url)),Ar=(0,A.lazy)(()=>u(()=>import(`./Jobs-Chqv0RuL.js`).then(e=>({default:e.Jobs})),__vite__mapDeps([57,1,2,3,4,5,18,27,10,23,14,13,19,7,31,46]),import.meta.url)),jr=(0,A.lazy)(()=>u(()=>import(`./Logs-C5PNP9Wq.js`).then(e=>({default:e.Logs})),__vite__mapDeps([58,1,2,18,10,4,23,14,13,19,7,24,57,3,5,27,31,46]),import.meta.url)),Mr=(0,A.lazy)(()=>u(()=>import(`./Metrics-Ba46pdzT.js`).then(e=>({default:e.Metrics})),__vite__mapDeps([59,2,1,27,4,5,10,12,23,13,14,19]),import.meta.url)),Nr=(0,A.lazy)(()=>u(()=>import(`./Overview-DV2qo5v3.js`).then(e=>({default:e.Overview})),__vite__mapDeps([60,2,1,18,27,4,5,10,12,23,13,14,19]),import.meta.url)),Pr=(0,A.lazy)(()=>u(()=>import(`./QueueDetail-COSH9bJl.js`).then(e=>({default:e.QueueDetail})),__vite__mapDeps([61,1,2,3,4,5,18,27,10,11,12,23,14,19,7,15,31]),import.meta.url)),Fr=(0,A.lazy)(()=>u(()=>import(`./Queues-D2-R8nYh.js`).then(e=>({default:e.Queues})),__vite__mapDeps([62,1,2,18,27,4,5,10,23,13,14,19,24]),import.meta.url)),Ir=(0,A.lazy)(()=>u(()=>import(`./S3Backup-DNABHR2Q.js`).then(e=>({default:e.S3Backup})),__vite__mapDeps([63,2,1,27,4,5,10,12,23,13,14]),import.meta.url)),Lr=(0,A.lazy)(()=>u(()=>import(`./Settings-UcujwvKv.js`).then(e=>({default:e.Settings})),__vite__mapDeps([64,1,2,4,18,11,12,13,14,7]),import.meta.url)),Rr=(0,A.lazy)(()=>u(()=>import(`./Usage-1KxG1mJ9.js`).then(e=>({default:e.Usage})),__vite__mapDeps([65,2,1,27,4,5,10,12,23,13,14,19]),import.meta.url)),zr=(0,A.lazy)(()=>u(()=>import(`./Workers-BX1qspaQ.js`).then(e=>({default:e.Workers})),__vite__mapDeps([66,1,2,18,27,4,5,10,23,13,14,19,24]),import.meta.url));function Br(){return(0,I.jsx)(r,{children:(0,I.jsxs)(f,{element:(0,I.jsx)(jn,{}),children:[(0,I.jsx)(f,{path:`/`,element:(0,I.jsx)(nr,{})}),(0,I.jsx)(f,{path:`/fleet`,element:(0,I.jsx)(Dr,{})}),(0,I.jsx)(f,{path:`/overview-classic`,element:(0,I.jsx)(Nr,{})}),(0,I.jsx)(f,{path:`/queues`,element:(0,I.jsx)(br,{})}),(0,I.jsx)(f,{path:`/queues-classic`,element:(0,I.jsx)(Fr,{})}),(0,I.jsx)(f,{path:`/queues/:name`,element:(0,I.jsx)(yr,{})}),(0,I.jsx)(f,{path:`/queues-classic/:name`,element:(0,I.jsx)(Pr,{})}),(0,I.jsx)(f,{path:`/jobs`,element:(0,I.jsx)(mr,{})}),(0,I.jsx)(f,{path:`/jobs-classic`,element:(0,I.jsx)(Ar,{})}),(0,I.jsx)(f,{path:`/dlq`,element:(0,I.jsx)(dr,{})}),(0,I.jsx)(f,{path:`/dlq-classic`,element:(0,I.jsx)(kr,{})}),(0,I.jsx)(f,{path:`/cron`,element:(0,I.jsx)(sr,{})}),(0,I.jsx)(f,{path:`/cron-classic`,element:(0,I.jsx)(Or,{})}),(0,I.jsx)(f,{path:`/flows`,element:(0,I.jsx)(fr,{})}),(0,I.jsx)(f,{path:`/workflows`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/workflows/executions`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/workflows/waiting`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/workflows/compensation`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/workflows/archive`,element:(0,I.jsx)(Q,{})}),(0,I.jsx)(f,{path:`/metrics`,element:(0,I.jsx)(_r,{})}),(0,I.jsx)(f,{path:`/metrics-classic`,element:(0,I.jsx)(Mr,{})}),(0,I.jsx)(f,{path:`/workers`,element:(0,I.jsx)(Tr,{})}),(0,I.jsx)(f,{path:`/workers-classic`,element:(0,I.jsx)(zr,{})}),(0,I.jsx)(f,{path:`/logs`,element:(0,I.jsx)(hr,{})}),(0,I.jsx)(f,{path:`/logs-classic`,element:(0,I.jsx)(jr,{})}),(0,I.jsx)(f,{path:`/server`,element:(0,I.jsx)(Sr,{})}),(0,I.jsx)(f,{path:`/add-job`,element:(0,I.jsx)(ir,{})}),(0,I.jsx)(f,{path:`/jobs/bulk-add`,element:(0,I.jsx)(or,{})}),(0,I.jsx)(f,{path:`/job`,element:(0,I.jsx)(pr,{})}),(0,I.jsx)(f,{path:`/queue-control`,element:(0,I.jsx)(vr,{})}),(0,I.jsx)(f,{path:`/cron-manager`,element:(0,I.jsx)(n,{to:`/cron`,replace:!0})}),(0,I.jsx)(f,{path:`/dlq-control`,element:(0,I.jsx)(ur,{})}),(0,I.jsx)(f,{path:`/webhooks`,element:(0,I.jsx)(wr,{})}),(0,I.jsx)(f,{path:`/diagnostics`,element:(0,I.jsx)(lr,{})}),(0,I.jsx)(f,{path:`/alerts`,element:(0,I.jsx)(Er,{})}),(0,I.jsx)(f,{path:`/benchmark`,element:(0,I.jsx)(ar,{})}),(0,I.jsx)(f,{path:`/database`,element:(0,I.jsx)(cr,{})}),(0,I.jsx)(f,{path:`/mcp`,element:(0,I.jsx)(gr,{})}),(0,I.jsx)(f,{path:`/usage`,element:(0,I.jsx)(Cr,{})}),(0,I.jsx)(f,{path:`/usage-classic`,element:(0,I.jsx)(Rr,{})}),(0,I.jsx)(f,{path:`/s3`,element:(0,I.jsx)(xr,{})}),(0,I.jsx)(f,{path:`/s3-classic`,element:(0,I.jsx)(Ir,{})}),(0,I.jsx)(f,{path:`/settings`,element:(0,I.jsx)(Lr,{})}),(0,I.jsx)(f,{path:`*`,element:(0,I.jsx)(rr,{})})]})})}var $=new WeakMap;function Vr(e,t){let n=document.createElement(`div`);n.setAttribute(`role`,`alert`),n.style.cssText=`padding:2rem;font:14px/1.6 system-ui,sans-serif;max-width:44rem;margin:auto`;let r=document.createElement(`h1`);r.style.cssText=`font-size:1.1rem;font-weight:600;margin-bottom:.5rem`,r.textContent=`Demo data failed to load`;let i=document.createElement(`p`);i.textContent=`This build serves canned data from a bundled chunk that could not be fetched, so there is no backend to talk to. Reload the page (a hard refresh clears a stale cached index.html).`;let a=document.createElement(`p`);a.style.cssText=`margin-top:.75rem;opacity:.7;font-family:ui-monospace,monospace`,a.textContent=t instanceof Error?t.message:String(t),n.append(r,i,a),e.replaceChildren(n)}function Hr({root:e,demo:t,loadDemo:n,render:r,reportError:i=e=>console.error(`[demo] failed to load the demo backend`,e)}){let a=$.get(e);if(a)return a===!0?void 0:a;if(!t){$.set(e,!0);try{r()}catch(t){throw $.delete(e),t}return}let o=Promise.resolve().then(async()=>{let t;try{t=await n(),t.installDemo()}catch(t){try{i(t)}catch{}Vr(e,t);return}r()});return $.set(e,o),o}It();var Ur=document.getElementById(`root`);if(!Ur)throw Error(`Root element #root not found`);function Wr(){(0,Le.createRoot)(Ur).render((0,I.jsx)(A.StrictMode,{children:(0,I.jsx)(c,{basename:b(te(`__BUNQUEUE_BASE_PATH__`),`./`),children:(0,I.jsx)(Br,{})})}))}Hr({root:Ur,demo:H(),loadDemo:()=>u(()=>import(`./install-oydLpc1T.js`),[],import.meta.url),render:Wr});export{Bt as a,P as c,St as d,at as f,H as i,Dt as l,q as n,V as o,M as p,pn as r,F as s,Qn as t,N as u};
|
package/dist/index.html
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
content="Fully drive a bunqueue server from one UI: queues, jobs, DLQ, cron, webhooks, workers, and start/stop/restart. Live demo, no signup."
|
|
50
50
|
/>
|
|
51
51
|
<meta name="twitter:image" content="https://egeominotti.github.io/bunqueue-dashboard/og.png" />
|
|
52
|
-
<script type="module" crossorigin src="./assets/index-
|
|
52
|
+
<script type="module" crossorigin src="./assets/index-8Ii-_Rml.js"></script>
|
|
53
53
|
<link rel="modulepreload" crossorigin href="./assets/cn-zFEt5SO8.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="./assets/react-vendor-CvwrP0tU.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="./assets/connectionStore-BJLihGaC.js">
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunqueue-dashboard",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Web dashboard for a bunqueue server (queues, jobs, DLQ, cron, metrics, workers, live activity). Run with `bunx bunqueue-dashboard` (requires Bun 1.4.
|
|
6
|
-
"packageManager": "bun@1.4.
|
|
5
|
+
"description": "Web dashboard for a bunqueue server (queues, jobs, DLQ, cron, metrics, workers, live activity). Run with `bunx bunqueue-dashboard` (requires Bun 1.4.2).",
|
|
6
|
+
"packageManager": "bun@1.4.2",
|
|
7
7
|
"bin": {
|
|
8
8
|
"bunqueue-dashboard": "scripts/serve.ts"
|
|
9
9
|
},
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"scripts/bunVersion.ts",
|
|
16
16
|
"scripts/embedded.gen.ts",
|
|
17
17
|
"agent",
|
|
18
|
-
"shared"
|
|
18
|
+
"shared",
|
|
19
|
+
"patches"
|
|
19
20
|
],
|
|
20
21
|
"publishConfig": {
|
|
21
22
|
"access": "public"
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"react"
|
|
49
50
|
],
|
|
50
51
|
"engines": {
|
|
51
|
-
"bun": "1.4.
|
|
52
|
+
"bun": "1.4.2"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
55
|
"prepack": "bun run version:check && bun run build && bun scripts/gen-embed.ts",
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"dev": "vite",
|
|
57
58
|
"agent": "bun run agent/index.ts",
|
|
58
59
|
"build": "bun run typecheck && vite build",
|
|
59
|
-
"typecheck": "tsc --noEmit && bun run typecheck:agent && bun run typecheck:examples",
|
|
60
|
+
"typecheck": "tsc --noEmit && bun run typecheck:agent && bun run typecheck:examples && bun run typecheck:e2e",
|
|
60
61
|
"typecheck:agent": "tsc -p tsconfig.agent.json",
|
|
61
62
|
"typecheck:examples": "tsc -p tsconfig.examples.json",
|
|
62
63
|
"size": "bun run scripts/check-bundle.ts",
|
|
@@ -88,7 +89,10 @@
|
|
|
88
89
|
"check": "bun run lint && bun run format:check",
|
|
89
90
|
"check:fix": "bun run lint:fix && bun run format",
|
|
90
91
|
"audit:high": "bun audit --audit-level=high --ignore=GHSA-qwww-vcr4-c8h2",
|
|
91
|
-
"quality": "bun run version:check && bun run architecture && bun run check && bun run build && bun run size && bun run docs:build && bun run test:coverage && bun run test:e2e && bun run test:package && bun run audit:high"
|
|
92
|
+
"quality": "bun run version:check && bun run architecture && bun run check && bun run build && bun run size && bun run docs:build && bun run test:coverage && bun run test:e2e && bun run test:package && bun run audit:high",
|
|
93
|
+
"typecheck:e2e": "tsc -p tsconfig.e2e.json",
|
|
94
|
+
"test:e2e:browser:managed": "bun run build && bun scripts/gen-embed.ts && playwright test -c playwright.managed.config.ts",
|
|
95
|
+
"test:e2e:docs": "bun run docs:build && playwright test -c playwright.docs.config.ts"
|
|
92
96
|
},
|
|
93
97
|
"devDependencies": {
|
|
94
98
|
"@ai-sdk/anthropic": "^4.0.7",
|
|
@@ -98,6 +102,7 @@
|
|
|
98
102
|
"@axe-core/playwright": "4.13.0",
|
|
99
103
|
"@fontsource-variable/inter": "^5.2.8",
|
|
100
104
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
|
105
|
+
"@modelcontextprotocol/sdk": "1.30.0",
|
|
101
106
|
"@playwright/test": "1.62.1",
|
|
102
107
|
"@shikijs/vitepress-twoslash": "^4.3.0",
|
|
103
108
|
"@tailwindcss/vite": "^4.3.2",
|
|
@@ -105,8 +110,8 @@
|
|
|
105
110
|
"@types/react": "^19.2.17",
|
|
106
111
|
"@types/react-dom": "^19.2.3",
|
|
107
112
|
"@vitejs/plugin-react": "^6.0.3",
|
|
108
|
-
"ai": "
|
|
109
|
-
"bun-types": "1.4.
|
|
113
|
+
"ai": "7.0.14",
|
|
114
|
+
"bun-types": "1.4.2",
|
|
110
115
|
"bunqueue-v2-9-2": "npm:bunqueue@2.9.2",
|
|
111
116
|
"happy-dom": "^20.10.6",
|
|
112
117
|
"mermaid": "^11.16.0",
|
|
@@ -135,5 +140,8 @@
|
|
|
135
140
|
"dependencies": {
|
|
136
141
|
"bunqueue": "2.9.4",
|
|
137
142
|
"msgpackr": "^1.11.8"
|
|
143
|
+
},
|
|
144
|
+
"patchedDependencies": {
|
|
145
|
+
"ai@7.0.14": "patches/ai@7.0.14.patch"
|
|
138
146
|
}
|
|
139
147
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
diff --git a/dist/index.js b/dist/index.js
|
|
2
|
+
index 6aae155eec4d3a72f4f9c37b01f84d9683788767..e6d182812f04f7e6f5f8c4e3f78040a76f3d836c 100644
|
|
3
|
+
--- a/dist/index.js
|
|
4
|
+
+++ b/dist/index.js
|
|
5
|
+
@@ -4082,6 +4082,8 @@ function openTelemetryChannelSpanContext({
|
|
6
|
+
}) {
|
|
7
|
+
var _a22;
|
|
8
|
+
if (!isNodeRuntime()) {
|
|
9
|
+
+ // Browser callers also create a completion promise that can reject on abort.
|
|
10
|
+
+ Promise.resolve(completion).catch(() => {});
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
const diagnosticsChannel = loadBuiltinModule(
|
|
14
|
+
diff --git a/src/telemetry/tracing-channel-publisher.ts b/src/telemetry/tracing-channel-publisher.ts
|
|
15
|
+
index 060be5e4d845e5490c852868390f4b97912735f3..4e167eb699164f6d121b52d295097aef51b48536 100644
|
|
16
|
+
--- a/src/telemetry/tracing-channel-publisher.ts
|
|
17
|
+
+++ b/src/telemetry/tracing-channel-publisher.ts
|
|
18
|
+
@@ -136,5 +136,7 @@ export function openTelemetryChannelSpanContext({
|
|
19
|
+
completion: PromiseLike<unknown>;
|
|
20
|
+
}): TracingChannelContext | undefined {
|
|
21
|
+
if (!isNodeRuntime()) {
|
|
22
|
+
+ // Browser callers also create a completion promise that can reject on abort.
|
|
23
|
+
+ Promise.resolve(completion).catch(() => {});
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
package/scripts/bunVersion.ts
CHANGED