@workflow/web 4.0.1-beta.25 → 4.0.1-beta.26

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 (94) 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/page.js +4 -4
  6. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/server/app/_global-error.html +2 -2
  8. package/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page/server-reference-manifest.json +74 -89
  15. package/.next/server/app/_not-found/page.js +7 -7
  16. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/server/app/page/server-reference-manifest.json +64 -64
  19. package/.next/server/app/page.js +6 -6
  20. package/.next/server/app/page.js.nft.json +1 -1
  21. package/.next/server/app/page_client-reference-manifest.js +1 -1
  22. package/.next/server/app/run/[runId]/page/server-reference-manifest.json +71 -101
  23. package/.next/server/app/run/[runId]/page.js +6 -6
  24. package/.next/server/app/run/[runId]/page.js.nft.json +1 -1
  25. package/.next/server/app/run/[runId]/page_client-reference-manifest.js +1 -1
  26. package/.next/server/chunks/ssr/7a2e6_next_dist_ae14ba7e._.js +3 -0
  27. package/.next/server/chunks/ssr/7a2e6_next_dist_ae14ba7e._.js.map +1 -0
  28. package/.next/server/chunks/ssr/[root-of-the-server]__5c054bd5._.js +3 -0
  29. package/.next/server/chunks/ssr/[root-of-the-server]__5c054bd5._.js.map +1 -0
  30. package/.next/server/chunks/ssr/[root-of-the-server]__6ca59dc9._.js +1 -1
  31. package/.next/server/chunks/ssr/[root-of-the-server]__6ca59dc9._.js.map +1 -1
  32. package/.next/server/chunks/ssr/[root-of-the-server]__c06c8e66._.js +3 -0
  33. package/.next/server/chunks/ssr/[root-of-the-server]__c06c8e66._.js.map +1 -0
  34. package/.next/server/chunks/ssr/{[root-of-the-server]__6a861d9c._.js → [root-of-the-server]__cdeda0e3._.js} +7 -4
  35. package/.next/server/chunks/ssr/[root-of-the-server]__cdeda0e3._.js.map +1 -0
  36. package/.next/server/chunks/ssr/{_73d9d1d2._.js → _2b3a1bb9._.js} +3 -3
  37. package/.next/server/chunks/ssr/_2b3a1bb9._.js.map +1 -0
  38. package/.next/server/chunks/ssr/_3271c9ff._.js +9 -0
  39. package/.next/server/chunks/ssr/_3271c9ff._.js.map +1 -0
  40. package/.next/server/chunks/ssr/_af28dabd._.js +1 -1
  41. package/.next/server/chunks/ssr/_af28dabd._.js.map +1 -1
  42. package/.next/server/chunks/ssr/_fb1f944b._.js +9 -0
  43. package/.next/server/chunks/ssr/_fb1f944b._.js.map +1 -0
  44. package/.next/server/chunks/ssr/packages_web__next-internal_server_app__not-found_page_actions_8572dae1.js +3 -0
  45. package/.next/server/chunks/ssr/packages_web__next-internal_server_app__not-found_page_actions_8572dae1.js.map +1 -0
  46. package/.next/server/chunks/ssr/packages_web__next-internal_server_app_page_actions_b691008e.js +3 -0
  47. package/.next/server/chunks/ssr/packages_web__next-internal_server_app_page_actions_b691008e.js.map +1 -0
  48. package/.next/server/chunks/ssr/packages_web__next-internal_server_app_run_[runId]_page_actions_ed901ed2.js +3 -0
  49. package/.next/server/chunks/ssr/packages_web__next-internal_server_app_run_[runId]_page_actions_ed901ed2.js.map +1 -0
  50. package/.next/server/chunks/ssr/packages_web_src_app_page_tsx_cd282e82._.js +2 -2
  51. package/.next/server/chunks/ssr/packages_web_src_app_page_tsx_cd282e82._.js.map +1 -1
  52. package/.next/server/chunks/ssr/packages_web_src_app_run_[runId]_page_tsx_c7d0b139._.js +2 -2
  53. package/.next/server/chunks/ssr/packages_web_src_app_run_[runId]_page_tsx_c7d0b139._.js.map +1 -1
  54. package/.next/server/pages/500.html +2 -2
  55. package/.next/server/server-reference-manifest.js +1 -1
  56. package/.next/server/server-reference-manifest.json +142 -163
  57. package/.next/static/chunks/{2cff92f050b5d346.js → 1dd7f6f53142c523.js} +4 -4
  58. package/.next/static/chunks/2d6234294c9cbe6e.js +5 -0
  59. package/.next/static/chunks/{81bfcaaedc5b9dd4.js → 76f7e662cf18bc05.js} +2 -2
  60. package/.next/static/chunks/9a10dd2dbe813b82.css +3 -0
  61. package/.next/static/chunks/{f13610a4cf4d839d.js → b2c692ac364407a1.js} +3 -3
  62. package/.next/static/chunks/d939d848519f0271.js +7 -0
  63. package/.next/static/chunks/ddf3d216d028d6c3.js +7 -0
  64. package/.next/trace +1 -1
  65. package/.next/trace-build +1 -1
  66. package/package.json +2 -2
  67. package/.next/server/chunks/ssr/7a2e6_next_dist_44e95a3d._.js +0 -3
  68. package/.next/server/chunks/ssr/7a2e6_next_dist_44e95a3d._.js.map +0 -1
  69. package/.next/server/chunks/ssr/7a2e6_next_dist_9bcf7330._.js +0 -6
  70. package/.next/server/chunks/ssr/7a2e6_next_dist_9bcf7330._.js.map +0 -1
  71. package/.next/server/chunks/ssr/[root-of-the-server]__2168651f._.js +0 -3
  72. package/.next/server/chunks/ssr/[root-of-the-server]__2168651f._.js.map +0 -1
  73. package/.next/server/chunks/ssr/[root-of-the-server]__25c4ca9a._.js +0 -3
  74. package/.next/server/chunks/ssr/[root-of-the-server]__25c4ca9a._.js.map +0 -1
  75. package/.next/server/chunks/ssr/[root-of-the-server]__6a861d9c._.js.map +0 -1
  76. package/.next/server/chunks/ssr/[root-of-the-server]__cd52d714._.js +0 -3
  77. package/.next/server/chunks/ssr/[root-of-the-server]__cd52d714._.js.map +0 -1
  78. package/.next/server/chunks/ssr/[root-of-the-server]__d416fa5e._.js +0 -3
  79. package/.next/server/chunks/ssr/[root-of-the-server]__d416fa5e._.js.map +0 -1
  80. package/.next/server/chunks/ssr/_73d9d1d2._.js.map +0 -1
  81. package/.next/server/chunks/ssr/_bff7cae2._.js +0 -9
  82. package/.next/server/chunks/ssr/_bff7cae2._.js.map +0 -1
  83. package/.next/server/chunks/ssr/_ce81e446._.js +0 -9
  84. package/.next/server/chunks/ssr/_ce81e446._.js.map +0 -1
  85. package/.next/server/chunks/ssr/packages_web_src_19bb3951._.js +0 -3
  86. package/.next/server/chunks/ssr/packages_web_src_19bb3951._.js.map +0 -1
  87. package/.next/static/chunks/470b42b911d29964.css +0 -3
  88. package/.next/static/chunks/4d2ec8aac07fb893.js +0 -7
  89. package/.next/static/chunks/a28dcf3cb7639da5.js +0 -7
  90. package/.next/static/chunks/b4d900e32de21ca7.js +0 -5
  91. package/.next/static/chunks/e68c61c49bcda1b6.js +0 -1
  92. /package/.next/static/{pORVETc7I1nE9v4XSTenx → pAcj1nEa06NbhYNudNEMs}/_buildManifest.js +0 -0
  93. /package/.next/static/{pORVETc7I1nE9v4XSTenx → pAcj1nEa06NbhYNudNEMs}/_clientMiddlewareManifest.json +0 -0
  94. /package/.next/static/{pORVETc7I1nE9v4XSTenx → pAcj1nEa06NbhYNudNEMs}/_ssgManifest.js +0 -0
@@ -1,14 +1,14 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,721969,e=>{"use strict";let t;var r,a=e.i(666426);e.i(169764);var s=e.i(545030),n=e.i(868924),o=e.i(360088),l=e.i(531875),d=e.i(742334),i=e.i(195547),c=e.i(687602),u=e.i(400138),p=e.i(886288);let m=(0,p.default)("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),f=(0,p.default)("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);var x=e.i(857812),h=e.i(414576),g=e.i(686107),b=e.i(806746),v=e.i(456944),j=e.i(961612),y=e.i(652773),N=e.i(178896),w=e.i(873350),k=e.i(676977),S=e.i(571577),A=e.i(68206),C=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((e,t)=>{let r=g.forwardRef((e,r)=>{let{asChild:s,...n}=e,o=s?A.Slot:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,a.jsx)(o,{...n,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),I=e.i(448297),E=e.i(25749),D="dismissableLayer.update",T=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),R=g.forwardRef((e,t)=>{let{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:d,onDismiss:i,...c}=e,u=g.useContext(T),[p,m]=g.useState(null),f=p?.ownerDocument??globalThis?.document,[,x]=g.useState({}),h=(0,y.useComposedRefs)(t,e=>m(e)),b=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),j=b.indexOf(v),w=p?b.indexOf(p):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=j,A=function(e,t=globalThis?.document){let r=(0,I.useCallbackRef)(e),a=g.useRef(!1),s=g.useRef(()=>{});return g.useEffect(()=>{let e=e=>{if(e.target&&!a.current){let a=function(){P("dismissableLayer.pointerDownOutside",r,n,{discrete:!0})},n={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",s.current),s.current=a,t.addEventListener("click",s.current,{once:!0})):a()}else t.removeEventListener("click",s.current);a.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{let t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(o?.(e),d?.(e),e.defaultPrevented||i?.())},f),R=function(e,t=globalThis?.document){let r=(0,I.useCallbackRef)(e),a=g.useRef(!1);return g.useEffect(()=>{let e=e=>{e.target&&!a.current&&P("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{let t=e.target;![...u.branches].some(e=>e.contains(t))&&(l?.(e),d?.(e),e.defaultPrevented||i?.())},f);return(0,E.useEscapeKeydown)(e=>{w===u.layers.size-1&&(n?.(e),!e.defaultPrevented&&i&&(e.preventDefault(),i()))},f),g.useEffect(()=>{if(p)return s&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(r=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),O(),()=>{s&&1===u.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=r)}},[p,f,s,u]),g.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),O())},[p,u]),g.useEffect(()=>{let e=()=>x({});return document.addEventListener(D,e),()=>document.removeEventListener(D,e)},[]),(0,a.jsx)(C.div,{...c,ref:h,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:(0,N.composeEventHandlers)(e.onFocusCapture,R.onFocusCapture),onBlurCapture:(0,N.composeEventHandlers)(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:(0,N.composeEventHandlers)(e.onPointerDownCapture,A.onPointerDownCapture)})});function O(){let e=new CustomEvent(D);document.dispatchEvent(e)}function P(e,t,r,{discrete:a}){let s=r.originalEvent.target,n=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});if(t&&s.addEventListener(e,t,{once:!0}),a)s&&S.flushSync(()=>s.dispatchEvent(n));else s.dispatchEvent(n)}R.displayName="DismissableLayer",g.forwardRef((e,t)=>{let r=g.useContext(T),s=g.useRef(null),n=(0,y.useComposedRefs)(t,s);return g.useEffect(()=>{let e=s.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,a.jsx)(C.div,{...e,ref:n})}).displayName="DismissableLayerBranch";var L="focusScope.autoFocusOnMount",M="focusScope.autoFocusOnUnmount",F={bubbles:!1,cancelable:!0},_=g.forwardRef((e,t)=>{let{loop:r=!1,trapped:s=!1,onMountAutoFocus:n,onUnmountAutoFocus:o,...l}=e,[d,i]=g.useState(null),c=(0,I.useCallbackRef)(n),u=(0,I.useCallbackRef)(o),p=g.useRef(null),m=(0,y.useComposedRefs)(t,e=>i(e)),f=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(s){let e=function(e){if(f.paused||!d)return;let t=e.target;d.contains(t)?p.current=t:$(p.current,{select:!0})},t=function(e){if(f.paused||!d)return;let t=e.relatedTarget;null!==t&&(d.contains(t)||$(p.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&$(d)});return d&&r.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[s,d,f.paused]),g.useEffect(()=>{if(d){H.add(f);let e=document.activeElement;if(!d.contains(e)){let t=new CustomEvent(L,F);d.addEventListener(L,c),d.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let a of e)if($(a,{select:t}),document.activeElement!==r)return}(W(d).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&$(d))}return()=>{d.removeEventListener(L,c),setTimeout(()=>{let t=new CustomEvent(M,F);d.addEventListener(M,u),d.dispatchEvent(t),t.defaultPrevented||$(e??document.body,{select:!0}),d.removeEventListener(M,u),H.remove(f)},0)}}},[d,c,u,f]);let x=g.useCallback(e=>{if(!r&&!s||f.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){var n;let t,s=e.currentTarget,[o,l]=[B(t=W(n=s),n),B(t.reverse(),n)];o&&l?e.shiftKey||a!==l?e.shiftKey&&a===o&&(e.preventDefault(),r&&$(l,{select:!0})):(e.preventDefault(),r&&$(o,{select:!0})):a===s&&e.preventDefault()}},[r,s,f.paused]);return(0,a.jsx)(C.div,{tabIndex:-1,...l,ref:m,onKeyDown:x})});function W(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function B(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function $(e,{select:t=!1}={}){if(e&&e.focus){var r;let a=document.activeElement;e.focus({preventScroll:!0}),e!==a&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}_.displayName="FocusScope";var H=(t=[],{add(e){let r=t[0];e!==r&&r?.pause(),(t=K(t,e)).unshift(e)},remove(e){t=K(t,e),t[0]?.resume()}});function K(e,t){let r=[...e],a=r.indexOf(t);return -1!==a&&r.splice(a,1),r}var z=e.i(664019),G=g.forwardRef((e,t)=>{let{container:r,...s}=e,[n,o]=g.useState(!1);(0,z.useLayoutEffect)(()=>o(!0),[]);let l=r||n&&globalThis?.document?.body;return l?S.default.createPortal((0,a.jsx)(C.div,{...s,ref:t}),l):null});G.displayName="Portal";var V=e.i(224285),U=e.i(648502),q=e.i(891246),J=e.i(73772),Z="Dialog",[Q,Y]=(0,j.createContextScope)(Z),[X,ee]=Q(Z),et=e=>{let{__scopeDialog:t,children:r,open:s,defaultOpen:n,onOpenChange:o,modal:l=!0}=e,d=g.useRef(null),i=g.useRef(null),[c=!1,u]=(0,k.useControllableState)({prop:s,defaultProp:n,onChange:o});return(0,a.jsx)(X,{scope:t,triggerRef:d,contentRef:i,contentId:(0,w.useId)(),titleId:(0,w.useId)(),descriptionId:(0,w.useId)(),open:c,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(e=>!e),[u]),modal:l,children:r})};et.displayName=Z;var er="DialogTrigger",ea=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(er,r),o=(0,y.useComposedRefs)(t,n.triggerRef);return(0,a.jsx)(C.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":eN(n.open),...s,ref:o,onClick:(0,N.composeEventHandlers)(e.onClick,n.onOpenToggle)})});ea.displayName=er;var es="DialogPortal",[en,eo]=Q(es,{forceMount:void 0}),el=e=>{let{__scopeDialog:t,forceMount:r,children:s,container:n}=e,o=ee(es,t);return(0,a.jsx)(en,{scope:t,forceMount:r,children:g.Children.map(s,e=>(0,a.jsx)(V.Presence,{present:r||o.open,children:(0,a.jsx)(G,{asChild:!0,container:n,children:e})}))})};el.displayName=es;var ed="DialogOverlay",ei=g.forwardRef((e,t)=>{let r=eo(ed,e.__scopeDialog),{forceMount:s=r.forceMount,...n}=e,o=ee(ed,e.__scopeDialog);return o.modal?(0,a.jsx)(V.Presence,{present:s||o.open,children:(0,a.jsx)(ec,{...n,ref:t})}):null});ei.displayName=ed;var ec=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(ed,r);return(0,a.jsx)(q.RemoveScroll,{as:A.Slot,allowPinchZoom:!0,shards:[n.contentRef],children:(0,a.jsx)(C.div,{"data-state":eN(n.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),eu="DialogContent",ep=g.forwardRef((e,t)=>{let r=eo(eu,e.__scopeDialog),{forceMount:s=r.forceMount,...n}=e,o=ee(eu,e.__scopeDialog);return(0,a.jsx)(V.Presence,{present:s||o.open,children:o.modal?(0,a.jsx)(em,{...n,ref:t}):(0,a.jsx)(ef,{...n,ref:t})})});ep.displayName=eu;var em=g.forwardRef((e,t)=>{let r=ee(eu,e.__scopeDialog),s=g.useRef(null),n=(0,y.useComposedRefs)(t,r.contentRef,s);return g.useEffect(()=>{let e=s.current;if(e)return(0,J.hideOthers)(e)},[]),(0,a.jsx)(ex,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,N.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:(0,N.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,N.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault())})}),ef=g.forwardRef((e,t)=>{let r=ee(eu,e.__scopeDialog),s=g.useRef(!1),n=g.useRef(!1);return(0,a.jsx)(ex,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(s.current||r.triggerRef.current?.focus(),t.preventDefault()),s.current=!1,n.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,"pointerdown"===t.detail.originalEvent.type&&(n.current=!0));let a=t.target;r.triggerRef.current?.contains(a)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&n.current&&t.preventDefault()}})}),ex=g.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:o,...l}=e,d=ee(eu,r),i=g.useRef(null),c=(0,y.useComposedRefs)(t,i);return(0,U.useFocusGuards)(),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(_,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:n,onUnmountAutoFocus:o,children:(0,a.jsx)(R,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":eN(d.open),...l,ref:c,onDismiss:()=>d.onOpenChange(!1)})}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eA,{titleId:d.titleId}),(0,a.jsx)(eC,{contentRef:i,descriptionId:d.descriptionId})]})]})}),eh="DialogTitle",eg=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(eh,r);return(0,a.jsx)(C.h2,{id:n.titleId,...s,ref:t})});eg.displayName=eh;var eb="DialogDescription",ev=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(eb,r);return(0,a.jsx)(C.p,{id:n.descriptionId,...s,ref:t})});ev.displayName=eb;var ej="DialogClose",ey=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(ej,r);return(0,a.jsx)(C.button,{type:"button",...s,ref:t,onClick:(0,N.composeEventHandlers)(e.onClick,()=>n.onOpenChange(!1))})});function eN(e){return e?"open":"closed"}ey.displayName=ej;var ew="DialogTitleWarning",[ek,eS]=(0,j.createContext)(ew,{contentName:eu,titleName:eh,docsSlug:"dialog"}),eA=({titleId:e})=>{let t=eS(ew),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,721969,e=>{"use strict";let t;var r,a=e.i(666426);e.i(169764);var s=e.i(545030),n=e.i(868924),o=e.i(360088),l=e.i(531875),d=e.i(742334),i=e.i(195547),c=e.i(687602),u=e.i(400138),p=e.i(886288);let m=(0,p.default)("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),f=(0,p.default)("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);var x=e.i(857812),h=e.i(414576),g=e.i(686107),b=e.i(806746),v=e.i(456944),j=e.i(961612),y=e.i(652773),N=e.i(178896),w=e.i(873350),k=e.i(676977),S=e.i(571577),A=e.i(68206),I=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((e,t)=>{let r=g.forwardRef((e,r)=>{let{asChild:s,...n}=e,o=s?A.Slot:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,a.jsx)(o,{...n,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),C=e.i(448297),E=e.i(25749),D="dismissableLayer.update",T=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),R=g.forwardRef((e,t)=>{let{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:l,onInteractOutside:d,onDismiss:i,...c}=e,u=g.useContext(T),[p,m]=g.useState(null),f=p?.ownerDocument??globalThis?.document,[,x]=g.useState({}),h=(0,y.useComposedRefs)(t,e=>m(e)),b=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),j=b.indexOf(v),w=p?b.indexOf(p):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=j,A=function(e,t=globalThis?.document){let r=(0,C.useCallbackRef)(e),a=g.useRef(!1),s=g.useRef(()=>{});return g.useEffect(()=>{let e=e=>{if(e.target&&!a.current){let a=function(){P("dismissableLayer.pointerDownOutside",r,n,{discrete:!0})},n={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",s.current),s.current=a,t.addEventListener("click",s.current,{once:!0})):a()}else t.removeEventListener("click",s.current);a.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{let t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(o?.(e),d?.(e),e.defaultPrevented||i?.())},f),R=function(e,t=globalThis?.document){let r=(0,C.useCallbackRef)(e),a=g.useRef(!1);return g.useEffect(()=>{let e=e=>{e.target&&!a.current&&P("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{let t=e.target;![...u.branches].some(e=>e.contains(t))&&(l?.(e),d?.(e),e.defaultPrevented||i?.())},f);return(0,E.useEscapeKeydown)(e=>{w===u.layers.size-1&&(n?.(e),!e.defaultPrevented&&i&&(e.preventDefault(),i()))},f),g.useEffect(()=>{if(p)return s&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(r=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),O(),()=>{s&&1===u.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=r)}},[p,f,s,u]),g.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),O())},[p,u]),g.useEffect(()=>{let e=()=>x({});return document.addEventListener(D,e),()=>document.removeEventListener(D,e)},[]),(0,a.jsx)(I.div,{...c,ref:h,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:(0,N.composeEventHandlers)(e.onFocusCapture,R.onFocusCapture),onBlurCapture:(0,N.composeEventHandlers)(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:(0,N.composeEventHandlers)(e.onPointerDownCapture,A.onPointerDownCapture)})});function O(){let e=new CustomEvent(D);document.dispatchEvent(e)}function P(e,t,r,{discrete:a}){let s=r.originalEvent.target,n=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});if(t&&s.addEventListener(e,t,{once:!0}),a)s&&S.flushSync(()=>s.dispatchEvent(n));else s.dispatchEvent(n)}R.displayName="DismissableLayer",g.forwardRef((e,t)=>{let r=g.useContext(T),s=g.useRef(null),n=(0,y.useComposedRefs)(t,s);return g.useEffect(()=>{let e=s.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,a.jsx)(I.div,{...e,ref:n})}).displayName="DismissableLayerBranch";var L="focusScope.autoFocusOnMount",M="focusScope.autoFocusOnUnmount",F={bubbles:!1,cancelable:!0},_=g.forwardRef((e,t)=>{let{loop:r=!1,trapped:s=!1,onMountAutoFocus:n,onUnmountAutoFocus:o,...l}=e,[d,i]=g.useState(null),c=(0,C.useCallbackRef)(n),u=(0,C.useCallbackRef)(o),p=g.useRef(null),m=(0,y.useComposedRefs)(t,e=>i(e)),f=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(s){let e=function(e){if(f.paused||!d)return;let t=e.target;d.contains(t)?p.current=t:$(p.current,{select:!0})},t=function(e){if(f.paused||!d)return;let t=e.relatedTarget;null!==t&&(d.contains(t)||$(p.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&$(d)});return d&&r.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[s,d,f.paused]),g.useEffect(()=>{if(d){H.add(f);let e=document.activeElement;if(!d.contains(e)){let t=new CustomEvent(L,F);d.addEventListener(L,c),d.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let a of e)if($(a,{select:t}),document.activeElement!==r)return}(W(d).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&$(d))}return()=>{d.removeEventListener(L,c),setTimeout(()=>{let t=new CustomEvent(M,F);d.addEventListener(M,u),d.dispatchEvent(t),t.defaultPrevented||$(e??document.body,{select:!0}),d.removeEventListener(M,u),H.remove(f)},0)}}},[d,c,u,f]);let x=g.useCallback(e=>{if(!r&&!s||f.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){var n;let t,s=e.currentTarget,[o,l]=[B(t=W(n=s),n),B(t.reverse(),n)];o&&l?e.shiftKey||a!==l?e.shiftKey&&a===o&&(e.preventDefault(),r&&$(l,{select:!0})):(e.preventDefault(),r&&$(o,{select:!0})):a===s&&e.preventDefault()}},[r,s,f.paused]);return(0,a.jsx)(I.div,{tabIndex:-1,...l,ref:m,onKeyDown:x})});function W(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function B(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function $(e,{select:t=!1}={}){if(e&&e.focus){var r;let a=document.activeElement;e.focus({preventScroll:!0}),e!==a&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}_.displayName="FocusScope";var H=(t=[],{add(e){let r=t[0];e!==r&&r?.pause(),(t=K(t,e)).unshift(e)},remove(e){t=K(t,e),t[0]?.resume()}});function K(e,t){let r=[...e],a=r.indexOf(t);return -1!==a&&r.splice(a,1),r}var z=e.i(664019),G=g.forwardRef((e,t)=>{let{container:r,...s}=e,[n,o]=g.useState(!1);(0,z.useLayoutEffect)(()=>o(!0),[]);let l=r||n&&globalThis?.document?.body;return l?S.default.createPortal((0,a.jsx)(I.div,{...s,ref:t}),l):null});G.displayName="Portal";var V=e.i(224285),U=e.i(648502),q=e.i(891246),J=e.i(73772),Z="Dialog",[Y,Q]=(0,j.createContextScope)(Z),[X,ee]=Y(Z),et=e=>{let{__scopeDialog:t,children:r,open:s,defaultOpen:n,onOpenChange:o,modal:l=!0}=e,d=g.useRef(null),i=g.useRef(null),[c=!1,u]=(0,k.useControllableState)({prop:s,defaultProp:n,onChange:o});return(0,a.jsx)(X,{scope:t,triggerRef:d,contentRef:i,contentId:(0,w.useId)(),titleId:(0,w.useId)(),descriptionId:(0,w.useId)(),open:c,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(e=>!e),[u]),modal:l,children:r})};et.displayName=Z;var er="DialogTrigger",ea=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(er,r),o=(0,y.useComposedRefs)(t,n.triggerRef);return(0,a.jsx)(I.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":eN(n.open),...s,ref:o,onClick:(0,N.composeEventHandlers)(e.onClick,n.onOpenToggle)})});ea.displayName=er;var es="DialogPortal",[en,eo]=Y(es,{forceMount:void 0}),el=e=>{let{__scopeDialog:t,forceMount:r,children:s,container:n}=e,o=ee(es,t);return(0,a.jsx)(en,{scope:t,forceMount:r,children:g.Children.map(s,e=>(0,a.jsx)(V.Presence,{present:r||o.open,children:(0,a.jsx)(G,{asChild:!0,container:n,children:e})}))})};el.displayName=es;var ed="DialogOverlay",ei=g.forwardRef((e,t)=>{let r=eo(ed,e.__scopeDialog),{forceMount:s=r.forceMount,...n}=e,o=ee(ed,e.__scopeDialog);return o.modal?(0,a.jsx)(V.Presence,{present:s||o.open,children:(0,a.jsx)(ec,{...n,ref:t})}):null});ei.displayName=ed;var ec=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(ed,r);return(0,a.jsx)(q.RemoveScroll,{as:A.Slot,allowPinchZoom:!0,shards:[n.contentRef],children:(0,a.jsx)(I.div,{"data-state":eN(n.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),eu="DialogContent",ep=g.forwardRef((e,t)=>{let r=eo(eu,e.__scopeDialog),{forceMount:s=r.forceMount,...n}=e,o=ee(eu,e.__scopeDialog);return(0,a.jsx)(V.Presence,{present:s||o.open,children:o.modal?(0,a.jsx)(em,{...n,ref:t}):(0,a.jsx)(ef,{...n,ref:t})})});ep.displayName=eu;var em=g.forwardRef((e,t)=>{let r=ee(eu,e.__scopeDialog),s=g.useRef(null),n=(0,y.useComposedRefs)(t,r.contentRef,s);return g.useEffect(()=>{let e=s.current;if(e)return(0,J.hideOthers)(e)},[]),(0,a.jsx)(ex,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,N.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:(0,N.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,N.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault())})}),ef=g.forwardRef((e,t)=>{let r=ee(eu,e.__scopeDialog),s=g.useRef(!1),n=g.useRef(!1);return(0,a.jsx)(ex,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(s.current||r.triggerRef.current?.focus(),t.preventDefault()),s.current=!1,n.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,"pointerdown"===t.detail.originalEvent.type&&(n.current=!0));let a=t.target;r.triggerRef.current?.contains(a)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&n.current&&t.preventDefault()}})}),ex=g.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:o,...l}=e,d=ee(eu,r),i=g.useRef(null),c=(0,y.useComposedRefs)(t,i);return(0,U.useFocusGuards)(),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(_,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:n,onUnmountAutoFocus:o,children:(0,a.jsx)(R,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":eN(d.open),...l,ref:c,onDismiss:()=>d.onOpenChange(!1)})}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eA,{titleId:d.titleId}),(0,a.jsx)(eI,{contentRef:i,descriptionId:d.descriptionId})]})]})}),eh="DialogTitle",eg=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(eh,r);return(0,a.jsx)(I.h2,{id:n.titleId,...s,ref:t})});eg.displayName=eh;var eb="DialogDescription",ev=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(eb,r);return(0,a.jsx)(I.p,{id:n.descriptionId,...s,ref:t})});ev.displayName=eb;var ej="DialogClose",ey=g.forwardRef((e,t)=>{let{__scopeDialog:r,...s}=e,n=ee(ej,r);return(0,a.jsx)(I.button,{type:"button",...s,ref:t,onClick:(0,N.composeEventHandlers)(e.onClick,()=>n.onOpenChange(!1))})});function eN(e){return e?"open":"closed"}ey.displayName=ej;var ew="DialogTitleWarning",[ek,eS]=(0,j.createContext)(ew,{contentName:eu,titleName:eh,docsSlug:"dialog"}),eA=({titleId:e})=>{let t=eS(ew),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
2
 
3
3
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4
 
5
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},eC=({contentRef:e,descriptionId:t})=>{let r=eS("DialogDescriptionWarning"),a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return g.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},eI="AlertDialog",[eE,eD]=(0,j.createContextScope)(eI,[Y]),eT=Y(),eR=e=>{let{__scopeAlertDialog:t,...r}=e,s=eT(t);return(0,a.jsx)(et,{...s,...r,modal:!0})};eR.displayName=eI,g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(ea,{...n,...s,ref:t})}).displayName="AlertDialogTrigger";var eO=e=>{let{__scopeAlertDialog:t,...r}=e,s=eT(t);return(0,a.jsx)(el,{...s,...r})};eO.displayName="AlertDialogPortal";var eP=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(ei,{...n,...s,ref:t})});eP.displayName="AlertDialogOverlay";var eL="AlertDialogContent",[eM,eF]=eE(eL),e_=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,children:s,...n}=e,o=eT(r),l=g.useRef(null),d=(0,y.useComposedRefs)(t,l),i=g.useRef(null);return(0,a.jsx)(ek,{contentName:eL,titleName:eW,docsSlug:"alert-dialog",children:(0,a.jsx)(eM,{scope:r,cancelRef:i,children:(0,a.jsxs)(ep,{role:"alertdialog",...o,...n,ref:d,onOpenAutoFocus:(0,N.composeEventHandlers)(n.onOpenAutoFocus,e=>{e.preventDefault(),i.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,a.jsx)(A.Slottable,{children:s}),(0,a.jsx)(eV,{contentRef:l})]})})})});e_.displayName=eL;var eW="AlertDialogTitle",eB=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(eg,{...n,...s,ref:t})});eB.displayName=eW;var e$="AlertDialogDescription",eH=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(ev,{...n,...s,ref:t})});eH.displayName=e$;var eK=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(ey,{...n,...s,ref:t})});eK.displayName="AlertDialogAction";var ez="AlertDialogCancel",eG=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,{cancelRef:n}=eF(ez,r),o=eT(r),l=(0,y.useComposedRefs)(t,n);return(0,a.jsx)(ey,{...o,...s,ref:l})});eG.displayName=ez;var eV=({contentRef:e})=>{let t=`\`${eL}\` requires a description for the component to be accessible for screen reader users.
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},eI=({contentRef:e,descriptionId:t})=>{let r=eS("DialogDescriptionWarning"),a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return g.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},eC="AlertDialog",[eE,eD]=(0,j.createContextScope)(eC,[Q]),eT=Q(),eR=e=>{let{__scopeAlertDialog:t,...r}=e,s=eT(t);return(0,a.jsx)(et,{...s,...r,modal:!0})};eR.displayName=eC,g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(ea,{...n,...s,ref:t})}).displayName="AlertDialogTrigger";var eO=e=>{let{__scopeAlertDialog:t,...r}=e,s=eT(t);return(0,a.jsx)(el,{...s,...r})};eO.displayName="AlertDialogPortal";var eP=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(ei,{...n,...s,ref:t})});eP.displayName="AlertDialogOverlay";var eL="AlertDialogContent",[eM,eF]=eE(eL),e_=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,children:s,...n}=e,o=eT(r),l=g.useRef(null),d=(0,y.useComposedRefs)(t,l),i=g.useRef(null);return(0,a.jsx)(ek,{contentName:eL,titleName:eW,docsSlug:"alert-dialog",children:(0,a.jsx)(eM,{scope:r,cancelRef:i,children:(0,a.jsxs)(ep,{role:"alertdialog",...o,...n,ref:d,onOpenAutoFocus:(0,N.composeEventHandlers)(n.onOpenAutoFocus,e=>{e.preventDefault(),i.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,a.jsx)(A.Slottable,{children:s}),(0,a.jsx)(eV,{contentRef:l})]})})})});e_.displayName=eL;var eW="AlertDialogTitle",eB=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(eg,{...n,...s,ref:t})});eB.displayName=eW;var e$="AlertDialogDescription",eH=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(ev,{...n,...s,ref:t})});eH.displayName=e$;var eK=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,n=eT(r);return(0,a.jsx)(ey,{...n,...s,ref:t})});eK.displayName="AlertDialogAction";var ez="AlertDialogCancel",eG=g.forwardRef((e,t)=>{let{__scopeAlertDialog:r,...s}=e,{cancelRef:n}=eF(ez,r),o=eT(r),l=(0,y.useComposedRefs)(t,n);return(0,a.jsx)(ey,{...o,...s,ref:l})});eG.displayName=ez;var eV=({contentRef:e})=>{let t=`\`${eL}\` requires a description for the component to be accessible for screen reader users.
6
6
 
7
7
  You can add a description to the \`${eL}\` by passing a \`${e$}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
8
8
 
9
9
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${eL}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
10
10
 
11
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return g.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},eU=e.i(260218),eq=e.i(949245);function eJ({...e}){return(0,a.jsx)(eR,{"data-slot":"alert-dialog",...e})}function eZ({...e}){return(0,a.jsx)(eO,{"data-slot":"alert-dialog-portal",...e})}function eQ({className:e,...t}){return(0,a.jsx)(eP,{"data-slot":"alert-dialog-overlay",className:(0,eq.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",e),...t})}function eY({className:e,...t}){return(0,a.jsxs)(eZ,{children:[(0,a.jsx)(eQ,{}),(0,a.jsx)(e_,{"data-slot":"alert-dialog-content",className:(0,eq.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function eX({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,eq.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function e0({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,eq.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function e1({className:e,...t}){return(0,a.jsx)(eB,{"data-slot":"alert-dialog-title",className:(0,eq.cn)("text-lg font-semibold",e),...t})}function e2({className:e,...t}){return(0,a.jsx)(eH,{"data-slot":"alert-dialog-description",className:(0,eq.cn)("text-muted-foreground text-sm",e),...t})}function e5({className:e,...t}){return(0,a.jsx)(eK,{className:(0,eq.cn)((0,eU.buttonVariants)(),e),...t})}function e3({className:e,...t}){return(0,a.jsx)(eG,{className:(0,eq.cn)((0,eU.buttonVariants)({variant:"outline"}),e),...t})}var e4=e.i(524914);function e6({...e}){return(0,a.jsx)("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function e8({className:e,...t}){return(0,a.jsx)("ol",{"data-slot":"breadcrumb-list",className:(0,eq.cn)("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function e9({className:e,...t}){return(0,a.jsx)("li",{"data-slot":"breadcrumb-item",className:(0,eq.cn)("inline-flex items-center gap-1.5",e),...t})}function e7({asChild:e,className:t,...r}){let s=e?A.Slot:"a";return(0,a.jsx)(s,{"data-slot":"breadcrumb-link",className:(0,eq.cn)("hover:text-foreground transition-colors",t),...r})}function te({className:e,...t}){return(0,a.jsx)("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:(0,eq.cn)("text-foreground font-normal",e),...t})}function tt({children:e,className:t,...r}){return(0,a.jsx)("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:(0,eq.cn)("[&>svg]:size-3.5",t),...r,children:e??(0,a.jsx)(e4.ChevronRight,{})})}e.i(495566);var tr=e.i(889840),ta=e.i(638322),ts=e.i(620486);let tn="sleep";function to(e){return e.replace(/\/\/\.\.\//g,"//")}function tl(e){let t=e.split("//");return t.length>=3?t[t.length-1]:null}var td=e.i(479823),ti=e.i(241245);function tc({hasError:e,errorMessage:t}){return(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)(ta.Tooltip,{children:[(0,a.jsx)(ta.TooltipTrigger,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("div",{className:`w-2 h-2 rounded-full ${e?"bg-red-500":"bg-green-500 animate-pulse"}`}),(0,a.jsx)("span",{className:`text-xs $
11
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return g.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},eU=e.i(260218),eq=e.i(949245);function eJ({...e}){return(0,a.jsx)(eR,{"data-slot":"alert-dialog",...e})}function eZ({...e}){return(0,a.jsx)(eO,{"data-slot":"alert-dialog-portal",...e})}function eY({className:e,...t}){return(0,a.jsx)(eP,{"data-slot":"alert-dialog-overlay",className:(0,eq.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",e),...t})}function eQ({className:e,...t}){return(0,a.jsxs)(eZ,{children:[(0,a.jsx)(eY,{}),(0,a.jsx)(e_,{"data-slot":"alert-dialog-content",className:(0,eq.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function eX({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,eq.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function e0({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,eq.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function e1({className:e,...t}){return(0,a.jsx)(eB,{"data-slot":"alert-dialog-title",className:(0,eq.cn)("text-lg font-semibold",e),...t})}function e2({className:e,...t}){return(0,a.jsx)(eH,{"data-slot":"alert-dialog-description",className:(0,eq.cn)("text-muted-foreground text-sm",e),...t})}function e5({className:e,...t}){return(0,a.jsx)(eK,{className:(0,eq.cn)((0,eU.buttonVariants)(),e),...t})}function e3({className:e,...t}){return(0,a.jsx)(eG,{className:(0,eq.cn)((0,eU.buttonVariants)({variant:"outline"}),e),...t})}var e4=e.i(524914);function e6({...e}){return(0,a.jsx)("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function e8({className:e,...t}){return(0,a.jsx)("ol",{"data-slot":"breadcrumb-list",className:(0,eq.cn)("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function e9({className:e,...t}){return(0,a.jsx)("li",{"data-slot":"breadcrumb-item",className:(0,eq.cn)("inline-flex items-center gap-1.5",e),...t})}function e7({asChild:e,className:t,...r}){let s=e?A.Slot:"a";return(0,a.jsx)(s,{"data-slot":"breadcrumb-link",className:(0,eq.cn)("hover:text-foreground transition-colors",t),...r})}function te({className:e,...t}){return(0,a.jsx)("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:(0,eq.cn)("text-foreground font-normal",e),...t})}function tt({children:e,className:t,...r}){return(0,a.jsx)("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:(0,eq.cn)("[&>svg]:size-3.5",t),...r,children:e??(0,a.jsx)(e4.ChevronRight,{})})}e.i(495566);var tr=e.i(889840),ta=e.i(638322),ts=e.i(620486);let tn="sleep";function to(e){return e.replace(/\/\/\.\.\//g,"//")}function tl(e){let t=e.split("//");return t.length>=3?t[t.length-1]:null}var td=e.i(479823),ti=e.i(714594),tc=e.i(241245);function tu({hasError:e,errorMessage:t}){return(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)(ta.Tooltip,{children:[(0,a.jsx)(ta.TooltipTrigger,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("div",{className:`w-2 h-2 rounded-full ${e?"bg-red-500":"bg-green-500 animate-pulse"}`}),(0,a.jsx)("span",{className:`text-xs $
12
12
  hasError
13
13
  ? 'text-red-600 dark:text-red-400'
14
- : 'text-muted-foreground'`,children:e?"Error":"Live"})]})}),(0,a.jsx)(ta.TooltipContent,{children:(0,a.jsx)("p",{children:e?`Error updating data: ${t}`:`Content updates every ${eq.LIVE_UPDATE_INTERVAL_MS/1e3} seconds`})})]})})}var tu=e.i(719402),tp=e.i(451675),tm=e.i(330974),tf=e.i(280998),tx=e.i(259280),th=e.i(356089),tg=e.i(562918),tb=e.i(93698);function tv(e){return"retrying"===e?"running":e}let tj={loopNode:function({data:e,selected:t}){return(0,a.jsxs)("div",{className:`relative ${e.className||""}`,style:{borderWidth:e.nodeStyle?.borderWidth??2,borderRadius:8,padding:12,width:220,borderStyle:"solid",backgroundColor:e.nodeStyle?.backgroundColor,borderColor:e.nodeStyle?.borderColor??"#9ca3af",opacity:e.nodeStyle?.opacity,boxShadow:t?"0 0 0 2px rgba(168, 85, 247, 0.5)":void 0},children:[e.label,(0,a.jsx)(tm.Handle,{type:"target",position:tf.Position.Top,className:"!bg-purple-500"}),(0,a.jsx)(tm.Handle,{type:"source",position:tf.Position.Bottom,className:"!bg-purple-500"}),(0,a.jsx)(tm.Handle,{type:"source",position:tf.Position.Left,id:"loop-out",className:"!bg-purple-500 !-left-1 !w-[6px] !h-[6px] !min-w-0 !min-h-0",style:{top:"30%"}}),(0,a.jsx)(tm.Handle,{type:"target",position:tf.Position.Left,id:"loop-in",className:"!bg-purple-500 !-left-1 !w-[6px] !h-[6px] !min-w-0 !min-h-0",style:{top:"70%"}})]})},parallelGroup:tb.ParallelGroupComponent,executionNode:function({data:e,selected:t}){let r="workflow_start"===e.nodeKind,s="workflow_end"===e.nodeKind;return(0,a.jsxs)("div",{className:`relative ${e.className||""}`,style:{borderWidth:e.nodeStyle?.borderWidth??2,borderRadius:8,padding:12,width:220,borderStyle:"solid",backgroundColor:e.nodeStyle?.backgroundColor,borderColor:e.nodeStyle?.borderColor??"#9ca3af",opacity:e.nodeStyle?.opacity,boxShadow:t?"0 0 0 2px rgba(59, 130, 246, 0.35)":void 0},children:[e.label,!r&&(0,a.jsx)(tm.Handle,{type:"target",position:tf.Position.Top,className:"!bg-muted"}),!s&&(0,a.jsx)(tm.Handle,{type:"source",position:tf.Position.Bottom,className:"!bg-muted"})]})},diamondNode:function({data:e,selected:t}){return(0,a.jsxs)("div",{className:`relative flex items-center justify-center ${e.className||""}`,style:{width:160,height:160},children:[(0,a.jsx)("div",{style:{width:112,height:112,transform:"rotate(45deg)",borderWidth:2,borderStyle:"solid",borderRadius:4,backgroundColor:e.nodeStyle?.backgroundColor,borderColor:e.nodeStyle?.borderColor??"#ef4444",opacity:e.nodeStyle?.opacity,boxShadow:t?"0 0 0 2px rgba(239, 68, 68, 0.5)":void 0}}),(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-auto",style:{fontSize:11,fontWeight:600,padding:40},title:"string"==typeof e.label?e.label:void 0,children:(0,a.jsx)("span",{className:"text-center line-clamp-3 overflow-hidden",children:e.label})}),(0,a.jsx)(tm.Handle,{type:"target",position:tf.Position.Top,className:"!bg-red-500"}),(0,a.jsx)(tm.Handle,{type:"source",position:tf.Position.Bottom,id:"bottom",className:"!bg-red-500"}),(0,a.jsx)(tm.Handle,{type:"source",position:tf.Position.Left,id:"left",className:"!bg-red-500"}),(0,a.jsx)(tm.Handle,{type:"source",position:tf.Position.Right,id:"right",className:"!bg-red-500"})]})}},ty=(0,tb.createEdgeTypes)(tb.executionSelfLoopStyle);function tN(e,t,r){let s=(0,a.jsxs)("div",{className:"flex items-start gap-2 w-full overflow-hidden",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,tb.getNodeIcon)(e.nodeKind,e.label)}),(0,a.jsx)("span",{className:"text-sm font-medium break-words whitespace-normal leading-tight flex-1 min-w-0",children:e.label})]});if(!r||0===r.length)return s;let n=r[r.length-1],o=r.length,l=o>1;return l||n.duration&&n.duration>0?(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 w-full",children:[s,(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 text-xs",children:[l&&(0,a.jsxs)(tg.Badge,{variant:"outline",className:"text-xs px-1.5 py-0 border-orange-500 text-orange-700 dark:text-orange-300",children:["↻ ",o,"x"]}),n.duration&&n.duration>0&&(0,a.jsxs)(tg.Badge,{variant:"secondary",className:"text-xs px-1.5 py-0 bg-black/10 dark:bg-white/15 border-0",children:["⏱ ",(0,th.formatDuration)(n.duration,!0)]})]})]}):s}let tw={...tb.LAYOUT,VERTICAL_SPACING:320};function tk(e,t){let{nodes:r,groupNodes:a}=(0,tb.calculateEnhancedLayout)(e,tw),s=new Map,n=new Map;for(let e of a)e.id.startsWith("group_")&&n.set(e.id,e.position);for(let e of r){let t=e.metadata?.parallelGroupId?`group_${e.metadata.parallelGroupId}`:null;t&&n.has(t)&&s.set(e.id,t)}let o=[];for(let e of a.filter(e=>e.id.startsWith("group_")))o.push({id:e.id,type:"parallelGroup",position:e.position,style:{...e.style,cursor:"grab",zIndex:-1},data:e.data,selectable:!0,draggable:!0});for(let e of r){let r=t?.nodeExecutions.get(e.id),a=function(e,t){let r=(0,tb.getNodeBackgroundColor)(e);if(!t||0===t.length)return{color:"hsl(var(--card-foreground))",backgroundColor:r,borderColor:"#9ca3af",opacity:.4};let a=t[t.length-1],s="#9ca3af",n=2;switch(a.status){case"completed":s="#22c55e";break;case"failed":s="#ef4444",n=3;break;case"running":s="#3b82f6",n=2;break;case"retrying":s="#f97316";break;case"cancelled":s="#eab308";break;case"pending":s="#9ca3af"}return{color:"hsl(var(--card-foreground))",backgroundColor:r,borderColor:s,borderWidth:n}}(e.data.nodeKind,r),l=t?.currentNode===e.id,d=!!e.metadata?.loopId,i=!!e.metadata?.loopIsAwait,c="conditional"===e.data.nodeKind,u=c?"diamondNode":d?"loopNode":"executionNode",p=s.get(e.id),m=e.position;if(p){let t=n.get(p);t&&(m={x:e.position.x-t.x,y:e.position.y-t.y})}let f=l?"animate-pulse-subtle":"";d?o.push({id:e.id,type:u,position:m,parentId:p,extent:p?"parent":void 0,expandParent:!0,data:{...e.data,label:tN(e.data,e.metadata,r),executions:r,isLoopNode:!0,isAwaitLoop:i,nodeStyle:a,className:f}}):c?o.push({id:e.id,type:u,position:m,parentId:p,extent:p?"parent":void 0,expandParent:!0,data:{...e.data,label:e.data.label,executions:r,nodeStyle:a,className:f}}):o.push({id:e.id,type:u,position:m,parentId:p,extent:p?"parent":void 0,expandParent:!0,data:{...e.data,label:tN(e.data,e.metadata,r),executions:r,nodeStyle:a,className:f},style:{width:220}})}return o}function tS(e,t){let{additionalEdges:r}=(0,tb.calculateEnhancedLayout)(e,tw),s=[...e.edges.map(e=>"loop"===e.type?{...e,id:`loop_back_${e.source}_${e.target}`,isOriginal:!0}:{...e,isOriginal:!0}),...r.map(e=>({...e,isOriginal:!1}))];return(0,tb.consolidateEdges)(s,e.nodes).map(e=>{let r;if("selfLoop"===e.type)return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,type:"selfLoop",label:e.label,markerEnd:{type:tf.MarkerType.ArrowClosed,width:12,height:12,color:"#a855f7"}};let s=t?.edgeTraversals.get(e.id);if(!s&&e.isConsolidated&&e.originalEdgeIds)for(let r of e.originalEdgeIds){let e=t?.edgeTraversals.get(r);if(e&&e.traversalCount>0){s=e;break}}let n=s&&s.traversalCount>0,o=!!t,l=s?.timings.length?s.timings.reduce((e,t)=>e+t,0)/s.timings.length:void 0,d="bezier",i=e.label,c=!1;switch(e.type){case"parallel":d="smoothstep",r="4,4",i=void 0;break;case"loop":d="step",r="8,4";break;case"conditional":d="smoothstep",r="8,4",c=!0;break;default:d="bezier"}let u=n?"#22c55e":"#6b7280",p=n?void 0:r,m=c?"#ffffff":"#6b7280",f=c?"#374151":"#f3f4f6",x=c?"#4b5563":"#d1d5db";return{id:e.id,source:e.source,target:e.target,type:d,animated:n&&t?.status==="running",label:s&&s.traversalCount>1?(0,a.jsxs)("div",{className:"flex flex-col items-center gap-0.5",children:[(0,a.jsxs)(tg.Badge,{variant:"secondary",className:"text-xs px-1.5 py-0",children:[s.traversalCount,"×"]}),l&&l>0&&(0,a.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["~",(0,th.formatDuration)(l,!0)]})]}):i,labelStyle:{fill:m,fontWeight:500,fontSize:"11px"},labelBgStyle:{fill:f,fillOpacity:.95,stroke:x,strokeWidth:1},labelBgPadding:[4,6],labelBgBorderRadius:4,markerEnd:{type:tf.MarkerType.ArrowClosed,width:n?14:10,height:n?14:10,color:u},style:{strokeWidth:n?2.5:1,stroke:u,opacity:o&&!n?.35:1,strokeDasharray:p}}})}function tA({selectedNode:e,env:t,onClose:r}){let{node:s,executions:n,stepId:o,runId:d}=e,i=n[n.length-1],c=n.length>1,{data:u,loading:p}=(0,l.useWorkflowResourceData)(t??{},"step",o??"",{runId:d}),m=u?.input??i?.input,f=u?.output??i?.output,h=u?.error??i?.error;return(0,a.jsxs)("div",{className:"h-full flex flex-col bg-background border-l",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b flex-none",children:[(0,a.jsx)("span",{className:"text-xs font-medium truncate flex-1",title:s.data.label,children:s.data.label}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-none",children:[i?.duration!==void 0&&i.duration>0&&(0,a.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:(0,th.formatDuration)(i.duration)}),(0,a.jsx)("div",{className:"w-px h-4 bg-border"}),(0,a.jsx)("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-muted transition-colors","aria-label":"Close panel",children:(0,a.jsx)(tx.X,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-3 min-h-0",children:[(0,a.jsxs)("div",{className:"flex flex-col divide-y rounded-lg border overflow-hidden mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"type"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:s.data.nodeKind})]}),i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"status"}),(0,a.jsx)(tp.StatusBadge,{status:tv(i.status)})]}),void 0!==i.duration&&i.duration>0&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"duration"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:(0,th.formatDuration)(i.duration)})]}),c&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"attempts"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:n.length})]}),i.startedAt&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"startedAt"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:new Date(i.startedAt).toLocaleString()})]}),i.completedAt&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"completedAt"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:new Date(i.completedAt).toLocaleString()})]})]})]}),p&&o&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-3",children:[(0,a.jsx)(x.Loader2,{className:"h-3 w-3 animate-spin"}),(0,a.jsx)("span",{children:"Loading step data..."})]}),void 0!==m&&(0,a.jsxs)("details",{className:"group mb-3",children:[(0,a.jsxs)("summary",{className:"cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 bg-muted/50",children:[(0,a.jsx)("span",{className:"font-medium",children:"Input"}),(0,a.jsxs)("span",{className:"text-muted-foreground ml-1",children:["(",Array.isArray(m)?m.length:1," args)"]})]}),(0,a.jsxs)("div",{className:"relative pl-6 mt-3",children:[(0,a.jsx)("div",{className:"absolute left-3 -top-3 w-px h-3 bg-border"}),(0,a.jsx)("div",{className:"absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg border-border"}),(0,a.jsx)("pre",{className:"text-[11px] overflow-x-auto rounded-md border p-2.5 bg-muted/30 max-h-64 overflow-y-auto",children:(0,a.jsx)("code",{children:JSON.stringify(m,null,2)})})]})]}),void 0!==f&&(0,a.jsxs)("details",{className:"group mb-3",children:[(0,a.jsx)("summary",{className:"cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 bg-muted/50",children:(0,a.jsx)("span",{className:"font-medium",children:"Output"})}),(0,a.jsxs)("div",{className:"relative pl-6 mt-3",children:[(0,a.jsx)("div",{className:"absolute left-3 -top-3 w-px h-3 bg-border"}),(0,a.jsx)("div",{className:"absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg border-border"}),(0,a.jsx)("pre",{className:"text-[11px] overflow-x-auto rounded-md border p-2.5 bg-muted/30 max-h-64 overflow-y-auto",children:(0,a.jsx)("code",{children:JSON.stringify(f,null,2)})})]})]}),h&&(0,a.jsxs)("details",{className:"group mb-3",open:!0,children:[(0,a.jsx)("summary",{className:"cursor-pointer rounded-md border border-red-300 bg-red-50 dark:bg-red-950/20 px-2.5 py-1.5 text-xs hover:brightness-95",children:(0,a.jsx)("span",{className:"font-medium text-red-600 dark:text-red-400",children:"Error"})}),(0,a.jsxs)("div",{className:"relative pl-6 mt-3",children:[(0,a.jsx)("div",{className:"absolute left-3 -top-3 w-px h-3 bg-red-300"}),(0,a.jsx)("div",{className:"absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg border-red-300"}),(0,a.jsx)("pre",{className:"text-[11px] overflow-x-auto rounded-md border border-red-200 p-2.5 bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-300 whitespace-pre-wrap max-h-64 overflow-y-auto",children:(0,a.jsx)("code",{children:"object"==typeof h?JSON.stringify(h,null,2):String(h)})})]})]}),c&&(0,a.jsxs)("details",{className:"group",children:[(0,a.jsxs)("summary",{className:"cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 bg-muted/50",children:[(0,a.jsx)("span",{className:"font-medium",children:"Attempt History"}),(0,a.jsxs)("span",{className:"text-muted-foreground ml-1",children:["(",n.length," attempts)"]})]}),(0,a.jsxs)("div",{className:"relative pl-6 mt-3",children:[(0,a.jsx)("div",{className:"absolute left-3 -top-3 w-px h-3 bg-border"}),(0,a.jsx)("div",{className:"absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg border-border"}),(0,a.jsx)("div",{className:"flex flex-col divide-y rounded-md border overflow-hidden",children:n.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 text-[11px]",children:[(0,a.jsxs)("span",{className:"text-muted-foreground",children:["Attempt ",e.attemptNumber]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(tp.StatusBadge,{status:tv(e.status)}),void 0!==e.duration&&e.duration>0&&(0,a.jsx)("span",{className:"font-mono text-muted-foreground",children:(0,th.formatDuration)(e.duration)})]})]},e.attemptNumber))})]})]})]})]})}function tC({workflow:e,execution:t,env:r,onNodeClick:s}){let[n,o]=(0,g.useState)(null),l=(0,g.useMemo)(()=>tk(e,t),[e,t]),d=(0,g.useMemo)(()=>tS(e,t),[e,t]),[i,c,u]=(0,tm.useNodesState)(l),[p,m,f]=(0,tm.useEdgesState)(d);(0,g.useEffect)(()=>{c(r=>{let a=tk(e,t),s=new Map(r.map(e=>[e.id,e.position]));return a.map(e=>({...e,position:s.get(e.id)??e.position}))}),m(tS(e,t))},[e,t,c,m]);let x=(0,g.useCallback)((r,a)=>{let n=e.nodes.find(e=>e.id===a.id);if(n){let e=a.data.executions||[],r=e[e.length-1];o({nodeId:a.id,node:n,executions:e,stepId:r?.stepId,runId:t?.runId}),s&&e.length>0&&s(a.id,e)}},[e.nodes,t?.runId,s]),h=(0,g.useCallback)(()=>{o(null)},[]);return(0,a.jsxs)("div",{className:"h-full w-full border rounded-lg bg-background relative overflow-hidden flex",children:[(0,a.jsx)("div",{className:"h-full flex-1 min-w-0",style:{width:n?"calc(100% - 320px)":"100%"},children:(0,a.jsxs)(tm.ReactFlow,{nodes:i,edges:p,onNodesChange:u,onEdgesChange:f,onNodeClick:x,nodeTypes:tj,edgeTypes:ty,fitView:!0,minZoom:.1,maxZoom:2,defaultViewport:{x:0,y:0,zoom:1},proOptions:{hideAttribution:!0},children:[(0,a.jsx)(tm.Background,{}),(0,a.jsx)(tm.Controls,{}),(0,a.jsx)(tm.Panel,{position:"top-left",className:"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border rounded-lg p-2 text-xs",children:(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("div",{className:"font-semibold text-[10px] text-muted-foreground mb-1",children:"Status"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-green-500 bg-background"}),(0,a.jsx)("span",{children:"Completed"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-red-500 bg-background"}),(0,a.jsx)("span",{children:"Failed"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-blue-500 bg-background"}),(0,a.jsx)("span",{children:"Running"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-yellow-500 bg-background"}),(0,a.jsx)("span",{children:"Cancelled"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 opacity-50",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-gray-400 bg-background"}),(0,a.jsx)("span",{children:"Pending"})]})]})}),t&&(0,a.jsxs)(tm.Panel,{position:"top-right",className:"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border rounded-lg p-3 text-xs space-y-1.5",children:[(0,a.jsx)("div",{className:"font-semibold text-sm",children:"Execution"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:"Status:"}),(0,a.jsx)(tg.Badge,{variant:"completed"===t.status?"default":"failed"===t.status?"destructive":"cancelled"===t.status?"outline":"secondary",className:"text-xs",children:t.status})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:"Progress:"}),(0,a.jsxs)("span",{className:"font-mono",children:[t.executionPath.length," / ",e.nodes.length]})]})]})]})}),n&&(0,a.jsx)("div",{className:"h-full flex-none",style:{width:320},children:(0,a.jsx)(tA,{selectedNode:n,env:r,onClose:h})})]})}var tI=e.i(708341),tE=e.i(613087);function tD({config:e,run:t,allSteps:r,allEvents:s,env:n}){let{manifest:o,loading:l,error:d}=(0,td.useWorkflowGraphManifest)(e),i=(0,g.useMemo)(()=>o&&t.workflowName?o.workflows[t.workflowName]??null:null,[o,t.workflowName]),u=(0,g.useMemo)(()=>i&&t.runId?function(e,t,r,a){let s,n,o=new Map,l=[];console.log("[Graph Mapper] Mapping run to execution:",{runId:e.runId,workflowName:e.workflowName,graphNodes:a.nodes.length,stepsCount:t.length}),(n=a.nodes.find(e=>"workflow_start"===e.data.nodeKind))&&(l.push(n.id),o.set(n.id,[{nodeId:n.id,attemptNumber:1,status:"completed",startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0}]));let d=[...t].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime());console.log("[Graph Mapper] Sorted steps:",d.map(e=>({stepId:e.stepId,stepName:e.stepName,attempt:e.attempt,status:e.status,createdAt:e.createdAt})));let{byStepId:i,byFunctionName:c,primitivesByLabel:u,agentNodes:p,toolNodes:m}=function(e){let t=new Map,r=new Map,a=new Map,s=[],n=new Map;for(let o of e){if(o.data.stepId){let e=to(o.data.stepId),a=t.get(e)||[];a.push(o),t.set(e,a);let s=tl(e);if(s){let e=r.get(s)||[];e.push(o),r.set(s,e)}}if("primitive"===o.data.nodeKind){let e=o.data.label,t=a.get(e)||[];t.push(o),a.set(e,t)}if("agent"===o.data.nodeKind&&s.push(o),"tool"===o.data.nodeKind){let e=o.data.label.replace(/ \(tool\)$/,""),t=n.get(e)||[];if(t.push(o),n.set(e,t),o.data.stepId){let e=tl(to(o.data.stepId));if(e){let t=n.get(e)||[];t.includes(o)||(t.push(o),n.set(e,t))}}}}return{byStepId:t,byFunctionName:r,primitivesByLabel:a,agentNodes:s,toolNodes:n}}(a.nodes);console.log("[Graph Mapper] Graph nodes by stepId:",{allGraphNodes:a.nodes.map(e=>({id:e.id,stepId:e.data.stepId,normalizedStepId:e.data.stepId?to(e.data.stepId):void 0,nodeKind:e.data.nodeKind})),nodesByStepId:Array.from(i.entries()).map(([e,t])=>({stepId:e,nodeIds:t.map(e=>e.id)}))});let f=new Map,x=[],h=null,g=null;for(let e=0;e<=d.length;e++){let t=d[e];if(t&&t.stepId===h)x.push(t);else{if(x.length>0&&g){let e=function(e,t,r,a,s,n,o){let l=to(t),d=s.get(l)||0;s.set(l,d+1);let i=r.get(l)||[],c="step-id";if(0===i.length){let e=tl(l);e&&(i=a.get(e)||[],c="function-name")}let u=1===i.length?i[0]:i[d];if(console.log("[Graph Mapper] Processing step group:",{stepName:t,normalizedStepName:l,attempts:e.length,occurrenceIndex:d,totalNodesWithStepId:i.length,selectedNode:u?.id,allNodesWithStepId:i.map(e=>e.id),matchStrategy:c,strategy:1===i.length?"single-node-multiple-invocations":"occurrence-based"}),!u)return;let p=e.map((t,r)=>(function(e,t,r,a){let s;switch(e.status){case"completed":s="completed";break;case"failed":s=r<a-1?"retrying":"failed";break;case"running":s="running";break;case"cancelled":s="cancelled";break;default:s="pending"}let n=e.completedAt&&e.startedAt?new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime():void 0;return{nodeId:t,stepId:e.stepId,attemptNumber:e.attempt,status:s,startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.completedAt?new Date(e.completedAt).toISOString():void 0,duration:n,input:e.input,output:e.output,error:e.error?{message:e.error.message,stack:e.error.stack||""}:void 0}})(t,u.id,r,e.length));if(1===i.length){let e=n.get(u.id)||[];n.set(u.id,[...e,...p])}else n.set(u.id,p);return o.includes(u.id)||o.push(u.id),"running"===p[p.length-1].status?u.id:void 0}(x,g,i,c,f,o,l);e&&(s=e)}t&&(x=[t],h=t.stepId,g=t.stepName)}}let b=function(e,t,r,a){let s,n=new Map,o=new Map;for(let t of e){if(!t.correlationId)continue;let e=o.get(t.correlationId)||[];e.push(t),o.set(t.correlationId,e)}let l=t.get(tn)||[],d=new Set;for(let t of e)"wait_created"===t.eventType&&t.correlationId&&d.add(t.correlationId);for(let e of Array.from(d).sort((e,t)=>{let r=o.get(e)||[],a=o.get(t)||[],s=r.find(e=>"wait_created"===e.eventType)?.createdAt,n=a.find(e=>"wait_created"===e.eventType)?.createdAt;return s&&n?new Date(s).getTime()-new Date(n).getTime():0})){let t=o.get(e)||[],d=t.find(e=>"wait_created"===e.eventType),i=t.find(e=>"wait_completed"===e.eventType);if(!d)continue;let c=n.get(tn)||0;n.set(tn,c+1);let u=1===l.length?l[0]:l[c];if(!u)continue;let p="running";i&&(p="completed");let m=new Date(d.createdAt).toISOString(),f=i?new Date(i.createdAt).toISOString():void 0,x=i?new Date(i.createdAt).getTime()-new Date(d.createdAt).getTime():void 0,h={nodeId:u.id,attemptNumber:1,status:p,startedAt:m,completedAt:f,duration:x},g=r.get(u.id)||[];r.set(u.id,[...g,h]),a.includes(u.id)||a.push(u.id),"running"===p&&(s=u.id)}let i=[...t.get("createHook")||[],...t.get("createWebhook")||[]],c=new Set;for(let t of e)"hook_created"===t.eventType&&t.correlationId&&c.add(t.correlationId);let u=Array.from(c).sort((e,t)=>{let r=o.get(e)||[],a=o.get(t)||[],s=r.find(e=>"hook_created"===e.eventType)?.createdAt,n=a.find(e=>"hook_created"===e.eventType)?.createdAt;return s&&n?new Date(s).getTime()-new Date(n).getTime():0}),p=0;for(let e of u){let t=(o.get(e)||[]).find(e=>"hook_created"===e.eventType);if(!t)continue;let s=1===i.length?i[0]:i[p];if(p++,!s)continue;let n=new Date(t.createdAt).toISOString(),l=new Date(t.createdAt).toISOString(),d={nodeId:s.id,attemptNumber:1,status:"completed",startedAt:n,completedAt:l,duration:0},c=r.get(s.id)||[];r.set(s.id,[...c,d]),a.includes(s.id)||a.push(s.id)}let m=t.get("awaitWebhook")||[],f=new Set;for(let t of e)"hook_received"===t.eventType&&t.correlationId&&f.add(t.correlationId);let x=0;for(let e of u){let t,s,n,l=1===m.length?m[0]:m[x];if(x++,!l)continue;let d=o.get(e)||[],i=d.find(e=>"hook_created"===e.eventType),c=d.find(e=>"hook_received"===e.eventType),u=0;c?(t="completed",s=i?new Date(i.createdAt).toISOString():new Date(c.createdAt).toISOString(),u=new Date(n=new Date(c.createdAt).toISOString()).getTime()-new Date(s).getTime()):i?(t="running",s=new Date(i.createdAt).toISOString()):t="pending";let p={nodeId:l.id,attemptNumber:1,status:t,startedAt:s,completedAt:n,duration:u},f=r.get(l.id)||[];r.set(l.id,[...f,p]),a.includes(l.id)||a.push(l.id)}return s}(r,u,o,l);b&&(s=b),function(e,t,r,a,s,n,o){let l="pending";for(let t of("completed"===e.status?l="completed":"failed"===e.status?l="failed":"running"===e.status&&(l="running"),r)){let r={nodeId:t.id,attemptNumber:1,status:l,startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.completedAt&&("completed"===l||"failed"===l)?new Date(e.completedAt).toISOString():void 0};s.set(t.id,[r]),n.includes(t.id)||n.push(t.id)}for(let e of t){let t,r=tl(e.stepName);if(!r)continue;let o=a.get(r);if(!o||0===o.length)continue;let l=o[0];switch(e.status){case"completed":t="completed";break;case"failed":t="failed";break;case"running":t="running";break;case"cancelled":t="cancelled";break;default:t="pending"}let d=e.completedAt&&e.startedAt?new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime():void 0,i={nodeId:l.id,stepId:e.stepId,attemptNumber:e.attempt,status:t,startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.completedAt?new Date(e.completedAt).toISOString():void 0,duration:d,input:e.input,output:e.output,error:e.error},c=s.get(l.id)||[];s.set(l.id,[...c,i]),n.includes(l.id)||n.push(l.id)}for(let t of o){let r=t.metadata?.isToolsCollection===!0;if("tool"===t.data.nodeKind&&r&&!s.has(t.id)){let r={nodeId:t.id,attemptNumber:1,status:l,startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.completedAt&&("completed"===l||"failed"===l)?new Date(e.completedAt).toISOString():void 0};s.set(t.id,[r]),n.includes(t.id)||n.push(t.id)}}}(e,d,p,m,o,l,a.nodes),function(e,t,r,a){let s=e.nodes.filter(e=>"conditional"===e.data.nodeKind),n=new Map;for(let t of e.nodes){let e=t.metadata?.conditionalId;if(e){let r=n.get(e)||{thenNodes:[],elseNodes:[]};t.metadata?.conditionalBranch==="Then"?r.thenNodes.push(t):t.metadata?.conditionalBranch==="Else"&&r.elseNodes.push(t),n.set(e,r)}}for(let e of s){let s=e.id.match(/^(cond_\d+)_node$/);if(!s)continue;let o=s[1],l=n.get(o);if(!l)continue;let d=l.thenNodes.some(e=>t.has(e.id)),i=l.elseNodes.some(e=>t.has(e.id));if(d||i){let s=[...l.thenNodes,...l.elseNodes];if(!t.has(e.id)){let r;for(let e of s){let a=t.get(e.id);if(a&&a.length>0){let e=a[0];e.startedAt&&(!r||e.startedAt<r)&&(r=e.startedAt)}}let n=a.startedAt?new Date(a.startedAt).toISOString():void 0,o={nodeId:e.id,attemptNumber:1,status:"completed",startedAt:r||n,completedAt:r||n};t.set(e.id,[o])}if(!r.includes(e.id)){let t=s.map(e=>r.indexOf(e.id)).filter(e=>e>=0);if(t.length>0){let a=Math.min(...t);a>=0&&a<r.length?r.splice(a,0,e.id):r.push(e.id)}else r.push(e.id)}}}}(a,o,l,e),function(e,t,r,a){let s,n=t.nodes.find(e=>"workflow_end"===e.data.nodeKind);if(!(!n||r.includes(n.id))){switch(e.status){case"completed":s="completed";break;case"failed":s="failed";break;case"cancelled":s="cancelled";break;case"running":s="running";break;default:return}r.push(n.id),a.set(n.id,[{nodeId:n.id,attemptNumber:1,status:s,startedAt:e.completedAt?new Date(e.completedAt).toISOString():void 0,completedAt:e.completedAt?new Date(e.completedAt).toISOString():void 0}])}}(e,a,l,o);let v=function(e,t,r){let a=new Map,s=new Set(e),n=new Map;for(let e of t.nodes){let t=e.metadata?.parallelGroupId;if(t){let r=n.get(t)||{nodes:[]};r.nodes.push(e),r.method=e.metadata?.parallelMethod,n.set(t,r)}}let o=new Map;for(let[e,t]of n)if("race"===t.method){let a,s;for(let e of t.nodes){let t=r.get(e.id);if(t){for(let r of t)if("completed"===r.status&&r.completedAt){let t=new Date(r.completedAt);(!s||t<s)&&(s=t,a=e.id)}}}a&&o.set(e,a)}let l=e=>{let t=a.get(e.id);t?t.traversalCount++:a.set(e.id,{edgeId:e.id,traversalCount:1,timings:[]})};for(let e of t.edges){let r=t.nodes.find(t=>t.id===e.source),a=t.nodes.find(t=>t.id===e.target);if(!r||!a)continue;let n=s.has(e.source),d=s.has(e.target);if(!n&&!d)continue;if("conditional"===e.type){n&&d&&l(e);continue}let i=r.metadata?.parallelGroupId,c=r.metadata?.parallelMethod;i&&"race"===c?o.get(i)===e.source&&d&&l(e):n&&d?l(e):n&&"parallel"===e.type&&d&&l(e)}return a}(l,a,o),j={runId:e.runId,status:e.status,nodeExecutions:o,edgeTraversals:v,currentNode:s,executionPath:l};return console.log("[Graph Mapper] Mapping complete:",{executionPath:l,nodeExecutionsCount:o.size,nodeExecutions:Array.from(o.entries()).map(([e,t])=>({nodeId:e,executionCount:t.length,latestStatus:t[t.length-1]?.status}))}),j}(t,r||[],s||[],i):null,[i,t,r,s]);return l?(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(x.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"ml-4 text-muted-foreground",children:"Loading workflow graph..."})]}):d?(0,a.jsx)("div",{className:"flex items-center justify-center w-full h-full p-4",children:(0,a.jsxs)(v.Alert,{variant:"destructive",className:"max-w-lg",children:[(0,a.jsx)(c.AlertCircle,{className:"h-4 w-4"}),(0,a.jsx)(v.AlertTitle,{children:"Error Loading Workflow Graph"}),(0,a.jsx)(v.AlertDescription,{children:d.message})]})}):i?(0,a.jsx)(tC,{workflow:i,execution:u||void 0,env:n}):(0,a.jsx)("div",{className:"flex items-center justify-center w-full h-full",children:(0,a.jsxs)(v.Alert,{className:"max-w-lg",children:[(0,a.jsx)(c.AlertCircle,{className:"h-4 w-4"}),(0,a.jsx)(v.AlertTitle,{children:"Workflow Graph Not Found"}),(0,a.jsx)(v.AlertDescription,{children:"Could not find the workflow graph for this run. The workflow may have been deleted or the graph manifest may need to be regenerated."})]})})}function tT({config:e,runId:t,selectedId:r}){let p=(0,n.useRouter)(),j=(0,n.useSearchParams)(),[y,N]=(0,g.useState)(!1),[w,k]=(0,g.useState)(!1),[S,A]=(0,g.useState)(!1),[C,I]=(0,g.useState)(!1),E=(0,g.useMemo)(()=>(0,ts.worldConfigToEnvMap)(e),[e]),D=j.get("tab")||"trace",T=j.get("streamId"),R="1"===j.get("debug"),O=(0,g.useCallback)(e=>{let t=new URLSearchParams(j.toString());for(let[r,a]of Object.entries(e))null===a?t.delete(r):t.set(r,a);p.push(`?${t.toString()}`,{scroll:!1})},[p,j]),P=(0,g.useCallback)(e=>{"trace"===e||"graph"===e?O({tab:e,streamId:null}):O({tab:e})},[O]),L=(0,g.useCallback)(e=>{O({streamId:e})},[O]),M=(0,g.useCallback)(e=>{O({tab:"streams",streamId:e})},[O]),F="local"===e.backend,{run:_,steps:W,hooks:B,events:$,loading:H,auxiliaryDataLoading:K,error:z,update:G}=(0,l.useWorkflowTraceViewerData)(E,t,{live:!0}),V=_??{},{streams:U,loading:q,error:J}=(0,l.useWorkflowStreams)(E,t),Z=async()=>{if(!y)try{N(!0),A(!1),await (0,l.cancelRun)(E,t),await G(),b.toast.success("Run cancelled successfully")}catch(e){console.error("Failed to cancel run:",e),b.toast.error("Failed to cancel run",{description:e instanceof Error?e.message:"An unknown error occurred"})}finally{N(!1)}},Q=async()=>{if(!w)try{k(!0),I(!1);let t=await (0,l.recreateRun)(E,V.runId);b.toast.success("New run started successfully",{description:`Run ID: ${t}`}),p.push((0,ts.buildUrlWithConfig)(`/run/${t}`,e))}catch(e){console.error("Failed to re-run workflow:",e),b.toast.error("Failed to start new run",{description:e instanceof Error?e.message:"An unknown error occurred"})}finally{k(!1),I(!1)}};if(z&&!_)return(0,a.jsxs)(v.Alert,{variant:"destructive",className:"m-4",children:[(0,a.jsx)(c.AlertCircle,{className:"h-4 w-4"}),(0,a.jsx)(v.AlertTitle,{children:"Error loading workflow run"}),(0,a.jsx)(v.AlertDescription,{children:z.message})]});let Y=(0,o.parseWorkflowName)(V.workflowName)?.shortName;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eJ,{open:S,onOpenChange:A,children:(0,a.jsxs)(eY,{children:[(0,a.jsxs)(eX,{children:[(0,a.jsx)(e1,{children:"Cancel Workflow Run?"}),(0,a.jsx)(e2,{children:"This will stop the workflow execution immediately, and no further steps will be executed. Partial workflow execution may occur. Are you sure you want to cancel the run?"})]}),(0,a.jsxs)(e0,{children:[(0,a.jsx)(e3,{children:"Keep Running"}),(0,a.jsx)(e5,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Run"})]})]})}),(0,a.jsx)(eJ,{open:C,onOpenChange:I,children:(0,a.jsxs)(eY,{children:[(0,a.jsxs)(eX,{children:[(0,a.jsx)(e1,{children:"Replay Run?"}),(0,a.jsx)(e2,{children:"This can potentially re-run code that is meant to only execute once. Are you sure you want to replay the workflow run?"})]}),(0,a.jsxs)(e0,{children:[(0,a.jsx)(e3,{children:"Cancel"}),(0,a.jsx)(e5,{onClick:Q,children:"Replay Run"})]})]})}),(0,a.jsxs)("div",{className:"flex flex-col h-[calc(100vh-97px)]",children:[(0,a.jsxs)("div",{className:"flex-none space-y-4",children:[(0,a.jsx)(e6,{children:(0,a.jsxs)(e8,{children:[(0,a.jsx)(e9,{children:(0,a.jsx)(e7,{asChild:!0,children:(0,a.jsx)(h.default,{href:(0,ts.buildUrlWithConfig)("/",e),children:"Runs"})})}),(0,a.jsx)(tt,{}),(0,a.jsx)(e9,{children:(0,a.jsx)(te,{className:"font-mono text-xs",children:t})})]})}),(0,a.jsxs)("div",{className:"space-y-4 p-6 border rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("h1",{className:"text-xl font-semibold",children:Y||(0,a.jsx)(tE.Skeleton,{className:"w-[260px] h-[28px]"})})}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)(tc,{hasError:!1,errorMessage:""}),(0,a.jsx)(tI.RunActionsButtons,{env:E,runId:t,runStatus:V.status,events:$,eventsLoading:K,loading:H,onRerunClick:()=>{I(!0)},onCancelClick:()=>{A(!0)},callbacks:{onSuccess:G},showDebugActions:R})]})]}),(0,a.jsxs)("div",{className:"flex items-start gap-8",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Status"}),V.status?(0,a.jsx)(tp.StatusBadge,{status:V.status,context:V}):(0,a.jsx)(tE.Skeleton,{className:"w-[55px] h-[24px]"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Duration"}),(0,a.jsx)("div",{className:"text-xs",children:V.runId?V.startedAt?(()=>{let e=Math.floor(((V.completedAt?new Date(V.completedAt).getTime():Date.now())-new Date(V.startedAt).getTime())/1e3);if(e<60)return`${e}s`;let t=Math.floor(e/60),r=e%60;if(t<60)return r>0?`${t}m ${r}s`:`${t}m`;let a=Math.floor(t/60),s=t%60;return s>0?`${a}h ${s}m`:`${a}h`})():"-":(0,a.jsx)(tE.Skeleton,{className:"w-[60px] h-[20px]"})})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Run ID"}),V.runId?(0,a.jsx)(ti.CopyableText,{text:V.runId,children:(0,a.jsx)("div",{className:"text-xs mt-0.5 font-mono",children:V.runId})}):(0,a.jsx)(tE.Skeleton,{className:"w-[280px] h-[20px]"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Queued"}),V.createdAt?(0,a.jsx)("div",{className:"text-xs",children:(0,a.jsx)(tu.RelativeTime,{date:V.createdAt})}):(0,a.jsx)(tE.Skeleton,{className:"w-[110px] h-[20px]"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Started"}),(0,a.jsx)("div",{className:"text-xs",children:V.runId?V.startedAt?(0,a.jsx)(tu.RelativeTime,{date:V.startedAt}):"-":(0,a.jsx)(tE.Skeleton,{className:"w-[110px] h-[20px]"})})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Completed"}),(0,a.jsx)("div",{className:"text-xs",children:V.runId?V.completedAt?(0,a.jsx)(tu.RelativeTime,{date:V.completedAt}):"-":(0,a.jsx)(tE.Skeleton,{className:"w-[110px] h-[20px]"})})]}),null!=V.expiredAt&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)(ta.Tooltip,{children:[(0,a.jsx)(ta.TooltipTrigger,{asChild:!0,children:(0,a.jsxs)("div",{className:"text-xs text-muted-foreground cursor-help flex items-center gap-1",children:["Expired",(0,a.jsx)(m,{className:"w-3 h-3"})]})}),(0,a.jsx)(ta.TooltipContent,{children:(0,a.jsx)("p",{children:"The storage data for this run has expired and is no longer available."})})]}),(0,a.jsx)("div",{className:"text-xs",children:(0,a.jsx)(tu.RelativeTime,{date:V.expiredAt})})]})]})]})]}),(0,a.jsxs)("div",{className:"mt-4 flex-1 flex flex-col min-h-0",children:[(0,a.jsxs)(tr.Tabs,{value:D,onValueChange:e=>P(e),className:"flex-1 flex flex-col min-h-0",children:[(0,a.jsxs)(tr.TabsList,{className:"mb-4 flex-none",children:[(0,a.jsxs)(tr.TabsTrigger,{value:"trace",className:"gap-2",children:[(0,a.jsx)(f,{className:"h-4 w-4"}),"Trace"]}),F&&(0,a.jsxs)(tr.TabsTrigger,{value:"graph",className:"gap-2",children:[(0,a.jsx)(u.GitBranch,{className:"h-4 w-4"}),"Graph"]}),(0,a.jsxs)(tr.TabsTrigger,{value:"streams",className:"gap-2",children:[(0,a.jsx)(f,{className:"h-4 w-4"}),"Streams"]})]}),(0,a.jsx)(tr.TabsContent,{value:"trace",className:"mt-0 flex-1 min-h-0",children:(0,a.jsx)(s.ErrorBoundary,{title:"Trace Viewer Error",description:"Failed to load trace viewer. Please try refreshing the page.",children:(0,a.jsx)("div",{className:"h-full",children:(0,a.jsx)(i.WorkflowTraceViewer,{error:z,steps:W,events:$,hooks:B,env:E,run:V,isLoading:H,onStreamClick:M})})})}),(0,a.jsx)(tr.TabsContent,{value:"streams",className:"mt-0 flex-1 min-h-0",children:(0,a.jsx)(s.ErrorBoundary,{title:"Streams Error",description:"Failed to load streams. Please try refreshing the page.",children:(0,a.jsxs)("div",{className:"h-full flex gap-4",children:[(0,a.jsxs)("div",{className:"w-64 flex-shrink-0 border rounded-lg overflow-hidden",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-background-100)"},children:[(0,a.jsxs)("div",{className:"px-3 py-2 border-b text-xs font-medium",style:{borderColor:"var(--ds-gray-300)",color:"var(--ds-gray-900)"},children:["Streams (",U.length,")"]}),(0,a.jsx)("div",{className:"overflow-auto max-h-[calc(100vh-400px)]",children:q?(0,a.jsx)("div",{className:"p-4 flex items-center justify-center",children:(0,a.jsx)(x.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):J?(0,a.jsx)("div",{className:"p-4 text-xs text-destructive",children:J.message}):0===U.length?(0,a.jsx)("div",{className:"p-4 text-xs",style:{color:"var(--ds-gray-600)"},children:"No streams found for this run"}):U.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>L(e),className:"w-full text-left px-3 py-2 text-xs font-mono truncate hover:bg-accent transition-colors",style:{backgroundColor:T===e?"var(--ds-gray-200)":"transparent",color:"var(--ds-gray-1000)"},title:e,children:e},e))})]}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:T?(0,a.jsx)(d.StreamViewer,{env:E,streamId:T}):(0,a.jsx)("div",{className:"h-full flex items-center justify-center rounded-lg border",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)"},children:(0,a.jsx)("div",{className:"text-sm",style:{color:"var(--ds-gray-600)"},children:U.length>0?"Select a stream to view its data":"No streams available"})})})]})})}),F&&(0,a.jsx)(tr.TabsContent,{value:"graph",className:"mt-0 flex-1 min-h-0",children:(0,a.jsx)(s.ErrorBoundary,{title:"Graph Viewer Error",description:"Failed to load execution graph. Please try refreshing the page.",children:(0,a.jsx)("div",{className:"h-full min-h-[500px]",children:(0,a.jsx)(tD,{config:e,run:V,allSteps:W,allEvents:$,env:E})})})})]}),K&&(0,a.jsxs)("div",{className:"fixed flex items-center gap-2 left-8 bottom-8 bg-background border rounded-md px-4 py-2 shadow-lg",children:[(0,a.jsx)(x.Loader2,{className:"size-4 animate-spin"}),(0,a.jsx)("span",{className:"text-sm",children:"Fetching data..."})]})]})]})]})}var tR=e.i(480462);function tO(){let e=(0,n.useParams)(),t=(0,ts.useQueryParamConfig)(),[r]=(0,tR.useStepIdState)(),[o]=(0,tR.useEventIdState)(),[l]=(0,tR.useHookIdState)(),d=e.runId;return(0,a.jsx)(s.ErrorBoundary,{title:"Run Detail Error",description:"Failed to load run details. Please try navigating back to the home page.",children:(0,a.jsx)(tT,{config:t,runId:d,selectedId:r||o||l||void 0})})}e.s(["default",()=>tO],721969)}]);
14
+ : 'text-muted-foreground'`,children:e?"Error":"Live"})]})}),(0,a.jsx)(ta.TooltipContent,{children:(0,a.jsx)("p",{children:e?`Error updating data: ${t}`:`Content updates every ${eq.LIVE_UPDATE_INTERVAL_MS/1e3} seconds`})})]})})}var tp=e.i(719402),tm=e.i(451675),tf=e.i(330974),tx=e.i(280998),th=e.i(259280),tg=e.i(356089),tb=e.i(562918),tv=e.i(93698);function tj(e){return"retrying"===e?"running":e}let ty={loopNode:function({data:e,selected:t}){return(0,a.jsxs)("div",{className:`relative ${e.className||""}`,style:{borderWidth:e.nodeStyle?.borderWidth??2,borderRadius:8,padding:12,width:220,borderStyle:"solid",backgroundColor:e.nodeStyle?.backgroundColor,borderColor:e.nodeStyle?.borderColor??"#9ca3af",opacity:e.nodeStyle?.opacity,boxShadow:t?"0 0 0 2px rgba(168, 85, 247, 0.5)":void 0},children:[e.label,(0,a.jsx)(tf.Handle,{type:"target",position:tx.Position.Top,className:"!bg-purple-500"}),(0,a.jsx)(tf.Handle,{type:"source",position:tx.Position.Bottom,className:"!bg-purple-500"}),(0,a.jsx)(tf.Handle,{type:"source",position:tx.Position.Left,id:"loop-out",className:"!bg-purple-500 !-left-1 !w-[6px] !h-[6px] !min-w-0 !min-h-0",style:{top:"30%"}}),(0,a.jsx)(tf.Handle,{type:"target",position:tx.Position.Left,id:"loop-in",className:"!bg-purple-500 !-left-1 !w-[6px] !h-[6px] !min-w-0 !min-h-0",style:{top:"70%"}})]})},parallelGroup:tv.ParallelGroupComponent,executionNode:function({data:e,selected:t}){let r="workflow_start"===e.nodeKind,s="workflow_end"===e.nodeKind;return(0,a.jsxs)("div",{className:`relative ${e.className||""}`,style:{borderWidth:e.nodeStyle?.borderWidth??2,borderRadius:8,padding:12,width:220,borderStyle:"solid",backgroundColor:e.nodeStyle?.backgroundColor,borderColor:e.nodeStyle?.borderColor??"#9ca3af",opacity:e.nodeStyle?.opacity,boxShadow:t?"0 0 0 2px rgba(59, 130, 246, 0.35)":void 0},children:[e.label,!r&&(0,a.jsx)(tf.Handle,{type:"target",position:tx.Position.Top,className:"!bg-muted"}),!s&&(0,a.jsx)(tf.Handle,{type:"source",position:tx.Position.Bottom,className:"!bg-muted"})]})},diamondNode:function({data:e,selected:t}){return(0,a.jsxs)("div",{className:`relative flex items-center justify-center ${e.className||""}`,style:{width:160,height:160},children:[(0,a.jsx)("div",{style:{width:112,height:112,transform:"rotate(45deg)",borderWidth:2,borderStyle:"solid",borderRadius:4,backgroundColor:e.nodeStyle?.backgroundColor,borderColor:e.nodeStyle?.borderColor??"#ef4444",opacity:e.nodeStyle?.opacity,boxShadow:t?"0 0 0 2px rgba(239, 68, 68, 0.5)":void 0}}),(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-auto",style:{fontSize:11,fontWeight:600,padding:40},title:"string"==typeof e.label?e.label:void 0,children:(0,a.jsx)("span",{className:"text-center line-clamp-3 overflow-hidden",children:e.label})}),(0,a.jsx)(tf.Handle,{type:"target",position:tx.Position.Top,className:"!bg-red-500"}),(0,a.jsx)(tf.Handle,{type:"source",position:tx.Position.Bottom,id:"bottom",className:"!bg-red-500"}),(0,a.jsx)(tf.Handle,{type:"source",position:tx.Position.Left,id:"left",className:"!bg-red-500"}),(0,a.jsx)(tf.Handle,{type:"source",position:tx.Position.Right,id:"right",className:"!bg-red-500"})]})}},tN=(0,tv.createEdgeTypes)(tv.executionSelfLoopStyle);function tw(e,t,r){let s=(0,a.jsxs)("div",{className:"flex items-start gap-2 w-full overflow-hidden",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,tv.getNodeIcon)(e.nodeKind,e.label)}),(0,a.jsx)("span",{className:"text-sm font-medium break-words whitespace-normal leading-tight flex-1 min-w-0",children:e.label})]});if(!r||0===r.length)return s;let n=r[r.length-1],o=r.length,l=o>1;return l||n.duration&&n.duration>0?(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 w-full",children:[s,(0,a.jsxs)("div",{className:"flex flex-wrap gap-1 text-xs",children:[l&&(0,a.jsxs)(tb.Badge,{variant:"outline",className:"text-xs px-1.5 py-0 border-orange-500 text-orange-700 dark:text-orange-300",children:["↻ ",o,"x"]}),n.duration&&n.duration>0&&(0,a.jsxs)(tb.Badge,{variant:"secondary",className:"text-xs px-1.5 py-0 bg-black/10 dark:bg-white/15 border-0",children:["⏱ ",(0,tg.formatDuration)(n.duration,!0)]})]})]}):s}let tk={...tv.LAYOUT,VERTICAL_SPACING:320};function tS(e,t){let{nodes:r,groupNodes:a}=(0,tv.calculateEnhancedLayout)(e,tk),s=new Map,n=new Map;for(let e of a)e.id.startsWith("group_")&&n.set(e.id,e.position);for(let e of r){let t=e.metadata?.parallelGroupId?`group_${e.metadata.parallelGroupId}`:null;t&&n.has(t)&&s.set(e.id,t)}let o=[];for(let e of a.filter(e=>e.id.startsWith("group_")))o.push({id:e.id,type:"parallelGroup",position:e.position,style:{...e.style,cursor:"grab",zIndex:-1},data:e.data,selectable:!0,draggable:!0});for(let e of r){let r=t?.nodeExecutions.get(e.id),a=function(e,t){let r=(0,tv.getNodeBackgroundColor)(e);if(!t||0===t.length)return{color:"hsl(var(--card-foreground))",backgroundColor:r,borderColor:"#9ca3af",opacity:.4};let a=t[t.length-1],s="#9ca3af",n=2;switch(a.status){case"completed":s="#22c55e";break;case"failed":s="#ef4444",n=3;break;case"running":s="#3b82f6",n=2;break;case"retrying":s="#f97316";break;case"cancelled":s="#eab308";break;case"pending":s="#9ca3af"}return{color:"hsl(var(--card-foreground))",backgroundColor:r,borderColor:s,borderWidth:n}}(e.data.nodeKind,r),l=t?.currentNode===e.id,d=!!e.metadata?.loopId,i=!!e.metadata?.loopIsAwait,c="conditional"===e.data.nodeKind,u=c?"diamondNode":d?"loopNode":"executionNode",p=s.get(e.id),m=e.position;if(p){let t=n.get(p);t&&(m={x:e.position.x-t.x,y:e.position.y-t.y})}let f=l?"animate-pulse-subtle":"";d?o.push({id:e.id,type:u,position:m,parentId:p,extent:p?"parent":void 0,expandParent:!0,data:{...e.data,label:tw(e.data,e.metadata,r),executions:r,isLoopNode:!0,isAwaitLoop:i,nodeStyle:a,className:f}}):c?o.push({id:e.id,type:u,position:m,parentId:p,extent:p?"parent":void 0,expandParent:!0,data:{...e.data,label:e.data.label,executions:r,nodeStyle:a,className:f}}):o.push({id:e.id,type:u,position:m,parentId:p,extent:p?"parent":void 0,expandParent:!0,data:{...e.data,label:tw(e.data,e.metadata,r),executions:r,nodeStyle:a,className:f},style:{width:220}})}return o}function tA(e,t){let{additionalEdges:r}=(0,tv.calculateEnhancedLayout)(e,tk),s=[...e.edges.map(e=>"loop"===e.type?{...e,id:`loop_back_${e.source}_${e.target}`,isOriginal:!0}:{...e,isOriginal:!0}),...r.map(e=>({...e,isOriginal:!1}))];return(0,tv.consolidateEdges)(s,e.nodes).map(e=>{let r;if("selfLoop"===e.type)return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,type:"selfLoop",label:e.label,markerEnd:{type:tx.MarkerType.ArrowClosed,width:12,height:12,color:"#a855f7"}};let s=t?.edgeTraversals.get(e.id);if(!s&&e.isConsolidated&&e.originalEdgeIds)for(let r of e.originalEdgeIds){let e=t?.edgeTraversals.get(r);if(e&&e.traversalCount>0){s=e;break}}let n=s&&s.traversalCount>0,o=!!t,l=s?.timings.length?s.timings.reduce((e,t)=>e+t,0)/s.timings.length:void 0,d="bezier",i=e.label,c=!1;switch(e.type){case"parallel":d="smoothstep",r="4,4",i=void 0;break;case"loop":d="step",r="8,4";break;case"conditional":d="smoothstep",r="8,4",c=!0;break;default:d="bezier"}let u=n?"#22c55e":"#6b7280",p=n?void 0:r,m=c?"#ffffff":"#6b7280",f=c?"#374151":"#f3f4f6",x=c?"#4b5563":"#d1d5db";return{id:e.id,source:e.source,target:e.target,type:d,animated:n&&t?.status==="running",label:s&&s.traversalCount>1?(0,a.jsxs)("div",{className:"flex flex-col items-center gap-0.5",children:[(0,a.jsxs)(tb.Badge,{variant:"secondary",className:"text-xs px-1.5 py-0",children:[s.traversalCount,"×"]}),l&&l>0&&(0,a.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["~",(0,tg.formatDuration)(l,!0)]})]}):i,labelStyle:{fill:m,fontWeight:500,fontSize:"11px"},labelBgStyle:{fill:f,fillOpacity:.95,stroke:x,strokeWidth:1},labelBgPadding:[4,6],labelBgBorderRadius:4,markerEnd:{type:tx.MarkerType.ArrowClosed,width:n?14:10,height:n?14:10,color:u},style:{strokeWidth:n?2.5:1,stroke:u,opacity:o&&!n?.35:1,strokeDasharray:p}}})}function tI({selectedNode:e,env:t,onClose:r}){let{node:s,executions:n,stepId:o,runId:d}=e,i=n[n.length-1],c=n.length>1,{data:u,loading:p}=(0,l.useWorkflowResourceData)(t??{},"step",o??"",{runId:d}),m=u?.input??i?.input,f=u?.output??i?.output,h=u?.error??i?.error;return(0,a.jsxs)("div",{className:"h-full flex flex-col bg-background border-l",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b flex-none",children:[(0,a.jsx)("span",{className:"text-xs font-medium truncate flex-1",title:s.data.label,children:s.data.label}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-none",children:[i?.duration!==void 0&&i.duration>0&&(0,a.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:(0,tg.formatDuration)(i.duration)}),(0,a.jsx)("div",{className:"w-px h-4 bg-border"}),(0,a.jsx)("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-muted transition-colors","aria-label":"Close panel",children:(0,a.jsx)(th.X,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-3 min-h-0",children:[(0,a.jsxs)("div",{className:"flex flex-col divide-y rounded-lg border overflow-hidden mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"type"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:s.data.nodeKind})]}),i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"status"}),(0,a.jsx)(tm.StatusBadge,{status:tj(i.status)})]}),void 0!==i.duration&&i.duration>0&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"duration"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:(0,tg.formatDuration)(i.duration)})]}),c&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"attempts"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:n.length})]}),i.startedAt&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"startedAt"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:new Date(i.startedAt).toLocaleString()})]}),i.completedAt&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-muted-foreground",children:"completedAt"}),(0,a.jsx)("span",{className:"text-[11px] font-mono",children:new Date(i.completedAt).toLocaleString()})]})]})]}),p&&o&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-3",children:[(0,a.jsx)(x.Loader2,{className:"h-3 w-3 animate-spin"}),(0,a.jsx)("span",{children:"Loading step data..."})]}),void 0!==m&&(0,a.jsxs)("details",{className:"group mb-3",children:[(0,a.jsxs)("summary",{className:"cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 bg-muted/50",children:[(0,a.jsx)("span",{className:"font-medium",children:"Input"}),(0,a.jsxs)("span",{className:"text-muted-foreground ml-1",children:["(",Array.isArray(m)?m.length:1," args)"]})]}),(0,a.jsxs)("div",{className:"relative pl-6 mt-3",children:[(0,a.jsx)("div",{className:"absolute left-3 -top-3 w-px h-3 bg-border"}),(0,a.jsx)("div",{className:"absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg border-border"}),(0,a.jsx)("pre",{className:"text-[11px] overflow-x-auto rounded-md border p-2.5 bg-muted/30 max-h-64 overflow-y-auto",children:(0,a.jsx)("code",{children:JSON.stringify(m,null,2)})})]})]}),void 0!==f&&(0,a.jsxs)("details",{className:"group mb-3",children:[(0,a.jsx)("summary",{className:"cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 bg-muted/50",children:(0,a.jsx)("span",{className:"font-medium",children:"Output"})}),(0,a.jsxs)("div",{className:"relative pl-6 mt-3",children:[(0,a.jsx)("div",{className:"absolute left-3 -top-3 w-px h-3 bg-border"}),(0,a.jsx)("div",{className:"absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg border-border"}),(0,a.jsx)("pre",{className:"text-[11px] overflow-x-auto rounded-md border p-2.5 bg-muted/30 max-h-64 overflow-y-auto",children:(0,a.jsx)("code",{children:JSON.stringify(f,null,2)})})]})]}),h&&(0,a.jsxs)("details",{className:"group mb-3",open:!0,children:[(0,a.jsx)("summary",{className:"cursor-pointer rounded-md border border-red-300 bg-red-50 dark:bg-red-950/20 px-2.5 py-1.5 text-xs hover:brightness-95",children:(0,a.jsx)("span",{className:"font-medium text-red-600 dark:text-red-400",children:"Error"})}),(0,a.jsxs)("div",{className:"relative pl-6 mt-3",children:[(0,a.jsx)("div",{className:"absolute left-3 -top-3 w-px h-3 bg-red-300"}),(0,a.jsx)("div",{className:"absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg border-red-300"}),(0,a.jsx)("pre",{className:"text-[11px] overflow-x-auto rounded-md border border-red-200 p-2.5 bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-300 whitespace-pre-wrap max-h-64 overflow-y-auto",children:(0,a.jsx)("code",{children:"object"==typeof h?JSON.stringify(h,null,2):String(h)})})]})]}),c&&(0,a.jsxs)("details",{className:"group",children:[(0,a.jsxs)("summary",{className:"cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 bg-muted/50",children:[(0,a.jsx)("span",{className:"font-medium",children:"Attempt History"}),(0,a.jsxs)("span",{className:"text-muted-foreground ml-1",children:["(",n.length," attempts)"]})]}),(0,a.jsxs)("div",{className:"relative pl-6 mt-3",children:[(0,a.jsx)("div",{className:"absolute left-3 -top-3 w-px h-3 bg-border"}),(0,a.jsx)("div",{className:"absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg border-border"}),(0,a.jsx)("div",{className:"flex flex-col divide-y rounded-md border overflow-hidden",children:n.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between px-2.5 py-1.5 text-[11px]",children:[(0,a.jsxs)("span",{className:"text-muted-foreground",children:["Attempt ",e.attemptNumber]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(tm.StatusBadge,{status:tj(e.status)}),void 0!==e.duration&&e.duration>0&&(0,a.jsx)("span",{className:"font-mono text-muted-foreground",children:(0,tg.formatDuration)(e.duration)})]})]},e.attemptNumber))})]})]})]})]})}function tC({workflow:e,execution:t,env:r,onNodeClick:s}){let[n,o]=(0,g.useState)(null),l=(0,g.useMemo)(()=>tS(e,t),[e,t]),d=(0,g.useMemo)(()=>tA(e,t),[e,t]),[i,c,u]=(0,tf.useNodesState)(l),[p,m,f]=(0,tf.useEdgesState)(d);(0,g.useEffect)(()=>{c(r=>{let a=tS(e,t),s=new Map(r.map(e=>[e.id,e.position]));return a.map(e=>({...e,position:s.get(e.id)??e.position}))}),m(tA(e,t))},[e,t,c,m]);let x=(0,g.useCallback)((r,a)=>{let n=e.nodes.find(e=>e.id===a.id);if(n){let e=a.data.executions||[],r=e[e.length-1];o({nodeId:a.id,node:n,executions:e,stepId:r?.stepId,runId:t?.runId}),s&&e.length>0&&s(a.id,e)}},[e.nodes,t?.runId,s]),h=(0,g.useCallback)(()=>{o(null)},[]);return(0,a.jsxs)("div",{className:"h-full w-full border rounded-lg bg-background relative overflow-hidden flex",children:[(0,a.jsx)("div",{className:"h-full flex-1 min-w-0",style:{width:n?"calc(100% - 320px)":"100%"},children:(0,a.jsxs)(tf.ReactFlow,{nodes:i,edges:p,onNodesChange:u,onEdgesChange:f,onNodeClick:x,nodeTypes:ty,edgeTypes:tN,fitView:!0,minZoom:.1,maxZoom:2,defaultViewport:{x:0,y:0,zoom:1},proOptions:{hideAttribution:!0},children:[(0,a.jsx)(tf.Background,{}),(0,a.jsx)(tf.Controls,{}),(0,a.jsx)(tf.Panel,{position:"top-left",className:"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border rounded-lg p-2 text-xs",children:(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("div",{className:"font-semibold text-[10px] text-muted-foreground mb-1",children:"Status"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-green-500 bg-background"}),(0,a.jsx)("span",{children:"Completed"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-red-500 bg-background"}),(0,a.jsx)("span",{children:"Failed"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-blue-500 bg-background"}),(0,a.jsx)("span",{children:"Running"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-yellow-500 bg-background"}),(0,a.jsx)("span",{children:"Cancelled"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 opacity-50",children:[(0,a.jsx)("div",{className:"w-6 h-4 rounded border-2 border-gray-400 bg-background"}),(0,a.jsx)("span",{children:"Pending"})]})]})}),t&&(0,a.jsxs)(tf.Panel,{position:"top-right",className:"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border rounded-lg p-3 text-xs space-y-1.5",children:[(0,a.jsx)("div",{className:"font-semibold text-sm",children:"Execution"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:"Status:"}),(0,a.jsx)(tb.Badge,{variant:"completed"===t.status?"default":"failed"===t.status?"destructive":"cancelled"===t.status?"outline":"secondary",className:"text-xs",children:t.status})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:"Progress:"}),(0,a.jsxs)("span",{className:"font-mono",children:[t.executionPath.length," / ",e.nodes.length]})]})]})]})}),n&&(0,a.jsx)("div",{className:"h-full flex-none",style:{width:320},children:(0,a.jsx)(tI,{selectedNode:n,env:r,onClose:h})})]})}var tE=e.i(708341),tD=e.i(613087);function tT({run:e,allSteps:t,allEvents:r,env:s}){let{manifest:n,loading:o,error:l}=(0,td.useWorkflowGraphManifest)(),d=(0,g.useMemo)(()=>n&&e.workflowName?n.workflows[e.workflowName]??null:null,[n,e.workflowName]),i=(0,g.useMemo)(()=>d&&e.runId?function(e,t,r,a){let s,n,o=new Map,l=[];console.log("[Graph Mapper] Mapping run to execution:",{runId:e.runId,workflowName:e.workflowName,graphNodes:a.nodes.length,stepsCount:t.length}),(n=a.nodes.find(e=>"workflow_start"===e.data.nodeKind))&&(l.push(n.id),o.set(n.id,[{nodeId:n.id,attemptNumber:1,status:"completed",startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0}]));let d=[...t].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime());console.log("[Graph Mapper] Sorted steps:",d.map(e=>({stepId:e.stepId,stepName:e.stepName,attempt:e.attempt,status:e.status,createdAt:e.createdAt})));let{byStepId:i,byFunctionName:c,primitivesByLabel:u,agentNodes:p,toolNodes:m}=function(e){let t=new Map,r=new Map,a=new Map,s=[],n=new Map;for(let o of e){if(o.data.stepId){let e=to(o.data.stepId),a=t.get(e)||[];a.push(o),t.set(e,a);let s=tl(e);if(s){let e=r.get(s)||[];e.push(o),r.set(s,e)}}if("primitive"===o.data.nodeKind){let e=o.data.label,t=a.get(e)||[];t.push(o),a.set(e,t)}if("agent"===o.data.nodeKind&&s.push(o),"tool"===o.data.nodeKind){let e=o.data.label.replace(/ \(tool\)$/,""),t=n.get(e)||[];if(t.push(o),n.set(e,t),o.data.stepId){let e=tl(to(o.data.stepId));if(e){let t=n.get(e)||[];t.includes(o)||(t.push(o),n.set(e,t))}}}}return{byStepId:t,byFunctionName:r,primitivesByLabel:a,agentNodes:s,toolNodes:n}}(a.nodes);console.log("[Graph Mapper] Graph nodes by stepId:",{allGraphNodes:a.nodes.map(e=>({id:e.id,stepId:e.data.stepId,normalizedStepId:e.data.stepId?to(e.data.stepId):void 0,nodeKind:e.data.nodeKind})),nodesByStepId:Array.from(i.entries()).map(([e,t])=>({stepId:e,nodeIds:t.map(e=>e.id)}))});let f=new Map,x=[],h=null,g=null;for(let e=0;e<=d.length;e++){let t=d[e];if(t&&t.stepId===h)x.push(t);else{if(x.length>0&&g){let e=function(e,t,r,a,s,n,o){let l=to(t),d=s.get(l)||0;s.set(l,d+1);let i=r.get(l)||[],c="step-id";if(0===i.length){let e=tl(l);e&&(i=a.get(e)||[],c="function-name")}let u=1===i.length?i[0]:i[d];if(console.log("[Graph Mapper] Processing step group:",{stepName:t,normalizedStepName:l,attempts:e.length,occurrenceIndex:d,totalNodesWithStepId:i.length,selectedNode:u?.id,allNodesWithStepId:i.map(e=>e.id),matchStrategy:c,strategy:1===i.length?"single-node-multiple-invocations":"occurrence-based"}),!u)return;let p=e.map((t,r)=>(function(e,t,r,a){let s;switch(e.status){case"completed":s="completed";break;case"failed":s=r<a-1?"retrying":"failed";break;case"running":s="running";break;case"cancelled":s="cancelled";break;default:s="pending"}let n=e.completedAt&&e.startedAt?new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime():void 0;return{nodeId:t,stepId:e.stepId,attemptNumber:e.attempt,status:s,startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.completedAt?new Date(e.completedAt).toISOString():void 0,duration:n,input:e.input,output:e.output,error:e.error?{message:e.error.message,stack:e.error.stack||""}:void 0}})(t,u.id,r,e.length));if(1===i.length){let e=n.get(u.id)||[];n.set(u.id,[...e,...p])}else n.set(u.id,p);return o.includes(u.id)||o.push(u.id),"running"===p[p.length-1].status?u.id:void 0}(x,g,i,c,f,o,l);e&&(s=e)}t&&(x=[t],h=t.stepId,g=t.stepName)}}let b=function(e,t,r,a){let s,n=new Map,o=new Map;for(let t of e){if(!t.correlationId)continue;let e=o.get(t.correlationId)||[];e.push(t),o.set(t.correlationId,e)}let l=t.get(tn)||[],d=new Set;for(let t of e)"wait_created"===t.eventType&&t.correlationId&&d.add(t.correlationId);for(let e of Array.from(d).sort((e,t)=>{let r=o.get(e)||[],a=o.get(t)||[],s=r.find(e=>"wait_created"===e.eventType)?.createdAt,n=a.find(e=>"wait_created"===e.eventType)?.createdAt;return s&&n?new Date(s).getTime()-new Date(n).getTime():0})){let t=o.get(e)||[],d=t.find(e=>"wait_created"===e.eventType),i=t.find(e=>"wait_completed"===e.eventType);if(!d)continue;let c=n.get(tn)||0;n.set(tn,c+1);let u=1===l.length?l[0]:l[c];if(!u)continue;let p="running";i&&(p="completed");let m=new Date(d.createdAt).toISOString(),f=i?new Date(i.createdAt).toISOString():void 0,x=i?new Date(i.createdAt).getTime()-new Date(d.createdAt).getTime():void 0,h={nodeId:u.id,attemptNumber:1,status:p,startedAt:m,completedAt:f,duration:x},g=r.get(u.id)||[];r.set(u.id,[...g,h]),a.includes(u.id)||a.push(u.id),"running"===p&&(s=u.id)}let i=[...t.get("createHook")||[],...t.get("createWebhook")||[]],c=new Set;for(let t of e)"hook_created"===t.eventType&&t.correlationId&&c.add(t.correlationId);let u=Array.from(c).sort((e,t)=>{let r=o.get(e)||[],a=o.get(t)||[],s=r.find(e=>"hook_created"===e.eventType)?.createdAt,n=a.find(e=>"hook_created"===e.eventType)?.createdAt;return s&&n?new Date(s).getTime()-new Date(n).getTime():0}),p=0;for(let e of u){let t=(o.get(e)||[]).find(e=>"hook_created"===e.eventType);if(!t)continue;let s=1===i.length?i[0]:i[p];if(p++,!s)continue;let n=new Date(t.createdAt).toISOString(),l=new Date(t.createdAt).toISOString(),d={nodeId:s.id,attemptNumber:1,status:"completed",startedAt:n,completedAt:l,duration:0},c=r.get(s.id)||[];r.set(s.id,[...c,d]),a.includes(s.id)||a.push(s.id)}let m=t.get("awaitWebhook")||[],f=new Set;for(let t of e)"hook_received"===t.eventType&&t.correlationId&&f.add(t.correlationId);let x=0;for(let e of u){let t,s,n,l=1===m.length?m[0]:m[x];if(x++,!l)continue;let d=o.get(e)||[],i=d.find(e=>"hook_created"===e.eventType),c=d.find(e=>"hook_received"===e.eventType),u=0;c?(t="completed",s=i?new Date(i.createdAt).toISOString():new Date(c.createdAt).toISOString(),u=new Date(n=new Date(c.createdAt).toISOString()).getTime()-new Date(s).getTime()):i?(t="running",s=new Date(i.createdAt).toISOString()):t="pending";let p={nodeId:l.id,attemptNumber:1,status:t,startedAt:s,completedAt:n,duration:u},f=r.get(l.id)||[];r.set(l.id,[...f,p]),a.includes(l.id)||a.push(l.id)}return s}(r,u,o,l);b&&(s=b),function(e,t,r,a,s,n,o){let l="pending";for(let t of("completed"===e.status?l="completed":"failed"===e.status?l="failed":"running"===e.status&&(l="running"),r)){let r={nodeId:t.id,attemptNumber:1,status:l,startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.completedAt&&("completed"===l||"failed"===l)?new Date(e.completedAt).toISOString():void 0};s.set(t.id,[r]),n.includes(t.id)||n.push(t.id)}for(let e of t){let t,r=tl(e.stepName);if(!r)continue;let o=a.get(r);if(!o||0===o.length)continue;let l=o[0];switch(e.status){case"completed":t="completed";break;case"failed":t="failed";break;case"running":t="running";break;case"cancelled":t="cancelled";break;default:t="pending"}let d=e.completedAt&&e.startedAt?new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime():void 0,i={nodeId:l.id,stepId:e.stepId,attemptNumber:e.attempt,status:t,startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.completedAt?new Date(e.completedAt).toISOString():void 0,duration:d,input:e.input,output:e.output,error:e.error},c=s.get(l.id)||[];s.set(l.id,[...c,i]),n.includes(l.id)||n.push(l.id)}for(let t of o){let r=t.metadata?.isToolsCollection===!0;if("tool"===t.data.nodeKind&&r&&!s.has(t.id)){let r={nodeId:t.id,attemptNumber:1,status:l,startedAt:e.startedAt?new Date(e.startedAt).toISOString():void 0,completedAt:e.completedAt&&("completed"===l||"failed"===l)?new Date(e.completedAt).toISOString():void 0};s.set(t.id,[r]),n.includes(t.id)||n.push(t.id)}}}(e,d,p,m,o,l,a.nodes),function(e,t,r,a){let s=e.nodes.filter(e=>"conditional"===e.data.nodeKind),n=new Map;for(let t of e.nodes){let e=t.metadata?.conditionalId;if(e){let r=n.get(e)||{thenNodes:[],elseNodes:[]};t.metadata?.conditionalBranch==="Then"?r.thenNodes.push(t):t.metadata?.conditionalBranch==="Else"&&r.elseNodes.push(t),n.set(e,r)}}for(let e of s){let s=e.id.match(/^(cond_\d+)_node$/);if(!s)continue;let o=s[1],l=n.get(o);if(!l)continue;let d=l.thenNodes.some(e=>t.has(e.id)),i=l.elseNodes.some(e=>t.has(e.id));if(d||i){let s=[...l.thenNodes,...l.elseNodes];if(!t.has(e.id)){let r;for(let e of s){let a=t.get(e.id);if(a&&a.length>0){let e=a[0];e.startedAt&&(!r||e.startedAt<r)&&(r=e.startedAt)}}let n=a.startedAt?new Date(a.startedAt).toISOString():void 0,o={nodeId:e.id,attemptNumber:1,status:"completed",startedAt:r||n,completedAt:r||n};t.set(e.id,[o])}if(!r.includes(e.id)){let t=s.map(e=>r.indexOf(e.id)).filter(e=>e>=0);if(t.length>0){let a=Math.min(...t);a>=0&&a<r.length?r.splice(a,0,e.id):r.push(e.id)}else r.push(e.id)}}}}(a,o,l,e),function(e,t,r,a){let s,n=t.nodes.find(e=>"workflow_end"===e.data.nodeKind);if(!(!n||r.includes(n.id))){switch(e.status){case"completed":s="completed";break;case"failed":s="failed";break;case"cancelled":s="cancelled";break;case"running":s="running";break;default:return}r.push(n.id),a.set(n.id,[{nodeId:n.id,attemptNumber:1,status:s,startedAt:e.completedAt?new Date(e.completedAt).toISOString():void 0,completedAt:e.completedAt?new Date(e.completedAt).toISOString():void 0}])}}(e,a,l,o);let v=function(e,t,r){let a=new Map,s=new Set(e),n=new Map;for(let e of t.nodes){let t=e.metadata?.parallelGroupId;if(t){let r=n.get(t)||{nodes:[]};r.nodes.push(e),r.method=e.metadata?.parallelMethod,n.set(t,r)}}let o=new Map;for(let[e,t]of n)if("race"===t.method){let a,s;for(let e of t.nodes){let t=r.get(e.id);if(t){for(let r of t)if("completed"===r.status&&r.completedAt){let t=new Date(r.completedAt);(!s||t<s)&&(s=t,a=e.id)}}}a&&o.set(e,a)}let l=e=>{let t=a.get(e.id);t?t.traversalCount++:a.set(e.id,{edgeId:e.id,traversalCount:1,timings:[]})};for(let e of t.edges){let r=t.nodes.find(t=>t.id===e.source),a=t.nodes.find(t=>t.id===e.target);if(!r||!a)continue;let n=s.has(e.source),d=s.has(e.target);if(!n&&!d)continue;if("conditional"===e.type){n&&d&&l(e);continue}let i=r.metadata?.parallelGroupId,c=r.metadata?.parallelMethod;i&&"race"===c?o.get(i)===e.source&&d&&l(e):n&&d?l(e):n&&"parallel"===e.type&&d&&l(e)}return a}(l,a,o),j={runId:e.runId,status:e.status,nodeExecutions:o,edgeTraversals:v,currentNode:s,executionPath:l};return console.log("[Graph Mapper] Mapping complete:",{executionPath:l,nodeExecutionsCount:o.size,nodeExecutions:Array.from(o.entries()).map(([e,t])=>({nodeId:e,executionCount:t.length,latestStatus:t[t.length-1]?.status}))}),j}(e,t||[],r||[],d):null,[d,e,t,r]);return o?(0,a.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,a.jsx)(x.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"ml-4 text-muted-foreground",children:"Loading workflow graph..."})]}):l?(0,a.jsx)("div",{className:"flex items-center justify-center w-full h-full p-4",children:(0,a.jsxs)(v.Alert,{variant:"destructive",className:"max-w-lg",children:[(0,a.jsx)(c.AlertCircle,{className:"h-4 w-4"}),(0,a.jsx)(v.AlertTitle,{children:"Error Loading Workflow Graph"}),(0,a.jsx)(v.AlertDescription,{children:l.message})]})}):d?(0,a.jsx)(tC,{workflow:d,execution:i||void 0,env:s}):(0,a.jsx)("div",{className:"flex items-center justify-center w-full h-full",children:(0,a.jsxs)(v.Alert,{className:"max-w-lg",children:[(0,a.jsx)(c.AlertCircle,{className:"h-4 w-4"}),(0,a.jsx)(v.AlertTitle,{children:"Workflow Graph Not Found"}),(0,a.jsx)(v.AlertDescription,{children:"Could not find the workflow graph for this run. The workflow may have been deleted or the graph manifest may need to be regenerated."})]})})}function tR({runId:e,selectedId:t}){let r=(0,n.useRouter)(),p=(0,n.useSearchParams)(),{serverConfig:j}=(0,ti.useServerConfig)(),[y,N]=(0,g.useState)(!1),[w,k]=(0,g.useState)(!1),[S,A]=(0,g.useState)(!1),[I,C]=(0,g.useState)(!1),E=(0,g.useMemo)(()=>({}),[]),D=p.get("tab")||"trace",T=p.get("streamId"),R="1"===p.get("debug"),O=(0,g.useCallback)(e=>{let t=new URLSearchParams(p.toString());for(let[r,a]of Object.entries(e))null===a?t.delete(r):t.set(r,a);r.push(`?${t.toString()}`,{scroll:!1})},[r,p]),P=(0,g.useCallback)(e=>{"trace"===e||"graph"===e?O({tab:e,streamId:null}):O({tab:e})},[O]),L=(0,g.useCallback)(e=>{O({streamId:e})},[O]),M=(0,g.useCallback)(e=>{O({tab:"streams",streamId:e})},[O]),F="local"===j.backendId||"@workflow/world-local"===j.backendId,{run:_,steps:W,hooks:B,events:$,loading:H,auxiliaryDataLoading:K,error:z,update:G}=(0,l.useWorkflowTraceViewerData)(E,e,{live:!0}),V=_??{},{streams:U,loading:q,error:J}=(0,l.useWorkflowStreams)(E,e),Z=async()=>{if(!y)try{N(!0),A(!1),await (0,l.cancelRun)(E,e),await G(),b.toast.success("Run cancelled successfully")}catch(e){console.error("Failed to cancel run:",e),b.toast.error("Failed to cancel run",{description:e instanceof Error?e.message:"An unknown error occurred"})}finally{N(!1)}},Y=async()=>{if(!w)try{k(!0),C(!1);let e=await (0,l.recreateRun)(E,V.runId);b.toast.success("New run started successfully",{description:`Run ID: ${e}`}),r.push((0,ts.buildUrlWithConfig)(`/run/${e}`))}catch(e){console.error("Failed to re-run workflow:",e),b.toast.error("Failed to start new run",{description:e instanceof Error?e.message:"An unknown error occurred"})}finally{k(!1),C(!1)}};if(z&&!_)return(0,a.jsxs)(v.Alert,{variant:"destructive",className:"m-4",children:[(0,a.jsx)(c.AlertCircle,{className:"h-4 w-4"}),(0,a.jsx)(v.AlertTitle,{children:"Error loading workflow run"}),(0,a.jsx)(v.AlertDescription,{children:z.message})]});let Q=(0,o.parseWorkflowName)(V.workflowName)?.shortName;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eJ,{open:S,onOpenChange:A,children:(0,a.jsxs)(eQ,{children:[(0,a.jsxs)(eX,{children:[(0,a.jsx)(e1,{children:"Cancel Workflow Run?"}),(0,a.jsx)(e2,{children:"This will stop the workflow execution immediately, and no further steps will be executed. Partial workflow execution may occur. Are you sure you want to cancel the run?"})]}),(0,a.jsxs)(e0,{children:[(0,a.jsx)(e3,{children:"Keep Running"}),(0,a.jsx)(e5,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Run"})]})]})}),(0,a.jsx)(eJ,{open:I,onOpenChange:C,children:(0,a.jsxs)(eQ,{children:[(0,a.jsxs)(eX,{children:[(0,a.jsx)(e1,{children:"Replay Run?"}),(0,a.jsx)(e2,{children:"This can potentially re-run code that is meant to only execute once. Are you sure you want to replay the workflow run?"})]}),(0,a.jsxs)(e0,{children:[(0,a.jsx)(e3,{children:"Cancel"}),(0,a.jsx)(e5,{onClick:Y,children:"Replay Run"})]})]})}),(0,a.jsxs)("div",{className:"flex flex-col h-[calc(100vh-97px)]",children:[(0,a.jsxs)("div",{className:"flex-none space-y-4",children:[(0,a.jsx)(e6,{children:(0,a.jsxs)(e8,{children:[(0,a.jsx)(e9,{children:(0,a.jsx)(e7,{asChild:!0,children:(0,a.jsx)(h.default,{href:(0,ts.buildUrlWithConfig)("/"),children:"Runs"})})}),(0,a.jsx)(tt,{}),(0,a.jsx)(e9,{children:(0,a.jsx)(te,{className:"font-mono text-xs",children:e})})]})}),(0,a.jsxs)("div",{className:"space-y-4 p-6 border rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("h1",{className:"text-xl font-semibold",children:Q||(0,a.jsx)(tD.Skeleton,{className:"w-[260px] h-[28px]"})})}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)(tu,{hasError:!1,errorMessage:""}),(0,a.jsx)(tE.RunActionsButtons,{env:E,runId:e,runStatus:V.status,events:$,eventsLoading:K,loading:H,onRerunClick:()=>{C(!0)},onCancelClick:()=>{A(!0)},callbacks:{onSuccess:G},showDebugActions:R})]})]}),(0,a.jsxs)("div",{className:"flex items-start gap-8",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Status"}),V.status?(0,a.jsx)(tm.StatusBadge,{status:V.status,context:V}):(0,a.jsx)(tD.Skeleton,{className:"w-[55px] h-[24px]"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Duration"}),(0,a.jsx)("div",{className:"text-xs",children:V.runId?V.startedAt?(()=>{let e=Math.floor(((V.completedAt?new Date(V.completedAt).getTime():Date.now())-new Date(V.startedAt).getTime())/1e3);if(e<60)return`${e}s`;let t=Math.floor(e/60),r=e%60;if(t<60)return r>0?`${t}m ${r}s`:`${t}m`;let a=Math.floor(t/60),s=t%60;return s>0?`${a}h ${s}m`:`${a}h`})():"-":(0,a.jsx)(tD.Skeleton,{className:"w-[60px] h-[20px]"})})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Run ID"}),V.runId?(0,a.jsx)(tc.CopyableText,{text:V.runId,children:(0,a.jsx)("div",{className:"text-xs mt-0.5 font-mono",children:V.runId})}):(0,a.jsx)(tD.Skeleton,{className:"w-[280px] h-[20px]"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Queued"}),V.createdAt?(0,a.jsx)("div",{className:"text-xs",children:(0,a.jsx)(tp.RelativeTime,{date:V.createdAt})}):(0,a.jsx)(tD.Skeleton,{className:"w-[110px] h-[20px]"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Started"}),(0,a.jsx)("div",{className:"text-xs",children:V.runId?V.startedAt?(0,a.jsx)(tp.RelativeTime,{date:V.startedAt}):"-":(0,a.jsx)(tD.Skeleton,{className:"w-[110px] h-[20px]"})})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Completed"}),(0,a.jsx)("div",{className:"text-xs",children:V.runId?V.completedAt?(0,a.jsx)(tp.RelativeTime,{date:V.completedAt}):"-":(0,a.jsx)(tD.Skeleton,{className:"w-[110px] h-[20px]"})})]}),null!=V.expiredAt&&(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsxs)(ta.Tooltip,{children:[(0,a.jsx)(ta.TooltipTrigger,{asChild:!0,children:(0,a.jsxs)("div",{className:"text-xs text-muted-foreground cursor-help flex items-center gap-1",children:["Expired",(0,a.jsx)(m,{className:"w-3 h-3"})]})}),(0,a.jsx)(ta.TooltipContent,{children:(0,a.jsx)("p",{children:"The storage data for this run has expired and is no longer available."})})]}),(0,a.jsx)("div",{className:"text-xs",children:(0,a.jsx)(tp.RelativeTime,{date:V.expiredAt})})]})]})]})]}),(0,a.jsxs)("div",{className:"mt-4 flex-1 flex flex-col min-h-0",children:[(0,a.jsxs)(tr.Tabs,{value:D,onValueChange:e=>P(e),className:"flex-1 flex flex-col min-h-0",children:[(0,a.jsxs)(tr.TabsList,{className:"mb-4 flex-none",children:[(0,a.jsxs)(tr.TabsTrigger,{value:"trace",className:"gap-2",children:[(0,a.jsx)(f,{className:"h-4 w-4"}),"Trace"]}),F&&(0,a.jsxs)(tr.TabsTrigger,{value:"graph",className:"gap-2",children:[(0,a.jsx)(u.GitBranch,{className:"h-4 w-4"}),"Graph"]}),(0,a.jsxs)(tr.TabsTrigger,{value:"streams",className:"gap-2",children:[(0,a.jsx)(f,{className:"h-4 w-4"}),"Streams"]})]}),(0,a.jsx)(tr.TabsContent,{value:"trace",className:"mt-0 flex-1 min-h-0",children:(0,a.jsx)(s.ErrorBoundary,{title:"Trace Viewer Error",description:"Failed to load trace viewer. Please try refreshing the page.",children:(0,a.jsx)("div",{className:"h-full",children:(0,a.jsx)(i.WorkflowTraceViewer,{error:z,steps:W,events:$,hooks:B,env:E,run:V,isLoading:H,onStreamClick:M})})})}),(0,a.jsx)(tr.TabsContent,{value:"streams",className:"mt-0 flex-1 min-h-0",children:(0,a.jsx)(s.ErrorBoundary,{title:"Streams Error",description:"Failed to load streams. Please try refreshing the page.",children:(0,a.jsxs)("div",{className:"h-full flex gap-4",children:[(0,a.jsxs)("div",{className:"w-64 flex-shrink-0 border rounded-lg overflow-hidden",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-background-100)"},children:[(0,a.jsxs)("div",{className:"px-3 py-2 border-b text-xs font-medium",style:{borderColor:"var(--ds-gray-300)",color:"var(--ds-gray-900)"},children:["Streams (",U.length,")"]}),(0,a.jsx)("div",{className:"overflow-auto max-h-[calc(100vh-400px)]",children:q?(0,a.jsx)("div",{className:"p-4 flex items-center justify-center",children:(0,a.jsx)(x.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):J?(0,a.jsx)("div",{className:"p-4 text-xs text-destructive",children:J.message}):0===U.length?(0,a.jsx)("div",{className:"p-4 text-xs",style:{color:"var(--ds-gray-600)"},children:"No streams found for this run"}):U.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>L(e),className:"w-full text-left px-3 py-2 text-xs font-mono truncate hover:bg-accent transition-colors",style:{backgroundColor:T===e?"var(--ds-gray-200)":"transparent",color:"var(--ds-gray-1000)"},title:e,children:e},e))})]}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:T?(0,a.jsx)(d.StreamViewer,{env:E,streamId:T}):(0,a.jsx)("div",{className:"h-full flex items-center justify-center rounded-lg border",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)"},children:(0,a.jsx)("div",{className:"text-sm",style:{color:"var(--ds-gray-600)"},children:U.length>0?"Select a stream to view its data":"No streams available"})})})]})})}),F&&(0,a.jsx)(tr.TabsContent,{value:"graph",className:"mt-0 flex-1 min-h-0",children:(0,a.jsx)(s.ErrorBoundary,{title:"Graph Viewer Error",description:"Failed to load execution graph. Please try refreshing the page.",children:(0,a.jsx)("div",{className:"h-full min-h-[500px]",children:(0,a.jsx)(tT,{run:V,allSteps:W,allEvents:$,env:E})})})})]}),K&&(0,a.jsxs)("div",{className:"fixed flex items-center gap-2 left-8 bottom-8 bg-background border rounded-md px-4 py-2 shadow-lg",children:[(0,a.jsx)(x.Loader2,{className:"size-4 animate-spin"}),(0,a.jsx)("span",{className:"text-sm",children:"Fetching data..."})]})]})]})]})}var tO=e.i(480462);function tP(){let e=(0,n.useParams)(),[t]=(0,tO.useStepIdState)(),[r]=(0,tO.useEventIdState)(),[o]=(0,tO.useHookIdState)(),l=e.runId;return(0,a.jsx)(s.ErrorBoundary,{title:"Run Detail Error",description:"Failed to load run details. Please try navigating back to the home page.",children:(0,a.jsx)(tR,{runId:l,selectedId:t||r||o||void 0})})}e.s(["default",()=>tP],721969)}]);
@@ -0,0 +1,5 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,330997,e=>{"use strict";let t;var r=e.i(666426);e.i(169764);var s=e.i(545030),a=e.i(868924),n=e.i(531875),o=e.i(932671),l=e.i(176498),i=e.i(687602),d=e.i(886288);let c=(0,d.default)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var u=e.i(524914),m=e.i(495566);let f=(0,d.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 h=e.i(846220),p=e.i(811735),x=e.i(686107),g=e.i(806746),v=e.i(456944),w=e.i(260218),j=e.i(949245);let b=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("div",{ref:s,className:(0,j.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));b.displayName="Card",x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("div",{ref:s,className:(0,j.cn)("flex flex-col space-y-1.5 p-6",e),...t})).displayName="CardHeader",x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("div",{ref:s,className:(0,j.cn)("text-2xl font-semibold leading-none tracking-tight",e),...t})).displayName="CardTitle",x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("div",{ref:s,className:(0,j.cn)("text-sm text-muted-foreground",e),...t})).displayName="CardDescription";let y=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("div",{ref:s,className:(0,j.cn)("p-6 pt-0",e),...t}));y.displayName="CardContent",x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("div",{ref:s,className:(0,j.cn)("flex items-center p-6 pt-0",e),...t})).displayName="CardFooter";var k=e.i(414576);let N=x.forwardRef(({className:e,href:t,children:s,...a},n)=>{let o=t.startsWith("http")?t:`https://useworkflow.dev/docs/${t.replace(/^\//,"")}`;return(0,r.jsx)(k.default,{href:o,className:(0,j.cn)("font-medium underline underline-offset-4 transition-colors",e),style:{color:"var(--ds-blue-600)"},target:"_blank",rel:"noopener noreferrer",ref:n,...a,children:s})});N.displayName="DocsLink";var C=e.i(917955);let S=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:s,className:(0,j.cn)("w-full caption-bottom text-sm",e),...t})}));S.displayName="Table";let R=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("thead",{ref:s,className:(0,j.cn)("[&_tr]:border-b",e),...t}));R.displayName="TableHeader";let E=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("tbody",{ref:s,className:(0,j.cn)("[&_tr:last-child]:border-0",e),...t}));E.displayName="TableBody",x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("tfoot",{ref:s,className:(0,j.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t})).displayName="TableFooter";let I=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("tr",{ref:s,className:(0,j.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));I.displayName="TableRow";let T=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("th",{ref:s,className:(0,j.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));T.displayName="TableHead";let D=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("td",{ref:s,className:(0,j.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));D.displayName="TableCell",x.forwardRef(({className:e,...t},s)=>(0,r.jsx)("caption",{ref:s,className:(0,j.cn)("mt-4 text-sm text-muted-foreground",e),...t})).displayName="TableCaption";var P=e.i(638322),M=e.i(241245),A=e.i(719402),L=e.i(613087);function H({rows:e=j.DEFAULT_PAGE_SIZE,variant:t="runs"}){return(0,r.jsx)(b,{className:"overflow-hidden mt-4 bg-background",children:(0,r.jsxs)(y,{className:"p-0",children:[(()=>{switch(t){case"runs":return(0,r.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,r.jsx)(L.Skeleton,{className:"h-4 w-20"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-14"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-12"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-14"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-20"}),(0,r.jsx)("div",{className:"w-6"})]});case"hooks":return(0,r.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,r.jsx)(L.Skeleton,{className:"h-4 w-16"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-14"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-12"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-14"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-20"}),(0,r.jsx)("div",{className:"w-6"})]});case"workflows":return(0,r.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.5fr] items-center gap-4 py-3 px-4 border-b",children:[(0,r.jsx)(L.Skeleton,{className:"h-4 w-20"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-10"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-12 mx-auto"})]});default:return null}})(),Array.from({length:e},(e,s)=>(e=>{switch(t){case"runs":return(0,r.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.8fr_1fr_1fr_40px] items-center gap-4 py-3 px-4",children:[(0,r.jsx)(L.Skeleton,{className:"h-4 w-3/4"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-4/5"}),(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(L.Skeleton,{className:"h-3 w-14"}),(0,r.jsx)(L.Skeleton,{className:"h-2 w-8"})]}),(0,r.jsx)(L.Skeleton,{className:"h-3 w-3/4"}),(0,r.jsx)(L.Skeleton,{className:"h-3 w-3/4"}),(0,r.jsx)(L.Skeleton,{className:"h-6 w-6 rounded"})]},`skeleton-row-${e}`);case"hooks":return(0,r.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,r.jsx)(L.Skeleton,{className:"h-4 w-4/5"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-4/5"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-3/4"}),(0,r.jsx)(L.Skeleton,{className:"h-3 w-3/4"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-8"}),(0,r.jsx)(L.Skeleton,{className:"h-6 w-6 rounded"})]},`skeleton-row-${e}`);case"workflows":return(0,r.jsxs)("div",{className:"grid grid-cols-[1fr_1.5fr_0.5fr] items-center gap-4 py-3 px-4",children:[(0,r.jsx)(L.Skeleton,{className:"h-4 w-3/4"}),(0,r.jsx)(L.Skeleton,{className:"h-4 w-4/5"}),(0,r.jsx)(L.Skeleton,{className:"h-5 w-16 rounded-full mx-auto"})]},`skeleton-row-${e}`);default:return null}})(s))]})})}function _({runId:e,onHookClick:t,selectedHookId:s}){let[a,d]=(0,x.useState)(()=>new Date),j=(0,x.useMemo)(()=>({}),[]),{data:k,error:L,nextPage:_,previousPage:F,hasNextPage:O,hasPreviousPage:z,reload:B,pageInfo:W}=(0,n.useWorkflowHooks)(j,{runId:e,sortOrder:"desc"}),$=(0,o.useHookActions)({env:j,callbacks:{onSuccess:B}}),K=k.isLoading,U=k.data??[],[V,q]=(0,x.useState)(new Map);return(0,x.useEffect)(()=>{U.length&&(async()=>{let e=new Map;for(let t of U)e.set(t.hookId,{count:0,hasMore:!1,loading:!0});q(e);let t=await Promise.allSettled(U.map(async e=>{try{let t=await (0,l.fetchEventsByCorrelationId)(j,e.hookId,{sortOrder:"asc",limit:100});if(!t.success)return{hookId:e.hookId,count:Error(t.error?.message||"Failed to fetch events"),hasMore:!1};let r=t.data,s=r.data.filter(e=>"hook_received"===e.eventType).length;return{hookId:e.hookId,count:s,hasMore:r.hasMore}}catch(t){return{hookId:e.hookId,count:t,hasMore:!1}}}));q(e=>{let r=new Map(e);for(let e=0;e<t.length;e++){let s=t[e],a=U[e].hookId;"fulfilled"===s.status?r.set(s.value.hookId,{count:s.value.count,hasMore:s.value.hasMore,loading:!1}):r.set(a,{count:0,hasMore:!1,loading:!1})}return r})})()},[U,j]),(0,r.jsxs)("div",{children:[(0,r.jsx)(o.HookResolveModalWrapper,{hookActions:$}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-end gap-2",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Last refreshed"}),a&&(0,r.jsx)(A.RelativeTime,{date:a,className:"text-sm text-muted-foreground",type:"distance"})]}),(0,r.jsx)("div",{className:"flex items-center gap-4",children:(0,r.jsxs)(P.Tooltip,{children:[(0,r.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,r.jsxs)(w.Button,{variant:"outline",size:"sm",onClick:()=>{d(()=>new Date),B()},disabled:K,children:[(0,r.jsx)(f,{className:K?"animate-spin":""}),"Refresh"]})}),(0,r.jsx)(P.TooltipContent,{children:"Note that this resets pages"})]})})]}),L?(0,r.jsxs)(v.Alert,{variant:"destructive",children:[(0,r.jsx)(i.AlertCircle,{className:"h-4 w-4"}),(0,r.jsx)(v.AlertTitle,{children:"Error loading hooks"}),(0,r.jsx)(v.AlertDescription,{children:(0,n.getErrorMessage)(L)})]}):K||U&&0!==U.length?K&&!k?.data?(0,r.jsx)(H,{variant:"hooks"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b,{className:"overflow-hidden mt-4 bg-background",children:(0,r.jsx)(y,{className:"p-0 max-h-[calc(100vh-280px)] overflow-auto",children:(0,r.jsxs)(S,{children:[(0,r.jsx)(R,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Hook ID"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Run ID"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Token"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Created"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Invocations"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10"})]})}),(0,r.jsx)(E,{children:U.map(e=>(0,r.jsxs)(I,{className:"cursor-pointer group relative",onClick:()=>t(e.hookId,e.runId),"data-selected":e.hookId===s,children:[(0,r.jsx)(D,{className:"font-mono text-xs py-2",children:(0,r.jsx)(M.CopyableText,{text:e.hookId,overlay:!0,children:e.hookId})}),(0,r.jsx)(D,{className:"font-mono text-xs py-2",children:(0,r.jsx)(M.CopyableText,{text:e.runId,overlay:!0,children:e.runId})}),(0,r.jsx)(D,{className:"font-mono text-xs py-2",children:(0,r.jsx)(M.CopyableText,{text:e.token,overlay:!0,children:(0,r.jsx)("span",{className:"text-muted-foreground",children:"••••••••••••"})})}),(0,r.jsx)(D,{className:"py-2 text-muted-foreground text-xs",children:e.createdAt?(0,r.jsx)(A.RelativeTime,{date:e.createdAt}):"-"}),(0,r.jsx)(D,{className:"py-2",children:(e=>{let t=V.get(e.hookId);if(!t||t.loading)return(0,r.jsx)("span",{className:"text-muted-foreground text-xs",children:"..."});if(t.count instanceof Error)return(0,r.jsx)("span",{className:"text-muted-foreground",children:"Error"});if(0===t.count)return(0,r.jsx)("span",{className:"text-muted-foreground",children:"0"});let s=t.hasMore?`${t.count}+`:`${t.count}`;return t.hasMore?(0,r.jsxs)(P.Tooltip,{children:[(0,r.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,r.jsx)("span",{className:"font-semibold cursor-help",children:s})}),(0,r.jsx)(P.TooltipContent,{className:"max-w-xs",children:(0,r.jsx)("div",{className:"text-xs",children:"Showing first 100 invocations. There may be more."})})]}):(0,r.jsx)("span",{className:"font-semibold",children:s})})(e)}),(0,r.jsx)(D,{className:"py-2",children:(0,r.jsxs)(C.DropdownMenu,{children:[(0,r.jsx)(C.DropdownMenuTrigger,{asChild:!0,children:(0,r.jsx)(w.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:e=>e.stopPropagation(),children:(0,r.jsx)(m.MoreHorizontal,{className:"h-4 w-4"})})}),(0,r.jsxs)(C.DropdownMenuContent,{align:"end",children:[(0,r.jsx)(o.ResolveHookDropdownItem,{hook:e,stopPropagation:!0,onResolveClick:$.openResolveModal,DropdownMenuItem:C.DropdownMenuItem}),(0,r.jsxs)(C.DropdownMenuItem,{onClick:async t=>{t.stopPropagation();try{let t=await (0,n.recreateRun)(j,e.runId);g.toast.success("New run started",{description:`Run ID: ${t}`}),B()}catch(e){g.toast.error("Failed to re-run",{description:e instanceof Error?e.message:"Unknown error"})}},children:[(0,r.jsx)(h.RotateCw,{className:"h-4 w-4 mr-2"}),"Replay Run"]}),(0,r.jsxs)(C.DropdownMenuItem,{onClick:async t=>{t.stopPropagation();try{await (0,n.cancelRun)(j,e.runId),g.toast.success("Run cancelled"),B()}catch(e){g.toast.error("Failed to cancel",{description:e instanceof Error?e.message:"Unknown error"})}},children:[(0,r.jsx)(p.XCircle,{className:"h-4 w-4 mr-2"}),"Cancel"]})]})]})})]},e.hookId))})]})})}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-4",children:[(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:W}),(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsxs)(w.Button,{variant:"outline",size:"sm",onClick:F,disabled:!z,children:[(0,r.jsx)(c,{}),"Previous"]}),(0,r.jsxs)(w.Button,{variant:"outline",size:"sm",onClick:_,disabled:!O,children:["Next",(0,r.jsx)(u.ChevronRight,{})]})]})]})]}):(0,r.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:["No active hooks found. ",(0,r.jsx)("br",{}),(0,r.jsx)(N,{href:"https://useworkflow.dev/docs/api-reference/workflow/create-hook",children:"Learn how to create a hook"})]})]})}var F=e.i(360088),O=e.i(867652),z=e.i(406358);let B=(0,d.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"}]]),W=(0,d.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 $=e.i(857812),K=e.i(571577);function U(e,[t,r]){return Math.min(r,Math.max(t,e))}var V=e.i(291967),q=e.i(177779),G=e.i(221588),X=e.i(810096),Z=e.i(92581),Y=e.i(975287),J=0;function Q(){x.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ee()),document.body.insertAdjacentElement("beforeend",e[1]??ee()),J++,()=>{1===J&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),J--}},[])}function ee(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var et=e.i(692792),er=e.i(852947),es="focusScope.autoFocusOnMount",ea="focusScope.autoFocusOnUnmount",en={bubbles:!1,cancelable:!0},eo=x.forwardRef((e,t)=>{let{loop:s=!1,trapped:a=!1,onMountAutoFocus:n,onUnmountAutoFocus:o,...l}=e,[i,d]=x.useState(null),c=(0,er.useCallbackRef)(n),u=(0,er.useCallbackRef)(o),m=x.useRef(null),f=(0,G.useComposedRefs)(t,e=>d(e)),h=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(a){let e=function(e){if(h.paused||!i)return;let t=e.target;i.contains(t)?m.current=t:ed(m.current,{select:!0})},t=function(e){if(h.paused||!i)return;let t=e.relatedTarget;null!==t&&(i.contains(t)||ed(m.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&ed(i)});return i&&r.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[a,i,h.paused]),x.useEffect(()=>{if(i){ec.add(h);let e=document.activeElement;if(!i.contains(e)){let t=new CustomEvent(es,en);i.addEventListener(es,c),i.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let s of e)if(ed(s,{select:t}),document.activeElement!==r)return}(el(i).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&ed(i))}return()=>{i.removeEventListener(es,c),setTimeout(()=>{let t=new CustomEvent(ea,en);i.addEventListener(ea,u),i.dispatchEvent(t),t.defaultPrevented||ed(e??document.body,{select:!0}),i.removeEventListener(ea,u),ec.remove(h)},0)}}},[i,c,u,h]);let p=x.useCallback(e=>{if(!s&&!a||h.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){var n;let t,a=e.currentTarget,[o,l]=[ei(t=el(n=a),n),ei(t.reverse(),n)];o&&l?e.shiftKey||r!==l?e.shiftKey&&r===o&&(e.preventDefault(),s&&ed(l,{select:!0})):(e.preventDefault(),s&&ed(o,{select:!0})):r===a&&e.preventDefault()}},[s,a,h.paused]);return(0,r.jsx)(et.Primitive.div,{tabIndex:-1,...l,ref:f,onKeyDown:p})});function el(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function ei(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function ed(e,{select:t=!1}={}){if(e&&e.focus){var r;let s=document.activeElement;e.focus({preventScroll:!0}),e!==s&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}eo.displayName="FocusScope";var ec=(t=[],{add(e){let r=t[0];e!==r&&r?.pause(),(t=eu(t,e)).unshift(e)},remove(e){t=eu(t,e),t[0]?.resume()}});function eu(e,t){let r=[...e],s=r.indexOf(t);return -1!==s&&r.splice(s,1),r}var em=e.i(244107),ef=e.i(509377),eh=e.i(153840),ep=e.i(545136),ex=e.i(802313),eg=e.i(225088),ev=e.i(962687),ew=e.i(73772),ej=e.i(891246),eb=[" ","Enter","ArrowUp","ArrowDown"],ey=[" ","Enter"],ek="Select",[eN,eC,eS]=(0,q.createCollection)(ek),[eR,eE]=(0,X.createContextScope)(ek,[eS,ef.createPopperScope]),eI=(0,ef.createPopperScope)(),[eT,eD]=eR(ek),[eP,eM]=eR(ek),eA=e=>{let{__scopeSelect:t,children:s,open:a,defaultOpen:n,onOpenChange:o,value:l,defaultValue:i,onValueChange:d,dir:c,name:u,autoComplete:m,disabled:f,required:h,form:p}=e,g=eI(t),[v,w]=x.useState(null),[j,b]=x.useState(null),[y,k]=x.useState(!1),N=(0,Z.useDirection)(c),[C,S]=(0,ex.useControllableState)({prop:a,defaultProp:n??!1,onChange:o,caller:ek}),[R,E]=(0,ex.useControllableState)({prop:l,defaultProp:i,onChange:d,caller:ek}),I=x.useRef(null),T=!v||p||!!v.closest("form"),[D,P]=x.useState(new Set),M=Array.from(D).map(e=>e.props.value).join(";");return(0,r.jsx)(ef.Root,{...g,children:(0,r.jsxs)(eT,{required:h,scope:t,trigger:v,onTriggerChange:w,valueNode:j,onValueNodeChange:b,valueNodeHasChildren:y,onValueNodeHasChildrenChange:k,contentId:(0,em.useId)(),value:R,onValueChange:E,open:C,onOpenChange:S,dir:N,triggerPointerDownPosRef:I,disabled:f,children:[(0,r.jsx)(eN.Provider,{scope:t,children:(0,r.jsx)(eP,{scope:e.__scopeSelect,onNativeOptionAdd:x.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:x.useCallback(e=>{P(t=>{let r=new Set(t);return r.delete(e),r})},[]),children:s})}),T?(0,r.jsxs)(td,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:m,value:R,onChange:e=>E(e.target.value),disabled:f,form:p,children:[void 0===R?(0,r.jsx)("option",{value:""}):null,Array.from(D)]},M):null]})})};eA.displayName=ek;var eL="SelectTrigger",eH=x.forwardRef((e,t)=>{let{__scopeSelect:s,disabled:a=!1,...n}=e,o=eI(s),l=eD(eL,s),i=l.disabled||a,d=(0,G.useComposedRefs)(t,l.onTriggerChange),c=eC(s),u=x.useRef("touch"),[m,f,h]=tu(e=>{let t=c().filter(e=>!e.disabled),r=t.find(e=>e.value===l.value),s=tm(t,e,r);void 0!==s&&l.onValueChange(s.value)}),p=e=>{i||(l.onOpenChange(!0),h()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,r.jsx)(ef.Anchor,{asChild:!0,...o,children:(0,r.jsx)(et.Primitive.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":tc(l.value)?"":void 0,...n,ref:d,onClick:(0,V.composeEventHandlers)(n.onClick,e=>{e.currentTarget.focus(),"mouse"!==u.current&&p(e)}),onPointerDown:(0,V.composeEventHandlers)(n.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(p(e),e.preventDefault())}),onKeyDown:(0,V.composeEventHandlers)(n.onKeyDown,e=>{let t=""!==m.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||f(e.key),(!t||" "!==e.key)&&eb.includes(e.key)&&(p(),e.preventDefault())})})})});eH.displayName=eL;var e_="SelectValue",eF=x.forwardRef((e,t)=>{let{__scopeSelect:s,className:a,style:n,children:o,placeholder:l="",...i}=e,d=eD(e_,s),{onValueNodeHasChildrenChange:c}=d,u=void 0!==o,m=(0,G.useComposedRefs)(t,d.onValueNodeChange);return(0,eg.useLayoutEffect)(()=>{c(u)},[c,u]),(0,r.jsx)(et.Primitive.span,{...i,ref:m,style:{pointerEvents:"none"},children:tc(d.value)?(0,r.jsx)(r.Fragment,{children:l}):o})});eF.displayName=e_;var eO=x.forwardRef((e,t)=>{let{__scopeSelect:s,children:a,...n}=e;return(0,r.jsx)(et.Primitive.span,{"aria-hidden":!0,...n,ref:t,children:a||"▼"})});eO.displayName="SelectIcon";var ez=e=>(0,r.jsx)(eh.Portal,{asChild:!0,...e});ez.displayName="SelectPortal";var eB="SelectContent",eW=x.forwardRef((e,t)=>{let s=eD(eB,e.__scopeSelect),[a,n]=x.useState();return((0,eg.useLayoutEffect)(()=>{n(new DocumentFragment)},[]),s.open)?(0,r.jsx)(eV,{...e,ref:t}):a?K.createPortal((0,r.jsx)(e$,{scope:e.__scopeSelect,children:(0,r.jsx)(eN.Slot,{scope:e.__scopeSelect,children:(0,r.jsx)("div",{children:e.children})})}),a):null});eW.displayName=eB;var[e$,eK]=eR(eB),eU=(0,ep.createSlot)("SelectContent.RemoveScroll"),eV=x.forwardRef((e,t)=>{let{__scopeSelect:s,position:a="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:o,onPointerDownOutside:l,side:i,sideOffset:d,align:c,alignOffset:u,arrowPadding:m,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:g,avoidCollisions:v,...w}=e,j=eD(eB,s),[b,y]=x.useState(null),[k,N]=x.useState(null),C=(0,G.useComposedRefs)(t,e=>y(e)),[S,R]=x.useState(null),[E,I]=x.useState(null),T=eC(s),[D,P]=x.useState(!1),M=x.useRef(!1);x.useEffect(()=>{if(b)return(0,ew.hideOthers)(b)},[b]),Q();let A=x.useCallback(e=>{let[t,...r]=T().map(e=>e.ref.current),[s]=r.slice(-1),a=document.activeElement;for(let r of e)if(r===a||(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===s&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a))return},[T,k]),L=x.useCallback(()=>A([S,b]),[A,S,b]);x.useEffect(()=>{D&&L()},[D,L]);let{onOpenChange:H,triggerPointerDownPosRef:_}=j;x.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(_.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(_.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():b.contains(r.target)||H(!1),document.removeEventListener("pointermove",t),_.current=null};return null!==_.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[b,H,_]),x.useEffect(()=>{let e=()=>H(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[H]);let[F,O]=tu(e=>{let t=T().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),s=tm(t,e,r);s&&setTimeout(()=>s.ref.current.focus())}),z=x.useCallback((e,t,r)=>{let s=!M.current&&!r;(void 0!==j.value&&j.value===t||s)&&(R(e),s&&(M.current=!0))},[j.value]),B=x.useCallback(()=>b?.focus(),[b]),W=x.useCallback((e,t,r)=>{let s=!M.current&&!r;(void 0!==j.value&&j.value===t||s)&&I(e)},[j.value]),$="popper"===a?eG:eq,K=$===eG?{side:i,sideOffset:d,align:c,alignOffset:u,arrowPadding:m,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:g,avoidCollisions:v}:{};return(0,r.jsx)(e$,{scope:s,content:b,viewport:k,onViewportChange:N,itemRefCallback:z,selectedItem:S,onItemLeave:B,itemTextRefCallback:W,focusSelectedItem:L,selectedItemText:E,position:a,isPositioned:D,searchRef:F,children:(0,r.jsx)(ej.RemoveScroll,{as:eU,allowPinchZoom:!0,children:(0,r.jsx)(eo,{asChild:!0,trapped:j.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:(0,V.composeEventHandlers)(n,e=>{j.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,r.jsx)(Y.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:(0,r.jsx)($,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:e=>e.preventDefault(),...w,...K,onPlaced:()=>P(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:(0,V.composeEventHandlers)(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||O(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let r=e.target,s=t.indexOf(r);t=t.slice(s+1)}setTimeout(()=>A(t)),e.preventDefault()}})})})})})})});eV.displayName="SelectContentImpl";var eq=x.forwardRef((e,t)=>{let{__scopeSelect:s,onPlaced:a,...n}=e,o=eD(eB,s),l=eK(eB,s),[i,d]=x.useState(null),[c,u]=x.useState(null),m=(0,G.useComposedRefs)(t,e=>u(e)),f=eC(s),h=x.useRef(!1),p=x.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:w,focusSelectedItem:j}=l,b=x.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&c&&g&&v&&w){let e=o.trigger.getBoundingClientRect(),t=c.getBoundingClientRect(),r=o.valueNode.getBoundingClientRect(),s=w.getBoundingClientRect();if("rtl"!==o.dir){let a=s.left-t.left,n=r.left-a,o=e.left-n,l=e.width+o,d=Math.max(l,t.width),c=U(n,[10,Math.max(10,window.innerWidth-10-d)]);i.style.minWidth=l+"px",i.style.left=c+"px"}else{let a=t.right-s.right,n=window.innerWidth-r.right-a,o=window.innerWidth-e.right-n,l=e.width+o,d=Math.max(l,t.width),c=U(n,[10,Math.max(10,window.innerWidth-10-d)]);i.style.minWidth=l+"px",i.style.right=c+"px"}let n=f(),l=window.innerHeight-20,d=g.scrollHeight,u=window.getComputedStyle(c),m=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),x=parseInt(u.borderBottomWidth,10),j=m+p+d+parseInt(u.paddingBottom,10)+x,b=Math.min(5*v.offsetHeight,j),y=window.getComputedStyle(g),k=parseInt(y.paddingTop,10),N=parseInt(y.paddingBottom,10),C=e.top+e.height/2-10,S=v.offsetHeight/2,R=m+p+(v.offsetTop+S);if(R<=C){let e=n.length>0&&v===n[n.length-1].ref.current;i.style.bottom="0px";let t=Math.max(l-C,S+(e?N:0)+(c.clientHeight-g.offsetTop-g.offsetHeight)+x);i.style.height=R+t+"px"}else{let e=n.length>0&&v===n[0].ref.current;i.style.top="0px";let t=Math.max(C,m+g.offsetTop+(e?k:0)+S);i.style.height=t+(j-R)+"px",g.scrollTop=R-C+g.offsetTop}i.style.margin="10px 0",i.style.minHeight=b+"px",i.style.maxHeight=l+"px",a?.(),requestAnimationFrame(()=>h.current=!0)}},[f,o.trigger,o.valueNode,i,c,g,v,w,o.dir,a]);(0,eg.useLayoutEffect)(()=>b(),[b]);let[y,k]=x.useState();(0,eg.useLayoutEffect)(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);let N=x.useCallback(e=>{e&&!0===p.current&&(b(),j?.(),p.current=!1)},[b,j]);return(0,r.jsx)(eX,{scope:s,contentWrapper:i,shouldExpandOnScrollRef:h,onScrollButtonChange:N,children:(0,r.jsx)("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:y},children:(0,r.jsx)(et.Primitive.div,{...n,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});eq.displayName="SelectItemAlignedPosition";var eG=x.forwardRef((e,t)=>{let{__scopeSelect:s,align:a="start",collisionPadding:n=10,...o}=e,l=eI(s);return(0,r.jsx)(ef.Content,{...l,...o,ref:t,align:a,collisionPadding:n,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});eG.displayName="SelectPopperPosition";var[eX,eZ]=eR(eB,{}),eY="SelectViewport",eJ=x.forwardRef((e,t)=>{let{__scopeSelect:s,nonce:a,...n}=e,o=eK(eY,s),l=eZ(eY,s),i=(0,G.useComposedRefs)(t,o.onViewportChange),d=x.useRef(0);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),(0,r.jsx)(eN.Slot,{scope:s,children:(0,r.jsx)(et.Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:(0,V.composeEventHandlers)(n.onScroll,e=>{let t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:s}=l;if(s?.current&&r){let e=Math.abs(d.current-t.scrollTop);if(e>0){let s=window.innerHeight-20,a=Math.max(parseFloat(r.style.minHeight),parseFloat(r.style.height));if(a<s){let n=a+e,o=Math.min(s,n),l=n-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=l>0?l:0,r.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});eJ.displayName=eY;var eQ="SelectGroup",[e0,e1]=eR(eQ);x.forwardRef((e,t)=>{let{__scopeSelect:s,...a}=e,n=(0,em.useId)();return(0,r.jsx)(e0,{scope:s,id:n,children:(0,r.jsx)(et.Primitive.div,{role:"group","aria-labelledby":n,...a,ref:t})})}).displayName=eQ;var e4="SelectLabel",e2=x.forwardRef((e,t)=>{let{__scopeSelect:s,...a}=e,n=e1(e4,s);return(0,r.jsx)(et.Primitive.div,{id:n.id,...a,ref:t})});e2.displayName=e4;var e5="SelectItem",[e6,e8]=eR(e5),e3=x.forwardRef((e,t)=>{let{__scopeSelect:s,value:a,disabled:n=!1,textValue:o,...l}=e,i=eD(e5,s),d=eK(e5,s),c=i.value===a,[u,m]=x.useState(o??""),[f,h]=x.useState(!1),p=(0,G.useComposedRefs)(t,e=>d.itemRefCallback?.(e,a,n)),g=(0,em.useId)(),v=x.useRef("touch"),w=()=>{n||(i.onValueChange(a),i.onOpenChange(!1))};if(""===a)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,r.jsx)(e6,{scope:s,value:a,disabled:n,textId:g,isSelected:c,onItemTextChange:x.useCallback(e=>{m(t=>t||(e?.textContent??"").trim())},[]),children:(0,r.jsx)(eN.ItemSlot,{scope:s,value:a,disabled:n,textValue:u,children:(0,r.jsx)(et.Primitive.div,{role:"option","aria-labelledby":g,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...l,ref:p,onFocus:(0,V.composeEventHandlers)(l.onFocus,()=>h(!0)),onBlur:(0,V.composeEventHandlers)(l.onBlur,()=>h(!1)),onClick:(0,V.composeEventHandlers)(l.onClick,()=>{"mouse"!==v.current&&w()}),onPointerUp:(0,V.composeEventHandlers)(l.onPointerUp,()=>{"mouse"===v.current&&w()}),onPointerDown:(0,V.composeEventHandlers)(l.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:(0,V.composeEventHandlers)(l.onPointerMove,e=>{v.current=e.pointerType,n?d.onItemLeave?.():"mouse"===v.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:(0,V.composeEventHandlers)(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:(0,V.composeEventHandlers)(l.onKeyDown,e=>{(d.searchRef?.current===""||" "!==e.key)&&(ey.includes(e.key)&&w()," "===e.key&&e.preventDefault())})})})})});e3.displayName=e5;var e7="SelectItemText",e9=x.forwardRef((e,t)=>{let{__scopeSelect:s,className:a,style:n,...o}=e,l=eD(e7,s),i=eK(e7,s),d=e8(e7,s),c=eM(e7,s),[u,m]=x.useState(null),f=(0,G.useComposedRefs)(t,e=>m(e),d.onItemTextChange,e=>i.itemTextRefCallback?.(e,d.value,d.disabled)),h=u?.textContent,p=x.useMemo(()=>(0,r.jsx)("option",{value:d.value,disabled:d.disabled,children:h},d.value),[d.disabled,d.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=c;return(0,eg.useLayoutEffect)(()=>(g(p),()=>v(p)),[g,v,p]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(et.Primitive.span,{id:d.textId,...o,ref:f}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?K.createPortal(o.children,l.valueNode):null]})});e9.displayName=e7;var te="SelectItemIndicator",tt=x.forwardRef((e,t)=>{let{__scopeSelect:s,...a}=e;return e8(te,s).isSelected?(0,r.jsx)(et.Primitive.span,{"aria-hidden":!0,...a,ref:t}):null});tt.displayName=te;var tr="SelectScrollUpButton",ts=x.forwardRef((e,t)=>{let s=eK(tr,e.__scopeSelect),a=eZ(tr,e.__scopeSelect),[n,o]=x.useState(!1),l=(0,G.useComposedRefs)(t,a.onScrollButtonChange);return(0,eg.useLayoutEffect)(()=>{if(s.viewport&&s.isPositioned){let e=function(){o(t.scrollTop>0)},t=s.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[s.viewport,s.isPositioned]),n?(0,r.jsx)(to,{...e,ref:l,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=s;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});ts.displayName=tr;var ta="SelectScrollDownButton",tn=x.forwardRef((e,t)=>{let s=eK(ta,e.__scopeSelect),a=eZ(ta,e.__scopeSelect),[n,o]=x.useState(!1),l=(0,G.useComposedRefs)(t,a.onScrollButtonChange);return(0,eg.useLayoutEffect)(()=>{if(s.viewport&&s.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)},t=s.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[s.viewport,s.isPositioned]),n?(0,r.jsx)(to,{...e,ref:l,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=s;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});tn.displayName=ta;var to=x.forwardRef((e,t)=>{let{__scopeSelect:s,onAutoScroll:a,...n}=e,o=eK("SelectScrollButton",s),l=x.useRef(null),i=eC(s),d=x.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return x.useEffect(()=>()=>d(),[d]),(0,eg.useLayoutEffect)(()=>{let e=i().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[i]),(0,r.jsx)(et.Primitive.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:(0,V.composeEventHandlers)(n.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(a,50))}),onPointerMove:(0,V.composeEventHandlers)(n.onPointerMove,()=>{o.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(a,50))}),onPointerLeave:(0,V.composeEventHandlers)(n.onPointerLeave,()=>{d()})})}),tl=x.forwardRef((e,t)=>{let{__scopeSelect:s,...a}=e;return(0,r.jsx)(et.Primitive.div,{"aria-hidden":!0,...a,ref:t})});tl.displayName="SelectSeparator";var ti="SelectArrow";x.forwardRef((e,t)=>{let{__scopeSelect:s,...a}=e,n=eI(s),o=eD(ti,s),l=eK(ti,s);return o.open&&"popper"===l.position?(0,r.jsx)(ef.Arrow,{...n,...a,ref:t}):null}).displayName=ti;var td=x.forwardRef(({__scopeSelect:e,value:t,...s},a)=>{let n,o=x.useRef(null),l=(0,G.useComposedRefs)(a,o),i=(n=x.useRef({value:t,previous:t}),x.useMemo(()=>(n.current.value!==t&&(n.current.previous=n.current.value,n.current.value=t),n.current.previous),[t]));return x.useEffect(()=>{let e=o.current;if(!e)return;let r=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(i!==t&&r){let s=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(s)}},[i,t]),(0,r.jsx)(et.Primitive.select,{...s,style:{...ev.VISUALLY_HIDDEN_STYLES,...s.style},ref:l,defaultValue:t})});function tc(e){return""===e||void 0===e}function tu(e){let t=(0,er.useCallbackRef)(e),r=x.useRef(""),s=x.useRef(0),a=x.useCallback(e=>{let a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(s.current),""!==t&&(s.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),n=x.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,a,n]}function tm(e,t,r){var s,a;let n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=r?e.indexOf(r):-1,l=(s=e,a=Math.max(o,0),s.map((e,t)=>s[(a+t)%s.length]));1===n.length&&(l=l.filter(e=>e!==r));let i=l.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}td.displayName="SelectBubbleInput";var tf=e.i(613671);let th=(0,d.default)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),tp=(0,d.default)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),tx=x.forwardRef(({className:e,children:t,...s},a)=>(0,r.jsxs)(eH,{ref:a,className:(0,j.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...s,children:[t,(0,r.jsx)(eO,{asChild:!0,children:(0,r.jsx)(th,{className:"h-4 w-4 opacity-50"})})]}));tx.displayName=eH.displayName;let tg=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)(ts,{ref:s,className:(0,j.cn)("flex cursor-default items-center justify-center py-1",e),...t,children:(0,r.jsx)(tp,{className:"h-4 w-4"})}));tg.displayName=ts.displayName;let tv=x.forwardRef(({className:e,...t},s)=>(0,r.jsx)(tn,{ref:s,className:(0,j.cn)("flex cursor-default items-center justify-center py-1",e),...t,children:(0,r.jsx)(th,{className:"h-4 w-4"})}));tv.displayName=tn.displayName;let tw=x.forwardRef(({className:e,children:t,position:s="popper",...a},n)=>(0,r.jsx)(ez,{children:(0,r.jsxs)(eW,{ref:n,className:(0,j.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...a,children:[(0,r.jsx)(tg,{}),(0,r.jsx)(eJ,{className:(0,j.cn)("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,r.jsx)(tv,{})]})}));tw.displayName=eW.displayName,x.forwardRef(({className:e,...t},s)=>(0,r.jsx)(e2,{ref:s,className:(0,j.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=e2.displayName;let tj=x.forwardRef(({className:e,children:t,...s},a)=>(0,r.jsxs)(e3,{ref:a,className:(0,j.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(tt,{children:(0,r.jsx)(tf.Check,{className:"h-4 w-4"})})}),(0,r.jsx)(e9,{children:t})]}));tj.displayName=e3.displayName,x.forwardRef(({className:e,...t},s)=>(0,r.jsx)(tl,{ref:s,className:(0,j.cn)("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=tl.displayName;var tb=e.i(335468),ty=e.i(202311);ty.callServer,ty.findSourceMapURL;var tk=(0,ty.createServerReference)("4067de1e709dd422a94e62d096bf963fff48ce3e46",ty.callServer,void 0,ty.findSourceMapURL,"resolveDataDirInfo"),tN=e.i(714594),tC=e.i(259280);function tS({selectionCount:e,onClearSelection:t,actions:s,itemLabel:a="items",className:n}){if(0===e)return null;let o=1===e?a.replace(/s$/,""):a;return(0,r.jsxs)("div",{className:(0,j.cn)("fixed bottom-6 left-1/2 -translate-x-1/2 z-50","flex items-center gap-3 px-4 py-2.5 rounded-lg","bg-primary text-primary-foreground shadow-lg","animate-in fade-in slide-in-from-bottom-4 duration-200",n),children:[(0,r.jsxs)("span",{className:"text-sm font-medium",children:[e," ",o," selected"]}),s&&(0,r.jsx)("div",{className:"flex items-center gap-2 border-l border-primary-foreground/20 pl-3",children:s}),(0,r.jsxs)(w.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground",onClick:t,children:[(0,r.jsx)(tC.X,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Clear selection"})]})]})}var tR=e.i(451675),tE=e.i(708341),tI=e.i(652773),tT=e.i(961612),tD=e.i(178896),tP=e.i(676977),tM=e.i(869676),tA=e.i(224285),tL=e.i(656900),tH="Checkbox",[t_,tF]=(0,tT.createContextScope)(tH),[tO,tz]=t_(tH),tB=x.forwardRef((e,t)=>{let{__scopeCheckbox:s,name:a,checked:n,defaultChecked:o,required:l,disabled:i,value:d="on",onCheckedChange:c,form:u,...m}=e,[f,h]=x.useState(null),p=(0,tI.useComposedRefs)(t,e=>h(e)),g=x.useRef(!1),v=!f||u||!!f.closest("form"),[w=!1,j]=(0,tP.useControllableState)({prop:n,defaultProp:o,onChange:c}),b=x.useRef(w);return x.useEffect(()=>{let e=f?.form;if(e){let t=()=>j(b.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[f,j]),(0,r.jsxs)(tO,{scope:s,state:w,disabled:i,children:[(0,r.jsx)(tL.Primitive.button,{type:"button",role:"checkbox","aria-checked":tU(w)?"mixed":w,"aria-required":l,"data-state":tV(w),"data-disabled":i?"":void 0,disabled:i,value:d,...m,ref:p,onKeyDown:(0,tD.composeEventHandlers)(e.onKeyDown,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,tD.composeEventHandlers)(e.onClick,e=>{j(e=>!!tU(e)||!e),v&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),v&&(0,r.jsx)(tK,{control:f,bubbles:!g.current,name:a,value:d,checked:w,required:l,disabled:i,form:u,style:{transform:"translateX(-100%)"},defaultChecked:!tU(o)&&o})]})});tB.displayName=tH;var tW="CheckboxIndicator",t$=x.forwardRef((e,t)=>{let{__scopeCheckbox:s,forceMount:a,...n}=e,o=tz(tW,s);return(0,r.jsx)(tA.Presence,{present:a||tU(o.state)||!0===o.state,children:(0,r.jsx)(tL.Primitive.span,{"data-state":tV(o.state),"data-disabled":o.disabled?"":void 0,...n,ref:t,style:{pointerEvents:"none",...e.style}})})});t$.displayName=tW;var tK=e=>{let t,{control:s,checked:a,bubbles:n=!0,defaultChecked:o,...l}=e,i=x.useRef(null),d=(t=x.useRef({value:a,previous:a}),x.useMemo(()=>(t.current.value!==a&&(t.current.previous=t.current.value,t.current.value=a),t.current.previous),[a])),c=(0,tM.useSize)(s);x.useEffect(()=>{let e=i.current,t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(d!==a&&t){let r=new Event("click",{bubbles:n});e.indeterminate=tU(a),t.call(e,!tU(a)&&a),e.dispatchEvent(r)}},[d,a,n]);let u=x.useRef(!tU(a)&&a);return(0,r.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??u.current,...l,tabIndex:-1,ref:i,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function tU(e){return"indeterminate"===e}function tV(e){return tU(e)?"indeterminate":e?"checked":"unchecked"}let tq=(0,d.default)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),tG=x.forwardRef(({className:e,checked:t,indeterminate:s,onCheckedChange:a,...n},o)=>{let l=x.useId(),i=n.id??l;return(0,r.jsx)("label",{htmlFor:i,className:"p-2 -m-2 inline-flex items-center justify-center cursor-pointer",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,r.jsx)(tB,{ref:o,id:i,checked:s?"indeterminate":t??!1,onCheckedChange:e=>{a?.(!0===e)},className:(0,j.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground","data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground",e),...n,children:(0,r.jsx)(t$,{className:"flex items-center justify-center text-current",children:s?(0,r.jsx)(tq,{className:"h-3.5 w-3.5"}):(0,r.jsx)(tf.Check,{className:"h-3.5 w-3.5"})})})})});function tX({env:e,runId:t,runStatus:s,onSuccess:a,showDebugActions:n}){let[o,l]=(0,x.useState)(void 0),[i,d]=(0,x.useState)(!0),[c,u]=(0,x.useState)(void 0),m=c?.status||s;return(0,x.useEffect)(()=>{d(!0),Promise.all([(0,z.fetchRun)(e,t,"none"),(0,O.fetchEvents)(e,t,{limit:1e3,sortOrder:"desc"})]).then(([e,t])=>{e.success&&u(e.data),t.success&&l(t.data.data)}).catch(e=>{console.error("Failed to fetch run or events:",e)}).finally(()=>{d(!1)})},[e,t]),(0,r.jsx)(tE.RunActionsDropdownItems,{env:e,runId:t,runStatus:m,events:o,eventsLoading:i,stopPropagation:!0,callbacks:{onSuccess:a},showDebugActions:n})}function tZ({env:e,runId:t,runStatus:s,onSuccess:a,showDebugActions:n}){let[o,l]=(0,x.useState)(!1);return(0,r.jsxs)(C.DropdownMenu,{open:o,onOpenChange:l,children:[(0,r.jsx)(C.DropdownMenuTrigger,{asChild:!0,children:(0,r.jsx)(w.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:e=>e.stopPropagation(),children:(0,r.jsx)(m.MoreHorizontal,{className:"h-4 w-4"})})}),o&&(0,r.jsx)(C.DropdownMenuContent,{align:"end",children:(0,r.jsx)(tX,{env:e,runId:t,runStatus:s,onSuccess:a,showDebugActions:n})})]})}tG.displayName="Checkbox";let tY={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"},cancelled:{label:"Cancelled",color:"bg-gray-600 dark:bg-gray-400"}};function tJ({workflowNameFilter:e,status:t,seenWorkflowNames:s,sortOrder:a,loading:n,statusFilterRequiresWorkflowNameFilter:o,onWorkflowChange:l,onStatusChange:i,onSortToggle:d,onRefresh:c,lastRefreshTime:u}){return(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-end gap-2",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Last refreshed"}),u&&(0,r.jsx)(A.RelativeTime,{date:u,className:"text-sm text-muted-foreground",type:"distance"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)(eA,{value:e??"all",onValueChange:l,disabled:n,children:[(0,r.jsx)(tx,{className:"w-[180px] h-9",children:(0,r.jsx)(eF,{placeholder:"Filter by workflow"})}),(0,r.jsxs)(tw,{children:[(0,r.jsx)(tj,{value:"all",children:"All Workflows"}),Array.from(s).sort().map(e=>(0,r.jsx)(tj,{value:e,children:(0,F.parseWorkflowName)(e)?.shortName||e},e))]})]}),(0,r.jsxs)(P.Tooltip,{children:[(0,r.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,r.jsx)("div",{children:(0,r.jsxs)(eA,{value:t||"all",onValueChange:i,disabled:n||o&&!e,children:[(0,r.jsx)(tx,{className:"w-[140px] h-9",children:(0,r.jsx)(eF,{placeholder:"Filter by status"})}),(0,r.jsxs)(tw,{children:[(0,r.jsx)(tj,{value:"all",children:"Any status"}),Object.entries(tY).map(([e,{label:t,color:s}])=>(0,r.jsx)(tj,{value:e,children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:`${s} size-1.5 rounded-full mr-2`}),t]})},e))]})]})})}),(0,r.jsx)(P.TooltipContent,{children:o&&"all"===e?"Select a workflow first to filter by status":"Filter runs by status"})]}),(0,r.jsxs)(P.Tooltip,{children:[(0,r.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,r.jsxs)(w.Button,{variant:"outline",size:"sm",onClick:d,disabled:n,children:["desc"===a?(0,r.jsx)(B,{className:"h-4 w-4"}):(0,r.jsx)(W,{className:"h-4 w-4"}),"desc"===a?"Newest":"Oldest"]})}),(0,r.jsx)(P.TooltipContent,{children:"desc"===a?"Showing newest first":"Showing oldest first"})]}),(0,r.jsxs)(P.Tooltip,{children:[(0,r.jsx)(P.TooltipTrigger,{asChild:!0,children:(0,r.jsxs)(w.Button,{variant:"outline",size:"sm",onClick:c,disabled:n,children:[(0,r.jsx)(f,{className:n?"animate-spin":""}),"Refresh"]})}),(0,r.jsx)(P.TooltipContent,{children:"Note that this resets pages"})]})]})]})}function tQ({onRunClick:e}){var t;let s,o,l,d,m,f,h=(0,a.useSearchParams)(),j=(s=(0,a.useRouter)(),o=(0,a.usePathname)(),l=(0,a.useSearchParams)(),(0,x.useCallback)(e=>{let t=new URLSearchParams(l.toString());"all"===e?(t.delete("workflow"),t.delete("status")):t.set("workflow",e),s.push(`${o}?${t.toString()}`)},[s,o,l])),k=(d=(0,a.useRouter)(),m=(0,a.usePathname)(),f=(0,a.useSearchParams)(),(0,x.useCallback)(e=>{let t=new URLSearchParams(f.toString());"all"===e?t.delete("status"):t.set("status",e),d.push(`${m}?${t.toString()}`)},[d,m,f])),{serverConfig:N}=(0,tN.useServerConfig)(),C=h.get("status"),P=Object.keys(tY),L="all"===C||C&&P.includes(C)?C:void 0,_=h.get("workflow"),O="1"===h.get("debug"),[z,B]=(0,x.useState)("desc"),[W,K]=(0,x.useState)(()=>new Date),U=(0,x.useMemo)(()=>({}),[]),V="local"===N.backendId||"@workflow/world-local"===N.backendId,{data:q,isLoading:G}=(t=N.displayInfo.dataDir??"",(0,tb.default)(t?`data-dir-info:${t}`:"data-dir-info:cwd",()=>tk(t),{revalidateOnFocus:!1})),X=N.backendId?.includes("vercel")||!1,[Z,Y]=(0,x.useState)(new Set),{data:J,error:Q,nextPage:ee,previousPage:et,hasNextPage:er,hasPreviousPage:es,reload:ea,pageInfo:en}=(0,n.useWorkflowRuns)(U,{sortOrder:z,workflowName:"all"===_?void 0:_,status:"all"===L?void 0:L}),eo=function({getItemId:e}){let[t,r]=(0,x.useState)(new Set),s=(0,x.useCallback)(r=>t.has(e(r)),[t,e]),a=(0,x.useCallback)(t=>{let s=e(t);r(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},[e]),n=(0,x.useCallback)(t=>{r(new Set(t.map(e)))},[e]),o=(0,x.useCallback)(()=>{r(new Set)},[]),l=(0,x.useCallback)(r=>0!==r.length&&r.every(r=>t.has(e(r))),[t,e]),i=(0,x.useCallback)(r=>{if(0===r.length)return!1;let s=r.some(r=>t.has(e(r))),a=r.every(r=>t.has(e(r)));return s&&!a},[t,e]),d=(0,x.useCallback)(e=>{l(e)?o():n(e)},[l,o,n]),c=(0,x.useCallback)(e=>{r(t=>{let r=new Set(t);return r.add(e),r})},[]),u=(0,x.useCallback)(e=>{r(t=>{let r=new Set(t);return r.delete(e),r})},[]),m=t.size;return(0,x.useMemo)(()=>({selectedIds:t,isSelected:s,toggleSelection:a,selectAll:n,clearSelection:o,toggleSelectAll:d,selectionCount:m,isAllSelected:l,isSomeSelected:i,selectById:c,deselectById:u}),[t,s,a,n,o,d,m,l,i,c,u])}({getItemId:e=>e.runId}),el=J.data??[],[ei,ed]=(0,x.useState)(!1),ec=V&&(!q?.dataDir||!J?.data?.length)&&!G;(0,x.useEffect)(()=>{if(J.data&&J.data.length>0){let e=new Set(J.data.map(e=>e.workflowName));Y(t=>{let r=new Set(t);for(let t of e)r.add(t);return r})}},[J.data]);let eu=J.isLoading,em=(0,x.useCallback)(()=>{K(()=>new Date),ea()},[ea]),ef=(0,x.useMemo)(()=>el.filter(e=>eo.selectedIds.has(e.runId)),[el,eo.selectedIds]),eh=(0,x.useMemo)(()=>ef.filter(e=>"pending"===e.status||"running"===e.status),[ef]),ep=eh.length>0,ex=(0,x.useCallback)(async()=>{if(!ei&&0!==eh.length){ed(!0);try{let e=await Promise.allSettled(eh.map(e=>(0,n.cancelRun)(U,e.runId))),t=e.filter(e=>"fulfilled"===e.status).length,r=e.filter(e=>"rejected"===e.status).length;0===r?g.toast.success(`Cancelled ${t} run${1!==t?"s":""}`):0===t?g.toast.error(`Failed to cancel ${r} run${1!==r?"s":""}`):g.toast.warning(`Cancelled ${t} run${1!==t?"s":""}, ${r} failed`),eo.clearSelection(),em()}catch(e){g.toast.error("Failed to cancel runs",{description:e instanceof Error?e.message:"Unknown error"})}finally{ed(!1)}}},[U,eh,ei,eo,em]);(0,x.useEffect)(()=>{if(ec){let e=setInterval(()=>{em()},3e3);return()=>clearInterval(e)}},[ec,em]),(0,x.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&W&&Date.now()-W.getTime()>=1e4&&em()};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[W,em]);let eg=(0,r.jsx)("code",{className:"font-mono",children:q?.shortName||"current directory"});return(0,r.jsxs)("div",{children:[(0,r.jsx)(tJ,{workflowNameFilter:_,status:L,seenWorkflowNames:Z,sortOrder:z,loading:eu,statusFilterRequiresWorkflowNameFilter:X,onWorkflowChange:j,onStatusChange:k,onSortToggle:()=>{B(e=>"desc"===e?"asc":"desc")},onRefresh:em,lastRefreshTime:W}),Q?(0,r.jsxs)(v.Alert,{variant:"destructive",children:[(0,r.jsx)(i.AlertCircle,{className:"h-4 w-4"}),(0,r.jsx)(v.AlertTitle,{children:"Error loading runs"}),(0,r.jsx)(v.AlertDescription,{children:(0,n.getErrorMessage)(Q)})]}):eu&&!J?.data?(0,r.jsx)(H,{}):eu||J.data&&0!==J.data.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b,{className:"overflow-hidden mt-4 bg-background",children:(0,r.jsx)(y,{className:"p-0 max-h-[calc(100vh-280px)] overflow-auto",children:(0,r.jsxs)(S,{children:[(0,r.jsx)(R,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10",children:(0,r.jsx)(tG,{checked:eo.isAllSelected(el),indeterminate:eo.isSomeSelected(el),onCheckedChange:()=>eo.toggleSelectAll(el),"aria-label":"Select all runs"})}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Workflow"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Run ID"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Status"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Started"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Completed"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10 w-10"})]})}),(0,r.jsx)(E,{children:el.map(t=>(0,r.jsxs)(I,{className:"cursor-pointer group relative",onClick:()=>e(t.runId),"data-selected":eo.isSelected(t),children:[(0,r.jsx)(D,{className:"py-2",children:(0,r.jsx)(tG,{checked:eo.isSelected(t),onCheckedChange:()=>eo.toggleSelection(t),"aria-label":`Select run ${t.runId}`})}),(0,r.jsx)(D,{className:"py-2",children:(0,r.jsx)(M.CopyableText,{text:t.workflowName,overlay:!0,children:(0,F.parseWorkflowName)(t.workflowName)?.shortName||"?"})}),(0,r.jsx)(D,{className:"font-mono text-xs py-2",children:(0,r.jsx)(M.CopyableText,{text:t.runId,overlay:!0,children:t.runId})}),(0,r.jsx)(D,{className:"py-2",children:(0,r.jsx)(tR.StatusBadge,{status:t.status,context:t,durationMs:t.startedAt?(t.completedAt?new Date(t.completedAt).getTime():Date.now())-new Date(t.startedAt).getTime():void 0})}),(0,r.jsx)(D,{className:"py-2 text-muted-foreground text-xs",children:t.startedAt?(0,r.jsx)(A.RelativeTime,{date:t.startedAt}):"-"}),(0,r.jsx)(D,{className:"py-2 text-muted-foreground text-xs",children:t.completedAt?(0,r.jsx)(A.RelativeTime,{date:t.completedAt}):"-"}),(0,r.jsx)(D,{className:"py-2",children:(0,r.jsx)(tZ,{env:U,runId:t.runId,runStatus:t.status,onSuccess:em,showDebugActions:O})})]},t.runId))})]})})}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-4",children:[(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:en}),(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsxs)(w.Button,{variant:"outline",size:"sm",onClick:et,disabled:!es,children:[(0,r.jsx)(c,{}),"Previous"]}),(0,r.jsxs)(w.Button,{variant:"outline",size:"sm",onClick:ee,disabled:!er,children:["Next",(0,r.jsx)(u.ChevronRight,{})]})]})]})]}):(0,r.jsxs)("div",{className:"text-sm text-center py-8 text-muted-foreground flex flex-col items-center justify-center gap-3",children:[(0,r.jsxs)("span",{className:"text-sm",children:["No workflow runs found",ec?(0,r.jsxs)(r.Fragment,{children:[" in ",eg]}):"","."]}),ec&&(0,r.jsx)("span",{className:"text-sm flex items-center gap-2",children:"This view will update once you run a workflow."})]}),(0,r.jsx)(tS,{selectionCount:eo.selectionCount,onClearSelection:eo.clearSelection,itemLabel:"runs",actions:ep&&(0,r.jsxs)(w.Button,{variant:"ghost",size:"sm",className:"h-7 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground",onClick:ex,disabled:ei,children:[ei?(0,r.jsx)($.Loader2,{className:"h-4 w-4 mr-1 animate-spin"}):(0,r.jsx)(p.XCircle,{className:"h-4 w-4 mr-1"}),"Cancel"," ",eh.length!==eo.selectionCount?`${eh.length} `:"",ei?"cancelling...":""]})})]})}var t0=e.i(889840);e.i(418669);var t1=e.i(655809),t4=e.i(400138);let t2=(0,d.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 t5=e.i(93698),t6=e.i(562918),t8=e.i(110515),t3="Dialog",[t7,t9]=(0,X.createContextScope)(t3),[re,rt]=t7(t3),rr=e=>{let{__scopeDialog:t,children:s,open:a,defaultOpen:n,onOpenChange:o,modal:l=!0}=e,i=x.useRef(null),d=x.useRef(null),[c,u]=(0,ex.useControllableState)({prop:a,defaultProp:n??!1,onChange:o,caller:t3});return(0,r.jsx)(re,{scope:t,triggerRef:i,contentRef:d,contentId:(0,em.useId)(),titleId:(0,em.useId)(),descriptionId:(0,em.useId)(),open:c,onOpenChange:u,onOpenToggle:x.useCallback(()=>u(e=>!e),[u]),modal:l,children:s})};rr.displayName=t3;var rs="DialogTrigger";x.forwardRef((e,t)=>{let{__scopeDialog:s,...a}=e,n=rt(rs,s),o=(0,G.useComposedRefs)(t,n.triggerRef);return(0,r.jsx)(et.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":rk(n.open),...a,ref:o,onClick:(0,V.composeEventHandlers)(e.onClick,n.onOpenToggle)})}).displayName=rs;var ra="DialogPortal",[rn,ro]=t7(ra,{forceMount:void 0}),rl=e=>{let{__scopeDialog:t,forceMount:s,children:a,container:n}=e,o=rt(ra,t);return(0,r.jsx)(rn,{scope:t,forceMount:s,children:x.Children.map(a,e=>(0,r.jsx)(t8.Presence,{present:s||o.open,children:(0,r.jsx)(eh.Portal,{asChild:!0,container:n,children:e})}))})};rl.displayName=ra;var ri="DialogOverlay",rd=x.forwardRef((e,t)=>{let s=ro(ri,e.__scopeDialog),{forceMount:a=s.forceMount,...n}=e,o=rt(ri,e.__scopeDialog);return o.modal?(0,r.jsx)(t8.Presence,{present:a||o.open,children:(0,r.jsx)(ru,{...n,ref:t})}):null});rd.displayName=ri;var rc=(0,ep.createSlot)("DialogOverlay.RemoveScroll"),ru=x.forwardRef((e,t)=>{let{__scopeDialog:s,...a}=e,n=rt(ri,s);return(0,r.jsx)(ej.RemoveScroll,{as:rc,allowPinchZoom:!0,shards:[n.contentRef],children:(0,r.jsx)(et.Primitive.div,{"data-state":rk(n.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),rm="DialogContent",rf=x.forwardRef((e,t)=>{let s=ro(rm,e.__scopeDialog),{forceMount:a=s.forceMount,...n}=e,o=rt(rm,e.__scopeDialog);return(0,r.jsx)(t8.Presence,{present:a||o.open,children:o.modal?(0,r.jsx)(rh,{...n,ref:t}):(0,r.jsx)(rp,{...n,ref:t})})});rf.displayName=rm;var rh=x.forwardRef((e,t)=>{let s=rt(rm,e.__scopeDialog),a=x.useRef(null),n=(0,G.useComposedRefs)(t,s.contentRef,a);return x.useEffect(()=>{let e=a.current;if(e)return(0,ew.hideOthers)(e)},[]),(0,r.jsx)(rx,{...e,ref:n,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,V.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),s.triggerRef.current?.focus()}),onPointerDownOutside:(0,V.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,V.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault())})}),rp=x.forwardRef((e,t)=>{let s=rt(rm,e.__scopeDialog),a=x.useRef(!1),n=x.useRef(!1);return(0,r.jsx)(rx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(a.current||s.triggerRef.current?.focus(),t.preventDefault()),a.current=!1,n.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(a.current=!0,"pointerdown"===t.detail.originalEvent.type&&(n.current=!0));let r=t.target;s.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&n.current&&t.preventDefault()}})}),rx=x.forwardRef((e,t)=>{let{__scopeDialog:s,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:o,...l}=e,i=rt(rm,s),d=x.useRef(null),c=(0,G.useComposedRefs)(t,d);return Q(),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eo,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:o,children:(0,r.jsx)(Y.DismissableLayer,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":rk(i.open),...l,ref:c,onDismiss:()=>i.onOpenChange(!1)})}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(rR,{titleId:i.titleId}),(0,r.jsx)(rE,{contentRef:d,descriptionId:i.descriptionId})]})]})}),rg="DialogTitle",rv=x.forwardRef((e,t)=>{let{__scopeDialog:s,...a}=e,n=rt(rg,s);return(0,r.jsx)(et.Primitive.h2,{id:n.titleId,...a,ref:t})});rv.displayName=rg;var rw="DialogDescription",rj=x.forwardRef((e,t)=>{let{__scopeDialog:s,...a}=e,n=rt(rw,s);return(0,r.jsx)(et.Primitive.p,{id:n.descriptionId,...a,ref:t})});rj.displayName=rw;var rb="DialogClose",ry=x.forwardRef((e,t)=>{let{__scopeDialog:s,...a}=e,n=rt(rb,s);return(0,r.jsx)(et.Primitive.button,{type:"button",...a,ref:t,onClick:(0,V.composeEventHandlers)(e.onClick,()=>n.onOpenChange(!1))})});function rk(e){return e?"open":"closed"}ry.displayName=rb;var rN="DialogTitleWarning",[rC,rS]=(0,X.createContext)(rN,{contentName:rm,titleName:rg,docsSlug:"dialog"}),rR=({titleId:e})=>{let t=rS(rN),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
+
3
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
+
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},rE=({contentRef:e,descriptionId:t})=>{let r=rS("DialogDescriptionWarning"),s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return x.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},rI=e.i(897884),rI=rI;function rT({...e}){return(0,r.jsx)(rr,{"data-slot":"sheet",...e})}function rD({...e}){return(0,r.jsx)(rl,{"data-slot":"sheet-portal",...e})}function rP({className:e,...t}){return(0,r.jsx)(rd,{"data-slot":"sheet-overlay",className:(0,j.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",e),...t})}function rM({className:e,children:t,side:s="right",...a}){return(0,r.jsxs)(rD,{children:[(0,r.jsx)(rP,{}),(0,r.jsxs)(rf,{"data-slot":"sheet-content",className:(0,j.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"===s&&"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"===s&&"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"===s&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===s&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...a,children:[t,(0,r.jsxs)(ry,{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,r.jsx)(rI.default,{className:"size-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function rA({className:e,...t}){return(0,r.jsx)("div",{"data-slot":"sheet-header",className:(0,j.cn)("flex flex-col gap-1.5 p-4",e),...t})}function rL({className:e,...t}){return(0,r.jsx)(rv,{"data-slot":"sheet-title",className:(0,j.cn)("text-foreground font-semibold",e),...t})}function rH({className:e,...t}){return(0,r.jsx)(rj,{"data-slot":"sheet-description",className:(0,j.cn)("text-muted-foreground text-sm",e),...t})}var r_=e.i(479823);function rF({onWorkflowSelect:e}){let[t,s]=(0,x.useState)(!1),[a,n]=(0,x.useState)(null),{manifest:o,loading:l,error:d}=(0,r_.useWorkflowGraphManifest)(),c=o?Object.values(o.workflows):[],u=(0,x.useMemo)(()=>[...c].sort((e,t)=>e.workflowName.localeCompare(t.workflowName)),[c]),m=(0,x.useMemo)(()=>a?.nodes.filter(e=>"step"===e.data.nodeKind).length??0,[a]);return l?(0,r.jsx)(H,{variant:"workflows",rows:6}):d?(0,r.jsxs)(v.Alert,{variant:"destructive",children:[(0,r.jsx)(i.AlertCircle,{className:"h-4 w-4"}),(0,r.jsx)(v.AlertTitle,{children:"Error Loading Workflows"}),(0,r.jsx)(v.AlertDescription,{children:d.message})]}):0===c.length?(0,r.jsx)(b,{children:(0,r.jsxs)(y,{className:"p-12 text-center",children:[(0,r.jsx)(t2,{className:"mx-auto h-12 w-12 text-muted-foreground mb-4"}),(0,r.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No Workflows Found"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No workflow definitions were found in the graph manifest."})]})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b,{className:"overflow-hidden bg-background",children:(0,r.jsx)(y,{className:"p-0 max-h-[calc(100vh-200px)] overflow-auto",children:(0,r.jsxs)(S,{children:[(0,r.jsx)(R,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Workflow"}),(0,r.jsx)(T,{className:"sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"File"}),(0,r.jsx)(T,{className:"text-center sticky top-0 bg-background z-10 border-b shadow-sm h-10",children:"Steps"})]})}),(0,r.jsx)(E,{children:u.map(t=>{let a=t.nodes.filter(e=>"step"===e.data.nodeKind).length;return(0,r.jsxs)(I,{className:"cursor-pointer",onClick:()=>{n(t),s(!0),e?.(t.workflowName)},children:[(0,r.jsx)(D,{className:"py-2",children:(0,r.jsx)("span",{className:"font-medium",children:t.workflowName})}),(0,r.jsx)(D,{className:"py-2",children:(0,r.jsx)("code",{className:"text-xs text-muted-foreground",children:t.filePath})}),(0,r.jsx)(D,{className:"text-center py-2",children:(0,r.jsxs)(t6.Badge,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(t4.GitBranch,{className:"h-3 w-3"}),a," ",(0,t1.pluralize)("step","steps",a)]})})]},t.workflowId)})})]})})}),(0,r.jsx)(rT,{open:t,onOpenChange:s,children:(0,r.jsxs)(rM,{side:"right",className:"w-[75vw] max-w-[75vw] sm:max-w-[75vw]",children:[(0,r.jsxs)(rA,{children:[(0,r.jsxs)(rL,{className:"flex items-center gap-2",children:[(0,r.jsx)(t2,{className:"h-5 w-5"}),a?.workflowName]}),a&&(0,r.jsx)(rH,{asChild:!0,children:(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("code",{className:"text-xs",children:a.filePath}),(0,r.jsx)("div",{children:(0,r.jsxs)(t6.Badge,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(t4.GitBranch,{className:"h-3 w-3"}),m," ",(0,t1.pluralize)("step","steps",m)]})})]})})]}),(0,r.jsx)("div",{className:"mt-6 h-[calc(100vh-180px)]",children:a&&(0,r.jsx)(t5.WorkflowGraphViewer,{workflow:a})})]})})]})}var rO=e.i(620486),rz=e.i(480462);function rB(){let e=(0,a.useRouter)(),{serverConfig:t}=(0,tN.useServerConfig)(),[n]=(0,rz.useSidebarState)(),[o]=(0,rz.useHookIdState)(),[l,i]=(0,rz.useTabState)(),d="local"===t.backendId||"@workflow/world-local"===t.backendId;return(0,r.jsx)("div",{className:"max-w-7xl mx-auto px-4",children:(0,r.jsxs)(t0.Tabs,{value:l,onValueChange:i,className:"w-full",children:[(0,r.jsxs)(t0.TabsList,{className:"mb-4",children:[(0,r.jsx)(t0.TabsTrigger,{value:"runs",children:"Runs"}),(0,r.jsx)(t0.TabsTrigger,{value:"hooks",children:"Hooks"}),d&&(0,r.jsx)(t0.TabsTrigger,{value:"workflows",children:"Workflows"})]}),(0,r.jsx)(t0.TabsContent,{value:"runs",children:(0,r.jsx)(s.ErrorBoundary,{title:"Runs Error",description:"Failed to load workflow runs. Please try refreshing the page.",children:(0,r.jsx)(tQ,{onRunClick:(t,r)=>{r?e.push((0,rO.buildUrlWithConfig)(`/run/${t}/streams/${r}`)):e.push((0,rO.buildUrlWithConfig)(`/run/${t}`))}})})}),(0,r.jsx)(t0.TabsContent,{value:"hooks",children:(0,r.jsx)(s.ErrorBoundary,{title:"Hooks Error",description:"Failed to load hooks. Please try refreshing the page.",children:(0,r.jsx)(_,{onHookClick:(t,r)=>{t?e.push((0,rO.buildUrlWithConfig)(`/run/${r}`,{sidebar:"hook",hookId:t})):e.push((0,rO.buildUrlWithConfig)(`/run/${r}`))},selectedHookId:"hook"===n&&o?o:void 0})})}),d&&(0,r.jsx)(t0.TabsContent,{value:"workflows",children:(0,r.jsx)(s.ErrorBoundary,{title:"Workflows Error",description:"Failed to load workflow graph data. Please try refreshing the page.",children:(0,r.jsx)(rF,{})})})]})})}e.s(["default",()=>rB],330997)}]);