@workflow/web 4.0.1-beta.20 → 4.0.1-beta.21

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 (84) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/fallback-build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/server/app/_global-error.html +2 -2
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/.next/server/app/_not-found/page/server-reference-manifest.json +17 -17
  13. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/page/server-reference-manifest.json +32 -17
  16. package/.next/server/app/page.js.nft.json +1 -1
  17. package/.next/server/app/page_client-reference-manifest.js +1 -1
  18. package/.next/server/app/run/[runId]/page/server-reference-manifest.json +32 -17
  19. package/.next/server/app/run/[runId]/page.js.nft.json +1 -1
  20. package/.next/server/app/run/[runId]/page_client-reference-manifest.js +1 -1
  21. package/.next/server/chunks/ssr/[root-of-the-server]__1365a866._.js +2 -2
  22. package/.next/server/chunks/ssr/[root-of-the-server]__1365a866._.js.map +1 -1
  23. package/.next/server/chunks/ssr/[root-of-the-server]__2168651f._.js +1 -1
  24. package/.next/server/chunks/ssr/[root-of-the-server]__2168651f._.js.map +1 -1
  25. package/.next/server/chunks/ssr/[root-of-the-server]__25c4ca9a._.js +1 -1
  26. package/.next/server/chunks/ssr/[root-of-the-server]__25c4ca9a._.js.map +1 -1
  27. package/.next/server/chunks/ssr/[root-of-the-server]__d416fa5e._.js +1 -1
  28. package/.next/server/chunks/ssr/[root-of-the-server]__d416fa5e._.js.map +1 -1
  29. package/.next/server/chunks/ssr/[root-of-the-server]__e576a2e1._.js +2 -2
  30. package/.next/server/chunks/ssr/[root-of-the-server]__e576a2e1._.js.map +1 -1
  31. package/.next/server/chunks/ssr/_af28dabd._.js +1 -1
  32. package/.next/server/chunks/ssr/_af28dabd._.js.map +1 -1
  33. package/.next/server/chunks/ssr/_bff7cae2._.js +9 -0
  34. package/.next/server/chunks/ssr/_bff7cae2._.js.map +1 -0
  35. package/.next/server/chunks/ssr/_c8bf1458._.js +9 -0
  36. package/.next/server/chunks/ssr/_c8bf1458._.js.map +1 -0
  37. package/.next/server/chunks/ssr/{node_modules__pnpm_604882ab._.js → node_modules__pnpm_1053b681._.js} +2 -2
  38. package/.next/server/chunks/ssr/node_modules__pnpm_9ac28e5c._.js +3 -0
  39. package/.next/server/chunks/ssr/node_modules__pnpm_9ac28e5c._.js.map +1 -0
  40. package/.next/server/chunks/ssr/node_modules__pnpm_c6ddcd47._.js +1 -1
  41. package/.next/server/chunks/ssr/node_modules__pnpm_c6ddcd47._.js.map +1 -1
  42. package/.next/server/chunks/ssr/node_modules__pnpm_ecc06f40._.js +3 -0
  43. package/.next/server/chunks/ssr/node_modules__pnpm_ecc06f40._.js.map +1 -0
  44. package/.next/server/chunks/ssr/packages_web_src_app_page_tsx_cd282e82._.js +5 -1
  45. package/.next/server/chunks/ssr/packages_web_src_app_page_tsx_cd282e82._.js.map +1 -1
  46. package/.next/server/chunks/ssr/packages_web_src_app_run_[runId]_page_tsx_c7d0b139._.js +6 -6
  47. package/.next/server/chunks/ssr/packages_web_src_app_run_[runId]_page_tsx_c7d0b139._.js.map +1 -1
  48. package/.next/server/chunks/ssr/packages_web_src_components_ui_select_tsx_7c5238ef._.js +1 -1
  49. package/.next/server/chunks/ssr/packages_web_src_components_ui_select_tsx_7c5238ef._.js.map +1 -1
  50. package/.next/server/pages/500.html +2 -2
  51. package/.next/server/server-reference-manifest.js +1 -1
  52. package/.next/server/server-reference-manifest.json +40 -18
  53. package/.next/static/chunks/080d73f6a8a7055f.js +1 -0
  54. package/.next/static/chunks/0bf0e3b66b375058.js +2 -0
  55. package/.next/static/chunks/1633a4677cb7eacd.js +7 -0
  56. package/.next/static/chunks/19288057adbbaf16.css +2 -0
  57. package/.next/static/chunks/7993564ea9cd3862.js +60 -0
  58. package/.next/static/chunks/826c531268249b18.js +1 -0
  59. package/.next/static/chunks/915c48af605695f8.js +5 -0
  60. package/.next/static/chunks/a2fdd31ef7d1ed50.js +154 -0
  61. package/.next/static/chunks/b39dd1bd2af229c0.css +3 -0
  62. package/.next/static/chunks/{f860cef1a19defc2.js → c41b2f1bfdc5f91e.js} +1 -1
  63. package/.next/static/chunks/d3781b000675e89a.js +7 -0
  64. package/.next/static/chunks/ebaf4c277606b4fc.js +14 -0
  65. package/.next/trace +1 -1
  66. package/.next/trace-build +1 -1
  67. package/package.json +4 -4
  68. package/.next/server/chunks/ssr/_5587a26a._.js +0 -3
  69. package/.next/server/chunks/ssr/_5587a26a._.js.map +0 -1
  70. package/.next/server/chunks/ssr/_905b4948._.js +0 -3
  71. package/.next/server/chunks/ssr/_905b4948._.js.map +0 -1
  72. package/.next/static/chunks/0ba5474f4ed4a8c8.js +0 -154
  73. package/.next/static/chunks/3cf543bacb44cfb5.js +0 -1
  74. package/.next/static/chunks/65a1beec565c5452.js +0 -1
  75. package/.next/static/chunks/74dc45834647aebe.css +0 -3
  76. package/.next/static/chunks/a6a14ee8e38e3e97.js +0 -14
  77. package/.next/static/chunks/e1532e8c78b14240.js +0 -1
  78. package/.next/static/chunks/e834043d5d00c377.js +0 -60
  79. package/.next/static/chunks/ed676821fd9c42fe.js +0 -1
  80. package/.next/static/chunks/f00878722fec5692.js +0 -2
  81. /package/.next/server/chunks/ssr/{node_modules__pnpm_604882ab._.js.map → node_modules__pnpm_1053b681._.js.map} +0 -0
  82. /package/.next/static/{kDel5ryx8YzI2wcHKGqt0 → 1Gd0u_mHFXgTr2DR4OTNR}/_buildManifest.js +0 -0
  83. /package/.next/static/{kDel5ryx8YzI2wcHKGqt0 → 1Gd0u_mHFXgTr2DR4OTNR}/_clientMiddlewareManifest.json +0 -0
  84. /package/.next/static/{kDel5ryx8YzI2wcHKGqt0 → 1Gd0u_mHFXgTr2DR4OTNR}/_ssgManifest.js +0 -0
@@ -1,3 +1,7 @@
1
- module.exports=[762587,a=>{"use strict";var b=a.i(857446);a.i(580551);var c=a.i(285993),d=a.i(624282),e=a.i(721578),f=a.i(735835),g=a.i(635005),h=a.i(207973),i=a.i(622427);let j=(0,i.default)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var k=a.i(322178),l=a.i(139274);let m=(0,i.default)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var n=a.i(630135),o=a.i(67659),p=a.i(253220),q=a.i(95811),r=a.i(135321),s=a.i(397494),t=a.i(676653);let u=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",a),...c}));u.displayName="Card",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("flex flex-col space-y-1.5 p-6",a),...c})).displayName="CardHeader",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("text-2xl font-semibold leading-none tracking-tight",a),...c})).displayName="CardTitle",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("text-sm text-muted-foreground",a),...c})).displayName="CardDescription";let v=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("p-6 pt-0",a),...c}));v.displayName="CardContent",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("flex items-center p-6 pt-0",a),...c})).displayName="CardFooter";var w=a.i(315330);let x=p.forwardRef(({className:a,href:c,children:d,...e},f)=>{let g=c.startsWith("http")?c:`https://useworkflow.dev/docs/${c.replace(/^\//,"")}`;return(0,b.jsx)(w.default,{href:g,className:(0,t.cn)("font-medium underline underline-offset-4 transition-colors",a),style:{color:"var(--ds-blue-600)"},target:"_blank",rel:"noopener noreferrer",ref:f,...e,children:d})});x.displayName="DocsLink";var y=a.i(794851);let z=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{className:"relative w-full overflow-auto",children:(0,b.jsx)("table",{ref:d,className:(0,t.cn)("w-full caption-bottom text-sm",a),...c})}));z.displayName="Table";let A=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("thead",{ref:d,className:(0,t.cn)("[&_tr]:border-b",a),...c}));A.displayName="TableHeader";let B=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tbody",{ref:d,className:(0,t.cn)("[&_tr:last-child]:border-0",a),...c}));B.displayName="TableBody",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tfoot",{ref:d,className:(0,t.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...c})).displayName="TableFooter";let C=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tr",{ref:d,className:(0,t.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...c}));C.displayName="TableRow";let D=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("th",{ref:d,className:(0,t.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",a),...c}));D.displayName="TableHead";let E=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("td",{ref:d,className:(0,t.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...c}));E.displayName="TableCell",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("caption",{ref:d,className:(0,t.cn)("mt-4 text-sm text-muted-foreground",a),...c})).displayName="TableCaption";var F=a.i(393557),G=a.i(508624),H=a.i(432320),I=a.i(315244),J=a.i(433105);function K({rows:a=t.DEFAULT_PAGE_SIZE,variant:c="runs"}){return(0,b.jsx)(u,{className:"overflow-hidden mt-4 bg-background",children:(0,b.jsxs)(v,{className:"p-0",children:[(()=>{switch(c){case"runs":return(0,b.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.8fr_1fr_1fr_40px] items-center gap-4 py-3 px-4 border-b",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-20"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-12"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-20"}),(0,b.jsx)("div",{className:"w-6"})]});case"hooks":return(0,b.jsxs)("div",{className:"grid grid-cols-[1.2fr_1.2fr_0.8fr_1fr_0.5fr_40px] items-center gap-4 py-3 px-4 border-b",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-16"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-12"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-20"}),(0,b.jsx)("div",{className:"w-6"})]});case"workflows":return(0,b.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.5fr] items-center gap-4 py-3 px-4 border-b",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-20"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-10"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-12 mx-auto"})]});default:return null}})(),Array.from({length:a},(a,d)=>(a=>{switch(c){case"runs":return(0,b.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.8fr_1fr_1fr_40px] items-center gap-4 py-3 px-4",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-4/5"}),(0,b.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,b.jsx)(J.Skeleton,{className:"h-3 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-2 w-8"})]}),(0,b.jsx)(J.Skeleton,{className:"h-3 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-3 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-6 w-6 rounded"})]},`skeleton-row-${a}`);case"hooks":return(0,b.jsxs)("div",{className:"grid grid-cols-[1.2fr_1.2fr_0.8fr_1fr_0.5fr_40px] items-center gap-4 py-3 px-4",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-4/5"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-4/5"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-3 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-8"}),(0,b.jsx)(J.Skeleton,{className:"h-6 w-6 rounded"})]},`skeleton-row-${a}`);case"workflows":return(0,b.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.5fr] items-center gap-4 py-3 px-4",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-4/5"}),(0,b.jsx)(J.Skeleton,{className:"h-5 w-16 rounded-full mx-auto"})]},`skeleton-row-${a}`);default:return null}})(d))]})})}function L({config:a,runId:c,onHookClick:d,selectedHookId:i}){let[t,w]=(0,p.useState)(()=>new Date),J=(0,p.useMemo)(()=>(0,G.worldConfigToEnvMap)(a),[a]),{data:L,error:M,nextPage:N,previousPage:O,hasNextPage:P,hasPreviousPage:Q,reload:R,pageInfo:S}=(0,e.useWorkflowHooks)(J,{runId:c,sortOrder:"desc"}),T=(0,f.useHookActions)({env:J,callbacks:{onSuccess:R}}),U=L.isLoading,V=L.data??[],[W,X]=(0,p.useState)(new Map);return(0,p.useEffect)(()=>{V.length&&(async()=>{let a=new Map;for(let b of V)a.set(b.hookId,{count:0,hasMore:!1,loading:!0});X(a);let b=await Promise.allSettled(V.map(async a=>{try{let b=await (0,g.fetchEventsByCorrelationId)(J,a.hookId,{sortOrder:"asc",limit:100});if(!b.success)return{hookId:a.hookId,count:Error(b.error?.message||"Failed to fetch events"),hasMore:!1};let c=b.data,d=c.data.filter(a=>"hook_received"===a.eventType).length;return{hookId:a.hookId,count:d,hasMore:c.hasMore}}catch(b){return{hookId:a.hookId,count:b,hasMore:!1}}}));X(a=>{let c=new Map(a);for(let a=0;a<b.length;a++){let d=b[a],e=V[a].hookId;"fulfilled"===d.status?c.set(d.value.hookId,{count:d.value.count,hasMore:d.value.hasMore,loading:!1}):c.set(e,{count:0,hasMore:!1,loading:!1})}return c})})()},[V,J]),(0,b.jsxs)("div",{children:[(0,b.jsx)(f.HookResolveModalWrapper,{hookActions:T}),(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-end gap-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"Last refreshed"}),t&&(0,b.jsx)(I.RelativeTime,{date:t,className:"text-sm text-muted-foreground",type:"distance"})]}),(0,b.jsx)("div",{className:"flex items-center gap-4",children:(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:()=>{w(()=>new Date),R()},disabled:U,children:[(0,b.jsx)(m,{className:U?"animate-spin":""}),"Refresh"]})}),(0,b.jsx)(F.TooltipContent,{children:"Note that this resets pages"})]})})]}),M?(0,b.jsxs)(r.Alert,{variant:"destructive",children:[(0,b.jsx)(h.AlertCircle,{className:"h-4 w-4"}),(0,b.jsx)(r.AlertTitle,{children:"Error loading hooks"}),(0,b.jsx)(r.AlertDescription,{children:(0,e.getErrorMessage)(M)})]}):U||V&&0!==V.length?U&&!L?.data?(0,b.jsx)(K,{variant:"hooks"}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u,{className:"overflow-hidden mt-4 bg-background",children:(0,b.jsx)(v,{className:"p-0 max-h-[calc(100vh-280px)] overflow-auto",children:(0,b.jsxs)(z,{children:[(0,b.jsx)(A,{children:(0,b.jsxs)(C,{children:[(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Hook ID"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Run ID"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Token"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Created"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Invocations"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10"})]})}),(0,b.jsx)(B,{children:V.map(a=>(0,b.jsxs)(C,{className:"cursor-pointer group relative",onClick:()=>d(a.hookId,a.runId),"data-selected":a.hookId===i,children:[(0,b.jsx)(E,{className:"font-mono text-xs py-2",children:(0,b.jsx)(H.CopyableText,{text:a.hookId,overlay:!0,children:a.hookId})}),(0,b.jsx)(E,{className:"font-mono text-xs py-2",children:(0,b.jsx)(H.CopyableText,{text:a.runId,overlay:!0,children:a.runId})}),(0,b.jsx)(E,{className:"font-mono text-xs py-2",children:(0,b.jsx)(H.CopyableText,{text:a.token,overlay:!0,children:(0,b.jsx)("span",{className:"text-muted-foreground",children:"••••••••••••"})})}),(0,b.jsx)(E,{className:"py-2 text-muted-foreground text-xs",children:a.createdAt?(0,b.jsx)(I.RelativeTime,{date:a.createdAt}):"-"}),(0,b.jsx)(E,{className:"py-2",children:(a=>{let c=W.get(a.hookId);if(!c||c.loading)return(0,b.jsx)("span",{className:"text-muted-foreground text-xs",children:"..."});if(c.count instanceof Error)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"Error"});if(0===c.count)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"0"});let d=c.hasMore?`${c.count}+`:`${c.count}`;return c.hasMore?(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsx)("span",{className:"font-semibold cursor-help",children:d})}),(0,b.jsx)(F.TooltipContent,{className:"max-w-xs",children:(0,b.jsx)("div",{className:"text-xs",children:"Showing first 100 invocations. There may be more."})})]}):(0,b.jsx)("span",{className:"font-semibold",children:d})})(a)}),(0,b.jsx)(E,{className:"py-2",children:(0,b.jsxs)(y.DropdownMenu,{children:[(0,b.jsx)(y.DropdownMenuTrigger,{asChild:!0,children:(0,b.jsx)(s.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a=>a.stopPropagation(),children:(0,b.jsx)(l.MoreHorizontal,{className:"h-4 w-4"})})}),(0,b.jsxs)(y.DropdownMenuContent,{align:"end",children:[(0,b.jsx)(f.ResolveHookDropdownItem,{hook:a,stopPropagation:!0,onResolveClick:T.openResolveModal,DropdownMenuItem:y.DropdownMenuItem}),(0,b.jsxs)(y.DropdownMenuItem,{onClick:async b=>{b.stopPropagation();try{let b=await (0,e.recreateRun)(J,a.runId);q.toast.success("New run started",{description:`Run ID: ${b}`}),R()}catch(a){q.toast.error("Failed to re-run",{description:a instanceof Error?a.message:"Unknown error"})}},children:[(0,b.jsx)(n.RotateCw,{className:"h-4 w-4 mr-2"}),"Replay Run"]}),(0,b.jsxs)(y.DropdownMenuItem,{onClick:async b=>{b.stopPropagation();try{await (0,e.cancelRun)(J,a.runId),q.toast.success("Run cancelled"),R()}catch(a){q.toast.error("Failed to cancel",{description:a instanceof Error?a.message:"Unknown error"})}},children:[(0,b.jsx)(o.XCircle,{className:"h-4 w-4 mr-2"}),"Cancel"]})]})]})})]},a.hookId))})]})})}),(0,b.jsxs)("div",{className:"flex items-center justify-between mt-4",children:[(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:S}),(0,b.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:O,disabled:!Q,children:[(0,b.jsx)(j,{}),"Previous"]}),(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:N,disabled:!P,children:["Next",(0,b.jsx)(k.ChevronRight,{})]})]})]})]}):(0,b.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:["No active hooks found. ",(0,b.jsx)("br",{}),(0,b.jsx)(x,{href:"https://useworkflow.dev/docs/api-reference/workflow/create-hook",children:"Learn how to create a hook"})]})]})}var M=a.i(538015),N=a.i(71028),O=a.i(262267);let P=(0,i.default)("ArrowDownAZ",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]),Q=(0,i.default)("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);var R=a.i(175196),S=a.i(93354),T=a.i(303872);function U({env:a,runId:c,runStatus:d,onSuccess:e,showDebugActions:f}){let[g,h]=(0,p.useState)(void 0),[i,j]=(0,p.useState)(!0),[k,l]=(0,p.useState)(void 0),m=k?.status||d;return(0,p.useEffect)(()=>{j(!0),Promise.all([(0,O.fetchRun)(a,c,"none"),(0,N.fetchEvents)(a,c,{limit:1e3,sortOrder:"desc"})]).then(([a,b])=>{a.success&&l(a.data),b.success&&h(b.data.data)}).catch(a=>{console.error("Failed to fetch run or events:",a)}).finally(()=>{j(!1)})},[a,c]),(0,b.jsx)(T.RunActionsDropdownItems,{env:a,runId:c,runStatus:m,events:g,eventsLoading:i,stopPropagation:!0,callbacks:{onSuccess:e},showDebugActions:f})}function V({env:a,runId:c,runStatus:d,onSuccess:e,showDebugActions:f}){let[g,h]=(0,p.useState)(!1);return(0,b.jsxs)(y.DropdownMenu,{open:g,onOpenChange:h,children:[(0,b.jsx)(y.DropdownMenuTrigger,{asChild:!0,children:(0,b.jsx)(s.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a=>a.stopPropagation(),children:(0,b.jsx)(l.MoreHorizontal,{className:"h-4 w-4"})})}),g&&(0,b.jsx)(y.DropdownMenuContent,{align:"end",children:(0,b.jsx)(U,{env:a,runId:c,runStatus:d,onSuccess:e,showDebugActions:f})})]})}let W={pending:{label:"Pending",color:"bg-neutral-600 dark:bg-neutral-400"},running:{label:"Running",color:"bg-blue-600 dark:bg-blue-400"},completed:{label:"Completed",color:"bg-green-600 dark:bg-green-400"},failed:{label:"Failed",color:"bg-red-600 dark:bg-red-400"},paused:{label:"Paused",color:"bg-yellow-600 dark:bg-yellow-400"},cancelled:{label:"Cancelled",color:"bg-gray-600 dark:bg-gray-400"}};function X({workflowNameFilter:a,status:c,seenWorkflowNames:d,sortOrder:e,loading:f,statusFilterRequiresWorkflowNameFilter:g,onWorkflowChange:h,onStatusChange:i,onSortToggle:j,onRefresh:k,lastRefreshTime:l}){return(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-end gap-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"Last refreshed"}),l&&(0,b.jsx)(I.RelativeTime,{date:l,className:"text-sm text-muted-foreground",type:"distance"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)(R.Select,{value:a??"all",onValueChange:h,disabled:f,children:[(0,b.jsx)(R.SelectTrigger,{className:"w-[180px] h-9",children:(0,b.jsx)(R.SelectValue,{placeholder:"Filter by workflow"})}),(0,b.jsxs)(R.SelectContent,{children:[(0,b.jsx)(R.SelectItem,{value:"all",children:"All Workflows"}),Array.from(d).sort().map(a=>(0,b.jsx)(R.SelectItem,{value:a,children:(0,M.parseWorkflowName)(a)?.shortName||a},a))]})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsx)("div",{children:(0,b.jsxs)(R.Select,{value:c||"all",onValueChange:i,disabled:f||g&&!a,children:[(0,b.jsx)(R.SelectTrigger,{className:"w-[140px] h-9",children:(0,b.jsx)(R.SelectValue,{placeholder:"Filter by status"})}),(0,b.jsxs)(R.SelectContent,{children:[(0,b.jsx)(R.SelectItem,{value:"all",children:"Any status"}),Object.entries(W).map(([a,{label:c,color:d}])=>(0,b.jsx)(R.SelectItem,{value:a,children:(0,b.jsxs)("div",{className:"flex items-center",children:[(0,b.jsx)("span",{className:`${d} size-1.5 rounded-full mr-2`}),c]})},a))]})]})})}),(0,b.jsx)(F.TooltipContent,{children:g&&"all"===a?"Select a workflow first to filter by status":"Filter runs by status"})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:j,disabled:f,children:["desc"===e?(0,b.jsx)(P,{className:"h-4 w-4"}):(0,b.jsx)(Q,{className:"h-4 w-4"}),"desc"===e?"Newest":"Oldest"]})}),(0,b.jsx)(F.TooltipContent,{children:"desc"===e?"Showing newest first":"Showing oldest first"})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:k,disabled:f,children:[(0,b.jsx)(m,{className:f?"animate-spin":""}),"Refresh"]})}),(0,b.jsx)(F.TooltipContent,{children:"Note that this resets pages"})]})]})]})}function Y({config:a,onRunClick:c}){let f,g,i,l,m,n,o=(0,d.useSearchParams)(),q=(f=(0,d.useRouter)(),g=(0,d.usePathname)(),i=(0,d.useSearchParams)(),(0,p.useCallback)(a=>{let b=new URLSearchParams(i.toString());"all"===a?(b.delete("workflow"),b.delete("status")):b.set("workflow",a),f.push(`${g}?${b.toString()}`)},[f,g,i])),t=(l=(0,d.useRouter)(),m=(0,d.usePathname)(),n=(0,d.useSearchParams)(),(0,p.useCallback)(a=>{let b=new URLSearchParams(n.toString());"all"===a?b.delete("status"):b.set("status",a),l.push(`${m}?${b.toString()}`)},[l,m,n])),w=o.get("status"),y=Object.keys(W),F="all"===w||w&&y.includes(w)?w:void 0,J=o.get("workflow"),L="1"===o.get("debug"),[N,O]=(0,p.useState)("desc"),[P,Q]=(0,p.useState)(()=>new Date),R=(0,p.useMemo)(()=>(0,G.worldConfigToEnvMap)(a),[a]),T=a.backend?.includes("vercel")||!1,[U,Y]=(0,p.useState)(new Set),{data:Z,error:$,nextPage:_,previousPage:aa,hasNextPage:ab,hasPreviousPage:ac,reload:ad,pageInfo:ae}=(0,e.useWorkflowRuns)(R,{sortOrder:N,workflowName:"all"===J?void 0:J,status:"all"===F?void 0:F});(0,p.useEffect)(()=>{if(Z.data&&Z.data.length>0){let a=new Set(Z.data.map(a=>a.workflowName));Y(b=>{let c=new Set(b);for(let b of a)c.add(b);return c})}},[Z.data]);let af=Z.isLoading;return(0,b.jsxs)("div",{children:[(0,b.jsx)(X,{workflowNameFilter:J,status:F,seenWorkflowNames:U,sortOrder:N,loading:af,statusFilterRequiresWorkflowNameFilter:T,onWorkflowChange:q,onStatusChange:t,onSortToggle:()=>{O(a=>"desc"===a?"asc":"desc")},onRefresh:()=>{Q(()=>new Date),ad()},lastRefreshTime:P}),$?(0,b.jsxs)(r.Alert,{variant:"destructive",children:[(0,b.jsx)(h.AlertCircle,{className:"h-4 w-4"}),(0,b.jsx)(r.AlertTitle,{children:"Error loading runs"}),(0,b.jsx)(r.AlertDescription,{children:(0,e.getErrorMessage)($)})]}):af&&!Z?.data?(0,b.jsx)(K,{}):af||Z.data&&0!==Z.data.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u,{className:"overflow-hidden mt-4 bg-background",children:(0,b.jsx)(v,{className:"p-0 max-h-[calc(100vh-280px)] overflow-auto",children:(0,b.jsxs)(z,{children:[(0,b.jsx)(A,{children:(0,b.jsxs)(C,{children:[(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Workflow"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Run ID"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Status"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Started"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Completed"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10"})]})}),(0,b.jsx)(B,{children:Z.data?.map(a=>(0,b.jsxs)(C,{className:"cursor-pointer group relative",onClick:()=>c(a.runId),children:[(0,b.jsx)(E,{className:"py-2",children:(0,b.jsx)(H.CopyableText,{text:a.workflowName,overlay:!0,children:(0,M.parseWorkflowName)(a.workflowName)?.shortName||"?"})}),(0,b.jsx)(E,{className:"font-mono text-xs py-2",children:(0,b.jsx)(H.CopyableText,{text:a.runId,overlay:!0,children:a.runId})}),(0,b.jsx)(E,{className:"py-2",children:(0,b.jsx)(S.StatusBadge,{status:a.status,context:a,durationMs:a.startedAt?(a.completedAt?new Date(a.completedAt).getTime():Date.now())-new Date(a.startedAt).getTime():void 0})}),(0,b.jsx)(E,{className:"py-2 text-muted-foreground text-xs",children:a.startedAt?(0,b.jsx)(I.RelativeTime,{date:a.startedAt}):"-"}),(0,b.jsx)(E,{className:"py-2 text-muted-foreground text-xs",children:a.completedAt?(0,b.jsx)(I.RelativeTime,{date:a.completedAt}):"-"}),(0,b.jsx)(E,{className:"py-2",children:(0,b.jsx)(V,{env:R,runId:a.runId,runStatus:a.status,onSuccess:ad,showDebugActions:L})})]},a.runId))})]})})}),(0,b.jsxs)("div",{className:"flex items-center justify-between mt-4",children:[(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:ae}),(0,b.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:aa,disabled:!ac,children:[(0,b.jsx)(j,{}),"Previous"]}),(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:_,disabled:!ab,children:["Next",(0,b.jsx)(k.ChevronRight,{})]})]})]})]}):(0,b.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:["No workflow runs found. ",(0,b.jsx)("br",{}),(0,b.jsx)(x,{href:"https://useworkflow.dev/docs/foundations/workflows-and-steps",children:"Learn how to create a workflow"})]})]})}var Z=a.i(725538),$=a.i(47318);function _(){let a=(0,d.useRouter)(),e=(0,G.useQueryParamConfig)(),[f]=(0,$.useSidebarState)(),[g]=(0,$.useHookIdState)(),[h,i]=(0,$.useTabState)();return(0,b.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,b.jsxs)(Z.Tabs,{value:h,onValueChange:i,className:"w-full",children:[(0,b.jsxs)(Z.TabsList,{className:"mb-4",children:[(0,b.jsx)(Z.TabsTrigger,{value:"runs",children:"Runs"}),(0,b.jsx)(Z.TabsTrigger,{value:"hooks",children:"Hooks"})]}),(0,b.jsx)(Z.TabsContent,{value:"runs",children:(0,b.jsx)(c.ErrorBoundary,{title:"Runs Error",description:"Failed to load workflow runs. Please try refreshing the page.",children:(0,b.jsx)(Y,{config:e,onRunClick:(b,c)=>{c?a.push((0,G.buildUrlWithConfig)(`/run/${b}/streams/${c}`,e)):a.push((0,G.buildUrlWithConfig)(`/run/${b}`,e))}})})}),(0,b.jsx)(Z.TabsContent,{value:"hooks",children:(0,b.jsx)(c.ErrorBoundary,{title:"Hooks Error",description:"Failed to load hooks. Please try refreshing the page.",children:(0,b.jsx)(L,{config:e,onHookClick:(b,c)=>{b?a.push((0,G.buildUrlWithConfig)(`/run/${c}`,e,{sidebar:"hook",hookId:b})):a.push((0,G.buildUrlWithConfig)(`/run/${c}`,e))},selectedHookId:"hook"===f&&g?g:void 0})})})]})})}a.s(["default",()=>_],762587)}];
1
+ module.exports=[762587,a=>{"use strict";var b=a.i(857446);a.i(580551);var c=a.i(285993),d=a.i(624282),e=a.i(721578),f=a.i(735835),g=a.i(169998),h=a.i(207973),i=a.i(622427);let j=(0,i.default)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var k=a.i(322178),l=a.i(139274);let m=(0,i.default)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var n=a.i(630135),o=a.i(67659),p=a.i(253220),q=a.i(95811),r=a.i(135321),s=a.i(397494),t=a.i(676653);let u=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",a),...c}));u.displayName="Card",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("flex flex-col space-y-1.5 p-6",a),...c})).displayName="CardHeader",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("text-2xl font-semibold leading-none tracking-tight",a),...c})).displayName="CardTitle",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("text-sm text-muted-foreground",a),...c})).displayName="CardDescription";let v=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("p-6 pt-0",a),...c}));v.displayName="CardContent",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{ref:d,className:(0,t.cn)("flex items-center p-6 pt-0",a),...c})).displayName="CardFooter";var w=a.i(315330);let x=p.forwardRef(({className:a,href:c,children:d,...e},f)=>{let g=c.startsWith("http")?c:`https://useworkflow.dev/docs/${c.replace(/^\//,"")}`;return(0,b.jsx)(w.default,{href:g,className:(0,t.cn)("font-medium underline underline-offset-4 transition-colors",a),style:{color:"var(--ds-blue-600)"},target:"_blank",rel:"noopener noreferrer",ref:f,...e,children:d})});x.displayName="DocsLink";var y=a.i(794851);let z=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{className:"relative w-full overflow-auto",children:(0,b.jsx)("table",{ref:d,className:(0,t.cn)("w-full caption-bottom text-sm",a),...c})}));z.displayName="Table";let A=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("thead",{ref:d,className:(0,t.cn)("[&_tr]:border-b",a),...c}));A.displayName="TableHeader";let B=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tbody",{ref:d,className:(0,t.cn)("[&_tr:last-child]:border-0",a),...c}));B.displayName="TableBody",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tfoot",{ref:d,className:(0,t.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...c})).displayName="TableFooter";let C=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tr",{ref:d,className:(0,t.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...c}));C.displayName="TableRow";let D=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("th",{ref:d,className:(0,t.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",a),...c}));D.displayName="TableHead";let E=p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("td",{ref:d,className:(0,t.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...c}));E.displayName="TableCell",p.forwardRef(({className:a,...c},d)=>(0,b.jsx)("caption",{ref:d,className:(0,t.cn)("mt-4 text-sm text-muted-foreground",a),...c})).displayName="TableCaption";var F=a.i(393557),G=a.i(508624),H=a.i(432320),I=a.i(315244),J=a.i(433105);function K({rows:a=t.DEFAULT_PAGE_SIZE,variant:c="runs"}){return(0,b.jsx)(u,{className:"overflow-hidden mt-4 bg-background",children:(0,b.jsxs)(v,{className:"p-0",children:[(()=>{switch(c){case"runs":return(0,b.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.8fr_1fr_1fr_40px] items-center gap-4 py-3 px-4 border-b",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-20"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-12"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-20"}),(0,b.jsx)("div",{className:"w-6"})]});case"hooks":return(0,b.jsxs)("div",{className:"grid grid-cols-[1.2fr_1.2fr_0.8fr_1fr_0.5fr_40px] items-center gap-4 py-3 px-4 border-b",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-16"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-12"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-20"}),(0,b.jsx)("div",{className:"w-6"})]});case"workflows":return(0,b.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.5fr] items-center gap-4 py-3 px-4 border-b",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-20"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-10"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-12 mx-auto"})]});default:return null}})(),Array.from({length:a},(a,d)=>(a=>{switch(c){case"runs":return(0,b.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.8fr_1fr_1fr_40px] items-center gap-4 py-3 px-4",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-4/5"}),(0,b.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,b.jsx)(J.Skeleton,{className:"h-3 w-14"}),(0,b.jsx)(J.Skeleton,{className:"h-2 w-8"})]}),(0,b.jsx)(J.Skeleton,{className:"h-3 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-3 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-6 w-6 rounded"})]},`skeleton-row-${a}`);case"hooks":return(0,b.jsxs)("div",{className:"grid grid-cols-[1.2fr_1.2fr_0.8fr_1fr_0.5fr_40px] items-center gap-4 py-3 px-4",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-4/5"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-4/5"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-3 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-8"}),(0,b.jsx)(J.Skeleton,{className:"h-6 w-6 rounded"})]},`skeleton-row-${a}`);case"workflows":return(0,b.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.5fr] items-center gap-4 py-3 px-4",children:[(0,b.jsx)(J.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(J.Skeleton,{className:"h-4 w-4/5"}),(0,b.jsx)(J.Skeleton,{className:"h-5 w-16 rounded-full mx-auto"})]},`skeleton-row-${a}`);default:return null}})(d))]})})}function L({config:a,runId:c,onHookClick:d,selectedHookId:i}){let[t,w]=(0,p.useState)(()=>new Date),J=(0,p.useMemo)(()=>(0,G.worldConfigToEnvMap)(a),[a]),{data:L,error:M,nextPage:N,previousPage:O,hasNextPage:P,hasPreviousPage:Q,reload:R,pageInfo:S}=(0,e.useWorkflowHooks)(J,{runId:c,sortOrder:"desc"}),T=(0,f.useHookActions)({env:J,callbacks:{onSuccess:R}}),U=L.isLoading,V=L.data??[],[W,X]=(0,p.useState)(new Map);return(0,p.useEffect)(()=>{V.length&&(async()=>{let a=new Map;for(let b of V)a.set(b.hookId,{count:0,hasMore:!1,loading:!0});X(a);let b=await Promise.allSettled(V.map(async a=>{try{let b=await (0,g.fetchEventsByCorrelationId)(J,a.hookId,{sortOrder:"asc",limit:100});if(!b.success)return{hookId:a.hookId,count:Error(b.error?.message||"Failed to fetch events"),hasMore:!1};let c=b.data,d=c.data.filter(a=>"hook_received"===a.eventType).length;return{hookId:a.hookId,count:d,hasMore:c.hasMore}}catch(b){return{hookId:a.hookId,count:b,hasMore:!1}}}));X(a=>{let c=new Map(a);for(let a=0;a<b.length;a++){let d=b[a],e=V[a].hookId;"fulfilled"===d.status?c.set(d.value.hookId,{count:d.value.count,hasMore:d.value.hasMore,loading:!1}):c.set(e,{count:0,hasMore:!1,loading:!1})}return c})})()},[V,J]),(0,b.jsxs)("div",{children:[(0,b.jsx)(f.HookResolveModalWrapper,{hookActions:T}),(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-end gap-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"Last refreshed"}),t&&(0,b.jsx)(I.RelativeTime,{date:t,className:"text-sm text-muted-foreground",type:"distance"})]}),(0,b.jsx)("div",{className:"flex items-center gap-4",children:(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:()=>{w(()=>new Date),R()},disabled:U,children:[(0,b.jsx)(m,{className:U?"animate-spin":""}),"Refresh"]})}),(0,b.jsx)(F.TooltipContent,{children:"Note that this resets pages"})]})})]}),M?(0,b.jsxs)(r.Alert,{variant:"destructive",children:[(0,b.jsx)(h.AlertCircle,{className:"h-4 w-4"}),(0,b.jsx)(r.AlertTitle,{children:"Error loading hooks"}),(0,b.jsx)(r.AlertDescription,{children:(0,e.getErrorMessage)(M)})]}):U||V&&0!==V.length?U&&!L?.data?(0,b.jsx)(K,{variant:"hooks"}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u,{className:"overflow-hidden mt-4 bg-background",children:(0,b.jsx)(v,{className:"p-0 max-h-[calc(100vh-280px)] overflow-auto",children:(0,b.jsxs)(z,{children:[(0,b.jsx)(A,{children:(0,b.jsxs)(C,{children:[(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Hook ID"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Run ID"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Token"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Created"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Invocations"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10"})]})}),(0,b.jsx)(B,{children:V.map(a=>(0,b.jsxs)(C,{className:"cursor-pointer group relative",onClick:()=>d(a.hookId,a.runId),"data-selected":a.hookId===i,children:[(0,b.jsx)(E,{className:"font-mono text-xs py-2",children:(0,b.jsx)(H.CopyableText,{text:a.hookId,overlay:!0,children:a.hookId})}),(0,b.jsx)(E,{className:"font-mono text-xs py-2",children:(0,b.jsx)(H.CopyableText,{text:a.runId,overlay:!0,children:a.runId})}),(0,b.jsx)(E,{className:"font-mono text-xs py-2",children:(0,b.jsx)(H.CopyableText,{text:a.token,overlay:!0,children:(0,b.jsx)("span",{className:"text-muted-foreground",children:"••••••••••••"})})}),(0,b.jsx)(E,{className:"py-2 text-muted-foreground text-xs",children:a.createdAt?(0,b.jsx)(I.RelativeTime,{date:a.createdAt}):"-"}),(0,b.jsx)(E,{className:"py-2",children:(a=>{let c=W.get(a.hookId);if(!c||c.loading)return(0,b.jsx)("span",{className:"text-muted-foreground text-xs",children:"..."});if(c.count instanceof Error)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"Error"});if(0===c.count)return(0,b.jsx)("span",{className:"text-muted-foreground",children:"0"});let d=c.hasMore?`${c.count}+`:`${c.count}`;return c.hasMore?(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsx)("span",{className:"font-semibold cursor-help",children:d})}),(0,b.jsx)(F.TooltipContent,{className:"max-w-xs",children:(0,b.jsx)("div",{className:"text-xs",children:"Showing first 100 invocations. There may be more."})})]}):(0,b.jsx)("span",{className:"font-semibold",children:d})})(a)}),(0,b.jsx)(E,{className:"py-2",children:(0,b.jsxs)(y.DropdownMenu,{children:[(0,b.jsx)(y.DropdownMenuTrigger,{asChild:!0,children:(0,b.jsx)(s.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a=>a.stopPropagation(),children:(0,b.jsx)(l.MoreHorizontal,{className:"h-4 w-4"})})}),(0,b.jsxs)(y.DropdownMenuContent,{align:"end",children:[(0,b.jsx)(f.ResolveHookDropdownItem,{hook:a,stopPropagation:!0,onResolveClick:T.openResolveModal,DropdownMenuItem:y.DropdownMenuItem}),(0,b.jsxs)(y.DropdownMenuItem,{onClick:async b=>{b.stopPropagation();try{let b=await (0,e.recreateRun)(J,a.runId);q.toast.success("New run started",{description:`Run ID: ${b}`}),R()}catch(a){q.toast.error("Failed to re-run",{description:a instanceof Error?a.message:"Unknown error"})}},children:[(0,b.jsx)(n.RotateCw,{className:"h-4 w-4 mr-2"}),"Replay Run"]}),(0,b.jsxs)(y.DropdownMenuItem,{onClick:async b=>{b.stopPropagation();try{await (0,e.cancelRun)(J,a.runId),q.toast.success("Run cancelled"),R()}catch(a){q.toast.error("Failed to cancel",{description:a instanceof Error?a.message:"Unknown error"})}},children:[(0,b.jsx)(o.XCircle,{className:"h-4 w-4 mr-2"}),"Cancel"]})]})]})})]},a.hookId))})]})})}),(0,b.jsxs)("div",{className:"flex items-center justify-between mt-4",children:[(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:S}),(0,b.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:O,disabled:!Q,children:[(0,b.jsx)(j,{}),"Previous"]}),(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:N,disabled:!P,children:["Next",(0,b.jsx)(k.ChevronRight,{})]})]})]})]}):(0,b.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:["No active hooks found. ",(0,b.jsx)("br",{}),(0,b.jsx)(x,{href:"https://useworkflow.dev/docs/api-reference/workflow/create-hook",children:"Learn how to create a hook"})]})]})}var M=a.i(538015),N=a.i(550104),O=a.i(161518);let P=(0,i.default)("ArrowDownAZ",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]),Q=(0,i.default)("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);var R=a.i(175196),S=a.i(93354),T=a.i(303872);function U({env:a,runId:c,runStatus:d,onSuccess:e,showDebugActions:f}){let[g,h]=(0,p.useState)(void 0),[i,j]=(0,p.useState)(!0),[k,l]=(0,p.useState)(void 0),m=k?.status||d;return(0,p.useEffect)(()=>{j(!0),Promise.all([(0,O.fetchRun)(a,c,"none"),(0,N.fetchEvents)(a,c,{limit:1e3,sortOrder:"desc"})]).then(([a,b])=>{a.success&&l(a.data),b.success&&h(b.data.data)}).catch(a=>{console.error("Failed to fetch run or events:",a)}).finally(()=>{j(!1)})},[a,c]),(0,b.jsx)(T.RunActionsDropdownItems,{env:a,runId:c,runStatus:m,events:g,eventsLoading:i,stopPropagation:!0,callbacks:{onSuccess:e},showDebugActions:f})}function V({env:a,runId:c,runStatus:d,onSuccess:e,showDebugActions:f}){let[g,h]=(0,p.useState)(!1);return(0,b.jsxs)(y.DropdownMenu,{open:g,onOpenChange:h,children:[(0,b.jsx)(y.DropdownMenuTrigger,{asChild:!0,children:(0,b.jsx)(s.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a=>a.stopPropagation(),children:(0,b.jsx)(l.MoreHorizontal,{className:"h-4 w-4"})})}),g&&(0,b.jsx)(y.DropdownMenuContent,{align:"end",children:(0,b.jsx)(U,{env:a,runId:c,runStatus:d,onSuccess:e,showDebugActions:f})})]})}let W={pending:{label:"Pending",color:"bg-neutral-600 dark:bg-neutral-400"},running:{label:"Running",color:"bg-blue-600 dark:bg-blue-400"},completed:{label:"Completed",color:"bg-green-600 dark:bg-green-400"},failed:{label:"Failed",color:"bg-red-600 dark:bg-red-400"},paused:{label:"Paused",color:"bg-yellow-600 dark:bg-yellow-400"},cancelled:{label:"Cancelled",color:"bg-gray-600 dark:bg-gray-400"}};function X({workflowNameFilter:a,status:c,seenWorkflowNames:d,sortOrder:e,loading:f,statusFilterRequiresWorkflowNameFilter:g,onWorkflowChange:h,onStatusChange:i,onSortToggle:j,onRefresh:k,lastRefreshTime:l}){return(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-end gap-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"Last refreshed"}),l&&(0,b.jsx)(I.RelativeTime,{date:l,className:"text-sm text-muted-foreground",type:"distance"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)(R.Select,{value:a??"all",onValueChange:h,disabled:f,children:[(0,b.jsx)(R.SelectTrigger,{className:"w-[180px] h-9",children:(0,b.jsx)(R.SelectValue,{placeholder:"Filter by workflow"})}),(0,b.jsxs)(R.SelectContent,{children:[(0,b.jsx)(R.SelectItem,{value:"all",children:"All Workflows"}),Array.from(d).sort().map(a=>(0,b.jsx)(R.SelectItem,{value:a,children:(0,M.parseWorkflowName)(a)?.shortName||a},a))]})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsx)("div",{children:(0,b.jsxs)(R.Select,{value:c||"all",onValueChange:i,disabled:f||g&&!a,children:[(0,b.jsx)(R.SelectTrigger,{className:"w-[140px] h-9",children:(0,b.jsx)(R.SelectValue,{placeholder:"Filter by status"})}),(0,b.jsxs)(R.SelectContent,{children:[(0,b.jsx)(R.SelectItem,{value:"all",children:"Any status"}),Object.entries(W).map(([a,{label:c,color:d}])=>(0,b.jsx)(R.SelectItem,{value:a,children:(0,b.jsxs)("div",{className:"flex items-center",children:[(0,b.jsx)("span",{className:`${d} size-1.5 rounded-full mr-2`}),c]})},a))]})]})})}),(0,b.jsx)(F.TooltipContent,{children:g&&"all"===a?"Select a workflow first to filter by status":"Filter runs by status"})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:j,disabled:f,children:["desc"===e?(0,b.jsx)(P,{className:"h-4 w-4"}):(0,b.jsx)(Q,{className:"h-4 w-4"}),"desc"===e?"Newest":"Oldest"]})}),(0,b.jsx)(F.TooltipContent,{children:"desc"===e?"Showing newest first":"Showing oldest first"})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:k,disabled:f,children:[(0,b.jsx)(m,{className:f?"animate-spin":""}),"Refresh"]})}),(0,b.jsx)(F.TooltipContent,{children:"Note that this resets pages"})]})]})]})}function Y({config:a,onRunClick:c}){let f,g,i,l,m,n,o=(0,d.useSearchParams)(),q=(f=(0,d.useRouter)(),g=(0,d.usePathname)(),i=(0,d.useSearchParams)(),(0,p.useCallback)(a=>{let b=new URLSearchParams(i.toString());"all"===a?(b.delete("workflow"),b.delete("status")):b.set("workflow",a),f.push(`${g}?${b.toString()}`)},[f,g,i])),t=(l=(0,d.useRouter)(),m=(0,d.usePathname)(),n=(0,d.useSearchParams)(),(0,p.useCallback)(a=>{let b=new URLSearchParams(n.toString());"all"===a?b.delete("status"):b.set("status",a),l.push(`${m}?${b.toString()}`)},[l,m,n])),w=o.get("status"),y=Object.keys(W),F="all"===w||w&&y.includes(w)?w:void 0,J=o.get("workflow"),L="1"===o.get("debug"),[N,O]=(0,p.useState)("desc"),[P,Q]=(0,p.useState)(()=>new Date),R=(0,p.useMemo)(()=>(0,G.worldConfigToEnvMap)(a),[a]),T=a.backend?.includes("vercel")||!1,[U,Y]=(0,p.useState)(new Set),{data:Z,error:$,nextPage:_,previousPage:aa,hasNextPage:ab,hasPreviousPage:ac,reload:ad,pageInfo:ae}=(0,e.useWorkflowRuns)(R,{sortOrder:N,workflowName:"all"===J?void 0:J,status:"all"===F?void 0:F});(0,p.useEffect)(()=>{if(Z.data&&Z.data.length>0){let a=new Set(Z.data.map(a=>a.workflowName));Y(b=>{let c=new Set(b);for(let b of a)c.add(b);return c})}},[Z.data]);let af=Z.isLoading;return(0,b.jsxs)("div",{children:[(0,b.jsx)(X,{workflowNameFilter:J,status:F,seenWorkflowNames:U,sortOrder:N,loading:af,statusFilterRequiresWorkflowNameFilter:T,onWorkflowChange:q,onStatusChange:t,onSortToggle:()=>{O(a=>"desc"===a?"asc":"desc")},onRefresh:()=>{Q(()=>new Date),ad()},lastRefreshTime:P}),$?(0,b.jsxs)(r.Alert,{variant:"destructive",children:[(0,b.jsx)(h.AlertCircle,{className:"h-4 w-4"}),(0,b.jsx)(r.AlertTitle,{children:"Error loading runs"}),(0,b.jsx)(r.AlertDescription,{children:(0,e.getErrorMessage)($)})]}):af&&!Z?.data?(0,b.jsx)(K,{}):af||Z.data&&0!==Z.data.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u,{className:"overflow-hidden mt-4 bg-background",children:(0,b.jsx)(v,{className:"p-0 max-h-[calc(100vh-280px)] overflow-auto",children:(0,b.jsxs)(z,{children:[(0,b.jsx)(A,{children:(0,b.jsxs)(C,{children:[(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Workflow"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Run ID"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Status"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Started"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Completed"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10"})]})}),(0,b.jsx)(B,{children:Z.data?.map(a=>(0,b.jsxs)(C,{className:"cursor-pointer group relative",onClick:()=>c(a.runId),children:[(0,b.jsx)(E,{className:"py-2",children:(0,b.jsx)(H.CopyableText,{text:a.workflowName,overlay:!0,children:(0,M.parseWorkflowName)(a.workflowName)?.shortName||"?"})}),(0,b.jsx)(E,{className:"font-mono text-xs py-2",children:(0,b.jsx)(H.CopyableText,{text:a.runId,overlay:!0,children:a.runId})}),(0,b.jsx)(E,{className:"py-2",children:(0,b.jsx)(S.StatusBadge,{status:a.status,context:a,durationMs:a.startedAt?(a.completedAt?new Date(a.completedAt).getTime():Date.now())-new Date(a.startedAt).getTime():void 0})}),(0,b.jsx)(E,{className:"py-2 text-muted-foreground text-xs",children:a.startedAt?(0,b.jsx)(I.RelativeTime,{date:a.startedAt}):"-"}),(0,b.jsx)(E,{className:"py-2 text-muted-foreground text-xs",children:a.completedAt?(0,b.jsx)(I.RelativeTime,{date:a.completedAt}):"-"}),(0,b.jsx)(E,{className:"py-2",children:(0,b.jsx)(V,{env:R,runId:a.runId,runStatus:a.status,onSuccess:ad,showDebugActions:L})})]},a.runId))})]})})}),(0,b.jsxs)("div",{className:"flex items-center justify-between mt-4",children:[(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:ae}),(0,b.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:aa,disabled:!ac,children:[(0,b.jsx)(j,{}),"Previous"]}),(0,b.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:_,disabled:!ab,children:["Next",(0,b.jsx)(k.ChevronRight,{})]})]})]})]}):(0,b.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:["No workflow runs found. ",(0,b.jsx)("br",{}),(0,b.jsx)(x,{href:"https://useworkflow.dev/docs/foundations/workflows-and-steps",children:"Learn how to create a workflow"})]})]})}var Z=a.i(725538),$=a.i(60408);let _=(0,i.default)("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);var aa=a.i(706998),ab=a.i(904730),ac=a.i(559653),ad=a.i(840861),ae=a.i(333702),af=a.i(192534),ag=a.i(984295),ah=a.i(443343),ai=a.i(665106),aj=a.i(549033),ak=a.i(200866),al=a.i(518243),am=a.i(8930),an=a.i(513358),ao=a.i(516164),ap=a.i(523776),aq="Dialog",[ar,as]=(0,ae.createContextScope)(aq),[at,au]=ar(aq),av=a=>{let{__scopeDialog:c,children:d,open:e,defaultOpen:f,onOpenChange:g,modal:h=!0}=a,i=p.useRef(null),j=p.useRef(null),[k,l]=(0,ag.useControllableState)({prop:e,defaultProp:f??!1,onChange:g,caller:aq});return(0,b.jsx)(at,{scope:c,triggerRef:i,contentRef:j,contentId:(0,af.useId)(),titleId:(0,af.useId)(),descriptionId:(0,af.useId)(),open:k,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(a=>!a),[l]),modal:h,children:d})};av.displayName=aq;var aw="DialogTrigger";p.forwardRef((a,c)=>{let{__scopeDialog:d,...e}=a,f=au(aw,d),g=(0,ad.useComposedRefs)(c,f.triggerRef);return(0,b.jsx)(al.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":f.open,"aria-controls":f.contentId,"data-state":aQ(f.open),...e,ref:g,onClick:(0,ac.composeEventHandlers)(a.onClick,f.onOpenToggle)})}).displayName=aw;var ax="DialogPortal",[ay,az]=ar(ax,{forceMount:void 0}),aA=a=>{let{__scopeDialog:c,forceMount:d,children:e,container:f}=a,g=au(ax,c);return(0,b.jsx)(ay,{scope:c,forceMount:d,children:p.Children.map(e,a=>(0,b.jsx)(ak.Presence,{present:d||g.open,children:(0,b.jsx)(aj.Portal,{asChild:!0,container:f,children:a})}))})};aA.displayName=ax;var aB="DialogOverlay",aC=p.forwardRef((a,c)=>{let d=az(aB,a.__scopeDialog),{forceMount:e=d.forceMount,...f}=a,g=au(aB,a.__scopeDialog);return g.modal?(0,b.jsx)(ak.Presence,{present:e||g.open,children:(0,b.jsx)(aE,{...f,ref:c})}):null});aC.displayName=aB;var aD=(0,ap.createSlot)("DialogOverlay.RemoveScroll"),aE=p.forwardRef((a,c)=>{let{__scopeDialog:d,...e}=a,f=au(aB,d);return(0,b.jsx)(an.RemoveScroll,{as:aD,allowPinchZoom:!0,shards:[f.contentRef],children:(0,b.jsx)(al.Primitive.div,{"data-state":aQ(f.open),...e,ref:c,style:{pointerEvents:"auto",...e.style}})})}),aF="DialogContent",aG=p.forwardRef((a,c)=>{let d=az(aF,a.__scopeDialog),{forceMount:e=d.forceMount,...f}=a,g=au(aF,a.__scopeDialog);return(0,b.jsx)(ak.Presence,{present:e||g.open,children:g.modal?(0,b.jsx)(aH,{...f,ref:c}):(0,b.jsx)(aI,{...f,ref:c})})});aG.displayName=aF;var aH=p.forwardRef((a,c)=>{let d=au(aF,a.__scopeDialog),e=p.useRef(null),f=(0,ad.useComposedRefs)(c,d.contentRef,e);return p.useEffect(()=>{let a=e.current;if(a)return(0,ao.hideOthers)(a)},[]),(0,b.jsx)(aJ,{...a,ref:f,trapFocus:d.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,ac.composeEventHandlers)(a.onCloseAutoFocus,a=>{a.preventDefault(),d.triggerRef.current?.focus()}),onPointerDownOutside:(0,ac.composeEventHandlers)(a.onPointerDownOutside,a=>{let b=a.detail.originalEvent,c=0===b.button&&!0===b.ctrlKey;(2===b.button||c)&&a.preventDefault()}),onFocusOutside:(0,ac.composeEventHandlers)(a.onFocusOutside,a=>a.preventDefault())})}),aI=p.forwardRef((a,c)=>{let d=au(aF,a.__scopeDialog),e=p.useRef(!1),f=p.useRef(!1);return(0,b.jsx)(aJ,{...a,ref:c,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:b=>{a.onCloseAutoFocus?.(b),b.defaultPrevented||(e.current||d.triggerRef.current?.focus(),b.preventDefault()),e.current=!1,f.current=!1},onInteractOutside:b=>{a.onInteractOutside?.(b),b.defaultPrevented||(e.current=!0,"pointerdown"===b.detail.originalEvent.type&&(f.current=!0));let c=b.target;d.triggerRef.current?.contains(c)&&b.preventDefault(),"focusin"===b.detail.originalEvent.type&&f.current&&b.preventDefault()}})}),aJ=p.forwardRef((a,c)=>{let{__scopeDialog:d,trapFocus:e,onOpenAutoFocus:f,onCloseAutoFocus:g,...h}=a,i=au(aF,d),j=p.useRef(null),k=(0,ad.useComposedRefs)(c,j);return(0,am.useFocusGuards)(),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ai.FocusScope,{asChild:!0,loop:!0,trapped:e,onMountAutoFocus:f,onUnmountAutoFocus:g,children:(0,b.jsx)(ah.DismissableLayer,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":aQ(i.open),...h,ref:k,onDismiss:()=>i.onOpenChange(!1)})}),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aU,{titleId:i.titleId}),(0,b.jsx)(aV,{contentRef:j,descriptionId:i.descriptionId})]})]})}),aK="DialogTitle",aL=p.forwardRef((a,c)=>{let{__scopeDialog:d,...e}=a,f=au(aK,d);return(0,b.jsx)(al.Primitive.h2,{id:f.titleId,...e,ref:c})});aL.displayName=aK;var aM="DialogDescription",aN=p.forwardRef((a,c)=>{let{__scopeDialog:d,...e}=a,f=au(aM,d);return(0,b.jsx)(al.Primitive.p,{id:f.descriptionId,...e,ref:c})});aN.displayName=aM;var aO="DialogClose",aP=p.forwardRef((a,c)=>{let{__scopeDialog:d,...e}=a,f=au(aO,d);return(0,b.jsx)(al.Primitive.button,{type:"button",...e,ref:c,onClick:(0,ac.composeEventHandlers)(a.onClick,()=>f.onOpenChange(!1))})});function aQ(a){return a?"open":"closed"}aP.displayName=aO;var aR="DialogTitleWarning",[aS,aT]=(0,ae.createContext)(aR,{contentName:aF,titleName:aK,docsSlug:"dialog"}),aU=({titleId:a})=>{let b=aT(aR),c=`\`${b.contentName}\` requires a \`${b.titleName}\` for the component to be accessible for screen reader users.
2
+
3
+ If you want to hide the \`${b.titleName}\`, you can wrap it with our VisuallyHidden component.
4
+
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return p.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},aV=({contentRef:a,descriptionId:b})=>{let c=aT("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return p.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null},aW=a.i(930840),aW=aW;function aX({...a}){return(0,b.jsx)(av,{"data-slot":"sheet",...a})}function aY({...a}){return(0,b.jsx)(aA,{"data-slot":"sheet-portal",...a})}function aZ({className:a,...c}){return(0,b.jsx)(aC,{"data-slot":"sheet-overlay",className:(0,t.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...c})}function a$({className:a,children:c,side:d="right",...e}){return(0,b.jsxs)(aY,{children:[(0,b.jsx)(aZ,{}),(0,b.jsxs)(aG,{"data-slot":"sheet-content",className:(0,t.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===d&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===d&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===d&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===d&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",a),...e,children:[c,(0,b.jsxs)(aP,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,b.jsx)(aW.default,{className:"size-4"}),(0,b.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function a_({className:a,...c}){return(0,b.jsx)("div",{"data-slot":"sheet-header",className:(0,t.cn)("flex flex-col gap-1.5 p-4",a),...c})}function a0({className:a,...c}){return(0,b.jsx)(aL,{"data-slot":"sheet-title",className:(0,t.cn)("text-foreground font-semibold",a),...c})}function a1({className:a,...c}){return(0,b.jsx)(aN,{"data-slot":"sheet-description",className:(0,t.cn)("text-muted-foreground text-sm",a),...c})}var a2=a.i(691435);function a3({config:a,onWorkflowSelect:c}){let[d,e]=(0,p.useState)(!1),[f,g]=(0,p.useState)(null),{manifest:i,loading:j,error:k}=(0,a2.useWorkflowGraphManifest)(a),l=i?Object.values(i.workflows):[],m=(0,p.useMemo)(()=>[...l].sort((a,b)=>a.workflowName.localeCompare(b.workflowName)),[l]);return j?(0,b.jsx)(K,{variant:"workflows",rows:6}):k?(0,b.jsxs)(r.Alert,{variant:"destructive",children:[(0,b.jsx)(h.AlertCircle,{className:"h-4 w-4"}),(0,b.jsx)(r.AlertTitle,{children:"Error Loading Workflows"}),(0,b.jsx)(r.AlertDescription,{children:k.message})]}):0===l.length?(0,b.jsx)(u,{children:(0,b.jsxs)(v,{className:"p-12 text-center",children:[(0,b.jsx)(_,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),(0,b.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No Workflows Found"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"No workflow definitions were found in the graph manifest."})]})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u,{className:"overflow-hidden bg-background",children:(0,b.jsx)(v,{className:"p-0 max-h-[calc(100vh-200px)] overflow-auto",children:(0,b.jsxs)(z,{children:[(0,b.jsx)(A,{children:(0,b.jsxs)(C,{children:[(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Workflow"}),(0,b.jsx)(D,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"File"}),(0,b.jsx)(D,{className:"text-center sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Steps"})]})}),(0,b.jsx)(B,{children:m.map(a=>{let d=a.nodes.filter(a=>"step"===a.data.nodeKind).length;return(0,b.jsxs)(C,{className:"cursor-pointer",onClick:()=>{g(a),e(!0),c?.(a.workflowName)},children:[(0,b.jsx)(E,{className:"py-2",children:(0,b.jsx)("span",{className:"font-medium",children:a.workflowName})}),(0,b.jsx)(E,{className:"py-2",children:(0,b.jsx)("code",{className:"text-xs text-muted-foreground",children:a.filePath})}),(0,b.jsx)(E,{className:"text-center py-2",children:(0,b.jsxs)(ab.Badge,{variant:"secondary",className:"gap-1",children:[(0,b.jsx)($.GitBranch,{className:"h-3 w-3"}),d," ",1===d?"step":"steps"]})})]},a.workflowId)})})]})})}),(0,b.jsx)(aX,{open:d,onOpenChange:e,children:(0,b.jsxs)(a$,{side:"right",className:"w-[75vw] max-w-[75vw] sm:max-w-[75vw]",children:[(0,b.jsxs)(a_,{children:[(0,b.jsxs)(a0,{className:"flex items-center gap-2",children:[(0,b.jsx)(_,{className:"h-5 w-5"}),f?.workflowName]}),f&&(0,b.jsx)(a1,{asChild:!0,children:(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("code",{className:"text-xs",children:f.filePath}),(0,b.jsx)("div",{children:(0,b.jsxs)(ab.Badge,{variant:"outline",className:"gap-1",children:[(0,b.jsx)($.GitBranch,{className:"h-3 w-3"}),f.nodes.filter(a=>"step"===a.data.nodeKind).length," ",1===f.nodes.filter(a=>"step"===a.data.nodeKind).length?"step":"steps"]})})]})})]}),(0,b.jsx)("div",{className:"mt-6 h-[calc(100vh-180px)]",children:f&&(0,b.jsx)(aa.WorkflowGraphViewer,{workflow:f})})]})})]})}var a4=a.i(47318);function a5(){let a=(0,d.useRouter)(),e=(0,G.useQueryParamConfig)(),[f]=(0,a4.useSidebarState)(),[g]=(0,a4.useHookIdState)(),[h,i]=(0,a4.useTabState)(),j="local"===e.backend;return(0,b.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,b.jsxs)(Z.Tabs,{value:h,onValueChange:i,className:"w-full",children:[(0,b.jsxs)(Z.TabsList,{className:"mb-4",children:[(0,b.jsx)(Z.TabsTrigger,{value:"runs",children:"Runs"}),(0,b.jsx)(Z.TabsTrigger,{value:"hooks",children:"Hooks"}),j&&(0,b.jsx)(Z.TabsTrigger,{value:"workflows",children:"Workflows"})]}),(0,b.jsx)(Z.TabsContent,{value:"runs",children:(0,b.jsx)(c.ErrorBoundary,{title:"Runs Error",description:"Failed to load workflow runs. Please try refreshing the page.",children:(0,b.jsx)(Y,{config:e,onRunClick:(b,c)=>{c?a.push((0,G.buildUrlWithConfig)(`/run/${b}/streams/${c}`,e)):a.push((0,G.buildUrlWithConfig)(`/run/${b}`,e))}})})}),(0,b.jsx)(Z.TabsContent,{value:"hooks",children:(0,b.jsx)(c.ErrorBoundary,{title:"Hooks Error",description:"Failed to load hooks. Please try refreshing the page.",children:(0,b.jsx)(L,{config:e,onHookClick:(b,c)=>{b?a.push((0,G.buildUrlWithConfig)(`/run/${c}`,e,{sidebar:"hook",hookId:b})):a.push((0,G.buildUrlWithConfig)(`/run/${c}`,e))},selectedHookId:"hook"===f&&g?g:void 0})})}),j&&(0,b.jsx)(Z.TabsContent,{value:"workflows",children:(0,b.jsx)(c.ErrorBoundary,{title:"Workflows Error",description:"Failed to load workflow graph data. Please try refreshing the page.",children:(0,b.jsx)(a3,{config:e})})})]})})}a.s(["default",()=>a5],762587)}];
2
6
 
3
7
  //# sourceMappingURL=packages_web_src_app_page_tsx_cd282e82._.js.map