@workflow/web 4.1.0 → 5.0.0-beta.1

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.
@@ -1,4 +1,4 @@
1
- import{r as l,j as e,w as z,v as B,M as F,L as q,S as G,x as J,O as Q,y as X,i as Y,z as _,A as ee,B as te}from"./index-BmZS3y7B.js";import{c as C,u as se,T as W,a as P,b as I,r as re,t as H,B as A,L as ne,d as R,e as oe,S as ae,f as ie}from"./mermaid-3ZIDBTTL-CsKo7Yup.js";var ce=(t,r,s,n,a,i,u,h)=>{let o=document.documentElement,c=["light","dark"];function d(f){(Array.isArray(t)?t:[t]).forEach(x=>{let k=x==="class",S=k&&i?a.map(b=>i[b]||b):a;k?(o.classList.remove(...S),o.classList.add(i&&i[f]?i[f]:f)):o.setAttribute(x,f)}),v(f)}function v(f){h&&c.includes(f)&&(o.style.colorScheme=f)}function m(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)d(n);else try{let f=localStorage.getItem(r)||s,x=u&&f==="system"?m():f;d(x)}catch{}},O=["light","dark"],K="(prefers-color-scheme: dark)",le=typeof window>"u",$=l.createContext(void 0),de={setTheme:t=>{},themes:[]},T=()=>{var t;return(t=l.useContext($))!=null?t:de},ue=t=>l.useContext($)?l.createElement(l.Fragment,null,t.children):l.createElement(me,{...t}),he=["light","dark"],me=({forcedTheme:t,disableTransitionOnChange:r=!1,enableSystem:s=!0,enableColorScheme:n=!0,storageKey:a="theme",themes:i=he,defaultTheme:u=s?"system":"light",attribute:h="data-theme",value:o,children:c,nonce:d,scriptProps:v})=>{let[m,f]=l.useState(()=>pe(a,u)),[x,k]=l.useState(()=>m==="system"?E():m),S=o?Object.values(o):i,b=l.useCallback(p=>{let g=p;if(!g)return;p==="system"&&s&&(g=E());let j=o?o[g]:g,V=r?ge(d):null,w=document.documentElement,M=y=>{y==="class"?(w.classList.remove(...S),j&&w.classList.add(j)):y.startsWith("data-")&&(j?w.setAttribute(y,j):w.removeAttribute(y))};if(Array.isArray(h)?h.forEach(M):M(h),n){let y=O.includes(u)?u:null,U=O.includes(g)?g:y;w.style.colorScheme=U}V==null||V()},[d]),L=l.useCallback(p=>{let g=typeof p=="function"?p(m):p;f(g);try{localStorage.setItem(a,g)}catch{}},[m]),N=l.useCallback(p=>{let g=E(p);k(g),m==="system"&&s&&!t&&b("system")},[m,t]);l.useEffect(()=>{let p=window.matchMedia(K);return p.addListener(N),N(p),()=>p.removeListener(N)},[N]),l.useEffect(()=>{let p=g=>{g.key===a&&(g.newValue?f(g.newValue):L(u))};return window.addEventListener("storage",p),()=>window.removeEventListener("storage",p)},[L]),l.useEffect(()=>{b(t??m)},[t,m]);let D=l.useMemo(()=>({theme:m,setTheme:L,forcedTheme:t,resolvedTheme:m==="system"?x:m,themes:s?[...i,"system"]:i,systemTheme:s?x:void 0}),[m,L,t,x,s,i]);return l.createElement($.Provider,{value:D},l.createElement(fe,{forcedTheme:t,storageKey:a,attribute:h,enableSystem:s,enableColorScheme:n,defaultTheme:u,value:o,themes:i,nonce:d,scriptProps:v}),c)},fe=l.memo(({forcedTheme:t,storageKey:r,attribute:s,enableSystem:n,enableColorScheme:a,defaultTheme:i,value:u,themes:h,nonce:o,scriptProps:c})=>{let d=JSON.stringify([s,r,i,t,h,u,n,a]).slice(1,-1);return l.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?o:"",dangerouslySetInnerHTML:{__html:`(${ce.toString()})(${d})`}})}),pe=(t,r)=>{if(le)return;let s;try{s=localStorage.getItem(t)||void 0}catch{}return s||r},ge=t=>{let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(r),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(r)},1)}},E=t=>(t||(t=window.matchMedia(K)),t.matches?"dark":"light");/**
1
+ import{r as l,j as e,w as z,v as B,M as F,L as q,S as G,x as J,O as Q,y as X,i as Y,z as _,A as ee,B as te}from"./index-BmZS3y7B.js";import{c as C,u as se,T as W,a as P,b as I,r as re,t as H,B as A,L as ne,d as R,e as oe,S as ae,f as ie}from"./mermaid-3ZIDBTTL-CCXSRVd3.js";var ce=(t,r,s,n,a,i,u,h)=>{let o=document.documentElement,c=["light","dark"];function d(f){(Array.isArray(t)?t:[t]).forEach(x=>{let k=x==="class",S=k&&i?a.map(b=>i[b]||b):a;k?(o.classList.remove(...S),o.classList.add(i&&i[f]?i[f]:f)):o.setAttribute(x,f)}),v(f)}function v(f){h&&c.includes(f)&&(o.style.colorScheme=f)}function m(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)d(n);else try{let f=localStorage.getItem(r)||s,x=u&&f==="system"?m():f;d(x)}catch{}},O=["light","dark"],K="(prefers-color-scheme: dark)",le=typeof window>"u",$=l.createContext(void 0),de={setTheme:t=>{},themes:[]},T=()=>{var t;return(t=l.useContext($))!=null?t:de},ue=t=>l.useContext($)?l.createElement(l.Fragment,null,t.children):l.createElement(me,{...t}),he=["light","dark"],me=({forcedTheme:t,disableTransitionOnChange:r=!1,enableSystem:s=!0,enableColorScheme:n=!0,storageKey:a="theme",themes:i=he,defaultTheme:u=s?"system":"light",attribute:h="data-theme",value:o,children:c,nonce:d,scriptProps:v})=>{let[m,f]=l.useState(()=>pe(a,u)),[x,k]=l.useState(()=>m==="system"?E():m),S=o?Object.values(o):i,b=l.useCallback(p=>{let g=p;if(!g)return;p==="system"&&s&&(g=E());let j=o?o[g]:g,V=r?ge(d):null,w=document.documentElement,M=y=>{y==="class"?(w.classList.remove(...S),j&&w.classList.add(j)):y.startsWith("data-")&&(j?w.setAttribute(y,j):w.removeAttribute(y))};if(Array.isArray(h)?h.forEach(M):M(h),n){let y=O.includes(u)?u:null,U=O.includes(g)?g:y;w.style.colorScheme=U}V==null||V()},[d]),L=l.useCallback(p=>{let g=typeof p=="function"?p(m):p;f(g);try{localStorage.setItem(a,g)}catch{}},[m]),N=l.useCallback(p=>{let g=E(p);k(g),m==="system"&&s&&!t&&b("system")},[m,t]);l.useEffect(()=>{let p=window.matchMedia(K);return p.addListener(N),N(p),()=>p.removeListener(N)},[N]),l.useEffect(()=>{let p=g=>{g.key===a&&(g.newValue?f(g.newValue):L(u))};return window.addEventListener("storage",p),()=>window.removeEventListener("storage",p)},[L]),l.useEffect(()=>{b(t??m)},[t,m]);let D=l.useMemo(()=>({theme:m,setTheme:L,forcedTheme:t,resolvedTheme:m==="system"?x:m,themes:s?[...i,"system"]:i,systemTheme:s?x:void 0}),[m,L,t,x,s,i]);return l.createElement($.Provider,{value:D},l.createElement(fe,{forcedTheme:t,storageKey:a,attribute:h,enableSystem:s,enableColorScheme:n,defaultTheme:u,value:o,themes:i,nonce:d,scriptProps:v}),c)},fe=l.memo(({forcedTheme:t,storageKey:r,attribute:s,enableSystem:n,enableColorScheme:a,defaultTheme:i,value:u,themes:h,nonce:o,scriptProps:c})=>{let d=JSON.stringify([s,r,i,t,h,u,n,a]).slice(1,-1);return l.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?o:"",dangerouslySetInnerHTML:{__html:`(${ce.toString()})(${d})`}})}),pe=(t,r)=>{if(le)return;let s;try{s=localStorage.getItem(t)||void 0}catch{}return s||r},ge=t=>{let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(r),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(r)},1)}},E=t=>(t||(t=window.matchMedia(K)),t.matches?"dark":"light");/**
2
2
  * @license lucide-react v0.575.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,37 @@
1
+ import{j as t,r as a,f as Ut,C as Os,A as $s,B as Pr,z as Ws,w as Hs,G as Bs}from"./index-BmZS3y7B.js";import{O as rt,C as Fr,Q as st,B as ze,j as Kt,q as Or,U as $r,Z as Vs,S as Wr,R as Hr,p as zs,o as Us,X as Ks,N as Qe,V as qs,G as Gs,I as ue,u as ht,W as _e,Y as Zs,v as je,_ as yt,$ as Ys,t as Br,a0 as Xs,s as Js,a1 as It,w as qt,l as Qs,m as en,a2 as tn,a3 as rn,a4 as sn,r as nn,A as on,c as an,d as ln,a as Ae,a5 as cn,F as dn,e as un,b as ut,T as fn,K as mn,L as Tt,M as Rt,y as pn,a6 as hn}from"./workflow-graph-viewer-B5c_xYyF.js";import{c as Nt,h as Ue,M as Q,Y as xn,N as ye,O as sr,U as vt,_ as gn,W as yn,X as Le,Z as vn,$ as wn,a0 as Vr,a1 as bn,a2 as Pe,a3 as ve,a4 as G,a5 as jn,a6 as kn,a7 as At,a8 as ce,a9 as ft,aa as wt,ab as We,ac as Se,ad as zr,ae as Xe,af as Dt,ag as Nn,ah as Cn,ai as En,aj as Sn,ak as In,al as Tn,am as Rn,an as He,ao as me,ap as Ur,l as Be,F as Wt,aq as An,ar as Dn,as as Gt,E as Ie,at as Mn,d as de,au as Kr,av as nr,aw as or,ax as _n,T as qr,a as Gr,b as Zr,ay as Ln,u as Pn,az as ar,aA as Fn,t as De,L as On,aB as $n}from"./mermaid-3ZIDBTTL-CCXSRVd3.js";import{decrypt as Wn,importKey as Hn}from"./encryption-8OvC6eoJ.js";/**
2
+ * @license lucide-react v0.575.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Bn=[["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"}]],Vn=Nt("circle-question-mark",Bn);/**
7
+ * @license lucide-react v0.575.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const zn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Un=Nt("info",zn);/**
12
+ * @license lucide-react v0.575.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Kn=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Mt=Nt("list",Kn);/**
17
+ * @license lucide-react v0.575.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const qn=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],Gn=Nt("type",qn),Zn="@keyframes wf-spinner-fade{0%{opacity:1}100%{opacity:.15}}";function Zt({size:e=14,color:r}){const s=e<=12?{angle:45,delays:[-875,-750,-625,-500,-375,-250,-125,0],duration:1e3,lineW:3,lineH:1.5}:e<=16?{angle:36,delays:[-900,-800,-700,-600,-500,-400,-300,-200,-100,0],duration:1e3,lineW:4,lineH:1.5}:{angle:30,delays:[-1100,-1e3,-900,-800,-700,-600,-500,-400,-300,-200,-100,0],duration:1200,lineW:e*.24,lineH:e*.08};return t.jsxs("span",{style:{display:"inline-flex",position:"relative",width:e,height:e},children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:Zn}}),s.delays.map((n,o)=>t.jsx("span",{style:{position:"absolute",left:"50%",top:"50%",width:s.lineW,height:s.lineH,marginLeft:-s.lineW/2,marginTop:-s.lineH/2,borderRadius:1,backgroundColor:r??"var(--ds-gray-700)",transform:`rotate(${o*s.angle}deg) translate(${e*.36}px)`,animation:`wf-spinner-fade ${s.duration}ms linear infinite`,animationDelay:`${n}ms`}},n))]})}const Yn=".wf-decrypt-btn{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 12px;border-radius:6px;font-size:14px;font-weight:500;line-height:20px;cursor:pointer;white-space:nowrap;gap:6px;transition:background 150ms}.wf-decrypt-idle{color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400)}.wf-decrypt-idle:hover{background:var(--ds-gray-alpha-200)}.wf-decrypt-done{color:var(--ds-green-900);background:var(--ds-green-100);box-shadow:0 0 0 1px var(--ds-green-400);cursor:default}";function Yt({decrypted:e=!1,loading:r=!1,onClick:s}){return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:Yn}}),t.jsxs("button",{type:"button",onClick:e?void 0:s,disabled:e||r,className:`wf-decrypt-btn ${e?"wf-decrypt-done":"wf-decrypt-idle"}`,children:[r?t.jsx(Zt,{size:14}):e?t.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),t.jsx("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"})]}):t.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),t.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),r?"Decrypting…":e?"Decrypted":"Decrypt"]})]})}function et(e){return e!=null&&typeof e=="object"&&"stack"in e&&typeof e.stack=="string"}function bt({value:e}){const r=Ue(),s=e.stack,n=typeof e.message=="string"?e.message:void 0,o=n?`${n}
22
+
23
+ ${s}`:s;return t.jsxs("div",{className:"relative overflow-hidden rounded-md border",style:{borderColor:"var(--ds-red-400)",background:"var(--ds-red-100)"},children:[t.jsx("button",{type:"button","aria-label":"Copy error",title:"Copy",className:"!absolute !right-2 !top-2 !flex !h-6 !w-6 !items-center !justify-center !rounded-md !border transition-transform transition-colors duration-100 hover:!bg-[var(--ds-red-200)] active:!scale-95",style:{borderColor:"var(--ds-red-400)",background:"var(--ds-red-100)",color:"var(--ds-red-900)"},onClick:()=>{navigator.clipboard.writeText(o).then(()=>{r.success("Copied to clipboard")}).catch(()=>{r.error("Failed to copy")})},children:t.jsx(rt,{size:12})}),n&&t.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 pr-10",style:{color:"var(--ds-red-900)",borderBottom:"1px solid var(--ds-red-400)"},children:[t.jsx(Fr,{className:"h-4 w-4 shrink-0",style:{marginTop:1}}),t.jsx("p",{className:"text-xs font-semibold m-0 break-words",children:n})]}),t.jsx("pre",{className:"px-3 py-2.5 text-xs font-mono whitespace-pre-wrap break-words overflow-auto m-0",style:{color:"var(--ds-red-900)",background:"var(--ds-red-200)"},children:s})]})}const Xn=".wf-load-more{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;border-radius:6px;font-size:13px;font-weight:500;line-height:20px;color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400);cursor:pointer;white-space:nowrap;gap:6px;transition:background 150ms}.wf-load-more:hover{background:var(--ds-gray-alpha-200)}.wf-load-more:disabled{opacity:.6;cursor:default}.wf-load-more:disabled:hover{background:var(--ds-background-100)}";function Jn({loading:e=!1,onClick:r,label:s="Load more",loadingLabel:n="Loading..."}){return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:Xn}}),t.jsxs("button",{type:"button",onClick:r,disabled:e,className:"wf-load-more",children:[e&&t.jsx(Zt,{size:14}),e?n:s]})]})}const Qn=".wf-menu-btn{appearance:none;-webkit-appearance:none;border:none;display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 12px;border-radius:6px;font-size:14px;font-weight:500;line-height:20px;color:var(--ds-gray-1000);background:var(--ds-background-100);box-shadow:0 0 0 1px var(--ds-gray-400);cursor:pointer;white-space:nowrap;transition:background 150ms}.wf-menu-btn:hover{background:var(--ds-gray-alpha-200)}.wf-menu-item{appearance:none;-webkit-appearance:none;border:none;display:flex;align-items:center;width:100%;height:40px;padding:0 8px;border-radius:6px;font-size:14px;color:var(--ds-gray-1000);background:transparent;cursor:pointer;transition:background 150ms}.wf-menu-item:hover{background:var(--ds-gray-alpha-100)}";function eo({options:e,value:r,onChange:s}){var c,u;const[n,o]=a.useState(!1),i=a.useRef(null),l=((c=e.find(d=>d.value===r))==null?void 0:c.label)??((u=e[0])==null?void 0:u.label)??"";return a.useEffect(()=>{if(!n)return;function d(p){i.current&&!i.current.contains(p.target)&&o(!1)}return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]),t.jsxs("div",{ref:i,style:{position:"relative",flexShrink:0},children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:Qn}}),t.jsxs("button",{type:"button",className:"wf-menu-btn",onClick:()=>o(!n),children:[t.jsx("span",{children:l}),t.jsx("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",style:{marginLeft:16,marginRight:-4,color:"var(--ds-gray-900)"},children:t.jsx("path",{d:"M4.5 6L8 9.5L11.5 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),n&&t.jsx("div",{style:{position:"absolute",right:0,top:"100%",marginTop:4,minWidth:140,padding:4,borderRadius:12,background:"var(--ds-background-100)",boxShadow:"var(--ds-shadow-menu, var(--ds-shadow-medium))",zIndex:2001},role:"menu",children:e.map(d=>t.jsx("button",{type:"button",role:"menuitem",className:"wf-menu-item",style:{fontWeight:d.value===r?500:400},onClick:()=>{s(d.value),o(!1)},children:d.label},d.value))})]})}const to=[{unit:"year",ms:31536e6},{unit:"month",ms:2628e6},{unit:"day",ms:864e5},{unit:"hour",ms:36e5},{unit:"minute",ms:6e4},{unit:"second",ms:1e3}];function ro(e){let r=Math.abs(e);const s=[];for(const{unit:n,ms:o}of to){const i=Math.floor(r/o);if((i>0||s.length>0)&&(s.push(`${i} ${n}${i!==1?"s":""}`),r%=o),s.length===3)break}return s.join(", ")}function so(e){const[r,s]=a.useState("");return a.useEffect(()=>{const n=()=>{const i=Date.now()-e,l=ro(i);s(l?`${l} ago`:"Just now")};n();const o=setInterval(n,1e3);return()=>clearInterval(o)},[e]),r}function ir({date:e,zone:r}){var l;const s=new Date(e),n=((l=new Intl.DateTimeFormat("en-US",{timeZone:r,timeZoneName:"short"}).formatToParts(s).find(c=>c.type==="timeZoneName"))==null?void 0:l.value)||r,o=s.toLocaleString("en-US",{timeZone:r,year:"numeric",month:"long",day:"numeric"}),i=s.toLocaleTimeString("en-US",{timeZone:r,hour:"2-digit",minute:"2-digit",second:"2-digit"});return t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[t.jsx("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",height:16,padding:"0 6px",backgroundColor:"var(--ds-gray-200)",borderRadius:3,fontSize:11,fontFamily:"var(--font-mono, monospace)",fontWeight:500,color:"var(--ds-gray-900)",whiteSpace:"nowrap"},children:n}),t.jsx("span",{style:{fontSize:13,color:"var(--ds-gray-1000)",whiteSpace:"nowrap"},children:o})]}),t.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",fontVariantNumeric:"tabular-nums",color:"var(--ds-gray-900)",whiteSpace:"nowrap"},children:i})]})}function no({date:e}){const r=Intl.DateTimeFormat().resolvedOptions().timeZone,s=so(e);return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,minWidth:300,padding:"12px 14px"},children:[t.jsx("span",{style:{fontSize:13,fontVariantNumeric:"tabular-nums",color:"var(--ds-gray-900)"},children:s}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx(ir,{date:e,zone:"UTC"}),t.jsx(ir,{date:e,zone:r})]})]})}const oo=330,mt=8;function ao({triggerRect:e,onMouseEnter:r,onMouseLeave:s,date:n}){const o=a.useRef(null),[i,l]=a.useState({position:"fixed",zIndex:9999,visibility:"hidden"});return a.useEffect(()=>{const c=e.top>240?"above":"below",u=e.left+e.width/2,d=o.current,p=d?d.offsetWidth:oo,h=d?d.offsetHeight:100;let m=u-p/2;m=Math.max(mt,Math.min(m,window.innerWidth-p-mt));let f;c==="above"?(f=e.top-h-6,f<mt&&(f=e.bottom+6)):(f=e.bottom+6,f+h>window.innerHeight-mt&&(f=e.top-h-6)),l({position:"fixed",left:m,top:f,zIndex:9999,borderRadius:10,border:"1px solid var(--ds-gray-alpha-200)",backgroundColor:"var(--ds-background-100)",boxShadow:"0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06)",visibility:"visible"})},[e]),Ut.createPortal(t.jsx("div",{ref:o,onMouseEnter:r,onMouseLeave:s,style:i,children:t.jsx(no,{date:n})}),document.body)}function Yr({date:e,children:r}){const[s,n]=a.useState(!1),[o,i]=a.useState(null),l=a.useRef(null),c=a.useRef(null);a.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const u=e==null?null:typeof e=="number"?e:new Date(e).getTime();if(u==null||Number.isNaN(u))return t.jsx(t.Fragment,{children:r});const d=()=>{c.current&&(clearTimeout(c.current),c.current=null)},p=()=>{d(),c.current=setTimeout(()=>n(!1),120)},h=()=>{d(),l.current&&i(l.current.getBoundingClientRect()),n(!0)};return t.jsxs("span",{ref:l,onMouseEnter:h,onMouseLeave:p,style:{display:"inline-flex"},children:[r,s&&o&&t.jsx(ao,{triggerRect:o,onMouseEnter:d,onMouseLeave:p,date:u})]})}const io=new Set(["step_failed","step_retrying","run_failed","workflow_failed"]),Xr={appearance:"none",WebkitAppearance:"none",border:"none",background:"transparent"},Jr="workflow-dot-pulse 1.25s cubic-bezier(0, 0, 0.2, 1) infinite";function lo(e){return e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})+"."+e.getMilliseconds().toString().padStart(3,"0")}function Qr(e){return e.split("_").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}function co(e){return e==="step_failed"||e==="run_failed"||e==="workflow_failed"?"var(--ds-red-700)":e==="run_cancelled"||e==="step_retrying"?"var(--ds-amber-700)":e==="step_completed"||e==="run_completed"||e==="workflow_completed"||e==="hook_disposed"||e==="wait_completed"?"var(--ds-green-700)":e==="step_started"||e==="run_started"||e==="workflow_started"||e==="hook_received"?"var(--ds-blue-700)":"var(--ds-gray-600)"}function uo(e,r){var o,i;const s=new Map;if(e){for(const l of e)if(l.eventType==="step_created"&&l.correlationId){const c=((o=l.eventData)==null?void 0:o.stepName)??"",u=st(String(c));s.set(l.correlationId,(u==null?void 0:u.shortName)??c)}}const n=r!=null&&r.workflowName?((i=ze(r.workflowName))==null?void 0:i.shortName)??r.workflowName:null;return{correlationNameMap:s,workflowName:n}}function fo(e){const r=new Map,s=new Map,n=new Map;for(const o of e){const i=new Date(o.createdAt).getTime(),l=o.correlationId??"__run__",c=o.eventType;if((c==="step_created"||c==="run_created")&&r.set(l,i),c==="step_started"||c==="run_started"||c==="workflow_started"){s.set(l,i),r.has(l)||r.set(l,i);const u=r.get(l),d=n.get(l)??{};u!==void 0&&(d.queued=i-u),n.set(l,d)}if(c==="step_completed"||c==="step_failed"||c==="run_completed"||c==="run_failed"||c==="run_cancelled"||c==="workflow_completed"||c==="workflow_failed"||c==="wait_completed"||c==="hook_disposed"){const u=s.get(l),d=n.get(l)??{};u!==void 0&&(d.ran=i-u),n.set(l,d)}}return n}function Ht(e){if(!e||typeof e!="object")return!1;for(const r of Object.values(e))if(ye(r))return!0;return!1}function jt(e){return e==="run_created"||e==="run_started"||e==="run_completed"||e==="run_failed"||e==="run_cancelled"||e==="workflow_started"||e==="workflow_completed"||e==="workflow_failed"}const tt=36,mo=20,_t="var(--ds-gray-500)";function lr({isFirst:e,isLast:r,isRunLevel:s,statusDotColor:n,pulse:o=!1,hasSelection:i,showBranch:l,showLaneLine:c,isLaneStart:u,isLaneEnd:d,continuationOnly:p=!1}){const h=s?8:6,m=s?5:6,f=i&&!l&&!s?.3:1;return t.jsxs("div",{className:"relative flex-shrink-0 self-stretch",style:{width:tt,minHeight:p?0:void 0},children:[t.jsx("div",{style:{position:"absolute",left:8,top:p?0:e?"50%":0,bottom:p?0:r?"50%":0,width:2,backgroundColor:_t,zIndex:0}}),!p&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{position:"absolute",left:m,top:"50%",transform:"translateY(-50%)",width:h,height:h,zIndex:2},children:[t.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:"var(--ds-background-100)",zIndex:0}}),o&&t.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:n,opacity:.75*f,animation:Jr,zIndex:1}}),t.jsx("div",{style:{position:"relative",width:"100%",height:"100%",borderRadius:"50%",backgroundColor:n,opacity:f,transition:"opacity 150ms",zIndex:2}})]}),l&&t.jsx("div",{style:{position:"absolute",left:9,top:"50%",width:tt-9,height:2,backgroundColor:_t,zIndex:0}})]}),c&&t.jsx("div",{style:{position:"absolute",left:mo,top:p?0:u?"50%":0,bottom:p?0:d?"50%":0,width:2,backgroundColor:_t,zIndex:0}})]})}function cr({value:e,className:r,style:s}){const[n,o]=a.useState(!1),i=a.useRef(null);a.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const l=a.useCallback(c=>{c.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{o(!1),i.current=null},1500)})},[e]);return t.jsxs("div",{className:`group/copy flex items-center gap-1 min-w-0 px-4 ${r??""}`,style:s,children:[t.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:e||"-"}),e?t.jsx("button",{type:"button",onClick:l,className:"flex-shrink-0 opacity-0 group-hover/copy:opacity-100 transition-opacity p-0.5 rounded hover:bg-[var(--ds-gray-alpha-200)]",style:Xr,"aria-label":`Copy ${e}`,children:n?t.jsx(Or,{className:"h-3 w-3",style:{color:"var(--ds-green-700)"}}):t.jsx(rt,{className:"h-3 w-3",style:{color:"var(--ds-gray-700)"}})}):null]})}function xt(e){if(typeof e=="string"){const r=e.trim();if(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]")||r.startsWith('"')&&r.endsWith('"'))try{return xt(JSON.parse(r))}catch{return e}return e}if(Array.isArray(e))return e.map(xt);if(e!==null&&typeof e=="object"){if(e.constructor!==Object)return e;const r={};for(const[s,n]of Object.entries(e))r[s]=xt(n);return r}return e}function po(e,r){if(!r||!io.has(r)||e==null||typeof e!="object")return null;const s=e;return et(s.error)?s.error:et(s)?s:null}function ho({data:e,eventType:r}){const s=a.useMemo(()=>po(e,r),[e,r]),[n,o]=a.useState(!1),i=a.useRef(null),l=a.useMemo(()=>xt(e),[e]);a.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const c=a.useMemo(()=>{try{return JSON.stringify(l,null,2)}catch{return String(l)}},[l]),u=a.useCallback(d=>{d.stopPropagation(),navigator.clipboard.writeText(c).then(()=>{o(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{o(!1),i.current=null},1500)})},[c]);return s?t.jsx("div",{className:"p-2",children:t.jsx(bt,{value:s})}):t.jsxs("div",{className:"relative group/payload",children:[t.jsx("div",{className:"overflow-x-auto p-2 text-[11px]",style:{color:"var(--ds-gray-1000)"},children:t.jsx(vt,{data:l,expandLevel:2})}),t.jsx("button",{type:"button",onClick:u,className:"absolute bottom-2 right-2 opacity-0 group-hover/payload:opacity-100 transition-opacity flex items-center gap-1 px-2 py-1 rounded-md text-xs hover:bg-[var(--ds-gray-alpha-200)]",style:{...Xr,color:"var(--ds-gray-700)"},"aria-label":"Copy payload",children:n?t.jsxs(t.Fragment,{children:[t.jsx(Or,{className:"h-3 w-3",style:{color:"var(--ds-green-700)"}}),t.jsx("span",{style:{color:"var(--ds-green-700)"},children:"Copied"})]}):t.jsxs(t.Fragment,{children:[t.jsx(rt,{className:"h-3 w-3"}),t.jsx("span",{children:"Copy"})]})})]})}const xo=[{value:"desc",label:"Newest"},{value:"asc",label:"Oldest"}];function dr(){return t.jsx("div",{className:"flex-1 overflow-hidden",children:Array.from({length:16},(e,r)=>t.jsxs("div",{className:"flex items-center gap-0",style:{height:40},children:[t.jsxs("div",{className:"relative flex-shrink-0 self-stretch flex items-center",style:{width:tt},children:[t.jsx("div",{style:{position:"absolute",left:8,top:r===0?"50%":0,bottom:0,width:2},children:t.jsx(Q,{className:"w-full h-full",style:{borderRadius:1}})}),t.jsx(Q,{className:"flex-shrink-0",style:{width:r%4===0?8:6,height:r%4===0?8:6,borderRadius:"50%",marginLeft:r%4===0?5:6}})]}),t.jsx("div",{className:"w-5 flex-shrink-0 flex items-center justify-center",children:t.jsx(Q,{className:"w-5 h-5",style:{borderRadius:4}})}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"2 1 0%"},children:t.jsx(Q,{className:"h-3",style:{width:"70%"}})}),t.jsxs("div",{className:"min-w-0 px-4 flex items-center gap-1.5",style:{flex:"2 1 0%"},children:[t.jsx(Q,{className:"flex-shrink-0",style:{width:6,height:6,borderRadius:"50%"}}),t.jsx(Q,{className:"h-3",style:{width:"60%"}})]}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"2 1 0%"},children:t.jsx(Q,{className:"h-3",style:{width:"50%"}})}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"3 1 0%"},children:t.jsx(Q,{className:"h-3",style:{width:"75%"}})}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"3 1 0%"},children:t.jsx(Q,{className:"h-3",style:{width:"75%"}})})]},r))})}function go({event:e,index:r,isFirst:s,isLast:n,isExpanded:o,onToggleExpand:i,activeGroupKey:l,selectedGroupKey:c,selectedGroupRange:u,correlationNameMap:d,workflowName:p,durationMap:h,onSelectGroup:m,onHoverGroup:f,onLoadEventData:A,cachedEventData:N,onCacheEventData:x,encryptionKey:k,onEncryptedDataDetected:v}){const[R,T]=a.useState(!1),[P,C]=a.useState(N),[E,w]=a.useState(null),[g,y]=a.useState(N!==null);a.useEffect(()=>{N!==null&&!k&&Ht(N)&&(v==null||v())},[]);const _=jt(e.eventType)?"__run__":e.correlationId??void 0,S=co(e.eventType),I=new Date(e.createdAt),B="eventData"in e&&e.eventData!=null,O=jt(e.eventType),L=O?p??"-":e.correlationId?d.get(e.correlationId)??"-":"-",D=e.correlationId??(O?"__run__":""),b=D?h.get(D):void 0,F=l!==void 0,U=_!==void 0&&_===l,$=F&&!U,K=F&&U,J=F&&U&&!O,X=u!==null&&r>=u.first&&r<=u.last,j=u!==null&&r===u.first,M=u!==null&&r===u.last,W=a.useCallback(async()=>{if(P===null){if(N!==null){C(N),y(!0);return}if(!R){T(!0),w(null);try{if(!A){w("Event details unavailable");return}const V=await A(e);V!=null&&(C(V),x(e.eventId,V),!k&&Ht(V)&&(v==null||v()))}catch(V){w(V instanceof Error?V.message:"Failed to load event details")}finally{T(!1),y(!0)}}}},[e,P,R,A,x,k,v,N]);a.useEffect(()=>{!o||R||W()},[]),a.useEffect(()=>{k&&g&&A&&(C(null),y(!1),A(e).then(V=>{V!=null&&(C(V),x(e.eventId,V)),y(!0)}).catch(()=>{y(!0)}))},[k]);const z=a.useCallback(()=>{m(_===c?void 0:_),i(e.eventId),o||W()},[c,_,m,i,e.eventId,o,W]),ee=P??(B?e.eventData:null),H=R?P:ee,Z=$?.3:1;return t.jsxs("div",{"data-event-id":e.eventId,onMouseEnter:()=>f(_),onMouseLeave:()=>f(void 0),children:[t.jsxs("div",{role:"button",tabIndex:0,onClick:z,onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&z()},className:"w-full text-left flex items-center gap-0 text-[13px] hover:bg-[var(--ds-gray-alpha-100)] transition-colors cursor-pointer",style:{minHeight:40},children:[t.jsx(lr,{isFirst:s,isLast:n&&!o,isRunLevel:O,statusDotColor:S,pulse:K,hasSelection:F,showBranch:J,showLaneLine:X,isLaneStart:j,isLaneEnd:M}),t.jsxs("div",{className:"flex items-center flex-1 min-w-0",style:{opacity:Z,transition:"opacity 150ms"},children:[t.jsx("div",{className:"flex items-center justify-center w-5 h-5 flex-shrink-0 rounded",style:{border:"1px solid var(--ds-gray-400)"},children:t.jsx(Kt,{className:"h-3 w-3 transition-transform",style:{color:"var(--ds-gray-900)",transform:o?"rotate(90deg)":"rotate(0deg)"}})}),t.jsx("div",{className:"tabular-nums min-w-0 px-4",style:{color:"var(--ds-gray-900)",flex:"2 1 0%"},children:t.jsx(Yr,{date:I,children:t.jsx("span",{children:lo(I)})})}),t.jsx("div",{className:"font-medium min-w-0 px-4",style:{flex:"2 1 0%"},children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",style:{color:"var(--ds-gray-900)"},children:[t.jsxs("span",{style:{position:"relative",display:"inline-flex",width:6,height:6,flexShrink:0},children:[K&&t.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:S,opacity:.75,animation:Jr}}),t.jsx("span",{style:{position:"relative",width:6,height:6,borderRadius:"50%",backgroundColor:S}})]}),Qr(e.eventType)]})}),t.jsx("div",{className:"min-w-0 px-4 overflow-hidden text-ellipsis whitespace-nowrap",style:{flex:"2 1 0%"},title:L!=="-"?L:void 0,children:L}),t.jsx(cr,{value:e.correlationId||"",className:"font-mono",style:{flex:"3 1 0%"}}),t.jsx(cr,{value:e.eventId,className:"font-mono",style:{flex:"3 1 0%"}})]})]}),o&&t.jsxs("div",{className:"flex",children:[t.jsx(lr,{isFirst:!1,isLast:n,isRunLevel:O,hasSelection:F,showBranch:!1,showLaneLine:X&&!M,isLaneStart:!1,isLaneEnd:!1,continuationOnly:!0}),t.jsx("div",{className:"w-5 flex-shrink-0"}),t.jsxs("div",{className:"flex-1 my-1.5 mr-3 ml-2 py-2 rounded-md border overflow-hidden",style:{borderColor:"var(--ds-gray-alpha-200)",opacity:Z,transition:"opacity 150ms"},children:[((b==null?void 0:b.queued)!==void 0||(b==null?void 0:b.ran)!==void 0)&&t.jsxs("div",{className:"px-2 pb-1.5 text-xs flex gap-3",style:{color:"var(--ds-gray-900)"},children:[b.queued!==void 0&&b.queued>0&&t.jsxs("span",{children:["Queued for"," ",t.jsx("span",{className:"font-mono tabular-nums",children:sr(b.queued)})]}),b.ran!==void 0&&t.jsxs("span",{children:["Ran for"," ",t.jsx("span",{className:"font-mono tabular-nums",children:sr(b.ran)})]})]}),H!=null?t.jsx(ho,{data:H,eventType:e.eventType}):E?t.jsx("div",{className:"rounded-md border p-3 text-xs",style:{borderColor:"var(--ds-red-400)",backgroundColor:"var(--ds-red-100)",color:"var(--ds-red-900)"},children:E}):R||P===null&&!g&&e.correlationId?t.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[t.jsx(Q,{className:"h-3",style:{width:"75%"}}),t.jsx(Q,{className:"h-3",style:{width:"50%"}}),t.jsx(Q,{className:"h-3",style:{width:"60%"}})]}):t.jsx("div",{className:"p-2 text-xs",style:{color:"var(--ds-gray-900)"},children:"No data"})]})]})]})}function yo({events:e,run:r,onLoadEventData:s,hasMoreEvents:n=!1,isLoadingMoreEvents:o=!1,onLoadMoreEvents:i,encryptionKey:l,isLoading:c=!1,sortOrder:u,onSortOrderChange:d,onDecrypt:p,isDecrypting:h=!1}){const[m,f]=a.useState("asc"),A=u??m,N=a.useCallback(H=>{d?d(H):f(H)},[d]),x=a.useMemo(()=>{if(!e||e.length===0)return[];const H=A==="desc"?-1:1;return[...e].sort((Z,V)=>H*(new Date(Z.createdAt).getTime()-new Date(V.createdAt).getTime()))},[e,A]),k=a.useMemo(()=>{if(!e)return!1;for(const H of e){const Z=H.eventData;if(Ht(Z))return!0}return!1},[e]),[v,R]=a.useState(!1),T=a.useCallback(()=>{R(!0)},[]),P=k||v,{correlationNameMap:C,workflowName:E}=a.useMemo(()=>uo(e??null,r??null),[e,r]),w=a.useMemo(()=>fo(x),[x]),[g,y]=a.useState(void 0),[_,S]=a.useState(void 0),I=a.useCallback(H=>{y(H)},[]),B=a.useCallback(H=>{S(H)},[]),O=g??_,[L,D]=a.useState(()=>new Set),b=a.useCallback(H=>{D(Z=>{const V=new Set(Z);return V.has(H)?V.delete(H):V.add(H),V})},[]),F=a.useRef(new Map),U=a.useCallback((H,Z)=>{F.current.set(H,Z)},[]),$=a.useMemo(()=>{const H=new Map;for(const Z of x){const V=jt(Z.eventType)?"__run__":Z.correlationId??"";V&&H.set(Z.eventId,V)}return H},[x]);a.useEffect(()=>{g!==void 0&&D(H=>{if(H.size===0)return H;let Z=!1;const V=new Set;for(const Y of H)$.get(Y)===g?V.add(Y):Z=!0;return Z?V:H})},[g,$]);const K=a.useMemo(()=>{if(!O||O==="__run__")return null;let H=-1,Z=-1;for(let V=0;V<x.length;V++)x[V].correlationId===O&&(H===-1&&(H=V),Z=V);return H>=0?{first:H,last:Z}:null},[O,x]),[J,X]=a.useState(""),j=a.useRef(null),M=a.useMemo(()=>{const H=[];for(let Z=0;Z<x.length;Z++){const V=x[Z],Y=jt(V.eventType),se=Y?E??"":V.correlationId?C.get(V.correlationId)??"":"";H.push({fields:[V.eventId,V.correlationId??"",V.eventType,Qr(V.eventType),se].map(oe=>oe.toLowerCase()),groupKey:V.correlationId??(Y?"__run__":void 0),eventId:V.eventId,index:Z})}return H},[x,C,E]);a.useEffect(()=>{var Y;const H=J.trim().toLowerCase();if(!H){y(void 0);return}let Z=null,V=0;for(const se of M)for(const oe of se.fields)if(oe&&oe.includes(H)){const fe=H.length/oe.length;fe>V&&(V=fe,Z=se)}Z&&(y(Z.groupKey),(Y=j.current)==null||Y.scrollToIndex({index:Z.index,align:"center",behavior:"smooth"}))},[J,M]);const W=a.useRef(!1);x.length>0&&(W.current=!0);const z=c&&!W.current,ee=c&&W.current&&x.length===0;return z?t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[t.jsx("div",{style:{padding:6},children:t.jsx(Q,{style:{height:40,borderRadius:6}})}),t.jsxs("div",{className:"flex items-center gap-0 h-10 border-b flex-shrink-0",style:{borderColor:"var(--ds-gray-alpha-200)"},children:[t.jsx("div",{className:"flex-shrink-0",style:{width:tt}}),t.jsx("div",{className:"w-5 flex-shrink-0"}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"2 1 0%"},children:t.jsx(Q,{className:"h-3",style:{width:40}})}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"2 1 0%"},children:t.jsx(Q,{className:"h-3",style:{width:72}})}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"2 1 0%"},children:t.jsx(Q,{className:"h-3",style:{width:44}})}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"3 1 0%"},children:t.jsx(Q,{className:"h-3",style:{width:92}})}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"3 1 0%"},children:t.jsx(Q,{className:"h-3",style:{width:60}})})]}),t.jsx(dr,{})]}):!c&&(!e||e.length===0)?t.jsx("div",{className:"flex items-center justify-center h-full text-sm",style:{color:"var(--ds-gray-700)"},children:"No events found"}):t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[t.jsx("style",{children:"@keyframes workflow-dot-pulse{0%{transform:scale(1);opacity:.7}70%,100%{transform:scale(2.2);opacity:0}}"}),t.jsxs("div",{style:{padding:6,backgroundColor:"var(--ds-background-100)",display:"flex",gap:6},children:[t.jsxs("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,boxShadow:"0 0 0 1px var(--ds-gray-alpha-400)",background:"var(--ds-background-100)",height:40,flex:1,minWidth:0},children:[t.jsx("div",{style:{width:40,height:40,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--ds-gray-800)",flexShrink:0},children:t.jsxs("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",focusable:"false",children:[t.jsx("circle",{cx:"7",cy:"7",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("path",{d:"M11.5 11.5L14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),t.jsx("input",{type:"search",placeholder:"Search by name, event type, or ID…",value:J,onChange:H=>X(H.target.value),style:{marginLeft:-16,paddingInline:12,fontFamily:"inherit",fontSize:14,background:"transparent",border:"none",outline:"none",height:40,width:"100%"}})]}),t.jsx(eo,{options:xo,value:A,onChange:N}),(P||l)&&p&&t.jsx(Yt,{decrypted:!!l,loading:h,onClick:p})]}),t.jsxs("div",{className:"flex items-center gap-0 text-[13px] font-medium h-10 border-b flex-shrink-0",style:{borderColor:"var(--ds-gray-alpha-200)",color:"var(--ds-gray-900)",backgroundColor:"var(--ds-background-100)"},children:[t.jsx("div",{className:"flex-shrink-0",style:{width:tt}}),t.jsx("div",{className:"w-5 flex-shrink-0"}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"2 1 0%"},children:"Time"}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"2 1 0%"},children:"Event Type"}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"2 1 0%"},children:"Name"}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"3 1 0%"},children:"Correlation ID"}),t.jsx("div",{className:"min-w-0 px-4",style:{flex:"3 1 0%"},children:"Event ID"})]}),ee?t.jsx(dr,{}):t.jsx(xn,{ref:j,totalCount:x.length,overscan:20,defaultItemHeight:40,endReached:()=>{!n||o||i==null||i()},itemContent:H=>{const Z=x[H];return t.jsx(go,{event:Z,index:H,isFirst:H===0,isLast:H===x.length-1,isExpanded:L.has(Z.eventId),onToggleExpand:b,activeGroupKey:O,selectedGroupKey:g,selectedGroupRange:K,correlationNameMap:C,workflowName:E,durationMap:w,onSelectGroup:I,onHoverGroup:B,onLoadEventData:s,cachedEventData:F.current.get(Z.eventId)??null,onCacheEventData:U,encryptionKey:l,onEncryptedDataDetected:T})},style:{flex:1,minHeight:0}}),t.jsxs("div",{className:"relative flex-shrink-0 flex items-center h-10 border-t px-4 text-xs",style:{borderColor:"var(--ds-gray-alpha-200)",color:"var(--ds-gray-900)",backgroundColor:"var(--ds-background-100)"},children:[t.jsxs("span",{children:[x.length," event",x.length!==1?"s":""," loaded"]}),n&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:t.jsx("div",{className:"pointer-events-auto",children:t.jsx(Jn,{loading:o,onClick:()=>void(i==null?void 0:i())})})})]})]})}function vo({messages:e}){return e.length===0?t.jsx("div",{className:"text-center py-8 text-[11px]",style:{color:"var(--ds-gray-600)"},children:"No messages"}):t.jsx("div",{className:"flex flex-col gap-3 p-3",children:e.map((r,s)=>t.jsx(wo,{message:r},s))})}function wo({message:e}){const r=e.role,s=ko(e.content),n=jo(r);return t.jsxs("div",{className:"rounded-md border text-[11px]",style:{backgroundColor:n.bg,borderColor:n.border},children:[t.jsx("div",{className:"px-2.5 py-1 border-b text-[10px] font-medium uppercase tracking-wide",style:{borderColor:n.border,color:n.label},children:r}),t.jsx("div",{className:"px-2.5 py-2 space-y-2",children:s.map((o,i)=>t.jsx(bo,{part:o,role:r},i))})]})}function bo({part:e,role:r}){return e.type==="text"?e.text?r==="assistant"?t.jsx("div",{className:"prose prose-sm max-w-none text-[11px] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",style:{color:"var(--ds-gray-1000)"},children:t.jsx(gn,{children:e.text})}):t.jsx("div",{className:"whitespace-pre-wrap break-words",style:{color:"var(--ds-gray-1000)"},children:e.text}):null:e.type==="tool-call"?t.jsxs("div",{className:"rounded border px-2 py-1.5",style:{backgroundColor:"var(--ds-purple-100)",borderColor:"var(--ds-purple-300)"},children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium",children:[t.jsx("span",{children:"🔧"}),t.jsx("span",{style:{color:"var(--ds-purple-900)"},children:e.toolName})]}),e.input!=null&&t.jsx("div",{className:"mt-1.5 overflow-x-auto p-1.5 rounded",style:{backgroundColor:"var(--ds-gray-100)"},children:typeof e.input=="string"?t.jsx("pre",{className:"text-[10px]",style:{color:"var(--ds-gray-800)"},children:e.input}):t.jsx(vt,{data:e.input})})]}):e.type==="tool-result"?t.jsxs("div",{className:"rounded border px-2 py-1.5",style:{backgroundColor:"var(--ds-green-100)",borderColor:"var(--ds-green-300)"},children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium",children:[t.jsx("span",{children:"✓"}),t.jsxs("span",{style:{color:"var(--ds-green-900)"},children:[e.toolName," result"]})]}),e.output!=null&&t.jsx("div",{className:"mt-1.5 overflow-x-auto max-h-[200px] overflow-y-auto p-1.5 rounded",style:{backgroundColor:"var(--ds-gray-100)"},children:typeof e.output=="string"?t.jsx("pre",{className:"text-[10px]",style:{color:"var(--ds-gray-800)"},children:e.output}):t.jsx(vt,{data:e.output,expandLevel:1})})]}):null}function jo(e){switch(e){case"user":return{bg:"var(--ds-blue-100)",border:"var(--ds-blue-300)",label:"var(--ds-blue-700)"};case"assistant":return{bg:"var(--ds-gray-100)",border:"var(--ds-gray-300)",label:"var(--ds-gray-700)"};case"system":return{bg:"var(--ds-amber-100)",border:"var(--ds-amber-300)",label:"var(--ds-amber-700)"};case"tool":return{bg:"var(--ds-green-50)",border:"var(--ds-green-300)",label:"var(--ds-green-700)"};default:return{bg:"var(--ds-gray-100)",border:"var(--ds-gray-300)",label:"var(--ds-gray-700)"}}}function ko(e){return typeof e=="string"?[{type:"text",text:e}]:Array.isArray(e)?e.map(r=>typeof r=="string"?{type:"text",text:r}:(r==null?void 0:r.type)==="text"?{type:"text",text:String(r.text??"")}:(r==null?void 0:r.type)==="tool-call"?{type:"tool-call",toolName:r.toolName,input:r.input}:(r==null?void 0:r.type)==="tool-result"?{type:"tool-result",toolName:r.toolName,output:r.output}:{type:"text",text:""}):[]}const No=e=>{if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||e===null)return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}};function es({data:e}){const r=Ue();return t.jsxs("div",{className:"relative overflow-x-auto rounded-md border p-3 pt-9",style:{borderColor:"var(--ds-gray-300)"},children:[t.jsx("button",{type:"button","aria-label":"Copy data",title:"Copy",className:"!absolute !right-2 !top-2 !flex !h-6 !w-6 !items-center !justify-center !rounded-md !border !bg-[var(--ds-background-100)] !text-[var(--ds-gray-800)] transition-transform transition-colors duration-100 hover:!bg-[var(--ds-gray-alpha-200)] active:!scale-95 active:!bg-[var(--ds-gray-alpha-300)]",style:{borderColor:"var(--ds-gray-300)"},onClick:()=>{navigator.clipboard.writeText(No(e)).then(()=>{r.success("Copied to clipboard")}).catch(()=>{r.error("Failed to copy")})},children:t.jsx(rt,{size:12})}),t.jsx(vt,{data:e})]})}function ie({summary:e,children:r,onToggle:s,disabled:n=!1,summaryClassName:o,contentClassName:i}){return n?t.jsx("div",{className:`rounded-md border px-2.5 py-1.5 text-xs ${o??""}`,style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)",color:"var(--ds-gray-700)",cursor:"not-allowed",opacity:.8},children:e}):t.jsxs("details",{className:"group",onToggle:l=>s==null?void 0:s(l.target.open),children:[t.jsx("summary",{className:`cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 [&::-webkit-details-marker]:hidden ${o??""}`,style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)",color:"var(--ds-gray-900)",listStyle:"none"},children:t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(Kt,{size:14,className:"shrink-0 transition-transform group-open:rotate-90"}),e]})}),t.jsxs("div",{className:`relative pl-6 mt-3 ${i??""}`,children:[t.jsx("div",{className:"absolute left-3 -top-3 w-px h-3",style:{backgroundColor:"var(--ds-gray-400)"}}),t.jsx("div",{className:"absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg",style:{borderColor:"var(--ds-gray-400)"}}),t.jsx("div",{className:"absolute left-6 top-3 w-0 h-px -translate-y-px",style:{backgroundColor:"var(--ds-gray-400)"}}),t.jsx("div",{children:r})]})]})}function Co({active:e,onClick:r,children:s}){return t.jsx("button",{type:"button",role:"tab","aria-selected":e,tabIndex:e?0:-1,onClick:r,className:"px-3 py-1.5 text-[11px] font-medium transition-colors -mb-px",style:{backgroundColor:"transparent",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:`2px solid ${e?"var(--ds-blue-600)":"transparent"}`,borderRadius:0,outline:"none",boxShadow:"none",cursor:"pointer",color:e?"var(--ds-gray-1000)":"var(--ds-gray-600)"},children:s})}function Eo({tabs:e,activeTab:r,onTabChange:s,ariaLabel:n,children:o}){const i=a.useCallback(l=>{if(l.key!=="ArrowRight"&&l.key!=="ArrowLeft")return;l.preventDefault();const c=e.findIndex(d=>d.id===r),u=l.key==="ArrowRight"?(c+1)%e.length:(c-1+e.length)%e.length;s(e[u].id)},[e,r,s]);return t.jsxs("div",{className:"rounded-md border",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"transparent"},children:[t.jsx("div",{className:"flex gap-1 border-b",role:"tablist","aria-label":n,onKeyDown:i,style:{borderColor:"var(--ds-gray-300)",backgroundColor:"transparent"},children:e.map(l=>t.jsx(Co,{active:r===l.id,onClick:()=>s(l.id),children:l.label},l.id))}),t.jsx("div",{role:"tabpanel",children:o})]})}const So=[{id:"conversation",label:"Conversation"},{id:"json",label:"Raw JSON"}];function Io({conversation:e,args:r}){const[s,n]=a.useState("conversation");return t.jsx(ie,{summary:`Input (${e.length} messages)`,children:t.jsx(Eo,{tabs:So,activeTab:s,onTabChange:n,ariaLabel:"Conversation view",children:s==="conversation"?t.jsx(vo,{messages:e}):t.jsx("div",{className:"p-3",children:Array.isArray(r)?r.map((o,i)=>t.jsx("div",{className:"mt-2 first:mt-0",children:le(o)},i)):le(r)})})})}function Ze(){return t.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border px-3 py-2 text-xs",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)",color:"var(--ds-gray-700)"},children:[t.jsx(Vr,{className:"h-3 w-3"}),t.jsx("span",{className:"font-medium",children:"Encrypted"})]})}function Ye(){return t.jsx("div",{className:"flex items-center gap-1.5 rounded-md border px-3 py-2 text-xs",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)",color:"var(--ds-gray-700)"},children:t.jsx("span",{className:"font-medium",children:"Data expired"})})}function le(e){return t.jsx(es,{data:e})}const be=e=>e==null?!1:typeof e=="string"?e.trim().length>0:Array.isArray(e)?e.length>0:typeof e=="object"?Object.keys(e).length>0:!0,ur=["workflowName","moduleSpecifier","stepName","status","stepId","hookId","eventId","runId","attempt","token","receivedCount","lastReceivedAt","disposedAt","correlationId","eventType","deploymentId","specVersion","workflowCoreVersion","ownerId","projectId","environment","executionContext","createdAt","startedAt","updatedAt","completedAt","expiredAt","retryAfter","error","metadata","eventData","input","output","resumeAt"],Lt=(e,r)=>{const s=ur.indexOf(e)||0,n=ur.indexOf(r)||0;return s-n},To={workflowCoreVersion:"@workflow/core version",receivedCount:"times resolved"},Ro=e=>To[e]??e,Ao=e=>{const r=String(e),s=st(r);if(s)return s.moduleSpecifier;const n=ze(r);return n?n.moduleSpecifier:r},Xt=e=>{if(e==null)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="string"&&e.trim().length===0)return null;const r=typeof e=="number"?new Date(e):new Date(String(e));return Number.isNaN(r.getTime())?null:r},Jt=e=>e.toLocaleString(void 0,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3}),Do=e=>{const r=Xt(e);return r?Jt(r):"-"},fr=e=>{const r=Xt(e);return r?Jt(r):null},Me=e=>{const r=Xt(e);return r?t.jsx(Yr,{date:r,children:t.jsx("span",{children:Jt(r)})}):null},Je={workflowName:e=>{var r;return((r=ze(String(e)))==null?void 0:r.shortName)??"?"},moduleSpecifier:e=>Ao(e),stepName:e=>{var r;return((r=st(String(e)))==null?void 0:r.shortName)??"?"},runId:e=>String(e),stepId:e=>String(e),hookId:e=>String(e),eventId:e=>String(e),status:e=>String(e),attempt:e=>String(e),token:e=>String(e),isWebhook:e=>String(e),receivedCount:e=>String(e),lastReceivedAt:fr,disposedAt:fr,eventType:e=>String(e),correlationId:e=>String(e),deploymentId:e=>String(e),specVersion:e=>String(e),workflowCoreVersion:e=>String(e),ownerId:e=>null,projectId:e=>null,environment:e=>null,executionContext:e=>null,createdAt:Me,startedAt:Me,updatedAt:Me,completedAt:Me,expiredAt:Me,retryAfter:Me,resumeAt:Me,metadata:e=>be(e)?ye(e)?t.jsx(Ze,{}):Le(e)?t.jsx(Ye,{}):le(e):null,input:(e,r)=>{if(ye(e))return t.jsx(Ze,{});if(Le(e))return t.jsx(Ye,{});if(e&&typeof e=="object"&&"args"in e){const{args:o,closureVars:i,thisVal:l}=e,c=Array.isArray(o)?o.length:0,u=c===1?"argument":"arguments",d=be(i),p=be(l),h=be(o);if(r!=null&&r.stepName&&vn(r.stepName)){const m=wn(o);if(m&&m.length>0)return t.jsxs(t.Fragment,{children:[t.jsx(Io,{conversation:m,args:o}),d&&t.jsx(ie,{summary:"Closure Variables",children:le(i)}),p&&t.jsx(ie,{summary:"This Value",children:le(l)})]})}return!h&&!d&&!p?t.jsx(ie,{summary:"Input (no data)",disabled:!0,summaryClassName:"text-base py-2"}):t.jsxs(t.Fragment,{children:[t.jsx(ie,{summary:`Input (${c} ${u})`,summaryClassName:"text-base py-2",contentClassName:"mt-0",children:Array.isArray(o)?o.map((m,f)=>t.jsx("div",{className:"mt-2 first:mt-0",children:le(m)},f)):le(o)}),d&&t.jsx(ie,{summary:"Closure Variables",children:le(i)}),p&&t.jsx(ie,{summary:"this",children:le(l)})]})}const s=Array.isArray(e)?e.length:0,n=s===1?"argument":"arguments";return be(e)?t.jsx(ie,{summary:`Input (${s} ${n})`,summaryClassName:"text-base py-2",contentClassName:"mt-0",children:Array.isArray(e)?e.map((o,i)=>t.jsx("div",{className:"mt-2 first:mt-0",children:le(o)},i)):le(e)}):t.jsx(ie,{summary:"Input (no data)",disabled:!0,summaryClassName:"text-base py-2"})},output:e=>be(e)?ye(e)?t.jsx(Ze,{}):Le(e)?t.jsx(Ye,{}):t.jsx(ie,{summary:"Output",summaryClassName:"text-base py-2",contentClassName:"mt-0",children:le(e)}):null,error:e=>ye(e)?t.jsx(Ze,{}):Le(e)?t.jsx(Ye,{}):be(e)?et(e)?t.jsx(ie,{summary:"Error",summaryClassName:"text-base py-2",contentClassName:"mt-0",children:t.jsx(bt,{value:e})}):t.jsx(ie,{summary:"Error",summaryClassName:"text-base py-2",contentClassName:"mt-0",children:le(e)}):null,eventData:e=>ye(e)?t.jsx(Ze,{}):Le(e)?t.jsx(Ye,{}):be(e)?t.jsx(ie,{summary:"Event Data",children:le(e)}):null},mr=["input","output","error","metadata","eventData"],Mo=()=>t.jsx("div",{className:"text-copy-12 rounded-md border p-4 my-2",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)",color:"var(--ds-gray-700)"},children:t.jsx("span",{children:"The data for this run has expired and is no longer available."})}),_o=({attribute:e,value:r,isLoading:s,inline:n=!1,context:o})=>{if(s&&(e==="input"||e==="output"||e==="eventData")&&!be(r))return t.jsxs("div",{className:`my-2 flex flex-col ${e==="input"||e==="output"?"gap-2 my-3.5":"gap-0"}`,children:[t.jsx("span",{className:`${e==="input"||e==="output"?"text-base":"text-xs"} font-medium first-letter:uppercase`,style:{color:"var(--ds-gray-700)"},children:e}),t.jsx(Q,{className:"h-9 w-full rounded-md"})]});const l=Je[e];if(!l)return null;const c=l(r,o);return c?n?t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"text-[11px] font-medium",style:{color:"var(--ds-gray-700)"},children:e}),t.jsx("span",{className:"text-[11px]",style:{color:"var(--ds-gray-1000)"},children:c})]}):t.jsxs("div",{className:"relative",children:[typeof s=="boolean"&&s&&t.jsx("div",{className:"absolute top-9 right-4",children:t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2",style:{borderColor:"var(--ds-gray-900)"}})}),t.jsxs("div",{className:`my-2 flex flex-col ${e==="input"||e==="output"||e==="error"?"gap-2 my-3.5":"gap-0"}`,children:[t.jsx("span",{className:`${e==="input"||e==="output"||e==="error"?"text-base":"text-xs"} font-medium first-letter:uppercase`,style:{color:"var(--ds-gray-700)"},children:e}),t.jsx("span",{className:"text-xs",style:{color:"var(--ds-gray-1000)"},children:c})]},e)]}):null},Lo=({data:e,moduleSpecifier:r,isLoading:s,error:n,expiredAt:o,onStreamClick:i,resource:l})=>{const c=Ue(),u=a.useMemo(()=>{const x={...e},k=e.executionContext;return k!=null&&k.workflowCoreVersion&&(x.workflowCoreVersion=k.workflowCoreVersion),r?x.moduleSpecifier=r:typeof e.stepName=="string"?x.moduleSpecifier=e.stepName:typeof e.workflowName=="string"&&(x.moduleSpecifier=e.workflowName),x},[e,r]),d=o!=null&&new Date(o)<new Date,p=Object.keys(u).filter(x=>!mr.includes(x)).sort(Lt),h=a.useMemo(()=>{const x=Object.keys(u).filter(v=>mr.includes(v)).sort(Lt);if(!s)return x;const k=["input","output"];for(const v of k)x.includes(v)||x.push(v);return x.sort(Lt)},[u,s]),m=p.filter(x=>{const k=Je[x];return k?k(u[x])!==null:!1}),f=a.useMemo(()=>{const x=[...m],k=x.indexOf("moduleSpecifier");if(k===-1)return x;x.splice(k,1);const v=x.indexOf("workflowName");if(v!==-1)return x.splice(v+1,0,"moduleSpecifier"),x;const R=x.indexOf("stepName");return R!==-1?(x.splice(R+1,0,"moduleSpecifier"),x):(x.unshift("moduleSpecifier"),x)},[m]),A=a.useMemo(()=>({stepName:u.stepName}),[u.stepName]),N=a.useCallback(x=>{navigator.clipboard.writeText(x).then(()=>{c.success("moduleSpecifier copied")}).catch(()=>{c.error("Failed to copy moduleSpecifier")})},[]);return t.jsx(yn.Provider,{value:i,children:t.jsxs("div",{children:[m.length>0&&t.jsxs("div",{className:"mb-3 flex flex-col overflow-hidden rounded-lg border",style:{borderColor:"var(--ds-gray-300)"},children:[f.map((x,k)=>{var w;const v=(w=Je[x])==null?void 0:w.call(Je,u[x]),R=x==="moduleSpecifier",T=typeof v=="string"?v:String(v??u.moduleSpecifier??""),P=x!=="workflowCoreVersion",C=s&&l==="sleep"&&!u.resumeAt,E=k<f.length-1||C;return t.jsxs("div",{className:"py-1",children:[t.jsxs("div",{className:"flex min-h-[32px] items-center justify-between gap-4 rounded-sm px-2.5 py-1",children:[t.jsx("span",{className:P?"text-[14px] first-letter:uppercase":"text-[14px]",style:{color:"var(--ds-gray-700)"},children:Ro(x)}),R?t.jsx("button",{type:"button",className:"min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono",style:{color:"var(--ds-gray-1000)",background:"transparent",border:"none",padding:0},title:T,onClick:()=>N(T),children:T}):t.jsx("span",{className:"min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono",style:{color:"var(--ds-gray-1000)"},children:v})]}),E?t.jsx("div",{className:"mx-2.5 border-b",style:{borderColor:"var(--ds-gray-300)"}}):null]},x)}),s&&l==="sleep"&&!u.resumeAt&&t.jsx("div",{className:"py-1",children:t.jsxs("div",{className:"flex min-h-[32px] items-center justify-between gap-4 rounded-sm px-2.5 py-1",children:[t.jsx("span",{className:"text-[14px] first-letter:uppercase",style:{color:"var(--ds-gray-700)"},children:"resumeAt"}),t.jsx(Q,{className:"h-4 w-[55%]"})]})})]}),n?t.jsx($r,{title:"Failed to load resource details",details:n.message,className:"my-4"}):d?t.jsx(Mo,{}):t.jsx(t.Fragment,{children:h.map(x=>t.jsx(_o,{isLoading:s,attribute:x,value:u[x],context:A},x))})]})})},Po=new Set(["step_failed","step_retrying"]),Fo=new Set(["step_created","step_completed","step_failed","step_retrying","hook_created","hook_received","run_created","run_completed","run_failed","wait_created","wait_completed"]);function Oo({event:e,onLoadEventData:r,encryptionKey:s}){const[n,o]=a.useState(null),[i,l]=a.useState(!1),[c,u]=a.useState(null),d=a.useRef(!1),p=a.useRef(null),h="eventData"in e&&e.eventData!=null?e.eventData:null,m=n??h,f=Fo.has(e.eventType),A=a.useCallback(async v=>{if(!(!r||!e.correlationId||!e.eventId)&&!(!(v!=null&&v.force)&&p.current!==null))try{l(!0),u(null);const R=await r(e.correlationId,e.eventId);p.current=R,o(R)}catch(R){u(R instanceof Error?R.message:String(R))}finally{l(!1)}},[r,e.correlationId,e.eventId]),N=a.useCallback(async()=>{i||(d.current=!0,await A())},[i,A]);a.useEffect(()=>{!s||!d.current||(p.current=null,o(null),A({force:!0}))},[s,A]);const x=new Date(e.createdAt),k=i?n:m;return t.jsxs(ie,{summaryClassName:"text-base py-2",summary:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-medium",style:{color:"var(--ds-gray-1000)"},children:e.eventType})," ","-"," ",t.jsx("span",{style:{color:"var(--ds-gray-700)"},children:Do(x.getTime())})]}),onToggle:f?v=>{v&&N()}:void 0,children:[t.jsxs("div",{className:"flex flex-col divide-y rounded-md border overflow-hidden",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)"},children:[t.jsxs("div",{className:"flex min-h-[32px] items-center justify-between gap-4 px-2.5 py-1.5",style:{borderColor:"var(--ds-gray-300)"},children:[t.jsx("span",{className:"text-[14px]",style:{color:"var(--ds-gray-700)"},children:"eventId"}),t.jsx("span",{className:"max-w-[70%] truncate text-right text-[13px] font-mono",style:{color:"var(--ds-gray-1000)"},title:e.eventId,children:e.eventId})]}),e.correlationId&&t.jsxs("div",{className:"flex min-h-[32px] items-center justify-between gap-4 px-2.5 py-1.5",style:{borderColor:"var(--ds-gray-300)"},children:[t.jsx("span",{className:"text-[14px]",style:{color:"var(--ds-gray-700)"},children:"correlationId"}),t.jsx("span",{className:"max-w-[70%] truncate text-right text-[13px] font-mono",style:{color:"var(--ds-gray-1000)"},title:e.correlationId,children:e.correlationId})]})]}),i&&t.jsxs("div",{className:"mt-2 rounded-md border p-3",style:{borderColor:"var(--ds-gray-300)"},children:[t.jsx(Q,{className:"h-4 w-[35%]"}),t.jsx(Q,{className:"mt-2 h-4 w-[90%]"}),t.jsx(Q,{className:"mt-2 h-4 w-[75%]"})]}),c&&t.jsx($r,{title:"Failed to load event data",details:c,className:"mt-2"}),k!=null&&t.jsx("div",{className:"mt-2",children:t.jsx(Wo,{eventType:e.eventType,data:k})})]})}function $o(e,r){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const s=e,o=(bn[r]??[]).filter(i=>i in s);return o.length>0&&o.every(i=>Le(s[i]))}function Wo({eventType:e,data:r}){if(Le(r)||$o(r,e))return t.jsx("div",{className:"flex items-center gap-1.5 rounded-md border px-3 py-2 text-xs",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)",color:"var(--ds-gray-700)"},children:t.jsx("span",{className:"font-medium",children:"Data expired"})});if(Po.has(e)&&r!=null&&typeof r=="object"){const s=r;if(et(s.error))return t.jsx(bt,{value:s.error});if(et(s))return t.jsx(bt,{value:s})}return t.jsx(es,{data:r})}function Ho({events:e,isLoading:r=!1,error:s,onLoadEventData:n,encryptionKey:o}){const i=a.useMemo(()=>[...e].sort((l,c)=>new Date(l.createdAt).getTime()-new Date(c.createdAt).getTime()),[e]);return t.jsxs("div",{className:"mt-2",style:{color:"var(--ds-gray-1000)"},children:[t.jsxs("h3",{className:"text-heading-16 font-medium mt-4 mb-2",style:{color:"var(--ds-gray-1000)"},children:["Events ",!r&&`(${i.length})`]}),r?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Q,{className:"h-9 w-full rounded-md"}),t.jsx(Q,{className:"h-9 w-full rounded-md"}),t.jsx(Q,{className:"h-9 w-full rounded-md"})]}):null,!r&&!s&&i.length===0&&t.jsx("div",{className:"text-sm",children:"No events found"}),i.length>0&&!s?t.jsx("div",{className:"flex flex-col gap-4",children:i.map(l=>t.jsx(Oo,{event:l,onLoadEventData:n,encryptionKey:o},l.eventId))}):null]})}function Bo(e){return e!==null&&typeof e=="object"&&"stepId"in e}function Vo(e){return e!==null&&typeof e=="object"&&"runId"in e}function pt(e){return e!==null&&typeof e=="object"&&"hookId"in e}function zo({run:e,onStreamClick:r,spanDetailData:s,spanDetailError:n,spanDetailLoading:o,onSpanSelect:i,onWakeUpSleep:l,onLoadEventData:c,onResolveHook:u,encryptionKey:d,onDecrypt:p,isDecrypting:h=!1,selectedSpan:m}){const f=Ue(),[A,N]=a.useState(!1),[x,k]=a.useState(!1),[v,R]=a.useState(!1),[T,P]=a.useState(new Set),C=m==null?void 0:m.data,E=m==null?void 0:m.rawEvents,w=(E==null?void 0:E.length)??0,{resource:g,resourceId:y,runId:_}=a.useMemo(()=>{if(!m)return{resource:void 0,resourceId:void 0,runId:void 0};const M=m.resource;if(M==="step"&&Bo(C))return{resource:"step",resourceId:C.stepId,runId:C.runId};if(M==="run"&&Vo(C))return{resource:"run",resourceId:C.runId,runId:void 0};if(M==="hook"&&pt(C))return{resource:"hook",resourceId:C.hookId,runId:void 0};if(M==="sleep"){const W=C;return{resource:"sleep",resourceId:m.spanId,runId:W==null?void 0:W.runId}}return{resource:void 0,resourceId:void 0,runId:void 0}},[m,C]),S=a.useRef(i);S.current=i,a.useEffect(()=>{g&&y&&["run","step","hook","sleep"].includes(g)&&S.current({resource:g,resourceId:y,runId:_})},[g,y,_]);const I=a.useMemo(()=>g!=="sleep"||!E||["completed","failed","cancelled"].includes(e.status)||!E.some(ee=>ee.eventType==="wait_created")?!1:!E.some(ee=>ee.eventType==="wait_completed"),[g,E,w,e.status]),B=a.useMemo(()=>!(g!=="hook"||!E||!y||T.has(y)||["completed","failed","cancelled"].includes(e.status)||E.some(z=>z.eventType==="hook_disposed")),[g,y,E,w,e.status,T]),O=n??void 0,L=o??!1,D=a.useMemo(()=>{if(!s)return!1;const M=s;return ye(M.input)||ye(M.output)||ye(M.error)||ye(M.metadata)},[s]),b=a.useMemo(()=>{if(!(g!=="hook"||!y)){if(pt(s)&&s.token)return s.token;if(pt(C)&&C.token)return C.token}},[g,y,s,C]);a.useEffect(()=>{O&&m&&g&&f.error(`Failed to load ${g} details`,{description:O.message})},[O,g,m]);const F=async()=>{if(!(A||!y)){if(!l){f.error("Unable to wake up sleep",{description:"No wake-up handler provided."});return}try{N(!0),(await l(e.runId,y)).stoppedCount>0?f.success("Run woken up",{description:"The sleep call has been interrupted and the run woken up."}):f.info("Sleep already completed",{description:"This sleep call has already finished."})}catch(M){console.error("Failed to wake up run:",M),f.error("Failed to wake up run",{description:M instanceof Error?M.message:"An unknown error occurred"})}finally{N(!1)}}},U=a.useCallback(async M=>{if(!v){if(!u){f.error("Unable to resolve hook",{description:"No resolve handler provided."});return}if(!b){f.error("Unable to resolve hook",{description:"Missing hook token. Try refreshing the run data and retry."});return}try{R(!0);const W=s??C,z=pt(W)?W:void 0;await u(b,M,z),f.success("Hook resolved",{description:"The payload has been sent and the hook resolved."}),k(!1),y&&P(ee=>new Set(ee).add(y))}catch(W){console.error("Failed to resolve hook:",W),f.error("Failed to resolve hook",{description:W instanceof Error?W.message:"An unknown error occurred"})}finally{R(!1)}}},[u,b,v,s,C]),$=s??C,K=a.useMemo(()=>{const M=$,W=M.stepName,z=M.workflowName;if(typeof W=="string")return W;if(typeof z=="string")return z;if(typeof e.workflowName=="string")return e.workflowName},[$,e.workflowName]);if(!m||!g||!y)return null;const J=g.charAt(0).toUpperCase()+g.slice(1),X=g==="sleep"&&I||g==="hook"&&B,j=e.completedAt?"Completed":"Live";return t.jsxs("div",{className:"flex h-full flex-col",children:[t.jsx("div",{className:"border-b px-3 py-3",style:{borderColor:"var(--ds-gray-200)"},children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-flex items-center rounded-full border px-2 py-0.5 text-[13px] font-medium",style:{borderColor:"var(--ds-gray-300)",color:"var(--ds-gray-900)",backgroundColor:"var(--ds-background-100)"},children:J}),t.jsx("span",{className:"text-[13px]",style:{color:e.completedAt?"var(--ds-gray-700)":"var(--ds-green-800)"},children:j})]}),t.jsx("p",{className:"mt-1 truncate font-mono text-[13px]",style:{color:"var(--ds-gray-700)"},title:y,children:y})]}),(D||d)&&p&&t.jsx(Yt,{decrypted:!!d,loading:h,onClick:p})]})}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-3 pt-3 pb-8",children:[X&&t.jsxs("div",{className:"mb-4 rounded-lg border p-2",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)"},children:[t.jsx("p",{className:"mb-2 px-1 text-[13px] font-medium uppercase tracking-wide",style:{color:"var(--ds-gray-700)"},children:"Actions"}),t.jsxs("div",{className:"flex flex-col gap-2",children:[g==="sleep"&&I&&t.jsxs("button",{type:"button",onClick:F,disabled:A,className:Pe("flex items-center justify-center gap-2 rounded-md px-3 py-2 text-sm font-medium","disabled:opacity-50 disabled:cursor-not-allowed transition-colors",A?"opacity-50 cursor-not-allowed":"cursor-pointer"),style:{background:"var(--ds-amber-200)",color:"var(--ds-amber-900)"},children:[t.jsx(Vs,{className:"h-4 w-4"}),A?"Waking up...":"Wake Up Sleep"]}),g==="hook"&&B&&t.jsxs("button",{type:"button",onClick:()=>k(!0),disabled:v,className:Pe("flex items-center justify-center gap-2 rounded-md px-3 py-2 text-sm font-medium","disabled:opacity-50 disabled:cursor-not-allowed transition-colors",v?"opacity-50 cursor-not-allowed":"cursor-pointer"),style:{background:"var(--ds-gray-1000)",color:"var(--ds-background-100)"},children:[t.jsx(Wr,{className:"h-4 w-4"}),"Resolve Hook"]})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("section",{children:[t.jsx("h3",{className:"mb-2 text-[13px] font-medium uppercase tracking-wide",style:{color:"var(--ds-gray-700)"},children:"Details"}),t.jsx(Lo,{data:$,moduleSpecifier:K,expiredAt:e.expiredAt,isLoading:L,error:O??void 0,onStreamClick:r,resource:g})]}),g!=="run"&&E&&t.jsx("section",{children:t.jsx(Ho,{events:E,onLoadEventData:c,encryptionKey:d})})]})]}),t.jsx(Hr,{isOpen:x,onClose:()=>k(!1),onSubmit:U,isSubmitting:v})]})}function Uo(e){const r=a.useRef(e);r.current=e,a.useEffect(()=>{let s=0,n=0;const o=()=>{r.current(s),s=0},i=l=>{if(!l.ctrlKey&&!l.metaKey)return;l.preventDefault();let c=-l.deltaY;switch(l.deltaMode){case WheelEvent.DOM_DELTA_PAGE:c*=window.innerHeight;break;case WheelEvent.DOM_DELTA_LINE:c*=20;break}s+=c,cancelAnimationFrame(n),n=requestAnimationFrame(o)};return window.addEventListener("wheel",i,{passive:!1}),()=>{window.removeEventListener("wheel",i),cancelAnimationFrame(n)}},[])}function pr(e){if(e<=0)return 1;const s=10**Math.floor(Math.log10(e)),n=e/s;return n<=1.5?s:n<=3.5?2*s:n<=7.5?5*s:10*s}function Ko({scale:e,isLive:r=!1}){const{state:{root:s}}=ve(),[,n]=a.useState(0);a.useEffect(()=>{if(!r)return;const m=setInterval(()=>n(f=>f+1),1e3);return()=>clearInterval(m)},[r]);const o=s.duration,i=e>0?e:o>0?1/o:1;let c=pr(50/i);c=Math.max(1,c);let u=c*i;const d=1e3;o/c>d&&(c=pr(o/d),u=c*i);const p=Math.ceil(o/c),h=Math.ceil(100/u)||1;return t.jsx("div",{className:G.markersContainer,children:t.jsx("div",{"aria-hidden":!0,className:G.markers,style:{width:Math.floor(s.duration*e+15),visibility:e!==-1?"visible":"hidden","--marker-width":`${u}px`},children:new Array(p).fill(null).map((m,f)=>{const A=f%h===0;return t.jsx("span",{className:Pe(G.marker,!A&&G.notch),children:A?t.jsxs("span",{className:G.markerLabel,children:[jn(c*f),t.jsx("span",{className:G.markerClockTime,children:kn(s.startTime+c*f)})]}):null},String(f))})})})}function qo({events:e,root:r,scale:s}){const n=a.useMemo(()=>e.filter(o=>o.event.showVerticalLine!==!1),[e]);return t.jsx("div",{className:G.eventMarkersContainer,children:t.jsx("div",{"aria-hidden":!0,className:G.eventMarkers,style:{width:Math.floor(r.duration*s)},children:n.map(o=>t.jsx("span",{className:Pe(G.eventMarker),style:{left:Math.floor((o.timestamp-r.startTime)*s),...o.event.color&&{borderLeftColor:o.event.color}}},o.key))})})}const hr=2;function Go({memoCacheRef:e,timelineRef:r,root:s,spans:n,events:o,scale:i,dispatch:l,scrollSnapshotRef:c}){const u=a.useRef(!1),d=a.useRef(n);d.current=n;const p=a.useRef(o);p.current=o;const h=a.useRef(null),{style:m,setStyle:f}=At(h),A=a.useRef(null),N=a.useRef(null),{style:x,setStyle:k}=At(N),v=a.useRef(void 0),R=a.useRef(null),{style:T,setStyle:P}=At(R),C=a.useRef(0);a.useEffect(()=>{const w=r.current;if(!w)return;let g=C.current,y=0,_=!1,S=!1,I=!1,B=!1,O=0,L=0;const D=Date.now()+500,b=()=>{v.current||(v.current=w.getBoundingClientRect())},F=Y=>v.current?(Y-wt-ce)/(We+Se):0,U=()=>{const Y=e.current;for(const se of d.current)se.isHovered&&(se.isHovered=!1,Y.set(se.span.spanId,{}));l({type:"forceRender"})};let $=0;const K=()=>{var Ke,ot,at,xe,it,lt,ct,dt;if(!u.current)return;v.current||b();const Y=v.current;if(!Y)return;const{scrollLeft:se,scrollTop:oe}=w,fe=Math.max(0,Math.min(g+se-Y.left-ce,s.duration*i)),Oe=`${fe-se+ce}px`;k("left",Oe),f("left",Oe);const we=s.startTime+fe/i,Ce=we-s.startTime;if(Ce<0||Ce>s.duration?(Ke=A.current)==null||Ke.removeAttribute("data-text"):(ot=A.current)==null||ot.setAttribute("data-text",ft(Ce)),_){const Te=g-y,qe=Math.abs(Te);if(!I){if(qe<4)return;I=!0,P("display","flex"),U()}Te>0?(P("left",""),P("right","0")):(P("left","0"),P("right","")),P("width",`${qe}px`);const Re=Math.max(0,Math.min(y+se-Y.left-ce,s.duration*i))/i;let q,te;Re<Ce?(q=Re,te=Ce):(q=Ce,te=Re),(at=R.current)==null||at.setAttribute("data-range",`${ft(q)} — ${ft(te)}`),(xe=R.current)==null||xe.setAttribute("data-duration",`${ft(te-q)} selected`)}if(Date.now()<D){$=requestAnimationFrame(K);return}if(se!==O||oe!==L){O=se,L=oe,$=requestAnimationFrame(K);return}if(g-Y.left<128?(it=A.current)==null||it.setAttribute("data-align","left"):g-Y.left>Y.width-128?(lt=A.current)==null||lt.setAttribute("data-align","right"):(ct=A.current)==null||ct.removeAttribute("data-align"),!I&&!S){const Te=e.current,qe=F(oe)-hr,St=F(oe+Y.height)+hr;for(const re of d.current){const ae=re.row>=qe&&re.row<=St&&we>=re.startTime&&we<=re.endTime;re.isHovered!==ae&&(re.isHovered=ae,Te.set(re.span.spanId,{}))}const q=12/i;let te=null,ne=1/0;for(const re of p.current){const ae=Math.abs(re.timestamp-we);ae<=q&&ae<ne&&(ne=ae,te=re)}for(const re of p.current){const ae=re===te;if(re.isHovered===ae)continue;re.isHovered=ae;const Ge=(dt=re.ref)==null?void 0:dt.current;Ge&&Ge.setAttribute("data-hovered",String(ae))}l({type:"forceRender"})}};$=requestAnimationFrame(K);const J=Y=>{Y.pointerType==="mouse"&&(u.current=!0)},X=()=>{u.current&&(u.current=!1,U())},j=({clientX:Y})=>{g=Y,C.current=g,cancelAnimationFrame($),$=requestAnimationFrame(K)},M=Y=>{Y.preventDefault()},W=Y=>{var se;if(Y.button===2)B=!0,Y.preventDefault();else{if(Y.button!==0)return;B=!1}(se=r.current)!=null&&se.contains(Y.target)?(y=g,_=!0):(S=!0,requestAnimationFrame(U))},z=Y=>{if(S=!1,!_||(_=!1,!I))return;if(I=!1,P("display",""),P("left",""),P("right",""),P("width",""),Y.preventDefault(),Y.stopImmediatePropagation(),B){B=!1;return}v.current||b();const se=v.current;if(!se)return;const{scrollLeft:oe}=w,fe=Math.max(0,Math.min((y+oe-se.left-ce)/i,s.duration)),Oe=Math.max(0,Math.min((g+oe-se.left-ce)/i,s.duration));l({type:"scaleToRange",t1:fe+s.startTime,t2:Oe+s.startTime})},ee=Y=>{_&&Y.key==="Escape"&&(B=!0,z(Y))},H=()=>{v.current=void 0,E.current=void 0,cancelAnimationFrame($),$=requestAnimationFrame(K)},Z=()=>{cancelAnimationFrame($),$=requestAnimationFrame(K)},V=new ResizeObserver(()=>{v.current=void 0});return V.observe(w),window.addEventListener("mousemove",j),w.addEventListener("contextmenu",M),window.addEventListener("mousedown",W),window.addEventListener("mouseup",z),window.addEventListener("blur",z),window.addEventListener("keydown",ee,!0),window.addEventListener("scroll",H),w.addEventListener("scroll",Z),w.addEventListener("pointerenter",J),w.addEventListener("pointerleave",X),()=>{V.disconnect(),window.removeEventListener("mousemove",j),w.removeEventListener("contextmenu",M),window.removeEventListener("mousedown",W),window.removeEventListener("mouseup",z),window.removeEventListener("blur",z),window.removeEventListener("keydown",ee,!0),window.removeEventListener("scroll",H),w.removeEventListener("scroll",Z),w.removeEventListener("pointerenter",J),w.removeEventListener("pointerleave",X),cancelAnimationFrame($),C.current=g,U()}},[l,s,i,k,f,P,e,r,c]);const E=a.useRef(void 0);return Uo(w=>{const g=r.current;if(!g)return;v.current??(v.current=g.getBoundingClientRect());const y=v.current,_=Math.max(0,Math.min(C.current-y.left-ce,y.width-2*ce));let S=0,I=E.current;(I==null?void 0:I.anchorX)===_?S=I.anchorT:(S=(g.scrollLeft+_)/i,I={anchorT:S,anchorX:_},E.current=I),l({type:"trackpadScale",delta:w/64,anchorT:S,anchorX:_})}),t.jsxs(t.Fragment,{children:[t.jsx("div",{className:G.cursorMarkerStickyParent,children:t.jsx("div",{className:G.cursorMarkerLabelContainer,ref:h,style:m,children:t.jsx("div",{className:G.cursorMarkerLabel,ref:A})})}),t.jsx("div",{className:G.cursorMarkerStickyParent,children:t.jsx("div",{className:G.cursorMarkerContainer,ref:N,style:x,children:t.jsx("div",{className:G.cursorMarker,children:t.jsx("div",{className:G.cursorSelection,ref:R,style:T})})})})]})}function Zo({height:e,width:r,value:s,placeholder:n,onChange:o}){return t.jsxs("label",{className:G.searchInputLabel,children:[t.jsx("div",{className:G.searchInputPrefix,children:t.jsx(Yo,{})}),t.jsx("input",{type:"search",value:s,placeholder:n,onChange:o,style:{height:e,width:r}})]})}function Yo(){return t.jsxs("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",focusable:"false",children:[t.jsx("circle",{cx:"7",cy:"7",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("path",{d:"M11.5 11.5L14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function Xo(){return t.jsx("nav",{className:G.searchBar,children:t.jsx(Jo,{})})}function Jo(){const{dispatch:e}=ve(),[r,s]=a.useState("");return a.useEffect(()=>{const n=setTimeout(()=>e({type:"setFilter",filter:r}),100);return()=>{clearTimeout(n)}},[e,r]),t.jsx("div",{className:G.searchInput,children:t.jsx(Zo,{height:zr,onChange:n=>s(n.target.value),placeholder:"Search spans…",value:r,width:"100%"})})}function Qo({size:e=16}){return t.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[t.jsx("title",{children:"Zoom In"}),t.jsx("path",{d:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",stroke:"currentColor",strokeWidth:"2"}),t.jsx("path",{d:"M11 8v6M8 11h6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),t.jsx("path",{d:"M20 20l-3.5-3.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function ea({size:e=16}){return t.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[t.jsx("title",{children:"Zoom Out"}),t.jsx("path",{d:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",stroke:"currentColor",strokeWidth:"2"}),t.jsx("path",{d:"M8 11h6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),t.jsx("path",{d:"M20 20l-3.5-3.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function ta({size:e=16}){return t.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[t.jsx("title",{children:"Minus"}),t.jsx("path",{d:"M6 12h12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function ra(){const{dispatch:e}=ve(),r=a.useCallback(()=>{e({type:"adjustScaleRatio",direction:1})},[e]),s=a.useCallback(()=>{e({type:"adjustScaleRatio",direction:-1})},[e]),n=a.useCallback(()=>{e({type:"adjustScaleRatio",direction:0})},[e]);return t.jsxs("div",{className:G.zoomButtonGroup,children:[t.jsx("button",{"aria-label":"Zoom Out",className:G.zoomButton,onClick:s,type:"button",children:t.jsx(ea,{size:18})}),t.jsx("div",{className:G.divider}),t.jsx("button",{"aria-label":"Reset Zoom",className:G.zoomButton,onClick:n,type:"button",children:t.jsx(ta,{size:18})}),t.jsx("div",{className:G.divider}),t.jsx("button",{"aria-label":"Zoom In",className:G.zoomButton,onClick:r,type:"button",children:t.jsx(Qo,{size:18})})]})}const sa=e=>{const{spans:r}=e,s={startTime:0,endTime:0,duration:0,depth:0,children:[]},n={},o=new Map,i=h=>{const m=o.get(h);if(m)return m;const f=o.size+1;return o.set(h,f),f};let l=!1;for(const h of r){const m=Xe(h.startTime),f=Xe(h.endTime),A=Xe(h.duration);f>s.endTime&&(s.endTime=f,s.duration=f-s.startTime),(s.startTime===0||m<s.startTime)&&(s.startTime=m,s.duration=s.endTime-m);const N=h.resource.startsWith("vercel.");N||(l=!0);const x=N&&(h.resource!=="vercel.serverless-runtime"||!("http.method"in h.attributes)),k=x?0:i(h.resource);let v;x&&(v=`▲ ${h.name}`),n[h.spanId]={parent:null,startTime:m,endTime:f,duration:A,span:h,depth:0,label:v,events:na(h),isVercel:x,children:[],resourceIndex:k,activeStartTime:h.activeStartTime?Xe(h.activeStartTime):void 0}}const c=(h,m)=>{let f;m?(f=n[m],f||(f=s)):f=s,h.parent=f,f.children.push(h)},u=h=>{"parent"in h&&(h.depth=h.parent.depth+1);for(const m of h.children)u(m)};let d=1;const p=(h,m)=>{if("parent"in h&&h.span.name===m){let f=h.endTime;const A=C=>C.children.length?C.children.map(A).sort((E,w)=>E.duration-w.duration)[0]||C:C.span.name==="waitUntil"?(f=C.startTime,C.parent):C,N=A(h),x=`instrumentation-hint-${d++}`,k=h.duration*.05,v=h.startTime+k,R=Math.max(v+k,Math.min(f-h.duration*.01,h.endTime-k)),T=R-v,P={parent:N,startTime:v,endTime:R,duration:T,span:{spanId:x,name:"Add your spans here",resource:"",kind:0,library:{name:""},status:{code:200},traceFlags:0,attributes:{},links:[],events:[],startTime:Dt(v),endTime:Dt(R),duration:Dt(T)},depth:h.depth+1,isVercel:!1,isInstrumentationHint:!0,children:[],resourceIndex:1};return N.children.push(P),n[x]=P,!0}for(const f of h.children)if(p(f,m))return!0;return!1};for(const h of Object.values(n))c(h,h.span.parentSpanId);if(u(s),!l){for(const h of["Invoke Function","Invoke Middleware","Vercel Runtime"])if(p(s,h))break}return{root:s,map:n}},na=e=>{if(!e.events.length)return;const r=`${e.spanId}:ev`;return e.events.map((s,n)=>({key:`${r}${n}`,timestamp:Xe(s.timestamp),event:s})).sort((s,n)=>s.timestamp-n.timestamp)},xr=(e,r)=>(e.isVisible=!0,e.isHovered=!1,e.isVisible);function Pt(){return[]}const oa=(e,r=!1)=>{const{state:s,dispatch:n}=ve(),{root:o,filter:i,scale:l,timelineRef:c,timelineWidth:u,spanMap:d,scrollSnapshotRef:p,selected:h,memoCacheRef:m}=s,f=aa(s.timelineHeight),A=a.useRef(0),[N,x]=a.useState(Pt),[k,v]=a.useState(Pt),[R,T]=a.useState(Pt),[P,C]=a.useState(-1),E=a.useRef(void 0);return a.useEffect(()=>{var w;return(w=E.current)==null?void 0:w.call(E,i)},[i]),a.useEffect(()=>{if(e!=null&&e.length){for(const w of N)for(const g of w){const y=e.includes(g.span.spanId);g.isHighlighted!==y&&(g.isHighlighted=y,m.current.set(g.span.spanId,{}))}n({type:"forceRender"})}},[N,e,n,m]),a.useEffect(()=>{if(!o.startTime)return;const w=new Worker(new URL("/assets/worker-D-HfgUMl.js",import.meta.url),{type:"module"});let g=++A.current;const y=S=>{var B;const I=S.data;switch(I.type){case"setRowsResult":{if((I==null?void 0:I.requestId)!==g)return;if(I.isEnd)for(const O of I.rows)for(const L of O)L.span=((B=d[L.span.spanId])==null?void 0:B.span)??L.span;x(I.rows);break}case"updateHighlight":{if((I==null?void 0:I.requestId)!==g)return;const{matches:O}=I;x(L=>{for(const D of L)for(const b of D){const F=O.has(b.span.spanId);b.isHighlighted!==F&&(b.isHighlighted=F,m.current.set(b.span.spanId,{}))}return L}),n({type:"forceRender"});break}}};w.addEventListener("message",y);const _={requestId:g,type:"calculateSpanPositions",root:o};return w.postMessage(_),E.current=S=>{const I=S.trim().toLocaleLowerCase();if(!I){x(O=>O.map(L=>L.map(D=>(D.isHighlighted=void 0,{...D}))));return}g=++A.current;const B={type:"filterSpans",requestId:g,root:o,filter:I};w.postMessage(B)},()=>{w.terminate()}},[o,d,n,m]),a.useEffect(()=>{if(!N.length)return;if(r){const j=[],M=[];for(const W of N)for(const z of W)xr(z)&&(j.push(z),z.events&&M.push(...z.events));v(j),T(M),C(l);return}const w=c.current;let g=p.current,y=!1,_=!1,S=0,I=0;const B=Math.max(500,u*.5),O=new Array(N.length).fill(null),L=()=>{_=!0;const j=Math.min(1+I+Math.ceil((g==null?void 0:g.endRow)??Number.POSITIVE_INFINITY),N.length);for(let M=j;M--;){if(O[M])continue;const W=D(M);if(Math.abs(W)>I){if(_=!1,W>0)continue;break}const z=[],ee=N[M];if(ee){for(const H of ee){if(!xr(H))continue;const Z=b(H);S=Math.max(Z,S),z.push({d:Z,span:H})}O[M]=z}}},D=j=>g?j<g.startRow?j-g.startRow:j>g.endRow?j-g.endRow:0:0,b=j=>{if(!g)return 0;let M=0;j.endTime<g.startTime?M=g.startTime-j.endTime:j.startTime>g.endTime&&(M=j.startTime-g.endTime);const W=Math.abs(D(j.row));return!M&&!W?0:Math.sqrt((M/l)**2+(W*We+Se)**2)},F=()=>{if(!w)return;const{scrollLeft:j,scrollTop:M}=w,W=0,z=j/l,ee=(M-wt-ce)/(We+Se),H=ee+Math.ceil(f/(We+Se));g={anchorT:z,anchorX:W,scrollLeft:j,scrollTop:M,startTime:o.startTime+j/l,endTime:o.startTime+(j+u)/l,startRow:ee,endRow:H,scale:l},p.current=g;for(let Z=O.length;Z--;)O[Z]=null};let U=0;const $=()=>{(y||!g)&&(y=!1,F()),L();const j=[],M=[];for(const W of O)if(W)for(const{d:z,span:ee}of W)z>I||(j.push(ee),ee.events&&M.push(...ee.events));I<B&&(!_||I<S)&&(I=Math.min(B,I+100),U=requestAnimationFrame($)),v(j),T(M),C(l)};$();let K=Date.now();const J=j=>{(j.ctrlKey||j.metaKey)&&(K=Date.now())};w==null||w.addEventListener("wheel",J);const X=()=>{Date.now()-K<=50||(y=!0,cancelAnimationFrame(U),U=requestAnimationFrame($))};return w==null||w.addEventListener("scroll",X),()=>{cancelAnimationFrame(U),w==null||w.removeEventListener("wheel",J),w==null||w.removeEventListener("scroll",X)}},[N,o,l,p,c,u,f,r]),a.useEffect(()=>{var y;if(!h)return;let w;for(const _ of k)if(_.span.spanId===h.span.spanId){w=_;break}const g=(y=w==null?void 0:w.ref)==null?void 0:y.current;if(!(!w||!g))return w.isSelected=!0,g.setAttribute("data-selected",""),()=>{w.isSelected=!1,g.removeAttribute("data-selected")}},[k,h]),{rows:N,spans:k,events:R,scale:P}};function aa(e){const[r,s]=a.useState(e);return a.useEffect(()=>{if(r===e)return;let n=0,o=0;const i=()=>{if(++n<=3){o=requestAnimationFrame(i);return}s(e)};return i(),()=>{cancelAnimationFrame(o)}},[r,e]),r}const gr={traceId:"skeleton",spans:[{parentSpanId:"",spanId:"root",name:"root span",kind:1,resource:"vercel.runtime",startTime:[5e3,0],endTime:[6e3,0],duration:[1e3,0],library:{name:"vercel-site"},status:{code:1},attributes:{"vercel.ownerId":"team_abc"},traceFlags:1,events:[],links:[]}],resources:[{name:"vercel.runtime",attributes:{}}],rootSpanId:"root"};function ia({trace:e=gr,className:r="",scrollLock:s=!1,height:n,withPanel:o=!1,highlightedSpans:i,eagerRender:l=!1,isLive:c=!1,footer:u,knownDurationMs:d,hasMoreData:p=!1}){const h=e===gr,{state:m,dispatch:f}=ve(),{timelineRef:A,scrollSnapshotRef:N}=m,x=m.memoCacheRef.current,k=((i==null?void 0:i.length)??0)>0,v=a.useRef(!1),R=a.useRef(""),T=a.useRef(null),P=a.useRef({}),C=a.useRef(null);a.useEffect(()=>{const{root:L,map:D}=sa(e),b=!v.current;v.current=!0;const F=Object.keys(D).sort().map(U=>{const $=D[U].events,K=($==null?void 0:$.length)??0,J=K?$==null?void 0:$[0]:void 0,X=K?$==null?void 0:$[K-1]:void 0,j=`${(J==null?void 0:J.event.name)??"none"}@${(J==null?void 0:J.timestamp)??0}|${(X==null?void 0:X.event.name)??"none"}@${(X==null?void 0:X.timestamp)??0}`;return`${U}:${K}:${j}`}).join(",");if(!b&&F===R.current&&T.current){const U=T.current,$=P.current;let K=!1;(U.endTime!==L.endTime||U.duration!==L.duration)&&(U.endTime=L.endTime,U.duration=L.duration,K=!0);for(const[J,X]of Object.entries(D)){const j=$[J];j&&((j.endTime!==X.endTime||j.duration!==X.duration)&&(j.endTime=X.endTime,j.duration=X.duration,K=!0),Object.assign(j.span,X.span))}if(!K)return;f({type:"forceRender"});return}R.current=F,T.current=L,P.current=D,f({type:b?"setRoot":"updateRoot",root:L,spanMap:D,resources:e.resources||[]})},[f,e]);const{rows:E,spans:w,events:g,scale:y}=oa(i,l),_=a.useRef(null);a.useLayoutEffect(()=>{const L=_.current;if(!L)return;const D=()=>{const F=2*ce,U=L.getBoundingClientRect(),$=U.width-F,K=U.height,J=C.current;J&&J.width===$&&J.height===K||(C.current={width:$,height:K},f({type:"setSize",width:$,height:K}))};D();const b=new ResizeObserver(D);return b.observe(L),window.addEventListener("resize",D),()=>{b.disconnect(),window.removeEventListener("resize",D)}},[f]);const S=a.useRef({t:0,x:-1,y:-1,spanId:""}),I=a.useCallback(L=>{const D=S.current,b=Date.now(),{clientX:F,clientY:U}=L,$=Math.sqrt((F-D.x)**2+(U-D.y)**2);if(b-D.t<=500&&$<=8){if(L.stopPropagation(),L.preventDefault(),!D.spanId){f({type:"resetScale"});return}f({type:"select",id:D.spanId}),f({type:"scaleToNode",id:D.spanId});return}const K=L.target;if(!K.closest(`.${String(G.timeline)}`))return;const J=K.closest("[data-span-id]"),X=(J==null?void 0:J.dataset.spanId)||"";S.current={x:F,y:U,t:b,spanId:X},X&&(f({type:"toggleSelection",id:X}),L.stopPropagation())},[f]);a.useLayoutEffect(()=>{const L=A.current;if(!L)return;const D=N.current;D&&(L.scrollLeft=D.anchorT*y-D.anchorX,N.current=void 0)},[N,A,y]),a.useEffect(()=>{var b;const L=(b=m.selected)==null?void 0:b.span.spanId;if(!L)return;const D=setTimeout(()=>{const F=m.timelineRef.current,U=F==null?void 0:F.querySelector(`[data-span-id="${L}"]`);if(!F||!U)return;const $=F.getBoundingClientRect(),K=U.getBoundingClientRect();K.width<$.width&&(K.left<$.left||K.right>$.right||K.top<$.top||K.bottom>$.bottom)&&U.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})},500);return()=>{clearTimeout(D)}},[m.selected,m.timelineRef]),a.useEffect(()=>{const L=D=>{D.key==="Escape"&&f({type:"escape"})};return window.addEventListener("keydown",L),()=>{window.removeEventListener("keydown",L)}},[f]),a.useEffect(()=>{if(!s)return;const L=document.documentElement,D=document.body;L.style.overflow="clip",D.style.overflow="clip";const b=F=>{F!=null&&F.cancelable?F.preventDefault():window.scrollTo({left:0,top:0,behavior:"instant"})};return b(),window.addEventListener("scroll",b,{passive:!1}),()=>{L.style.overflow="",D.style.overflow="",window.removeEventListener("scroll",b)}},[s]);const B=Math.max(m.timelineHeight-m.scrollbarWidth,wt+Se+E.length*(We+Se)-Se+84),O=!!(m.isMobile&&m.selected);return t.jsxs("div",{className:Pe(G.traceViewer,h&&G.skeleton,r),onClickCapture:I,ref:_,style:{height:n,"--timeline-padding":`${ce}px`,"--row-height":`${We}px`,"--row-padding":`${Se}px`,"--search-height":`${k?0:zr}px`,"--search-gap":`${k?2:En}px`,"--map-height":`${Cn}px`,"--timeline-width":`${m.timelineWidth}px`,"--timeline-height":`${m.timelineHeight}px`,"--timeline-scroll-width":`${Math.round(m.root.duration*m.scale)}px`,"--panel-width":`${m.panelWidth}px`,"--panel-height":`${m.panelHeight}px`,"--height":`${m.height}px`,"--scrollbar-width":`${m.scrollbarWidth}px`,"--marker-height":`${wt}px`,"--marker-notch-height":`${Nn}px`},children:[k?null:t.jsx(Xo,{}),t.jsx(Sn,{rows:E,scale:y,timelineRef:A}),t.jsxs("div",{className:Pe(G.traceViewerContent,O&&G.inert),children:[t.jsxs("div",{className:G.timeline,ref:A,children:[t.jsx("div",{style:{position:"relative",width:m.timelineWidth,minHeight:m.timelineHeight-ce*2,padding:ce,paddingBottom:0},children:t.jsxs("div",{className:G.traceNode,style:{width:m.root.duration*y||void 0,height:B-ce*2},children:[t.jsx(Ko,{scale:y,isLive:c}),t.jsx(qo,{events:g,root:m.root,scale:y}),t.jsx(Go,{dispatch:f,events:g,memoCacheRef:m.memoCacheRef,root:m.root,scale:y,scrollSnapshotRef:N,spans:w,timelineRef:A}),t.jsx(In,{cacheKey:x.get(""),cache:x,customSpanClassNameFunc:m.customSpanClassNameFunc,customSpanEventClassNameFunc:m.customSpanEventClassNameFunc,isLive:c,root:m.root,scale:y,scrollSnapshotRef:N,spans:w}),d!=null&&d>0&&(p||c)&&m.root.duration>0&&(()=>{const L=d*y,b=m.root.duration*y-L;if(b<4)return null;const F=Math.min(b*.05,20);return t.jsx("div",{style:{position:"absolute",top:0,left:L+F,width:b-F,height:"100%",pointerEvents:"none",zIndex:1,maskImage:"linear-gradient(to right, transparent 1%, black 3%)",WebkitMaskImage:"linear-gradient(to right, transparent 1%, black 3%)",background:"repeating-linear-gradient(-45deg, var(--ds-background-200) 0, var(--ds-background-200) 11px, var(--ds-gray-200) 11px, var(--ds-gray-200) 12px)"}})})()]})}),u]}),t.jsx("div",{className:G.zoomButtonTraceViewer,children:t.jsx(ra,{})})]}),o?t.jsx("div",{className:Pe(G.spanDetailPanelTraceViewer,!m.selected&&G.hidden,m.isMobile&&G.mobile),children:t.jsx(Tn,{attached:!0})}):null]})}function yr(e,r=!1){if(r&&e==="pending")return G.spanPendingStriped;switch(e){case"running":return G.spanRunning;case"pending":return G.spanPending;case"completed":return G.spanCompleted;case"cancelled":return G.spanCancelled;case"failed":return G.spanFailed;default:return""}}function la(e){return String(e).toLowerCase().endsWith("sleep")}const ca=e=>{const r=e.span.attributes,s=r==null?void 0:r.resource;if(s==="step"){const n=r.data,o=n==null?void 0:n.stepName;if(o&&la(o))return G.spanSleep;const i=(n==null?void 0:n.status)==="pending";return yr(n==null?void 0:n.status,i)}if(s==="run"){const n=r.data;return yr(n==null?void 0:n.status,!1)}return s==="hook"?G.spanHook:s==="sleep"?G.spanSleep:""},da=e=>{const r=e.event.name;return r==="step_failed"||r==="run_failed"?G.eventFailed:r==="step_retrying"?G.eventRetrying:r==="hook_created"||r==="hook_received"||r==="hook_disposed"?G.eventHook:G.eventDefault};function ua(e){return e==="hook_created"||e==="hook_received"||e==="hook_disposed"}function pe(e){if(typeof e=="string"&&(e=new Date(e)),!e||!(e instanceof Date))return[0,0];const r=e.getTime(),s=Math.floor(r/1e3),n=r%1e3*1e6;return[s,n]}function Bt(e){const r=e[0]*1e3,s=e[1]/1e6;return r+s}function Ct(e,r){if(typeof e=="string"&&(e=new Date(e)),typeof r=="string"&&(r=new Date(r)),!e||!(e instanceof Date))return[0,0];const n=(r&&r instanceof Date?r:new Date).getTime()-e.getTime(),o=Math.floor(n/1e3),i=n%1e3*1e6;return[o,i]}const nt={name:"workflow-development-kit",version:"4.0.0"},fa=new Set(["hook_created","hook_received","hook_disposed","step_started","step_retrying","step_failed","run_failed","wait_created","wait_completed"]);function Et(e,r=!0){return e.filter(s=>r?fa.has(s.eventType):!0).map(s=>({name:s.eventType,timestamp:pe(s.createdAt),attributes:{eventId:s.eventId,correlationId:s.correlationId,eventData:"eventData"in s?s.eventData:void 0},showVerticalLine:ua(s.eventType)}))}const ts=e=>{var n;const r=e.find(o=>o.eventType==="wait_created");if(!r)return null;const s=e.find(o=>o.eventType==="wait_completed");return{waitId:r.correlationId,runId:r.runId,createdAt:r.createdAt,resumeAt:(n=r.eventData)==null?void 0:n.resumeAt,completedAt:s==null?void 0:s.createdAt}};function ma(e,r){const s=ts(e);if(!s)return null;const n=s.createdAt,o=s.completedAt??r,i=pe(n),l=pe(o),c=Ct(n,o),u=Et(e,!1);return{spanId:s.waitId,name:"sleep",kind:1,resource:"sleep",library:nt,status:{code:0},traceFlags:1,attributes:{resource:"sleep",data:s},links:[],events:u,duration:c,startTime:i,endTime:l}}const pa=e=>{var u;const r=e.find(d=>d.eventType==="step_created"),s=r??e[0];if(!s)return null;let n="pending",o=0,i,l;for(const d of e)switch(d.eventType){case"step_started":n="running",o+=1,i||(i=d.createdAt),l=void 0;break;case"step_completed":n="completed",l=d.createdAt;break;case"step_failed":n="failed",l=d.createdAt;break;case"step_retrying":n="pending",l=void 0;break}o===0&&(o=1);const c=e[e.length-1];return{stepId:s.correlationId??"",runId:s.runId,stepName:((u=r==null?void 0:r.eventData)==null?void 0:u.stepName)??"",status:n,attempt:o,createdAt:s.createdAt,updatedAt:(c==null?void 0:c.createdAt)??s.createdAt,startedAt:i,completedAt:l,specVersion:s.specVersion}};function ha(e,r){const s=pa(e);if(!s)return null;const n=st(String(s.stepName)),o={resource:"step",data:s},i="step",l=new Date(s.completedAt??r),c=Et(e,!1),u=new Date(s.createdAt);let d=s.startedAt?new Date(s.startedAt):void 0;const p=e.find(h=>h.eventType==="step_started");return p&&(d=new Date(p.createdAt)),{spanId:String(s.stepId),name:(n==null?void 0:n.shortName)??"",kind:1,resource:i,library:nt,status:{code:0},traceFlags:1,attributes:o,links:[],events:c,startTime:pe(u),endTime:pe(l),duration:Ct(u,l),activeStartTime:d&&d.getTime()>u.getTime()?pe(d):void 0}}const xa=e=>{var i,l;const r=e.find(c=>c.eventType==="hook_created");if(!r)return null;const s=e.filter(c=>c.eventType==="hook_received"),n=e.filter(c=>c.eventType==="hook_disposed"),o=s.at(-1);return{hookId:r.correlationId,runId:r.runId,token:(i=r.eventData)==null?void 0:i.token,createdAt:r.createdAt,receivedCount:s.length,lastReceivedAt:(o==null?void 0:o.createdAt)||void 0,disposedAt:((l=n.at(-1))==null?void 0:l.createdAt)||void 0}};function ga(e,r){const s=xa(e);if(!s)return null;const n=Et(e,!1),o=s.disposedAt||r;return{spanId:String(s.hookId),name:String(s.hookId),kind:1,resource:"hook",library:nt,status:{code:1},traceFlags:1,attributes:{resource:"hook",data:s},links:[],events:n,startTime:pe(s.createdAt),endTime:pe(o),duration:Ct(s.createdAt,o)}}function ya(e,r,s){var f;const n=s??new Date,{input:o,output:i,error:l,...c}=e,u={resource:"run",data:c},d=new Date(e.createdAt),p=e.startedAt?new Date(e.startedAt):void 0,h=e.completedAt??n,m=Et(r,!1);return{spanId:String(e.runId),name:String(((f=ze(e.workflowName))==null?void 0:f.shortName)??"?"),kind:1,resource:"run",library:nt,status:{code:0},traceFlags:1,attributes:u,links:[],events:m,startTime:pe(d),endTime:pe(h),duration:Ct(d,h),activeStartTime:p&&p.getTime()>d.getTime()?pe(p):void 0}}const va=e=>e.startsWith("step_"),wa=e=>e==="wait_created"||e==="wait_completed",ba=e=>e==="hook_received"||e==="hook_created"||e==="hook_disposed";function Ft(e,r,s){const n=e.get(r);if(n){n.push(s);return}e.set(r,[s])}function ja(e){const r=new Map,s=[],n=new Map,o=new Map;for(const i of e){const l=i.correlationId;if(!l){s.push(i);continue}if(wa(i.eventType)){Ft(n,l,i);continue}if(ba(i.eventType)){Ft(o,l,i);continue}if(va(i.eventType)){Ft(r,l,i);continue}s.push(i)}return{eventsByStepId:r,runLevelEvents:s,timerEvents:n,hookEvents:o}}function ka(e,r){let s=new Date(r.createdAt).getTime();for(const n of e){const o=new Date(n.createdAt).getTime();o>s&&(s=o)}return new Date(s)}function Na(e,r,s,n){const o=n,i=Array.from(r.eventsByStepId.values()).map(u=>ha(u,o)).filter(u=>u!==null),l=Array.from(r.hookEvents.values()).map(u=>ga(u,o)).filter(u=>u!==null),c=Array.from(r.timerEvents.values()).map(u=>ma(u,o)).filter(u=>u!==null);return{runSpan:ya(e,r.runLevelEvents,s),spans:[...i,...l,...c]}}function Ca(e,r){const s=[e,...r.slice().sort((n,o)=>{const i=Bt(n.startTime),l=Bt(o.startTime);return i-l})];return s.map((n,o)=>{const i=o===0?void 0:String(s[o-1].spanId);return{...n,parentSpanId:i}})}function Ea(e,r,s){const n=ja(r),o=ka(r,e),{runSpan:i,spans:l}=Na(e,n,s,o),c=Ca(i,l),u=Bt(i.startTime),d=o.getTime()-u;return{traceId:e.runId,rootSpanId:e.runId,spans:c,resources:[{name:"workflow",attributes:{"service.name":nt.name}}],knownDurationMs:Math.max(0,d)}}function Sa(e){const{state:r,dispatch:s}=ve(),n=a.useRef(r);n.current=r,a.useEffect(()=>{if(!e)return;let o=0;const i=()=>{const{root:d}=n.current;if(d.startTime){const p=Date.now();p>d.endTime&&(d.endTime=p,d.duration=d.endTime-d.startTime)}o=requestAnimationFrame(i)};o=requestAnimationFrame(i);let l=0,c=0;const u=()=>{const d=n.current;if(d.root.duration>0){const p=(d.width-d.scrollbarWidth)/d.root.duration;(Math.abs(p-c)>c*.001||c===0)&&(c=p,s({type:"detectBaseScale"}))}l=requestAnimationFrame(u)};return l=requestAnimationFrame(u),()=>{cancelAnimationFrame(o),cancelAnimationFrame(l)}},[e,s])}const Ia=450,Ta=240;function Ra({menu:e,items:r,onClose:s}){const n=a.useRef(null);a.useEffect(()=>{const l=p=>{n.current&&!n.current.contains(p.target)&&s()},c=p=>{p.key==="Escape"&&s()},u=()=>{s()},d=setTimeout(()=>{window.addEventListener("mousedown",l),window.addEventListener("keydown",c),window.addEventListener("scroll",u,!0)},0);return()=>{clearTimeout(d),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",c),window.removeEventListener("scroll",u,!0)}},[s]);const[o,i]=a.useState({x:e.x,y:e.y});return a.useEffect(()=>{const l=n.current;if(!l)return;const c=l.getBoundingClientRect();let{x:u,y:d}=e;c.right>window.innerWidth&&(u=window.innerWidth-c.width-8),c.bottom>window.innerHeight&&(d=window.innerHeight-c.height-8),(u!==e.x||d!==e.y)&&i({x:u,y:d})},[e]),r.length===0?null:Ut.createPortal(t.jsxs("div",{ref:n,style:{position:"fixed",left:o.x,top:o.y,zIndex:99999,boxShadow:"var(--ds-shadow-menu)",borderRadius:12,background:"var(--ds-background-100)",padding:"var(--geist-space-gap-quarter, 4px)",fontSize:14,minWidth:180,overflowX:"hidden",overflowY:"auto"},children:[t.jsx("div",{style:{display:"block",color:"var(--ds-gray-900)",fontSize:"0.75rem",padding:"var(--geist-gap-quarter, 4px) var(--geist-space-2x, 8px)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:240,borderBottom:"1px solid var(--ds-gray-alpha-400)",marginBottom:4},children:e.spanName}),r.map(l=>t.jsxs("button",{type:"button",style:{outline:"none",cursor:l.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:8,padding:"0 var(--geist-space-2x, 8px)",height:40,textDecoration:"none",borderRadius:6,color:l.destructive?"var(--ds-red-900)":"var(--ds-gray-1000)",width:"100%",background:"transparent",border:"none",fontSize:14,textAlign:"left",opacity:l.disabled?.4:1,transition:"background 0.15s"},disabled:l.disabled,onMouseEnter:c=>{c.currentTarget.style.background="var(--ds-gray-alpha-100)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},onClick:()=>{l.action(),s()},children:[l.icon??null,l.label]},l.label))]}),document.body)}function Aa({trace:e,run:r,isLive:s,onWakeUpSleep:n,onCancelRun:o,onResolveHook:i,onLoadMoreSpans:l,hasMoreSpans:c=!1,isLoadingMoreSpans:u=!1,children:d}){const p=Ue(),{state:h,dispatch:m}=ve();Sa(s);const[f,A]=a.useState(null),[N,x]=a.useState(null),[k,v]=a.useState(!1),[R,T]=a.useState(new Set),P=a.useMemo(()=>{const S=new Map;for(const I of e.spans)S.set(I.spanId,I);return S},[e.spans]),C=a.useCallback(async S=>{if(!(k||!N||!i)){if(!N.token){p.error("Unable to resolve hook",{description:"Missing hook token. Try refreshing the run data and retry."});return}try{v(!0),await i(N.token,S),p.success("Hook resolved",{description:"The payload has been sent and the hook resolved."}),T(I=>new Set(I).add(N.hookId)),x(null)}catch(I){console.error("Failed to resolve hook:",I),p.error("Failed to resolve hook",{description:I instanceof Error?I.message:"An unknown error occurred"})}finally{v(!1)}}},[i,N,k]),E=a.useCallback(S=>{const B=S.target.closest("[data-span-id]");if(!B)return;const O=B.dataset.spanId;if(!O)return;S.preventDefault(),S.stopPropagation();const L=P.get(O);if(!L)return;const D=L.attributes.resource??"unknown",b=L.attributes.data,F=!(b!=null&&b.completedAt)&&!(b!=null&&b.disposedAt);A({x:S.clientX,y:S.clientY,spanId:O,spanName:L.name,resourceType:D,isActive:F})},[P]),w=a.useRef(null);a.useEffect(()=>{const S=w.current;if(!S)return;const I=B=>{E(B)};return S.addEventListener("contextmenu",I),()=>{S.removeEventListener("contextmenu",I)}},[E]);const g=a.useRef(!1);a.useEffect(()=>{const S=h.timelineRef.current;if(!S||!l||!c)return;const I=200,B=()=>{g.current||u||!c||S.scrollHeight-S.scrollTop-S.clientHeight>I||(g.current=!0,Promise.resolve(l()).finally(()=>{g.current=!1}))};return S.addEventListener("scroll",B),B(),()=>{S.removeEventListener("scroll",B)}},[h.timelineRef,l,c,u]);const y=a.useCallback(()=>{A(null)},[]),_=a.useCallback(S=>{var O,L;const I=[],B=!r.completedAt;if(S.resourceType==="sleep"&&S.isActive&&B&&n&&I.push({label:"Wake Up Sleep",icon:t.jsx(qs,{className:"h-3.5 w-3.5"}),action:()=>{n(r.runId,S.spanId).then(D=>{D.stoppedCount>0?p.success("Sleep woken up",{description:`Woke up ${String(D.stoppedCount)} sleep${D.stoppedCount>1?"s":""}`}):p.info("No active sleeps found",{description:"The sleep may have already completed."})}).catch(D=>{p.error("Failed to wake up sleep",{description:D instanceof Error?D.message:"An unknown error occurred"})})}}),S.resourceType==="hook"&&B&&i){const D=P.get(S.spanId),b=(O=D==null?void 0:D.attributes)==null?void 0:O.data,F=!!(b!=null&&b.disposedAt)||!!((L=D==null?void 0:D.events)!=null&&L.some(U=>U.name==="hook_disposed"))||R.has(S.spanId);b!=null&&b.token&&!F&&I.push({label:"Resolve Hook",icon:t.jsx(Wr,{className:"h-3.5 w-3.5"}),action:()=>{x({hookId:S.spanId,token:b.token})}})}return S.resourceType==="run"&&B&&o&&I.push({label:"Cancel Run",icon:t.jsx(Gs,{className:"h-3.5 w-3.5"}),destructive:!0,action:()=>{o(r.runId).catch(D=>{p.error("Failed to cancel run",{description:D instanceof Error?D.message:"An unknown error occurred"})})}}),I.push({label:"View Details",icon:t.jsx(Un,{className:"h-3.5 w-3.5"}),action:()=>{m({type:"select",id:S.spanId})}}),I.push({label:"Copy Name",icon:t.jsx(Gn,{className:"h-3.5 w-3.5"}),action:()=>{navigator.clipboard.writeText(S.spanName).then(()=>{p.success("Name copied to clipboard")}).catch(()=>{p.error("Failed to copy name")})}}),I.push({label:"Copy ID",icon:t.jsx(rt,{className:"h-3.5 w-3.5"}),action:()=>{navigator.clipboard.writeText(S.spanId).then(()=>{p.success("ID copied to clipboard")}).catch(()=>{p.error("Failed to copy ID")})}}),I},[m,n,o,i,P,R,r.runId,r.completedAt]);return t.jsxs("div",{className:"relative w-full h-full",ref:w,children:[d,f?t.jsx(Ra,{menu:f,items:_(f),onClose:y}):null,t.jsx(Hr,{isOpen:N!==null,onClose:()=>x(null),onSubmit:C,isSubmitting:k})]})}function Da({onSelectionChange:e}){const{state:r}=ve(),{selected:s}=r,n=a.useRef(e);n.current=e;const o=a.useRef(void 0);return a.useEffect(()=>{var l,c;const i=s==null?void 0:s.span.spanId;i!==o.current&&(o.current=i,s?n.current({data:(l=s.span.attributes)==null?void 0:l.data,resource:(c=s.span.attributes)==null?void 0:c.resource,spanId:s.span.spanId}):n.current(null))},[s]),null}function Ma({triggerDeselect:e}){const{dispatch:r}=ve();return a.useEffect(()=>{e>0&&r({type:"deselect"})},[e,r]),null}function _a({selectRequest:e}){const{dispatch:r}=ve();return a.useEffect(()=>{e!=null&&e.id&&r({type:"select",id:e.id})},[r,e]),null}function La({onResize:e}){const r=a.useCallback(s=>{s.preventDefault();let n=s.clientX;const o=l=>{const c=n-l.clientX;n=l.clientX,e(c)},i=()=>{document.removeEventListener("pointermove",o),document.removeEventListener("pointerup",i)};document.addEventListener("pointermove",o),document.addEventListener("pointerup",i)},[e]);return t.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-400/50 z-10",onPointerDown:r})}function Pa({hasMore:e,isLive:r,isInitialLoading:s}){const n={color:"var(--ds-gray-900)"};return e||s?t.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-xs",style:n,children:[t.jsx(Zt,{size:14}),"Loading more events…"]}):r?t.jsx("div",{className:"flex items-center justify-center py-3 text-xs",style:n,children:"Waiting for more events…"}):t.jsx("div",{className:"flex items-center justify-center py-3 text-xs",style:n,children:"End of run"})}const Fa=({run:e,events:r,isLoading:s,error:n,spanDetailData:o,spanDetailLoading:i,spanDetailError:l,onWakeUpSleep:c,onResolveHook:u,onCancelRun:d,onStreamClick:p,onSpanSelect:h,onLoadEventData:m,onLoadMoreSpans:f,hasMoreSpans:A=!1,isLoadingMoreSpans:N=!1,encryptionKey:x,onDecrypt:k,isDecrypting:v=!1})=>{const R=Ue(),[T,P]=a.useState(null),[C,E]=a.useState(Ia),[w,g]=a.useState(0),[y,_]=a.useState(null),S=!!(e&&!e.completedAt),I=a.useMemo(()=>{if(e!=null&&e.runId)return Ea(e,r,new Date)},[e,r]),B=I;a.useEffect(()=>{n&&!s&&(console.error(n),R.error("Error loading workflow trace data",{description:n.message}))},[n,s]);const O=a.useCallback(j=>{h==null||h(j)},[h]),L=a.useCallback(j=>{if(j){const M=j.spanId,W=M?r.filter(z=>z.correlationId===M):[];P({...j,rawEvents:W})}else P(null)},[r]);a.useEffect(()=>{const j=T==null?void 0:T.spanId;if(!j)return;const M=r.filter(W=>W.correlationId===j);P(W=>{if(!W||W.spanId!==j)return W;const z=W.rawEvents??[];return z.length===M.length&&z.every((H,Z)=>{var V;return H.eventId===((V=M[Z])==null?void 0:V.eventId)})?W:{...W,rawEvents:M}})},[r,T==null?void 0:T.spanId]);const D=a.useCallback(()=>{P(null),g(j=>j+1)},[]),b=a.useCallback(j=>{E(M=>Math.max(Ta,M+j))},[]),F=a.useMemo(()=>!(T!=null&&T.spanId)||!B?-1:B.spans.findIndex(j=>j.spanId===T.spanId),[T==null?void 0:T.spanId,B]),U=F>0,$=F>=0&&B!=null&&F<B.spans.length-1,K=a.useCallback(()=>{var M;if(!B||F<=0)return;const j=(M=B.spans[F-1])==null?void 0:M.spanId;j&&_({id:j,token:Date.now()})},[F,B]),J=a.useCallback(()=>{var M;if(!B||F<0)return;const j=(M=B.spans[F+1])==null?void 0:M.spanId;j&&_({id:j,token:Date.now()})},[F,B]),X=a.useMemo(()=>{var z,ee;if(!(T!=null&&T.data))return;const j=T.data,M=j.stepName,W=j.workflowName;return(M?(z=st(M))==null?void 0:z.shortName:void 0)??(W?(ee=ze(W))==null?void 0:ee.shortName:void 0)??M??W??j.hookId??"Details"},[T==null?void 0:T.data]);return B?t.jsxs("div",{className:"relative w-full h-full flex",children:[t.jsx("div",{className:"flex-1 min-w-0 relative",children:t.jsxs(Rn,{customSpanClassNameFunc:ca,customSpanEventClassNameFunc:da,children:[t.jsx(Da,{onSelectionChange:L}),t.jsx(Ma,{triggerDeselect:w}),t.jsx(_a,{selectRequest:y}),t.jsx(Aa,{trace:B,run:e,isLive:S,onWakeUpSleep:c,onCancelRun:d,onResolveHook:u,onLoadMoreSpans:f,hasMoreSpans:A,isLoadingMoreSpans:N,children:t.jsx(ia,{eagerRender:!0,height:"100%",isLive:S,trace:B,knownDurationMs:I==null?void 0:I.knownDurationMs,hasMoreData:A||!!s,footer:t.jsx(Pa,{hasMore:A,isLive:S,isInitialLoading:!!s})})})]})}),T&&t.jsxs("div",{className:"relative border-l flex-shrink-0 flex flex-col",style:{width:C,borderColor:"var(--ds-gray-200)",backgroundColor:"var(--ds-background-100)"},children:[t.jsx(La,{onResize:b}),t.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-y flex-shrink-0",style:{borderColor:"var(--ds-gray-200)"},children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx("div",{className:"text-sm font-medium truncate",style:{color:"var(--ds-gray-1000)"},title:X,children:X})}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("button",{type:"button","aria-label":"Previous span",onClick:K,disabled:!U,style:{display:"flex",alignItems:"center",justifyContent:"center",marginLeft:6,width:24,height:24,padding:0,borderRadius:6,border:"none",background:"transparent",color:"var(--ds-gray-700)",cursor:U?"pointer":"not-allowed",opacity:U?1:.45,flexShrink:0,transition:"background 0.15s"},onMouseEnter:j=>{U&&(j.currentTarget.style.background="var(--ds-gray-alpha-100)")},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:t.jsx(zs,{size:16})}),t.jsx("button",{type:"button","aria-label":"Next span",onClick:J,disabled:!$,style:{display:"flex",alignItems:"center",justifyContent:"center",marginLeft:2,width:24,height:24,padding:0,borderRadius:6,border:"none",background:"transparent",color:"var(--ds-gray-700)",cursor:$?"pointer":"not-allowed",opacity:$?1:.45,flexShrink:0,transition:"background 0.15s"},onMouseEnter:j=>{$&&(j.currentTarget.style.background="var(--ds-gray-alpha-100)")},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:t.jsx(Us,{size:16})})]}),t.jsx("div",{className:"flex items-center",style:{borderLeft:"1px solid var(--ds-gray-300)",marginLeft:6},children:t.jsx("button",{type:"button","aria-label":"Close panel",onClick:D,style:{display:"flex",alignItems:"center",justifyContent:"center",marginLeft:6,width:24,height:24,padding:0,borderRadius:6,border:"none",background:"transparent",color:"var(--ds-gray-700)",cursor:"pointer",flexShrink:0,transition:"background 0.15s"},onMouseEnter:j=>{j.currentTarget.style.background="var(--ds-gray-alpha-100)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:t.jsx(Ks,{size:16})})})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",children:t.jsx(Qe,{title:"Failed to load entity details",children:t.jsx(zo,{run:e,onStreamClick:p,spanDetailData:o??null,spanDetailError:l,spanDetailLoading:i,onSpanSelect:O,onWakeUpSleep:c,onLoadEventData:m,onResolveHook:u,encryptionKey:x,onDecrypt:k,isDecrypting:v,selectedSpan:T})})})]})]}):t.jsxs("div",{className:"relative w-full h-full",children:[t.jsx("div",{className:"border-b border-gray-alpha-400 w-full"}),t.jsx(Q,{className:"w-full ml-2 mt-1 mb-1 h-[56px]"}),t.jsxs("div",{className:"p-2 relative w-full",children:[t.jsx(Q,{className:"w-full mt-6 h-[20px]"}),t.jsx(Q,{className:"w-[10%] mt-2 ml-6 h-[20px]"}),t.jsx(Q,{className:"w-[10%] mt-2 ml-12 h-[20px]"}),t.jsx(Q,{className:"w-[20%] mt-2 ml-16 h-[20px]"})]})]})};async function Oa(e,r,s,n={}){const o=n.resolveData??"all";let i,l;if(r==="run")i=await ht(Wt(e,s,o)),l=i.runId;else if(r==="step"){const{runId:c}=n;if(!c)throw new _e("runId is required for step resource",{layer:"client"});i=await ht(An(e,c,s,o)),l=i.stepId}else if(r==="hook")i=await ht(Ur(e,s,o)),l=i.hookId;else throw new _e(`Unknown resource type: ${r}`,{layer:"client"});return{data:i,correlationId:l}}function $a(e,r,s,n={}){const{refreshInterval:o=0,runId:i,enabled:l=!0,encryptionKey:c}=n,[u,d]=a.useState(null),[p,h]=a.useState(l),[m,f]=a.useState(null),A=a.useCallback(async k=>c?He(k,c):me(k),[c]),N=a.useRef(""),x=a.useCallback(async()=>{if(!l){h(!1);return}const k=`${r}:${s}`;if(k!==N.current&&(d(null),N.current=k),f(null),h(!0),r==="hook"){try{const{error:v,result:R}=await ue(Ur(e,s,"all"));if(v){f(v);return}try{d(await A(R))}catch(T){f(T instanceof Error?T:new Error(String(T)))}}finally{h(!1)}return}if(r==="sleep"){try{if(!i){f(new Error("runId is required for loading sleep details"));return}const{error:v,result:R}=await ue(Be(e,i,{sortOrder:"asc",limit:1e3,withData:!0}));if(v){f(v);return}try{const T=R.data.map(me),P=await Promise.all(T.filter(E=>E.correlationId===s).map(A)),C=ts(P);if(C===null){f(new Error(`Failed to load ${r} details: missing required event data`));return}d(C)}catch(T){f(T instanceof Error?T:new Error(String(T)))}}finally{h(!1)}return}try{const{data:v}=await Oa(e,r,s,{runId:i});d(await A(v))}catch(v){v instanceof Error?f(v):f(new Error(String(v)));return}finally{h(!1)}},[e,r,s,i,l,A]);return a.useEffect(()=>{x()},[x]),a.useEffect(()=>{if(!o||o<=0)return;const k=setInterval(x,o);return()=>clearInterval(k)},[o,x]),{data:u,loading:p,error:m,refresh:x}}function Vt(e,r,s){const n=[...e,...r],o=new Map(n.map(i=>[i[s],i]));return Array.from(o.values())}async function Wa(e){const{fetchFn:r,setItems:s,setCursor:n,setError:o,idKey:i,cursorStrategy:l="always",transform:c}=e,{error:u,result:d}=await r();if(u)return o(u),!1;if(d.data.length>0){const p=c?d.data.map(c):d.data;return s(m=>Vt(m,p,i)),(l==="onHasMore"?!!(d.cursor&&d.hasMore):!!d.cursor)&&n(d.cursor),!0}return!1}const Ha=100,Ba=500,Va=100,za=5e3;function Ua(e,r,s={}){const{live:n=!1}=s,[o,i]=a.useState(null),[l,c]=a.useState([]),[u,d]=a.useState(!0),[p,h]=a.useState(null),[m,f]=a.useState(),[A,N]=a.useState(!1),[x,k]=a.useState(!1),v=a.useRef(!1),[R,T]=a.useState(!1),P=a.useCallback(async()=>{if(v.current)return;v.current=!0,d(!0),h(null);const[y,_]=await Promise.all([ue(Wt(e,r,"none")),ue(Be(e,r,{sortOrder:"asc",limit:Ba,withData:!1}))]);y.error?h(y.error):i(me(y.result));const S=_.error?[]:_.result.data.map(me);c(Vt([],S,"eventId")),f(_.error||!_.result.hasMore?void 0:_.result.cursor),N(!!(!_.error&&_.result.hasMore)),d(!1),T(!0),v.current=!1,!y.error&&_.error&&h(_.error)},[e,r]),C=a.useCallback(async()=>{if(!(v.current||!R||x||!A)){k(!0);try{const y=await ue(Be(e,r,{cursor:m,sortOrder:"asc",limit:Va,withData:!1}));if(y.error)h(y.error);else{const _=y.result.data.map(me);_.length>0&&c(S=>Vt(S,_,"eventId")),N(!!y.result.hasMore),f(y.result.hasMore?y.result.cursor:void 0)}}finally{k(!1)}}},[e,r,R,x,A,m]),E=a.useCallback(async()=>{if(o!=null&&o.completedAt)return!1;const{error:y,result:_}=await ue(Wt(e,r,"none"));return y?(h(y),!1):(h(null),i(me(_)),!0)},[e,r,o==null?void 0:o.completedAt]),w=a.useCallback(()=>Wa({fetchFn:()=>ue(Be(e,r,{cursor:m,sortOrder:"asc",limit:Ha,withData:!1})),setItems:c,setCursor:f,setError:h,idKey:"eventId",transform:me}),[e,r,m]),g=a.useCallback(async()=>{if(v.current||!R)return{foundNewItems:!1};let y=!1;try{const[_,S]=await Promise.all([E(),w()]);y=S}catch(_){console.error("Update error:",_)}return{foundNewItems:y}},[w,R,E]);return a.useEffect(()=>{P()},[P]),a.useEffect(()=>{if(!n||!R||o!=null&&o.completedAt)return;const y=setInterval(()=>{g()},za);return()=>{clearInterval(y)}},[n,R,g,o==null?void 0:o.completedAt]),{run:o??{},events:l,loading:u,error:p,update:g,loadMoreTraceData:C,hasMoreTraceData:A,isLoadingMoreTraceData:x}}function Ka(e){return typeof e=="object"&&e!==null&&"message"in e&&"layer"in e&&"cause"in e&&"request"in e}async function qa(e,r,s,n,o){try{const i=new URLSearchParams({runId:s});o&&i.set("cursor",o);const l=`/api/stream/${encodeURIComponent(r)}?${i.toString()}`,c=await fetch(l,{signal:n});if(!c.ok){const p=await c.json().catch(()=>null);throw p&&Ka(p)?new _e(p.message,{layer:"client",cause:p.cause,request:p.request}):new _e(`Failed to read stream: ${c.status}`,{layer:"client"})}if(!c.body)throw new _e("Failed to read stream: no body",{layer:"client"});const u=c.headers.get("X-Stream-Cursor"),d=c.headers.get("X-Stream-Done")==="true";return{body:c.body,cursor:u,done:d}}catch(i){throw i instanceof _e?i:new _e("Failed to read stream",{layer:"client",cause:i})}}async function Ga(e,r){return ht(Dn(e,r))}const Za=1e4;function Ya(e,r,s=Za){const[n,o]=a.useState([]),[i,l]=a.useState(!0),[c,u]=a.useState(null),d=a.useRef(!1),p=a.useCallback(async()=>{d.current||l(!0),u(null);try{const h=await Ga(e,r);o(h)}catch(h){u(h instanceof Error?h:new Error(String(h)))}finally{d.current=!0,l(!1)}},[e,r]);return a.useEffect(()=>{d.current=!1,p()},[p]),a.useEffect(()=>{if(!s||s<=0)return;const h=setInterval(p,s);return()=>clearInterval(h)},[s,p]),{streams:n,loading:i,error:c,refresh:p}}var Xa=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ke=Xa.reduce((e,r)=>{const s=a.forwardRef((n,o)=>{const{asChild:i,...l}=n,c=i?Gt:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(c,{...l,ref:o})});return s.displayName=`Primitive.${r}`,{...e,[r]:s}},{});function Ja(e,r){e&&Ut.flushSync(()=>e.dispatchEvent(r))}var Qa="DismissableLayer",zt="dismissableLayer.update",ei="dismissableLayer.pointerDownOutside",ti="dismissableLayer.focusOutside",vr,rs=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ss=a.forwardRef((e,r)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:l,onDismiss:c,...u}=e,d=a.useContext(rs),[p,h]=a.useState(null),m=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=a.useState({}),A=Ie(r,E=>h(E)),N=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=N.indexOf(x),v=p?N.indexOf(p):-1,R=d.layersWithOutsidePointerEventsDisabled.size>0,T=v>=k,P=ni(E=>{const w=E.target,g=[...d.branches].some(y=>y.contains(w));!T||g||(o==null||o(E),l==null||l(E),E.defaultPrevented||c==null||c())},m),C=oi(E=>{const w=E.target;[...d.branches].some(y=>y.contains(w))||(i==null||i(E),l==null||l(E),E.defaultPrevented||c==null||c())},m);return Zs(E=>{v===d.layers.size-1&&(n==null||n(E),!E.defaultPrevented&&c&&(E.preventDefault(),c()))},m),a.useEffect(()=>{if(p)return s&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(vr=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),wr(),()=>{s&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=vr)}},[p,m,s,d]),a.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),wr())},[p,d]),a.useEffect(()=>{const E=()=>f({});return document.addEventListener(zt,E),()=>document.removeEventListener(zt,E)},[]),t.jsx(ke.div,{...u,ref:A,style:{pointerEvents:R?T?"auto":"none":void 0,...e.style},onFocusCapture:je(e.onFocusCapture,C.onFocusCapture),onBlurCapture:je(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:je(e.onPointerDownCapture,P.onPointerDownCapture)})});ss.displayName=Qa;var ri="DismissableLayerBranch",si=a.forwardRef((e,r)=>{const s=a.useContext(rs),n=a.useRef(null),o=Ie(r,n);return a.useEffect(()=>{const i=n.current;if(i)return s.branches.add(i),()=>{s.branches.delete(i)}},[s.branches]),t.jsx(ke.div,{...e,ref:o})});si.displayName=ri;function ni(e,r=globalThis==null?void 0:globalThis.document){const s=yt(e),n=a.useRef(!1),o=a.useRef(()=>{});return a.useEffect(()=>{const i=c=>{if(c.target&&!n.current){let u=function(){ns(ei,s,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(r.removeEventListener("click",o.current),o.current=u,r.addEventListener("click",o.current,{once:!0})):u()}else r.removeEventListener("click",o.current);n.current=!1},l=window.setTimeout(()=>{r.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),r.removeEventListener("pointerdown",i),r.removeEventListener("click",o.current)}},[r,s]),{onPointerDownCapture:()=>n.current=!0}}function oi(e,r=globalThis==null?void 0:globalThis.document){const s=yt(e),n=a.useRef(!1);return a.useEffect(()=>{const o=i=>{i.target&&!n.current&&ns(ti,s,{originalEvent:i},{discrete:!1})};return r.addEventListener("focusin",o),()=>r.removeEventListener("focusin",o)},[r,s]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function wr(){const e=new CustomEvent(zt);document.dispatchEvent(e)}function ns(e,r,s,{discrete:n}){const o=s.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:s});r&&o.addEventListener(e,r,{once:!0}),n?Ja(o,i):o.dispatchEvent(i)}var Ot="focusScope.autoFocusOnMount",$t="focusScope.autoFocusOnUnmount",br={bubbles:!1,cancelable:!0},ai="FocusScope",os=a.forwardRef((e,r)=>{const{loop:s=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...l}=e,[c,u]=a.useState(null),d=yt(o),p=yt(i),h=a.useRef(null),m=Ie(r,N=>u(N)),f=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(n){let N=function(R){if(f.paused||!c)return;const T=R.target;c.contains(T)?h.current=T:Ee(h.current,{select:!0})},x=function(R){if(f.paused||!c)return;const T=R.relatedTarget;T!==null&&(c.contains(T)||Ee(h.current,{select:!0}))},k=function(R){if(document.activeElement===document.body)for(const P of R)P.removedNodes.length>0&&Ee(c)};document.addEventListener("focusin",N),document.addEventListener("focusout",x);const v=new MutationObserver(k);return c&&v.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",x),v.disconnect()}}},[n,c,f.paused]),a.useEffect(()=>{if(c){kr.add(f);const N=document.activeElement;if(!c.contains(N)){const k=new CustomEvent(Ot,br);c.addEventListener(Ot,d),c.dispatchEvent(k),k.defaultPrevented||(ii(fi(as(c)),{select:!0}),document.activeElement===N&&Ee(c))}return()=>{c.removeEventListener(Ot,d),setTimeout(()=>{const k=new CustomEvent($t,br);c.addEventListener($t,p),c.dispatchEvent(k),k.defaultPrevented||Ee(N??document.body,{select:!0}),c.removeEventListener($t,p),kr.remove(f)},0)}}},[c,d,p,f]);const A=a.useCallback(N=>{if(!s&&!n||f.paused)return;const x=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,k=document.activeElement;if(x&&k){const v=N.currentTarget,[R,T]=li(v);R&&T?!N.shiftKey&&k===T?(N.preventDefault(),s&&Ee(R,{select:!0})):N.shiftKey&&k===R&&(N.preventDefault(),s&&Ee(T,{select:!0})):k===v&&N.preventDefault()}},[s,n,f.paused]);return t.jsx(ke.div,{tabIndex:-1,...l,ref:m,onKeyDown:A})});os.displayName=ai;function ii(e,{select:r=!1}={}){const s=document.activeElement;for(const n of e)if(Ee(n,{select:r}),document.activeElement!==s)return}function li(e){const r=as(e),s=jr(r,e),n=jr(r.reverse(),e);return[s,n]}function as(e){const r=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)r.push(s.currentNode);return r}function jr(e,r){for(const s of e)if(!ci(s,{upTo:r}))return s}function ci(e,{upTo:r}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(r!==void 0&&e===r)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function di(e){return e instanceof HTMLInputElement&&"select"in e}function Ee(e,{select:r=!1}={}){if(e&&e.focus){const s=document.activeElement;e.focus({preventScroll:!0}),e!==s&&di(e)&&r&&e.select()}}var kr=ui();function ui(){let e=[];return{add(r){const s=e[0];r!==s&&(s==null||s.pause()),e=Nr(e,r),e.unshift(r)},remove(r){var s;e=Nr(e,r),(s=e[0])==null||s.resume()}}}function Nr(e,r){const s=[...e],n=s.indexOf(r);return n!==-1&&s.splice(n,1),s}function fi(e){return e.filter(r=>r.tagName!=="A")}var mi="Portal",is=a.forwardRef((e,r)=>{var c;const{container:s,...n}=e,[o,i]=a.useState(!1);Ys(()=>i(!0),[]);const l=s||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?Os.createPortal(t.jsx(ke.div,{...n,ref:r}),l):null});is.displayName=mi;var Qt="Dialog",[ls,cs]=Br(Qt),[pi,he]=ls(Qt),ds=e=>{const{__scopeDialog:r,children:s,open:n,defaultOpen:o,onOpenChange:i,modal:l=!0}=e,c=a.useRef(null),u=a.useRef(null),[d=!1,p]=Js({prop:n,defaultProp:o,onChange:i});return t.jsx(pi,{scope:r,triggerRef:c,contentRef:u,contentId:It(),titleId:It(),descriptionId:It(),open:d,onOpenChange:p,onOpenToggle:a.useCallback(()=>p(h=>!h),[p]),modal:l,children:s})};ds.displayName=Qt;var us="DialogTrigger",fs=a.forwardRef((e,r)=>{const{__scopeDialog:s,...n}=e,o=he(us,s),i=Ie(r,o.triggerRef);return t.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":rr(o.open),...n,ref:i,onClick:je(e.onClick,o.onOpenToggle)})});fs.displayName=us;var er="DialogPortal",[hi,ms]=ls(er,{forceMount:void 0}),ps=e=>{const{__scopeDialog:r,forceMount:s,children:n,container:o}=e,i=he(er,r);return t.jsx(hi,{scope:r,forceMount:s,children:a.Children.map(n,l=>t.jsx(qt,{present:s||i.open,children:t.jsx(is,{asChild:!0,container:o,children:l})}))})};ps.displayName=er;var kt="DialogOverlay",hs=a.forwardRef((e,r)=>{const s=ms(kt,e.__scopeDialog),{forceMount:n=s.forceMount,...o}=e,i=he(kt,e.__scopeDialog);return i.modal?t.jsx(qt,{present:n||i.open,children:t.jsx(xi,{...o,ref:r})}):null});hs.displayName=kt;var xi=a.forwardRef((e,r)=>{const{__scopeDialog:s,...n}=e,o=he(kt,s);return t.jsx(en,{as:Gt,allowPinchZoom:!0,shards:[o.contentRef],children:t.jsx(ke.div,{"data-state":rr(o.open),...n,ref:r,style:{pointerEvents:"auto",...n.style}})})}),Fe="DialogContent",xs=a.forwardRef((e,r)=>{const s=ms(Fe,e.__scopeDialog),{forceMount:n=s.forceMount,...o}=e,i=he(Fe,e.__scopeDialog);return t.jsx(qt,{present:n||i.open,children:i.modal?t.jsx(gi,{...o,ref:r}):t.jsx(yi,{...o,ref:r})})});xs.displayName=Fe;var gi=a.forwardRef((e,r)=>{const s=he(Fe,e.__scopeDialog),n=a.useRef(null),o=Ie(r,s.contentRef,n);return a.useEffect(()=>{const i=n.current;if(i)return Qs(i)},[]),t.jsx(gs,{...e,ref:o,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:je(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),(l=s.triggerRef.current)==null||l.focus()}),onPointerDownOutside:je(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&i.preventDefault()}),onFocusOutside:je(e.onFocusOutside,i=>i.preventDefault())})}),yi=a.forwardRef((e,r)=>{const s=he(Fe,e.__scopeDialog),n=a.useRef(!1),o=a.useRef(!1);return t.jsx(gs,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,i),i.defaultPrevented||(n.current||(c=s.triggerRef.current)==null||c.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{var u,d;(u=e.onInteractOutside)==null||u.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=i.target;((d=s.triggerRef.current)==null?void 0:d.contains(l))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),gs=a.forwardRef((e,r)=>{const{__scopeDialog:s,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...l}=e,c=he(Fe,s),u=a.useRef(null),d=Ie(r,u);return tn(),t.jsxs(t.Fragment,{children:[t.jsx(os,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:t.jsx(ss,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":rr(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),t.jsxs(t.Fragment,{children:[t.jsx(wi,{titleId:c.titleId}),t.jsx(ji,{contentRef:u,descriptionId:c.descriptionId})]})]})}),tr="DialogTitle",ys=a.forwardRef((e,r)=>{const{__scopeDialog:s,...n}=e,o=he(tr,s);return t.jsx(ke.h2,{id:o.titleId,...n,ref:r})});ys.displayName=tr;var vs="DialogDescription",ws=a.forwardRef((e,r)=>{const{__scopeDialog:s,...n}=e,o=he(vs,s);return t.jsx(ke.p,{id:o.descriptionId,...n,ref:r})});ws.displayName=vs;var bs="DialogClose",js=a.forwardRef((e,r)=>{const{__scopeDialog:s,...n}=e,o=he(bs,s);return t.jsx(ke.button,{type:"button",...n,ref:r,onClick:je(e.onClick,()=>o.onOpenChange(!1))})});js.displayName=bs;function rr(e){return e?"open":"closed"}var ks="DialogTitleWarning",[vi,Ns]=Xs(ks,{contentName:Fe,titleName:tr,docsSlug:"dialog"}),wi=({titleId:e})=>{const r=Ns(ks),s=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users.
24
+
25
+ If you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component.
26
+
27
+ For more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return a.useEffect(()=>{e&&(document.getElementById(e)||console.error(s))},[s,e]),null},bi="DialogDescriptionWarning",ji=({contentRef:e,descriptionId:r})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ns(bi).contentName}}.`;return a.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");r&&o&&(document.getElementById(r)||console.warn(n))},[n,e,r]),null},ki=ds,Ni=fs,Ci=ps,Ei=hs,Si=xs,Ii=ys,Ti=ws,Cs=js,Es="AlertDialog",[Ri]=Br(Es,[cs]),Ne=cs(),Ss=e=>{const{__scopeAlertDialog:r,...s}=e,n=Ne(r);return t.jsx(ki,{...n,...s,modal:!0})};Ss.displayName=Es;var Ai="AlertDialogTrigger",Di=a.forwardRef((e,r)=>{const{__scopeAlertDialog:s,...n}=e,o=Ne(s);return t.jsx(Ni,{...o,...n,ref:r})});Di.displayName=Ai;var Mi="AlertDialogPortal",Is=e=>{const{__scopeAlertDialog:r,...s}=e,n=Ne(r);return t.jsx(Ci,{...n,...s})};Is.displayName=Mi;var _i="AlertDialogOverlay",Ts=a.forwardRef((e,r)=>{const{__scopeAlertDialog:s,...n}=e,o=Ne(s);return t.jsx(Ei,{...o,...n,ref:r})});Ts.displayName=_i;var Ve="AlertDialogContent",[Li,Pi]=Ri(Ve),Rs=a.forwardRef((e,r)=>{const{__scopeAlertDialog:s,children:n,...o}=e,i=Ne(s),l=a.useRef(null),c=Ie(r,l),u=a.useRef(null);return t.jsx(vi,{contentName:Ve,titleName:As,docsSlug:"alert-dialog",children:t.jsx(Li,{scope:s,cancelRef:u,children:t.jsxs(Si,{role:"alertdialog",...i,...o,ref:c,onOpenAutoFocus:je(o.onOpenAutoFocus,d=>{var p;d.preventDefault(),(p=u.current)==null||p.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[t.jsx(Mn,{children:n}),t.jsx(Oi,{contentRef:l})]})})})});Rs.displayName=Ve;var As="AlertDialogTitle",Ds=a.forwardRef((e,r)=>{const{__scopeAlertDialog:s,...n}=e,o=Ne(s);return t.jsx(Ii,{...o,...n,ref:r})});Ds.displayName=As;var Ms="AlertDialogDescription",_s=a.forwardRef((e,r)=>{const{__scopeAlertDialog:s,...n}=e,o=Ne(s);return t.jsx(Ti,{...o,...n,ref:r})});_s.displayName=Ms;var Fi="AlertDialogAction",Ls=a.forwardRef((e,r)=>{const{__scopeAlertDialog:s,...n}=e,o=Ne(s);return t.jsx(Cs,{...o,...n,ref:r})});Ls.displayName=Fi;var Ps="AlertDialogCancel",Fs=a.forwardRef((e,r)=>{const{__scopeAlertDialog:s,...n}=e,{cancelRef:o}=Pi(Ps,s),i=Ne(s),l=Ie(r,o);return t.jsx(Cs,{...i,...n,ref:l})});Fs.displayName=Ps;var Oi=({contentRef:e})=>{const r=`\`${Ve}\` requires a description for the component to be accessible for screen reader users.
28
+
29
+ You can add a description to the \`${Ve}\` by passing a \`${Ms}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
30
+
31
+ 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 \`${Ve}\`. 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.
32
+
33
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return a.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(r)},[r,e]),null},$i=Ss,Wi=Is,Hi=Ts,Bi=Rs,Vi=Ls,zi=Fs,Ui=Ds,Ki=_s;function Cr({...e}){return t.jsx($i,{"data-slot":"alert-dialog",...e})}function qi({...e}){return t.jsx(Wi,{"data-slot":"alert-dialog-portal",...e})}function Gi({className:e,...r}){return t.jsx(Hi,{"data-slot":"alert-dialog-overlay",className:de("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),...r})}function Er({className:e,onSubmit:r,...s}){return t.jsxs(qi,{children:[t.jsx(Gi,{}),t.jsx(Bi,{"data-slot":"alert-dialog-content",className:de("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),onSubmit:n=>{n.preventDefault(),r==null||r(n)},...s})]})}function Sr({className:e,...r}){return t.jsx("div",{"data-slot":"alert-dialog-header",className:de("flex flex-col gap-2 text-center sm:text-left",e),...r})}function Ir({className:e,...r}){return t.jsx("div",{"data-slot":"alert-dialog-footer",className:de("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...r})}function Tr({className:e,...r}){return t.jsx(Ui,{"data-slot":"alert-dialog-title",className:de("text-lg font-semibold",e),...r})}function Rr({className:e,...r}){return t.jsx(Ki,{"data-slot":"alert-dialog-description",className:de("text-muted-foreground text-sm",e),...r})}function Ar({className:e,...r}){return t.jsx(Vi,{className:de(Kr(),e),...r})}function Dr({className:e,...r}){return t.jsx(zi,{className:de(Kr({variant:"outline"}),e),...r})}function Zi({...e}){return t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function Yi({className:e,...r}){return t.jsx("ol",{"data-slot":"breadcrumb-list",className:de("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...r})}function Mr({className:e,...r}){return t.jsx("li",{"data-slot":"breadcrumb-item",className:de("inline-flex items-center gap-1.5",e),...r})}function Xi({asChild:e,className:r,...s}){const n=e?Gt:"a";return t.jsx(n,{"data-slot":"breadcrumb-link",className:de("hover:text-foreground transition-colors",r),...s})}function Ji({className:e,...r}){return t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:de("text-foreground font-normal",e),...r})}function Qi({children:e,className:r,...s}){return t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:de("[&>svg]:size-3.5",r),...s,children:e??t.jsx(Kt,{})})}const ge=4,el="[Encrypted]",_r=3e3;function Lr(e){return e==="pending"||e==="running"}const $e=200,tl=6;function gt(e,r=0){if(e==null)return e;if(ArrayBuffer.isView(e)&&!(e instanceof DataView)){const s=e,n=s.constructor.name,o=Array.from({length:Math.min(s.length,8)},(l,c)=>s[c]),i=s.length>8?", …":"";return`${n}(${s.length}) [${o.join(", ")}${i}]`}if(e instanceof ArrayBuffer)return`ArrayBuffer(${e.byteLength})`;if(r>=tl)return Array.isArray(e)?`Array(${e.length})`:typeof e=="object"?"{…}":e;if(Array.isArray(e)){if(e.length<=$e)return e.map(n=>gt(n,r+1));const s=e.slice(0,$e).map(n=>gt(n,r+1));return s.push(`… ${e.length-$e} more items`),s}if(typeof e=="object"){const s=Object.keys(e),n={},o=Math.min(s.length,$e);for(let i=0;i<o;i++)n[s[i]]=gt(e[s[i]],r+1);return s.length>$e&&(n[`… ${s.length-$e} more keys`]="…"),n}return e}const rl=()=>new Promise(e=>setTimeout(e,0)),sl=64;function nl(e){if(e.length<ge)return"framed";const s=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!1);return s>0&&s<=10*1024*1024?"framed":"legacy"}function ol(e,r,s,n,o){const[i,l]=a.useState([]),[c,u]=a.useState(!1),[d,p]=a.useState(null),h=a.useRef(null),m=a.useRef(0),f=a.useRef(0),A=a.useRef(null),N=a.useRef(o);N.current=o;const x=a.useRef(null),k=a.useCallback(async(v,R,T)=>{let P=v;if(P.length>=ge+4&&!nr(P)){const y=new DataView(P.buffer,P.byteOffset,P.byteLength).getUint32(0,!1);y>0&&y<=10*1024*1024&&y===P.length-ge&&(P=P.slice(ge))}let C;try{if(nr(P)){if(!R)return{encrypted:!0};const g=P.slice(4);C=or(await Wn(R,g),T)}else C=or(P,T)}catch{C=el}let E;try{if(typeof C=="string")E=C;else{const g=gt(C);E=JSON.stringify(g,null,2)}}catch{E="[Serialization Error]"}return{encrypted:!1,chunk:{id:m.current++,text:E}}},[]);return a.useEffect(()=>{if(l([]),p(null),m.current=0,f.current=0,x.current=null,A.current&&(clearTimeout(A.current),A.current=null),!r||!s){u(!1);return}let v=!0;const R=new AbortController;h.current=R,u(!0);const T=_n(),P=w=>{const g=m.current++;let y;try{const _=JSON.parse(w);y=JSON.stringify(_,null,2)}catch{y=w}return{id:g,text:y}},C=async(w,g,y)=>{const _=await qa(e,r,s,R.signal,y==null?void 0:y.cursor),S=(y==null?void 0:y.skipFrames)??0,I=_.body.getReader(),B=new TextDecoder;let O=new Uint8Array(0),L=null,D="",b=0;const F=U=>{const $=new Uint8Array(O.length+U.length);$.set(O,0),$.set(U,O.length),O=$};for(;!R.signal.aborted;){const{value:U,done:$}=await I.read();if($){L==="legacy"&&D.trim()&&(b++,b>S&&w.push(P(D.trim())),D="");break}if(L===null?(F(U),O.length>=ge&&(L=nl(O)),L==="legacy"&&(D=B.decode(O,{stream:!0}),O=new Uint8Array(0))):L==="legacy"?D+=B.decode(U,{stream:!0}):F(U),L==="legacy"){const X=D.split(`
34
+ `);D=X.pop()??"";for(const j of X){const M=j.trim();M&&(b++,b>S&&w.push(P(M)))}continue}let K=0,J=0;for(;K+ge<=O.length;){const j=new DataView(O.buffer,O.byteOffset+K,O.byteLength-K).getUint32(0,!1);if(j===0||j>10*1024*1024||K+ge+j>O.length)break;const M=O.slice(K+ge,K+ge+j);if(K+=ge+j,b++,b<=S)continue;const W=await k(M,g,T);if(W.encrypted)return I.cancel().catch(()=>{}),{encrypted:!0};if(w.push(W.chunk),J++,J%sl===0&&(await rl(),R.signal.aborted||!v))break}O=O.slice(K)}return{encrypted:!1,frameCount:b,cursor:_.cursor,done:_.done}};return(async()=>{try{const w=n?await Hn(n):void 0,g=[],y=await C(g,w);if(y.encrypted){v&&(p("This stream is encrypted. Click Decrypt to view."),u(!1));return}if(f.current=y.frameCount,x.current=y.cursor,!v||R.signal.aborted)return;if(l(g),y.done){u(!1);return}if(Lr(N.current)){const _=async()=>{if(!(!v||R.signal.aborted)){try{const S=[],I=await C(S,w,{cursor:x.current,skipFrames:f.current});if(!I.encrypted&&(f.current=I.frameCount,I.cursor&&(x.current=I.cursor),S.length>0&&v&&l(B=>[...B,...S]),I.done)){u(!1);return}}catch(S){console.warn("Stream poll error:",S)}v&&!R.signal.aborted&&(A.current=setTimeout(_,_r))}};A.current=setTimeout(_,_r)}else u(!1)}catch(w){if(R.signal.aborted)return;v&&(p(w instanceof Error?w.message:String(w)),u(!1))}})(),()=>{v=!1,R.abort(),A.current&&(clearTimeout(A.current),A.current=null)}},[e,r,s,n,k]),a.useEffect(()=>{!Lr(o)&&A.current&&(clearTimeout(A.current),A.current=null,u(!1))},[o]),{chunks:i,isLive:c,error:d}}const al=100,il=100;function ll(e,r,s={}){const{sortOrder:n="asc",encryptionKey:o,enabled:i=!0}=s,[l,c]=a.useState([]),[u,d]=a.useState(!0),[p,h]=a.useState(null),[m,f]=a.useState(),[A,N]=a.useState(!1),[x,k]=a.useState(!1),v=a.useRef(!1),R=a.useRef(o);R.current=o;const T=a.useCallback(async()=>{if(!v.current){v.current=!0,d(!0),h(null),c([]),f(void 0),N(!1);try{const{error:C,result:E}=await ue(Be(e,r,{sortOrder:n,limit:al,withData:!1}));if(C)h(C);else{const w=E.data.map(me),g=R.current;if(g){const y=await Promise.all(w.map(_=>He(_,g)));c(y)}else c(w);f(E.hasMore?E.cursor:void 0),N(!!E.hasMore)}}catch(C){h(C)}finally{d(!1),v.current=!1}}},[e,r,n]);a.useEffect(()=>{i&&T()},[T,i]),a.useEffect(()=>{if(!o||l.length===0)return;let C=!1;return Promise.all(l.map(E=>He(E,o))).then(E=>{C||c(E)}).catch(()=>{}),()=>{C=!0}},[o]);const P=a.useCallback(async()=>{if(!(x||!m)){k(!0);try{const{error:C,result:E}=await ue(Be(e,r,{cursor:m,sortOrder:n,limit:il,withData:!1}));if(C)h(C);else{if(E.data.length>0){const w=E.data.map(me),g=R.current;if(g){const y=await Promise.all(w.map(_=>He(_,g)));c(_=>[..._,...y])}else c(y=>[...y,...w])}f(E.hasMore?E.cursor:void 0),N(!!E.hasMore)}}catch(C){h(C)}finally{k(!1)}}},[e,r,n,m,x]);return{events:l,loading:u,error:p,hasMore:A,loadingMore:x,loadMore:P}}function cl({hasError:e,errorMessage:r}){return t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(qr,{children:[t.jsx(Gr,{asChild:!0,children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:`w-2 h-2 rounded-full ${e?"bg-red-500":"bg-green-500 animate-pulse"}`}),t.jsx("span",{className:`text-xs $
35
+ hasError
36
+ ? 'text-red-600 dark:text-red-400'
37
+ : 'text-muted-foreground'`,children:e?"Error":"Live"})]})}),t.jsx(Zr,{children:t.jsx("p",{children:e?`Error updating data: ${r}`:`Content updates every ${Ln/1e3} seconds`})})]})})}({...rn});function dl({runId:e,selectedId:r}){var Re;const s=$s(),[n]=Pr(),{serverConfig:o}=Pn(),[i,l]=a.useState(!1),[c,u]=a.useState(!1),[d,p]=a.useState(!1),[h,m]=a.useState(!1),f=a.useMemo(()=>({}),[]),A=n.get("tab")||"trace",N=A==="graph"?"trace":A,x=n.get("streamId"),k=a.useCallback(q=>{const te=new URLSearchParams(n.toString());for(const[ne,re]of Object.entries(q))re===null?te.delete(ne):te.set(ne,re);s(`?${te.toString()}`,{preventScrollReset:!0})},[s,n]),v=a.useCallback(q=>{k(q!=="streams"?{tab:q,streamId:null}:{tab:q})},[k]),R=a.useCallback(q=>{k({streamId:q})},[k]),T=a.useCallback(q=>{k({tab:"streams",streamId:q})},[k]),P=a.useCallback(async(q,te)=>sn(f,q,{correlationIds:[te]}),[f]),C=a.useRef(null),E=a.useCallback(async(q,te)=>{await nn(f,q,te)},[f]),w=a.useCallback(async q=>{const{error:te,result:ne}=await ue(ar(f,q.runId,q.eventId,"all"));if(te)throw te;const re=C.current?await He(ne,C.current):me(ne);return"eventData"in re?re.eventData:null},[f]),g=a.useCallback(async(q,te)=>{const{error:ne,result:re}=await ue(ar(f,e,te,"all"));if(ne)throw ne;const ae=C.current?await He(re,C.current):me(re);return"eventData"in ae?ae.eventData:null},[f,e]);o.backendId==="local"||o.backendId;const{run:y,events:_,loading:S,error:I,update:B,loadMoreTraceData:O,hasMoreTraceData:L,isLoadingMoreTraceData:D}=Ua(f,e,{live:!0}),b=y??{},[F,U]=a.useState(null);C.current=F;const[$,K]=a.useState("asc"),{events:J,loading:X,hasMore:j,loadingMore:M,loadMore:W}=ll(f,e,{sortOrder:$,encryptionKey:F??void 0,enabled:N==="events"}),[z,ee]=a.useState(null),{data:H,loading:Z,error:V,refresh:Y}=$a(f,(z==null?void 0:z.resource)??"run",(z==null?void 0:z.resourceId)??"",{runId:z==null?void 0:z.runId,enabled:!!(z!=null&&z.resource&&(z!=null&&z.resourceId)&&z.resource!=="hook"),encryptionKey:F??void 0}),[se,oe]=a.useState(!1),fe=a.useCallback(async()=>{if(F){Y();return}oe(!0);try{const{error:q,result:te}=await ue(Fn(f,e));if(q){De.error(`Failed to fetch encryption key: ${q.message}`);return}if(!te){De.error("Encryption is not configured for this deployment.");return}U(te),De.success("Run data decrypted successfully")}finally{oe(!1)}},[F,f,e,Y]),Oe=a.useCallback(q=>{ee(q)},[]),{streams:we,loading:Ce,error:Ke}=Ya(f,e),{chunks:ot,isLive:at,error:xe}=ol(f,x,e,F,b.status),it=()=>{p(!0)},lt=async()=>{if(!i)try{l(!0),p(!1),await pn(f,e),await B(),De.success("Run cancelled successfully")}catch(q){console.error("Failed to cancel run:",q),De.error("Failed to cancel run",{description:q instanceof Error?q.message:"An unknown error occurred"})}finally{l(!1)}},ct=()=>{m(!0)},dt=async()=>{if(!c)try{u(!0),m(!1);const q=await hn(f,b.runId);De.success("New run started successfully",{description:`Run ID: ${q}`}),s(`/run/${q}`)}catch(q){console.error("Failed to re-run workflow:",q),De.error("Failed to start new run",{description:q instanceof Error?q.message:"An unknown error occurred"})}finally{u(!1),m(!1)}};if(I&&!y)return t.jsxs(on,{variant:"destructive",className:"m-4",children:[t.jsx(Fr,{className:"h-4 w-4"}),t.jsx(an,{children:"Error loading workflow run"}),t.jsx(ln,{children:I.message})]});const Te=(Re=ze(b.workflowName))==null?void 0:Re.shortName;return t.jsxs(t.Fragment,{children:[t.jsx(Cr,{open:d,onOpenChange:p,children:t.jsxs(Er,{children:[t.jsxs(Sr,{children:[t.jsx(Tr,{children:"Cancel Workflow Run?"}),t.jsx(Rr,{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?"})]}),t.jsxs(Ir,{children:[t.jsx(Dr,{children:"Keep Running"}),t.jsx(Ar,{onClick:lt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Cancel Run"})]})]})}),t.jsx(Cr,{open:h,onOpenChange:m,children:t.jsxs(Er,{children:[t.jsxs(Sr,{children:[t.jsx(Tr,{children:"Replay Run?"}),t.jsx(Rr,{children:"This can potentially re-run code that is meant to only execute once. Are you sure you want to replay the workflow run?"})]}),t.jsxs(Ir,{children:[t.jsx(Dr,{children:"Cancel"}),t.jsx(Ar,{onClick:dt,children:"Replay Run"})]})]})}),t.jsxs("div",{className:"flex flex-col h-[calc(100vh-97px)]",children:[t.jsxs("div",{className:"flex-none space-y-4",children:[t.jsx(Zi,{children:t.jsxs(Yi,{children:[t.jsx(Mr,{children:t.jsx(Xi,{asChild:!0,children:t.jsx(Ws,{to:"/",children:"Runs"})})}),t.jsx(Qi,{}),t.jsx(Mr,{children:t.jsx(Ji,{className:"font-mono text-xs",children:e})})]})}),t.jsxs("div",{className:"space-y-4 p-6 border rounded-lg",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsx("div",{className:"mb-4",children:t.jsx("h1",{className:"text-xl font-semibold",children:Te||t.jsx(Ae,{className:"w-[260px] h-[28px]"})})}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx(cl,{hasError:!1,errorMessage:""}),t.jsx(cn,{env:f,runId:e,runStatus:b.status,events:_,eventsLoading:S,loading:S,onRerunClick:ct,onCancelClick:it,callbacks:{onSuccess:B}})]})]}),t.jsxs("div",{className:"flex items-start gap-8",children:[t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Status"}),b.status?t.jsx(dn,{status:b.status,context:b}):t.jsx(Ae,{className:"w-[55px] h-[24px]"})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Duration"}),t.jsx("div",{className:"text-xs",children:b.runId?b.startedAt?(()=>{const q=(b.completedAt?new Date(b.completedAt).getTime():Date.now())-new Date(b.startedAt).getTime(),te=Math.floor(q/1e3);if(te<60)return`${te}s`;const ne=Math.floor(te/60),re=te%60;if(ne<60)return re>0?`${ne}m ${re}s`:`${ne}m`;const ae=Math.floor(ne/60),Ge=ne%60;return Ge>0?`${ae}h ${Ge}m`:`${ae}h`})():"-":t.jsx(Ae,{className:"w-[60px] h-[20px]"})})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Run ID"}),b.runId?t.jsx(un,{text:b.runId,children:t.jsx("div",{className:"text-xs mt-0.5 font-mono",children:b.runId})}):t.jsx(Ae,{className:"w-[280px] h-[20px]"})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Queued"}),b.createdAt?t.jsx("div",{className:"text-xs",children:t.jsx(ut,{date:b.createdAt})}):t.jsx(Ae,{className:"w-[110px] h-[20px]"})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Started"}),t.jsx("div",{className:"text-xs",children:b.runId?b.startedAt?t.jsx(ut,{date:b.startedAt}):"-":t.jsx(Ae,{className:"w-[110px] h-[20px]"})})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Completed"}),t.jsx("div",{className:"text-xs",children:b.runId?b.completedAt?t.jsx(ut,{date:b.completedAt}):"-":t.jsx(Ae,{className:"w-[110px] h-[20px]"})})]}),b.expiredAt!=null&&t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs(qr,{children:[t.jsx(Gr,{asChild:!0,children:t.jsxs("div",{className:"text-xs text-muted-foreground cursor-help flex items-center gap-1",children:["Expired",t.jsx(Vn,{className:"w-3 h-3"})]})}),t.jsx(Zr,{children:t.jsx("p",{children:"The storage data for this run has expired and is no longer available."})})]}),t.jsx("div",{className:"text-xs",children:t.jsx(ut,{date:b.expiredAt})})]})]})]})]}),t.jsx("div",{className:"mt-4 flex-1 flex flex-col min-h-0",children:t.jsxs(fn,{value:N,onValueChange:q=>v(q),className:"flex-1 flex flex-col min-h-0",children:[t.jsxs(mn,{className:"mb-4 flex-none",children:[t.jsxs(Tt,{value:"trace",className:"gap-2",children:[t.jsx(Mt,{className:"h-4 w-4"}),"Trace"]}),!1,t.jsxs(Tt,{value:"events",className:"gap-2",children:[t.jsx(Mt,{className:"h-4 w-4"}),"Events"]}),t.jsxs(Tt,{value:"streams",className:"gap-2",children:[t.jsx(Mt,{className:"h-4 w-4"}),"Streams"]})]}),t.jsx(Rt,{value:"trace",className:"mt-0 flex-1 min-h-0",children:t.jsx(Qe,{title:"Failed to load trace viewer",children:t.jsx("div",{className:"h-full",children:t.jsx(Fa,{error:I,events:_,run:b,isLoading:S,spanDetailData:H,spanDetailLoading:Z,spanDetailError:V,onSpanSelect:Oe,onStreamClick:T,onWakeUpSleep:P,onResolveHook:E,onLoadEventData:g,onLoadMoreSpans:O,hasMoreSpans:L,isLoadingMoreSpans:D,encryptionKey:F??void 0,onDecrypt:fe,isDecrypting:se})})})}),t.jsx(Rt,{value:"events",className:"mt-0 flex-1 min-h-0",children:t.jsx(Qe,{title:"Failed to load events list",children:t.jsx("div",{className:"h-full",children:t.jsx(yo,{events:J,run:b,onLoadEventData:w,hasMoreEvents:j,isLoadingMoreEvents:M,onLoadMoreEvents:W,encryptionKey:F??void 0,isLoading:X,sortOrder:$,onSortOrderChange:K,onDecrypt:fe,isDecrypting:se})})})}),t.jsx(Rt,{value:"streams",className:"mt-0 flex-1 min-h-0",children:t.jsx(Qe,{title:"Failed to load stream data",children:t.jsxs("div",{className:"h-full flex gap-4",children:[t.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:[t.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 (",we.length,")"]}),t.jsx("div",{className:"overflow-auto max-h-[calc(100vh-400px)]",children:Ce?t.jsx("div",{className:"p-4 flex items-center justify-center",children:t.jsx(On,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):Ke?t.jsx("div",{className:"p-4 text-xs text-destructive",children:Ke.message}):we.length===0?t.jsx("div",{className:"p-4 text-xs",style:{color:"var(--ds-gray-600)"},children:"No streams found for this run"}):we.map(q=>t.jsx("button",{type:"button",onClick:()=>R(q),className:"w-full text-left px-3 py-2 text-xs font-mono truncate hover:bg-accent transition-colors",style:{backgroundColor:x===q?"var(--ds-gray-200)":"transparent",color:"var(--ds-gray-1000)"},title:q,children:q},q))})]}),t.jsx("div",{className:"flex-1 min-w-0",children:x?xe!=null&&xe.includes("encrypted")&&!F?t.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-3 rounded-lg border p-4",style:{borderColor:"var(--ds-gray-300)",backgroundColor:"var(--ds-gray-100)"},children:[t.jsx(Vr,{className:"h-6 w-6",style:{color:"var(--ds-gray-700)"}}),t.jsx("div",{className:"text-sm",style:{color:"var(--ds-gray-900)"},children:"This stream is encrypted."}),t.jsx(Yt,{onClick:fe,loading:se})]}):t.jsx($n,{streamId:x,chunks:ot,isLive:at,error:xe!=null&&xe.includes("encrypted")?null:xe}):t.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:t.jsx("div",{className:"text-sm",style:{color:"var(--ds-gray-600)"},children:we.length>0?"Select a stream to view its data":"No streams available"})})})]})})}),!1]})})]})]})}const hl=Hs(function(){const r=Bs(),[s]=Pr(),n=r.runId,o=s.get("stepId"),i=s.get("eventId"),l=s.get("hookId"),c=o||i||l||void 0;return t.jsx(Qe,{title:"Failed to load run details",children:t.jsx(dl,{runId:n,selectedId:c})})});export{hl as default};
@@ -1,4 +1,4 @@
1
- var Ld=Object.defineProperty;var Fd=(e,t,n)=>t in e?Ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var br=(e,t,n)=>Fd(e,typeof t!="symbol"?t+"":t,n);import{c as le,aB as os,d as ae,G as zd,aC as go,E as me,aD as Hd,aE as Bd,aF as Wd,aG as Vd,aH as Yd,aI as Gd,aJ as Xd,aK as Ud,aL as qd,T as Se,a as Ce,b as _e,aM as Kd,aN as Zd,aO as Qd,aP as Jd,aQ as ef,p as mo,n as Yr,v as ss,O as tf,B as Dn,t as Re,s as Li,P as Pt,q as ze,x as Fi,m as nf,H as rf}from"./mermaid-3ZIDBTTL-CsKo7Yup.js";import{r as x,j as h,f as zi,R as de,H as of,C as sf,a as Hi,I as af}from"./index-BmZS3y7B.js";function Bi(e,t){if(typeof t!="string")return null;const[n,r,...o]=t.split("//");if(n!==e||!r||o.length===0)return null;const s=o.join("//");let i=s.split("/").at(-1)??"",a="";if(r.startsWith("./"))a=r.split("/").at(-1)??"";else{const c=r.split("@").slice(0,-1).join("@")||r.split("@")[0];a=(c==null?void 0:c.split("/").at(-1))??""}return["default","__default"].includes(i)&&a&&(i=a),{shortName:i,moduleSpecifier:r,functionName:s}}function tS(e){return Bi("workflow",e)}function nS(e){return Bi("step",e)}/**
1
+ var Ld=Object.defineProperty;var Fd=(e,t,n)=>t in e?Ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var br=(e,t,n)=>Fd(e,typeof t!="symbol"?t+"":t,n);import{c as le,aC as os,d as ae,G as zd,aD as go,E as me,aE as Hd,aF as Bd,aG as Wd,aH as Vd,aI as Yd,aJ as Gd,aK as Xd,aL as Ud,aM as qd,T as Se,a as Ce,b as _e,aN as Kd,aO as Zd,aP as Qd,aQ as Jd,aR as ef,p as mo,n as Yr,v as ss,O as tf,B as Dn,t as Re,s as Li,P as Pt,q as ze,x as Fi,m as nf,H as rf}from"./mermaid-3ZIDBTTL-CCXSRVd3.js";import{r as x,j as h,f as zi,R as de,H as of,C as sf,a as Hi,I as af}from"./index-BmZS3y7B.js";function Bi(e,t){if(typeof t!="string")return null;const[n,r,...o]=t.split("//");if(n!==e||!r||o.length===0)return null;const s=o.join("//");let i=s.split("/").at(-1)??"",a="";if(r.startsWith("./"))a=r.split("/").at(-1)??"";else{const c=r.split("@").slice(0,-1).join("@")||r.split("@")[0];a=(c==null?void 0:c.split("/").at(-1))??""}return["default","__default"].includes(i)&&a&&(i=a),{shortName:i,moduleSpecifier:r,functionName:s}}function tS(e){return Bi("workflow",e)}function nS(e){return Bi("step",e)}/**
2
2
  * @license lucide-react v0.575.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -9176,7 +9176,7 @@ const app = express();
9176
9176
  app.all(
9177
9177
  "*",
9178
9178
  createRequestHandler({
9179
- build: () => import("./server-build-D_RLM6Vr.js").then((n) => n.F)
9179
+ build: () => import("./server-build-rhQJXUIP.js").then((n) => n.G)
9180
9180
  })
9181
9181
  );
9182
9182
  app.use(
@@ -1,16 +1,16 @@
1
- import { x as R, K as Ks, y as jsxRuntimeExports, z as Qe } from "./server-build-D_RLM6Vr.js";
2
- import { r as reactExports } from "./app-Czg8_lQt.js";
1
+ import { y as R, K as Ks, z as jsxRuntimeExports, A as Qe } from "./server-build-rhQJXUIP.js";
2
+ import { r as reactExports } from "./app-DaJqmGT8.js";
3
3
  import "node:stream";
4
4
  import "util";
5
5
  import "crypto";
6
6
  import "async_hooks";
7
7
  import "stream";
8
+ import "node:crypto";
8
9
  import "node:process";
9
10
  import "node:path";
10
11
  import "node:url";
11
12
  import "module";
12
13
  import "node:fs/promises";
13
- import "node:crypto";
14
14
  import "tty";
15
15
  import "os";
16
16
  import "node:module";
@@ -1,17 +1,17 @@
1
- import { B, D, q, E, a, b, c, H, L, M, P, Q, d, R, l, m, n, h, S, o, p, i, V, t, w, W, e, f, g, j, r, k, s, u, v } from "./server-build-D_RLM6Vr.js";
2
- import "./app-Czg8_lQt.js";
1
+ import { B, D, t, E, a, b, c, H, L, M, P, Q, d, R, l, m, n, o, h, S, p, q, i, V, w, x, W, e, f, g, j, r, k, s, u, v } from "./server-build-rhQJXUIP.js";
2
+ import "./app-DaJqmGT8.js";
3
3
  import "stream";
4
4
  import "express";
5
5
  import "node:stream";
6
6
  import "util";
7
7
  import "crypto";
8
8
  import "async_hooks";
9
+ import "node:crypto";
9
10
  import "node:process";
10
11
  import "node:path";
11
12
  import "node:url";
12
13
  import "module";
13
14
  import "node:fs/promises";
14
- import "node:crypto";
15
15
  import "tty";
16
16
  import "os";
17
17
  import "node:module";
@@ -44,7 +44,7 @@ import "node:os";
44
44
  export {
45
45
  B as BaseEventSchema,
46
46
  D as DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS,
47
- q as DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS,
47
+ t as DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS,
48
48
  E as EVENT_DATA_REF_FIELDS,
49
49
  a as EventSchema,
50
50
  b as EventTypeSchema,
@@ -59,14 +59,15 @@ export {
59
59
  l as SPEC_VERSION_CURRENT,
60
60
  m as SPEC_VERSION_LEGACY,
61
61
  n as SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT,
62
+ o as SPEC_VERSION_SUPPORTS_EVENT_SOURCING,
62
63
  h as SerializedDataSchema,
63
64
  S as StepInvokePayloadSchema,
64
- o as StepSchema,
65
- p as StepStatusSchema,
65
+ p as StepSchema,
66
+ q as StepStatusSchema,
66
67
  i as StructuredErrorSchema,
67
68
  V as ValidQueueName,
68
- t as WaitSchema,
69
- w as WaitStatusSchema,
69
+ w as WaitSchema,
70
+ x as WaitStatusSchema,
70
71
  W as WorkflowInvokePayloadSchema,
71
72
  e as WorkflowRunBaseSchema,
72
73
  f as WorkflowRunSchema,
@@ -1,17 +1,17 @@
1
- import { N } from "./server-build-D_RLM6Vr.js";
2
- import "./app-Czg8_lQt.js";
1
+ import { N } from "./server-build-rhQJXUIP.js";
2
+ import "./app-DaJqmGT8.js";
3
3
  import "stream";
4
4
  import "express";
5
5
  import "node:stream";
6
6
  import "util";
7
7
  import "crypto";
8
8
  import "async_hooks";
9
+ import "node:crypto";
9
10
  import "node:process";
10
11
  import "node:path";
11
12
  import "node:url";
12
13
  import "module";
13
14
  import "node:fs/promises";
14
- import "node:crypto";
15
15
  import "tty";
16
16
  import "os";
17
17
  import "node:module";