bunqueue-dashboard 0.0.38 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +17 -9
  2. package/agent/backup/resultValidation.ts +1 -1
  3. package/agent/backup/routes.ts +63 -17
  4. package/agent/db/query.ts +2 -1
  5. package/agent/index.ts +3 -0
  6. package/agent/manager/config.ts +2 -1
  7. package/agent/manager/process.ts +51 -5
  8. package/agent/manager/storageMode.ts +41 -0
  9. package/agent/manager/types.ts +2 -0
  10. package/agent/manager.ts +1 -0
  11. package/agent/queue/routes.ts +56 -2
  12. package/agent/queue/runtime.ts +67 -1
  13. package/agent/queue/types.ts +32 -0
  14. package/agent/queue/validation.ts +16 -0
  15. package/agent/server/controlRoutes.ts +55 -45
  16. package/agent/server/controlStatus.ts +115 -0
  17. package/agent/server/databaseRoutes.ts +47 -14
  18. package/agent/server/errors.ts +1 -0
  19. package/agent/server/lifecycle.ts +25 -8
  20. package/agent/server/managedRuntime.ts +27 -0
  21. package/agent/server/router.ts +90 -40
  22. package/agent/server/workflowReadRoutes.ts +28 -11
  23. package/agent/workflows.ts +1 -1
  24. package/dist/.vite/manifest.json +490 -476
  25. package/dist/assets/AddJob-DkbI_J5p.js +3 -0
  26. package/dist/assets/{Alerts-C2bAi-Kj.js → Alerts-CFj-u0iV.js} +1 -1
  27. package/dist/assets/{AreaChart-w0ruozXH.js → AreaChart-DEAalJ6P.js} +1 -1
  28. package/dist/assets/Benchmark-Ey2sq57q.js +1 -0
  29. package/dist/assets/{BulkAddJobs-BBWqQpP7.js → BulkAddJobs-BwPoeSB6.js} +1 -1
  30. package/dist/assets/{Button-BPqpRZJD.js → Button-Ch1W94fJ.js} +1 -1
  31. package/dist/assets/{Card-C7NMhqUt.js → Card-CWxrC8OY.js} +1 -1
  32. package/dist/assets/{CopilotPanel-Bhh-uCpN.js → CopilotPanel-CniuIIPn.js} +2 -2
  33. package/dist/assets/{Cron-pJJ5KXFG.js → Cron-B5XFBvU-.js} +1 -1
  34. package/dist/assets/CronManager-Bdg2BECM.js +1 -0
  35. package/dist/assets/{Database-DxiXsUl4.js → Database-CB0oOEFB.js} +1 -1
  36. package/dist/assets/Diagnostics-BDRftXQy.js +1 -0
  37. package/dist/assets/{Dlq-Bx4YXTp5.js → Dlq-CJO9itzJ.js} +1 -1
  38. package/dist/assets/{DlqControl-DJGhuyu3.js → DlqControl-DZL2lHOU.js} +1 -1
  39. package/dist/assets/{DlqPro-BhXIKtrt.js → DlqPro-OqBlzCnN.js} +1 -1
  40. package/dist/assets/Flows-BItJzbVQ.js +2 -0
  41. package/dist/assets/JobInspector-CJHX63p_.js +2 -0
  42. package/dist/assets/{Jobs-Blavwd1H.js → Jobs-BwmTsjJx.js} +1 -1
  43. package/dist/assets/{JobsPro-D8dH9um7.js → JobsPro-eFVAZJ10.js} +1 -1
  44. package/dist/assets/{Logs-B3dsGSF8.js → Logs-CXIf58M4.js} +1 -1
  45. package/dist/assets/{LogsPro-BCB7etG2.js → LogsPro-Xm6rylAd.js} +1 -1
  46. package/dist/assets/{McpServer-Cz1-GwD5.js → McpServer-Rf3i6lRn.js} +2 -2
  47. package/dist/assets/{Metrics-Bkuy6Ntb.js → Metrics-Cj3VYxzL.js} +1 -1
  48. package/dist/assets/{MetricsPro-BbJmy0oO.js → MetricsPro-C63eY00A.js} +1 -1
  49. package/dist/assets/{Overview-Ba5odzYe.js → Overview-CUM3XG7A.js} +1 -1
  50. package/dist/assets/{PageHeader-BXlZSBcc.js → PageHeader-CvIyaFOO.js} +1 -1
  51. package/dist/assets/{Pagination-Q-vf4hsX.js → Pagination-x-Cwgrul.js} +1 -1
  52. package/dist/assets/QueueActions-b19K0vCT.js +1 -0
  53. package/dist/assets/QueueControl-DusMoa05.js +1 -0
  54. package/dist/assets/QueueDetail-CpFIG1PU.js +1 -0
  55. package/dist/assets/QueueDetailPro-BNlBOj5s.js +1 -0
  56. package/dist/assets/{Queues-CGPgEkVm.js → Queues-CZ2qc7FY.js} +1 -1
  57. package/dist/assets/{QueuesOverview-ChC5Dtqh.js → QueuesOverview-CBFqQ3N_.js} +1 -1
  58. package/dist/assets/{S3Backup-5OKa8G13.js → S3Backup-x4mOV-AO.js} +1 -1
  59. package/dist/assets/S3BackupPro-BtvbPVg-.js +3 -0
  60. package/dist/assets/ServerControl-C5nQ7CCp.js +3 -0
  61. package/dist/assets/{Settings-C1HtCK6h.js → Settings-B5kCRSBH.js} +1 -1
  62. package/dist/assets/{StatusBadge-B0I7hNBX.js → StatusBadge-BoOVTnKu.js} +1 -1
  63. package/dist/assets/{Usage-QyZkUhgs.js → Usage-UYovs3D-.js} +1 -1
  64. package/dist/assets/{UsagePro-DMxrXxur.js → UsagePro-bT82DS-d.js} +1 -1
  65. package/dist/assets/{Webhooks-D0JQQf0q.js → Webhooks-BjsUMJAn.js} +1 -1
  66. package/dist/assets/{Workers-Cn8Bkgy1.js → Workers-CD4YZpca.js} +1 -1
  67. package/dist/assets/WorkersPro-hCPhfb1Z.js +1 -0
  68. package/dist/assets/Workflows-DOpeo-TP.js +1 -0
  69. package/dist/assets/{api-V_sVpHDo.js → api-BxYPEynh.js} +1 -1
  70. package/dist/assets/bq-C7wdABtE.js +1 -0
  71. package/dist/assets/{connectionStore-CKFQrxDo.js → connectionStore-CFuNYZ_8.js} +1 -1
  72. package/dist/assets/{controlConnectionEpoch-JM4omZ6j.js → controlConnectionEpoch-DzbuWOhe.js} +1 -1
  73. package/dist/assets/{feedback-BnGE2oW2.js → feedback-QDN1AsYt.js} +1 -1
  74. package/dist/assets/flowMutationSafety-DSd3JLAV.js +1 -0
  75. package/dist/assets/{form-tC20r4Ma.js → form-C4oby9pI.js} +1 -1
  76. package/dist/assets/{icons-CIvFfU2b.js → icons-BVzwsfbG.js} +1 -1
  77. package/dist/assets/{index-Cue53Myw.js → index-AUHH2nTG.js} +3 -3
  78. package/dist/assets/index-BK7fjWKK.css +1 -0
  79. package/dist/assets/install-C5y2ohOo.js +3 -0
  80. package/dist/assets/{react-vendor-CyjgmGTq.js → react-vendor-CvwrP0tU.js} +2 -2
  81. package/dist/assets/{responses-CBLyy1Ob.js → responses-DiIfPXXq.js} +1 -1
  82. package/dist/assets/{toastStore-B7n0zS0y.js → toastStore-B31o6Z5J.js} +1 -1
  83. package/dist/assets/{upstreamPaths-CDVsu6IM.js → upstreamPaths-B_cyinGI.js} +1 -1
  84. package/dist/assets/useControlActionGuard-DT7uudrj.js +1 -0
  85. package/dist/assets/{usePolledData-g80Z_UB-.js → usePolledData-CNtNtd0a.js} +1 -1
  86. package/dist/assets/useServerActionGuard-Db7PPgaI.js +1 -0
  87. package/dist/assets/{useThroughputSeries-CrsZYKbT.js → useThroughputSeries-y7Yyi7Zh.js} +1 -1
  88. package/dist/index.html +21 -18
  89. package/package.json +15 -7
  90. package/scripts/bunVersion.ts +10 -0
  91. package/scripts/embedded.gen.ts +152 -150
  92. package/scripts/serve.ts +3 -0
  93. package/scripts/serveHandler.ts +22 -1
  94. package/scripts/servePolicy.ts +12 -3
  95. package/dist/assets/AddJob-CC4bfHLH.js +0 -3
  96. package/dist/assets/Benchmark-ClJmYZoC.js +0 -1
  97. package/dist/assets/CronManager-lNZ4lHh1.js +0 -1
  98. package/dist/assets/Diagnostics-DLvCT7zI.js +0 -1
  99. package/dist/assets/Flows-Bb9j-YhZ.js +0 -2
  100. package/dist/assets/JobInspector-DfqBq4O5.js +0 -2
  101. package/dist/assets/QueueActions-B6M0ByGt.js +0 -1
  102. package/dist/assets/QueueControl-CWHsVfWU.js +0 -1
  103. package/dist/assets/QueueDetail-BClRbWC5.js +0 -1
  104. package/dist/assets/QueueDetailPro-CIimG0pX.js +0 -1
  105. package/dist/assets/S3BackupPro-BkwTXdtw.js +0 -3
  106. package/dist/assets/ServerControl-DJHKMaf9.js +0 -3
  107. package/dist/assets/WorkersPro-BOTuX9EP.js +0 -1
  108. package/dist/assets/Workflows-DqTKWPmT.js +0 -1
  109. package/dist/assets/bq-Bmysbg0r.js +0 -1
  110. package/dist/assets/flowMutationSafety-DObp9nJo.js +0 -1
  111. package/dist/assets/index-DOze4TKg.css +0 -1
  112. package/dist/assets/install-CFiYX86d.js +0 -3
  113. package/dist/assets/useServerActionGuard-OTv6_fU0.js +0 -1
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./cn-zFEt5SO8.js";import{f as n,g as r,l as i,t as a}from"./react-vendor-CvwrP0tU.js";import{i as o}from"./connectionStore-CFuNYZ_8.js";import{t as s}from"./upstreamPaths-B_cyinGI.js";import{s as c,t as l}from"./bq-C7wdABtE.js";import{t as u}from"./toastStore-B31o6Z5J.js";import{n as d}from"./usePolledData-CNtNtd0a.js";import{t as f}from"./Card-CWxrC8OY.js";import{i as p,n as m,r as h,t as g}from"./feedback-QDN1AsYt.js";import{t as _}from"./StatusBadge-BoOVTnKu.js";import{t as v}from"./PageHeader-CvIyaFOO.js";import{a as y,i as b,l as x}from"./format-Cg7VCIZW.js";import{n as ee,t as S}from"./controlConnectionEpoch-DzbuWOhe.js";import{t as te}from"./useControlActionGuard-DT7uudrj.js";var C={"/workflows":{id:`overview`,label:`Overview`,description:`The complete durable command center for Bunqueue Workflow Engine.`,kind:`active`,state:``},"/workflows/executions":{id:`executions`,label:`Executions`,description:`Inspect every active execution, step record, decision, and nested run.`,kind:`active`,state:``},"/workflows/waiting":{id:`waiting`,label:`Waiting & Signals`,description:`Focus on parked executions and their durable signal payloads.`,kind:`active`,state:`waiting`,lockKind:!0,lockState:!0},"/workflows/compensation":{id:`compensation`,label:`Compensation`,description:`See running, completed, skipped, failed, and parked saga compensation outcomes.`,kind:`active`,state:`compensation`,lockKind:!0,lockState:!0},"/workflows/archive":{id:`archive`,label:`Archive`,description:`Audit terminal executions retained by Workflow Engine archival.`,kind:`archive`,state:``,lockKind:!0}};function w(e){return C[e]??C[`/workflows`]}function T(e,t){return e?.source===`link`||e&&t.some(t=>t.id===e.id)?e:t[0]?{id:t[0].id,source:`page`}:null}var E=e(r(),1),ne=[`waiting`,`failed`,`compensation-stuck`];async function re(e,t){let[n,r]=await Promise.all([e.stats(),e.list(t)]);return{stats:n,page:r}}async function ie(e,t){let[n,...r]=await Promise.all([e.stats(),...ne.map(n=>e.list({kind:`active`,state:n,limit:t,offset:0}))]),i=r.flatMap(e=>e.executions).sort(ae).slice(0,t);return{stats:n,page:{ok:r.every(e=>e.ok),available:r.every(e=>e.available),executions:i,total:r.reduce((e,t)=>e+t.total,0),limit:t,offset:0}}}function ae(e,t){return t.createdAt-e.createdAt||t.id.localeCompare(e.id)}var D=new Set([`summary`,`history`,`payloads`]),O=new Set([`running`,`waiting`,`completed`,`failed`,`compensating`,`compensation-stuck`,`compensation`]);function k(e,t){let n=e.get(`kind`),r=t.id===`executions`&&(n===`active`||n===`archive`)?n:t.kind,i=t.id===`overview`?``:ce(e.get(`workflow`)),a=ue(e.get(`state`),t),o=t.id===`overview`?0:le(e.get(`offset`)),c=e.get(`execution`),l=c&&s(c,`Workflow execution id`)===null?c:null,u=e.get(`tab`),d=t.id===`overview`||t.id===`executions`;return{kind:r,workflowName:i,state:a,offset:o,executionId:l,tab:l&&d&&D.has(u)?u:`summary`}}function A(e,t){let n=new URLSearchParams;return e.id===`executions`&&t.kind===`archive`&&n.set(`kind`,`archive`),e.id!==`overview`&&t.workflowName&&n.set(`workflow`,t.workflowName),j(e)&&t.state&&n.set(`state`,t.state),e.id!==`overview`&&t.offset>0&&n.set(`offset`,String(t.offset)),t.executionId&&n.set(`execution`,t.executionId),t.executionId&&t.tab!==`summary`&&(e.id===`overview`||e.id===`executions`)&&n.set(`tab`,t.tab),n}function oe(e,t,n){return A(t,{...k(e,t),...n})}function se(e){return D.has(e)}function ce(e){return e&&e.length<=256?e:``}function le(e){if(!e||!/^(0|[1-9]\d*)$/.test(e))return 0;let t=Number(e);return Number.isSafeInteger(t)&&t<=1e6?Math.floor(t/25)*25:0}function ue(e,t){return j(t)?e?t.id===`archive`?e===`completed`||e===`failed`?e:``:O.has(e)?e:``:``:t.state}function j(e){return e.id===`executions`||e.id===`archive`}var de=e=>`${e}?target=${encodeURIComponent(o())}`,M=e=>({method:`POST`,headers:e===void 0?void 0:{"Content-Type":`application/json`},body:e===void 0?void 0:JSON.stringify(e)});async function N(e,t){return(await c(de(e),t)).result}var P={status:()=>N(`/workflows/runtime`),reload:()=>N(`/workflows/runtime/reload`,M()),start:async(e,t)=>(await N(`/workflows/start`,M({workflowName:e,input:t}))).run,signal:async(e,t,n)=>{await N(`/workflows/${encodeURIComponent(e)}/signal`,M({event:t,payload:n}))},recover:async()=>(await N(`/workflows/recover`,M())).recovered,resumeCompensation:async e=>{await N(`/workflows/${encodeURIComponent(e)}/resume-compensation`,M())},abandonCompensation:async e=>{await N(`/workflows/${encodeURIComponent(e)}/abandon-compensation`,M())},archive:async(e,t)=>(await N(`/workflows/archive`,M({maxAgeMs:e,states:t}))).affected,cleanup:async(e,t)=>(await N(`/workflows/cleanup`,M({maxAgeMs:e,states:t}))).affected},fe={stats:()=>l.workflows.stats(),list:e=>l.workflows.list(e),get:(e,t)=>l.workflows.get(e,t)};function pe(e){let[t,r]=n(),i=t.toString(),a=(0,E.useMemo)(()=>k(new URLSearchParams(i),e),[i,e]),o=(0,E.useMemo)(()=>A(e,a).toString(),[e,a]),s=(0,E.useRef)(null);(0,E.useEffect)(()=>{o!==i&&r(o,{replace:!0})},[o,i,r]);let c=(0,E.useCallback)((t,n=!1)=>{r(n=>oe(n,e,t),{replace:n})},[e,r]),l=(0,E.useCallback)((e,t=!1)=>{s.current=e,c({executionId:e?.id??null,tab:`summary`},t)},[c]),u=a.executionId?{id:a.executionId,source:s.current?.id===a.executionId?s.current.source:`link`}:null;return{...a,selected:u,update:c,select:l}}function F(e){let t=ee(),n=`workflow-command:${e.operationGroup}`,r=te(n),i=(0,E.useMemo)(()=>({local:e.scopeKey,connectionEpoch:t}),[t,e.scopeKey]),a=(0,E.useRef)(e);a.current=e;let o=(0,E.useRef)(null),s=(0,E.useRef)(!0),c=(0,E.useRef)(i),l=(0,E.useRef)(0);if(!Object.is(c.current,i)){let e=c.current.connectionEpoch!==t;c.current=i,l.current+=1,e&&(o.current=null)}let[u,d]=(0,E.useState)(()=>I(i,t));(0,E.useEffect)(()=>(s.current=!0,()=>{s.current=!1,l.current+=1,o.current=null}),[]);let f=(e,t)=>s.current&&e===l.current&&t===S(),p=async(e,c)=>{if(o.current||t!==S())return;let u=r.begin(n);if(!u)return;let p=Symbol(`workflow-command`);o.current=p;let m=l.current,h=t,{onApplied:g,onSucceeded:_}=a.current;try{d({connectionEpoch:t,scope:i,busy:e,error:``,receipt:null});let n=await c();if(!f(m,h))return;d({connectionEpoch:t,scope:i,busy:e,error:``,receipt:{label:e,value:n}});try{_?.(e,n)}catch{}try{await g?.()}catch(e){f(m,h)&&d(t=>({...t,error:`Command succeeded; refresh failed: ${L(e)}`}))}}catch(n){f(m,h)&&d({connectionEpoch:t,scope:i,busy:e,error:L(n),receipt:null})}finally{u.finish(),o.current===p&&(o.current=null,s.current&&h===S()&&d(e=>({...e,busy:``})))}},m=Object.is(u.scope,i)?u:I(i,t);return{busy:u.connectionEpoch===t?u.busy:``,error:m.error,result:m.receipt?.value,succeeded:m.receipt?.label??``,run:p,clearResult:()=>d(e=>({...e,receipt:null}))}}function I(e,t){return{connectionEpoch:t,scope:e,busy:``,error:``,receipt:null}}function L(e){return e instanceof Error?e.message:String(e)}var R=a(),z=e=>JSON.stringify(e,null,2)??`null`;function B({value:e,empty:t=`None`}){return e==null||typeof e==`object`&&Object.keys(e).length===0?(0,R.jsx)(`p`,{className:`text-xs text-faint`,children:t}):(0,R.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs leading-5 text-muted`,children:z(e)})}function V({label:e,value:t}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-faint`,children:e}),(0,R.jsx)(`dd`,{className:`mt-0.5 break-words text-muted`,children:t})]})}var me=3600*1e3;function he({repository:e=P,onApplied:t}){let[n,r]=(0,E.useState)(`720`),[i,a]=(0,E.useState)(!0),[o,s]=(0,E.useState)(!0),c=F({operationGroup:`maintenance`,scopeKey:(0,E.useMemo)(()=>Symbol(`workflow-maintenance:${n.length}:${i}:${o}`),[i,o,n]),onApplied:t}),l=[...i?[`completed`]:[],...o?[`failed`]:[]],u=Number(n),d=Number.isFinite(u)&&u>=0&&l.length>0,f=t=>{if(!d)return;let n=t===`archive`?`Archive ${l.join(` and `)} workflows at least ${u} hours old?`:`Permanently delete ${l.join(` and `)} workflows at least ${u} hours old from the active execution store? Archive records are not deleted.`;if(!window.confirm(n))return;let r=Math.round(u*me);c.run(t,async()=>({operation:t,affected:t===`archive`?await e.archive(r,l):await e.cleanup(r,l)}))};return(0,R.jsxs)(`section`,{className:`mb-5 rounded-lg border border-line bg-surface p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Retention operations`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`Archive moves terminal runs into retention. Cleanup permanently deletes eligible terminal runs from the active store only; archive records remain intact.`})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Minimum age (hours)`,(0,R.jsx)(`input`,{"aria-label":`Workflow retention age hours`,type:`number`,min:`0`,step:`1`,value:n,onChange:e=>r(e.target.value),className:`mt-1 block h-9 w-32 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`})]}),(0,R.jsxs)(`label`,{className:`flex h-9 items-center gap-2 text-xs text-muted`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),`Completed`]}),(0,R.jsxs)(`label`,{className:`flex h-9 items-center gap-2 text-xs text-muted`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`Failed`]})]})]}),(0,R.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:!d||!!c.busy,onClick:()=>f(`archive`),className:`rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:`Archive eligible`}),(0,R.jsx)(`button`,{type:`button`,disabled:!d||!!c.busy,onClick:()=>f(`cleanup`),className:`rounded-md border border-danger/40 px-3 py-2 text-xs text-danger disabled:opacity-40`,children:`Delete eligible`})]}),c.error&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:c.error}),c.result!==void 0&&(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{value:c.result})})]})}var ge=[[`Active`,`activeTotal`,`text-fg`],[`Running`,`running`,`text-blue-400`],[`Waiting`,`waiting`,`text-warning`],[`Completed`,`completed`,`text-success`],[`Failed`,`failed`,`text-danger`],[`Compensating`,`compensating`,`text-violet-400`],[`Stuck`,`compensation-stuck`,`text-danger`]];function _e({stats:e}){return(0,R.jsx)(`dl`,{className:`mb-4 grid grid-cols-2 divide-x divide-y divide-line overflow-hidden rounded-lg border border-line bg-surface sm:grid-cols-4 xl:grid-cols-7 xl:divide-y-0`,children:ge.map(([n,r,i])=>(0,R.jsxs)(`div`,{className:`px-3 py-2.5 first:border-0`,children:[(0,R.jsx)(`dt`,{className:`text-[10px] font-medium uppercase tracking-wider text-faint`,children:n}),(0,R.jsx)(`dd`,{className:t(`mt-1 tnum font-mono text-lg font-semibold`,i),children:r===`activeTotal`?e.activeTotal:e.states[r]})]},r))})}function ve({repository:e=P,onApplied:t}){let[n,r]=(0,E.useState)(``),[i,a]=(0,E.useState)(`{}`),o=(0,E.useMemo)(()=>Symbol(`workflow-runtime:${n.length}:${i.length}`),[i,n]),s=d(()=>e.status(),[e],{intervalMs:5e3}),c=F({operationGroup:`runtime`,scopeKey:o,onApplied:async()=>{await s.refetch(),await t?.()}}),l=s.data?.ready===!0;return(0,R.jsxs)(`section`,{className:`mb-5 overflow-hidden rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-line px-4 py-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Workflow runtime`}),(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-faint`,children:`Registered application handlers stay in the agent-side runtime; commands never edit SQLite directly.`})]}),(0,R.jsx)(ye,{ready:l,configured:s.data?.configured===!0,unavailable:!!(s.error&&!s.data)})]}),s.data?.configured&&(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-line px-4 py-2 text-[11px] text-faint`,children:[(0,R.jsxs)(`span`,{children:[`Module`,` `,(0,R.jsx)(`strong`,{className:`font-mono font-medium text-muted`,children:s.data.moduleName??`—`})]}),(0,R.jsxs)(`span`,{children:[`Queue`,` `,(0,R.jsx)(`strong`,{className:`font-mono font-medium text-muted`,children:s.data.queueName??`—`})]}),(0,R.jsxs)(`span`,{children:[`Concurrency`,` `,(0,R.jsx)(`strong`,{className:`font-mono font-medium text-muted`,children:s.data.concurrency??`—`})]})]}),s.error&&s.data&&(0,R.jsx)(p,{message:`Runtime status refresh failed; showing the last snapshot.`,onRetry:s.refetch}),s.error&&!s.data&&(0,R.jsx)(`div`,{className:`p-4`,children:(0,R.jsx)(m,{error:s.error,onRetry:s.refetch})}),(0,R.jsxs)(`div`,{className:`grid gap-5 p-4 lg:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Registered workflow`,(0,R.jsx)(`input`,{"aria-label":`Registered workflow`,list:`workflow-runtime-names`,value:n,onChange:e=>r(e.target.value),className:`mt-1 h-9 w-full rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`}),(0,R.jsx)(`datalist`,{id:`workflow-runtime-names`,children:s.data?.workflowNames.map(e=>(0,R.jsx)(`option`,{value:e},e))})]}),(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Input JSON`,(0,R.jsx)(`textarea`,{"aria-label":`Workflow input JSON`,value:i,onChange:e=>a(e.target.value),className:`mt-1 min-h-20 w-full resize-y rounded-lg border border-line bg-surface-2 p-2 font-mono text-xs text-fg`})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap content-start gap-2 lg:w-48 lg:flex-col`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:!l||!n.trim()||!!c.busy,onClick:()=>{let t;try{t=JSON.parse(i)}catch{c.run(`start`,async()=>{throw Error(`Workflow input must be valid JSON.`)});return}c.run(`start`,()=>e.start(n.trim(),t))},className:`rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:c.busy===`start`?`Starting…`:`Start execution`}),(0,R.jsx)(`button`,{type:`button`,disabled:!l||!!c.busy,onClick:()=>{window.confirm(`Recover every orphaned workflow using the registered idempotent handlers?`)&&c.run(`recover`,()=>e.recover())},className:`rounded-md border border-line px-3 py-2 text-xs text-muted disabled:opacity-40`,children:`Recover orphaned`}),(0,R.jsx)(`button`,{type:`button`,disabled:!s.data?.configured||!!c.busy,onClick:()=>void c.run(`reload`,()=>e.reload()),className:`rounded-md border border-line px-3 py-2 text-xs text-muted disabled:opacity-40`,children:`Reload definitions`})]})]}),!s.loading&&!s.error&&!s.data?.configured&&(0,R.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-xs text-warning`,children:[`Set `,(0,R.jsx)(`code`,{children:`BUNQUEUE_WORKFLOW_MODULE`}),` to an absolute module path in Server → Extra environment, then start the managed server.`]}),s.data?.error&&(0,R.jsx)(`p`,{role:`alert`,className:`border-t border-line px-4 py-3 text-xs text-danger`,children:s.data.error}),c.error&&(0,R.jsx)(`p`,{role:`alert`,className:`border-t border-line px-4 py-3 text-xs text-danger`,children:c.error}),c.result!==void 0&&(0,R.jsx)(`div`,{className:`border-t border-line p-4`,children:(0,R.jsx)(B,{value:c.result})})]})}function ye({ready:e,configured:t,unavailable:n}){return(0,R.jsx)(`span`,{className:e?`rounded-full bg-success/10 px-2 py-1 text-[11px] text-success`:`rounded-full bg-warning/10 px-2 py-1 text-[11px] text-warning`,children:e?`Handlers loaded`:n?`Status unavailable`:t?`Unavailable`:`Not configured`})}var be=[``,`running`,`waiting`,`completed`,`failed`,`compensating`,`compensation-stuck`,`compensation`];function xe({section:e,kind:t,workflowName:n,state:r,stats:i,total:a,onKind:o,onWorkflowName:s,onState:c}){return(0,R.jsx)(f,{className:`mb-5`,children:(0,R.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[e.lockKind?(0,R.jsx)(H,{label:`Store`,value:`${e.kind}${e.kind===`archive`&&i?` · ${i.archiveTotal}`:``}`,capitalize:!0}):(0,R.jsx)(Se,{kind:t,archiveTotal:i?.archiveTotal,onChange:o}),(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Workflow`,(0,R.jsxs)(`select`,{value:n,onChange:e=>s(e.target.value),className:`mt-1 block h-9 min-w-48 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`,children:[(0,R.jsx)(`option`,{value:``,children:`All workflows`}),i?.workflowNames.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]}),e.lockState?(0,R.jsx)(H,{label:`State scope`,value:e.state===`compensation`?`Compensating + stuck`:e.state}):(0,R.jsx)(Ce,{state:r,onChange:c}),a!==void 0&&(0,R.jsxs)(`span`,{className:`ml-auto text-xs text-faint`,children:[a,` execution`,a===1?``:`s`]})]})})}function Se({kind:e,archiveTotal:n,onChange:r}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`mb-1 block text-xs text-faint`,children:`Store`}),(0,R.jsx)(`div`,{className:`flex rounded-lg border border-line p-0.5`,children:[`active`,`archive`].map(i=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":e===i,onClick:()=>r(i),className:t(`rounded-md px-3 py-1.5 text-xs capitalize`,e===i?`bg-surface-2 text-fg`:`text-muted hover:text-fg`),children:[i,i===`archive`&&n!==void 0?` (${n})`:``]},i))})]})}function Ce({state:e,onChange:t}){return(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`State`,(0,R.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),className:`mt-1 block h-9 min-w-44 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`,children:be.map(e=>(0,R.jsx)(`option`,{value:e,children:e===`compensation`?`All compensation`:e||`All states`},e||`all`))})]})}function H({label:e,value:n,capitalize:r=!1}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`mb-1 block text-xs text-faint`,children:e}),(0,R.jsx)(`span`,{className:t(`inline-flex h-9 items-center rounded-lg border border-line bg-surface-2 px-3 text-xs text-fg`,r&&`capitalize`),children:n})]})}function we({label:e=`Workflow`,value:t,stats:n,onChange:r}){return(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[e,(0,R.jsxs)(`select`,{value:t,onChange:e=>r(e.target.value),className:`mt-1 block h-9 min-w-52 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`,children:[(0,R.jsx)(`option`,{value:``,children:`All workflows`}),n?.workflowNames.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]})}function Te(e){return e.section.id===`overview`?null:e.section.id===`executions`?(0,R.jsx)(xe,{...e}):(0,R.jsxs)(`div`,{className:`mb-5 flex items-end gap-4 rounded-lg border border-line bg-surface px-4 py-3`,children:[(0,R.jsx)(we,{value:e.workflowName,stats:e.stats,onChange:e.onWorkflowName}),e.section.id===`archive`&&(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Outcome`,(0,R.jsxs)(`select`,{value:e.state,onChange:t=>e.onState(t.target.value),className:`mt-1 block h-9 min-w-36 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`,children:[(0,R.jsx)(`option`,{value:``,children:`All outcomes`}),(0,R.jsx)(`option`,{value:`completed`,children:`Completed`}),(0,R.jsx)(`option`,{value:`failed`,children:`Failed`})]})]}),(0,R.jsxs)(`span`,{className:`ml-auto pb-2 text-xs text-faint`,children:[e.total??0,` `,e.section.id===`archive`?`records`:`executions`]})]})}function Ee(e){let t=[{id:`execution-started`,at:e.createdAt,title:`Execution started`,detail:e.workflowName,status:`running`,category:`execution`}];for(let[n,r]of Object.entries(e.steps))t.push(...De(n,r));for(let n of Object.keys(e.signals))t.push({id:`signal:${n}`,title:`Signal persisted: ${n}`,detail:`The store does not expose an exact signal timestamp.`,category:`signal`});return e.state!==`running`&&e.state!==`waiting`&&t.push({id:`execution-settled`,at:e.updatedAt,title:`Execution ${e.state}`,detail:e.failureReason,status:e.state,category:`execution`}),t.sort(Oe)}function De(e,t){let n=[];return t.startedAt!==void 0&&n.push({id:`step:${e}:started`,at:t.startedAt,title:`Step started: ${e}`,detail:t.attempts?`Attempt ${t.attempts}`:void 0,status:`running`,category:`step`}),(t.completedAt!==void 0||t.status===`failed`)&&n.push({id:`step:${e}:settled`,at:t.completedAt,title:`Step ${t.status}: ${e}`,detail:t.error,status:t.status,category:`step`}),t.compensation&&n.push({id:`step:${e}:compensation`,at:t.compensation.at,title:`Compensation ${t.compensation.status}: ${e}`,detail:t.compensation.error,status:t.compensation.status,category:`compensation`}),n}function Oe(e,t){return e.at===void 0&&t.at===void 0?e.id.localeCompare(t.id):e.at===void 0?1:t.at===void 0?-1:e.at-t.at||e.id.localeCompare(t.id)}function U({execution:e}){let t=Ee(e);return(0,R.jsx)(`ol`,{className:`divide-y divide-line/70 border-y border-line/70`,children:t.map((e,n)=>(0,R.jsxs)(`li`,{className:`grid grid-cols-[28px_minmax(0,1fr)] gap-3 py-3`,children:[(0,R.jsxs)(`div`,{className:`relative flex justify-center`,"aria-hidden":`true`,children:[(0,R.jsx)(`span`,{className:`mt-1.5 size-2 rounded-full border-2 border-surface bg-accent ring-1 ring-line`}),n<t.length-1&&(0,R.jsx)(`span`,{className:`absolute top-5 bottom-[-13px] w-px bg-line`})]}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`break-words text-sm font-medium text-fg`,children:e.title}),e.status&&(0,R.jsx)(_,{status:e.status})]}),(0,R.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 text-xs text-faint`,children:[(0,R.jsx)(`span`,{className:`capitalize`,children:e.category}),(0,R.jsx)(`span`,{children:e.at===void 0?`Timestamp unavailable`:b(e.at)})]}),e.detail&&(0,R.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-xs text-muted`,children:e.detail})]})]},e.id))})}var W={now:Date.now,subscribe:e=>{let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)}};function ke({since:e,clock:t=W}){let n=G(t);return(0,R.jsx)(R.Fragment,{children:y(Math.max(0,n-e))})}function G(e=W,t=!0){let[n,r]=(0,E.useState)(()=>e.now());return(0,E.useEffect)(()=>{if(r(e.now()),t)return e.subscribe(()=>r(e.now()))},[e,t]),n}function K({error:e,onRetry:t}){return e?(0,R.jsx)(p,{message:`Execution refresh failed; showing the last persisted snapshot.`,onRetry:t}):null}async function q(e,t){await Promise.all([e(),t?.()])}function Ae({repository:e,id:t,pollIntervalMs:n=1e4}){let{data:r,error:i,loading:a,refetch:o}=d(()=>e.get(t,`archive`),[e,t],{intervalMs:n});if(a&&!r)return(0,R.jsx)(h,{label:`Loading audit record…`});if(i&&!r)return(0,R.jsx)(m,{error:i,onRetry:o});let s=r?.execution;return s?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{error:i,onRetry:o}),(0,R.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-line px-4 py-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`Immutable audit record`}),(0,R.jsx)(`h2`,{className:`mt-1 break-all font-mono text-sm font-semibold text-fg`,children:s.id})]}),(0,R.jsx)(_,{status:s.state})]}),(0,R.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 border-b border-line p-4 text-xs sm:grid-cols-3`,children:[(0,R.jsx)(V,{label:`Workflow`,value:s.workflowName}),(0,R.jsx)(V,{label:`Runtime`,value:y(s.updatedAt-s.createdAt)}),(0,R.jsx)(V,{label:`Archived`,value:s.archivedAt?b(s.archivedAt):`Unavailable`}),(0,R.jsx)(V,{label:`Definition hash`,value:s.definitionHash??`Unavailable`}),(0,R.jsx)(V,{label:`Final node`,value:String(s.currentNodeIndex)}),(0,R.jsx)(V,{label:`Final transition`,value:b(s.updatedAt)})]}),(0,R.jsx)(`div`,{className:`p-4`,children:(0,R.jsx)(U,{execution:s})})]})]}):null}function je({repository:e,executionId:t,stuck:n,onApplied:r}){let i=F({operationGroup:`compensation`,scopeKey:`${t}:${n}`,onApplied:r,onSucceeded:e=>u.success(e===`resume`?`Compensation resumed`:`Compensation abandoned`,t)});return n?(0,R.jsxs)(`div`,{className:`border-t border-line p-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-faint`,children:`Operator decision`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:`Retry after fixing the reversal, or explicitly abandon the remaining compensation steps.`}),(0,R.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:!!i.busy,onClick:()=>{window.confirm(`Retry the stuck compensation for ${t}? Handlers must be idempotent.`)&&i.run(`resume`,()=>e.resumeCompensation(t))},className:`rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:`Resume compensation`}),(0,R.jsx)(`button`,{type:`button`,disabled:!!i.busy,onClick:()=>{window.confirm(`Abandon remaining compensation for ${t}? This is irreversible.`)&&i.run(`abandon`,()=>e.abandonCompensation(t))},className:`rounded-md border border-danger/40 px-3 py-2 text-xs text-danger disabled:opacity-40`,children:`Abandon remainder`})]}),i.error&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:i.error}),i.succeeded&&(0,R.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-success`,children:i.succeeded===`resume`?`Resume command accepted; recovery state refreshed.`:`Abandon command accepted; recovery state refreshed.`}),i.result!==void 0&&(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{value:i.result})})]}):null}function Me({repository:e,controlRepository:t,id:n,onApplied:r,pollIntervalMs:i=5e3}){let{data:a,error:o,loading:s,refetch:c}=d(()=>e.get(n,`active`),[e,n],{intervalMs:i});if(s&&!a)return(0,R.jsx)(h,{label:`Loading recovery plan…`});if(o&&!a)return(0,R.jsx)(m,{error:o,onRetry:c});let l=a?.execution;if(!l)return null;let u=Object.entries(l.steps).filter(([,e])=>e.compensatable||e.compensation);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{error:o,onRetry:c}),(0,R.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-line px-4 py-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-violet-400`,children:`Recovery plan`}),(0,R.jsx)(`h2`,{className:`mt-1 break-all font-mono text-sm font-semibold text-fg`,children:l.id})]}),(0,R.jsx)(_,{status:l.state})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 border-b border-line p-4 text-xs`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-faint`,children:`Compensation pivot`}),(0,R.jsx)(`div`,{className:`mt-1 text-fg`,children:l.committedAt===void 0?`Not committed`:`Node ${l.committedAt}`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-faint`,children:`Rollback state`}),(0,R.jsx)(`div`,{className:`mt-1 text-fg`,children:l.rollbackStatus??l.state})]})]}),l.failureReason&&(0,R.jsx)(`div`,{role:`alert`,className:`border-b border-danger/30 bg-danger/[0.06] px-4 py-3 text-xs text-danger`,children:l.failureReason}),(0,R.jsxs)(`div`,{className:`p-4`,children:[(0,R.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-faint`,children:`Compensation ledger`}),u.length?(0,R.jsx)(`ol`,{className:`space-y-2`,children:u.reverse().map(([e,t])=>(0,R.jsxs)(`li`,{className:`grid gap-2 rounded-md border border-line px-3 py-2 text-xs sm:grid-cols-[1fr_auto]`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-mono text-fg`,children:e}),(0,R.jsx)(`div`,{className:`mt-1 text-faint`,children:t.compensation?.error??`Compensation handler registered`})]}),(0,R.jsxs)(`div`,{className:`text-right text-muted`,children:[t.compensation?t.compensation.status:`pending`,t.compensation?.at?(0,R.jsx)(`div`,{className:`mt-1 text-[10px] text-faint`,children:b(t.compensation.at)}):null]})]},e))}):(0,R.jsx)(`p`,{className:`text-sm text-muted`,children:`No compensatable step was persisted.`})]}),(0,R.jsx)(je,{repository:t,executionId:n,stuck:l.state===`compensation-stuck`,onApplied:()=>q(c,r)},n)]})]})}function Ne({execution:e}){return(0,R.jsxs)(`div`,{className:`space-y-5`,children:[(0,R.jsx)(J,{title:`Input`,value:e.input}),(0,R.jsx)(J,{title:`Signals`,value:e.signals}),(0,R.jsx)(J,{title:`Resolved steps`,value:e.resolvedSteps}),(0,R.jsx)(J,{title:`Decisions`,value:e.decisions})]})}function J({title:e,value:t}){return(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wider text-faint`,children:e}),(0,R.jsx)(B,{value:t})]})}function Pe({steps:e,onSelect:t}){let n=Object.entries(e);return n.length===0?(0,R.jsx)(`p`,{className:`text-xs text-faint`,children:`No persisted step records.`}):(0,R.jsx)(`ol`,{className:`space-y-3`,children:n.map(([e,r],i)=>(0,R.jsx)(Fe,{name:e,step:r,last:i===n.length-1,onSelect:t},e))})}function Fe({name:e,step:t,last:n,onSelect:r}){let i=t.startedAt!==void 0&&t.completedAt!==void 0?t.completedAt-t.startedAt:void 0;return(0,R.jsxs)(`li`,{className:`relative grid grid-cols-[18px_1fr] gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col items-center`,"aria-hidden":`true`,children:[(0,R.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full bg-current text-accent`}),!n&&(0,R.jsx)(`span`,{className:`mt-1 w-px flex-1 bg-line`})]}),(0,R.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-line bg-surface-2 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{translate:`no`,className:`break-all font-mono text-sm font-medium text-fg`,children:e}),(0,R.jsx)(_,{status:t.status})]}),(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-faint`,children:[t.attempts!==void 0&&(0,R.jsxs)(`span`,{children:[t.attempts,` attempt`,t.attempts===1?``:`s`]}),i!==void 0&&(0,R.jsx)(`span`,{children:y(i)}),t.occurrence!==void 0&&(0,R.jsxs)(`span`,{children:[`Occurrence `,t.occurrence]}),t.loopIndex!==void 0&&(0,R.jsxs)(`span`,{children:[`Loop index `,t.loopIndex]}),t.compensatable&&(0,R.jsx)(`span`,{children:`Compensatable`})]}),t.idempotencyKey&&(0,R.jsxs)(`div`,{className:`mt-2 break-all font-mono text-[11px] text-faint`,children:[`Idempotency: `,t.idempotencyKey]}),t.childExecutionId&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(t.childExecutionId),className:`mt-2 break-all font-mono text-xs text-accent hover:underline`,children:[`Child execution: `,t.childExecutionId]}),t.error&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-2 whitespace-pre-wrap text-xs text-danger`,children:t.error}),t.compensation&&(0,R.jsxs)(`div`,{className:`mt-3 rounded-md border border-line px-3 py-2 text-xs`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-faint`,children:`Compensation`}),(0,R.jsx)(_,{status:t.compensation.status}),(0,R.jsx)(`span`,{className:`text-faint`,children:b(t.compensation.at)})]}),t.compensation.error&&(0,R.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-danger`,children:t.compensation.error})]}),(0,R.jsx)(Ie,{step:t})]})]})}function Ie({step:e}){return(0,R.jsxs)(R.Fragment,{children:[Object.hasOwn(e,`result`)&&(0,R.jsx)(Y,{label:`Result`,value:e.result}),Object.hasOwn(e,`loopItem`)&&(0,R.jsx)(Y,{label:`Loop item`,value:e.loopItem})]})}function Y({label:e,value:t}){return(0,R.jsxs)(`details`,{className:`mt-3`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted`,children:e}),(0,R.jsx)(`div`,{className:`mt-2`,children:(0,R.jsx)(B,{value:t})})]})}function Le({execution:e,onSelect:t}){let n=Object.values(e.steps),r=n.filter(e=>e.status===`completed`).length;return(0,R.jsxs)(`div`,{className:`space-y-5`,children:[(0,R.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 border-b border-line pb-5 text-xs sm:grid-cols-3`,children:[(0,R.jsx)(V,{label:`Current node`,value:String(e.currentNodeIndex)}),(0,R.jsx)(V,{label:`Step progress`,value:`${r}/${n.length} completed`}),(0,R.jsx)(V,{label:`Duration`,value:y(e.updatedAt-e.createdAt)}),(0,R.jsx)(V,{label:`Started`,value:b(e.createdAt)}),(0,R.jsx)(V,{label:`Last transition`,value:b(e.updatedAt)}),(0,R.jsx)(V,{label:`Rollback`,value:e.rollbackStatus??`Not started`})]}),e.failureReason&&(0,R.jsxs)(`div`,{role:`alert`,className:`border-l-2 border-danger bg-danger/[0.06] px-3 py-2 text-xs text-danger`,children:[(0,R.jsx)(`div`,{className:`mb-1 font-medium`,children:`Failure`}),(0,R.jsx)(`p`,{className:`whitespace-pre-wrap`,children:e.failureReason})]}),(0,R.jsx)(Re,{execution:e,onSelect:t}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-faint`,children:`Step state`}),(0,R.jsx)(Pe,{steps:e.steps,onSelect:t})]})]})}function Re({execution:e,onSelect:t}){return!e.parentExecutionId&&!e.definitionHash&&e.committedAt===void 0?null:(0,R.jsxs)(`div`,{className:`grid gap-3 border-b border-line pb-5 text-xs sm:grid-cols-2`,children:[e.parentExecutionId&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-faint`,children:`Parent execution`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>t(e.parentExecutionId),className:`mt-1 break-all font-mono text-accent hover:underline`,children:e.parentExecutionId})]}),e.definitionHash&&(0,R.jsx)(V,{label:`Definition hash`,value:e.definitionHash}),e.committedAt!==void 0&&(0,R.jsx)(V,{label:`Compensation pivot`,value:`Node ${e.committedAt}`}),(0,R.jsx)(`div`,{className:`flex items-end`,children:(0,R.jsx)(_,{status:e.state})})]})}var ze=[{id:`summary`,label:`Summary`},{id:`history`,label:`History`},{id:`payloads`,label:`Payloads`}];function X({repository:e,id:t,kind:n,onSelect:r}){return(0,R.jsx)(Be,{repository:e,id:t,kind:n,onSelect:r},`${n}:${t}`)}function Be({repository:e,id:r,kind:i,onSelect:a}){let[o,s]=n(),c=o.get(`tab`),l=se(c)?c:`summary`,{data:u,error:f,loading:g,refetch:v}=d(()=>e.get(r,i),[e,r,i],{intervalMs:5e3});if(g&&!u)return(0,R.jsx)(Z,{children:(0,R.jsx)(h,{label:`Loading execution…`})});if(f&&!u)return(0,R.jsx)(Z,{children:(0,R.jsx)(m,{error:f,onRetry:v})});let y=u?.execution;return y?(0,R.jsxs)(Z,{children:[f&&(0,R.jsx)(p,{message:`Execution refresh failed. Showing the last snapshot.`,onRetry:v}),(0,R.jsx)(`header`,{className:`border-b border-line px-4 py-3`,children:(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`Execution`}),(0,R.jsx)(`h2`,{translate:`no`,className:`mt-1 break-all font-mono text-sm font-semibold text-fg`,children:y.id}),(0,R.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:y.workflowName})]}),(0,R.jsx)(_,{status:y.state})]})}),(0,R.jsx)(`nav`,{"aria-label":`Execution detail`,className:`flex border-b border-line px-2`,children:ze.map(e=>(0,R.jsx)(`button`,{type:`button`,"aria-pressed":l===e.id,onClick:()=>{s(t=>{let n=new URLSearchParams(t);return e.id===`summary`?n.delete(`tab`):n.set(`tab`,e.id),n})},className:t(`border-b-2 px-3 py-2 text-xs font-medium`,l===e.id?`border-accent text-fg`:`border-transparent text-faint hover:text-muted`),children:e.label},e.id))}),(0,R.jsxs)(`div`,{className:`p-4`,"aria-live":`polite`,children:[l===`summary`&&(0,R.jsx)(Le,{execution:y,onSelect:a}),l===`history`&&(0,R.jsx)(U,{execution:y}),l===`payloads`&&(0,R.jsx)(Ne,{execution:y})]})]}):null}function Z({children:e}){return(0,R.jsx)(`section`,{className:`min-w-0 overflow-hidden rounded-lg border border-line bg-surface`,children:e})}function Q({total:e,offset:t,pageSize:n,count:r,onPage:i}){let a=r===0?0:t+1,o=Math.min(t+r,e);return(0,R.jsxs)(`nav`,{"aria-label":`Workflow execution pages`,className:`mt-3 flex items-center justify-between`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:t===0,onClick:()=>i(Math.max(0,t-n)),className:`rounded-lg border border-line px-3 py-1.5 text-xs text-muted disabled:opacity-40`,children:`Previous`}),(0,R.jsxs)(`span`,{className:`text-xs text-faint`,children:[a,`–`,o,` of `,e]}),(0,R.jsx)(`button`,{type:`button`,disabled:t+n>=e,onClick:()=>i(t+n),className:`rounded-lg border border-line px-3 py-1.5 text-xs text-muted disabled:opacity-40`,children:`Next`})]})}var Ve=e=>e.length>22?`${e.slice(0,12)}…${e.slice(-7)}`:e;function He({executions:e,total:t,offset:n,pageSize:r,selected:i,onSelect:a,onPage:o}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-line bg-surface`,children:(0,R.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,R.jsx)(`thead`,{className:`bg-surface-2/80`,children:(0,R.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Workflow / execution`}),(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Status`}),(0,R.jsx)(`th`,{className:`hidden px-3 py-2 font-medium md:table-cell`,children:`Node`}),(0,R.jsx)(`th`,{className:`hidden px-3 py-2 font-medium lg:table-cell`,children:`Elapsed`}),(0,R.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Updated`})]})}),(0,R.jsx)(`tbody`,{children:e.map(e=>(0,R.jsx)(Ue,{execution:e,selected:i?.id===e.id,onSelect:a},e.id))})]})}),(0,R.jsx)(Q,{total:t,offset:n,pageSize:r,count:e.length,onPage:o})]})}function Ue({execution:e,selected:n,onSelect:r}){return(0,R.jsxs)(`tr`,{className:t(`border-b border-line/70 last:border-0`,n&&`bg-surface-2`),children:[(0,R.jsx)(`td`,{className:`p-0`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r({id:e.id,source:`page`}),className:`block w-full px-3 py-2.5 text-left focus-visible:outline-2 focus-visible:outline-inset focus-visible:outline-accent`,children:[(0,R.jsx)(`span`,{className:`block truncate font-medium text-fg`,children:e.workflowName}),(0,R.jsx)(`span`,{translate:`no`,title:e.id,className:`mt-0.5 block font-mono text-[11px] text-faint`,children:Ve(e.id)})]})}),(0,R.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,R.jsx)(_,{status:e.state})}),(0,R.jsx)(`td`,{className:`hidden px-3 py-2.5 font-mono text-xs text-muted md:table-cell`,children:e.currentNodeIndex}),(0,R.jsx)(`td`,{className:`hidden whitespace-nowrap px-3 py-2.5 font-mono text-xs text-muted lg:table-cell`,children:y(e.updatedAt-e.createdAt)}),(0,R.jsx)(`td`,{title:b(e.updatedAt),className:`whitespace-nowrap px-3 py-2.5 text-right text-xs text-muted`,children:x(e.updatedAt)})]})}function We({mode:e,rows:n,selected:r,onSelect:i,total:a,offset:o,pageSize:s,onPage:c,clock:l=W}){let u=G(l,e===`waiting`);return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`section`,{className:`overflow-x-auto rounded-lg border border-line bg-surface`,children:(0,R.jsxs)(`table`,{className:`w-full min-w-[560px] text-sm`,children:[(0,R.jsx)(`thead`,{className:`border-b border-line bg-surface-2/80 text-left text-[10px] uppercase tracking-wider text-faint`,children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e===`archive`?`Execution record`:`Execution`}),(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Workflow`}),(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:Ge(e)}),(0,R.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:Ke(e)})]})}),(0,R.jsx)(`tbody`,{children:n.map(n=>(0,R.jsxs)(`tr`,{className:t(`border-b border-line last:border-0`,r?.id===n.id&&`bg-surface-2`),children:[(0,R.jsx)(`td`,{className:`p-0`,children:(0,R.jsx)(`button`,{type:`button`,className:`block w-full px-3 py-3 text-left font-mono text-xs text-fg`,onClick:()=>i({id:n.id,source:`page`}),children:n.id})}),(0,R.jsx)(`td`,{className:`px-3 py-3 text-muted`,children:n.workflowName}),(0,R.jsx)(`td`,{className:`px-3 py-3`,children:(0,R.jsx)(qe,{mode:e,row:n})}),(0,R.jsx)(`td`,{className:`whitespace-nowrap px-3 py-3 text-right text-xs text-muted`,children:Je(e,n,u)})]},n.id))})]})}),(0,R.jsx)(Q,{total:a,offset:o,pageSize:s,count:n.length,onPage:c})]})}var Ge=e=>e===`waiting`?`Resume node`:e===`compensation`?`Recovery state`:`Outcome`,Ke=e=>e===`archive`?`Archived`:e===`waiting`?`Waiting`:`Updated`;function qe({mode:e,row:t}){return e===`waiting`?(0,R.jsxs)(`span`,{className:`font-mono text-xs text-warning`,children:[`Node `,t.currentNodeIndex]}):(0,R.jsx)(_,{status:t.state})}function Je(e,t,n){return e===`archive`?t.archivedAt?b(t.archivedAt):`Unavailable`:e===`waiting`?y(Math.max(0,n-t.updatedAt)):x(t.updatedAt)}function $({stats:e,page:t,repository:n,kind:r,selected:i,onSelect:a}){let o=t.executions.filter(e=>[`waiting`,`failed`,`compensation-stuck`].includes(e.state));return(0,R.jsxs)(`div`,{className:`space-y-5`,children:[(0,R.jsx)(Ye,{stats:e}),(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(320px,0.7fr)_minmax(0,1.3fr)]`,children:[(0,R.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`border-b border-line px-4 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Needs attention`}),(0,R.jsxs)(`p`,{className:`mt-0.5 text-xs text-faint`,children:[`Waiting, failed, and stuck executions · showing `,o.length,` of `,t.total,`.`]})]}),(0,R.jsx)(Xe,{rows:o,selected:i,onSelect:a})]}),i&&(0,R.jsx)(X,{repository:n,id:i.id,kind:r,onSelect:e=>a({id:e,source:`link`})})]})]})}function Ye({stats:e}){return(0,R.jsx)(`dl`,{className:`grid overflow-hidden rounded-lg border border-line bg-surface sm:grid-cols-2 xl:grid-cols-4`,children:[[`Open executions`,e.activeTotal],[`Waiting for signal`,e.states.waiting],[`Recovery required`,e.states[`compensation-stuck`]+e.states.failed],[`Retained in archive`,e.archiveTotal]].map(([e,t])=>(0,R.jsxs)(`div`,{className:`border-b border-line px-4 py-3 sm:border-r xl:border-b-0`,children:[(0,R.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-faint`,children:e}),(0,R.jsx)(`dd`,{className:`mt-1 font-mono text-xl font-semibold text-fg`,children:t})]},e))})}function Xe({rows:e,selected:t,onSelect:n}){return e.length?(0,R.jsx)(`ul`,{className:`divide-y divide-line`,children:e.map(e=>(0,R.jsx)(`li`,{className:t?.id===e.id?`bg-surface-2`:void 0,children:(0,R.jsxs)(`button`,{type:`button`,className:`w-full px-4 py-3 text-left`,onClick:()=>n({id:e.id,source:`page`}),children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.workflowName}),(0,R.jsx)(`span`,{className:`text-xs text-faint`,children:x(e.updatedAt)})]}),(0,R.jsxs)(`span`,{className:`mt-1 flex items-center justify-between gap-3 font-mono text-[11px] text-faint`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:e.id}),(0,R.jsx)(`span`,{children:e.state})]})]})},e.id))}):(0,R.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-muted`,children:`No intervention required.`})}function Ze({repository:e,executionId:t,onApplied:n}){let[r,i]=(0,E.useState)(``),[a,o]=(0,E.useState)(`{}`),s=F({operationGroup:`signal`,scopeKey:t,onApplied:n,onSucceeded:()=>u.success(`Workflow signal accepted`,`${r.trim()} · ${t}`)});return(0,R.jsxs)(`div`,{className:`border-t border-line p-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-faint`,children:`Send signal`}),(0,R.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Event name`,(0,R.jsx)(`input`,{"aria-label":`Workflow signal event`,value:r,onChange:e=>i(e.target.value),className:`mt-1 h-9 w-full rounded-lg border border-line bg-surface-2 px-3 font-mono text-sm text-fg`})]}),(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Payload JSON`,(0,R.jsx)(`textarea`,{"aria-label":`Workflow signal payload`,value:a,onChange:e=>o(e.target.value),className:`mt-1 min-h-20 w-full resize-y rounded-lg border border-line bg-surface-2 p-2 font-mono text-xs text-fg`})]})]}),(0,R.jsx)(`button`,{type:`button`,disabled:!r.trim()||!!s.busy,onClick:()=>{let n;try{n=JSON.parse(a)}catch{s.run(`signal`,async()=>{throw Error(`Signal payload must be valid JSON.`)});return}window.confirm(`Send durable signal "${r.trim()}" to ${t}?`)&&s.run(`signal`,()=>e.signal(t,r.trim(),n))},className:`mt-3 rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:s.busy?`Sending…`:`Send durable signal`}),s.error&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:s.error}),s.succeeded&&(0,R.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-success`,children:`Durable signal accepted; execution and list refreshed.`}),s.result!==void 0&&(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{value:s.result})})]})}function Qe({repository:e,controlRepository:t,id:n,onApplied:r,clock:i,pollIntervalMs:a=5e3}){let{data:o,error:s,loading:c,refetch:l}=d(()=>e.get(n,`active`),[e,n],{intervalMs:a});if(c&&!o)return(0,R.jsx)(h,{label:`Loading signal inbox…`});if(s&&!o)return(0,R.jsx)(m,{error:s,onRetry:l});let u=o?.execution;if(!u)return null;let f=Object.entries(u.signals);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{error:s,onRetry:l}),(0,R.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`border-b border-line px-4 py-3`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-warning`,children:`Signal inbox`}),(0,R.jsx)(`h2`,{className:`mt-1 break-all font-mono text-sm font-semibold text-fg`,children:u.id})]}),(0,R.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 border-b border-line p-4 text-xs sm:grid-cols-3`,children:[(0,R.jsx)(V,{label:`Waiting at node`,value:String(u.currentNodeIndex)}),(0,R.jsx)(V,{label:`Parked for`,value:(0,R.jsx)(ke,{since:u.updatedAt,clock:i})}),(0,R.jsx)(V,{label:`Last transition`,value:b(u.updatedAt)})]}),(0,R.jsxs)(`div`,{className:`p-4`,children:[(0,R.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-faint`,children:`Durable signals`}),f.length?f.map(([e,t])=>(0,R.jsxs)(`div`,{className:`mb-3 last:mb-0`,children:[(0,R.jsx)(`div`,{className:`mb-1 font-mono text-xs text-warning`,children:e}),(0,R.jsx)(B,{value:t})]},e)):(0,R.jsx)(`p`,{className:`text-sm text-muted`,children:`No signal has been persisted yet. The execution remains parked.`})]}),(0,R.jsx)(Ze,{repository:t,executionId:n,onApplied:()=>q(l,r)},n)]})]})}function $e(e){return e.section.id===`overview`?(0,R.jsx)($,{...e}):e.section.id===`executions`?(0,R.jsx)(et,{...e}):(0,R.jsx)(tt,{...e})}function et({repository:e,kind:t,page:n,selected:r,offset:i,pageSize:a,onSelect:o,onPage:s}){return(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(390px,0.8fr)_minmax(0,1.4fr)]`,children:[(0,R.jsx)(He,{executions:n.executions,total:n.total,offset:i,pageSize:a,selected:r,onSelect:o,onPage:s}),r&&(0,R.jsx)(X,{repository:e,id:r.id,kind:t,onSelect:e=>o({id:e,source:`link`})})]})}function tt(e){let t=e.section.id;return(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(420px,0.95fr)_minmax(0,1.05fr)]`,children:[(0,R.jsx)(We,{mode:t,rows:e.page.executions,selected:e.selected,onSelect:e.onSelect,total:e.page.total,offset:e.offset,pageSize:e.pageSize,onPage:e.onPage}),e.selected&&(0,R.jsx)(nt,{...e,id:e.selected.id})]})}function nt({section:e,repository:t,controlRepository:n,onRefresh:r,id:i}){return e.id===`waiting`?(0,R.jsx)(Qe,{repository:t,controlRepository:n,id:i,onApplied:r}):e.id===`compensation`?(0,R.jsx)(Me,{repository:t,controlRepository:n,id:i,onApplied:r}):(0,R.jsx)(Ae,{repository:t,id:i})}function rt({repository:e=fe,controlRepository:t=P}){let{pathname:n}=i(),r=w(n),a=pe(r),{kind:o,workflowName:s,state:c,offset:l,selected:u}=a,f={kind:o,workflowName:s||void 0,state:c||void 0,limit:25,offset:l},{data:m,error:h,loading:g,refetch:_}=d(()=>r.id===`overview`?ie(e,25):re(e,f),[e,r.id,o,s,c,l],{intervalMs:5e3});(0,E.useEffect)(()=>{let e=m?.page.total;if(e===void 0||l===0)return;let t=e===0?0:Math.floor((e-1)/25)*25;l>t&&a.update({offset:t,executionId:null,tab:`summary`},!0)},[m?.page.total,l,a.update]),(0,E.useEffect)(()=>{let e=m?.page.executions;if(e){let t=r.id===`overview`?e.filter(e=>[`waiting`,`failed`,`compensation-stuck`].includes(e.state)):e,n=T(u,t);n?.id!==u?.id&&a.select(n,!0)}},[m?.page.executions,r.id,u,a.select]);let y=m?.stats,b=m?.page;return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(v,{title:(0,R.jsxs)(R.Fragment,{children:[`Workflow `,(0,R.jsxs)(`span`,{className:`text-faint`,children:[`/ `,r.label]})]}),description:r.description,live:!!(m&&!h),actions:(0,R.jsx)(`button`,{type:`button`,onClick:()=>void _(),className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Refresh`})}),r.id===`overview`&&(0,R.jsx)(ve,{repository:t,onApplied:_}),r.id===`archive`&&(0,R.jsx)(he,{repository:t,onApplied:_}),r.id===`executions`&&y&&(0,R.jsx)(_e,{stats:y}),(0,R.jsx)(Te,{section:r,kind:o,workflowName:s,state:c,stats:y??void 0,total:b?.total,onKind:e=>{a.update({kind:e,offset:0,executionId:null,tab:`summary`},!1)},onWorkflowName:e=>{a.update({workflowName:e,offset:0,executionId:null,tab:`summary`},!1)},onState:e=>{a.update({state:e,offset:0,executionId:null,tab:`summary`},!1)}}),h&&m&&(0,R.jsx)(p,{message:`Workflow refresh failed — showing the last snapshot.`,onRetry:_}),(0,R.jsx)(it,{repository:e,controlRepository:t,section:r,stats:y,kind:o,page:b,error:h,loading:g,dataPresent:!!m,selected:u,offset:l,onRetry:_,onSelect:e=>a.select(e),onPage:e=>{a.update({offset:e,executionId:null,tab:`summary`})}})]})}function it({repository:e,controlRepository:t,section:n,stats:r,kind:i,page:a,error:o,loading:s,dataPresent:c,selected:l,offset:u,onRetry:d,onSelect:f,onPage:p}){return o&&!c?(0,R.jsx)(m,{error:o,onRetry:d}):s&&!c?(0,R.jsx)(h,{label:`Loading workflows…`}):a?.available?a.executions.length===0&&a.total>0&&u>0?(0,R.jsx)(h,{label:`Loading workflow page…`}):a.executions.length===0?(0,R.jsx)(g,{title:`No executions match these filters`,hint:`Change the store, workflow, or state filter.`}):r?(0,R.jsx)($e,{section:n,repository:e,controlRepository:t,kind:i,stats:r,page:a,selected:l,offset:u,pageSize:25,onSelect:f,onPage:p,onRefresh:d}):null:(0,R.jsx)(g,{title:`Workflow store not initialized`,hint:`Start a Bunqueue Workflow Engine with this server dataPath; its official workflow_executions tables will appear here automatically.`})}export{rt as Workflows};
@@ -1 +1 @@
1
- import{i as e,r as t}from"./connectionStore-CKFQrxDo.js";import{a as n,n as r,r as i,s as a}from"./upstreamPaths-CDVsu6IM.js";var o=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`ApiError`}},s=3e4;async function c(n,r,i=!0,a=[],c=`json`){let l=AbortSignal.timeout(s),u=r?.signal?AbortSignal.any([r.signal,l]):l,d=new Headers(t());r?.headers&&new Headers(r.headers).forEach((e,t)=>{d.set(t,e)}),r?.body!=null&&!d.has(`Content-Type`)&&d.set(`Content-Type`,`application/json`);let f;try{f=await fetch(e()+n,{...r,headers:d,signal:u})}catch(e){throw l.aborted&&!r?.signal?.aborted||e?.name===`TimeoutError`?new o(`Request timed out`,0):e}if(!f.ok&&!a.includes(f.status)){let e=`HTTP ${f.status}`;try{let t=await f.json();t?.error&&(e=t.error)}catch{}throw new o(e,f.status)}if(f.status===204)return;let p;try{p=await f.text()}catch(e){throw l.aborted&&!r?.signal?.aborted?new o(`Request timed out`,0):e}if(!p)return;if(c===`text`)return p;let m;try{m=JSON.parse(p)}catch{throw new o(`Invalid JSON response (HTTP ${f.status})`,f.status)}if(i&&m&&typeof m==`object`&&m.ok===!1){let e=m.error;throw new o(e??`Operation failed`,f.status)}return m}var l=a,u=(e,t)=>c(e,{method:`POST`,body:t?JSON.stringify(t):void 0}),d=(e,t)=>c(e,{method:`PUT`,body:t?JSON.stringify(t):void 0}),f=e=>c(e,{method:`DELETE`}),p={overview:()=>c(`/dashboard`),queues:(e=200,t=0)=>c(`/dashboard/queues?limit=${e}&offset=${t}`),queueDetail:(e,t=!0)=>c(`/dashboard/queues/${l(e)}?includeJobs=${t}`),stats:()=>c(`/stats`),storage:()=>c(`/storage`,void 0,!1),health:()=>c(`/health`,void 0,!1,[503]),healthz:()=>c(`/healthz`,void 0,!0,[],`text`),live:()=>c(`/live`,void 0,!0,[],`text`),ready:()=>c(`/ready`,void 0,!1,[503]),metrics:()=>c(`/metrics`),jobsList:(e,t={})=>{let n=new URLSearchParams;return t.states?.length&&n.set(`states`,t.states.join(`,`)),n.set(`limit`,String(t.limit??50)),n.set(`offset`,String(t.offset??0)),c(`/queues/${l(e)}/jobs/list?${n.toString()}`)},job:e=>c(`/jobs/${n(e)}`),cancelJob:e=>f(`/jobs/${n(e)}`),promoteJob:e=>u(`/jobs/${n(e)}/promote`),retryJob:e=>u(`/jobs/${n(e)}/move-to-wait`),pause:e=>u(`/queues/${l(e)}/pause`),resume:e=>u(`/queues/${l(e)}/resume`),drain:e=>u(`/queues/${l(e)}/drain`),obliterate:e=>u(`/queues/${l(e)}/obliterate`),clean:(e,t=0,n=1e3)=>u(`/queues/${l(e)}/clean`,{grace:t,limit:n}),retryCompleted:e=>{throw TypeError(`Completed-job requeue is unavailable in Bunqueue v2.8.59 because flow dependency registration is not rebuilt.`)},setRateLimit:(e,t)=>d(`/queues/${l(e)}/rate-limit`,{limit:t}),clearRateLimit:e=>f(`/queues/${l(e)}/rate-limit`),setConcurrency:(e,t)=>d(`/queues/${l(e)}/concurrency`,{concurrency:t}),clearConcurrency:e=>f(`/queues/${l(e)}/concurrency`),dlq:(e,t=50,n=0)=>c(`/queues/${l(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>c(`/queues/${l(e)}/dlq/stats`),retryDlq:e=>{throw TypeError(`DLQ retry is unavailable in Bunqueue v2.8.59 because the endpoint has no atomic flow-safety precondition.`)},purgeDlq:e=>u(`/queues/${l(e)}/dlq/purge`),crons:()=>c(`/crons`),deleteCron:e=>f(`/crons/${r(e,`Cron name`,256)}`),workers:()=>c(`/workers`),eventsUrl:t=>e()+(t?`/events/queues/${i(t)}`:`/events`)};export{p as t};
1
+ import{i as e,r as t}from"./connectionStore-CFuNYZ_8.js";import{a as n,n as r,r as i,s as a}from"./upstreamPaths-B_cyinGI.js";var o=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`ApiError`}},s=3e4;async function c(n,r,i=!0,a=[],c=`json`){let l=AbortSignal.timeout(s),u=r?.signal?AbortSignal.any([r.signal,l]):l,d=new Headers(t());r?.headers&&new Headers(r.headers).forEach((e,t)=>{d.set(t,e)}),r?.body!=null&&!d.has(`Content-Type`)&&d.set(`Content-Type`,`application/json`);let f;try{f=await fetch(e()+n,{...r,headers:d,signal:u})}catch(e){throw l.aborted&&!r?.signal?.aborted||e?.name===`TimeoutError`?new o(`Request timed out`,0):e}if(!f.ok&&!a.includes(f.status)){let e=`HTTP ${f.status}`;try{let t=await f.json();t?.error&&(e=t.error)}catch{}throw new o(e,f.status)}if(f.status===204)return;let p;try{p=await f.text()}catch(e){throw l.aborted&&!r?.signal?.aborted?new o(`Request timed out`,0):e}if(!p)return;if(c===`text`)return p;let m;try{m=JSON.parse(p)}catch{throw new o(`Invalid JSON response (HTTP ${f.status})`,f.status)}if(i&&m&&typeof m==`object`&&m.ok===!1){let e=m.error;throw new o(e??`Operation failed`,f.status)}return m}var l=a,u=(e,t)=>c(e,{method:`POST`,body:t?JSON.stringify(t):void 0}),d=(e,t)=>c(e,{method:`PUT`,body:t?JSON.stringify(t):void 0}),f=e=>c(e,{method:`DELETE`}),p={overview:()=>c(`/dashboard`),queues:(e=200,t=0)=>c(`/dashboard/queues?limit=${e}&offset=${t}`),queueDetail:(e,t=!0)=>c(`/dashboard/queues/${l(e)}?includeJobs=${t}`),stats:()=>c(`/stats`),storage:()=>c(`/storage`,void 0,!1),health:()=>c(`/health`,void 0,!1,[503]),healthz:()=>c(`/healthz`,void 0,!0,[],`text`),live:()=>c(`/live`,void 0,!0,[],`text`),ready:()=>c(`/ready`,void 0,!1,[503]),metrics:()=>c(`/metrics`),jobsList:(e,t={})=>{let n=new URLSearchParams;return t.states?.length&&n.set(`states`,t.states.join(`,`)),n.set(`limit`,String(t.limit??50)),n.set(`offset`,String(t.offset??0)),c(`/queues/${l(e)}/jobs/list?${n.toString()}`)},job:e=>c(`/jobs/${n(e)}`),cancelJob:e=>f(`/jobs/${n(e)}`),promoteJob:e=>u(`/jobs/${n(e)}/promote`),retryJob:e=>u(`/jobs/${n(e)}/move-to-wait`),pause:e=>u(`/queues/${l(e)}/pause`),resume:e=>u(`/queues/${l(e)}/resume`),drain:e=>u(`/queues/${l(e)}/drain`),obliterate:e=>u(`/queues/${l(e)}/obliterate`),clean:(e,t=0,n=1e3)=>u(`/queues/${l(e)}/clean`,{grace:t,limit:n}),retryCompleted:e=>{throw TypeError(`Completed-job requeue is unavailable in Bunqueue v2.9.2 because flow dependency registration is not rebuilt.`)},setRateLimit:(e,t)=>d(`/queues/${l(e)}/rate-limit`,{limit:t}),clearRateLimit:e=>f(`/queues/${l(e)}/rate-limit`),setConcurrency:(e,t)=>d(`/queues/${l(e)}/concurrency`,{concurrency:t}),clearConcurrency:e=>f(`/queues/${l(e)}/concurrency`),dlq:(e,t=50,n=0)=>c(`/queues/${l(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>c(`/queues/${l(e)}/dlq/stats`),retryDlq:e=>{throw TypeError(`DLQ retry is unavailable in Bunqueue v2.9.2 because the endpoint has no atomic flow-safety precondition.`)},purgeDlq:e=>u(`/queues/${l(e)}/dlq/purge`),crons:()=>c(`/crons`),deleteCron:e=>f(`/crons/${r(e,`Cron name`,256)}`),workers:()=>c(`/workers`),eventsUrl:t=>e()+(t?`/events/queues/${i(t)}`:`/events`)};export{p as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,n,r}from"./connectionStore-CFuNYZ_8.js";import{a as i,i as a,n as o,r as s,s as c}from"./upstreamPaths-B_cyinGI.js";var l=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`BqError`}},u=3e4,d=()=>u;async function f(e,t,n,r,i=!0,a=`server`,o=[],s=u){let c=AbortSignal.timeout(s),d=r?.signal?AbortSignal.any([r.signal,c]):c,f=new Headers(n);r?.headers&&new Headers(r.headers).forEach((e,t)=>{f.set(t,e)}),r?.body!=null&&!f.has(`Content-Type`)&&f.set(`Content-Type`,`application/json`);let p;try{p=await fetch(e+t,{...r,headers:f,signal:d})}catch(e){throw c.aborted&&!r?.signal?.aborted||e?.name===`TimeoutError`?new l(`Request timed out`,0):e}if(!p.ok&&!o.includes(p.status)){let t=`HTTP ${p.status}`;try{let e=await p.json();e?.error&&(t=e.error)}catch{}throw p.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:a,auth:f.get(`Authorization`)??void 0,target:e}})),new l(t,p.status)}if(p.status===204)return;let m;try{m=await p.text()}catch(e){throw c.aborted&&!r?.signal?.aborted?new l(`Request timed out`,0):e}if(!m)return;let h;try{h=JSON.parse(m)}catch{throw new l(`Invalid JSON response (HTTP ${p.status})`,p.status)}if(i&&h&&typeof h==`object`&&h.ok===!1)throw new l(h.error??`Operation failed`,p.status);return h}var p=(e,n,i=!0,a=[],o=u)=>f(t(),e,r(),n,i,`server`,a,o);function m(t,n){return e(t)??e(n)??`http://localhost:6800`}function h(){try{return globalThis.__BUNQUEUE_AGENT_URL__}catch{return}}var g=m(h(),void 0),ee=()=>g,_=(e,t,r=u)=>f(g,e,n(),t,!0,`agent`,[],r),v=(e,t)=>({method:e,body:t===void 0?void 0:JSON.stringify(t)}),y=3e5,b=(e,t)=>v(e,t),x=new WeakMap,te=new WeakMap;function S(){let e=Object.freeze({baseUrl:t()});return x.set(e,Object.freeze({...r()})),e}function C(){let e=Object.freeze({baseUrl:g});return te.set(e,Object.freeze({...n()})),e}function w(e){let t=x.get(e);if(!t)throw TypeError(`Invalid server request target.`);return t}function T(e){let t=te.get(e);if(!t)throw TypeError(`Invalid agent request target.`);return t}function ne(e,t){let n=Object.entries(e);return n.length===Object.keys(t).length&&n.every(([e,n])=>t[e]===n)}function re(e){let n=w(e);if(e.baseUrl!==t()||!ne(n,r()))throw Error(`Server connection changed after confirmation was requested for ${e.baseUrl}; action refused.`)}async function E(e,t,n){n?.throwIfAborted();let r=await f(e.baseUrl,`/jobs/${i(t)}`,{...w(e)},n?{signal:n}:void 0);return n?.throwIfAborted(),r}var D=encodeURIComponent,ie={info:()=>_(`/db/info`),tables:()=>_(`/db/tables`),schema:e=>_(`/db/tables/${o(e,`Database table`)}/schema`),rows:(e,t=50,n=0,r,i=`asc`,a)=>_(`/db/tables/${o(e,`Database table`)}?limit=${t}&offset=${n}${r?`&orderBy=${D(r)}&dir=${i}`:``}${a?.value?`&fcol=${D(a.column)}&fop=${a.op}&fval=${D(a.value)}`:``}`),cell:(e,t,n)=>_(`/db/tables/${o(e,`Database table`)}/cell?rowid=${D(String(t))}&column=${D(n)}`),query:e=>_(`/db/query`,v(`POST`,{sql:e}))},ae={status:()=>_(`/control/status`),start:()=>_(`/control/start`,{method:`POST`}),stop:()=>_(`/control/stop`,{method:`POST`}),restart:()=>_(`/control/restart`,{method:`POST`}),logs:()=>_(`/control/logs`),getConfig:()=>_(`/control/config`),setConfig:(e,t)=>_(`/control/config`,v(`PUT`,{...e,...t===void 0?{}:{expectedRevision:t}}))},oe={stats:()=>_(`/workflows/stats`),list:(e={})=>{let t=new URLSearchParams;return e.kind&&t.set(`kind`,e.kind),e.workflowName&&t.set(`workflowName`,e.workflowName),e.state&&t.set(`state`,e.state),e.limit!==void 0&&t.set(`limit`,String(e.limit)),e.offset!==void 0&&t.set(`offset`,String(e.offset)),_(`/workflows${t.size?`?${t}`:``}`)},get:(e,t=`active`)=>_(`/workflows/${o(e,`Workflow execution id`)}?kind=${t}`)},se=2e5,O=16*1024*1024,ce=12e4,le=64*1024,k=encodeURIComponent;async function ue(e,t,n=50,r=0,i,a=`asc`,s,c){c?.throwIfAborted();let l=await f(e.baseUrl,`/db/tables/${o(t,`Database table`)}?limit=${n}&offset=${r}${i?`&orderBy=${k(i)}&dir=${a}`:``}${s?.value?`&fcol=${k(s.column)}&fop=${s.op}&fval=${k(s.value)}`:``}`,{...T(e)},c?{signal:c}:void 0,!0,`agent`);return c?.throwIfAborted(),l}function A(e,t,n,r=!0){let i=e.get(t);if(!i||!/^\d+$/.test(i))throw new l(`Malformed database export response: invalid ${t} header.`,200);let a=Number(i);if(!Number.isSafeInteger(a)||a>n||!r&&a===0)throw new l(`Malformed database export response: invalid ${t} header.`,200);return a}async function de(e){if(!e.body)return``;let t=e.body.getReader(),n=new Uint8Array(le),r=0;try{for(;;){let e=await t.read();if(e.done)break;if(r+e.value.byteLength>n.byteLength)return t.cancel().catch(()=>void 0),``;n.set(e.value,r),r+=e.value.byteLength}}finally{t.releaseLock()}return new TextDecoder().decode(n.subarray(0,r))}async function fe(e,t,n){if(!e.body)throw new l(`Malformed database export response: missing CSV body.`,200);let r=new Uint8Array(t),i=e.body.getReader(),a=0;try{for(;;){n?.throwIfAborted();let e=await i.read();if(e.done)break;if(a+e.value.byteLength>t)throw i.cancel().catch(()=>void 0),new l(`Malformed database export response: body exceeds declared ${t} bytes.`,200);r.set(e.value,a),a+=e.value.byteLength}}finally{i.releaseLock()}if(n?.throwIfAborted(),a!==t)throw new l(`Malformed database export response: received ${a} of ${t} declared bytes.`,200);return r}function pe(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`Invalid database export request.`);if(typeof e.table!=`string`||!e.table)throw TypeError(`Database export table must not be empty.`);if(e.dir!==`asc`&&e.dir!==`desc`)throw TypeError(`Invalid database export sort direction.`);if(e.orderBy!==void 0&&(typeof e.orderBy!=`string`||!e.orderBy))throw TypeError(`Database export sort column must not be empty.`);let t=e.filter;if(t&&(typeof t!=`object`||Array.isArray(t)||typeof t.column!=`string`||!t.column||typeof t.value!=`string`||!t.value||![`contains`,`eq`,`ne`].includes(t.op)))throw TypeError(`Invalid database export filter.`);return Object.freeze({table:e.table,orderBy:e.orderBy,dir:e.dir,filter:t?Object.freeze({...t}):void 0})}async function me(e,t,n){e.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:`agent`,auth:new Headers(n).get(`Authorization`)??void 0,target:t.baseUrl}}));let r=`HTTP ${e.status}`,i=await de(e);if(i)try{let e=JSON.parse(i);typeof e?.error==`string`&&(r=e.error)}catch{}return new l(r,e.status)}async function he(e,t,n){n?.throwIfAborted();let r={...T(e)},i=pe(t),a=new URLSearchParams;i.orderBy&&a.set(`orderBy`,i.orderBy),a.set(`dir`,i.dir),i.filter&&(a.set(`fcol`,i.filter.column),a.set(`fop`,i.filter.op),a.set(`fval`,i.filter.value));let s=`/db/tables/${o(i.table,`Database table`)}/export?${a}`,c=AbortSignal.timeout(ce),u=n?AbortSignal.any([n,c]):c;try{let t=await fetch(e.baseUrl+s,{headers:r,signal:u});if(!t.ok)throw await me(t,e,r);if(t.headers.get(`X-Bunqueue-Db-Export-Version`)!==`1`)throw new l(`Malformed database export response: unsupported contract version.`,200);if(!/^text\/csv(?:;|$)/i.test(t.headers.get(`Content-Type`)??``))throw new l(`Malformed database export response: expected CSV content.`,200);let a;try{let e=t.headers.get(`X-Bunqueue-Db-Export-Table`);if(!e)throw Error(`missing`);a=decodeURIComponent(e)}catch{throw new l(`Malformed database export response: invalid table identity.`,200)}if(a!==i.table)throw new l(`Database export target changed: requested "${i.table}", received "${a}".`,200);let o=A(t.headers,`X-Bunqueue-Db-Export-Rows`,se),c=A(t.headers,`X-Bunqueue-Db-Export-Bytes`,O,!1);if(A(t.headers,`Content-Length`,16777216,!1)!==c)throw new l(`Malformed database export response: Content-Length does not match X-Bunqueue-Db-Export-Bytes.`,200);let d=t.headers.get(`X-Bunqueue-Db-Export-Cap`);if(d!==`none`&&d!==`rows`&&d!==`bytes`)throw new l(`Malformed database export response: invalid export cap.`,200);if(d===`rows`&&o!==2e5)throw new l(`Malformed database export response: inconsistent row cap.`,200);let f=await fe(t,c,u);return n?.throwIfAborted(),{table:a,content:f,rowCount:o,bytes:c,cap:d===`none`?null:d}}catch(e){throw c.aborted&&!n?.aborted?new l(`Database export timed out`,0):e}}var ge={counts:e=>p(`/queues/${c(e)}/counts`),pause:e=>p(`/queues/${c(e)}/pause`,v(`POST`)),resume:e=>p(`/queues/${c(e)}/resume`,v(`POST`)),drain:e=>p(`/queues/${c(e)}/drain`,b(`POST`),!0,[],y),obliterate:e=>p(`/queues/${c(e)}/obliterate`,b(`POST`),!0,[],y),clean:(e,t={})=>p(`/queues/${c(e)}/clean`,v(`POST`,t)),promoteJobs:(e,t)=>p(`/queues/${c(e)}/promote-jobs`,v(`POST`,t==null?void 0:{count:t})),retryCompleted:(e,t)=>{throw TypeError(`Completed-job requeue is unavailable in Bunqueue v2.9.2 because flow dependency registration is not rebuilt.`)},setRateLimit:(e,t,n,r)=>p(`/queues/${c(e)}/rate-limit`,v(`PUT`,{limit:t,...n===void 0?{}:{duration:n},...r===void 0?{}:{ttl:r}})),clearRateLimit:e=>p(`/queues/${c(e)}/rate-limit`,{method:`DELETE`}),setConcurrency:(e,t)=>p(`/queues/${c(e)}/concurrency`,v(`PUT`,{concurrency:t})),clearConcurrency:e=>p(`/queues/${c(e)}/concurrency`,{method:`DELETE`}),getStallConfig:e=>p(`/queues/${c(e)}/stall-config`),setStallConfig:(e,t)=>p(`/queues/${c(e)}/stall-config`,v(`PUT`,{config:t})),getDlqConfig:e=>p(`/queues/${c(e)}/dlq-config`),setDlqConfig:(e,t)=>{if(t.autoRetry===!0)throw TypeError(`DLQ auto-retry is unavailable: Bunqueue v2.9.2 does not rebuild flow dependency registration.`);if(t.maxAge!==void 0||t.maxEntries!==void 0)throw TypeError(`DLQ retention is read-only: maxAge/maxEntries can destructively expire or evict flow jobs without an atomic dependency check.`);return p(`/queues/${c(e)}/dlq-config`,v(`PUT`,{config:t}))},dlq:(e,t=100,n=0)=>p(`/queues/${c(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>p(`/queues/${c(e)}/dlq/stats`),retryDlq:(e,t)=>{throw TypeError(`DLQ retry is unavailable in Bunqueue v2.9.2 because the endpoint has no atomic job-generation, state, or flow-topology precondition.`)},purgeDlq:e=>p(`/queues/${c(e)}/dlq/purge`,v(`POST`))},j=()=>encodeURIComponent(t()),_e={limits:(e,t)=>{let n=t===void 0?``:`&maxJobs=${t}`;return _(`/queue-operations/${c(e)}/limits?target=${j()}${n}`)},group:(e,n,r,i)=>{let a=new URLSearchParams({target:t(),groupId:n});return r!==void 0&&a.set(`maxJobs`,String(r)),i!==void 0&&a.set(`maxCount`,String(i)),_(`/queue-operations/${c(e)}/groups?${a}`)},setGroupRateLimit:(e,t,n,r)=>_(`/queue-operations/${c(e)}/groups/rate-limit?target=${j()}`,v(`POST`,{groupId:t,max:n,duration:r})),removeGroupRateLimit:(e,t)=>_(`/queue-operations/${c(e)}/groups/rate-limit/remove?target=${j()}`,v(`POST`,{groupId:t})),setGroupConcurrency:(e,t,n)=>_(`/queue-operations/${c(e)}/groups/concurrency?target=${j()}`,v(`POST`,{groupId:t,concurrency:n})),removeGroupConcurrency:(e,t)=>_(`/queue-operations/${c(e)}/groups/concurrency/remove?target=${j()}`,v(`POST`,{groupId:t})),deduplicationJobId:(e,n)=>_(`/queue-operations/${c(e)}/deduplication?${new URLSearchParams({target:t(),deduplicationId:n})}`),removeDeduplicationKey:(e,t)=>_(`/queue-operations/${c(e)}/deduplication/remove?target=${j()}`,v(`POST`,{deduplicationId:t})),metrics:(e,n,r,i)=>_(`/queue-operations/${c(e)}/metrics?${new URLSearchParams({target:t(),type:n,start:String(r),end:String(i)})}`),trimEvents:(e,t)=>_(`/queue-operations/${c(e)}/events/trim?target=${j()}`,v(`POST`,{maxLength:t}))},M=1e4,ve=1e3,ye=864e13,be=new Set([`job.pushed`,`job.started`,`job.completed`,`job.failed`,`job.progress`,`job.stalled`]);function N(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function P(e,t,n=!1){if(typeof e!=`string`||e.length>t||!n&&e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!1}return!0}function F(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function xe(e){return typeof e==`number`&&Number.isFinite(e)}function I(e){return F(e)&&e<=ye}function Se(e,t){return e===null||P(e,t)}function Ce(e,t,n){if(!Array.isArray(e)||e.length>t)return!1;let r=new Set;for(let t of e){if(!P(t,n)||r.has(t))return!1;r.add(t)}return!0}function L(e,t){let n=N(e),r=n&&N(n.data);if(n?.ok!==!0||!r)throw Error(`Malformed ${t} response.`);return r}function R(e){if(!Array.isArray(e))throw Error(`Malformed queue summary response.`);let t=new Set,n=[];for(let r of e){let e=N(r),i=e&&N(e.counts);if(!e||!P(e.name,256)||t.has(e.name)||typeof e.paused!=`boolean`||!i||!F(i.waiting)||!F(i.prioritized)||!F(i.active)||!F(i.completed)||!F(i.failed)||!F(i.delayed))throw Error(`Malformed queue summary response.`);t.add(e.name),n.push(r)}return n}function z(e){let t=L(e,`workers`);if(!Array.isArray(t.workers)||t.workers.length>M)throw Error(`Malformed workers response.`);let n=new Set,r=[],i=[];for(let e=0;e<t.workers.length;e++){let a=t.workers[e],o=N(a),s=o&&typeof o.id==`string`?o.id:null,c=[];if(o?(P(o.id,1024)?n.has(o.id)&&c.push(`duplicate id`):c.push(`id`),P(o.name,512,!0)||c.push(`name`),Ce(o.queues,ve,256)||c.push(`queues`),(!F(o.concurrency)||o.concurrency<1)&&c.push(`concurrency`),P(o.hostname,512,!0)||c.push(`hostname`),F(o.pid)||c.push(`pid`),o.status!==`active`&&o.status!==`stale`&&c.push(`status`),I(o.registeredAt)||c.push(`registeredAt`),I(o.lastSeen)||c.push(`lastSeen`),F(o.activeJobs)||c.push(`activeJobs`),F(o.processedJobs)||c.push(`processedJobs`),F(o.failedJobs)||c.push(`failedJobs`),Se(o.currentJob,1024)||c.push(`currentJob`),xe(o.uptime)||c.push(`uptime`)):c.push(`entry is not an object`),s&&n.add(s),c.length>0){i.push({index:e,id:s,reason:c.join(`, `)});continue}r.push(a)}return{ok:!0,data:{workers:r,quarantinedWorkers:i,...Object.hasOwn(t,`stats`)?{stats:t.stats}:{}}}}function we(e){if(!P(e,2048))return!1;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Te(e){let t=L(e,`webhooks`);if(!Array.isArray(t.webhooks)||t.webhooks.length>M)throw Error(`Malformed webhooks response.`);let n=new Set,r=[];for(let e of t.webhooks){let t=N(e);if(!t||!P(t.id,1024)||n.has(t.id)||!we(t.url)||!Array.isArray(t.events)||!t.events.every(e=>be.has(e))||!(t.queue===null||typeof t.queue==`string`)||!I(t.createdAt)||!(t.lastTriggered===null||I(t.lastTriggered))||!F(t.successCount)||!F(t.failureCount)||typeof t.enabled!=`boolean`)throw Error(`Malformed webhooks response.`);n.add(t.id),r.push(e)}return{ok:!0,data:{webhooks:r,...Object.hasOwn(t,`stats`)?{stats:t.stats}:{}}}}var Ee={crons:()=>p(`/crons`),createCron:e=>p(`/crons`,v(`POST`,e)),deleteCron:e=>p(`/crons/${o(e,`Cron name`,256)}`,{method:`DELETE`}),webhooks:async()=>Te(await p(`/webhooks`)),addWebhook:e=>p(`/webhooks`,v(`POST`,e)),removeWebhook:e=>p(`/webhooks/${i(e)}`,{method:`DELETE`}),setWebhookEnabled:(e,t)=>p(`/webhooks/${i(e)}/enabled`,v(`PUT`,{enabled:t})),workers:async()=>z(await p(`/workers`)),unregisterWorker:e=>p(`/workers/${i(e)}`,{method:`DELETE`}),eventsUrl:e=>t()+(e?`/events/queues/${s(e)}`:`/events`)},B=365*24*60*60*1e3,V=64*1024*1024,H=1e4,De=[`childrenIds`,`parentId`,`failParentOnFailure`,`removeDependencyOnFailure`,`continueParentOnFailure`,`ignoreDependencyOnFailure`,`keepLogs`,`sizeLimit`,`debounceId`,`debounceTtl`];function U(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`Repeat must be an object with a positive "every" interval`);let t=Object.keys(e).filter(e=>e!==`every`&&e!==`limit`);if(t.length)throw TypeError(`Unsupported repeat option(s): ${t.join(`, `)}. bunqueue v2.9.2 pattern repeats are unsafe; use the Cron API instead.`);if(!Number.isSafeInteger(e.every)||e.every<1||e.every>B)throw TypeError(`Repeat "every" must be a whole number from 1 to ${B} ms`);if(e.limit!==void 0&&(!Number.isSafeInteger(e.limit)||e.limit<1))throw TypeError(`Repeat "limit" must be a whole number of at least 1`)}function W(e){if(e!==void 0&&(typeof e!=`string`||!e||e.length>256))throw TypeError(`Job name must be a non-empty string of at most 256 characters`)}function G(e){let t=e,n=De.filter(e=>t[e]!==void 0);if(n.length)throw TypeError(`Unsupported Bunqueue v2.9.2 enqueue option(s): ${n.join(`, `)}. Flow topology must use the atomic flow API; inert compatibility fields are not sent.`)}function K(e,t){let n=a(t);if(n)throw TypeError(`${e}: ${n}. The job would not be manageable through v2.9.2 HTTP.`)}function Oe(e){if(W(e.name),U(e.repeat),G(e),e.dependsOn!==void 0&&(!Array.isArray(e.dependsOn)||!e.dependsOn.every(e=>typeof e==`string`)))throw TypeError(`dependsOn must be an array of job ID strings`);e.jobId!==void 0&&K(`jobId`,e.jobId);for(let t of e.dependsOn??[])K(`dependsOn`,t)}function ke(e){let t;try{t=JSON.stringify(e)}catch{throw TypeError(`Job payload must be JSON serializable`)}if(t===void 0)throw TypeError(`Job payload must be JSON serializable`);let n;try{n=JSON.parse(t)}catch{throw TypeError(`Job payload encoding failed`)}if(typeof n!=`object`||!n||Array.isArray(n))throw TypeError(`Job payload must serialize to a JSON object`);return Oe(n),t}function Ae({jobId:e,...t}){return e===void 0?t:{...t,customId:e}}function je(e){let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`must serialize to a JSON object`);let n=t;if(n.jobId!==void 0)throw TypeError(`serialized jobId is invalid; the bulk transport requires customId`);if(W(n.name),U(n.repeat),G(n),n.customId!==void 0){if(typeof n.customId!=`string`)throw TypeError(`customId must be a string`);K(`customId`,n.customId)}if(n.dependsOn!==void 0){if(!Array.isArray(n.dependsOn)||!n.dependsOn.every(e=>typeof e==`string`))throw TypeError(`dependsOn must be an array of job ID strings`);for(let e of n.dependsOn)K(`dependsOn`,e)}}function Me(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i<=127?n+=1:i<=2047?n+=2:i>=55296&&i<=56319&&r+1<e.length&&e.charCodeAt(r+1)>=56320&&e.charCodeAt(r+1)<=57343?(n+=4,r+=1):n+=3,n>t)return n}return n}function q(e,t,n){if(!Array.isArray(e)||e.length>1e4)return{ok:!1,error:`Bulk request must contain at most ${H} jobs`};if(!Number.isSafeInteger(t)||t<0)return{ok:!1,error:`Bulk request payload limit is invalid`};let r=11,i=n?Array(e.length):null;for(let a=0;a<e.length;a++){if(a&&(r+=1),r>t)return{ok:!1,error:`Bulk request payload exceeds the 64 MiB UTF-8 safety limit`};let o;try{o=JSON.stringify(Ae(e[a]))}catch{return{ok:!1,error:`Bulk request payload must be JSON serializable`}}if(o===void 0)return{ok:!1,error:`Bulk request payload must be JSON serializable`};if(r+=Me(o,t-r),r>t)return{ok:!1,error:`Bulk request payload exceeds the 64 MiB UTF-8 safety limit`};if(n)try{je(o)}catch(e){return{ok:!1,error:`Bulk job ${a+1}: ${e instanceof Error?e.message:String(e)}`}}i&&(i[a]=o)}return{ok:!0,bytes:r,body:i?`{"jobs":[${i.join(`,`)}]}`:void 0}}function Ne(e,t=V){let n=q(e,t,!1);return n.ok?null:n.error}function J(e){let t=q(e,V,!0);if(!t.ok)throw TypeError(t.error);if(t.body===void 0)throw TypeError(`Bulk request payload encoding failed`);return t.body}function Y(e){if(!Array.isArray(e)||e.length>1e4)throw TypeError(`Bulk request must contain at most ${H} jobs`)}var Pe={overview:e=>p(`/dashboard`,e),queues:(e=500,t=0)=>p(`/dashboard/queues?limit=${e}&offset=${t}`),queuesSummary:async()=>R(await p(`/queues/summary`)),queueDetail:(e,t=!0)=>p(`/dashboard/queues/${c(e)}?includeJobs=${t}`),stats:e=>p(`/stats`,e),storage:()=>p(`/storage`,void 0,!1),health:()=>p(`/health`,void 0,!1,[503]),ping:()=>p(`/ping`),prometheusUrl:()=>`${t()}/prometheus`,gc:()=>p(`/gc`,v(`POST`)),heapStats:()=>p(`/heapstats`)},Fe={jobsList:(e,t,n=50,r=0)=>{let i=new URLSearchParams;return t?.length&&i.set(`states`,t.join(`,`)),i.set(`limit`,String(n)),i.set(`offset`,String(r)),p(`/queues/${c(e)}/jobs/list?${i}`)},job:e=>p(`/jobs/${i(e)}`),jobByCustomId:e=>p(`/jobs/custom/${o(e,`Custom job ID`)}`),jobResult:e=>p(`/jobs/${i(e)}/result`),jobLogs:e=>p(`/jobs/${i(e)}/logs`),jobChildren:e=>p(`/jobs/${i(e)}/children`),addJob:async(e,t)=>p(`/queues/${c(e)}/jobs`,{method:`POST`,body:ke(t)}),addJobsBulk:async(e,t)=>(Y(t),p(`/queues/${c(e)}/jobs/bulk`,{method:`POST`,body:J(t)},!0,[],y)),pullBatch:(e,t)=>p(`/queues/${c(e)}/jobs/pull-batch`,v(`POST`,{count:t})),ackBatch:e=>p(`/jobs/ack-batch`,v(`POST`,{ids:e})),cancelJob:e=>p(`/jobs/${i(e)}`,{method:`DELETE`}),promoteJob:e=>p(`/jobs/${i(e)}/promote`,v(`POST`)),discardJob:e=>p(`/jobs/${i(e)}/discard`,v(`POST`)),retryJob:e=>p(`/jobs/${i(e)}/move-to-wait`,v(`POST`)),failJob:(e,t,n={})=>p(`/jobs/${i(e)}/fail`,v(`POST`,{error:t,...n})),updateJobData:(e,t)=>p(`/jobs/${i(e)}/data`,v(`PUT`,{data:t})),changePriority:(e,t,n)=>p(`/jobs/${i(e)}/priority`,v(`PUT`,{priority:t,...n===void 0?{}:{lifo:n}})),changeDelay:(e,t)=>p(`/jobs/${i(e)}/delay`,v(`PUT`,{delay:t})),moveToDelayed:(e,t)=>p(`/jobs/${i(e)}/move-to-delayed`,v(`POST`,{delay:t})),addJobLog:(e,t,n)=>p(`/jobs/${i(e)}/logs`,v(`POST`,{message:t,level:n})),clearJobLogs:e=>p(`/jobs/${i(e)}/logs`,{method:`DELETE`}),setJobProgress:(e,t,n)=>p(`/jobs/${i(e)}/progress`,v(`POST`,{progress:t,message:n}))};function X(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new l(`Malformed ${t} response.`,200);return e}function Z(e,t){let n=X(e,t);if(n.ok!==!0)throw new l(`Malformed ${t} response.`,200);return n}var Q=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0;function $(e,t){if(e!==void 0)return Z(e,t)}function Ie(e,t){let n={...w(e)},r=(r,i,a=d())=>{let o=t?{...i,signal:i?.signal?AbortSignal.any([i.signal,t]):t}:i;return f(e.baseUrl,r,n,o,!0,`server`,[],a)};return Object.freeze({queuesSummary:async()=>R(await r(`/queues/summary`)),overview:()=>r(`/dashboard`),counts:async e=>{let t=X(Z(await r(`/queues/${c(e)}/counts`),`queue counts`).counts,`queue counts`);if(!Object.values(t).every(Q))throw new l(`Malformed queue counts response.`,200);return{ok:!0,counts:t}},jobsList:async(e,t,n=50,i=0)=>{let a=new URLSearchParams;t?.length&&a.set(`states`,t.join(`,`)),a.set(`limit`,String(n)),a.set(`offset`,String(i));let o=Z(await r(`/queues/${c(e)}/jobs/list?${a}`),`jobs list`);if(!Array.isArray(o.jobs)||!o.jobs.every(t=>{let n=t;return typeof n==`object`&&!!n&&!Array.isArray(n)&&typeof n.id==`string`&&n.id.length>0&&(n.queue===void 0||n.queue===e)}))throw new l(`Malformed jobs list response.`,200);return{ok:!0,jobs:o.jobs}},job:async e=>{let t=X(Z(await r(`/jobs/${i(e)}`),`job`).job,`job`);if(t.id!==e)throw new l(`Malformed job response.`,200);return{ok:!0,job:t}},dlqStats:async e=>{let t=X(Z(await r(`/queues/${c(e)}/dlq/stats`),`DLQ stats`).stats,`DLQ stats`);if(!Q(t.total))throw new l(`Malformed DLQ stats response.`,200);return{ok:!0,stats:t}},dlq:async(e,t=100,n=0)=>{let i=Z(await r(`/queues/${c(e)}/dlq?limit=${t}&offset=${n}`),`DLQ list`);if(!Array.isArray(i.entries)||!Q(i.total))throw new l(`Malformed DLQ list response.`,200);for(let e of i.entries){let t=X(X(e,`DLQ list`).job,`DLQ list`);if(typeof t.id!=`string`||!t.id)throw new l(`Malformed DLQ list response.`,200)}return{ok:!0,entries:i.entries,total:i.total}},health:async()=>X(await f(e.baseUrl,`/health`,n,t?{signal:t}:void 0,!1,`server`,[503]),`health`),stats:async()=>{let e=await r(`/stats`);return X(Z(e,`server stats`).stats,`server stats`),e},workers:async()=>z(await r(`/workers`)),crons:async()=>{let e=Z(await r(`/crons`),`crons`);if(!Array.isArray(e.crons)||!e.crons.every(e=>{let t=e;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.name==`string`&&!!t.name&&typeof t.queue==`string`&&!!t.queue}))throw new l(`Malformed crons response.`,200);return{ok:!0,crons:e.crons}},addJobsBulk:async(e,t)=>(Y(t),r(`/queues/${c(e)}/jobs/bulk`,{method:`POST`,body:J(t)},y)),pullBatch:(e,t)=>r(`/queues/${c(e)}/jobs/pull-batch`,v(`POST`,{count:t})),heartbeatBatch:e=>r(`/jobs/heartbeat-batch`,v(`POST`,{ids:e})),ackBatch:e=>r(`/jobs/ack-batch`,v(`POST`,{ids:e})),retryJob:e=>r(`/jobs/${i(e)}/move-to-wait`,v(`POST`)),promoteJob:async e=>$(await r(`/jobs/${i(e)}/promote`,v(`POST`)),`promote job`),pause:async e=>$(await r(`/queues/${c(e)}/pause`,v(`POST`)),`pause queue`),resume:async e=>$(await r(`/queues/${c(e)}/resume`,v(`POST`)),`resume queue`),clean:(e,t={})=>r(`/queues/${c(e)}/clean`,v(`POST`,t))})}var Le={...Pe,captureServerRequestTarget:S,createServerTargetClient:Ie,getJobAtTarget:E,captureAgentRequestTarget:C,getDbRowsAtTarget:ue,getDbExportAtTarget:he,...Fe,...ge,queueOperations:_e,...Ee,db:ie,get agentBase(){return ee()},control:ae,workflows:oe};Object.defineProperty(Le,"agentBase",{configurable:!1});export{l as a,re as c,S as d,E as f,O as i,f as l,Ie as n,T as o,Ne as r,_ as s,Le as t,C as u};
@@ -1 +1 @@
1
- import{i as e}from"./cn-zFEt5SO8.js";import{g as t}from"./react-vendor-CyjgmGTq.js";var n=e(t(),1),r=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},i=(e=>e?r(e):r),a=e=>e;function o(e,t=a){let r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r}var s=e=>{let t=i(e),n=e=>o(t,e);return Object.assign(n,t),n},c=(e=>e?s(e):s);function l(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var u=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return u(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return u(t)(e)}}}},d=(e,t)=>(n,r,i)=>{let a={storage:l(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,d=new Set,f=a.storage;if(!f)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let p=()=>{let e=a.partialize({...r()});return f.setItem(a.name,{state:e,version:a.version})},m=i.setState;i.setState=(e,t)=>(m(e,t),p());let h=e((...e)=>(n(...e),p()),r,i);i.getInitialState=()=>h;let g,_=()=>{if(!f)return;let e=++s;o=!1,c.forEach(e=>e(r()??h));let t=a.onRehydrateStorage?.call(a,r()??h)||void 0;return u(f.getItem.bind(f))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(g=a.merge(o,r()??h),n(g,!0),i)return p()}).then(()=>{e===s&&(t?.(r(),void 0),g=r(),o=!0,d.forEach(e=>e(g)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(f=e.storage)},clearStorage:()=>{f?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>_(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(d.add(e),()=>{d.delete(e)})},a.skipHydration||_(),g||h},f=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function p(e,t=!1){try{let n=globalThis.localStorage??null;return!n&&t&&e.reportMissingWrites&&e.onError?.(Error(`localStorage is unavailable`)),n}catch(t){return e.onError?.(t),null}}function m(e,t){try{let n=JSON.parse(e),r=f(n)?n:{},i=t.sanitizeState(`state`in r?r.state:r),a=typeof r.version==`number`?r.version:void 0;return{hydration:JSON.stringify({state:i,...a===void 0?{}:{version:a}}),canonical:JSON.stringify({state:i,version:t.version})}}catch(e){return t.onError?.(e),null}}function h(e){let t=t=>e.onError?.(t);return{getItem(n){let r=p(e);if(!r)return null;let i;try{i=r.getItem(n)}catch(e){return t(e),null}if(i===null||n!==e.key)return i;let a=m(i,e);if(!a){try{r.removeItem(n)}catch(e){t(e)}return null}if(i!==a.canonical)try{r.setItem(n,a.canonical)}catch(e){t(e);try{r.removeItem(n)}catch(e){t(e)}}return a.hydration},setItem(n,r){let i=p(e,!0);if(i)try{i.setItem(n,r)}catch(e){t(e)}},removeItem(n){let r=p(e);if(r)try{r.removeItem(n)}catch(e){t(e)}}}}var g=/^\/(?:[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*)?\/?$/;function _(e){try{return globalThis[e]}catch{return}}function v(e){if(typeof e!=`string`)return null;let t=e.trim();return!g.test(t)||t.split(`/`).some(e=>e===`.`||e===`..`)?null:t.replace(/\/+$/,``)||`/`}function y(e,t){return v(e)??v(t)??`/`}var b=`bq-dash-connection`,x=3,S=`Use an http(s) URL without credentials, query, or fragment, or a non-root path starting with '/'.`,C=`https://bunqueue-dashboard.invalid`,w=/\s/u;function T(e){return[...e].some(e=>{let t=e.charCodeAt(0);return e===`\\`||w.test(e)||t<32||t===127})}function E(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t||t.includes(`?`)||t.includes(`#`)||T(t))return null;if(t.startsWith(`/`)){if(t.startsWith(`//`))return null;try{let e=new URL(t,C),n=e.pathname.replace(/\/+$/,``);return e.origin!==C||!n||n===`/`||n.startsWith(`//`)?null:n}catch{return null}}let n=t.match(/^https?:\/\//i)?.[0];if(!n)return null;let r=t.slice(n.length).split(`/`,1)[0];if(!r||r.includes(`@`))return null;try{let e=new URL(t);if(e.protocol!==`http:`&&e.protocol!==`https:`||!e.hostname||e.username||e.password)return null;let n=e.pathname.replace(/\/+$/,``);return n.startsWith(`//`)?null:`${e.origin}${n}`}catch{return null}}function D(e,t){return E(e)??E(t)??`/api`}var O=D(void 0,_(`__BUNQUEUE_API_URL__`)),k=3e3,A=500,j=6e4;function M(e){return E(e)??O}function N(e){return typeof e!=`number`||!Number.isFinite(e)?k:Math.min(j,Math.max(A,Math.round(e)))}function P(e){return typeof e==`string`?e.trim():``}function F(e){return{baseUrl:M(e.baseUrl),refreshMs:N(e.refreshMs)}}function I(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{baseUrl:M(t.baseUrl),refreshMs:N(t.refreshMs)}}function L(e,t,n=O){let r=I(e);return t<x&&r.baseUrl===`/api`?{...r,baseUrl:D(void 0,n)}:r}var R=null;function z(e){return e instanceof Error?e:Error(String(e))}function B(e){R=z(e)}function V(){return R?{persisted:!1,error:`${R.name&&R.name!==`Error`?`${R.name}: `:``}${R.message}`}:{persisted:!0}}var H=h({key:b,version:x,sanitizeState:I,onError:B,reportMissingWrites:!0}),U=l(()=>H),W=c()(d(e=>({baseUrl:O,token:``,agentToken:``,refreshMs:k,saveConnection:t=>(R=null,e({baseUrl:M(t.baseUrl),token:P(t.token),agentToken:P(t.agentToken)}),V()),setBaseUrl:t=>e({baseUrl:M(t)}),setToken:t=>e({token:P(t)}),setAgentToken:t=>e({agentToken:P(t)}),setRefreshMs:t=>e({refreshMs:N(t)})}),{name:b,storage:U,version:x,partialize:F,migrate:L,merge:(e,t)=>({...t,...I(e),token:``,agentToken:``})}));function G(){return M(W.getState().baseUrl)}function K(){let e=P(W.getState().token);return e?{Authorization:`Bearer ${e}`}:{}}function q(){let e=P(W.getState().agentToken);return e?{Authorization:`Bearer ${e}`}:{}}export{E as a,_ as c,d,c as f,G as i,h as l,q as n,W as o,K as r,y as s,S as t,l as u};
1
+ import{i as e}from"./cn-zFEt5SO8.js";import{g as t}from"./react-vendor-CvwrP0tU.js";var n=e(t(),1),r=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},i=(e=>e?r(e):r),a=e=>e;function o(e,t=a){let r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r}var s=e=>{let t=i(e),n=e=>o(t,e);return Object.assign(n,t),n},c=(e=>e?s(e):s);function l(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var u=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return u(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return u(t)(e)}}}},d=(e,t)=>(n,r,i)=>{let a={storage:l(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,d=new Set,f=a.storage;if(!f)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let p=()=>{let e=a.partialize({...r()});return f.setItem(a.name,{state:e,version:a.version})},m=i.setState;i.setState=(e,t)=>(m(e,t),p());let h=e((...e)=>(n(...e),p()),r,i);i.getInitialState=()=>h;let g,_=()=>{if(!f)return;let e=++s;o=!1,c.forEach(e=>e(r()??h));let t=a.onRehydrateStorage?.call(a,r()??h)||void 0;return u(f.getItem.bind(f))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(g=a.merge(o,r()??h),n(g,!0),i)return p()}).then(()=>{e===s&&(t?.(r(),void 0),g=r(),o=!0,d.forEach(e=>e(g)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(f=e.storage)},clearStorage:()=>{f?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>_(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(d.add(e),()=>{d.delete(e)})},a.skipHydration||_(),g||h},f=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function p(e,t=!1){try{let n=globalThis.localStorage??null;return!n&&t&&e.reportMissingWrites&&e.onError?.(Error(`localStorage is unavailable`)),n}catch(t){return e.onError?.(t),null}}function m(e,t){try{let n=JSON.parse(e),r=f(n)?n:{},i=t.sanitizeState(`state`in r?r.state:r),a=typeof r.version==`number`?r.version:void 0;return{hydration:JSON.stringify({state:i,...a===void 0?{}:{version:a}}),canonical:JSON.stringify({state:i,version:t.version})}}catch(e){return t.onError?.(e),null}}function h(e){let t=t=>e.onError?.(t);return{getItem(n){let r=p(e);if(!r)return null;let i;try{i=r.getItem(n)}catch(e){return t(e),null}if(i===null||n!==e.key)return i;let a=m(i,e);if(!a){try{r.removeItem(n)}catch(e){t(e)}return null}if(i!==a.canonical)try{r.setItem(n,a.canonical)}catch(e){t(e);try{r.removeItem(n)}catch(e){t(e)}}return a.hydration},setItem(n,r){let i=p(e,!0);if(i)try{i.setItem(n,r)}catch(e){t(e)}},removeItem(n){let r=p(e);if(r)try{r.removeItem(n)}catch(e){t(e)}}}}var g=/^\/(?:[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*)?\/?$/;function _(e){try{return globalThis[e]}catch{return}}function v(e){if(typeof e!=`string`)return null;let t=e.trim();return!g.test(t)||t.split(`/`).some(e=>e===`.`||e===`..`)?null:t.replace(/\/+$/,``)||`/`}function y(e,t){return v(e)??v(t)??`/`}var b=`bq-dash-connection`,x=3,S=`Use an http(s) URL without credentials, query, or fragment, or a non-root path starting with '/'.`,C=`https://bunqueue-dashboard.invalid`,w=/\s/u;function T(e){return[...e].some(e=>{let t=e.charCodeAt(0);return e===`\\`||w.test(e)||t<32||t===127})}function E(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t||t.includes(`?`)||t.includes(`#`)||T(t))return null;if(t.startsWith(`/`)){if(t.startsWith(`//`))return null;try{let e=new URL(t,C),n=e.pathname.replace(/\/+$/,``);return e.origin!==C||!n||n===`/`||n.startsWith(`//`)?null:n}catch{return null}}let n=t.match(/^https?:\/\//i)?.[0];if(!n)return null;let r=t.slice(n.length).split(`/`,1)[0];if(!r||r.includes(`@`))return null;try{let e=new URL(t);if(e.protocol!==`http:`&&e.protocol!==`https:`||!e.hostname||e.username||e.password)return null;let n=e.pathname.replace(/\/+$/,``);return n.startsWith(`//`)?null:`${e.origin}${n}`}catch{return null}}function D(e,t){return E(e)??E(t)??`/api`}var O=D(void 0,_(`__BUNQUEUE_API_URL__`)),k=3e3,A=500,j=6e4;function M(e){return E(e)??O}function N(e){return typeof e!=`number`||!Number.isFinite(e)?k:Math.min(j,Math.max(A,Math.round(e)))}function P(e){return typeof e==`string`?e.trim():``}function F(e){return{baseUrl:M(e.baseUrl),refreshMs:N(e.refreshMs)}}function I(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{baseUrl:M(t.baseUrl),refreshMs:N(t.refreshMs)}}function L(e,t,n=O){let r=I(e);return t<x&&r.baseUrl===`/api`?{...r,baseUrl:D(void 0,n)}:r}var R=null;function z(e){return e instanceof Error?e:Error(String(e))}function B(e){R=z(e)}function V(){return R?{persisted:!1,error:`${R.name&&R.name!==`Error`?`${R.name}: `:``}${R.message}`}:{persisted:!0}}var H=h({key:b,version:x,sanitizeState:I,onError:B,reportMissingWrites:!0}),U=l(()=>H),W=c()(d(e=>({baseUrl:O,token:``,agentToken:``,refreshMs:k,saveConnection:t=>(R=null,e({baseUrl:M(t.baseUrl),token:P(t.token),agentToken:P(t.agentToken)}),V()),setBaseUrl:t=>e({baseUrl:M(t)}),setToken:t=>e({token:P(t)}),setAgentToken:t=>e({agentToken:P(t)}),setRefreshMs:t=>e({refreshMs:N(t)})}),{name:b,storage:U,version:x,partialize:F,migrate:L,merge:(e,t)=>({...t,...I(e),token:``,agentToken:``})}));function G(){return M(W.getState().baseUrl)}function K(){let e=P(W.getState().token);return e?{Authorization:`Bearer ${e}`}:{}}function q(){let e=P(W.getState().agentToken);return e?{Authorization:`Bearer ${e}`}:{}}export{E as a,_ as c,d,c as f,G as i,h as l,q as n,W as o,K as r,y as s,S as t,l as u};
@@ -1 +1 @@
1
- import{i as e}from"./cn-zFEt5SO8.js";import{g as t}from"./react-vendor-CyjgmGTq.js";import{o as n}from"./connectionStore-CKFQrxDo.js";var r=e(t(),1),i=0,a=new Set;n.subscribe((e,t)=>{if(!(e.baseUrl===t.baseUrl&&e.token===t.token&&e.agentToken===t.agentToken)){i+=1;for(let e of a)e()}});function o(){return i}function s(){return(0,r.useSyncExternalStore)(c,o,o)}function c(e){return a.add(e),()=>a.delete(e)}export{s as n,o as t};
1
+ import{i as e}from"./cn-zFEt5SO8.js";import{g as t}from"./react-vendor-CvwrP0tU.js";import{o as n}from"./connectionStore-CFuNYZ_8.js";var r=e(t(),1),i=0,a=new Set;n.subscribe((e,t)=>{if(!(e.baseUrl===t.baseUrl&&e.token===t.token&&e.agentToken===t.agentToken)){i+=1;for(let e of a)e()}});function o(){return i}function s(){return(0,r.useSyncExternalStore)(c,o,o)}function c(e){return a.add(e),()=>a.delete(e)}export{s as n,o as t};
@@ -1 +1 @@
1
- import{t as e}from"./cn-zFEt5SO8.js";import{t}from"./react-vendor-CyjgmGTq.js";var n=t();function r({className:t,decorative:r=!1}){let i=e(`inline-block size-4 animate-spin rounded-full border-2 border-current border-t-transparent`,t);return r?(0,n.jsx)(`span`,{className:i,"aria-hidden":`true`}):(0,n.jsx)(`span`,{className:i,role:`status`,"aria-label":`Loading`})}function i({label:e=`Loading…`}){return(0,n.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`flex items-center justify-center gap-3 py-16 text-sm text-muted`,children:[(0,n.jsx)(r,{decorative:!0}),e]})}function a({icon:e,title:t,hint:r,action:i}){return(0,n.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-line py-14 text-center`,children:[e&&(0,n.jsx)(`div`,{className:`text-faint [&>svg]:size-8`,children:e}),(0,n.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t}),r&&(0,n.jsx)(`div`,{className:`max-w-sm text-xs text-faint`,children:r}),i&&(0,n.jsx)(`div`,{className:`mt-2`,children:i})]})}function o({onRetry:e,message:t=`Could not refresh bunqueue data — the view may be unavailable or stale.`}){return(0,n.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-500/25 bg-amber-500/[0.06] px-4 py-2.5 text-sm`,children:[(0,n.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`text-amber-300/90 light:text-amber-700`,children:t}),e&&(0,n.jsx)(`button`,{type:`button`,onClick:e,className:`ml-auto shrink-0 rounded-md border border-amber-500/30 px-2.5 py-1 text-xs font-medium text-amber-200 light:text-amber-700 hover:border-amber-400/50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,children:`Retry`})]})}function s({error:e,onRetry:t}){return(0,n.jsxs)(`div`,{role:`alert`,"aria-atomic":`true`,className:`flex flex-col items-center justify-center gap-3 rounded-xl border border-red-500/20 bg-red-500/5 py-14 text-center`,children:[(0,n.jsx)(`div`,{className:`text-sm font-medium text-danger`,children:`Something went wrong`}),(0,n.jsx)(`div`,{className:`max-w-md text-xs text-faint`,children:e.message}),t&&(0,n.jsx)(`button`,{type:`button`,onClick:t,className:`mt-1 rounded-lg border border-line bg-surface-2 px-3 py-1.5 text-xs font-medium text-fg hover:border-line-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,children:`Retry`})]})}export{o as i,s as n,i as r,a as t};
1
+ import{t as e}from"./cn-zFEt5SO8.js";import{t}from"./react-vendor-CvwrP0tU.js";var n=t();function r({className:t,decorative:r=!1}){let i=e(`inline-block size-4 animate-spin rounded-full border-2 border-current border-t-transparent`,t);return r?(0,n.jsx)(`span`,{className:i,"aria-hidden":`true`}):(0,n.jsx)(`span`,{className:i,role:`status`,"aria-label":`Loading`})}function i({label:e=`Loading…`}){return(0,n.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`flex items-center justify-center gap-3 py-16 text-sm text-muted`,children:[(0,n.jsx)(r,{decorative:!0}),e]})}function a({icon:e,title:t,hint:r,action:i}){return(0,n.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-line py-14 text-center`,children:[e&&(0,n.jsx)(`div`,{className:`text-faint [&>svg]:size-8`,children:e}),(0,n.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t}),r&&(0,n.jsx)(`div`,{className:`max-w-sm text-xs text-faint`,children:r}),i&&(0,n.jsx)(`div`,{className:`mt-2`,children:i})]})}function o({onRetry:e,message:t=`Could not refresh bunqueue data — the view may be unavailable or stale.`}){return(0,n.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-500/25 bg-amber-500/[0.06] px-4 py-2.5 text-sm`,children:[(0,n.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`text-amber-300/90 light:text-amber-700`,children:t}),e&&(0,n.jsx)(`button`,{type:`button`,onClick:e,className:`ml-auto shrink-0 rounded-md border border-amber-500/30 px-2.5 py-1 text-xs font-medium text-amber-200 light:text-amber-700 hover:border-amber-400/50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,children:`Retry`})]})}function s({error:e,onRetry:t}){return(0,n.jsxs)(`div`,{role:`alert`,"aria-atomic":`true`,className:`flex flex-col items-center justify-center gap-3 rounded-xl border border-red-500/20 bg-red-500/5 py-14 text-center`,children:[(0,n.jsx)(`div`,{className:`text-sm font-medium text-danger`,children:`Something went wrong`}),(0,n.jsx)(`div`,{className:`max-w-md text-xs text-faint`,children:e.message}),t&&(0,n.jsx)(`button`,{type:`button`,onClick:t,className:`mt-1 rounded-lg border border-line bg-surface-2 px-3 py-1.5 text-xs font-medium text-fg hover:border-line-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,children:`Retry`})]})}export{o as i,s as n,i as r,a as t};
@@ -0,0 +1 @@
1
+ var e=`Unavailable in Bunqueue v2.9.2: the server cannot inspect reverse flow dependencies or delete/discard topology atomically.`,t=`DLQ retry is unavailable in Bunqueue v2.9.2: its GET and retry POST have no atomic job-generation, state, or flow-topology precondition.`,n=t,r=`Completed-job requeue is unavailable in Bunqueue v2.9.2 because retry-completed re-inserts a child without rebuilding its flow dependency registration.`,i=`DLQ max age and max entries are read-only: changing them can expire or immediately evict a flow child without an atomic reverse-dependency check.`;export{n as a,i,r as n,e as r,t};
@@ -1 +1 @@
1
- import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,t as r}from"./react-vendor-CyjgmGTq.js";var i=e(n(),1),a=r();function o({children:e,htmlFor:t}){return(0,a.jsx)(`label`,{htmlFor:t,className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e})}function s({label:e,hint:t,htmlFor:n,children:r}){let s=(0,i.useId)(),c=r,d=n;if(!n&&(0,i.isValidElement)(r)){let e=r;(typeof e.type==`string`&&[`input`,`select`,`textarea`].includes(e.type)||e.type===l||e.type===u)&&(d=e.props.id??s,c=e.props.id?e:(0,i.cloneElement)(e,{id:s}))}return(0,a.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,a.jsx)(o,{htmlFor:d,children:e}),c,t&&(0,a.jsx)(`p`,{className:`text-xs leading-relaxed text-faint`,children:t})]})}var c=`h-9 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg placeholder:text-faint transition-colors focus-visible:border-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`;function l({className:e,...n}){return(0,a.jsx)(`input`,{className:t(c,`w-full`,e),...n})}function u({className:e,children:n,...r}){return(0,a.jsx)(`select`,{className:t(c,`w-full cursor-pointer pr-8`,e),...r,children:n})}function d({checked:e,onChange:n,label:r,disabled:i}){return(0,a.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:i,onClick:()=>n(!e),className:t(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,e?`bg-accent`:`bg-surface-2 border border-line`,i&&`opacity-40`),children:(0,a.jsx)(`span`,{className:t(`inline-block size-4 transform rounded-full bg-white shadow transition-transform`,e?`translate-x-6`:`translate-x-1`)})})}function f({options:e,value:n,onChange:r,disabled:i,label:o=`View options`}){return(0,a.jsxs)(`fieldset`,{className:`inline-flex items-center gap-1 rounded-lg border border-line bg-surface p-1`,children:[(0,a.jsx)(`legend`,{className:`sr-only`,children:o}),e.map(e=>(0,a.jsx)(`button`,{type:`button`,"aria-pressed":n===e,disabled:i,onClick:()=>r(e),className:t(`rounded-md px-3 py-1 text-xs font-medium capitalize transition-colors`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,n===e?`bg-surface-2 text-fg`:`text-muted hover:text-fg`,i&&`opacity-40`),children:e},e))]})}export{u as a,f as i,l as n,d as o,o as r,s as t};
1
+ import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,t as r}from"./react-vendor-CvwrP0tU.js";var i=e(n(),1),a=r();function o({children:e,htmlFor:t}){return(0,a.jsx)(`label`,{htmlFor:t,className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e})}function s({label:e,hint:t,htmlFor:n,children:r}){let s=(0,i.useId)(),c=r,d=n;if(!n&&(0,i.isValidElement)(r)){let e=r;(typeof e.type==`string`&&[`input`,`select`,`textarea`].includes(e.type)||e.type===l||e.type===u)&&(d=e.props.id??s,c=e.props.id?e:(0,i.cloneElement)(e,{id:s}))}return(0,a.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,a.jsx)(o,{htmlFor:d,children:e}),c,t&&(0,a.jsx)(`p`,{className:`text-xs leading-relaxed text-faint`,children:t})]})}var c=`h-9 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg placeholder:text-faint transition-colors focus-visible:border-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`;function l({className:e,...n}){return(0,a.jsx)(`input`,{className:t(c,`w-full`,e),...n})}function u({className:e,children:n,...r}){return(0,a.jsx)(`select`,{className:t(c,`w-full cursor-pointer pr-8`,e),...r,children:n})}function d({checked:e,onChange:n,label:r,disabled:i}){return(0,a.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:i,onClick:()=>n(!e),className:t(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,e?`bg-accent`:`bg-surface-2 border border-line`,i&&`opacity-40`),children:(0,a.jsx)(`span`,{className:t(`inline-block size-4 transform rounded-full bg-white shadow transition-transform`,e?`translate-x-6`:`translate-x-1`)})})}function f({options:e,value:n,onChange:r,disabled:i,label:o=`View options`}){return(0,a.jsxs)(`fieldset`,{className:`inline-flex items-center gap-1 rounded-lg border border-line bg-surface p-1`,children:[(0,a.jsx)(`legend`,{className:`sr-only`,children:o}),e.map(e=>(0,a.jsx)(`button`,{type:`button`,"aria-pressed":n===e,disabled:i,onClick:()=>r(e),className:t(`rounded-md px-3 py-1 text-xs font-medium capitalize transition-colors`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,n===e?`bg-surface-2 text-fg`:`text-muted hover:text-fg`,i&&`opacity-40`),children:e},e))]})}export{u as a,f as i,l as n,d as o,o as r,s as t};
@@ -1 +1 @@
1
- import{t as e}from"./react-vendor-CyjgmGTq.js";var t=e();function n({children:e,...n}){return(0,t.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...n,children:e})}var r=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M3 3v18h18`}),(0,t.jsx)(`rect`,{x:`7`,y:`12`,width:`3`,height:`6`}),(0,t.jsx)(`rect`,{x:`12`,y:`8`,width:`3`,height:`10`}),(0,t.jsx)(`rect`,{x:`17`,y:`5`,width:`3`,height:`13`})]}),i=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,t.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,t.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,t.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`}),(0,t.jsx)(`line`,{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`}),(0,t.jsx)(`line`,{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`})]}),a=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`2`,y:`7`,width:`20`,height:`14`,rx:`2`}),(0,t.jsx)(`path`,{d:`M16 7V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`})]}),o=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z`}),(0,t.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,t.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),s=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,t.jsx)(`polyline`,{points:`12 7 12 12 15 14`})]}),c=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M3 3v18h18`}),(0,t.jsx)(`path`,{d:`m19 9-5 5-4-4-3 3`})]}),l=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`8`,rx:`2`}),(0,t.jsx)(`rect`,{x:`4`,y:`14`,width:`16`,height:`6`,rx:`2`}),(0,t.jsx)(`line`,{x1:`8`,y1:`8`,x2:`8.01`,y2:`8`}),(0,t.jsx)(`line`,{x1:`8`,y1:`17`,x2:`8.01`,y2:`17`})]}),u=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9`}),(0,t.jsx)(`path`,{d:`M13.73 21a2 2 0 0 1-3.46 0`})]}),d=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,t.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,t.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,t.jsx)(`path`,{d:`M3 6h.01M3 12h.01M3 18h.01`})]}),f=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M12 20V10`}),(0,t.jsx)(`path`,{d:`M18 20V4`}),(0,t.jsx)(`path`,{d:`M6 20v-4`})]}),p=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,t.jsx)(`path`,{d:`M4 5v6c0 1.66 3.58 3 8 3s8-1.34 8-3V5`}),(0,t.jsx)(`path`,{d:`M4 11v6c0 1.66 3.58 3 8 3s8-1.34 8-3v-6`})]}),m=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,t.jsx)(`path`,{d:`M3 10h18`}),(0,t.jsx)(`path`,{d:`M9 10v10`})]}),h=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,t.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z`})]}),g=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,t.jsx)(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41`})]}),_=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z`})}),v=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),y=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),b=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})}),x=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`}),(0,t.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`})]}),S=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,t.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]}),C=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`polyline`,{points:`23 4 23 10 17 10`}),(0,t.jsx)(`polyline`,{points:`1 20 1 14 7 14`}),(0,t.jsx)(`path`,{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`})]}),w=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,t.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),T=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8Z`}),(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),E=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polygon`,{points:`13 2 3 14 12 14 11 22 21 10 12 10 13 2`})}),D=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,t.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),O=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),k=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,t.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]}),A=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,t.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),j=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`3`,y1:`6`,x2:`21`,y2:`6`}),(0,t.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),(0,t.jsx)(`line`,{x1:`3`,y1:`18`,x2:`21`,y2:`18`})]}),M=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,t.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,t.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]});export{l as A,C,g as D,h as E,S as O,i as S,w as T,c as _,y as a,x as b,s as c,M as d,T as f,j as g,d as h,v as i,f as k,m as l,E as m,k as n,D as o,a as p,O as r,A as s,u as t,o as u,_ as v,p as w,b as x,r as y};
1
+ import{t as e}from"./react-vendor-CvwrP0tU.js";var t=e();function n({children:e,...n}){return(0,t.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...n,children:e})}var r=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M3 3v18h18`}),(0,t.jsx)(`rect`,{x:`7`,y:`12`,width:`3`,height:`6`}),(0,t.jsx)(`rect`,{x:`12`,y:`8`,width:`3`,height:`10`}),(0,t.jsx)(`rect`,{x:`17`,y:`5`,width:`3`,height:`13`})]}),i=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,t.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,t.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,t.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`}),(0,t.jsx)(`line`,{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`}),(0,t.jsx)(`line`,{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`})]}),a=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`2`,y:`7`,width:`20`,height:`14`,rx:`2`}),(0,t.jsx)(`path`,{d:`M16 7V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`})]}),o=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z`}),(0,t.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,t.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),s=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,t.jsx)(`polyline`,{points:`12 7 12 12 15 14`})]}),c=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M3 3v18h18`}),(0,t.jsx)(`path`,{d:`m19 9-5 5-4-4-3 3`})]}),l=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`8`,rx:`2`}),(0,t.jsx)(`rect`,{x:`4`,y:`14`,width:`16`,height:`6`,rx:`2`}),(0,t.jsx)(`line`,{x1:`8`,y1:`8`,x2:`8.01`,y2:`8`}),(0,t.jsx)(`line`,{x1:`8`,y1:`17`,x2:`8.01`,y2:`17`})]}),u=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9`}),(0,t.jsx)(`path`,{d:`M13.73 21a2 2 0 0 1-3.46 0`})]}),d=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,t.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,t.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,t.jsx)(`path`,{d:`M3 6h.01M3 12h.01M3 18h.01`})]}),f=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M12 20V10`}),(0,t.jsx)(`path`,{d:`M18 20V4`}),(0,t.jsx)(`path`,{d:`M6 20v-4`})]}),p=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,t.jsx)(`path`,{d:`M4 5v6c0 1.66 3.58 3 8 3s8-1.34 8-3V5`}),(0,t.jsx)(`path`,{d:`M4 11v6c0 1.66 3.58 3 8 3s8-1.34 8-3v-6`})]}),m=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,t.jsx)(`path`,{d:`M3 10h18`}),(0,t.jsx)(`path`,{d:`M9 10v10`})]}),h=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,t.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z`})]}),g=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,t.jsx)(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41`})]}),_=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z`})}),v=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),y=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),b=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})}),x=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`}),(0,t.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`})]}),S=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,t.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]}),C=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`polyline`,{points:`23 4 23 10 17 10`}),(0,t.jsx)(`polyline`,{points:`1 20 1 14 7 14`}),(0,t.jsx)(`path`,{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`})]}),w=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,t.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),T=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8Z`}),(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),E=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polygon`,{points:`13 2 3 14 12 14 11 22 21 10 12 10 13 2`})}),D=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,t.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),O=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),k=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,t.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]}),A=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,t.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),j=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`3`,y1:`6`,x2:`21`,y2:`6`}),(0,t.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),(0,t.jsx)(`line`,{x1:`3`,y1:`18`,x2:`21`,y2:`18`})]}),M=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,t.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,t.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]});export{l as A,C,g as D,h as E,S as O,i as S,w as T,c as _,y as a,x as b,s as c,M as d,T as f,j as g,d as h,v as i,f as k,m as l,E as m,k as n,D as o,a as p,O as r,A as s,u as t,o as u,_ as v,p as w,b as x,r as y};