1import{r as e,j as t,aY as a,g as r,e2 as n,av as l,au as i,l as s,dr as o,ei as c,Z as d,c0 as u,_ as p,cR as m,z as g,a5 as h,Q as x,b8 as b,ej as f,aw as y,a8 as v,C as N,bS as w,a7 as k,a9 as C,dt as S,bd as z,aS as A,a6 as M,aT as $,b3 as I,N as R,dA as _,X as D,bX as O,M as E,d7 as j,Y as T,ek as P,aX as L,w as B,cl as G,J as W,F,q as H,az as U,h as V,T as Y,R as React}from"./vendor-HffV8TdV.js";import{R as q,ar as X,as as J,A as Q,Q as K}from"./engine-CTHLJ2mf.js";const Z={Rocket:s,PenTool:U,Target:H,Shield:F,Users:W,Award:G,Cpu:B,TrendingUp:L,ClipboardCheck:P,Workflow:a},ee={};Q.forEach(e=>{ee[e.id]=e});const te={nexus:"#8b5cf6",forge:"#3b82f6",muse:"#10b981",mercury:"#f59e0b",apollo:"#ec4899",vault:"#f97316",oracle:"#6366f1",guardian:"#06b6d4",dispatch:"#818cf8",architect:"#a855f7",context:"#14b8a6",reinvest:"#22c55e",evolve:"#f43f5e",sentinel:"#eab308",themer:"#d946ef"};function ae({activeRun:a,executing:r,history:n}){e.useRef(null),e.useRef(0);const[l,i]=e.useState(0);e.useEffect(()=>{const e=setInterval(()=>i(e=>e+1),80);return()=>clearInterval(e)},[]);const s=e.useMemo(()=>a?.steps?a.steps.filter(e=>"running"===e.status).map(e=>e.agentId):[],[a,l]),o=e.useMemo(()=>a?.steps?a.steps.filter(e=>"completed"===e.status).map(e=>e.agentId):[],[a,l]),c=e.useMemo(()=>{const e=a?a.steps.map(e=>e.agentId):Q.slice(0,9).map(e=>e.id);return e.map((t,a)=>{const r=a/e.length*Math.PI*2-Math.PI/2;return{id:t,x:160+95*Math.cos(r),y:130+95*Math.sin(r),angle:r}})},[a]);return t.jsxs("div",{className:"relative bg-gray-950/80 border border-violet-500/10 rounded-2xl overflow-hidden",children:[t.jsx("div",{className:"absolute top-0 right-0 w-72 h-72 bg-sky-500/5 rounded-full blur-3xl pointer-events-none"}),t.jsx("div",{className:"absolute bottom-0 left-0 w-64 h-64 bg-blue-500/5 rounded-full blur-3xl pointer-events-none"}),t.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-violet-900/5 via-transparent to-cyan-900/5"}),t.jsxs("div",{className:"absolute inset-0 transition-opacity duration-1000 "+(r?"opacity-100":"opacity-30"),children:[t.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-48 h-48 rounded-full bg-violet-500/5 blur-3xl animate-pulse"}),t.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-32 h-32 rounded-full bg-cyan-500/5 blur-2xl",style:{animationDelay:"1s"}})]}),t.jsxs("div",{className:"relative p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-2 h-2 rounded-full "+(r?"bg-violet-500 animate-ping":"bg-cyan-500")}),t.jsx("span",{className:"text-[10px] font-black text-gray-400 uppercase tracking-[0.2em]",children:r?"Entity Active":"OmniFINDS Entity"})]}),t.jsxs("span",{className:"text-[9px] text-gray-600",children:[c.length," nodes"]})]}),t.jsxs("svg",{viewBox:"0 0 320 260",className:"w-full max-w-sm mx-auto",children:[t.jsxs("defs",{children:[t.jsxs("filter",{id:"glow-violet",x:"-50%",y:"-50%",width:"200%",height:"200%",children:[t.jsx("feGaussianBlur",{stdDeviation:"4",result:"blur"}),t.jsx("feComposite",{in:"SourceGraphic",in2:"blur",operator:"over"})]}),t.jsxs("filter",{id:"glow-cyan",x:"-50%",y:"-50%",width:"200%",height:"200%",children:[t.jsx("feGaussianBlur",{stdDeviation:"3",result:"blur"}),t.jsx("feComposite",{in:"SourceGraphic",in2:"blur",operator:"over"})]}),t.jsxs("filter",{id:"glow-strong",x:"-50%",y:"-50%",width:"200%",height:"200%",children:[t.jsx("feGaussianBlur",{stdDeviation:"6",result:"blur"}),t.jsx("feComposite",{in:"SourceGraphic",in2:"blur",operator:"over"})]}),t.jsxs("linearGradient",{id:"nerve-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[t.jsx("stop",{offset:"0%",stopColor:"#8b5cf6",stopOpacity:"0.1"}),t.jsx("stop",{offset:3*l%100+"%",stopColor:"#8b5cf6",stopOpacity:"0.8"}),t.jsx("stop",{offset:"100%",stopColor:"#06b6d4",stopOpacity:"0.1"})]})]}),c.map((e,a)=>{const r=c[(a+1)%c.length],n=s.includes(e.id)||s.includes(r.id),l=o.includes(e.id)&&o.includes(r.id);return t.jsx("line",{x1:e.x,y1:e.y,x2:r.x,y2:r.y,stroke:n?"#8b5cf6":l?"#10b981":"#1f2937",strokeWidth:n?2:1,opacity:n?.8:l?.5:.2,filter:n?"url(#glow-violet)":void 0},`line-${a}`)}
1),c.length>4&&c.map((e,a)=>{const n=c[(a+Math.floor(c.length/2))%c.length];return t.jsx("line",{x1:e.x,y1:e.y,x2:n.x,y2:n.y,stroke:r?"#8b5cf620":"#1f293710",strokeWidth:.5,strokeDasharray:"4 8"},`cross-${a}`)}),t.jsx("circle",{cx:"160",cy:"130",r:r?18:14,fill:"none",stroke:r?"#8b5cf6":"#374151",strokeWidth:"1.5",opacity:r?.6:.3,filter:r?"url(#glow-strong)":void 0}),t.jsx("circle",{cx:"160",cy:"130",r:r?8:5,fill:r?"#8b5cf6":"#6b7280",opacity:r?.8:.4}),r&&t.jsx("circle",{cx:"160",cy:"130",r:"22",fill:"none",stroke:"#8b5cf6",strokeWidth:"0.5",opacity:"0.3",strokeDasharray:"3 6",children:t.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:"0 160 130",to:"360 160 130",dur:"8s",repeatCount:"indefinite"})}),c.map(e=>{const a=s.includes(e.id),r=o.includes(e.id),n=te[e.id]||"#6b7280",l=ee[e.id];return t.jsxs("g",{children:[a&&t.jsxs("circle",{cx:e.x,cy:e.y,r:"16",fill:n,opacity:"0.15",filter:"url(#glow-strong)",children:[t.jsx("animate",{attributeName:"r",values:"14;18;14",dur:"1.5s",repeatCount:"indefinite"}),t.jsx("animate",{attributeName:"opacity",values:"0.1;0.25;0.1",dur:"1.5s",repeatCount:"indefinite"})]}),t.jsx("circle",{cx:e.x,cy:e.y,r:a?10:r?9:7,fill:a||r?n:"#1f2937",stroke:a?n:r?"#10b981":"#374151",strokeWidth:a?2:1,opacity:a?1:r?.8:.5,filter:a?"url(#glow-violet)":void 0}),r&&!a&&t.jsx("text",{x:e.x,y:e.y+3,textAnchor:"middle",fontSize:"8",fill:"white",fontWeight:"bold",children:"\u2713"}),t.jsx("text",{x:e.x,y:e.y+20,textAnchor:"middle",fontSize:"7",fill:a?n:r?"#10b981":"#6b7280",fontWeight:"bold",letterSpacing:"0.05em",children:l?.name||e.id.toUpperCase()})]},e.id)}),r&&t.jsx(t.Fragment,{children:t.jsxs("circle",{cx:"160",cy:"130",r:"40",fill:"none",stroke:"#8b5cf6",strokeWidth:"0.5",opacity:"0",children:[t.jsx("animate",{attributeName:"r",values:"30;100;30",dur:"4s",repeatCount:"indefinite"}),t.jsx("animate",{attributeName:"opacity",values:"0.3;0;0.3",dur:"4s",repeatCount:"indefinite"})]})})]})]})]})}function re({history:a,templates:r}){const n=e.useMemo(()=>{const e={};Q.forEach(t=>{e[t.id]={runs:0,successes:0,totalTime:0,avgTime:0}});for(const t of a){const a=r.find(e=>e.id===t.templateId);a&&a.agents.forEach(r=>{e[r]&&(e[r].runs++,"completed"===t.status&&e[r].successes++,e[r].totalTime+=(t.totalElapsed||0)/(a.agents.length||1))})}return Object.values(e).forEach(e=>{e.avgTime=e.runs>0?e.totalTime/e.runs:0,e.successRate=e.runs>0?e.successes/e.runs:0}),e},[a,r]),l=Math.max(1,...Object.values(n).map(e=>e.runs));return t.jsxs("div",{className:"bg-gray-950/60 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/40 rounded-2xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx(z,{size:14,className:"text-orange-400"}),t.jsx("span",{className:"text-xs font-black text-gray-300 uppercase tracking-wider",children:"Agent Pipeline Heat Map"}),t.jsx("div",{className:"flex-1"}),t.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-sm bg-violet-500/20"}),"Cold"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"w-2 h-2 rounded-sm bg-violet-500"}),"Hot"]})]})]}),t.jsx("div",{className:"grid grid-cols-5 sm:grid-cols-8 lg:grid-cols-15 gap-1.5",children:Q.map(e=>{const a=n[e.id]||{runs:0,successRate:0},r=a.runs/l,i=te[e.id]||"#8b5cf6";return t.jsxs("div",{className:"group relative flex flex-col items-center gap-1 p-2 rounded-lg border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/30 hover:border-gray-700/50 transition-all cursor-default",style:{background:`${i}${Math.round(40*r).toString(16).padStart(2,"0")}`},children:[t.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-[8px] font-black text-white",style:{background:i,opacity:.3+.7*r,boxShadow:r>.5?`0 0 12px ${i}40`:"none"},children:a.runs}),t.jsx("span",{className:"text-[8px] font-bold text-gray-500 uppercase",children:e.name}),t.jsxs("div",{className:"absolute -top-16 left-1/2 -translate-x-1/2 bg-gray-900 border border-gray-700 rounded-lg px-3 py-2 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50 whitespace-nowrap",children:[t.jsx("div",{className:"text-[10px] font-bold text-white",children:e.name}),t.jsxs("div",{className:"text-[9px] text-gray-400",children:[a.runs," runs | ",Math.round(100*a.successRate),"% success"]}),t.jsx("div",{className:"text-[9px] text-gray-500",children:a.avgTime>0?`Avg ${(a.avgTime/1e3).toFixed(1)}s`:"No data"})]})]},e.id)})})]})}function ne({executing:a}){const[r,n]=e.useState(0);e.useEffect(()=>{const e=setInterval(()=>n(e=>e+1),100);return()=>clearInterval(e)},[]);const l=[{label:"Research",icon:"\ud83d\udd0d",color:"#6366f1",agents:"ORACLE"},{label:"Build",icon:"\u2699\ufe0f",color:"#3b82f6",agents:"FORGE + ARCHITECT"},{label:"Create",icon:"\u2728",color:"#10b981",agents:"MUSE + THEMER"},{label:"Optimize",icon:"\ud83d\udcca",color:"#ec4899",agents:"APOLLO + SENTINEL"},{label:"Distribute",icon:"\ud83d\udce1",color:"#f59e0b",agents:"MERCURY + DISPATCH"},{label:"Monetize",icon:"\ud83d\udcb0",color:"#22c55e",agents:"VAULT + REINVEST"},{label:"Evolve",icon:"\ud83e\uddec",color:"#f43f5e",agents:"EVOLVE + CONTEXT"},{label:"Orchestrate",icon:"\ud83e\udde0",color:"#8b5cf6",agents:"NEXUS + GUARDIAN"}],i=150;return t.jsxs("div",{className:"bg-gray-950/60 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/40 rounded-2xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(c,{size:14,className:"text-violet-400"}),t.jsx("span",{className:"text-xs font-black text-gray-300 uppercase tracking-wider",children:"AI Ecosystem Loop"}),t.jsx("div",{className:"flex-1"}),t.jsx("span",{className:"text-[9px] px-2 py-0.5 rounded-full "+(a?"bg-violet-500/20 text-violet-300":"bg-gray-800 text-gray-500"),children:a?"Cycling":"Idle"})]}),t.jsxs("svg",{viewBox:"0 0 300 260",className:"w-full max-w-xs mx-auto",children:[t.jsx("defs",{children:t.jsxs("filter",{id:"eco-glow",x:"-50%",y:"-50%",width:"200%",height:"200%",children:[t.jsx("feGaussianBlur",{stdDeviation:"3",result:"blur"}),t.jsx("feComposite",{in:"SourceGraphic",in2:"blur",operator:"over"})]})}),t.jsx("circle",{cx:i,cy:130,r:90,fill:"none",stroke:"#1f2937",strokeWidth:"1",strokeDasharray:"4 4"}),l.map((e,n)=>{const s=(n/l.length*Math.PI*2-Math.PI/2+((n+1)/l.length*Math.PI*2-Math.PI/2))/2,o=i+92*Math.cos(s),c=130+92*Math.sin(s),d=a&&r%l.length===n;return t.jsx("circle",{cx:o,cy:c,r:d?3:1.5,fill:d?e.color:"#374151",opacity:d?1:.3,filter:d?"url(#eco-glow)":void 0},`flow-${n}`)}),l.map((e,n)=>{const s=n/l.length*Math.PI*2-Math.PI/2,o=i+90*Math.cos(s),c=130+90*Math.sin(s),d=a&&r%l.length===n;return t.jsxs("g",{children:[d&&t.jsx("circle",{cx:o,cy:c,r:"20",fill:e.color,opacity:"0.1",filter:"url
1(#eco-glow)",children:t.jsx("animate",{attributeName:"r",values:"18;24;18",dur:"1s",repeatCount:"indefinite"})}),t.jsx("circle",{cx:o,cy:c,r:"14",fill:"#0a0a0a",stroke:d?e.color:"#374151",strokeWidth:d?2:1}),t.jsx("text",{x:o,y:c+3,textAnchor:"middle",fontSize:"10",children:e.icon}),t.jsx("text",{x:o,y:c+28,textAnchor:"middle",fontSize:"7",fill:d?e.color:"#6b7280",fontWeight:"bold",letterSpacing:"0.05em",children:e.label}),t.jsx("text",{x:o,y:c+37,textAnchor:"middle",fontSize:"5.5",fill:"#4b5563",children:e.agents})]},e.label)}),t.jsx("text",{x:i,y:122,textAnchor:"middle",fontSize:"8",fill:"#8b5cf6",fontWeight:"bold",letterSpacing:"0.15em",children:"OmniFINDS"}),t.jsx("text",{x:i,y:134,textAnchor:"middle",fontSize:"6",fill:"#6b7280",letterSpacing:"0.1em",children:"ECOSYSTEM"}),t.jsx("text",{x:i,y:144,textAnchor:"middle",fontSize:"5",fill:"#4b5563",children:"15 AGENTS"})]})]})}function le({data:e,title:a,icon:r,color:n="violet"}){const l=Math.max(1,...e.map(e=>e.value));return t.jsxs("div",{className:"bg-gray-950/60 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/40 rounded-2xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r&&t.jsx(r,{size:14,className:`text-${n}-400`}),t.jsx("span",{className:"text-xs font-black text-gray-300 uppercase tracking-wider",children:a})]}),t.jsx("div",{className:"space-y-2",children:e.map((e,a)=>t.jsxs("div",{className:"scroll-reveal-item flex items-center gap-2",style:{animationDelay:60*a+"ms"},children:[t.jsx("span",{className:"text-[9px] text-gray-500 w-16 truncate text-right",children:e.label}),t.jsxs("div",{className:"flex-1 h-4 bg-gray-900/50 rounded-full overflow-hidden relative",children:[t.jsx("div",{className:`h-full rounded-full bg-gradient-to-r from-${n}-600 to-${n}-400 transition-all duration-700`,style:{width:e.value/l*100+"%"}}),t.jsx("div",{className:`absolute inset-y-0 left-0 rounded-full bg-${n}-400/20 blur-sm transition-all duration-700`,style:{width:e.value/l*100+"%"}})]}),t.jsx("span",{className:`text-[10px] font-bold text-${n}-400 w-8 text-right`,children:e.value}),e.highlight&&t.jsx(m,{size:10,className:"text-amber-400"})]},e.label))})]})}function ie({run:a}){const[r,n]=e.useState(!1);if(!a||"completed"!==a.status)return null;const s=a.steps||[],o=s.reduce((e,t)=>e+(t.result?.length||0),0),c=s.length>0?s.reduce((e,t)=>e+(t.elapsed||0),0)/s.length:0,d=s.reduce((e,t)=>t.elapsed&&t.elapsed<(e?.elapsed||1/0)?t:e,null),u=s.reduce((e,t)=>t.elapsed&&t.elapsed>(e?.elapsed||0)?t:e,null);return t.jsxs("div",{className:"bg-gray-950/60 border border-cyan-500/10 rounded-2xl overflow-hidden",children:[t.jsxs("button",{onClick:()=>n(!r),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-900/50 transition-colors",children:[t.jsx(S,{size:14,className:"text-cyan-400"}),t.jsx("span",{className:"text-xs font-black text-gray-300 uppercase tracking-wider flex-1 text-left",children:"Pipeline Intelligence Deep Dive"}),r?t.jsx(l,{size:14,className:"text-gray-600"}):t.jsx(i,{size:14,className:"text-gray-600"})]}),r&&t.jsxs("div",{className:"px-4 pb-4 space-y-4",children:[t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[{label:"Total Output",value:o.toLocaleString(),sub:"characters",color:"cyan"},{label:"Avg Step Time",value:`${(c/1e3).toFixed(1)}s`,sub:"per agent",color:"violet"},{label:"Fastest Agent",value:ee[d?.agentId]?.name||"--",sub:d?`${(d.elapsed/1e3).toFixed(1)}s`:"",color:"green"},{label:"Slowest Agent",value:ee[u?.agentId]?.name||"--",sub:u?`${(u.elapsed/1e3).toFixed(1)}s`:"",color:"amber"}].map(e=>t.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/30 rounded-xl px-3 py-2",children:[t.jsx("div",{className:"text-[9px] text-gray-600 uppercase tracking-wider",children:e.label}),t.jsx("div",{className:`text-sm font-black text-${e.color}-400`,children:e.value}),t.jsx("div",{className:"text-[9px] text-gray-600",children:e.sub})]},e.label))}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-2",children:"Execution Timeline"}),t.jsx("div",{className:"space-y-1",children:s.map((e,r)=>{const n=ee[e.agentId],l=a.totalElapsed>0?(e.elapsed||0)/a.totalElapsed*100:0,i=te[e.agentId]||"#6b7280";return t.jsxs("div",{className:"scroll-reveal-item flex items-center gap-2",style:{animationDelay:60*r+"ms"},children:[t.jsx("span",{className:"text-[8px] text-gray-600 w-14 text-right truncate",children:n?.name}),t.jsx("div",{className:"flex-1 h-3 bg-gray-900/50 rounded-full overflow-hidden relative",children:t.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.max(l,2)}%`,background:i,boxShadow:`0 0 8px ${i}30`}})}),t.jsx("span",{className:"text-[8px] text-gray-600 w-10 text-right",children:e.elapsed?`${(e.elapsed/1e3).toFixed(1)}s`:"--"})]},r)})})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-2",children:"Output Volume"}),t.jsx("div",{className:"flex items-end gap-1 h-20",children:s.map((e,a)=>{const r=e.result?.length||0,n=r/Math.max(1,...s.map(e=>e.result?.length||0))*100,l=te[e.agentId]||"#6b7280";return t.jsxs("div",{className:"flex-1 flex flex-col items-center gap-0.5 group relative",children:[t.jsx("div",{className:"w-full rounded-t transition-all duration-500 min-h-[2px]",style:{height:`${n}%`,background:l,boxShadow:`0 0 6px ${l}20`}}),t.jsx("span",{className:"text-[7px] text-gray-600 truncate w-full text-center",children:ee[e.agentId]?.name}),t.jsx("div",{className:"absolute -top-8 left-1/2 -translate-x-1/2 bg-gray-900 border border-gray-700 rounded px-1.5 py-0.5 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50",children:t.jsxs("span",{className:"text-[9px] text-gray-300",children:[r.toLocaleStr
1ing()," chars"]})})]},a)})})]})]})]})}const se=[{id:"first_blood",name:"First Blood",desc:"Run your first pipeline",icon:s,color:"#8b5cf6",check:e=>e.length>=1,tier:"bronze"},{id:"hat_trick",name:"Hat Trick",desc:"3 successful runs",icon:g,color:"#f59e0b",check:e=>e.filter(e=>"completed"===e.status).length>=3,tier:"bronze"},{id:"perfect_10",name:"Perfect 10",desc:"10 successful runs",icon:m,color:"#ec4899",check:e=>e.filter(e=>"completed"===e.status).length>=10,tier:"silver"},{id:"explorer",name:"Explorer",desc:"Run 5 different pipelines",icon:c,color:"#06b6d4",check:e=>new Set(e.map(e=>e.templateId)).size>=5,tier:"silver"},{id:"completionist",name:"Completionist",desc:"Run all 10 pipeline types",icon:$,color:"#10b981",check:e=>new Set(e.map(e=>e.templateId)).size>=10,tier:"gold"},{id:"speed_demon",name:"Speed Demon",desc:"Complete a pipeline under 30s",icon:d,color:"#f43f5e",check:e=>e.some(e=>"completed"===e.status&&e.totalElapsed<3e4),tier:"silver"},{id:"iron_streak",name:"Iron Streak",desc:"5 successes in a row",icon:z,color:"#f97316",check:e=>{let t=0;for(const a of e)if("completed"===a.status){if(t++,t>=5)return!0}else t=0;return!1},tier:"gold"},{id:"data_giant",name:"Data Giant",desc:"Generate 50K+ chars in one run",icon:I,color:"#a855f7",check:e=>e.some(e=>e.steps?.reduce((e,t)=>e+(t.result?.length||0),0)>5e4),tier:"gold"}],oe={bronze:"#cd7f32",silver:"#c0c0c0",gold:"#ffd700"};function ce({history:a}){const[r,n]=e.useState(!1),s=e.useMemo(()=>se.map(e=>({...e,unlocked:e.check(a)})),[a]),o=s.filter(e=>e.unlocked).length,c=s.filter(e=>e.unlocked).reduce((e,t)=>e+("gold"===t.tier?300:"silver"===t.tier?150:50),0),d=Math.floor(c/200)+1,u=c%200;return t.jsxs("div",{className:"bg-gray-950/60 border border-amber-500/10 rounded-2xl overflow-hidden",children:[t.jsxs("button",{onClick:()=>n(!r),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-900/50 transition-colors",children:[t.jsx(g,{size:14,className:"text-amber-400"}),t.jsxs("span",{className:"text-xs font-black text-gray-300 uppercase tracking-wider flex-1 text-left",children:["Achievements ",o,"/",se.length]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-[10px] font-bold text-amber-400",children:["Lv.",d]}),t.jsxs("span",{className:"text-[10px] text-gray-600",children:[c," XP"]})]}),r?t.jsx(l,{size:14,className:"text-gray-600"}):t.jsx(i,{size:14,className:"text-gray-600"})]}),t.jsx("div",{className:"px-4 pb-1",children:t.jsx("div",{className:"h-1 bg-gray-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-gradient-to-r from-amber-500 to-yellow-400 rounded-full transition-all duration-700",style:{width:u/200*100+"%",boxShadow:"0 0 8px rgba(245,158,11,0.3)"}})})}),r&&t.jsx("div",{className:"px-4 pb-4 pt-2 grid grid-cols-2 sm:grid-cols-4 gap-2",children:s.map(e=>{const a=e.icon;return t.jsxs("div",{className:"relative rounded-xl border px-3 py-2.5 text-center transition-all "+(e.unlocked?"border-amber-500/30 bg-amber-500/5":"border-gray-800/30 bg-gray-900/30 opacity-40"),style:e.unlocked?{boxShadow:`0 0 16px ${oe[e.tier]}15`}:{},children:[t.jsx(a,{size:18,className:"mx-auto mb-1",style:{color:e.unlocked?e.color:"#374151"}}),t.jsx("div",{className:"text-[10px] font-bold",style:{color:e.unlocked?e.color:"#4b5563"},children:e.name}),t.jsx("div",{className:"text-[8px] text-gray-600 mt-0.5",children:e.desc}),e.unlocked&&t.jsx("div",{className:"absolute -top-1 -right-1 w-4 h-4 rounded-full flex items-center justify-center text-[7px] font-black text-white",style:{background:oe[e.tier]},children:"gold"===e.tier?"G":"silver"===e.tier?"S":"B"})]},e.id)})})]})}function de({history:a}){const[r,n]=e.useState(null),l=e.useMemo(()=>{const e={};return a.filter(e=>"completed"===e.status&&e.steps?.length>1).forEach(t=>{const a=t.steps||[];for(let r=0;r<a.length-1;r++){const t=`${a[r].agentId}\u2192${a[r+1].agentId}`;e[t]||(e[t]={from:a[r].agentId,to:a[r+1].agentId,count:0,avgHandoff:0,totalChars:0}),e[t].count++,e[t].totalChars+=a[r+1].result?.length||0}}),Object.values(e).sort((e,t)=>t.count-e.count).slice(0,8)},[a]);if(0===l.length)return null;const i=Math.max(1,...l.map(e=>e.count));return t.jsxs("div",{className:"bg-gray-950/60 border border-emerald-500/10 rounded-2xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx(A,{size:14,className:"text-emerald-400"}),t.jsx("span",{className:"text-xs font-black text-gray-300 uppercase tracking-wider",children:"Agent Synergy Bonds"})]}),t.jsx("div",{className:"space-y-1.5",children:l.map((e,a)=>{const l=ee[e.from],s=ee[e.to],o=te[e.from]||"#6b7280",c=te[e.to]||"#6b7280",d=e.count/i,u=r===a;return t.jsxs("div",{className:"flex items-center gap-2 group cursor-pointer",onMouseEnter:()=>n(a),onMouseLeave:()=>n(null),children:[t.jsxs("div",{className:"flex items-center gap-1.5 w-20",children:[t.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[7px] font-black text-white",style:{background:o},children:l?.name?.charAt(0)}),t.jsx("span",{className:"text-[9px] font-bold truncate",style:{color:o},children:l?.name})]}),t.jsxs("div",{className:"flex-1 relative h-4 flex items-center",children:[t.jsx("div",{className:"absolute inset-0 flex items-center",children:t.jsx("div",{className:"h-0.5 flex-1 rounded-full transition-all duration-300",style:{background:`linear-gradient(to right, ${o}, ${c})`,opacity:.2+.8*d,boxShadow:u?`0 0 8px ${o}40`:"none"}})}
1),t.jsx(M,{size:10,className:"absolute left-1/2 -translate-x-1/2 transition-colors",style:{color:u?c:"#374151"}}),u&&t.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 -top-5 bg-gray-900 border border-gray-700 rounded px-1.5 py-0.5 z-50 whitespace-nowrap",children:t.jsxs("span",{className:"text-[9px] text-gray-300",children:[e.count,"x handoffs, ",e.totalChars.toLocaleString()," chars produced"]})})]}),t.jsxs("div",{className:"flex items-center gap-1.5 w-20 justify-end",children:[t.jsx("span",{className:"text-[9px] font-bold truncate",style:{color:c},children:s?.name}),t.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[7px] font-black text-white",style:{background:c},children:s?.name?.charAt(0)})]}),t.jsxs("span",{className:"text-[9px] font-bold w-6 text-right",style:{color:d>.6?"#10b981":"#6b7280"},children:[e.count,"x"]})]},a)})})]})}const ue=[{condition:e=>e?.steps?.every(e=>"completed"===e.status),messages:["All agents delivered. Your pipeline runs like a well-oiled machine.","Perfect execution. The collective intelligence is firing on all cylinders.","Flawless run. Your agent team just set a new standard.","Complete success. The OmniFINDS Entity grows stronger with each run."]},{condition:e=>e?.totalElapsed<2e4,messages:["Lightning fast. Your agents are in peak synchronization.","Sub-20s execution. Speed meets intelligence."]},{condition:e=>e?.steps?.some(e=>e.result?.length>1e4),messages:["Deep output detected. Your agents went beyond surface-level analysis.","Rich intelligence generated. Quality over quantity achieved."]},{condition:e=>e?.steps?.length>=5,messages:["Complex pipeline mastered. Multi-agent orchestration at its finest.","A 5+ agent chain completed. True collaborative AI at work."]},{condition:()=>!0,messages:["Pipeline complete. Every run makes the system smarter.","Data processed. The Entity absorbs all learnings.","Execution logged. Your pipeline history grows stronger."]}];function pe({run:a}){const r=e.useMemo(()=>{if(!a||"completed"!==a.status)return null;for(const e of ue)if(e.condition(a))return e.messages[Math.floor(Math.random()*e.messages.length)];return null},[a?.id]);return r?t.jsxs("div",{className:"relative bg-gradient-to-r from-violet-950/40 via-gray-950/80 to-cyan-950/40 border border-violet-500/15 rounded-2xl px-5 py-3 overflow-hidden",children:[t.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-violet-500/3 via-transparent to-cyan-500/3"}),t.jsxs("div",{className:"relative flex items-center gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-violet-600 to-cyan-600 flex items-center justify-center flex-shrink-0",style:{boxShadow:"0 0 20px rgba(139,92,246,0.2)"},children:t.jsx(S,{size:16,className:"text-white"})}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[9px] text-violet-400/60 uppercase tracking-[0.2em] font-bold mb-0.5",children:"Entity Insight"}),t.jsxs("p",{className:"text-xs text-gray-300 italic leading-relaxed",children:["\u201c",r,"\u201d"]})]})]})]}):null}const me={nexus:["Coordinating team assignments...","Optimizing agent routing...","Syncing pipeline orchestration..."],forge:["Compiling analysis framework...","Running deep data evaluation...","Building structured insights..."],muse:["Crafting creative approach...","Generating fresh perspectives...","Designing innovative solutions..."],mercury:["Scanning market signals...","Gathering competitive data...","Tracking trend vectors..."],apollo:["Structuring brand narrative...","Polishing content delivery...","Aligning messaging strategy..."],vault:["Calculating revenue models...","Optimizing pricing matrices...","Forecasting growth curves..."],oracle:["Mining strategic patterns...","Connecting data threads...","Surfacing hidden insights..."],guardian:["Running security scans...","Auditing threat vectors...","Hardening defense layers..."],dispatch:["Scheduling task sequences...","Routing workflow nodes...","Automating delivery chain..."],architect:["Designing system blueprint...","Mapping infrastructure...","Planning scalable architecture..."],context:["Loading context memory...","Connecting historical data...","Building knowledge graph..."],reinvest:["Analyzing ROI channels...","Mapping reinvestment paths...","Optimizing capital flow..."],evolve:["Scanning upgrade vectors...","Planning system evolution...","Designing growth trajectory..."],sentinel:["Monitoring system health...","Checking anomaly patterns...","Verifying integrity checks..."],themer:["Styling interface elements...","Harmonizing visual language...","Refining UX patterns..."]};function ge({activeRun:a,executing:r}){const[n,l]=e.useState([]),i=e.useRef(null);return e.useEffect(()=>{if(!r||!a?.steps)return l([]),void(i.current&&clearInterval(i.current));const e=()=>{const e=a.steps.filter(e=>"running"===e.status);if(0===e.length)return;const t=e[Math.floor(Math.random()*e.length)],r=me[t.agentId]||["Processing..."],n=r[Math.floor(Math.random()*r.length)];l(e=>[{id:Date.now(),agentId:t.agentId,msg:n,ts:Date.now()},...e].slice(0,5))};return e(),i.current=setInterval(e,2500),()=>{i.current&&clearInterval(i.current)}},[r,a?.steps?.map(e=>e.status).join(",")]),r&&0!==n.length?t.jsxs("div",{className:"bg-gray-950/40 border border-violet-500/10 rounded-xl px-4 py-2.5",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(b,{size:12,className:"text-violet-400 animate-pulse"}),t.jsx("span",{className:"text-[9px] font-black text-gray-500 uppercase tracking-[0.15em]",children:"Agent Whispers \u2014 Live"})]}),t.jsx("div",{className:"space-y-1",children:n.map((e,a)=>{const r=te[e.agentId]||"#6b7280",n=(Date.now()-e.ts)/1e3;return t.jsxs("div",{className:"scroll-reveal-item flex items-center gap-2 transition-opacity",style:{opacity:Math.max(.3,1-.15*a)},children:[t.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-[6px] font-black text-white",style:{background:r},children:ee[e.agentId]?.name?.charAt(0)}),t.jsx("span",{className:"text-[10px]",style:{color:r},children:ee[e.agentId]?.name}),t.jsx("span",{className:"text-[10px] text-gray-500 flex-1",children:e.msg}),t.jsxs("span",{className:"text-[8px] text-gray-700",children:[n.toFixed(0),"s ago"]})]},e.id)})})]}):null}const he=[{from:"competitive_intel",to:"market_to_launch",name:"Intel \u2192 Launch",desc:"Research your competition, then launch against their weaknesses",bonus:"+40% market fit"},{from:"market_to_launch",to:"content_engine",name:"Launch \u2192 Content",desc:"After launch, flood the market with targeted content",bonus:"+35% reach"},{from:"content_engine",to:"customer_acquisition",name:"Content \u2192 Acquire",desc:"Convert content consumers into paying customers",bonus:"+50% conversion"},{from:"customer_acquisition",to:"revenue_optimization",name:"Acquire \u2192 Optimize",desc:"Once customers arrive, maximize their lifetime value",bonus:"+60% LTV"},{from:"full_audit",to:"security_hardening",name:"Audit \u2192 Harden",desc:"Find vulnerabilities, then seal every gap",bonus:"+90% security"},{from:"brand_authority",to:"competitive_intel",name:"Brand \u2192 Intel",desc:"Establish authority, then study what competitors do differently",bonus:"+25% positioning"},{from:"security_hardening",to:"system_evolution",name:"Secure \u2192 Evolve",desc:"Lock down the system, then evolve with confidence",bonus:"+45% stability"},{from:"system_evolution",to:"dispatch_workflow",name:"Evolve \u2192 Automate",desc:"Upgrade the system, then automate the improved workflows",bonus:"+55% efficie
1ncy"}];function xe({history:a,onRun:r}){const[n,l]=e.useState(!1),i=e.useMemo(()=>{if(0===a.length)return[];const e=a[0];return"completed"!==e?.status?[]:he.filter(t=>t.from===e.templateId)},[a]);if(0===i.length)return null;const s=n?i:i.slice(0,2);return t.jsxs("div",{className:"bg-gray-950/60 border border-pink-500/10 rounded-2xl p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx(z,{size:14,className:"text-pink-400"}),t.jsx("span",{className:"text-xs font-black text-gray-300 uppercase tracking-wider",children:"Combo Chains Available"}),t.jsx("span",{className:"text-[9px] text-pink-400/60 font-bold ml-auto",children:"Chain pipelines for bonus effect"})]}),t.jsx("div",{className:"space-y-2",children:s.map((e,a)=>t.jsxs("div",{className:"scroll-reveal-item flex items-center gap-3 px-3 py-2.5 rounded-xl bg-pink-500/5 border border-pink-500/15 hover:border-pink-500/30 transition-all group cursor-pointer",style:{animationDelay:60*a+"ms"},onClick:()=>r(e.to),children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs font-bold text-pink-300",children:e.name}),t.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-green-500/10 text-green-400 font-bold",children:e.bonus})]}),t.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:e.desc})]}),t.jsx(x,{size:14,className:"text-pink-400 opacity-0 group-hover:opacity-100 transition-opacity"})]},a))}),i.length>2&&t.jsx("button",{onClick:()=>l(!n),className:"text-[10px] text-pink-400/50 hover:text-pink-400 mt-2 transition-colors",children:n?"Show less":`+${i.length-2} more combos`})]})}function be({run:a}){const[r,n]=e.useState(0);if(e.useEffect(()=>{if(!a)return;const e=setInterval(()=>n(e=>e+1),100);return()=>clearInterval(e)},[a]),!a?.steps||a.steps.length<2)return null;const l=a.steps;return t.jsxs("div",{className:"bg-gray-950/40 border border-violet-500/10 rounded-xl px-4 py-3",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(f,{size:12,className:"text-violet-400"}),t.jsx("span",{className:"text-[9px] font-black text-gray-500 uppercase tracking-[0.15em]",children:"Pipeline DNA Signature"})]}),t.jsxs("svg",{viewBox:"0 0 300 60",className:"w-full",style:{height:"50px"},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"dna-grad",x1:"0",y1:"0",x2:"1",y2:"0",children:[t.jsx("stop",{offset:"0%",stopColor:"#8b5cf6",stopOpacity:"0.6"}),t.jsx("stop",{offset:"50%",stopColor:"#06b6d4",stopOpacity:"0.8"}),t.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.6"})]})}),[0,1].map(e=>t.jsx("path",{d:l.map((t,a)=>{const n=a/(l.length-1)*260+20,i=.1*r+e*Math.PI;return`${0===a?"M":"L"} ${n} ${30+18*Math.sin(a/l.length*Math.PI*2+i)}`}).join(" "),fill:"none",stroke:"url(#dna-grad)",strokeWidth:"1.5",opacity:.6+.2*e},e)),l.map((e,a)=>{const n=a/(l.length-1)*260+20,i=.1*r,s=.1*r+Math.PI,o=30+18*Math.sin(a/l.length*Math.PI*2+i),c=30+18*Math.sin(a/l.length*Math.PI*2+s),d=te[e.agentId]||"#6b7280",u="running"===e.status,p="completed"===e.status;return t.jsxs("g",{children:[t.jsx("line",{x1:n,y1:o,x2:n,y2:c,stroke:d,strokeWidth:p?1.5:.5,opacity:p?.7:.3}),t.jsx("circle",{cx:n,cy:o,r:p?4:u?5:3,fill:d,opacity:p?.9:u?1:.3,children:u&&t.jsx("animate",{attributeName:"r",values:"3;6;3",dur:"1s",repeatCount:"indefinite"})}),t.jsx("circle",{cx:n,cy:c,r:p?4:u?5:3,fill:d,opacity:p?.9:u?1:.3,children:u&&t.jsx("animate",{attributeName:"r",values:"3;6;3",dur:"1s",repeatCount:"indefinite",begin:"0.5s"})}),u&&t.jsxs("circle",{cx:n,cy:o,r:"8",fill:d,opacity:"0.15",children:[t.jsx("animate",{attributeName:"r",values:"5;12;5",dur:"1.5s",repeatCount:"indefinite"}),t.jsx("animate",{attributeName:"opacity",values:"0.2;0;0.2",dur:"1.5s",repeatCount:"indefinite"})]})]},a)})]})]})}const fe="omnifinds_custom_pipelines";function ye({onExecute:a,executing:r}){const[n,l]=e.useState(!1),[i,s]=e.useState([]),[o,c]=e.useState(""),[d,u]=e.useState(()=>{try{return JSON.parse(localStorage.getItem(fe)||"[]")}catch{return[]}}),[p,m]=e.useState(null),[g,h]=e.useState(""),b=e.useRef(null),f=e.useRef(null),y=e.useCallback(e=>{i.length>=8||s(t=>[...t,{agentId:e,instruction:"",name:""}])},[i.length]),v=e.useCallback(e=>{s(t=>t.filter((t,a)=>a!==e)),p===e&&m(null)},[p]),N=()=>
1{if(null===b.current||null===f.current)return;const e=[...i],t=e[b.current];e.splice(b.current,1),e.splice(f.current,0,t),s(e),b.current=null,f.current=null},w=e.useCallback(()=>{null!==p&&(s(e=>e.map((e,t)=>t===p?{...e,instruction:g}:e)),m(null),h(""))},[p,g]),k=e.useCallback(()=>{if(i.length<2||!o.trim())return;const e=[{id:`saved_${Date.now()}`,name:o,chain:[...i],createdAt:Date.now()},...d].slice(0,10);u(e);try{localStorage.setItem(fe,JSON.stringify(e))}catch{}},[i,o,d]),C=e.useCallback(e=>{s([...e.chain]),c(e.name)},[]),S=e.useCallback(e=>{const t=d.filter(t=>t.id!==e);u(t);try{localStorage.setItem(fe,JSON.stringify(t))}catch{}},[d]),z=e.useCallback(()=>{if(i.length<2||r)return;const e=i.map(e=>({agentId:e.agentId,name:e.name||`${ee[e.agentId]?.name||e.agentId}`,instruction:e.instruction}));a(e,{},{name:o||`Custom (${i.length} agents)`})},[i,r,a,o]),A=Q;return n?t.jsxs("div",{className:"bg-gray-950/80 border border-violet-500/20 rounded-2xl overflow-hidden",style:{boxShadow:"0 0 40px rgba(139,92,246,0.06)"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-violet-500/10 bg-violet-500/5",children:[t.jsx(_,{size:16,className:"text-violet-400"}),t.jsx("span",{className:"text-xs font-black text-white uppercase tracking-wider flex-1",children:"Custom Pipeline Builder"}),t.jsxs("span",{className:"text-[9px] text-gray-500",children:[i.length,"/8 agents"]}),t.jsx("button",{onClick:()=>l(!1),className:"text-gray-600 hover:text-white transition-colors",children:t.jsx(D,{size:14})})]}),t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsx("input",{type:"text",value:o,onChange:e=>c(e.target.value),placeholder:"Pipeline name (e.g., My Revenue Chain)",className:"w-full px-3 py-2 bg-gray-900 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300 rounded-lg text-sm text-white placeholder-gray-600 focus:border-violet-500/50 focus:outline-none"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-wider mb-2",children:"Click to add agent"}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:A.map(e=>{const a=te[e.id]||"#6b7280",r=i.filter(t=>t.agentId===e.id).length;return t.jsxs("button",{onClick:()=>y(e.id),disabled:i.length>=8,className:"flex items-center gap-1.5 px-2 py-1 rounded-lg border transition-all hover:scale-105 disabled:opacity-30 disabled:cursor-not-allowed",style:{borderColor:`${a}30`,background:`${a}08`},children:[t.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-[7px] font-black text-white",style:{background:a},children:e.name.charAt(0)}),t.jsx("span",{className:"text-[10px] font-bold",style:{color:a},children:e.name}),r>0&&t.jsx("span",{className:"text-[8px] px-1 rounded-full bg-white/10 text-white font-bold",children:r})]},e.id)})})]}),i.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-wider mb-2",children:"Agent Chain \u2014 drag to reorder"}),t.jsx("div",{className:"space-y-1.5",children:i.map((e,a)=>{const r=ee[e.agentId],n=te[e.agentId]||"#6b7280";return t.jsxs("div",{draggable:!0,onDragStart:()=>{return e=a,void(b.current=e);var e},onDragEnter:()=>{return e=a,void(f.current=e);var e},onDragEnd:N,onDragOver:e=>e.preventDefault(),className:"flex items-center gap-2 px-3 py-2 rounded-xl border cursor-grab active:cursor-grabbing transition-all hover:border-opacity-60",style:{borderColor:`${n}25`,background:`${n}06`},children:[t.jsx(O,{size:12,className:"text-gray-700 flex-shrink-0"}),t.jsx("span",{className:"text-xs font-black w-5 text-center",style:{color:n},children:a+1}),t.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-[8px] font-black text-white flex-shrink-0",style:{background:n},children:r?.name?.charAt(0)}),t.jsx("span",{className:"text-xs font-bold flex-shrink-0",style:{color:n},children:r?.name}),t.jsx("span",{className:"text-[10px] text-gray-600 flex-1 truncate",children:e.instruction||r?.role}),a>0&&t.jsxs("div",{className:"text-[8px] text-gray-700 flex-shrink-0",children:["receives from ",ee[i[a-1].agentId]?.name]}),t.jsx("button",{onClick:()=>{m(a),h(e.instruction)},className:"p-1 text-gray-600 hover:text-violet-400 transition-colors flex-shrink-0",children:t.jsx(E,{size:11})}),t.jsx("button",{onClick:()=>v(a),className:"p-1 text-gray-600 hover:text-red-400 transition-colors flex-shrink-0",children:t.jsx(D,{size:11})})]},a)})})]}),null!==p&&t.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300 rounded-xl p-3",children:[t.jsxs("div",{className:"text-[10px] text-gray-400 mb-1.5 font-semibold",children:["Custom instruction for Step ",p+1,": ",ee[i[p]?.agentId]?.name]}),t.jsx("textarea",{value:g,onChange:e=>h(e.target.value),placeholder:"e.g., Focus on competitor pricing analysis for SaaS products...",rows:2,className:"w-full px-3 py-2 bg-gray-950 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300 rounded-lg text-xs text-white placeholder-gray-600 focus:border-violet-500/50 focus:outline-none resize-none"}),t.jsxs("div",{className:"flex gap-2 mt-2",children:[t.jsx("button",{onClick:w,className:"px-3 py-1 bg-violet-500/20 text-violet-300 text-[10px] font-bold rounded-lg hover:bg-violet-500/30",children:"Save"}),t.jsx("button",{onClick:()=>m(null),className:"px-3 py-1 bg-gray-800 text-gray-500 text-[10px] rounded-lg hover:bg-gray-700",children:"Cancel"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:z,disabled:i.length<2||r,className:"flex-1 py-2.5 bg-gradient-to-r from-violet-600 to-cyan-600 text-white text-xs font-bold rounded-xl hover:from-violet-500 hover:to-cyan-500 transition-all flex items-center justify-center gap-2 disabled:opacity-30 disabled:cursor-not-allowed",style:{boxShadow:i.length>=2?"0 0 20px rgba(139,92,246,0.2)":"none"},children:[t.jsx(x,{size:14})," Execute Chain (",i.length," agents)"]}),t.jsxs("button",{onClick:k,disabled:i.length<2||!o.trim(),className:"px-3 py-2.5 bg-gray-800 text-gray-400 text-xs rounded-xl hover:bg-gray-700 hover:text-white transition-all disabled:opacity-30 disabled:cursor-not-allowed flex items-center gap-1.5",children:[t.jsx(j,{size:12})," Save"]}),t.jsxs("button",{onClick:()=>{s([]),c("")},className:"px-3 py-2.5 bg-gray-800 text-gray-400 text-xs rounded-xl hover:bg-gray-700 hover:text-white transition-all flex items-center gap-1.5",children:[t.jsx(T,{size:12})," Clear"]})]}),d.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"text-[9px] text-gray-500 uppercase tracking-wider mb-2",children:"Saved Pipelines"}),t.jsx("div",{className:"space-y-1",children:d.map(e=>t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-900/40 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/30 hover:border-violet-500/20 transition-all",children:[t.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[e.chain.slice(0,5).map((e,a)=>t.jsx("div",{className:"scroll-reveal-item w-4 h-4 rounded-full flex items-center justify-center text-[6px] font-black text-white",style:{animationDelay:60*a+"ms",background:te[e.agentId]||"#6b7280",marginLeft:a>0?"-4px":"0"},children:ee[e.agentId]?.name?.charAt(0)},a)),e.chain.length>5&&t.jsxs("span",{className:"text-[8px] text-gray-600 ml-1",children:["+",e.chain.length-5]})]}),t.jsx("span",{className:"text-xs font-semibold text-white flex-1 truncate",children:e.name}),t.jsxs("span",{className:"text-[9px] text-gray-600",children:[e.chain.length," agents"]}),t.jsx("button",{onClick:()=>C(e),className:"text-[10px] text-violet-400 hover:text-violet-300 font-semibold",children:"Load"}),t.jsx("button",{onClick:()=>S(e.id),className:"text-gray-700 hover:text-red-400",children:t.jsx(D,{size:10})})]},e.id))})]})]})]}):t.jsxs("button",{onClick:()=>l(!0),className:"w-full flex items-center gap-3 px-4 py-3 rounded-2xl border border-dashed border-violet-500/20 bg-gray-950/40 hover:border-violet-500/40 hover:bg-violet-500/5 transition-all group",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-violet-500/10 flex items-center justify-center group-hover:bg-violet-500/20 transition-colors",children:t.jsx(R,{size:16,className:"text-violet-400"})}),t.jsxs("div",{className:"text-left",children:[t.jsx("div",{className:"text-xs font-bold text-violet-300",children:"Build Custom Pipeline"}),t.jsx("div",{className:"text-[10px] text-gray-600",children:"Drag agents to create your own chain"})]}),t.jsx(_,{size:14,className:"text-violet-400/40 ml-auto group-hover:text-violet-400 transition-colors"})]})}function ve({agentId:e,status:a,isActive:r,index:n}){const l=ee[e];if(!l)return null;const i=te[e]||"#6b7280";return t.jsxs("div",{className:"flex flex-col items-center gap-1 group relative",children:[t.jsxs("div",{className:`relative w-10 h-10 rounded-full bg-gradient-to-br ${l.color} flex items-center justify-center transition-all duration-500 ${r?"scale-110":""}`,style:{boxShadow:r?`0 0 20px ${i}60, 0 0 40px ${i}20`:"completed"===a?`0 0 10px ${i}30`:"none",border:"running"===a?`2px solid ${i}`:"completed"===a?"2px solid #10b981":"1px solid #374151"},children:[t.jsx("span",{className:"text-[10px] font-black text-white",children:n+1}),r&&t.jsx("div",{className:"absolute inset-0 rounded-full animate-ping opacity-20",style:{background:i}}),"completed"===a&&t.jsx("div",{className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-green-500 flex items-center justify-center shadow-lg shadow-green-500/30",children:t.jsx(u,{size:10,
1className:"text-white"})}),"failed"===a&&t.jsx("div",{className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-red-500 flex items-center justify-center shadow-lg shadow-red-500/30",children:t.jsx(N,{size:10,className:"text-white"})})]}),t.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider",style:{color:i},children:l.name}),t.jsx("div",{className:"absolute -top-12 left-1/2 -translate-x-1/2 bg-gray-900 border border-gray-700 rounded-lg px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-50",children:t.jsx("span",{className:"text-[10px] text-gray-300",children:l.role})})]})}function Ne({active:e}){return t.jsxs("div",{className:"relative flex items-center justify-center w-8",children:[t.jsx("div",{className:"w-6 h-px "+(e?"bg-gradient-to-r from-violet-500 to-cyan-500":"bg-gray-800")}),e&&t.jsx("div",{className:"absolute w-2 h-2 rounded-full bg-violet-400 animate-ping opacity-60"}),t.jsx(M,{size:10,className:"absolute "+(e?"text-violet-400":"text-gray-700")})]})}function we({steps:e,runSteps:a,executing:r}){return t.jsx("div",{className:"flex items-center justify-center gap-0 flex-wrap py-3",children:e.map((e,r)=>{const n=a?.[r],l=n?.status||"pending";return t.jsxs(React.Fragment,{children:[r>0&&t.jsx(Ne,{active:"running"===l||"completed"===a?.[r-1]?.status&&"running"===l}),t.jsx(ve,{agentId:e.agentId,status:l,isActive:"running"===l,index:r})]},e.id)})})}function ke({template:e,onRun:r,isRunning:n,expanded:s,onToggle:o}){const c=Z[e.icon]||a,d=J[e.category]||{};return t.jsxs("div",{className:"bg-gray-900/60 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/60 rounded-2xl overflow-hidden transition-all duration-300 hover:border-violet-500/20 hover:shadow-lg hover:shadow-violet-500/5 "+(s?"col-span-full":""),children:[t.jsxs("div",{className:"p-4 cursor-pointer flex items-start gap-3",onClick:o,children:[t.jsx("div",{className:`w-10 h-10 rounded-xl ${d.bg||"bg-gray-800"} flex items-center justify-center flex-shrink-0`,children:t.jsx(c,{size:20,className:d.color||"text-gray-400"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h3",{className:"text-sm font-bold text-white truncate",children:e.name}),t.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full ${d.bg} ${d.color} font-semibold uppercase tracking-wider`,children:d.label})]}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5 line-clamp-1",children:e.description}),t.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px] text-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(V,{size:10})," ",e.agents.length," agents"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(p,{size:10})," ",e.estimatedTime]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[!n&&t.jsxs("button",{onClick:t=>{t.stopPropagation(),r(e.id)},className:"px-3 py-1.5 bg-gradient-to-r from-violet-600 to-cyan-600 text-white text-xs font-bold rounded-lg hover:from-violet-500 hover:to-cyan-500 transition-all flex items-center gap-1.5 shadow-lg shadow-violet-500/20",children:[t.jsx(x,{size:12})," Run"]}),s?t.jsx(l,{size:14,className:"text-gray-600"}):t.jsx(i,{size:14,className:"text-gray-600"})]})]}),s&&t.jsxs("div",{className:"px-4 pb-4 border-t border-gray-800/50",children:[t.jsx(we,{steps:e.steps}),t.jsx("div",{className:"grid gap-2 mt-3",children:e.steps.map((e,a)=>{const r=ee[e.agentId],n=te[e.agentId]||"#6b7280";return t.jsxs("div",{className:"scroll-reveal-item flex items-center gap-3 px-3 py-2 rounded-lg border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/30",style:{animationDelay:60*a+"ms",background:`${n}08`},children:[t.jsx("span",{className:"text-xs font-black w-6 text-center",style:{color:n},children:a+1}),t.jsx("span",{className:"text-xs font-bold",style:{color:n},children:r?.name}),t.jsx("span",{className:"text-xs text-gray-500",children:e.name})]},e.id)})})]})]})}function Ce({run:a,onClose:r}){const[n,l]=e.useState(null),[i,s]=e.useState(null),o=e.useRef(null),c=e.useMemo(()=>X[a?.templateId],[a?.templateId]);if(e.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[a?.steps]),!a||!c)return null;const d=a.steps.filter(e=>"completed"===e.status).length,m=a.steps.length>0?d/a.steps.length*100:0,h="running"===a.status,x=a.totalElapsed||(a.startedAt?Date.now()-a.startedAt:0);return t.jsxs("div",{className:"bg-gray-950 border border-violet-500/20 rounded-2xl overflow-hidden shadow-2xl",style:{boxShadow:"0 0 60px rgba(139, 92, 246, 0.08), 0 0 20px rgba(6, 182, 212, 0.05)"},children:[t.jsxs("div",{className:"bg-gradient-to-r from-violet-950/80 via-gray-950 to-cyan-950/80 px-5 py-4 border-b border-violet-500/20",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-3 h-3 rounded-full "+(h?"bg-violet-500 animate-pulse":"completed"===a.status?"bg-green-500":"bg-red-500"),style:{boxShadow:h?"0 0 12px #8b5cf6":void 0}}),t.jsx("h2",{className:"text-sm font-black text-transparent bg-clip-text bg-gradient-to-r from-pink-400 to-rose-400 uppercase tracking-wider",children:h?"Executing Pipeline":"completed"===a.status?"Pipeline Complete":"Pipeline "+a.status}),t.jsx("p",{className:"text-sm text-gray-400 mt-1.5",children:"Configure and monitor AI agent processing pipelines"})]}),t.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500",children:[t.jsxs("span",{children:[t.jsx(p,{size:12,className:"inline mr-1"}),(x/1e3).toFixed(1),"s"]}),t.jsxs("span",{children:[t.jsx(y,{size:12,className:"inline mr-1"}),d,"/",a.steps.length]}),!h&&t.jsx("button",{onClick:r,className:"text-gray-600 hover:text-white text-xs",children:"Close"})]})]}),t.jsx("div",{className:"mt-3 h-1.5 bg-gray-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full rounded-full transition-all duration-700 "+(h?"bg-gradient-to-r from-violet-500 to-cyan-500 animate-pulse":"completed"===a.status?"bg-gradient-to-r from-green-500 to-emerald-500":"bg-red-500"),style:{width:`${m}%`}})})]}),t.jsx("div",{className:"px-5 py-3 bg-gray-900/30 border-b border-gray-800/50",children:t.jsx(we,{steps:c.steps,runSteps:a.steps,executing:h})}),t.jsx("div",{ref:o,className:"max-h-[400px] overflow-y-auto",children:a.steps.map((e,a)=>{const r=ee[e.agentId],o=te[e.agentId]||"#6b7280",c=n===a,d=e.result&&"completed"===e.status;return t.jsxs("div",{className:"border-b border-gray-800/30 transition-all "+("running"===e.status?"bg-violet-500/5":""),children:[t.jsxs("div",{className:"flex items-center gap-3 px-5 py-3 cursor-pointer hover:bg-gray-900/50",onClick:()=>l(c?null:a),children:["running"===e.status&&t.jsx(v,{size:14,className:"text-violet-400 animate-spin"}),"completed"===e.status&&t.jsx(u,{size:14,className:"text-green-400"}),"failed"===e.status&&t.jsx(N,{size:14,className:"text-red-400"}),"pending"===e.status&&t.jsx(w,{size:14,className:"text-gray-700"}),t.jsx("span",{className:"text-xs font-bold",style:{color:o},children:r?.name}),t.jsx("span",{className:"text-xs text-gray-500 flex-1",children:e.name}),e.elapsed>0&&t.jsxs("span",{className:"text-[10px] text-gray-600",children:[(e.elapsed/1e3).toFixed(1),"s"]}),d&&t.jsxs("span",{className:"text-[10px] text-gray-600",children:[e.result.length.toLocaleStr
1ing()," chars"]})]}),c&&d&&t.jsx("div",{className:"px-5 pb-4",children:t.jsxs("div",{className:"relative bg-gray-950 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300 rounded-xl p-4 max-h-[300px] overflow-y-auto",children:[t.jsx("button",{onClick:()=>{navigator.clipboard.writeText(e.result).catch(()=>{}),s(a),setTimeout(()=>s(null),2e3)},className:"absolute top-2 right-2 p-1 rounded bg-gray-800 hover:bg-gray-700",children:i===a?t.jsx(k,{size:12,className:"text-green-400"}):t.jsx(C,{size:12,className:"text-gray-500"})}),t.jsx("pre",{className:"text-xs text-gray-300 whitespace-pre-wrap font-mono leading-relaxed",children:e.result})]})})]},a)})}),"completed"===a.status&&t.jsxs("div",{className:"px-5 py-3 border-t border-green-500/20 flex items-center gap-6",style:{background:"linear-gradient(to right, rgba(34,197,94,0.03), transparent, rgba(16,185,129,0.03))"},children:[t.jsx(g,{size:14,className:"text-green-400"}),t.jsx("span",{className:"text-xs font-bold text-green-400",children:"Pipeline Complete"}),t.jsxs("span",{className:"text-[10px] text-gray-500",children:[(x/1e3).toFixed(1),"s"]}),t.jsxs("span",{className:"text-[10px] text-gray-500",children:[a.steps.reduce((e,t)=>e+(t.result?.length||0),0).toLocaleString()," chars"]})]})]})}function Se({history:e,templates:a}){const r=e.length,n=e.filter(e=>"completed"===e.status).length,l=r>0?(e.reduce((e,t)=>e+t.totalElapsed,0)/r/1e3).toFixed(1):"0",i=new Set(e.map(e=>e.templateId)).size,s=(()=>{let t=0;for(const a of e){if("completed"!==a.status)break;t++}return t})(),o=[{icon:d,label:"Runs",value:r,color:"violet"},{icon:u,label:"Success",value:r>0?Math.round(n/r*100)+"%":"--",color:"green"},{icon:p,label:"Avg Time",value:l+"s",color:"cyan"},{icon:m,label:"Coverage",value:`${i}/${a.length}`,color:"amber"},{icon:g,label:"Streak",value:s,color:"pink"}];return t.jsx("div",{className:"grid grid-cols-5 gap-2",children:o.map(({icon:e,label:a,value:r,color:n})=>t.jsxs("div",{className:"bg-gray-900/50 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/50 rounded-xl px-2 py-2 text-center",children:[t.jsx(e,{size:12,className:`text-${n}-400 mx-auto mb-0.5`}),t.jsx("div",{className:`text-base font-black text-${n}-400`,children:r}),t.jsx("div",{className:"text-[8px] text-gray-600 uppercase tracking-wider",children:a})]},a))})}function ze({executing:e}){return t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 rounded-xl border transition-all duration-500 "+(e?"bg-violet-500/5 border-violet-500/30":"bg-gray-900/30 border-gray-800/30"),style:e?{boxShadow:"0 0 30px rgba(139,92,246,0.05)"}:{},children:[t.jsx("div",{className:"w-2 h-2 rounded-full "+(e?"bg-violet-500":"bg-green-500"),style:e?{boxShadow:"0 0 8px #8b5cf6"}:{}}),t.jsx("span",{className:"text-xs font-semibold "+(e?"text-violet-400":"text-green-400"),children:e?"Entity Active \u2014 Agents Collaborating":"System Ready \u2014 15 Agents Online"}),t.jsx("div",{className:"flex-1"}),t.jsx("div",{className:"flex items-center gap-0.5",children:[...Array(12)].map((a,r)=>t.jsx("div",{className:"w-0.5 rounded-full transition-all duration-200 "+(e?"bg-violet-500":"bg-gray-700"),style:{height:e?4+6*Math.sin(Date.now()/150+.5*r)+"px":"3px"}},r))})]})}function Ae({entry:e,onView:a}){const r="completed"===e.status?t.jsx(u,{size:12,className:"text-green-400"}):"failed"===e.status?t.jsx(N,{size:12,className:"text-red-400"}):t.jsx(Y,{size:12,className:"text-amber-400"});return t.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-gray-900/40 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/30 hover:border-gray-700/50 cursor-pointer transition-all",onClick:()=>a(e.id),children:[r,t.jsx("span",{className:"text-xs font-semibold text-white flex-1 truncate",children:e.templateName}),t.jsxs("span",{className:"text-[10px] text-gray-600",children:[e.successCount,"/",e.stepCount]}),t.jsxs("span",{className:"text-[10px] text-gray-600",children:[(e.totalElapsed/1e3).toFixed(1),"s"]})]})}function Me({history:a,onRun:r}){const n=e.useMemo(()=>{const e=new Set(a.slice(0,10).map(e=>e.templateId)),t=[];return e.has("full_audit")||t.push({id:"full_audit",reason:"Run your first platform audit"}),e.has("market_to_launch")||t.push({id:"market_to_launch",reason:"Launch a product end-to-e
1nd"}),e.has("content_engine")||t.push({id:"content_engine",reason:"Generate trending content"}),e.has("competitive_intel")&&!e.has("revenue_optimization")&&t.push({id:"revenue_optimization",reason:"Optimize revenue from your intel"}),t.slice(0,2)},[a]);return n.length?t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-gray-500",children:[t.jsx(h,{size:12,className:"text-amber-400"}),t.jsx("span",{className:"uppercase tracking-wider font-semibold",children:"Recommended"})]}),n.map(e=>t.jsxs("button",{onClick:()=>r(e.id),className:"w-full flex items-center gap-3 px-3 py-2 rounded-lg bg-amber-500/5 border border-amber-500/20 hover:border-amber-500/40 transition-all text-left",children:[t.jsx(h,{size:14,className:"text-amber-400"}),t.jsx("span",{className:"text-xs text-amber-300 font-medium flex-1",children:e.reason}),t.jsx(x,{size:12,className:"text-amber-400"})]},e.id))]}):null}const $e={market_to_launch:[{key:"niche",label:"Market Niche",placeholder:"AI SaaS",default:"AI SaaS"},{key:"audience",label:"Target Audience",placeholder:"tech-savvy entrepreneurs",default:"tech-savvy entrepreneurs"},{key:"budget",label:"Budget",placeholder:"$5,000",default:"$5,000"}],content_engine:[{key:"niche",label:"Content Niche",placeholder:"AI and automation",default:"AI and automation"}],competitive_intel:[{key:"niche",label:"Industry",placeholder:"AI automation platforms",default:"AI automation platforms"},{key:"budget",label:"Monthly Budget",placeholder:"$10,000/month",default:"$10,000/month"}],security_hardening:[{key:"target",label:"Target System",placeholder:"React + Supabase + Stripe SaaS",default:"React + Supabase + Stripe SaaS application"}],customer_acquisition:[{key:"product",label:"Product",placeholder:"AI business automation platform",default:"AI-powered business automation platform"},{key:"adBudget",label:"Ad Budget",placeholder:"$1,500/month",default:"$1,500/month"}],brand_authority:[{key:"niche",label:"Niche",placeholder:"AI automation",default:"AI automation"}],system_evolution:[{key:"system",label:"System",placeholder:"OmniFINDS.AI platform",default:"the OmniFINDS.AI platform"}],revenue_optimization:[{key:"product",label:"Product",placeholder:"AI SaaS platform",default:"an AI SaaS platform"},{key:"mrr",label:"Current MRR",placeholder:"$2,400",default:"$2,400"}],full_audit:[{key:"target",label:"Target",placeholder:"OmniFINDS.AI platform",default:"OmniFINDS.AI platform"}],dispatch_workflow:[{key:"goal",label:"Workflow Goal",placeholder:"Weekly revenue reporting",default:"Weekly revenue reporting and optimization cycle"}]};function Ie({executing:a}){const[r,n]=e.useState({charge:0,agents:{},entangledPairs:[]}),[l,i]=e.useState({tunnelingProbability:0,coherence:0,collapseReady:!1});e.useEffect(()=>{const e=()=>{try{const e=K.getState?.()||{charge:0,agents:{},entangledPairs:[]},t=K.getQuantumState?.()||{tunnelingProbability:0,coherence:0,collapseReady:!1};n(e),i(t)}catch{}};e();const t=setInterval(e,2e3);return()=>clearInterval(t)},[a]);const s=Math.min(100,Math.max(0,100*(r.charge||0))),c=Math.min(100,Math.max(0,100*(l.tunnelingProbability||0))),d=Math.min(100,Math.max(0,100*(l.coherence||0))),u=r.entangledPairs||[];return t.jsxs("div",{className:"bg-gray-900/60 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300/50 rounded-xl p-4 transition-all "+(l.collapseReady?"ring-2 ring-purple-500/60 animate-pulse":""),children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx(o,{className:"w-4 h-4 text-purple-400"}),t.jsx("span",{className:"text-sm font-bold text-white",children:"Quantum Capacitor"}),l.collapseReady&&t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-purple-500/20 text-purple-300 rounded-full",children:"Collapse Ready"})]}),t.jsxs("div",{className:"mb-2",children:[t.jsxs("div",{className:"flex justify-between text-[10px] text-gray-500 mb-1",children:[t.jsx("span",{children:"Swarm Charge"}),t.jsxs("span",{children:[s.toFixed(1),"%"]})]}),t.jsx("div",{className:"h-2 bg-gray-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-purple-600 to-cyan-400 transition-all duration-700",style:{width:`${s}%`}})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-2",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex justify-between text-[10px] text-gray-500 mb-1",children:[t.jsx("span",{children:"Tunneling"}),t.jsxs("span",{children:[c.toFixed(0),"%"]})]}),t.jsx("div",{className:"h-1.5 bg-gray-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-amber-500 to-orange-400 transition-all duration-700",style:{width:`${c}%`}})})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex justify-between text-[10px] text-gray-500 mb-1",children:[t.jsx("span",{children:"Coherence"}),t.jsxs("span",{children:[d.toFixed(0),"%"]})]}),t.jsx("div",{className:"h-1.5 bg-gray-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-emerald-500 to-teal-400 transition-all duration-700",style:{width:`${d}%`}})})]})]}),u.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:u.slice(0,6).map((e,a)=>t.jsxs("span",{className:"inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 bg-gray-800/80 rounded-full border border-gray-700/50",children:[t.jsx("span",{style:{color:te[e[0]]||"#8b5cf6"},children:e[0]}),t.jsx("span",{className:"text-gray-600",children:"\u2194"}),t.jsx("span",{style:{color:te[e[1]]||"#6366f1"},children:e[1]})]},a))})]})}function Re(){const{templates:o,categories:c,activeRun:d,history:u,executing:p,execute:m,executeCustom:g,getFullRun:h}=function(){const[t,a]=e.useState(null),[r,n]=e.useState(()=>q.getHistory()),[l,i]=e.useState(!1),s=e.useRef(null);e.useEffect(()=>(s.current=q.onEvent((e,t)=>{switch(e){case"pipeline:started":case"pipeline:step:started":case"pipeline:step:completed":case"pipeline:step:failed":case"pipeline:step:skipped":a({...t.runId?q.getRun(t.runId):t});break;case"pipeline:completed":case"pipeline:failed":case"pipeline:cancelled":a({...t}),n(q.getHistory()),i(!1)}}),()=>{s.current&&s.current()}),[]);const o=e.useCallback(async(e,t={},r={})=>{i(!0);try{const l=await q.executePipeline(e,t,r);return a(l),n(q.getHistory()),l}catch(l){throw i(!1),l}},[]),c=e.useCallback(()=>{t?.id&&q.cancelPipeline(t.id)},[t]),d=e.useCallback(async(e,t={},r={})=>{i(!0);try{const l=await q.executeCustomPipeline(e,t,r);return a(l),n(q.getHistory()),l}catch(l){throw i(!1),l}},[]),u=e.useCallback(e=>q.getFullRun(e),[]);
1return{templates:Object.values(X),categories:J,activeRun:t,history:r,executing:l,execute:o,executeCustom:d,cancel:c,getFullRun:u}}(),[x,b]=e.useState(null),[f,y]=e.useState(null),[v,N]=e.useState(null),[w,k]=e.useState({}),[C,S]=e.useState(!1),[z,A]=e.useState("all"),M=e.useCallback(e=>{const t=$e[e];if(t?.length>0){const a={};t.forEach(e=>{a[e.key]=e.default||""}),k(a),N(e)}else m(e)},[m]),$=e.useCallback(()=>{v&&(m(v,w),N(null))},[v,w,m]),I=e.useCallback(e=>{const t=h(e);t&&y(t)},[h]),R="all"===z?o:o.filter(e=>e.category===z),_=e.useMemo(()=>{const e={};return u.forEach(t=>{e[t.templateName]=(e[t.templateName]||0)+1}),Object.entries(e).map(([e,t])=>({label:e.split(" ").slice(0,2).join(" "),value:t})).sort((e,t)=>t.value-e.value).slice(0,6)},[u]),D=d||f;return t.jsxs("div",{className:"space-y-5 pb-10",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-violet-600 to-cyan-600 flex items-center justify-center",style:{boxShadow:"0 0 20px rgba(139,92,246,0.2)"},children:t.jsx(a,{size:20,className:"text-white"})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-xl font-black text-white tracking-tight",children:"Pipeline Command Center"}),t.jsx("p",{className:"text-xs text-gray-500",children:"Multi-agent orchestration with live intelligence"})]})]}),t.jsx(ze,{executing:p}),t.jsx(Ie,{executing:p}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[t.jsx(ae,{activeRun:d,executing:p,history:u}),t.jsx(ne,{executing:p}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Se,{history:u,templates:o}),t.jsx(Me,{history:u,onRun:M})]})]}),t.jsx(ge,{activeRun:d,executing:p}),p&&d&&t.jsx(be,{run:d}),D&&t.jsx(Ce,{run:D,onClose:()=>y(null)}),t.jsx(pe,{run:"completed"===d?.status?d:f}),t.jsx(xe,{history:u,onRun:M}),t.jsx(ie,{run:"completed"===d?.status?d:f}),t.jsx(de,{history:u}),t.jsx(ce,{history:u}),t.jsx(re,{history:u,templates:o}),_.length>0&&t.jsx(le,{data:_,title:"Pipeline Usage",icon:r,color:"violet"}),t.jsx(ye,{onExecute:g,executing:p}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("button",{onClick:()=>A("all"),className:"px-3 py-1 rounded-full text-xs font-semibold transition-all "+("all"===z?"bg-violet-500/20 text-violet-300 border border-violet-500/30":"bg-gray-900/50 text-gray-500 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300 hover:text-gray-300"),children:"All"}),Object.entries(c).map(([e,a])=>t.jsx("button",{onClick:()=>A(e),className:"px-3 py-1 rounded-full text-xs font-semibold transition-all "+(z===e?`${a.bg} ${a.color} border border-gray-700`:"bg-gray-900/50 text-gray-500 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300 hover:text-gray-300"),children:a.label},e))]}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:R.map(e=>t.jsx(ke,{template:e,onRun:M,isRunning:p&&d?.templateId===e.id,expanded:x===e.id,onToggle:()=>b(x===e.id?null:e.id)},e.id))}),u.length>0&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>S(!C),className:"flex items-center gap-2 text-xs text-gray-500 hover:text-gray-300 transition-colors mb-2",children:[t.jsx(n,{size:14}),t.jsxs("span",{className:"uppercase tracking-wider font-semibold",children:["History (",u.length,")"]}),C?t.jsx(l,{size:12}):t.jsx(i,{size:12})]}),C&&t.jsx("div",{className:"space-y-1.5 max-h-[250px] overflow-y-auto",children:u.map(e=>t.jsx(Ae,{entry:e,onView:I},e.id))})]}),v&&t.jsx("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:()=>N(null),children:t.jsxs("div",{className:"bg-gray-950 border border-violet-500/30 rounded-2xl w-full max-w-md p-6",style:{boxShadow:"0 0 60px rgba(139,92,246,0.1)"},onClick:e=>e.stopPropagation(),children:[t.jsx("h3",{className:"text-lg font-black text-white mb-1",children:"Configure Pipeline"}),t.jsx("p",{className:"text-xs text-gray-500 mb-4",children:o.find(e=>e.id===v)?.name}),t.jsx("div",{className:"space-y-3",children:($e[v]||[]).map(e=>t.jsxs("div",{children:[t.jsx("label",{className:"text-xs text-gray-400 font-semibold block mb-1",children:e.label}),t.jsx("input",{type:"text",value:w[e.key]||"",onChange:t=>k(a=>({...a,[e.key]:t.target.value})),placeholder:e.placeholder,className:"w-full px-3 py-2 bg-gray-900 border border-gray-800 hover:border-cyan-500/20 transition-colors duration-300 rounded-lg text-sm text-white placeholder-gray-600 focus:border-violet-500/50 focus:outline-none"})]},e.key))}),t.jsxs("div",{className:"flex items-center gap-3 mt-5",children:[t.jsxs("button",{onClick:$,className:"flex-1 py-2.5 bg-gradient-to-r from-violet-600 to-cyan-600 text-white text-sm font-bold rounded-xl hover:from-violet-500 hover:to-cyan-500 flex items-center justify-center gap-2",style:{boxShadow:"0 0 20px rgba(139,92,246,0.2)"},children:[t.jsx(s,{size:16})," Launch Pipeline"]}),t.jsx("button",{onClick:()=>N(null),className:"px-4 py-2.5 bg-gray-800 text-gray-400 text-sm rounded-xl hover:bg-gray-700",children:"Cancel"})]})]})})]})}export{Re as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.