1import{R as e,a as t,p as s}from"./chunk-6CSD65Y2-xYubHBmU.js";import{ax as r,b as o}from"./CoreLayout-V9PVLCM0.js";import{J as n,C as a,P as i}from"./voiceStore-D_K9cjIr.js";import{a as l,C as c}from"./loader-circle-Mux4UJzI.js";import{X as d}from"./overlayFocus-BmDVzTk_.js";import"./index-BcwKVuK3.js";import"./createLucideIcon-B7UGDY3i.js";import"./user-BccZgP0Q.js";import"./index-BfJR_dAR.js";import"./AuthContextDefinition-CrUuQ85U.js";const{useRef:u}=e;function m(e){const t=u();return s=>{const r=e(s);return function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,r]of e)if(!Object.is(r,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const s=Object.keys(e);if(s.length!==Object.keys(t).length)return!1;for(const r of s)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}(t.current,r)?t.current:t.current=r}}function f(e){return null===e?"":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const p=t.memo(function({summary:e,totalNodes:t,onDismiss:r}){const{nodeCount:o,durationMs:n}=e,a=f(n),i="completed"===e.status?t:o.completed;return s.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center gap-3 px-4 py-3 rounded-lg border-l-4 border-emerald-500 bg-emerald-50 dark:bg-emerald-950/50 text-emerald-800 dark:text-emerald-200 shadow-lg animate-in slide-in-from-top-2 duration-300",children:[s.jsx(l,{className:"w-5 h-5 shrink-0"}),s.jsxs("span",{className:"text-sm font-medium",children:["Workflow completed",a?` in ${a}`:""," â ",i,"/",t," nodes succeeded"]}),s.jsx("button",{onClick:r,className:"ml-auto p-1 rounded-md hover:bg-emerald-200/50 dark:hover:bg-emerald-800/50 transition-colors","aria-label":"Dismiss banner",children:s.jsx(d,{className:"w-4 h-4"})})]})}),x=t.memo(function({summary:e,totalNodes:n,onDismiss:i}){const{failedNodeIds:l,errors:u,durationMs:m,nodeCount:p}=e,x=a(e=>e.nodes),{setCenter:j}=r(),h=l[0],b=h?x.find(e=>e.id===h):void 0,g=b?.data,k=g?.node,y=k?.display_name||h||"unknown node",N=u[0]?.message,w=t.useCallback(()=>{if(!b)return;const{position:e}=b;j(e.x+160,e.y+100,{zoom:1,duration:500})},[b,j]),v="cancelled"===e.status,C=f(m);return s.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center gap-3 px-4 py-3 rounded-lg border-l-4 border-red-500 bg-red-50 dark:bg-red-950/50 text-red-800 dark:text-red-200 shadow-lg animate-in slide-in-from-top-2 duration-300",children:[v?s.jsx(o,{className:"w-5 h-5 shrink-0"}):s.jsx(c,{className:"w-5 h-5 shrink-0"}),s.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[s.jsxs("span",{className:"text-sm font-medium",children:[v?"Workflow cancelled"+(C?` after ${C}`:""):`Workflow failed at '${y}'${C?` after ${C}`:""}`," â ",p.completed,"/",n," nodes completed"]}),N&&!v&&s.jsx("span",{className:"text-xs opacity-80 truncate",children:N}),b&&!v&&s.jsx("button",{onClick:w,className:"text-xs underline underline-offset-2 opacity-80 hover:opacity-100 transition-opacity text-left w-fit",children:"Click to pan to failed node"})]}),s.jsx("button",{onClick:i,className:"ml-auto p-1 rounded-md hover:bg-red-200/50 dark:hover:bg-red-800/50 transition-colors shrink-0","aria-label":"Dismiss banner",children:s.jsx(d,{className:"w-4 h-4"})})]})});const j=t.memo(function(){const e=n(m(e=>e.getExecutionSummary())),r=n(e=>e.status),o=n(e=>e.isHistorical),l=a(e=>i(e.nodes).length),[c,d]=t.useState(!1),[u,f]=t.useState(null),j=n(e=>e.currentExecutionId);if(t.useEffect(()=>{e&&j!==u&&(d(!1),f(j))},[e,j,u]),t.useEffect(()=>{"running"===r&&d(!1)},[r]),t.useEffect(()=>{if(!e||c)return;if("completed"!==e.status)return;const t=setTimeout(()=>{d(!0)},1e4);return()=>clearTimeout(t)},[e,c]),!e||c||o)return null;const h=()=>d(!0);return s.jsx("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 z-10 max-w-lg w-full px-4",children:"completed"===e.status?s.jsx(p,{summary:e,totalNodes:l,onDismiss:h}):s.jsx(x,{summary:e,totalNodes:l,onDismiss:h})})});export{j as ExecutionSummaryBanner,j as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.