Created At: 2026-11-18T12:41:35Z Completed At: 2026-11-18T12:41:36Z Command exited with code 0. Command output: /root/telegram-saas/apps/frontend/src/components/pages/BotDetailsPage.tsx:127: https://api.yourdomain.com/webhooks/telegram/{botId} /root/telegram-saas/apps/frontend/src/components/pages/BotManagementPage.tsx:39: webhookUrl: 'https://api.yourdomain.com/webhooks/telegram/b-001', /root/telegram-saas/apps/frontend/src/components/pages/BotManagementPage.tsx:50: webhookUrl: 'https://api.yourdomain.com/webhooks/telegram/b-002', /root/telegram-saas/apps/frontend/src/components/pages/BotManagementPage.tsx:61: webhookUrl: 'https://api.yourdomain.com/webhooks/telegram/b-003', /root/telegram-saas/apps/frontend/src/components/pages/BotManagementPage.tsx:72: webhookUrl: 'https://api.yourdomain.com/webhooks/telegram/b-004', /root/telegram-saas/apps/frontend/src/components/pages/BotManagementPage.tsx:121: webhookUrl: `https://api.yourdomain.com/webhooks/telegram/${data.data?.id}`, /root/telegram-saas/apps/frontend/src/components/pages/BotManagementPage.tsx:142: webhookUrl: `https://api.yourdomain.com/webhooks/telegram/b-${Date.now()}`, /root/telegram-saas/apps/frontend/dist/assets/index-CVuRv4UJ.js:63:Tracking active. Volatility threshold set to ยฑ2.5%.`}},kl=[{id:"node-1",type:"trigger",label:"Telegram Inbound Message",subtitle:"Event: message:text",config:{event:"message:text",parse_commands:!0},status:"idle"},{id:"node-2",type:"ai_agent",label:"LLM Intent & Context Analyzer",subtitle:"Model: gpt-4o-mini",config:{model:"gpt-4o-mini",temperature:.3,system_prompt:"Analyze user intent and choose appropriate resolution or tools."},status:"idle"},{id:"node-3",type:"mcp_tool",label:"MCP Protocol Tool Router",subtitle:"Tools: message.send, analytics.report",config:{tools:["message.send","analytics.report"],enforce_approval:!0},status:"idle"},{id:"node-4",type:"channel_action",label:"Telegram HTML Message Dispatch",subtitle:"Parse Mode: HTML with Inline Buttons",config:{channel:"telegram",parse_mode:"HTML",enable_keyboard:!0},status:"idle"}],Sl=()=>{const[t,s]=l.useState("synthesizer"),[a,n]=l.useState(""),[r,i]=l.useState(!1),[o,h]=l.useState(""),[m,d]=l.useState(Ue.support),[u,p]=l.useState(!1),[v,f]=l.useState(kl),[g,j]=l.useState("node-2"),[x,c]=l.useState(!1),[b,N]=l.useState([]),S=()=>{a.trim()&&(i(!0),p(!1),h("Analyzing intent & classifying blueprint..."),setTimeout(()=>{h("Selecting core modules & permissions..."),setTimeout(()=>{h("Binding MCP protocol tools & policies..."),setTimeout(()=>{h("Synthesizing persona prompt & Unicode preview..."),setTimeout(()=>{const k=a.toLowerCase();k.includes("shop")||k.includes("store")||k.includes("cart")||k.includes("product")?d(Ue.ecommerce):k.includes("crypto")||k.includes("price")||k.includes("alert")||k.includes("btc")?d(Ue.crypto):d(Ue.support),i(!1),h("")},400)},400)},400)},400))},C=()=>{p(!0)},w=()=>{c(!0),N([]),f(k=>k.map(P=>({...P,status:"running",latency_ms:void 0}))),setTimeout(()=>{f(k=>k.map(P=>P.id==="node-1"?{...P,status:"success",latency_ms:12.3}:P)),setTimeout(()=>{f(k=>k.map(P=>P.id==="node-2"?{...P,status:"success",latency_ms:245.8}:P)),setTimeout(()=>{f(k=>k.map(P=>P.id==="node-3"?{...P,status:"success",latency_ms:38.4}:P)),setTimeout(()=>{f(k=>k.map(P=>P.id==="node-4"?{...P,status:"success",latency_ms:18.2}:P)),c(!1),N([{step:"1. Inbound Trigger",output:'Captured user message: "Verify transaction #88921"'},{step:"2. AI Agent Reasoning",output:"Extracted order intent; querying payment ledger."},{step:"3. MCP Tools Invoked",output:"analytics.report executed; message.send prepared."},{step:"4. Telegram Dispatched",output:"Delivered HTML message with receipt inline keyboard."}])},350)},350)},350)},350)},A=v.find(k=>k.id===g);return e.jsxs("div",{className:"space-y-8 animate-fadeIn min-w-0 max-w-full",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 pb-6 border-b border-white/10",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-champagne-400 animate-pulse"}),e.jsx("span",{className:"text-[10px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"Autonomous Bot OS Engine"})]}),e.jsxs("h1",{className:"font-cinzel text-2xl sm:text-3xl md:text-4xl text-pearl-50 font-light tracking-wide flex items-center gap-3",children:[e.jsx(Ca,{className:"w-7 h-7 sm:w-8 sm:h-8 text-champagne-400 shrink-0"}),e.jsx("span",{children:"Bot Builder & Automation Studio"})]}),e.jsx("p",{className:"text-xs sm:text-sm text-pearl-300 font-light mt-1",children:"Build custom bots via natural language AI synthesis or visually design multi-node automation workflows and deploy to 24/7 cloud hosting with 1 click."})]}),e.jsxs("div",{className:"flex items-center p-1 rounded-lg bg-space-900 border border-white/10 w-full md:w-auto shrink-0",children:[e.jsxs("button",{onClick:()=>s("synthesizer"),className:`flex-1 md:flex-none justify-center px-3 sm:px-4 py-2 text-xs font-mono tracking-wider uppercase rounded-md transition-all flex items-center gap-2 ${t==="synthesizer"?"bg-champagne-500 text-space-950 font-bold shadow-luxury":"text-pearl-400 hover:text-pearl-200"}`,children:[e.jsx(z,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"AI Synthesizer"})]}),e.jsxs("button",{onClick:()=>s("canvas"),className:`flex-1 md:flex-none justify-center px-3 sm:px-4 py-2 text-xs font-mono tracking-wider uppercase rounded-md transition-all flex items-center gap-2 ${t==="canvas"?"bg-champagne-500 text-space-950 font-bold shadow-luxury":"text-pearl-400 hover:text-pearl-200"}`,children:[e.jsx(ns,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Canvas"})]})]})]}),t==="synthesizer"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-6 rounded-xl bg-space-900/60 border border-white/10 backdrop-blur-xl relative overflow-hidden space-y-4",children:[e.jsxs("div",{className:"flex flex-col md:flex-row gap-3",children:[e.jsx("div",{className:"relative flex-1",children:e.jsx("input",{type:"text",placeholder:"Describe your desired bot in English or Hinglish (e.g. 'Customer support ticket bot with human escalation and Razorpay integration')...",value:a,onChange:k=>n(k.target.value),onKeyDown:k=>k.key==="Enter"&&S(),className:"w-full bg-space-950/80 border border-champagne-500/30 rounded-lg px-4 py-3.5 text-sm font-light text-pearl-100 placeholder:text-pearl-500 focus:outline-none focus:border-champagne-500/80 transition-all shadow-inner"})}),e.jsxs("button",{onClick:S,disabled:r||!a.trim(),className:"px-6 py-3.5 bg-champagne-500 hover:bg-champagne-400 disabled:opacity-50 text-space-950 font-mono text-xs uppercase tracking-wider font-bold rounded-lg shadow-luxury transition-all flex items-center justify-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),r?"Synthesizing...":"Synthesize Bot"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-2",children:[e.jsx("span",{className:"text-[11px] font-mono text-pearl-500",children:"Try Ideas:"}),[{label:"Customer Support Desk",text:"AI customer support desk with ticketing and human escalation"},{label:"Digital Store & Checkout",text:"E-commerce digital store with cart checkout and Razorpay payments"},{label:"Crypto Sentinel",text:"Crypto price tracker with live alerts and Binance MCP tools"}].map(k=>e.jsx("button",{onClick:()=>{n(k.text)},className:"px-2.5 py-1 text-[11px] font-mono bg-white/5 hover:bg-champagne-500/10 text-pearl-300 hover:text-champagne-300 rounded border border-white/10 transition-colors",children:k.label},k.label))]}),r&&e.jsxs("div",{className:"p-4 rounded-lg bg-space-950/90 border border-champagne-500/40 flex items-center gap-3 animate-pulse",children:[e.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-champagne-400 border-t-transparent animate-spin"}),e.jsx("span",{className:"text-xs font-mono text-champagne-300 tracking-wider",children:o})]})]}),m&&!r&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsx("div",{className:"lg:col-span-7 space-y-6",children:e.jsxs("div",{className:"p-6 rounded-xl bg-space-900/60 border border-white/10 backdrop-blur-xl space-y-5",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] font-mono tracking-widest text-champagne-400 uppercase",children:m.category}),e.jsx("h3",{className:"font-cinzel text-xl text-pearl-50 font-medium",children:m.bot_name}),e.jsx("p",{className:"text-xs text-pearl-300 font-light mt-1",children:m.headline})]}),e.jsx("span",{className:"px-2.5 py-1 rounded text-[10px] font-mono bg-emerald-500/20 text-emerald-300 border border-emerald-500/30",children:"SYNTHESIS READY"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-[11px] font-mono uppercase text-pearl-400",children:["Synthesized Core Modules (",m.selected_modules.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:m.selected_modules.map(k=>e.jsxs("span",{className:"px-2.5 py-1 rounded text-xs font-mono bg-space-950 border border-white/10 text-pearl-200",children:["๐Ÿ“ฆ ",k]},k))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-[11px] font-mono uppercase text-pearl-400",children:["Assigned MCP Protocol Tools (",m.selected_mcp_tools.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:m.selected_mcp_tools.map(k=>e.jsxs("span",{className:"px-2.5 py-1 rounded text-xs font-mono bg-champagne-500/10 border border-champagne-500/30 text-champagne-300",children:["โšก ",k]},k))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[11px] font-mono uppercase text-pearl-400",children:"Synthesized Persona System Prompt"}),e.jsx("textarea",{rows:4,value:m.system_prompt,onChange:k=>d({...m,system_prompt:k.target.value}),className:"w-full bg-space-950/80 border border-white/10 rounded-lg p-3 text-xs font-mono text-pearl-200 focus:outline-none focus:border-champagne-500/50"})]}),e.jsxs("div",{className:"pt-4 border-t border-white/10 flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs font-mono text-pearl-400",children:["Cloud Runtime: ",e.jsx("span",{className:"text-emerald-400",children:"24/7 Managed Celery Pool"})]}),e.jsx("button",{onClick:C,disabled:u,className:`px-5 py-2.5 rounded-lg text-xs font-mono uppercase tracking-wider font-bold transition-all flex items-center gap-2 ${u?"bg-emerald-500 text-space-950":"bg-champagne-500 hover:bg-champagne-400 text-space-950 shadow-luxury"}`,children:u?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-4 h-4"}),"Deployed to 24/7 Cloud!"]}):e.jsxs(e.Fragment,{children:[e.jsx(ws,{className:"w-4 h-4"}),"Deploy to 24/7 Cloud"]})})]}),u&&e.jsxs("div",{className:"p-4 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-xs font-mono text-emerald-300 space-y-1",children:[e.jsxs("div",{className:"font-semibold flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4 text-emerald-400"}),"Bot Container Successfully Provisioned"]}),e.jsx("p",{className:"text-[11px] text-pearl-300",children:"Webhook registered on Telegram API. Auto-recovery and deduplication active."})]})]})}),e.jsx("div",{className:"lg:col-span-5 space-y-4",children:e.jsxs("div",{className:"p-6 rounded-xl bg-space-900/60 border border-white/10 backdrop-blur-xl space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 pb-3",children:[e.jsxs("span",{className:"text-xs font-mono uppercase text-champagne-400 flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4"}),"Live Telegram Preview"]}),e.jsx("span",{className:"text-[10px] font-mono text-pearl-400",children:"HTML Parse Mode"})]}),e.jsxs("div",{className:"bg-[#182533] p-4 rounded-2xl border border-white/10 shadow-2xl space-y-3 font-sans max-w-sm mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[#6ab2f2] font-semibold",children:[e.jsx("span",{children:m.bot_name}),e.jsx("span",{className:"text-[9px] px-1 rounded bg-[#2b5278] text-white",children:"BOT"})]}),e.jsx("pre",{className:"text-xs text-[#f5f5f5] font-mono whitespace-pre-wrap leading-relaxed",dangerouslySetInnerHTML:{__html:m.preview_text}}),e.jsxs("div",{className:"space-y-1.5 pt-2",children:[e.jsx("div",{className:"w-full py-2 bg-[#2b5278] hover:bg-[#346595] text-white text-xs font-medium rounded-lg text-center transition-colors",children:"๐Ÿš€ Start Interactive Session"}),e.jsx("div",{className:"w-full py-2 bg-[#2b5278] hover:bg-[#346595] text-white text-xs font-medium rounded-lg text-center transition-colors",children:"๐Ÿ’ฌ Speak to Human Manager"})]}),e.jsx("div",{className:"text-right text-[10px] text-[#6c7883]",children:"12:00 PM โœ“โœ“"})]})]})})]})]}),t==="canvas"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl bg-space-900/60 border border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs font-mono uppercase text-pearl-400",children:["Pipeline Graph: ",e.jsx("span",{className:"text-champagne-300",children:"4 Connected Nodes"})]}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400"})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("button",{onClick:w,disabled:x,className:"px-4 py-2 text-xs font-mono uppercase tracking-wider font-bold bg-champagne-500 hover:bg-champagne-400 disabled:opacity-50 text-space-950 rounded-md shadow-luxury transition-all flex items-center gap-2",children:[e.jsx(we,{className:"w-3.5 h-3.5"}),x?"Executing Graph...":"Test Run Flow"]})})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 relative",children:v.map((k,P)=>{const G=g===k.id;return e.jsxs("div",{onClick:()=>j(k.id),className:`p-5 rounded-xl transition-all cursor-pointer relative space-y-3 ${G?"bg-space-900 border-2 border-champagne-500 shadow-luxury":"bg-space-900/70 border border-white/10 hover:border-white/25"}`,children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("span",{className:"text-[10px] font-mono uppercase tracking-widest text-champagne-400",children:["Step ",P+1]}),k.status==="running"&&e.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-champagne-400 border-t-transparent animate-spin"}),k.status==="success"&&e.jsxs("span",{className:"text-[10px] font-mono text-emerald-400 flex items-center gap-1",children:[e.jsx(O,{className:"w-3 h-3"}),k.latency_ms,"ms"]}),k.status==="idle"&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-white/20"})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-mono text-sm text-pearl-100 font-semibold",children:k.label}),e.jsx("p",{className:"text-xs text-pearl-400 font-mono mt-0.5",children:k.subtitle})]}),e.jsxs("div",{className:"text-[10px] font-mono px-2 py-1 rounded bg-space-950 border border-white/5 text-pearl-300",children:["Type: ",k.type]}),P{const P=k.target.value;f(G=>G.map(H=>H.id===A.id?{...H,label:P}:H))},className:"w-full bg-space-950 border border-white/10 rounded px-3 py-2 text-pearl-100"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-pearl-400 block mb-1",children:"Configuration Parameters (JSON)"}),e.jsx("pre",{className:"p-3 rounded bg-space-950 border border-white/5 text-pearl-300 text-[11px] overflow-x-auto",children:JSON.stringify(A.config,null,2)})]})]})]}),e.jsxs("div",{className:"lg:col-span-6 p-6 rounded-xl bg-space-900/60 border border-white/10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 pb-3",children:[e.jsxs("h4",{className:"font-cinzel text-base text-pearl-50 flex items-center gap-2",children:[e.jsx(qe,{className:"w-4 h-4 text-emerald-400"}),"Execution Trace & Telemetry"]}),e.jsx("span",{className:"text-xs font-mono text-pearl-400",children:b.length>0?"4/4 Completed":"Waiting for Run"})]}),b.length===0?e.jsx("div",{className:"p-8 text-center text-xs font-mono text-pearl-500",children:'Click "Test Run Flow" above to simulate deterministic graph execution across all 4 nodes.'}):e.jsx("div",{className:"space-y-3 font-mono text-xs",children:b.map((k,P)=>e.jsxs("div",{className:"p-3 rounded bg-space-950/80 border border-white/5 space-y-1",children:[e.jsx("div",{className:"text-champagne-300 font-semibold text-[11px]",children:k.step}),e.jsx("div",{className:"text-pearl-300 text-[11px]",children:k.output})]},P))})]})]})]})]})},_l=[{name:"bot.list",description:"Lists all Telegram bots registered under tenant account with operational status.",category:"Bot Fleet",is_dangerous:!1,requires_approval:!1,is_enabled:!0,input_schema:{status:"all | active | paused"}},{name:"bot.status",description:"Checks health, webhook sync status, and Telegram getMe profile for a specific bot.",category:"Bot Fleet",is_dangerous:!1,requires_approval:!1,is_enabled:!0,input_schema:{bot_id:"uuid",check_telegram:"boolean"}},{name:"marketplace.list",description:"Browses 25 ready-made bot blueprints and modules in the universal marketplace catalog.",category:"Marketplace",is_dangerous:!1,requires_approval:!1,is_enabled:!0,input_schema:{category:"all | business | community | ai_specialist"}},{name:"marketplace.install",description:"Installs a ready-made bot blueprint and configures 24/7 cloud instance provisioning.",category:"Marketplace",is_dangerous:!0,requires_approval:!0,is_enabled:!0,input_schema:{template_id:"string",bot_name:"string"}},{name:"message.send",description:"Dispatches high-priority message or broadcast via Telegram Bot API with retry backoff.",category:"Messaging",is_dangerous:!0,requires_approval:!0,is_enabled:!0,input_schema:{bot_id:"uuid",chat_id:"string",text:"string",parse_mode:"HTML"}},{name:"analytics.report",description:"Retrieves platform telemetry, active subscribers, and operational KPIs for the tenant.",category:"Analytics",is_dangerous:!1,requires_approval:!1,is_enabled:!0,input_schema:{period:"today | 7d | 30d"}}],Cl=[{id:"srv-1",name:"GitHub DevOps MCP Server",transport_type:"sse",endpoint_url:"https://mcp-hub.internal.net/github/sse",status:"online",discovered_tools:14,last_synced_at:"2 mins ago"},{id:"srv-2",name:"PostgreSQL Enterprise Explorer",transport_type:"stdio",endpoint_url:"npx -y @modelcontextprotocol/server-postgres",status:"online",discovered_tools:6,last_synced_at:"10 mins ago"},{id:"srv-3",name:"Stripe & Billing Gateway Tools",transport_type:"http",endpoint_url:"https://api.billing-mcp.internal/tools",status:"online",discovered_tools:8,last_synced_at:"1 hour ago"}],Al=[{id:"exec-901",tool_name:"message.send",caller:"Cursor AI Assistant",requested_at:"Just now",arguments:{bot_id:"b-001",chat_id:"99281726",text:"Urgent: VIP subscription plan renewed automatically.",parse_mode:"HTML"},risk_level:"high"},{id:"exec-902",tool_name:"marketplace.install",caller:"Claude Desktop Agent",requested_at:"3 mins ago",arguments:{template_id:"bot_customer_support",bot_name:"Astraea Automated Support Desk"},risk_level:"high"}],Tl=[{id:"log-101",tool_name:"bot.list",status:"completed",caller:"Claude Desktop",duration_ms:18.4,timestamp:"12:04:12 PM",result:{total_bots:4,active:4,paused:0}},{id:"log-102",tool_name:"analytics.report",status:"completed",caller:"Cursor AI",duration_ms:32.1,timestamp:"11:58:45 AM",result:{period:"7d",total_active_bots:4,uptime_percentage:99.98}},{id:"log-103",tool_name:"message.send",status:"approved",caller:"Autonomous Agent #2",duration_ms:145.8,timestamp:"11:42:01 AM",result:{status:"sent",message_id:"msg_98124"}},{id:"log-104",tool_name:"marketplace.install",status:"rejected",caller:"External Script",duration_ms:4.2,timestamp:"10:15:30 AM",result:{reason:"Admin rejected dangerous deployment without approval token"}}],Pl=()=>{const[t,s]=l.useState("tools"),[a,n]=l.useState(_l),[r,i]=l.useState(Cl),[o,h]=l.useState(Al),[m,d]=l.useState(Tl),[u,p]=l.useState(null),[v,f]=l.useState(null),[g,j]=l.useState(!1),[x,c]=l.useState(""),[b,N]=l.useState(""),[S,C]=l.useState("sse"),w=(_,L)=>{navigator.clipboard.writeText(_),p(L),setTimeout(()=>p(null),2e3)},A=()=>{f("Testing handshake..."),setTimeout(()=>{f("JSON-RPC 2.0 handshake verified (latency: 14ms)"),setTimeout(()=>f(null),4e3)},400)},k=_=>{n(L=>L.map(E=>E.name===_?{...E,requires_approval:!E.requires_approval}:E))},P=_=>{n(L=>L.map(E=>E.name===_?{...E,is_enabled:!E.is_enabled}:E))},G=_=>{const L=o.find(E=>E.id===_);L&&(h(E=>E.filter(W=>W.id!==_)),d(E=>[{id:`log-${Date.now()}`,tool_name:L.tool_name,status:"approved",caller:L.caller,duration_ms:124.5,timestamp:new Date().toLocaleTimeString(),result:{status:"executed_with_human_approval",id:_}},...E]))},H=_=>{const L=o.find(E=>E.id===_);L&&(h(E=>E.filter(W=>W.id!==_)),d(E=>[{id:`log-${Date.now()}`,tool_name:L.tool_name,status:"rejected",caller:L.caller,duration_ms:6.1,timestamp:new Date().toLocaleTimeString(),result:{reason:"Admin manually rejected approval gate"}},...E]))},fe=()=>{if(!x||!b)return;const _={id:`srv-${Date.now()}`,name:x,transport_type:S,endpoint_url:b,status:"online",discovered_tools:5,last_synced_at:"Just now"};i(L=>[_,...L]),j(!1),c(""),N("")},me=JSON.stringify({mcpServers:{"astraea-bot-cloud":{url:"https://api.yourdomain.com/api/v1/mcp/rpc",headers:{Authorization:"Bearer "}}}},null,2),se=JSON.stringify({servers:[{name:"astraea-bot-cloud",url:"https://api.yourdomain.com/api/v1/mcp/rpc",type:"sse"}]},null,2);return e.jsxs("div",{className:"space-y-6 sm:space-y-8 animate-fadeIn w-full max-w-full min-w-0",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 pb-6 border-b border-white/10",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),e.jsx("span",{className:"text-[10px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"Model Context Protocol Pro"})]}),e.jsxs("h1",{className:"font-cinzel text-2xl sm:text-3xl md:text-4xl text-pearl-50 font-light tracking-wide flex items-center gap-2 sm:gap-3",children:[e.jsx(ge,{className:"w-6 h-6 sm:w-8 sm:h-8 text-champagne-400 shrink-0"}),e.jsx("span",{children:"MCP Pro Protocol Cloud"})]}),e.jsx("p",{className:"text-xs sm:text-sm text-pearl-300 font-light mt-1 max-w-2xl",children:"Connect external AI clients (Claude Desktop, Cursor, Local LLMs) to your Telegram Bot Cloud via JSON-RPC 2.0 with granular human approval gates."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 sm:gap-3 w-full md:w-auto shrink-0",children:[e.jsxs("button",{onClick:A,className:"px-4 py-2 text-xs font-mono tracking-wider uppercase border border-champagne-500/40 text-champagne-300 hover:bg-champagne-500/10 rounded-md transition-all flex items-center justify-center gap-2",children:[e.jsx(bs,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:v||"Ping JSON-RPC"})]}),e.jsxs("button",{onClick:()=>j(!0),className:"px-4 py-2 text-xs font-mono tracking-wider uppercase bg-champagne-500 hover:bg-champagne-400 text-space-950 font-medium rounded-md shadow-luxury transition-all flex items-center justify-center gap-2",children:[e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:"Connect MCP Server"})]})]})]}),e.jsxs("div",{className:"p-4 sm:p-6 rounded-xl bg-space-900/60 border border-white/10 backdrop-blur-xl relative overflow-hidden w-full max-w-full min-w-0",children:[e.jsx("div",{className:"absolute top-0 right-0 w-80 h-80 bg-champagne-500/5 rounded-full blur-3xl pointer-events-none"}),e.jsxs("div",{className:"flex flex-col lg:flex-row items-start lg:items-center justify-between gap-4 sm:gap-6",children:[e.jsxs("div",{className:"space-y-2 max-w-xl min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-champagne-500/20 text-champagne-300 border border-champagne-500/30",children:"JSON-RPC 2.0"}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-emerald-500/20 text-emerald-300 border border-emerald-500/30",children:"AES-256 ISOLATED"})]}),e.jsx("h3",{className:"text-base sm:text-lg font-cinzel text-pearl-50",children:"Platform MCP Server Endpoint"}),e.jsx("p",{className:"text-xs text-pearl-300 font-mono break-all bg-space-950/80 px-3 py-2 rounded border border-white/5",children:"POST https://api.yourdomain.com/api/v1/mcp/rpc"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 sm:gap-3 w-full lg:w-auto shrink-0",children:[e.jsxs("button",{onClick:()=>w(me,"claude"),className:"px-3 py-2 text-xs font-mono bg-space-800/80 hover:bg-space-800 border border-white/10 rounded-md text-pearl-200 transition-all flex items-center justify-center gap-2",children:[u==="claude"?e.jsx(O,{className:"w-3.5 h-3.5 text-emerald-400"}):e.jsx($e,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Claude Desktop Config"})]}),e.jsxs("button",{onClick:()=>w(se,"cursor"),className:"px-3 py-2 text-xs font-mono bg-space-800/80 hover:bg-space-800 border border-white/10 rounded-md text-pearl-200 transition-all flex items-center justify-center gap-2",children:[u==="cursor"?e.jsx(O,{className:"w-3.5 h-3.5 text-emerald-400"}):e.jsx($e,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Cursor .cursor/mcp.json"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-white/10 pb-2 overflow-x-auto w-full max-w-full scrollbar-none",children:[e.jsxs("button",{onClick:()=>s("tools"),className:`px-3.5 sm:px-4 py-2 text-xs font-mono tracking-wider uppercase rounded-md transition-all flex items-center gap-2 shrink-0 whitespace-nowrap ${t==="tools"?"bg-champagne-500/20 text-champagne-300 border border-champagne-500/40":"text-pearl-400 hover:text-pearl-200 hover:bg-white/5"}`,children:[e.jsx(ps,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Platform Tools (",a.length,")"]})]}),e.jsxs("button",{onClick:()=>s("servers"),className:`px-3.5 sm:px-4 py-2 text-xs font-mono tracking-wider uppercase rounded-md transition-all flex items-center gap-2 shrink-0 whitespace-nowrap ${t==="servers"?"bg-champagne-500/20 text-champagne-300 border border-champagne-500/40":"text-pearl-400 hover:text-pearl-200 hover:bg-white/5"}`,children:[e.jsx(ws,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["External MCP Servers (",r.length,")"]})]}),e.jsxs("button",{onClick:()=>s("approvals"),className:`px-3.5 sm:px-4 py-2 text-xs font-mono tracking-wider uppercase rounded-md transition-all flex items-center gap-2 relative shrink-0 whitespace-nowrap ${t==="approvals"?"bg-champagne-500/20 text-champagne-300 border border-champagne-500/40":"text-pearl-400 hover:text-pearl-200 hover:bg-white/5"}`,children:[e.jsx(Aa,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Human Approval Queue"}),o.length>0&&e.jsx("span",{className:"w-4 h-4 rounded-full bg-amber-500 text-[9px] text-space-950 font-bold flex items-center justify-center ml-1",children:o.length})]}),e.jsxs("button",{onClick:()=>s("logs"),className:`px-3.5 sm:px-4 py-2 text-xs font-mono tracking-wider uppercase rounded-md transition-all flex items-center gap-2 shrink-0 whitespace-nowrap ${t==="logs"?"bg-champagne-500/20 text-champagne-300 border border-champagne-500/40":"text-pearl-400 hover:text-pearl-200 hover:bg-white/5"}`,children:[e.jsx(Ns,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Execution Logs"})]})]}),t==="tools"&&e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:a.map(_=>e.jsxs("div",{className:"p-5 rounded-xl bg-space-900/60 border border-white/10 hover:border-champagne-500/40 transition-all space-y-3 group",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] font-mono tracking-wider text-champagne-400 uppercase",children:_.category}),e.jsx("h4",{className:"font-mono font-medium text-pearl-100 text-sm group-hover:text-champagne-300 transition-colors",children:_.name})]}),_.is_dangerous&&e.jsxs("span",{className:"px-2 py-0.5 rounded text-[9px] font-mono bg-amber-500/20 text-amber-300 border border-amber-500/30 flex items-center gap-1",children:[e.jsx(dt,{className:"w-2.5 h-2.5"}),"CRITICAL"]})]}),e.jsx("p",{className:"text-xs text-pearl-300 line-clamp-2",children:_.description}),e.jsxs("div",{className:"bg-space-950/70 p-2.5 rounded border border-white/5 text-[11px] font-mono text-pearl-400 overflow-x-auto",children:[e.jsx("div",{className:"text-[9px] uppercase tracking-wider text-pearl-500 mb-1",children:"Input Schema"}),e.jsx("pre",{children:JSON.stringify(_.input_schema,null,2)})]}),e.jsxs("div",{className:"pt-2 border-t border-white/10 flex items-center justify-between text-xs font-mono",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:_.requires_approval,onChange:()=>k(_.name),className:"rounded border-white/20 bg-space-950 text-champagne-500 focus:ring-0"}),e.jsx("span",{className:_.requires_approval?"text-champagne-300":"text-pearl-400",children:"Requires Human Approval"})]}),e.jsx("button",{onClick:()=>P(_.name),className:`px-2 py-1 rounded text-[10px] font-mono ${_.is_enabled?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"bg-rose-500/20 text-rose-300 border border-rose-500/30"}`,children:_.is_enabled?"ENABLED":"DISABLED"})]})]},_.name))})}),t==="servers"&&e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:r.map(_=>e.jsxs("div",{className:"p-5 rounded-xl bg-space-900/60 border border-white/10 hover:border-champagne-500/30 transition-all space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-cinzel text-pearl-100 font-medium text-base",children:_.name}),e.jsxs("span",{className:"text-[10px] font-mono uppercase text-champagne-400",children:["Transport: ",_.transport_type.toUpperCase()]})]}),e.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-emerald-500/20 text-emerald-300 border border-emerald-500/30 flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"ONLINE"]})]}),e.jsx("div",{className:"text-xs font-mono text-pearl-300 bg-space-950/60 p-2 rounded border border-white/5 break-all",children:_.endpoint_url}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-white/10 text-xs font-mono text-pearl-400",children:[e.jsxs("span",{children:[_.discovered_tools," Tools Discovered"]}),e.jsxs("span",{children:["Synced ",_.last_synced_at]})]})]},_.id))})}),t==="approvals"&&e.jsx("div",{className:"space-y-4",children:o.length===0?e.jsxs("div",{className:"p-12 text-center rounded-xl bg-space-900/40 border border-white/10",children:[e.jsx($,{className:"w-12 h-12 text-emerald-400 mx-auto mb-3 opacity-80"}),e.jsx("h3",{className:"font-cinzel text-lg text-pearl-100",children:"No Pending Approvals"}),e.jsx("p",{className:"text-xs text-pearl-400 font-mono mt-1",children:"All external tool requests have been authorized or resolved."})]}):e.jsx("div",{className:"space-y-3",children:o.map(_=>e.jsxs("div",{className:"p-5 rounded-xl bg-space-900/80 border border-amber-500/30 flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono bg-amber-500/20 text-amber-300 border border-amber-500/30 flex items-center gap-1",children:[e.jsx(dt,{className:"w-3 h-3"}),"REQUIRES APPROVAL"]}),e.jsxs("span",{className:"text-xs font-mono text-pearl-400",children:["from ",_.caller]}),e.jsxs("span",{className:"text-xs font-mono text-pearl-500",children:["โ€ข ",_.requested_at]})]}),e.jsx("h4",{className:"font-mono text-sm text-pearl-100 font-semibold",children:_.tool_name}),e.jsx("pre",{className:"text-[11px] font-mono bg-space-950 p-2 rounded border border-white/10 text-pearl-300 max-w-xl overflow-x-auto",children:JSON.stringify(_.arguments,null,2)})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>H(_.id),className:"px-4 py-2 rounded text-xs font-mono uppercase bg-rose-500/20 text-rose-300 hover:bg-rose-500/30 border border-rose-500/40 transition-all flex items-center gap-1.5",children:[e.jsx(ys,{className:"w-3.5 h-3.5"}),"Reject"]}),e.jsxs("button",{onClick:()=>G(_.id),className:"px-4 py-2 rounded text-xs font-mono uppercase bg-emerald-500 text-space-950 hover:bg-emerald-400 font-bold shadow-luxury transition-all flex items-center gap-1.5",children:[e.jsx($,{className:"w-3.5 h-3.5"}),"Authorize & Run"]})]})]},_.id))})}),t==="logs"&&e.jsx("div",{className:"p-4 rounded-xl bg-space-900/60 border border-white/10 overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs font-mono",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/10 text-pearl-400",children:[e.jsx("th",{className:"p-3",children:"TOOL"}),e.jsx("th",{className:"p-3",children:"STATUS"}),e.jsx("th",{className:"p-3",children:"CALLER"}),e.jsx("th",{className:"p-3",children:"LATENCY"}),e.jsx("th",{className:"p-3",children:"TIME"}),e.jsx("th",{className:"p-3",children:"RESULT"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:m.map(_=>e.jsxs("tr",{className:"hover:bg-white/[0.02]",children:[e.jsx("td",{className:"p-3 font-semibold text-pearl-100",children:_.tool_name}),e.jsx("td",{className:"p-3",children:e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] ${_.status==="completed"||_.status==="approved"?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"bg-rose-500/20 text-rose-300 border border-rose-500/30"}`,children:_.status.toUpperCase()})}),e.jsx("td",{className:"p-3 text-pearl-300",children:_.caller}),e.jsxs("td",{className:"p-3 text-pearl-400",children:[_.duration_ms," ms"]}),e.jsx("td",{className:"p-3 text-pearl-400",children:_.timestamp}),e.jsx("td",{className:"p-3 text-pearl-300 max-w-xs truncate",children:JSON.stringify(_.result)})]},_.id))})]})}),g&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"max-w-md w-full bg-space-900 border border-champagne-500/30 rounded-xl p-6 space-y-4 shadow-2xl",children:[e.jsx("h3",{className:"font-cinzel text-lg text-pearl-50",children:"Connect External MCP Server"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] font-mono text-pearl-400 block mb-1",children:"Server Name"}),e.jsx("input",{type:"text",placeholder:"e.g. Brave Search MCP",value:x,onChange:_=>c(_.target.value),className:"w-full bg-space-950 border border-white/10 rounded px-3 py-2 text-xs text-pearl-100 font-mono focus:border-champagne-500/60 focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] font-mono text-pearl-400 block mb-1",children:"Transport Type"}),e.jsxs("select",{value:S,onChange:_=>C(_.target.value),className:"w-full bg-space-950 border border-white/10 rounded px-3 py-2 text-xs text-pearl-100 font-mono focus:border-champagne-500/60 focus:outline-none",children:[e.jsx("option",{value:"sse",children:"Server-Sent Events (SSE)"}),e.jsx("option",{value:"stdio",children:"Standard I/O (stdio)"}),e.jsx("option",{value:"http",children:"HTTP POST / JSON-RPC"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] font-mono text-pearl-400 block mb-1",children:"Endpoint URL or Command"}),e.jsx("input",{type:"text",placeholder:"https://mcp-server.example.com/sse",value:b,onChange:_=>N(_.target.value),className:"w-full bg-space-950 border border-white/10 rounded px-3 py-2 text-xs text-pearl-100 font-mono focus:border-champagne-500/60 focus:outline-none"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-white/10",children:[e.jsx("button",{onClick:()=>j(!1),className:"px-4 py-2 text-xs font-mono text-pearl-400 hover:text-pearl-200",children:"Cancel"}),e.jsx("button",{onClick:fe,className:"px-4 py-2 text-xs font-mono uppercase bg-champagne-500 hover:bg-champagne-400 text-space-950 font-bold rounded",children:"Connect & Discover"})]})]})})]})},Il=[{id:"b-001",name:"Astraea Flagship Super Bot",username:"astraea_flagship_bot",status:"active",defaultLocale:"en",keyVersion:1,webhookUrl:"https://api.yourdomain.com/webhooks/telegram/b-001",usersCount:14280,createdAt:"2026-11-01T10:00:00Z"},{id:"b-002",name:"VIP Concierge & Support",username:"vip_concierge_bot",status:"active",defaultLocale:"en",keyVersion:1,webhookUrl:"https://api.yourdomain.com/webhooks/telegram/b-002",usersCount:6890,createdAt:"2026-11-05T14:30:00Z"},{id:"b-003",name:"Automated Flash Billing",username:"flash_billing_bot",status:"active",defaultLocale:"hi",keyVersion:1,webhookUrl:"https://api.yourdomain.com/webhooks/telegram/b-003",usersCount:9420,createdAt:"2026-11-10T09:15:00Z"},{id:"b-004",name:"Omni Broadcast Announcer",username:"omni_broadcast_bot",status:"active",defaultLocale:"en",keyVersion:1,webhookUrl:"https://api.yourdomain.com/webhooks/telegram/b-004",usersCount:31200,createdAt:"2026-11-12T18:00:00Z"}],El=({onNavigate:t,onSelectBot:s})=>{Y();const[a,n]=l.useState(Il),[r,i]=l.useState(!1),[o,h]=l.useState(""),[m,d]=l.useState(""),[u,p]=l.useState("en"),[v,f]=l.useState(!1),[g,j]=l.useState(null),x=async c=>{var b,N,S,C;if(c.preventDefault(),!!o.trim()){f(!0);try{const w=await fetch("/api/v1/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:o,name:m||"New Telegram Bot",default_locale:u})});if(w.ok){const A=await w.json(),k={id:((b=A.data)==null?void 0:b.id)||`b-${Date.now()}`,name:((N=A.data)==null?void 0:N.name)||m||"New Telegram Bot",username:((S=A.data)==null?void 0:S.username)||"new_registered_bot",status:"active",defaultLocale:u,keyVersion:1,webhookUrl:`https://api.yourdomain.com/webhooks/telegram/${(C=A.data)==null?void 0:C.id}`,usersCount:0,createdAt:new Date().toISOString()};n([k,...a]),j(`Bot @${k.username} successfully registered and encrypted!`),setTimeout(()=>{i(!1),j(null),h(""),d("")},1200)}else{const A={id:`b-${Date.now()}`,name:m||"Astraea Subsidiary Bot",username:`astraea_${Date.now().toString().slice(-4)}_bot`,status:"active",defaultLocale:u,keyVersion:1,webhookUrl:`https://api.yourdomain.com/webhooks/telegram/b-${Date.now()}`,usersCount:0,createdAt:new Date().toISOString()};n([A,...a]),j(`Bot @${A.username} successfully validated via Telegram getMe!`),setTimeout(()=>{i(!1),j(null),h(""),d("")},1200)}}catch{i(!1)}finally{f(!1)}}};return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300 min-w-0 max-w-full",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 border-b border-white/10 pb-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-champagne-400"}),e.jsx("span",{className:"text-[10px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"Fleet Management Nexus"})]}),e.jsx("h1",{className:"font-cinzel text-2xl sm:text-3xl md:text-4xl text-pearl-50 font-light tracking-wide",children:"Telegram Bot Fleet"}),e.jsx("p",{className:"text-xs text-pearl-400 font-sans mt-1.5 max-w-2xl leading-relaxed",children:"Manage your tenant-isolated bot instances. Connect new bots via Telegram BotFather tokens with automated cryptographic validation and webhook dispatch."})]}),e.jsxs("button",{onClick:()=>i(!0),className:"btn-astraea-gold w-full sm:w-auto justify-center py-2.5 px-4",children:[e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:"CONNECT NEW BOT"})]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:a.map(c=>{var b,N;return e.jsxs("div",{className:"astraea-panel rounded-xl p-5 border border-white/10 flex flex-col justify-between group hover:border-champagne-400/30 transition-all",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-champagne-500/10 border border-champagne-400/30 flex items-center justify-center text-champagne-400",children:e.jsx(q,{className:"w-5 h-5"})}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono uppercase bg-emerald-500/10 border border-emerald-500/30 text-emerald-300",children:c.status})]}),e.jsx(I,{to:`/dashboard/bots/${((b=c.username)==null?void 0:b.replace("@",""))||c.id}`,onClick:()=>s&&s(c.id),className:"font-cinzel text-base text-pearl-50 font-normal tracking-wide group-hover:text-champagne-300 transition-colors block",children:c.name}),e.jsxs("div",{className:"text-xs font-mono text-champagne-400 mt-0.5",children:["@",c.username]}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-white/5 space-y-2 text-xs font-mono text-pearl-300",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-pearl-400 text-[10px] uppercase",children:"Audience:"}),e.jsxs("span",{className:"font-medium text-pearl-100",children:[c.usersCount.toLocaleString()," users"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-pearl-400 text-[10px] uppercase",children:"Default Locale:"}),e.jsx("span",{className:"text-pearl-100 uppercase",children:c.defaultLocale})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-pearl-400 text-[10px] uppercase",children:"Token Vault:"}),e.jsxs("span",{className:"text-emerald-400 flex items-center gap-1",children:[e.jsx(V,{className:"w-3.5 h-3.5 text-champagne-400"})," AES-256 (v",c.keyVersion,")"]})]})]})]}),e.jsxs("div",{className:"mt-5 pt-3 border-t border-white/10 flex items-center gap-2",children:[e.jsxs(I,{to:`/dashboard/bots/${((N=c.username)==null?void 0:N.replace("@",""))||c.id}`,onClick:()=>s&&s(c.id),className:"flex-1 btn-astraea-subtle py-2 text-[11px] justify-center inline-flex items-center gap-1.5",children:[e.jsx(ls,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"TELEMETRY"})]}),e.jsx(I,{to:"/dashboard/studio",onClick:()=>s&&s(c.id),className:"btn-astraea-gold py-2 px-3 text-[11px] justify-center inline-flex items-center",title:"Open Studio",children:e.jsx("span",{children:"STUDIO"})})]})]},c.id)})}),r&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4 bg-black/80 backdrop-blur-md",children:e.jsxs("div",{className:"w-full max-w-lg max-h-[90vh] overflow-y-auto astraea-panel-gold rounded-xl p-4 sm:p-6 border border-champagne-400/40 shadow-luxury animate-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-white/10 mb-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-cinzel text-lg text-pearl-50 font-normal tracking-wide",children:"Connect Telegram Bot"}),e.jsx("p",{className:"text-xs font-mono text-champagne-400 mt-0.5",children:"Telegram BotFather Token Cryptographic Registration"})]}),e.jsx("button",{onClick:()=>i(!1),className:"text-pearl-400 hover:text-pearl-100 p-1",children:e.jsx(F,{className:"w-5 h-5"})})]}),g?e.jsxs("div",{className:"py-8 text-center space-y-3",children:[e.jsx($,{className:"w-12 h-12 text-emerald-400 mx-auto animate-bounce"}),e.jsx("div",{className:"text-sm font-cinzel text-pearl-50",children:g})]}):e.jsxs("form",{onSubmit:x,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase tracking-widest text-pearl-400 mb-1.5",children:"Bot Display Name"}),e.jsx("input",{type:"text",value:m,onChange:c=>d(c.target.value),placeholder:"e.g. VIP Concierge Bot",className:"w-full px-3.5 py-2.5 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase tracking-widest text-pearl-400 mb-1.5",children:"Telegram Bot Token (from @BotFather)"}),e.jsx("input",{type:"password",required:!0,value:o,onChange:c=>h(c.target.value),placeholder:"123456789:ABCdefGHIjklMNOpqrSTUvwxYZ",className:"w-full px-3.5 py-2.5 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/60"}),e.jsxs("p",{className:"text-[10px] font-mono text-pearl-400 mt-1 flex items-center gap-1",children:[e.jsx(V,{className:"w-3.5 h-3.5 text-champagne-400"}),"Token is validated using Telegram getMe and encrypted with AES-256-GCM."]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase tracking-widest text-pearl-400 mb-1.5",children:"Default Bot Language"}),e.jsxs("select",{value:u,onChange:c=>p(c.target.value),className:"w-full px-3.5 py-2.5 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/60",children:[e.jsx("option",{value:"en",children:"English (en)"}),e.jsx("option",{value:"hi",children:"Hindi (hi)"}),e.jsx("option",{value:"hi-Latn",children:"Hinglish (hi-Latn)"}),e.jsx("option",{value:"ar",children:"Arabic (ar - RTL)"}),e.jsx("option",{value:"es",children:"Spanish (es)"}),e.jsx("option",{value:"fr",children:"French (fr)"}),e.jsx("option",{value:"de",children:"German (de)"}),e.jsx("option",{value:"ru",children:"Russian (ru)"}),e.jsx("option",{value:"ja",children:"Japanese (ja)"})]})]}),e.jsxs("div",{className:"pt-4 border-t border-white/10 flex flex-col sm:flex-row items-stretch sm:items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:()=>i(!1),className:"btn-astraea-subtle py-2 px-4 justify-center",children:"CANCEL"}),e.jsx("button",{type:"submit",disabled:v,className:"btn-astraea-gold py-2 px-5 justify-center",children:v?e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"VALIDATING..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"REGISTER & ENCRYPT"})]})})]})]})]})})]})},Rl=({botId:t,onNavigate:s})=>{const{slug:a}=Fs();Y();const n=t||a||"astraea-flagship";return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300 min-w-0 max-w-full",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 border-b border-white/10 pb-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 sm:w-14 sm:h-14 rounded-xl bg-champagne-500/10 border border-champagne-400/40 flex items-center justify-center text-champagne-400 shadow-luxury-gold shrink-0",children:e.jsx(q,{className:"w-6 h-6 sm:w-8 sm:h-8"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-ping"}),e.jsx("span",{className:"text-[10px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"Bot Hardware & Webhook Telemetry"})]}),e.jsx("h1",{className:"font-cinzel text-xl sm:text-2xl md:text-3xl text-pearl-50 font-light tracking-wide",children:"Astraea Flagship Super Bot"}),e.jsxs("div",{className:"text-xs font-mono text-pearl-300 flex flex-wrap items-center gap-2 sm:gap-3 mt-1",children:[e.jsx("span",{className:"text-champagne-400",children:"@astraea_flagship_bot"}),e.jsx("span",{className:"hidden sm:inline",children:"ยท"}),e.jsxs("span",{className:"text-pearl-400",children:["ID: ",n]}),e.jsx("span",{className:"hidden sm:inline",children:"ยท"}),e.jsx("span",{className:"text-emerald-400 uppercase font-semibold",children:"99.98% UPTIME"})]})]})]}),e.jsx("div",{className:"flex items-center gap-3 w-full sm:w-auto",children:e.jsxs(I,{to:"/dashboard/studio",className:"btn-astraea-gold w-full sm:w-auto justify-center inline-flex items-center gap-1.5",children:[e.jsx("span",{children:"MESSAGE STUDIO"}),e.jsx(Ee,{className:"w-4 h-4"})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6",children:[e.jsxs("div",{className:"astraea-panel rounded-xl p-5 border border-white/10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-pearl-200 uppercase font-semibold",children:[e.jsx(Nt,{className:"w-4 h-4 text-champagne-400"}),e.jsx("span",{children:"Token Vault Security"})]}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono uppercase bg-emerald-500/10 text-emerald-300 border border-emerald-500/30",children:"AES-256-GCM"})]}),e.jsxs("div",{className:"space-y-3 text-xs font-mono text-pearl-300",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-pearl-400 uppercase mb-1",children:"Storage Status"}),e.jsxs("div",{className:"text-pearl-100 font-semibold flex items-center gap-1.5",children:[e.jsx(V,{className:"w-4 h-4 text-emerald-400"}),e.jsx("span",{children:"Encrypted at Rest with Key Version 1"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-pearl-400 uppercase mb-1",children:"Masked Hash"}),e.jsx("div",{className:"p-2 rounded bg-space-900 border border-white/5 text-[11px] text-pearl-400 select-all",children:"$aes-gcm$v1$9f8b4a2e...c710d8a1"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-pearl-400 uppercase mb-1",children:"Telegram Verification"}),e.jsx("div",{className:"text-emerald-400 flex items-center gap-1",children:e.jsx("span",{children:"Verified via getMe (ID: 7182910392)"})})]})]})]}),e.jsxs("div",{className:"astraea-panel rounded-xl p-5 border border-white/10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-pearl-200 uppercase font-semibold",children:[e.jsx(ue,{className:"w-4 h-4 text-champagne-400"}),e.jsx("span",{children:"Webhook Telemetry"})]}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono uppercase bg-emerald-500/10 text-emerald-300 border border-emerald-500/30",children:"VERIFIED"})]}),e.jsxs("div",{className:"space-y-3 text-xs font-mono text-pearl-300",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-pearl-400 uppercase mb-1",children:"Webhook Endpoint"}),e.jsxs("div",{className:"p-2 rounded bg-space-900 border border-white/5 text-[11px] text-champagne-300 select-all truncate",children:["https://api.yourdomain.com/webhooks/telegram/",t]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-pearl-400 uppercase mb-1",children:"Secret Token Hash"}),e.jsx("div",{className:"p-2 rounded bg-space-900 border border-white/5 text-[11px] text-pearl-400 truncate",children:"sha256:d9b4c0e...8f2a17"})]}),e.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[e.jsx("span",{className:"text-pearl-400",children:"Max Connections:"}),e.jsx("span",{className:"text-pearl-100 font-semibold",children:"100 concurrent"})]})]})]}),e.jsxs("div",{className:"astraea-panel rounded-xl p-5 border border-white/10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-pearl-200 uppercase font-semibold",children:[e.jsx(ge,{className:"w-4 h-4 text-champagne-400"}),e.jsx("span",{children:"Throughput & Latency"})]}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono uppercase bg-emerald-500/10 text-emerald-300 border border-emerald-500/30",children:"38 MS AVG"})]}),e.jsxs("div",{className:"space-y-3 text-xs font-mono text-pearl-300",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-pearl-400",children:"Update Deduplication:"}),e.jsx("span",{className:"text-emerald-400",children:"Redis Bloom Active"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-pearl-400",children:"Celery Task Rate:"}),e.jsx("span",{className:"text-pearl-100 font-semibold",children:"1,240 updates / min"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-pearl-400",children:"Rate Limit Retries:"}),e.jsx("span",{className:"text-emerald-400",children:"0 dropped (Exponential backoff)"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-pearl-400",children:"Default Locale:"}),e.jsx("span",{className:"text-champagne-300 font-semibold uppercase",children:"en (English)"})]})]})]})]}),e.jsxs("div",{className:"astraea-panel rounded-xl p-4 sm:p-6 border border-white/10 min-w-0 max-w-full overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between pb-4 border-b border-white/10 mb-4 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(wt,{className:"w-5 h-5 text-champagne-400"}),e.jsx("h3",{className:"font-cinzel text-lg text-pearl-50 font-normal tracking-wide",children:"Registered Bot Commands"})]}),e.jsx("span",{className:"text-xs font-mono text-pearl-400",children:"Synchronized with Telegram setMyCommands"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4",children:[{cmd:"/start",desc:"Initialize conversation & display VIP menu",role:"public"},{cmd:"/help",desc:"Interactive guidance & support concierge",role:"public"},{cmd:"/price",desc:"Real-time crypto asset quotes & charts",role:"plugin"},{cmd:"/lang",desc:"Interactive 16-language selector picker",role:"i18n"},{cmd:"/optout",desc:"Manage broadcast delivery preferences",role:"privacy"},{cmd:"/account",desc:"Inspect subscription tier & wallet balance",role:"billing"},{cmd:"/ai",desc:"Invoke autonomous LLM customer support",role:"ai"},{cmd:"/support",desc:"Route inquiry to live support operator",role:"plugin"}].map((r,i)=>e.jsxs("div",{className:"p-3.5 rounded-lg bg-space-850/60 border border-white/5 hover:border-champagne-400/30 transition-all font-mono text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-champagne-400 font-bold text-sm",children:r.cmd}),e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] uppercase bg-space-800 text-pearl-400 border border-white/10",children:r.role})]}),e.jsx("p",{className:"text-[11px] text-pearl-300 font-sans leading-relaxed",children:r.desc})]},i))})]})]})},Ll=[{id:"c-001",title:"Spring Flash Sale 2026 โ€” VIP Access",status:"completed",totalRecipients:14280,deliveredCount:14251,failedCount:29,rateLimitPerSec:25,targetLocale:"en",messageSnippet:"๐Ÿ”ฅ Exclusive Offer: Claim 50% discount with code SPRING50!",startedAt:"2026-11-18T08:00:00Z"},{id:"c-002",title:"Hinglish Community Weekend Update",status:"running",totalRecipients:6890,deliveredCount:4120,failedCount:12,rateLimitPerSec:25,targetLocale:"hi-Latn",messageSnippet:"Bhai! Check out the newly added Telegram Premium custom emojis...",startedAt:"2026-11-18T09:00:00Z"},{id:"c-003",title:"Scheduled Global Platform Maintenance",status:"draft",totalRecipients:31200,deliveredCount:0,failedCount:0,rateLimitPerSec:25,messageSnippet:"Notice: Platform maintenance scheduled for Sunday 02:00 UTC."}],Ml=()=>{const[t,s]=l.useState(Ll),[a,n]=l.useState(!1),[r,i]=l.useState(""),[o,h]=l.useState(""),[m,d]=l.useState("all"),[u,p]=l.useState(25),[v,f]=l.useState(!1),g=async c=>{if(c.preventDefault(),!(!r.trim()||!o.trim())){f(!0);try{const N=await fetch("/api/v1/broadcasts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bot_id:"b-001",title:r,message_text:o,target_filter:m==="all"?{}:{locale:m},rate_limit_per_second:u,inline_keyboard:[[{text:"Explore Now ๐ŸŒŸ",url:"https://example.com"}]]})}),S={id:`c-${Date.now()}`,title:r,status:"draft",totalRecipients:14280,deliveredCount:0,failedCount:0,rateLimitPerSec:u,targetLocale:m==="all"?void 0:m,messageSnippet:o.slice(0,70)};s([S,...t]),n(!1),i(""),h("")}catch{n(!1)}finally{f(!1)}}},j=c=>{s(b=>b.map(N=>N.id===c?{...N,status:"running",startedAt:new Date().toISOString(),deliveredCount:Math.floor(N.totalRecipients*.98)}:N))},x=c=>{s(b=>b.map(N=>N.id!==c?N:{...N,status:N.status==="running"?"paused":"running"}))};return e.jsxs("div",{className:"space-y-6 sm:space-y-8 animate-in fade-in duration-300 min-w-0 max-w-full",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 border-b border-white/10 pb-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-champagne-400"}),e.jsx("span",{className:"text-[10px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"High-Throughput Campaign Engine"})]}),e.jsx("h1",{className:"font-cinzel text-2xl sm:text-3xl md:text-4xl text-pearl-50 font-light tracking-wide",children:"Broadcast Campaigns"}),e.jsx("p",{className:"text-xs text-pearl-400 font-sans mt-1.5 max-w-2xl leading-relaxed",children:"Dispatch rate-limited bulk broadcasts strictly adhering to Telegram's 25โ€“30 msgs/second limit with real-time opt-out filtering, delivery statistics, and error tracking."})]}),e.jsxs("button",{onClick:()=>n(!0),className:"btn-astraea-gold w-full sm:w-auto justify-center py-2.5 px-4 shrink-0",children:[e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:"NEW BROADCAST"})]})]}),e.jsx("div",{className:"astraea-panel rounded-xl p-3 sm:p-5 border border-white/10 overflow-hidden min-w-0 max-w-full",children:e.jsx("div",{className:"overflow-x-auto w-full max-w-full",children:e.jsxs("table",{className:"w-full min-w-[650px] text-left text-xs font-mono",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/10 text-[10px] text-pearl-400 uppercase tracking-widest",children:[e.jsx("th",{className:"pb-3 pl-2",children:"Campaign Title"}),e.jsx("th",{className:"pb-3",children:"Audience Filter"}),e.jsx("th",{className:"pb-3",children:"Status"}),e.jsx("th",{className:"pb-3",children:"Delivered / Total"}),e.jsx("th",{className:"pb-3",children:"Delivery Rate"}),e.jsx("th",{className:"pb-3 pr-2 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:t.map(c=>{const b=c.totalRecipients>0?Math.round(c.deliveredCount/c.totalRecipients*100):0;return e.jsxs("tr",{className:"hover:bg-white/[0.02] transition-colors",children:[e.jsxs("td",{className:"py-4 pl-2 font-medium text-pearl-100",children:[e.jsx("div",{className:"text-sm font-cinzel text-pearl-50",children:c.title}),e.jsx("div",{className:"text-[11px] font-sans text-pearl-400 truncate max-w-md mt-0.5",children:c.messageSnippet})]}),e.jsx("td",{className:"py-4 text-pearl-300",children:c.targetLocale?e.jsxs("span",{className:"px-2 py-0.5 rounded bg-space-850 border border-white/10 text-[10px] uppercase text-champagne-300",children:["Locale: ",c.targetLocale]}):e.jsx("span",{className:"text-pearl-400 text-[10px]",children:"All Eligible (Opted-in)"})}),e.jsx("td",{className:"py-4",children:e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] uppercase font-semibold ${c.status==="completed"?"bg-emerald-500/10 text-emerald-300 border border-emerald-500/30":c.status==="running"?"bg-champagne-500/15 text-champagne-300 border border-champagne-400/40 animate-pulse":c.status==="paused"?"bg-amber-500/10 text-amber-300 border border-amber-500/30":"bg-space-850 text-pearl-400 border border-white/10"}`,children:c.status})}),e.jsxs("td",{className:"py-4 text-pearl-200",children:[e.jsxs("div",{children:[c.deliveredCount.toLocaleString()," / ",c.totalRecipients.toLocaleString()]}),c.failedCount>0&&e.jsxs("div",{className:"text-[10px] text-rose-400",children:[c.failedCount," failed"]})]}),e.jsxs("td",{className:"py-4",children:[e.jsx("div",{className:"w-32 bg-space-850 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-champagne-400 to-emerald-400 h-1.5 transition-all duration-500",style:{width:`${b}%`}})}),e.jsxs("span",{className:"text-[10px] text-pearl-400 mt-1 block",children:[b,"% complete (",c.rateLimitPerSec," msg/s)"]})]}),e.jsx("td",{className:"py-4 pr-2 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.status==="draft"&&e.jsxs("button",{onClick:()=>j(c.id),className:"btn-astraea-gold py-1 px-3 text-[10px]",children:[e.jsx(we,{className:"w-3 h-3"}),e.jsx("span",{children:"DISPATCH"})]}),(c.status==="running"||c.status==="paused")&&e.jsxs("button",{onClick:()=>x(c.id),className:"btn-astraea-subtle py-1 px-2.5 text-[10px]",children:[c.status==="running"?e.jsx(Ta,{className:"w-3 h-3 text-amber-400"}):e.jsx(we,{className:"w-3 h-3 text-emerald-400"}),e.jsx("span",{children:c.status==="running"?"PAUSE":"RESUME"})]}),c.status==="completed"&&e.jsxs("span",{className:"text-[10px] text-emerald-400 flex items-center gap-1 justify-end",children:[e.jsx($,{className:"w-3.5 h-3.5"})," Delivered"]})]})})]},c.id)})})]})})}),a&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4 bg-black/80 backdrop-blur-md",children:e.jsxs("div",{className:"w-full max-w-xl max-h-[90vh] overflow-y-auto astraea-panel-gold rounded-xl p-4 sm:p-6 border border-champagne-400/40 shadow-luxury animate-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-white/10 mb-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-cinzel text-lg text-pearl-50 font-normal tracking-wide",children:"Compose Campaign Broadcast"}),e.jsx("p",{className:"text-xs font-mono text-champagne-400 mt-0.5",children:"Telegram-Compliant Rate-Limited Bulk Messaging"})]}),e.jsx("button",{onClick:()=>n(!1),className:"text-pearl-400 hover:text-pearl-100 p-1",children:e.jsx(F,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase tracking-widest text-pearl-400 mb-1.5",children:"Campaign Title"}),e.jsx("input",{type:"text",required:!0,value:r,onChange:c=>i(c.target.value),placeholder:"e.g. Black Friday VIP Announcement",className:"w-full px-3.5 py-2.5 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase tracking-widest text-pearl-400 mb-1.5",children:"Message Content (Telegram HTML Supported)"}),e.jsx("textarea",{rows:4,required:!0,value:o,onChange:c=>h(c.target.value),placeholder:"๐Ÿ”ฅ Exclusive Offer: Get 50% discount using code VIP50!",className:"w-full px-3.5 py-2.5 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/60"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase tracking-widest text-pearl-400 mb-1.5",children:"Target Audience Locale"}),e.jsxs("select",{value:m,onChange:c=>d(c.target.value),className:"w-full px-3.5 py-2.5 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/60",children:[e.jsx("option",{value:"all",children:"All Locales (Exclude Opted-out)"}),e.jsx("option",{value:"en",children:"English (en)"}),e.jsx("option",{value:"hi",children:"Hindi (hi)"}),e.jsx("option",{value:"hi-Latn",children:"Hinglish (hi-Latn)"}),e.jsx("option",{value:"es",children:"Spanish (es)"}),e.jsx("option",{value:"ar",children:"Arabic (ar)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase tracking-widest text-pearl-400 mb-1.5",children:"Dispatch Rate Limit"}),e.jsxs("select",{value:u,onChange:c=>p(Number(c.target.value)),className:"w-full px-3.5 py-2.5 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/60",children:[e.jsx("option",{value:25,children:"25 msgs / sec (Recommended Safe)"}),e.jsx("option",{value:20,children:"20 msgs / sec (Conservative)"}),e.jsx("option",{value:30,children:"30 msgs / sec (Telegram Max)"})]})]})]}),e.jsxs("div",{className:"p-3 rounded bg-space-850 border border-white/5 text-[11px] font-mono text-pearl-300",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-champagne-400 font-semibold mb-1",children:[e.jsx(z,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Audience Safety Check"})]}),"Blocked users and opted-out subscribers (/stop or /optout) will be strictly excluded automatically before dispatch."]}),e.jsxs("div",{className:"pt-4 border-t border-white/10 flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:()=>n(!1),className:"btn-astraea-subtle py-2 px-4",children:"CANCEL"}),e.jsxs("button",{type:"submit",disabled:v,className:"btn-astraea-gold py-2 px-5",children:[e.jsx(yt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"SAVE CAMPAIGN"})]})]})]})]})})]})},es=[{id:"agent-1",name:"Customer Concierge & Support",provider:"openai",model:"gpt-4o-mini",systemPrompt:"You are a luxury customer concierge for our Telegram bot SaaS platform. Be concise, polite, and helpful.",temperature:.6,maxTokens:800,isActive:!0,totalTokens:421e3},{id:"agent-2",name:"Autonomous Sales & Onboarding",provider:"openrouter",model:"anthropic/claude-3.5-sonnet",systemPrompt:"You are an enterprise sales advisor. Explain subscription tiers, pricing, and bot automation capabilities.",temperature:.7,maxTokens:1200,isActive:!0,totalTokens:229e3}],Dl=()=>{const[t,s]=l.useState(es),[a,n]=l.useState(es[0]),[r,i]=l.useState(!1),[o,h]=l.useState(!1),[m,d]=l.useState([{id:"k-1",provider:"openai",name:"OpenAI Production Key",masked:"sk-proj...9f21"},{id:"k-2",provider:"openrouter",name:"OpenRouter Claude Key",masked:"sk-or...b401"}]),[u,p]=l.useState([{role:"assistant",content:"Greetings. I am your autonomous AI Concierge. How may I assist your Telegram bot subscribers today?",tokens:28,costCents:.001}]),[v,f]=l.useState(""),[g,j]=l.useState(!1),x=async c=>{if(c.preventDefault(),!v.trim()||g)return;const b=v.trim();f(""),p(N=>[...N,{role:"user",content:b}]),j(!0);try{const N=await fetch(`/api/v1/ai/agents/${a.id}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:b})});if(N.ok){const S=await N.json();p(C=>{var w,A,k;return[...C,{role:"assistant",content:((w=S.data)==null?void 0:w.content)||"Completion generated successfully.",tokens:((A=S.data)==null?void 0:A.total_tokens)||45,costCents:((k=S.data)==null?void 0:k.cost_cents)||.002}]})}else setTimeout(()=>{p(S=>[...S,{role:"assistant",content:`๐Ÿค– [${a.name}]: I have processed your inquiry about "${b}". All parameters are verified and operational.`,tokens:52,costCents:.0025}])},600)}catch{setTimeout(()=>{p(N=>[...N,{role:"assistant",content:`๐Ÿค– [${a.name}]: I have received your message: "${b}".`,tokens:35,costCents:.0015}])},500)}finally{j(!1)}};return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300 min-w-0 max-w-full",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 border-b border-white/10 pb-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-champagne-400"}),e.jsx("span",{className:"text-[10px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"Autonomous Intelligence Center"})]}),e.jsx("h1",{className:"font-cinzel text-2xl sm:text-3xl md:text-4xl text-pearl-50 font-light tracking-wide",children:"AI Agents & Models"}),e.jsx("p",{className:"text-xs text-pearl-400 font-sans mt-1.5 max-w-2xl leading-relaxed",children:"Configure multi-turn autonomous LLM agents using OpenAI (GPT-4o) and OpenRouter (Claude 3.5 Sonnet). Encrypted API keys, prompt engineering, and real-time cost tracking."})]}),e.jsxs("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-2 sm:gap-3 w-full sm:w-auto",children:[e.jsxs("button",{onClick:()=>h(!0),className:"btn-astraea-subtle flex-1 sm:flex-initial justify-center py-2.5 px-3",children:[e.jsx(Mt,{className:"w-3.5 h-3.5 text-champagne-400"}),e.jsx("span",{children:"API KEYS VAULT"})]}),e.jsxs("button",{onClick:()=>i(!0),className:"btn-astraea-gold flex-1 sm:flex-initial justify-center py-2.5 px-4",children:[e.jsx(K,{className:"w-4 h-4"}),e.jsx("span",{children:"CREATE AGENT"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[e.jsxs("div",{className:"lg:col-span-5 space-y-4",children:[e.jsxs("div",{className:"text-xs font-cinzel text-pearl-200 uppercase tracking-wider font-semibold flex items-center justify-between",children:[e.jsx("span",{children:"Configured Agents"}),e.jsx("span",{className:"text-[10px] font-mono text-champagne-400 font-normal",children:"PRO TIER ENTITLEMENT ACTIVE"})]}),e.jsx("div",{className:"space-y-3",children:t.map(c=>{const b=c.id===a.id;return e.jsxs("div",{onClick:()=>n(c),className:`p-4 rounded-xl border cursor-pointer transition-all ${b?"bg-space-850 border-champagne-400/50 shadow-luxury-gold":"bg-space-900/60 border-white/10 hover:border-white/20"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 rounded bg-champagne-500/10 border border-champagne-400/30 flex items-center justify-center text-champagne-400",children:e.jsx(is,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-cinzel text-sm text-pearl-100 font-medium",children:c.name})]}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[9px] font-mono uppercase bg-emerald-500/10 text-emerald-300 border border-emerald-500/30",children:"ACTIVE"})]}),e.jsxs("div",{className:"text-xs font-mono text-champagne-300 flex items-center gap-2",children:[e.jsx("span",{className:"uppercase text-[10px] text-pearl-400",children:"Model:"}),e.jsx("span",{children:c.model}),e.jsx("span",{children:"ยท"}),e.jsx("span",{className:"uppercase text-[10px] text-pearl-400",children:"Temp:"}),e.jsx("span",{children:c.temperature})]}),e.jsxs("p",{className:"text-[11px] font-sans text-pearl-400 mt-2 line-clamp-2 leading-relaxed",children:['"',c.systemPrompt,'"']}),e.jsxs("div",{className:"mt-3 pt-3 border-t border-white/5 flex items-center justify-between text-[10px] font-mono text-pearl-400",children:[e.jsxs("span",{children:["Tokens: ",c.totalTokens.toLocaleString()]}),e.jsx("span",{className:"text-champagne-400",children:"Click to test console"})]})]},c.id)})})]}),e.jsxs("div",{className:"lg:col-span-7 astraea-panel rounded-xl border border-white/10 flex flex-col h-[460px] sm:h-[520px] lg:h-[580px] min-w-0 max-w-full overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-white/10 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-champagne-500/10 border border-champagne-400/30 flex items-center justify-center text-champagne-400",children:e.jsx(ge,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-xs font-cinzel text-pearl-100 font-semibold",children:["Test Console: ",a.name]}),e.jsxs("div",{className:"text-[10px] font-mono text-champagne-400",children:[a.provider.toUpperCase()," ยท ",a.model]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-mono text-pearl-400",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),e.jsx("span",{children:"Realtime Sandbox"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:[u.map((c,b)=>e.jsxs("div",{className:`flex flex-col ${c.role==="user"?"items-end":"items-start"}`,children:[e.jsx("div",{className:`max-w-[85%] rounded-xl px-4 py-3 text-xs leading-relaxed font-sans ${c.role==="user"?"bg-champagne-500/20 border border-champagne-400/40 text-pearl-50 rounded-br-none":"bg-space-850 border border-white/10 text-pearl-200 rounded-bl-none shadow-luxury"}`,children:c.content}),c.tokens!==void 0&&e.jsxs("span",{className:"text-[9px] font-mono text-pearl-400 mt-1 px-1",children:[c.tokens," tokens ยท $",c.costCents]})]},b)),g&&e.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-champagne-400",children:[e.jsx(de,{className:"w-3.5 h-3.5 animate-spin"}),e.jsxs("span",{children:["Generating completion from ",a.model,"..."]})]})]}),e.jsxs("form",{onSubmit:x,className:"p-4 border-t border-white/10 flex items-center gap-2",children:[e.jsx("input",{type:"text",value:v,onChange:c=>f(c.target.value),placeholder:"Test prompt for the agent (e.g. How do I configure my bot?)...",className:"flex-1 px-4 py-2.5 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/60"}),e.jsx("button",{type:"submit",disabled:g||!v.trim(),className:"btn-astraea-gold py-2.5 px-4",children:e.jsx(yt,{className:"w-3.5 h-3.5"})})]})]})]}),o&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4 bg-black/80 backdrop-blur-md",children:e.jsxs("div",{className:"w-full max-w-lg max-h-[90vh] overflow-y-auto astraea-panel-gold rounded-xl p-4 sm:p-6 border border-champagne-400/40 shadow-luxury animate-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-white/10 mb-5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mt,{className:"w-5 h-5 text-champagne-400"}),e.jsx("h3",{className:"font-cinzel text-lg text-pearl-50 font-normal tracking-wide",children:"Encrypted LLM API Keys Vault"})]}),e.jsx("button",{onClick:()=>h(!1),className:"text-pearl-400 hover:text-pearl-100 p-1",children:e.jsx(F,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"space-y-3 mb-5",children:m.map(c=>e.jsxs("div",{className:"p-3.5 rounded-lg bg-space-900 border border-white/10 flex items-center justify-between text-xs font-mono",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-pearl-100 font-semibold",children:c.name}),e.jsxs("div",{className:"text-champagne-400 text-[11px] uppercase mt-0.5",children:[c.provider," ยท ",c.masked]})]}),e.jsxs("span",{className:"text-[10px] text-emerald-400 flex items-center gap-1",children:[e.jsx(V,{className:"w-3.5 h-3.5"})," AES-256"]})]},c.id))}),e.jsxs("div",{className:"p-3 rounded bg-space-850 border border-white/5 text-[11px] font-mono text-pearl-300",children:[e.jsx("span",{className:"text-champagne-400 font-semibold",children:"Security Policy:"})," All tenant API keys are encrypted at rest with AES-256-GCM. Unencrypted keys are never transmitted to client browsers or logged."]}),e.jsx("div",{className:"mt-5 pt-4 border-t border-white/10 text-right",children:e.jsx("button",{onClick:()=>h(!1),className:"btn-astraea-gold py-2 px-5",children:"CLOSE VAULT"})})]})})]})},ts=[{id:"welcome_captcha",name:"Welcome Math & Button CAPTCHA",category:"security",version:"1.2.0",description:"Enforces interactive anti-bot verification when new members join Telegram groups before unmuting.",permissions:["messages:write","users:read"],isInstalled:!0,defaultConfig:{timeout_seconds:60,difficulty:"easy"}},{id:"crypto_price_tracker",name:"Crypto Price & Threshold Alerts",category:"finance",version:"2.0.1",description:"Provides live /price command quotes and automated broadcast alerts for BTC, ETH, and TON.",permissions:["messages:write","external:http"],isInstalled:!0,defaultConfig:{default_currency:"USD",coins:["BTC","ETH","TON"]}},{id:"sentiment_analyzer",name:"Real-Time Sentiment & Escalate",category:"ai",version:"1.0.4",description:"Analyzes user chat sentiment (positive, neutral, negative) and auto-flags angry messages for VIP support.",permissions:["messages:read","messages:write"],isInstalled:!1,defaultConfig:{negative_threshold:.7,auto_escalate:!0}},{id:"auto_support_router",name:"Intelligent Support FAQ Router",category:"support",version:"1.4.0",description:"Keyword-based dynamic FAQ matching with instant handoff to live human operator queue.",permissions:["messages:read","messages:write"],isInstalled:!1,defaultConfig:{trigger_keywords:["help","refund","agent"]}}],Ol=()=>{const[t,s]=l.useState(ts),[a,n]=l.useState(ts[1]),[r,i]=l.useState("price"),[o,h]=l.useState("BTC"),[m,d]=l.useState({symbol:"BTC",price_usd:96450,formatted:"$96,450.00","24h_change":"+3.45%",source:"Sandboxed In-Memory Crypto Mock Engine"}),[u,p]=l.useState(!1),v=async()=>{var g;p(!0);try{const j=await fetch(`/api/v1/plugins/${a.id}/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hook_name:"on_command",payload:{command:r,args:[o]}})});if(j.ok){const x=await j.json();d(((g=x.data)==null?void 0:g.output)||{status:"success"})}else setTimeout(()=>{d({symbol:o.toUpperCase(),price_usd:o.toUpperCase()==="ETH"?3420.5:96450,formatted:o.toUpperCase()==="ETH"?"$3,420.50":"$96,450.00","24h_change":"+2.8%",timestamp:new Date().toISOString()}),p(!1)},500)}catch{setTimeout(()=>{d({symbol:o.toUpperCase(),price_usd:96450,formatted:"$96,450.00",execution:"Sandboxed sandbox OK"}),p(!1)},400)}},f=g=>{s(j=>j.map(x=>x.id===g?{...x,isInstalled:!x.isInstalled}:x))};return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300 min-w-0 max-w-full",children:[e.jsx("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4 border-b border-white/10 pb-6",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-champagne-400"}),e.jsx("span",{className:"text-[10px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"Sandboxed Extensibility Framework"})]}),e.jsx("h1",{className:"font-cinzel text-3xl md:text-4xl text-pearl-50 font-light tracking-wide",children:"Plugins & Hook Registry"}),e.jsx("p",{className:"text-xs text-pearl-400 font-sans mt-1.5 max-w-2xl leading-relaxed",children:"Enhance bot capabilities with isolated plugins. Each plugin runs with strict capability permission checks (e.g. messages:read, messages:write, external:http) and safe timeout execution."})]})}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:t.map(g=>e.jsxs("div",{onClick:()=>n(g),className:`astraea-panel rounded-xl p-5 border flex flex-col justify-between cursor-pointer transition-all ${a.id===g.id?"border-champagne-400/50 shadow-luxury-gold bg-space-850":"border-white/10 hover:border-white/20"}`,children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("span",{className:"text-[10px] font-mono uppercase px-2 py-0.5 rounded bg-space-800 border border-white/10 text-champagne-400",children:[g.category," ยท v",g.version]}),e.jsx("span",{className:`px-2 py-0.5 rounded text-[9px] font-mono uppercase ${g.isInstalled?"bg-emerald-500/10 text-emerald-300 border border-emerald-500/30":"bg-space-800 text-pearl-400"}`,children:g.isInstalled?"ACTIVE":"AVAILABLE"})]}),e.jsx("h3",{className:"font-cinzel text-base text-pearl-50 font-normal tracking-wide",children:g.name}),e.jsx("p",{className:"text-xs font-sans text-pearl-300 mt-2 leading-relaxed",children:g.description}),e.jsxs("div",{className:"mt-4 pt-3 border-t border-white/5 space-y-1",children:[e.jsx("div",{className:"text-[10px] font-mono text-pearl-400 uppercase",children:"Required Capabilities:"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.permissions.map((j,x)=>e.jsx("span",{className:"px-1.5 py-0.5 rounded bg-space-900 border border-white/10 text-[9px] font-mono text-pearl-300",children:j},x))})]})]}),e.jsxs("div",{className:"mt-5 pt-3 border-t border-white/10 flex items-center justify-between",children:[e.jsx("button",{onClick:j=>{j.stopPropagation(),f(g.id)},className:`py-1.5 px-3 text-[11px] font-mono uppercase rounded transition-all ${g.isInstalled?"bg-rose-500/15 border border-rose-500/30 text-rose-300 hover:bg-rose-500/25":"btn-astraea-gold text-[10px] py-1 px-3"}`,children:g.isInstalled?"DEACTIVATE":"INSTALL PLUGIN"}),e.jsx("span",{className:"text-[10px] font-mono text-champagne-400",children:"Inspect Hook"})]})]},g.id))}),e.jsxs("div",{className:"astraea-panel rounded-xl p-4 sm:p-6 border border-white/10 space-y-4 min-w-0 max-w-full overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-4 border-b border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-champagne-500/10 border border-champagne-400/30 flex items-center justify-center text-champagne-400 shrink-0",children:e.jsx(wt,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-cinzel text-sm sm:text-base text-pearl-50 font-normal tracking-wide",children:["Sandboxed Hook Tester: ",a.name]}),e.jsx("p",{className:"text-[11px] sm:text-xs font-mono text-champagne-400 mt-0.5",children:"Simulate hook invocation with capability checks in isolated worker context"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("span",{className:"text-xs font-mono text-pearl-400",children:"Hook:"}),e.jsx("span",{className:"px-2 py-1 rounded bg-space-900 border border-white/10 text-xs font-mono text-champagne-300",children:"on_command"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase text-pearl-400 mb-1",children:"Command"}),e.jsx("input",{type:"text",value:r,onChange:g=>i(g.target.value),className:"w-full px-3 py-2 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase text-pearl-400 mb-1",children:"Argument"}),e.jsx("input",{type:"text",value:o,onChange:g=>h(g.target.value),className:"w-full px-3 py-2 rounded bg-space-900 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/50"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs("button",{onClick:v,disabled:u,className:"w-full btn-astraea-gold py-2 text-xs",children:[u?e.jsx(de,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(we,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"TRIGGER HOOK"})]})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-mono uppercase text-pearl-400 mb-1.5",children:"Sandboxed Execution Output (JSON)"}),e.jsx("pre",{className:"p-4 rounded-lg bg-space-950 border border-white/10 text-xs font-mono text-emerald-300 overflow-x-auto",children:JSON.stringify(m,null,2)})]})]})]})},Bl=[{id:"u-1",telegramUserId:589102482,name:"Alexander Stone",username:"astone_vip",locale:"en",isBlocked:!1,isOptedOut:!1,firstSeen:"2026-10-12"},{id:"u-2",telegramUserId:610928374,name:"Rohit Sharma",username:"rohit_sharma_99",locale:"hi",isBlocked:!1,isOptedOut:!1,firstSeen:"2026-10-18"},{id:"u-3",telegramUserId:729103845,name:"Elena Rostova",username:"elena_r",locale:"ru",isBlocked:!1,isOptedOut:!0,firstSeen:"2026-10-25"},{id:"u-4",telegramUserId:819203948,name:"Tariq Al-Mansoor",username:"tariq_m",locale:"ar",isBlocked:!0,isOptedOut:!1,firstSeen:"2026-11-02"},{id:"u-5",telegramUserId:902837482,name:"Aanya Patel",username:"aanya_p",locale:"hi-Latn",isBlocked:!1,isOptedOut:!1,firstSeen:"2026-11-08"}],Fl=()=>{const[t,s]=l.useState(Bl),[a,n]=l.useState(""),[r,i]=l.useState("all"),o=async m=>{s(d=>d.map(u=>{if(u.id!==m)return u;const p=!u.isOptedOut;return fetch("/api/v1/broadcasts/opt-out",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bot_id:"b-001",telegram_user_id:u.telegramUserId,opt_out:p})}).catch(()=>{}),{...u,isOptedOut:p}}))},h=t.filter(m=>{const d=m.name.toLowerCase().includes(a.toLowerCase())||m.username.toLowerCase().includes(a.toLowerCase())||m.telegramUserId.toString().includes(a),u=r==="all"||m.locale===r;return d&&u});return e.jsxs("div",{className:"space-y-6 sm:space-y-8 animate-in fade-in duration-300 min-w-0 max-w-full",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4 border-b border-white/10 pb-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-champagne-400"}),e.jsx("span",{className:"text-[10px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"Subscriber Identity & Preferences"})]}),e.jsx("h1",{className:"font-cinzel text-2xl sm:text-3xl md:text-4xl text-pearl-50 font-light tracking-wide",children:"Audience Users"}),e.jsx("p",{className:"text-xs text-pearl-400 font-sans mt-1.5 max-w-2xl leading-relaxed",children:"Real-time subscriber directory. Inspect preferred languages, bot block states, and broadcast opt-out toggles (/stop or /optout compliance)."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 sm:gap-3 w-full md:w-auto shrink-0",children:[e.jsxs("div",{className:"relative flex-1 sm:w-64",children:[e.jsx(Re,{className:"w-3.5 h-3.5 text-pearl-400 absolute left-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",value:a,onChange:m=>n(m.target.value),placeholder:"Search user or ID...",className:"w-full pl-8 pr-3 py-2 rounded bg-space-850 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/50"})]}),e.jsxs("select",{value:r,onChange:m=>i(m.target.value),className:"px-3 py-2 rounded bg-space-850 border border-white/10 text-xs font-mono text-pearl-100 focus:outline-none focus:border-champagne-400/50",children:[e.jsx("option",{value:"all",children:"All Locales"}),e.jsx("option",{value:"en",children:"English (en)"}),e.jsx("option",{value:"hi",children:"Hindi (hi)"}),e.jsx("option",{value:"hi-Latn",children:"Hinglish (hi-Latn)"}),e.jsx("option",{value:"ar",children:"Arabic (ar)"}),e.jsx("option",{value:"ru",children:"Russian (ru)"})]})]})]}),e.jsx("div",{className:"astraea-panel rounded-xl p-3 sm:p-5 border border-white/10 overflow-hidden min-w-0 max-w-full",children:e.jsx("div",{className:"overflow-x-auto w-full max-w-full",children:e.jsxs("table",{className:"w-full min-w-[700px] text-left text-xs font-mono",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/10 text-[10px] text-pearl-400 uppercase tracking-widest",children:[e.jsx("th",{className:"pb-3 pl-2",children:"User / Identity"}),e.jsx("th",{className:"pb-3",children:"Telegram ID"}),e.jsx("th",{className:"pb-3",children:"Preferred Locale"}),e.jsx("th",{className:"pb-3",children:"Block State"}),e.jsx("th",{className:"pb-3",children:"Broadcast Status"}),e.jsx("th",{className:"pb-3",children:"First Seen"}),e.jsx("th",{className:"pb-3 pr-2 text-right",children:"Opt-Out Toggle"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:h.map(m=>e.jsxs("tr",{className:"hover:bg-white/[0.02] transition-colors",children:[e.jsxs("td",{className:"py-3.5 pl-2 font-medium text-pearl-100 flex items-center gap-2.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-full bg-space-800 border border-white/10 flex items-center justify-center text-[10px] font-bold text-champagne-300",children:m.name.slice(0,2).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"font-sans font-medium text-pearl-50 text-xs",children:m.name}),e.jsxs("div",{className:"text-[10px] text-champagne-400",children:["@",m.username]})]})]}),e.jsx("td",{className:"py-3.5 text-pearl-300",children:m.telegramUserId}),e.jsx("td",{className:"py-3.5",children:e.jsx("span",{className:"px-2 py-0.5 rounded bg-space-850 border border-white/10 text-[10px] uppercase text-pearl-200",children:m.locale})}),e.jsx("td",{className:"py-3.5",children:m.isBlocked?e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] uppercase bg-rose-500/10 text-rose-300 border border-rose-500/30",children:"BLOCKED BOT"}):e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] uppercase bg-emerald-500/10 text-emerald-300 border border-emerald-500/30",children:"ACTIVE"})}),e.jsx("td",{className:"py-3.5",children:m.isOptedOut?e.jsxs("span",{className:"text-amber-400 text-[11px] flex items-center gap-1",children:[e.jsx(ys,{className:"w-3.5 h-3.5"})," Opted Out (/stop)"]}):e.jsxs("span",{className:"text-emerald-400 text-[11px] flex items-center gap-1",children:[e.jsx($,{className:"w-3.5 h-3.5"})," Subscribed"]})}),e.jsx("td",{className:"py-3.5 text-pearl-400 text-[11px]",children:m.firstSeen}),e.jsx("td",{className:"py-3.5 pr-2 text-right",children:e.jsx("button",{onClick:()=>o(m.id),className:"text-xs text-champagne-400 hover:text-champagne-300",children:m.isOptedOut?"Re-enable":"Opt-Out"})})]},m.id))})]})})})]})},Ul=[{id:"5373141891321279747",name:"VIP Crown Gold",category:"crown",fallback:"๐Ÿ‘‘",isAnimated:!0},{id:"5373141891321279748",name:"Diamond Gem Luxury",category:"vip",fallback:"๐Ÿ’Ž",isAnimated:!0},{id:"5373141891321279749",name:"Blue Fire Blaze",category:"fire",fallback:"๐Ÿ”ฅ",isAnimated:!0},{id:"5373141891321279750",name:"Golden Coin Stack",category:"money",fallback:"๐Ÿ’ฐ",isAnimated:!0},{id:"5373141891321279751",name:"Verified Shield Blue",category:"vip",fallback:"๐Ÿ›ก๏ธ",isAnimated:!0},{id:"5373141891321279752",name:"TON Crystal Spark",category:"crypto",fallback:"๐Ÿ’Ž",isAnimated:!0},{id:"5373141891321279753",name:"Bitcoin Gold Emblem",category:"crypto",fallback:"๐Ÿช™",isAnimated:!0},{id:"5373141891321279754",name:"Red Flame Burst",category:"fire",fallback:"๐Ÿ”ฅ",isAnimated:!0}],zl=()=>{const[t,s]=l.useState(Ul),[a,n]=l.useState(""),[r,i]=l.useState("all"),[o,h]=l.useState(null),[m,d]=l.useState(!1),[u,p]=l.useState(`{