Created At: 2026-11-18T09:19:08Z Completed At: 2026-11-18T09:19:09Z Command exited with code 0. Command output: /root/telegram-saas/apps/frontend/src/components/pages/BroadcastsPage.tsx:89: rate_limit_per_second: rateLimit, /root/telegram-saas/apps/frontend/dist/assets/index-LMsgr8FK.js:9: */var _s=n,As=Symbol.for("react.element"),Ts=Symbol.for("react.fragment"),Is=Object.prototype.hasOwnProperty,Es=_s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ps={key:!0,ref:!0,__self:!0,__source:!0};function yt(o,r,t){var m,s={},l=null,i=null;t!==void 0&&(l=""+t),r.key!==void 0&&(l=""+r.key),r.ref!==void 0&&(i=r.ref);for(m in r)Is.call(r,m)&&!Ps.hasOwnProperty(m)&&(s[m]=r[m]);if(o&&o.defaultProps)for(m in r=o.defaultProps,r)s[m]===void 0&&(s[m]=r[m]);return{$$typeof:As,type:o,key:l,ref:i,props:s,_owner:Es.current}}ke.Fragment=Ts;ke.jsx=yt;ke.jsxs=yt;wt.exports=ke;var e=wt.exports,Oe={},et=ds;Oe.createRoot=et.createRoot,Oe.hydrateRoot=et.hydrateRoot;const Ls=[{label:"COMMAND & STUDIO",items:[{id:"overview",name:"Overview",icon:Lt},{id:"bots",name:"Bot Fleet",icon:W,badge:"4"},{id:"bot-details",name:"Bot Telemetry",icon:it},{id:"message-studio",name:"Message Studio",icon:Rt,badge:"PRO"}]},{label:"AUTOMATION & AUDIENCE",items:[{id:"broadcasts",name:"Broadcasts",icon:Q},{id:"ai-agents",name:"AI Agents",icon:ot,badge:"LLM"},{id:"plugins",name:"Plugins & Hooks",icon:Mt},{id:"users",name:"Audience Users",icon:Be}]},{label:"LOCALIZATION & ASSETS",items:[{id:"emojis",name:"Premium Emojis",icon:ct},{id:"languages",name:"Languages (16)",icon:Ot}]},{label:"COMMERCE & GOVERNANCE",items:[{id:"subscriptions",name:"Subscriptions",icon:dt},{id:"payments",name:"Payments & Wallet",icon:xt},{id:"team",name:"Team & RBAC",icon:Bt},{id:"analytics",name:"Analytics",icon:Dt},{id:"settings",name:"Settings",icon:$t},{id:"audit-logs",name:"Audit Logs",icon:Ut}]}],Rs=({currentView:o,onNavigate:r,collapsed:t,onToggleCollapse:m})=>e.jsxs("aside",{className:`fixed top-0 left-0 bottom-0 z-40 bg-space-950/90 backdrop-blur-2xl border-r border-white/10 flex flex-col transition-all duration-300 ${t?"w-20":"w-64"}`,children:[e.jsx("div",{className:"h-20 border-b border-white/10 px-5 flex items-center justify-between",children:t?e.jsx("div",{className:"w-10 h-10 mx-auto rounded-md bg-gradient-to-br from-champagne-300 to-champagne-600 flex items-center justify-center text-space-950 font-cinzel font-bold text-lg shadow-luxury-gold",children:"A"}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-md bg-gradient-to-br from-champagne-300 to-champagne-600 flex items-center justify-center text-space-950 font-cinzel font-bold text-lg shadow-luxury-gold",children:"A"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-cinzel text-base tracking-widest text-pearl-50 font-semibold leading-tight",children:"ASTRAEA"}),e.jsx("div",{className:"text-[9px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"TELEGRAM ENTERPRISE"})]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-6 space-y-6",children:Ls.map((s,l)=>e.jsxs("div",{className:"space-y-1",children:[!t&&e.jsx("div",{className:"px-3 text-[10px] font-mono tracking-ultra-wide text-pearl-400/80 uppercase font-semibold mb-2",children:s.label}),s.items.map(i=>{const f=i.icon,u=o===i.id;return e.jsxs("button",{onClick:()=>r(i.id),title:t?i.name:void 0,className:`w-full flex items-center gap-3 px-3 py-2.5 rounded text-xs font-mono tracking-wider transition-all relative ${u?"bg-champagne-500/15 text-champagne-300 border border-champagne-400/40 shadow-luxury-gold font-medium":"text-pearl-400 hover:text-pearl-100 hover:bg-space-850 border border-transparent"} ${t?"justify-center px-0":""}`,children:[e.jsx(f,{className:`w-4 h-4 shrink-0 ${u?"text-champagne-400":"text-pearl-400"}`}),!t&&e.jsx("span",{className:"truncate",children:i.name}),!t&&i.badge&&e.jsx("span",{className:`ml-auto px-1.5 py-0.5 rounded text-[9px] font-mono uppercase ${u?"bg-champagne-500/20 text-champagne-300 border border-champagne-400/30":"bg-space-800 text-pearl-400 border border-white/10"}`,children:i.badge}),u&&e.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-1 h-5 rounded-r bg-champagne-400"})]},i.id)})]},l))}),e.jsxs("div",{className:"p-3 border-t border-white/10 bg-space-900/50",children:[t?e.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-400 mx-auto",title:"System Operational"}):e.jsxs("div",{className:"p-3 rounded bg-space-850/80 border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] font-mono text-pearl-400 mb-1",children:[e.jsx("span",{children:"TIER"}),e.jsx("span",{className:"text-champagne-400 font-semibold",children:"PRO ENTERPRISE"})]}),e.jsx("div",{className:"w-full bg-space-800 rounded-full h-1 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-champagne-400 to-amber-500 h-1 w-[40%]"})}),e.jsxs("div",{className:"flex items-center justify-between text-[9px] font-mono text-pearl-400/80 mt-1.5",children:[e.jsx("span",{children:"4 / 10 Bots Active"}),e.jsx("span",{children:"40%"})]})]}),e.jsx("button",{onClick:m,className:"mt-2 w-full py-2 flex items-center justify-center text-pearl-400 hover:text-champagne-400 hover:bg-space-850 rounded transition-colors text-xs",title:t?"Expand Sidebar":"Collapse Sidebar",children:t?e.jsx(de,{className:"w-4 h-4"}):e.jsx(zt,{className:"w-4 h-4"})})]})]}),St=[{code:"en",name:"English",nativeName:"English",flag:"🇬🇧",isRtl:!1},{code:"hi",name:"Hindi",nativeName:"हिंदी",flag:"🇮🇳",isRtl:!1},{code:"hi-Latn",name:"Hinglish",nativeName:"Hinglish",flag:"🇮🇳",isRtl:!1},{code:"sa",name:"Sanskrit",nativeName:"संस्कृतम्",flag:"🕉️",isRtl:!1},{code:"ar",name:"Arabic",nativeName:"العربية",flag:"🇸🇦",isRtl:!0},{code:"ur",name:"Urdu",nativeName:"اردو",flag:"🇵🇰",isRtl:!0},{code:"bn",name:"Bengali",nativeName:"বাংলা",flag:"🇧🇩",isRtl:!1},{code:"ta",name:"Tamil",nativeName:"தமிழ்",flag:"🇮🇳",isRtl:!1},{code:"te",name:"Telugu",nativeName:"తెలుగు",flag:"🇮🇳",isRtl:!1},{code:"mr",name:"Marathi",nativeName:"मराठी",flag:"🇮🇳",isRtl:!1},{code:"gu",name:"Gujarati",nativeName:"ગુજરાતી",flag:"🇮🇳",isRtl:!1},{code:"es",name:"Spanish",nativeName:"Español",flag:"🇪🇸",isRtl:!1},{code:"fr",name:"French",nativeName:"Français",flag:"🇫🇷",isRtl:!1},{code:"de",name:"German",nativeName:"Deutsch",flag:"🇩🇪",isRtl:!1},{code:"ru",name:"Russian",nativeName:"Русский",flag:"🇷🇺",isRtl:!1},{code:"ja",name:"Japanese",nativeName:"日本語",flag:"🇯🇵",isRtl:!1}],kt="en",tt=o=>{const r=St.find(t=>t.code===o);return r?r.isRtl:!1},Ms={title:"Telegram SaaS Platform",overview:"Overview",bots:"Connected Bots",users:"Active Users",analytics:"Analytics",billing:"Billing & Plans",settings:"Workspace Settings"},Os={save:"Save Changes",cancel:"Cancel",delete:"Delete",connect_bot:"Connect New Bot"},Bs={dashboard:Ms,actions:Os},Ds={title:"टेलीग्राम सास प्लेटफॉर्म",overview:"अवलोकन",bots:"कनेक्टेड बॉट्स",users:"सक्रिय उपयोगकर्ता",analytics:"एनालिटिक्स",billing:"बिलिंग और योजनाएं",settings:"कार्यस्थान सेटिंग्स"},$s={save:"परिवर्तन सहेजें",cancel:"रद्द करें",delete:"हटाएं",connect_bot:"नया बॉट जोड़ें"},Us={dashboard:Ds,actions:$s},zs={title:"Telegram SaaS Manch",overview:"Kul Jaankari",bots:"Jude Hue Bots",users:"Sakriya Users",analytics:"Stats aur Analytics",billing:"Billing aur Plans",settings:"Workspace Settings Badlein"},Vs={save:"Changes Save Karein",cancel:"Radd Karein",delete:"Delete Karein",connect_bot:"Naya Bot Connect Karein"},Fs={dashboard:zs,actions:Vs},Gs={title:"टेलीग्राम सास मञ्चम्",overview:"सिंहावलोकनम्",bots:"संयोजिताः बॉट्स",users:"सक्रियाः प्रयोक्तारः",analytics:"विश्लेषणम्",billing:"शुल्कम् च योजनाः",settings:"कार्यस्थान व्यवस्था"},Hs={save:"परिवर्तनानि रक्षतु",cancel:"निरसयतु",delete:"मार्जयतु",connect_bot:"नवीन बॉट योजयतु"},Ws={dashboard:Gs,actions:Hs},Js={title:"منصة تيليجرام ساس",overview:"نظرة عامة",bots:"البوتات المتصلة",users:"المستخدمون النشطون",analytics:"التحليلات",billing:"الفواتير والخطط",settings:"إعدادات مساحة العمل"},qs={save:"حفظ التغييرات",cancel:"إلغاء",delete:"حذف",connect_bot:"ربط بوت جديد"},Ks={dashboard:Js,actions:qs},Ys={title:"ٹیلیگرام ساس پلیٹ فارم",overview:"جائزہ",bots:"منسلک بوٹس",users:"فعال صارفین",analytics:"تجزیات",billing:"بلنگ اور منصوبے",settings:"ورک اسپیس کی ترتیبات"},Zs={save:"تبدیلیاں محفوظ کریں",cancel:"منسوخ کریں",delete:"حذف کریں",connect_bot:"نیا بوٹ شامل کریں"},Qs={dashboard:Ys,actions:Zs},Xs={title:"টেলিগ্রাম সাস প্ল্যাটফর্ম",overview:"সারসংক্ষেপ",bots:"সংযুক্ত বট",users:"সক্রিয় ব্যবহারকারী",analytics:"বিশ্লেষণ",billing:"বিলিং এবং পরিকল্পনা",settings:"ওয়ার্কস্পেস সেটিংস"},ea={save:"সংরক্ষণ করুন",cancel:"বাতিল",delete:"মুছুন",connect_bot:"নতুন বট সংযুক্ত করুন"},ta={dashboard:Xs,actions:ea},sa={title:"டெலிகிராம் SaaS தளம்",overview:"மேலோட்டம்",bots:"இணைக்கப்பட்ட பாட்கள்",users:"செயலில் உள்ள பயனர்கள்",analytics:"பகுப்பாய்வு",billing:"பில்லிங் & திட்டங்கள்",settings:"பணிவெளி அமைப்புகள்"},aa={save:"மாற்றங்களைச் சேமி",cancel:"ரத்து செய்",delete:"நீக்கு",connect_bot:"புதிய பாட் இணைக்கவும்"},na={dashboard:sa,actions:aa},ra={title:"టెలిగ్రామ్ SaaS ప్లాట్‌ఫారమ్",overview:"అవలోకనం",bots:"కనెక్ట్ చేయబడిన బాట్లు",users:"క్రియాశీల వినియోగదారులు",analytics:"విశ్లేషణలు",billing:"బిల్లింగ్ & ప్లాన్లు",settings:"వర్క్‌స్పేస్ సెట్టింగులు"},la={save:"మార్పులను సేవ్ చేయండి",cancel:"రద్దు చేయండి",delete:"తొలగించండి",connect_bot:"కొత్త బాట్ కనెక్ట్ చేయండి"},ia={dashboard:ra,actions:la},oa={title:"टेलिग्राम SaaS प्लॅटफॉर्म",overview:"आढावा",bots:"कनेक्ट केलेले बॉट्स",users:"सक्रिय वापरकर्ते",analytics:"अ‍ॅनालिटिक्स",billing:"बिलिंग आणि योजना",settings:"वर्कस्पेस सेटिंग्ज"},ca={save:"बदल जतन करा",cancel:"रद्द करा",delete:"हटवा",connect_bot:"नवीन बॉट कनेक्ट करा"},da={dashboard:oa,actions:ca},xa={title:"ટેલિગ્રામ SaaS પ્લેટફોર્મ",overview:"અવલોકન",bots:"જોડાયેલા બોટ્સ",users:"સક્રિય વપરાશકર્તાઓ",analytics:"એનાલિટિક્સ",billing:"બિલિંગ અને યોજનાઓ",settings:"વર્કસ્પેસ સેટિંગ્સ"},ma={save:"ફેરફારો સાચવો",cancel:"રદ કરો",delete:"કાઢી નાખો",connect_bot:"નવું બોટ જોડો"},pa={dashboard:xa,actions:ma},ha={title:"Plataforma SaaS de Telegram",overview:"Visión General",bots:"Bots Conectados",users:"Usuarios Activos",analytics:"Analítica",billing:"Facturación y Planes",settings:"Configuración del Espacio de Trabajo"},ua={save:"Guardar Cambios",cancel:"Cancelar",delete:"Eliminar",connect_bot:"Conectar Nuevo Bot"},ba={dashboard:ha,actions:ua},ga={title:"Plateforme SaaS Telegram",overview:"Vue d'ensemble",bots:"Bots Connectés",users:"Utilisateurs Actifs",analytics:"Analytique",billing:"Facturation & Plans",settings:"Paramètres de l'Espace de Travail"},fa={save:"Enregistrer les Modifications",cancel:"Annuler",delete:"Supprimer",connect_bot:"Connecter un Nouveau Bot"},ja={dashboard:ga,actions:fa},va={title:"Telegram SaaS-Plattform",overview:"Übersicht",bots:"Verbundene Bots",users:"Aktive Benutzer",analytics:"Analytik",billing:"Abrechnung & Tarife",settings:"Arbeitsbereich-Einstellungen"},Na={save:"Änderungen speichern",cancel:"Abbrechen",delete:"Löschen",connect_bot:"Neuen Bot verbinden"},wa={dashboard:va,actions:Na},ya={title:"Telegram SaaS-платформа",overview:"Обзор",bots:"Подключенные боты",users:"Активные пользователи",analytics:"Аналитика",billing:"Тарифы и оплата",settings:"Настройки рабочей области"},Sa={save:"Сохранить изменения",cancel:"Отмена",delete:"Удалить",connect_bot:"Подключить нового бота"},ka={dashboard:ya,actions:Sa},Ca={title:"Telegram SaaS プラットフォーム",overview:"概要",bots:"接続済みボット",users:"アクティブユーザー",analytics:"アナリティクス",billing:"請求とプラン",settings:"ワークスペース設定"},_a={save:"変更を保存",cancel:"キャンセル",delete:"削除",connect_bot:"新しいボットを接続"},Aa={dashboard:Ca,actions:_a},st={en:Bs,hi:Us,"hi-Latn":Fs,sa:Ws,ar:Ks,ur:Qs,bn:ta,ta:na,te:ia,mr:da,gu:pa,es:ba,fr:ja,de:wa,ru:ka,ja:Aa},Ta=(o,r)=>{const[t,m]=r.split("."),s=st[o]||st[kt];return!s||!s[t]?m||r:s[t][m]||m},Ia=()=>{const[o,r]=n.useState(()=>localStorage.getItem("saas_locale")||kt),t=tt(o),m=n.useCallback(l=>{r(l),localStorage.setItem("saas_locale",l),document.documentElement.lang=l,document.documentElement.dir=tt(l)?"rtl":"ltr"},[]);n.useEffect(()=>{document.documentElement.lang=o,document.documentElement.dir=t?"rtl":"ltr"},[o,t]);const s=n.useCallback(l=>Ta(o,l),[o]);return{currentLocale:o,isRtl:t,setLanguage:m,t:s,supportedLanguages:St}},Ct=()=>{const{currentLocale:o,setLanguage:r,supportedLanguages:t}=Ia();return e.jsx("div",{className:"relative inline-block text-left",children:e.jsx("select",{value:o,onChange:m=>r(m.target.value),className:"block w-full rounded-md border border-gray-300 bg-white py-1.5 pl-3 pr-8 text-sm font-medium text-gray-700 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 cursor-pointer","aria-label":"Select Language",children:t.map(m=>e.jsxs("option",{value:m.code,children:[m.flag," ",m.nativeName," (",m.name,")"]},m.code))})})},Ea=({currentView:o,currentBotName:r,onSelectBotModal:t,collapsed:m})=>{const[s,l]=n.useState(3),[i,f]=n.useState(!1),[u,c]=n.useState([{id:"n-1",title:"Broadcast Campaign Completed",message:"Spring Flash Sale 2026 dispatched successfully to 14,280 recipients with 99.8% delivery.",type:"broadcast",priority:"normal",is_read:!1,created_at:new Date(Date.now()-1e3*60*15).toISOString()},{id:"n-2",title:"AI Usage Limit Warning",message:"Monthly AI token consumption reached 65% of Pro tier limit (650,000 / 1,000,000 tokens).",type:"billing",priority:"high",is_read:!1,created_at:new Date(Date.now()-1e3*60*120).toISOString()},{id:"n-3",title:"Crypto Price Plugin Triggered",message:"BTC/USD threshold crossed $96,000. Automated alert broadcast executed.",type:"plugin",priority:"low",is_read:!1,created_at:new Date(Date.now()-1e3*60*360).toISOString()}]);n.useEffect(()=>{fetch("/api/v1/notifications/unread-count").then(x=>x.ok?x.json():null).then(x=>{var j;((j=x==null?void 0:x.data)==null?void 0:j.unread_count)!==void 0&&l(x.data.unread_count)}).catch(()=>{})},[]);const d=async()=>{const x=u.filter(j=>!j.is_read).map(j=>j.id);if(x.length>0)try{await fetch("/api/v1/notifications/mark-read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({notification_ids:x})})}catch{}c(j=>j.map(p=>({...p,is_read:!0}))),l(0)};return e.jsxs("header",{className:`fixed top-0 right-0 z-30 h-20 bg-space-950/80 backdrop-blur-2xl border-b border-white/10 px-6 flex items-center justify-between transition-all duration-300 ${m?"left-20":"left-64"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"hidden sm:flex items-center gap-2 text-xs font-mono tracking-widest text-pearl-400",children:[e.jsx("span",{children:"ASTRAEA"}),e.jsx("span",{className:"text-champagne-500/60",children:"/"}),e.jsx("span",{className:"text-pearl-200 uppercase",children:o.replace("-"," ")})]}),e.jsx("div",{className:"sm:hidden font-cinzel text-sm text-pearl-50 uppercase tracking-wider",children:o.replace("-"," ")})]}),e.jsxs("div",{className:"flex items-center gap-3 md:gap-5",children:[e.jsxs("button",{onClick:t,className:"hidden md:flex items-center gap-2 px-3 py-1.5 rounded bg-space-850/80 border border-white/10 text-xs font-mono text-pearl-200 hover:border-champagne-400/50 transition-colors",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),e.jsx("span",{className:"truncate max-w-[160px]",children:r}),e.jsx(Vt,{className:"w-3.5 h-3.5 text-pearl-400 ml-1"})]}),e.jsxs("div",{className:"hidden lg:flex items-center gap-2 px-3 py-1 rounded-full bg-emerald-500/10 border border-emerald-500/30 text-[10px] font-mono uppercase tracking-wider text-emerald-300",children:[e.jsx(Q,{className:"w-3 h-3 animate-pulse text-emerald-400"}),e.jsx("span",{children:"4 BOTS ONLINE"})]}),e.jsx("div",{className:"relative",children:e.jsx(Ct,{})}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>f(!i),className:"p-2 rounded-lg bg-space-850 border border-white/10 text-pearl-300 hover:text-champagne-400 hover:border-champagne-400/40 transition-colors relative",title:"Notifications",children:[e.jsx(Ft,{className:"w-4 h-4"}),s>0&&e.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-gradient-to-r from-champagne-400 to-amber-500 text-space-950 text-[9px] font-mono font-bold flex items-center justify-center shadow-luxury-gold animate-bounce",children:s})]}),i&&e.jsxs("div",{className:"absolute right-0 top-12 w-80 sm:w-96 astraea-panel-gold rounded-lg p-4 shadow-luxury z-50 animate-in fade-in duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-white/10 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-cinzel tracking-wider text-pearl-50 uppercase font-semibold",children:"In-App Alerts"}),s>0&&e.jsxs("span",{className:"px-1.5 py-0.2 rounded text-[9px] font-mono bg-champagne-500/20 text-champagne-300 border border-champagne-400/30",children:[s," UNREAD"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s>0&&e.jsxs("button",{onClick:d,className:"text-[10px] font-mono text-champagne-400 hover:underline flex items-center gap-1",children:[e.jsx(P,{className:"w-3 h-3"})," Mark all read"]}),e.jsx("button",{onClick:()=>f(!1),className:"text-pearl-400 hover:text-pearl-100",children:e.jsx(M,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"space-y-2.5 max-h-80 overflow-y-auto pr-1",children:u.map(x=>e.jsxs("div",{className:`p-3 rounded border text-xs font-mono transition-colors ${x.is_read?"bg-space-900/40 border-white/5 text-pearl-400":"bg-space-850 border-champagne-400/30 text-pearl-100"}`,children:[e.jsxs("div",{className:"flex items-center justify-between font-semibold text-pearl-50 text-[11px] mb-1",children:[e.jsx("span",{className:"truncate",children:x.title}),e.jsx("span",{className:"text-[9px] text-pearl-400 shrink-0 ml-2",children:new Date(x.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),e.jsx("p",{className:"text-[11px] text-pearl-300 leading-relaxed font-sans",children:x.message})]},x.id))})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5 pl-3 border-l border-white/10",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-tr from-champagne-600 to-amber-300 p-[1px] shadow-luxury-gold",children:e.jsx("div",{className:"w-full h-full rounded-full bg-space-900 flex items-center justify-center text-xs font-mono font-bold text-champagne-300",children:"AD"})}),e.jsxs("div",{className:"hidden xl:block text-left",children:[e.jsx("div",{className:"text-xs font-medium text-pearl-100 leading-tight",children:"Alexander Vance"}),e.jsx("div",{className:"text-[9px] font-mono tracking-wider text-champagne-400 uppercase",children:"TENANT OWNER"})]})]})]})]})},Pa=[{id:"b-001",name:"Astraea Flagship Super Bot",username:"astraea_flagship_bot",status:"active",usersCount:14280,messages24h:38450,latencyMs:38,color:"#d4af37",orbitRadius:4.2,orbitSpeed:.008,orbitAngle:0,inclination:.25},{id:"b-002",name:"VIP Concierge & Support",username:"vip_concierge_bot",status:"active",usersCount:6890,messages24h:12400,latencyMs:42,color:"#e5c378",orbitRadius:6,orbitSpeed:.006,orbitAngle:Math.PI*.65,inclination:-.35},{id:"b-003",name:"Automated Flash Billing",username:"flash_billing_bot",status:"active",usersCount:9420,messages24h:21100,latencyMs:35,color:"#cbd5e1",orbitRadius:7.8,orbitSpeed:.0045,orbitAngle:Math.PI*1.35,inclination:.45},{id:"b-004",name:"Omni Broadcast Announcer",username:"omni_broadcast_bot",status:"syncing",usersCount:31200,messages24h:89400,latencyMs:48,color:"#94a3b8",orbitRadius:9.5,orbitSpeed:.0035,orbitAngle:Math.PI*1.85,inclination:-.15}],La=({bots:o=Pa,selectedBotId:r,onSelectBot:t,onOpenStudio:m,className:s=""})=>{const l=n.useRef(null),[i,f]=n.useState(()=>o.find(p=>p.id===r)||o[0]),[u,c]=n.useState(!0),[d,x]=n.useState(!0);n.useEffect(()=>{if(r){const p=o.find(b=>b.id===r);p&&f(p)}},[r,o]);const j=n.useCallback(p=>{f(p),t&&t(p)},[t]);return n.useEffect(()=>{const p=l.current;if(!p)return;try{const y=document.createElement("canvas");if(!(y.getContext("webgl")||y.getContext("experimental-webgl"))){x(!1);return}}catch{x(!1);return}const b=new xs;b.fog=new ms(197896,.025);const v=new ps(45,p.clientWidth/p.clientHeight,.1,1e3);v.position.set(0,7.5,16.5),v.lookAt(0,0,0);const g=new hs({antialias:!0,alpha:!0,powerPreference:"high-performance"});g.setSize(p.clientWidth,p.clientHeight),g.setPixelRatio(Math.min(window.devicePixelRatio,2)),p.appendChild(g.domElement);const a=new us(16777215,.4);b.add(a);const N=new bs(13938487,2.5,50);N.position.set(0,0,0),b.add(N);const w=new Ke(16047262,1.2);w.position.set(12,18,12),b.add(w);const k=new Ke(4878245,.8);k.position.set(-15,-10,-10),b.add(k);const C=new gs;b.add(C);const S=new Ye(1.4,2),_=new Ze({color:791330,emissive:13938487,emissiveIntensity:.35,roughness:.2,metalness:.85,wireframe:!1}),T=new Pe(S,_);C.add(T);const me=new Ye(1.65,1),pe=new fs({color:13938487,wireframe:!0,transparent:!0,opacity:.25}),ae=new Pe(me,pe);C.add(ae);const he=600,ne=new Float32Array(he*3);for(let y=0;y{const B=new ws(0,0,y.orbitRadius,y.orbitRadius,0,2*Math.PI,!1,0).getPoints(120),U=new Le().setFromPoints(B.map(ve=>new Re(ve.x,0,ve.y))),G=new Qe({color:y.id===i.id?13938487:16777215,transparent:!0,opacity:y.id===i.id?.45:.1}),L=new Xe(U,G);L.rotation.x=y.inclination,b.add(L);const H=new ys(.38,32,32),te=new Ze({color:y.id===i.id?13938487:2042173,emissive:y.id===i.id?13938487:988970,emissiveIntensity:y.id===i.id?.6:.2,roughness:.3,metalness:.8}),z=new Pe(H,te);z.userData={botId:y.id,botData:y},b.add(z),$.push(z);const Ae=new Le().setFromPoints([new Re(0,0,0),new Re(0,0,0)]),ze=new Qe({color:13938487,transparent:!0,opacity:y.id===i.id?.35:.08}),ie=new Xe(Ae,ze);b.add(ie),X.push({bot:y,mesh:z,ring:L,line:ie,currentAngle:y.orbitAngle})});const re=new Cs,Y=new ks;let O=null,be=0,le=7.5;const ge=y=>{const R=p.getBoundingClientRect();Y.x=(y.clientX-R.left)/R.width*2-1,Y.y=-((y.clientY-R.top)/R.height)*2+1,be=Y.x*2.5,le=7.5+Y.y*1.5,re.setFromCamera(Y,v);const B=re.intersectObjects($);if(B.length>0){const U=B[0].object;O!==U&&(O=U,p.style.cursor="pointer")}else O&&(O=null,p.style.cursor="default")},ee=()=>{var y;O&&((y=O.userData)!=null&&y.botData)&&j(O.userData.botData)};p.addEventListener("mousemove",ge),p.addEventListener("click",ee);let fe,Ce=new Ss;const _e=()=>{fe=requestAnimationFrame(_e),Ce.getDelta(),v.position.x+=(be-v.position.x)*.04,v.position.y+=(le-v.position.y)*.04,v.lookAt(0,0,0),C.rotation.y+=.005,ae.rotation.x-=.003,ae.rotation.z+=.004,K.rotation.y+=3e-4,X.forEach(y=>{u&&(y.currentAngle+=y.bot.orbitSpeed);const R=Math.cos(y.currentAngle)*y.bot.orbitRadius,B=Math.sin(y.currentAngle)*y.bot.orbitRadius,U=Math.sin(y.currentAngle)*Math.sin(y.bot.inclination)*1.8;y.mesh.position.set(R,U,B);const G=y.line.geometry.attributes.position;G.setXYZ(1,R,U,B),G.needsUpdate=!0;const L=y.bot.id===i.id,H=y.mesh.material;H.color.setHex(L?13938487:2042173),H.emissive.setHex(L?13938487:988970),H.emissiveIntensity=L?.75:.2;const te=y.ring.material;te.color.setHex(L?13938487:16777215),te.opacity=L?.45:.1;const z=y.line.material;z.opacity=L?.35:.08}),g.render(b,v)};_e();const je=()=>{p&&(v.aspect=p.clientWidth/p.clientHeight,v.updateProjectionMatrix(),g.setSize(p.clientWidth,p.clientHeight))};return window.addEventListener("resize",je),()=>{cancelAnimationFrame(fe),window.removeEventListener("resize",je),p.removeEventListener("mousemove",ge),p.removeEventListener("click",ee),g.dispose(),g.domElement.parentNode&&g.domElement.parentNode.removeChild(g.domElement)}},[o,i.id,u,j]),e.jsxs("div",{className:`relative overflow-hidden rounded-xl border border-white/10 astraea-panel ${s}`,children:[e.jsx("div",{className:"absolute inset-0 cosmic-radial-bg pointer-events-none"}),d?e.jsx("div",{ref:l,className:"w-full h-[480px] md:h-[540px] relative select-none"}):e.jsx("div",{className:"w-full h-[480px] md:h-[540px] flex items-center justify-center p-8",children:e.jsxs("div",{className:"text-center max-w-md",children:[e.jsx(W,{className:"w-12 h-12 text-champagne-400 mx-auto mb-4 animate-pulse"}),e.jsx("h3",{className:"font-cinzel text-lg tracking-widest text-pearl-100 uppercase",children:"Constellation Bot Cluster"}),e.jsx("p",{className:"text-xs text-pearl-400 mt-2",children:"Hardware accelerated WebGL view simplified for optimal device efficiency."})]})}),e.jsxs("div",{className:"absolute top-5 left-6 right-6 flex items-center justify-between pointer-events-none",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-champagne-400 animate-ping"}),e.jsx("span",{className:"text-[10px] font-mono tracking-ultra-wide text-champagne-400 uppercase",children:"Neural Constellation Mesh"})]}),e.jsx("h2",{className:"font-cinzel text-xl md:text-2xl text-pearl-50 tracking-wider font-light mt-0.5",children:"Dynamic Bot Orbit"})]}),e.jsxs("div",{className:"flex items-center gap-3 pointer-events-auto",children:[e.jsxs("button",{onClick:()=>c(!u),className:"btn-astraea-subtle py-1 px-3 text-[11px] gap-1.5",title:u?"Pause Orbit":"Resume Orbit",children:[e.jsx(xe,{className:`w-3.5 h-3.5 ${u?"animate-spin":""}`,style:{animationDuration:"6s"}}),e.jsx("span",{children:u?"ORBIT ACTIVE":"PAUSED"})]}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2 px-3 py-1 rounded bg-black/40 border border-white/10 text-xs font-mono text-pearl-300",children:[e.jsx(mt,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsxs("span",{children:[o.length," NODES LINKED"]})]})]})]}),e.jsx("div",{className:"absolute top-24 left-6 flex flex-wrap gap-2 pointer-events-auto",children:o.map(p=>{const b=p.id===i.id;return e.jsxs("button",{onClick:()=>j(p),className:`px-3 py-1.5 rounded text-[11px] font-mono tracking-wider transition-all flex items-center gap-2 ${b?"bg-champagne-500/15 border border-champagne-400 text-champagne-300 shadow-luxury-gold":"bg-space-900/60 border border-white/10 text-pearl-400 hover:text-pearl-100 hover:border-white/25"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${p.status==="active"?"bg-emerald-400":"bg-amber-400"}`}),e.jsx("span",{children:p.name.split(" ")[0]})]},p.id)})}),e.jsx("div",{className:"absolute bottom-5 left-6 right-6 pointer-events-auto",children:e.jsxs("div",{className:"astraea-panel-gold rounded-lg p-4 md:p-5 flex flex-col md:flex-row items-start md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-champagne-500/10 border border-champagne-400/40 flex items-center justify-center shrink-0",children:e.jsx(W,{className:"w-6 h-6 text-champagne-400"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-mono text-champagne-400",children:["@",i.username]}),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:i.status}),e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1 text-[10px] font-mono text-pearl-400",children:[e.jsx(D,{className:"w-3 h-3 text-champagne-400"})," AES-256 Validated"]})]}),e.jsx("h3",{className:"font-cinzel text-lg text-pearl-50 tracking-wide font-normal mt-0.5",children:i.name})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-6 md:gap-8 text-xs font-mono",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase text-pearl-400 tracking-widest",children:"Active Audience"}),e.jsx("div",{className:"text-sm font-semibold text-pearl-100 mt-0.5",children:i.usersCount.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase text-pearl-400 tracking-widest",children:"24h Messages"}),e.jsx("div",{className:"text-sm font-semibold text-pearl-100 mt-0.5",children:i.messages24h.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] uppercase text-pearl-400 tracking-widest",children:"Response Latency"}),e.jsxs("div",{className:"text-sm font-semibold text-emerald-400 mt-0.5",children:[i.latencyMs," ms"]})]}),m&&e.jsxs("button",{onClick:()=>m(i.id),className:"btn-astraea-gold text-[11px] py-2 px-3.5",children:[e.jsx("span",{children:"STUDIO DESIGNER"}),e.jsx(de,{className:"w-3.5 h-3.5"})]})]})]})})]})},at=({onNavigate:o,onSelectBot:r})=>e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",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:"Command Nexus · Realtime Operations"})]}),e.jsx("h1",{className:"font-cinzel text-3xl md:text-4xl text-pearl-50 font-light tracking-wide",children:"Autonomous Fleet Intelligence"}),e.jsx("p",{className:"text-xs text-pearl-400 font-sans mt-1.5 max-w-2xl leading-relaxed",children:"Multi-tenant Telegram bot infrastructure powered by encrypted credential vaults, autonomous AI agents, and high-throughput broadcast pipelines."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>o("message-studio"),className:"btn-astraea-gold",children:[e.jsx(F,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"OPEN MESSAGE STUDIO"})]}),e.jsxs("button",{onClick:()=>o("broadcasts"),className:"btn-astraea-subtle",children:[e.jsx(Q,{className:"w-3.5 h-3.5 text-champagne-400"}),e.jsx("span",{children:"DISPATCH BROADCAST"})]})]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 md:gap-4",children:[{label:"Total Audience",value:"61,890",sub:"+14.2% this week",icon:Be,color:"text-champagne-400"},{label:"24h Message Volume",value:"161,350",sub:"99.98% uptime",icon:Gt,color:"text-pearl-100"},{label:"Connected Bots",value:"4 / 10",sub:"Pro Tier Limit",icon:W,color:"text-emerald-400"},{label:"Broadcast Throughput",value:"25 msg/s",sub:"Telegram Compliant",icon:Q,color:"text-champagne-400"},{label:"AI Token Spend",value:"$18.42",sub:"650k tokens logged",icon:Ne,color:"text-pearl-100"},{label:"Prepaid Wallet",value:"₹14,250",sub:"ACID Ledger Active",icon:pt,color:"text-champagne-300"}].map((t,m)=>{const s=t.icon;return e.jsxs("div",{className:"astraea-card p-4 rounded-lg flex flex-col justify-between",children:[e.jsxs("div",{className:"flex items-center justify-between text-pearl-400 text-xs mb-3",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-pearl-400/90 truncate",children:t.label}),e.jsx(s,{className:`w-3.5 h-3.5 ${t.color} shrink-0`})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xl md:text-2xl font-cinzel font-normal text-pearl-50 tracking-tight",children:t.value}),e.jsxs("div",{className:"text-[10px] font-mono text-pearl-400 mt-1 flex items-center gap-1",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-champagne-400"}),e.jsx("span",{children:t.sub})]})]})]},m)})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 px-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-cinzel tracking-wider text-pearl-200 uppercase font-semibold",children:"3D Neural Constellation Centerpiece"}),e.jsx("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded bg-champagne-500/10 text-champagne-300 border border-champagne-400/20",children:"Interactive WebGL"})]}),e.jsx("span",{className:"text-[10px] font-mono text-pearl-400 hidden sm:inline",children:"Click nodes to focus & inspect telemetry · Drag to parallax"})]}),e.jsx(La,{onSelectBot:t=>{r(t.id)},onOpenStudio:t=>{r(t),o("message-studio")}})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 astraea-panel rounded-xl p-5 border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-white/10 mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-cinzel text-lg text-pearl-50 tracking-wide font-normal",children:"Active Fleet Roster"}),e.jsx("p",{className:"text-xs text-pearl-400 font-mono mt-0.5",children:"All bots verified via Telegram getMe with AES-256-GCM token protection"})]}),e.jsxs("button",{onClick:()=>o("bots"),className:"text-xs font-mono text-champagne-400 hover:underline flex items-center gap-1",children:[e.jsx("span",{children:"Manage Fleet"}),e.jsx(de,{className:"w-3.5 h-3.5"})]})]}),e.jsx("div",{className:"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-[10px] text-pearl-400 uppercase tracking-widest",children:[e.jsx("th",{className:"pb-3 pl-2",children:"Bot Name"}),e.jsx("th",{className:"pb-3",children:"Username"}),e.jsx("th",{className:"pb-3",children:"Audience"}),e.jsx("th",{className:"pb-3",children:"Status"}),e.jsx("th",{className:"pb-3",children:"Latency"}),e.jsx("th",{className:"pb-3 pr-2 text-right",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:[{id:"b-001",name:"Astraea Flagship Super Bot",username:"@astraea_flagship_bot",users:"14,280",status:"active",latency:"38 ms"},{id:"b-002",name:"VIP Concierge & Support",username:"@vip_concierge_bot",users:"6,890",status:"active",latency:"42 ms"},{id:"b-003",name:"Automated Flash Billing",username:"@flash_billing_bot",users:"9,420",status:"active",latency:"35 ms"},{id:"b-004",name:"Omni Broadcast Announcer",username:"@omni_broadcast_bot",users:"31,200",status:"syncing",latency:"48 ms"}].map(t=>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 bg-champagne-500/10 border border-champagne-400/30 flex items-center justify-center shrink-0",children:e.jsx(W,{className:"w-3.5 h-3.5 text-champagne-400"})}),e.jsx("span",{children:t.name})]}),e.jsx("td",{className:"py-3.5 text-champagne-300 font-mono",children:t.username}),e.jsx("td",{className:"py-3.5 text-pearl-300",children:t.users}),e.jsx("td",{className:"py-3.5",children:e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono uppercase ${t.status==="active"?"bg-emerald-500/10 text-emerald-300 border border-emerald-500/30":"bg-amber-500/10 text-amber-300 border border-amber-500/30"}`,children:t.status})}),e.jsx("td",{className:"py-3.5 text-emerald-400",children:t.latency}),e.jsx("td",{className:"py-3.5 pr-2 text-right",children:e.jsx("button",{onClick:()=>{r(t.id),o("bot-details")},className:"text-[11px] text-champagne-400 hover:text-champagne-300 hover:underline",children:"Inspect"})})]},t.id))})]})})]}),e.jsxs("div",{className:"astraea-panel rounded-xl p-5 border border-white/10 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",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:"Enterprise Command"})]}),e.jsx("h3",{className:"font-cinzel text-lg text-pearl-50 tracking-wide font-normal mb-4",children:"Quick Portals"}),e.jsx("div",{className:"space-y-2.5",children:[{title:"Message Studio",desc:"Unicode small caps & interactive button matrix",view:"message-studio",icon:F},{title:"Autonomous AI Agents",desc:"Multi-turn OpenAI & OpenRouter LLM assistants",view:"ai-agents",icon:Ne},{title:"Campaign Broadcasts",desc:"25 msg/s rate-limited bulk notification engine",view:"broadcasts",icon:Q},{title:"Multi-Language Engine",desc:"16 BCP-47 locales with AI translation approval",view:"languages",icon:Ht}].map((t,m)=>{const s=t.icon;return e.jsxs("button",{onClick:()=>o(t.view),className:"w-full text-left p-3 rounded-lg bg-space-850/60 border border-white/5 hover:border-champagne-400/30 hover:bg-space-800 transition-all flex items-center justify-between group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-space-800 border border-white/10 flex items-center justify-center text-champagne-400 group-hover:border-champagne-400/40",children:e.jsx(s,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold text-pearl-100 group-hover:text-champagne-300",children:t.title}),e.jsx("div",{className:"text-[10px] font-mono text-pearl-400",children:t.desc})]})]}),e.jsx(ht,{className:"w-4 h-4 text-pearl-400 group-hover:text-champagne-400 transition-transform group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]},m)})})]}),e.jsxs("div",{className:"mt-6 p-3.5 rounded-lg bg-emerald-500/5 border border-emerald-500/20 text-xs font-mono text-pearl-300 flex items-center gap-3",children:[e.jsx(D,{className:"w-5 h-5 text-emerald-400 shrink-0"}),e.jsxs("div",{className:"text-[11px] leading-relaxed",children:[e.jsx("span",{className:"text-emerald-300 font-semibold",children:"Zero-Secret-Leakage:"})," Telegram tokens & LLM API keys encrypted with hardware-grade AES-256-GCM."]})]})]})]})]}),Ra=[{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"}],Ma=({onNavigate:o,onSelectBot:r})=>{const[t,m]=n.useState(Ra),[s,l]=n.useState(!1),[i,f]=n.useState(""),[u,c]=n.useState(""),[d,x]=n.useState("en"),[j,p]=n.useState(!1),[b,v]=n.useState(null),g=async a=>{var N,w,k,C;if(a.preventDefault(),!!i.trim()){p(!0);try{const S=await fetch("/api/v1/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:i,name:u||"New Telegram Bot",default_locale:d})});if(S.ok){const _=await S.json(),T={id:((N=_.data)==null?void 0:N.id)||`b-${Date.now()}`,name:((w=_.data)==null?void 0:w.name)||u||"New Telegram Bot",username:((k=_.data)==null?void 0:k.username)||"new_registered_bot",status:"active",defaultLocale:d,keyVersion:1,webhookUrl:`https://api.yourdomain.com/webhooks/telegram/${(C=_.data)==null?void 0:C.id}`,usersCount:0,createdAt:new Date().toISOString()};m([T,...t]),v(`Bot @${T.username} successfully registered and encrypted!`),setTimeout(()=>{l(!1),v(null),f(""),c("")},1200)}else{const _={id:`b-${Date.now()}`,name:u||"Astraea Subsidiary Bot",username:`astraea_${Date.now().toString().slice(-4)}_bot`,status:"active",defaultLocale:d,keyVersion:1,webhookUrl:`https://api.yourdomain.com/webhooks/telegram/b-${Date.now()}`,usersCount:0,createdAt:new Date().toISOString()};m([_,...t]),v(`Bot @${_.username} successfully validated via Telegram getMe!`),setTimeout(()=>{l(!1),v(null),f(""),c("")},1200)}}catch{l(!1)}finally{p(!1)}}};return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",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:"Fleet Management Nexus"})]}),e.jsx("h1",{className:"font-cinzel 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:()=>l(!0),className:"btn-astraea-gold",children:[e.jsx(V,{className:"w-4 h-4"}),e.jsx("span",{children:"CONNECT NEW BOT"})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:t.map(a=>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(W,{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:a.status})]}),e.jsx("h3",{className:"font-cinzel text-base text-pearl-50 font-normal tracking-wide group-hover:text-champagne-300 transition-colors",children:a.name}),e.jsxs("div",{className:"text-xs font-mono text-champagne-400 mt-0.5",children:["@",a.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:[a.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:a.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(D,{className:"w-3.5 h-3.5 text-champagne-400"})," AES-256 (v",a.keyVersion,")"]})]})]})]}),e.jsxs("div",{className:"mt-5 pt-3 border-t border-white/10 flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{r(a.id),o("bot-details")},className:"flex-1 btn-astraea-subtle py-1.5 text-[11px]",children:[e.jsx(it,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"TELEMETRY"})]}),e.jsx("button",{onClick:()=>{r(a.id),o("message-studio")},className:"btn-astraea-gold py-1.5 px-3 text-[11px]",title:"Open Studio",children:e.jsx("span",{children:"STUDIO"})})]})]},a.id))}),s&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-md",children:e.jsxs("div",{className:"w-full max-w-lg astraea-panel-gold rounded-xl 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:()=>l(!1),className:"text-pearl-400 hover:text-pearl-100 p-1",children:e.jsx(M,{className:"w-5 h-5"})})]}),b?e.jsxs("div",{className:"py-8 text-center space-y-3",children:[e.jsx(J,{className:"w-12 h-12 text-emerald-400 mx-auto animate-bounce"}),e.jsx("div",{className:"text-sm font-cinzel text-pearl-50",children:b})]}):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:"Bot Display Name"}),e.jsx("input",{type:"text",value:u,onChange:a=>c(a.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:i,onChange:a=>f(a.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(D,{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:d,onChange:a=>x(a.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 items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:()=>l(!1),className:"btn-astraea-subtle py-2 px-4",children:"CANCEL"}),e.jsx("button",{type:"submit",disabled:j,className:"btn-astraea-gold py-2 px-5",children:j?e.jsxs(e.Fragment,{children:[e.jsx(xe,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"VALIDATING..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"REGISTER & ENCRYPT"})]})})]})]})]})})]})},Oa=({botId:o,onNavigate:r})=>e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",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",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-14 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(W,{className:"w-8 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-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 items-center gap-3 mt-1",children:[e.jsx("span",{className:"text-champagne-400",children:"@astraea_flagship_bot"}),e.jsx("span",{children:"·"}),e.jsxs("span",{className:"text-pearl-400",children:["ID: ",o]}),e.jsx("span",{children:"·"}),e.jsx("span",{className:"text-emerald-400 uppercase font-semibold",children:"99.98% UPTIME"})]})]})]}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("button",{onClick:()=>r("message-studio"),className:"btn-astraea-gold",children:[e.jsx("span",{children:"MESSAGE STUDIO"}),e.jsx(de,{className:"w-4 h-4"})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 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(Wt,{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(D,{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(Q,{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/",o]})]}),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(Ne,{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-6 border border-white/10",children:[e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-white/10 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(ut,{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 md:grid-cols-2 lg:grid-cols-4 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((t,m)=>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:t.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:t.role})]}),e.jsx("p",{className:"text-[11px] text-pearl-300 font-sans leading-relaxed",children:t.desc})]},m))})]})]}),Ba=[{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."}],Da=()=>{const[o,r]=n.useState(Ba),[t,m]=n.useState(!1),[s,l]=n.useState(""),[i,f]=n.useState(""),[u,c]=n.useState("all"),[d,x]=n.useState(25),[j,p]=n.useState(!1),b=async a=>{if(a.preventDefault(),!(!s.trim()||!i.trim())){p(!0);try{const w=await fetch("/api/v1/broadcasts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bot_id:"b-001",title:s,message_text:i,target_filter:u==="all"?{}:{locale:u},rate_limit_per_second:d,inline_keyboard:[[{text:"Explore Now 🌟",url:"https://example.com"}]]})}),k={id:`c-${Date.now()}`,title:s,status:"draft",totalRecipients:14280,deliveredCount:0,failedCount:0,rateLimitPerSec:d,targetLocale:u==="all"?void 0:u,messageSnippet:i.slice(0,70)};r([k,...o]),m(!1),l(""),f("")}catch{m(!1)}finally{p(!1)}}},v=a=>{r(N=>N.map(w=>w.id===a?{...w,status:"running",startedAt:new Date().toISOString(),deliveredCount:Math.floor(w.totalRecipients*.98)}:w))},g=a=>{r(N=>N.map(w=>w.id!==a?w:{...w,status:w.status==="running"?"paused":"running"}))};return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",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:"High-Throughput Campaign Engine"})]}),e.jsx("h1",{className:"font-cinzel 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:()=>m(!0),className:"btn-astraea-gold",children:[e.jsx(V,{className:"w-4 h-4"}),e.jsx("span",{children:"NEW BROADCAST"})]})]}),e.jsx("div",{className:"astraea-panel rounded-xl p-5 border border-white/10",children:e.jsx("div",{className:"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-[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:o.map(a=>{const N=a.totalRecipients>0?Math.round(a.deliveredCount/a.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:a.title}),e.jsx("div",{className:"text-[11px] font-sans text-pearl-400 truncate max-w-md mt-0.5",children:a.messageSnippet})]}),e.jsx("td",{className:"py-4 text-pearl-300",children:a.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: ",a.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 ${a.status==="completed"?"bg-emerald-500/10 text-emerald-300 border border-emerald-500/30":a.status==="running"?"bg-champagne-500/15 text-champagne-300 border border-champagne-400/40 animate-pulse":a.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:a.status})}),e.jsxs("td",{className:"py-4 text-pearl-200",children:[e.jsxs("div",{children:[a.deliveredCount.toLocaleString()," / ",a.totalRecipients.toLocaleString()]}),a.failedCount>0&&e.jsxs("div",{className:"text-[10px] text-rose-400",children:[a.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:`${N}%`}})}),e.jsxs("span",{className:"text-[10px] text-pearl-400 mt-1 block",children:[N,"% complete (",a.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:[a.status==="draft"&&e.jsxs("button",{onClick:()=>v(a.id),className:"btn-astraea-gold py-1 px-3 text-[10px]",children:[e.jsx(Me,{className:"w-3 h-3"}),e.jsx("span",{children:"DISPATCH"})]}),(a.status==="running"||a.status==="paused")&&e.jsxs("button",{onClick:()=>g(a.id),className:"btn-astraea-subtle py-1 px-2.5 text-[10px]",children:[a.status==="running"?e.jsx(Jt,{className:"w-3 h-3 text-amber-400"}):e.jsx(Me,{className:"w-3 h-3 text-emerald-400"}),e.jsx("span",{children:a.status==="running"?"PAUSE":"RESUME"})]}),a.status==="completed"&&e.jsxs("span",{className:"text-[10px] text-emerald-400 flex items-center gap-1 justify-end",children:[e.jsx(J,{className:"w-3.5 h-3.5"})," Delivered"]})]})})]},a.id)})})]})})}),t&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-md",children:e.jsxs("div",{className:"w-full max-w-xl astraea-panel-gold rounded-xl 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:()=>m(!1),className:"text-pearl-400 hover:text-pearl-100 p-1",children:e.jsx(M,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:b,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:s,onChange:a=>l(a.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:i,onChange:a=>f(a.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-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:u,onChange:a=>c(a.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:d,onChange:a=>x(Number(a.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(F,{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:()=>m(!1),className:"btn-astraea-subtle py-2 px-4",children:"CANCEL"}),e.jsxs("button",{type:"submit",disabled:j,className:"btn-astraea-gold py-2 px-5",children:[e.jsx(De,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"SAVE CAMPAIGN"})]})]})]})]})})]})},nt=[{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}],$a=()=>{const[o,r]=n.useState(nt),[t,m]=n.useState(nt[0]),[s,l]=n.useState(!1),[i,f]=n.useState(!1),[u,c]=n.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"}]),[d,x]=n.useState([{role:"assistant",content:"Greetings. I am your autonomous AI Concierge. How may I assist your Telegram bot subscribers today?",tokens:28,costCents:.001}]),[j,p]=n.useState(""),[b,v]=n.useState(!1),g=async a=>{if(a.preventDefault(),!j.trim()||b)return;const N=j.trim();p(""),x(w=>[...w,{role:"user",content:N}]),v(!0);try{const w=await fetch(`/api/v1/ai/agents/${t.id}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:N})});if(w.ok){const k=await w.json();x(C=>{var S,_,T;return[...C,{role:"assistant",content:((S=k.data)==null?void 0:S.content)||"Completion generated successfully.",tokens:((_=k.data)==null?void 0:_.total_tokens)||45,costCents:((T=k.data)==null?void 0:T.cost_cents)||.002}]})}else setTimeout(()=>{x(k=>[...k,{role:"assistant",content:`🤖 [${t.name}]: I have processed your inquiry about "${N}". All parameters are verified and operational.`,tokens:52,costCents:.0025}])},600)}catch{setTimeout(()=>{x(w=>[...w,{role:"assistant",content:`🤖 [${t.name}]: I have received your message: "${N}".`,tokens:35,costCents:.0015}])},500)}finally{v(!1)}};return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",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:"Autonomous Intelligence Center"})]}),e.jsx("h1",{className:"font-cinzel 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 items-center gap-3",children:[e.jsxs("button",{onClick:()=>f(!0),className:"btn-astraea-subtle",children:[e.jsx(Je,{className:"w-3.5 h-3.5 text-champagne-400"}),e.jsx("span",{children:"API KEYS VAULT"})]}),e.jsxs("button",{onClick:()=>l(!0),className:"btn-astraea-gold",children:[e.jsx(V,{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:o.map(a=>{const N=a.id===t.id;return e.jsxs("div",{onClick:()=>m(a),className:`p-4 rounded-xl border cursor-pointer transition-all ${N?"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(ot,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-cinzel text-sm text-pearl-100 font-medium",children:a.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:a.model}),e.jsx("span",{children:"·"}),e.jsx("span",{className:"uppercase text-[10px] text-pearl-400",children:"Temp:"}),e.jsx("span",{children:a.temperature})]}),e.jsxs("p",{className:"text-[11px] font-sans text-pearl-400 mt-2 line-clamp-2 leading-relaxed",children:['"',a.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: ",a.totalTokens.toLocaleString()]}),e.jsx("span",{className:"text-champagne-400",children:"Click to test console"})]})]},a.id)})})]}),e.jsxs("div",{className:"lg:col-span-7 astraea-panel rounded-xl border border-white/10 flex flex-col h-[580px]",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(Ne,{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: ",t.name]}),e.jsxs("div",{className:"text-[10px] font-mono text-champagne-400",children:[t.provider.toUpperCase()," · ",t.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:[d.map((a,N)=>e.jsxs("div",{className:`flex flex-col ${a.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 ${a.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:a.content}),a.tokens!==void 0&&e.jsxs("span",{className:"text-[9px] font-mono text-pearl-400 mt-1 px-1",children:[a.tokens," tokens · $",a.costCents]})]},N)),b&&e.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-champagne-400",children:[e.jsx(xe,{className:"w-3.5 h-3.5 animate-spin"}),e.jsxs("span",{children:["Generating completion from ",t.model,"..."]})]})]}),e.jsxs("form",{onSubmit:g,className:"p-4 border-t border-white/10 flex items-center gap-2",children:[e.jsx("input",{type:"text",value:j,onChange:a=>p(a.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:b||!j.trim(),className:"btn-astraea-gold py-2.5 px-4",children:e.jsx(De,{className:"w-3.5 h-3.5"})})]})]})]}),i&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-md",children:e.jsxs("div",{className:"w-full max-w-lg astraea-panel-gold rounded-xl 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(Je,{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:()=>f(!1),className:"text-pearl-400 hover:text-pearl-100 p-1",children:e.jsx(M,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"space-y-3 mb-5",children:u.map(a=>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:a.name}),e.jsxs("div",{className:"text-champagne-400 text-[11px] uppercase mt-0.5",children:[a.provider," · ",a.masked]})]}),e.jsxs("span",{className:"text-[10px] text-emerald-400 flex items-center gap-1",children:[e.jsx(D,{className:"w-3.5 h-3.5"})," AES-256"]})]},a.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:()=>f(!1),className:"btn-astraea-gold py-2 px-5",children:"CLOSE VAULT"})})]})})]})},rt=[{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"]}}],Ua=()=>{const[o,r]=n.useState(rt),[t,m]=n.useState(rt[1]),[s,l]=n.useState("price"),[i,f]=n.useState("BTC"),[u,c]=n.useState({symbol:"BTC",price_usd:96450,formatted:"$96,450.00","24h_change":"+3.45%",source:"Sandboxed In-Memory Crypto Mock Engine"}),[d,x]=n.useState(!1),j=async()=>{var b;x(!0);try{const v=await fetch(`/api/v1/plugins/${t.id}/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hook_name:"on_command",payload:{command:s,args:[i]}})});if(v.ok){const g=await v.json();c(((b=g.data)==null?void 0:b.output)||{status:"success"})}else setTimeout(()=>{c({symbol:i.toUpperCase(),price_usd:i.toUpperCase()==="ETH"?3420.5:96450,formatted:i.toUpperCase()==="ETH"?"$3,420.50":"$96,450.00","24h_change":"+2.8%",timestamp:new Date().toISOString()}),x(!1)},500)}catch{setTimeout(()=>{c({symbol:i.toUpperCase(),price_usd:96450,formatted:"$96,450.00",execution:"Sandboxed sandbox OK"}),x(!1)},400)}},p=b=>{r(v=>v.map(g=>g.id===b?{...g,isInstalled:!g.isInstalled}:g))};return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",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 md:grid-cols-2 lg:grid-cols-4 gap-4",children:o.map(b=>e.jsxs("div",{onClick:()=>m(b),className:`astraea-panel rounded-xl p-5 border flex flex-col justify-between cursor-pointer transition-all ${t.id===b.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:[b.category," · v",b.version]}),e.jsx("span",{className:`px-2 py-0.5 rounded text-[9px] font-mono uppercase ${b.isInstalled?"bg-emerald-500/10 text-emerald-300 border border-emerald-500/30":"bg-space-800 text-pearl-400"}`,children:b.isInstalled?"ACTIVE":"AVAILABLE"})]}),e.jsx("h3",{className:"font-cinzel text-base text-pearl-50 font-normal tracking-wide",children:b.name}),e.jsx("p",{className:"text-xs font-sans text-pearl-300 mt-2 leading-relaxed",children:b.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:b.permissions.map((v,g)=>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:v},g))})]})]}),e.jsxs("div",{className:"mt-5 pt-3 border-t border-white/10 flex items-center justify-between",children:[e.jsx("button",{onClick:v=>{v.stopPropagation(),p(b.id)},className:`py-1.5 px-3 text-[11px] font-mono uppercase rounded transition-all ${b.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:b.isInstalled?"DEACTIVATE":"INSTALL PLUGIN"}),e.jsx("span",{className:"text-[10px] font-mono text-champagne-400",children:"Inspect Hook"})]})]},b.id))}),e.jsxs("div",{className:"astraea-panel rounded-xl p-6 border border-white/10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between 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",children:e.jsx(ut,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-cinzel text-base text-pearl-50 font-normal tracking-wide",children:["Sandboxed Hook Tester: ",t.name]}),e.jsx("p",{className:"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",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:s,onChange:b=>l(b.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:i,onChange:b=>f(b.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:j,disabled:d,className:"w-full btn-astraea-gold py-2 text-xs",children:[d?e.jsx(xe,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Me,{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(u,null,2)})]})]})]})},za=[{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"}],Va=()=>{const[o,r]=n.useState(za),[t,m]=n.useState(""),[s,l]=n.useState("all"),i=async u=>{r(c=>c.map(d=>{if(d.id!==u)return d;const x=!d.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:d.telegramUserId,opt_out:x})}).catch(()=>{}),{...d,isOptedOut:x}}))},f=o.filter(u=>{const c=u.name.toLowerCase().includes(t.toLowerCase())||u.username.toLowerCase().includes(t.toLowerCase())||u.telegramUserId.toString().includes(t),d=s==="all"||u.locale===s;return c&&d});return e.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",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-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 items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Se,{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:t,onChange:u=>m(u.target.value),placeholder:"Search user or ID...",className:"pl-8 pr-3 py-1.5 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:s,onChange:u=>l(u.target.value),className:"px-3 py-1.5 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-5 border border-white/10",children:e.jsx("div",{className:"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-[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:f.map(u=>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:u.name.slice(0,2).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"font-sans font-medium text-pearl-50 text-xs",children:u.name}),e.jsxs("div",{className:"text-[10px] text-champagne-400",children:["@",u.username]})]})]}),e.jsx("td",{className:"py-3.5 text-pearl-300",children:u.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:u.locale})}),e.jsx("td",{className:"py-3.5",children:u.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:u.isOptedOut?e.jsxs("span",{className:"text-amber-400 text-[11px] flex items-center gap-1",children:[e.jsx(qt,{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(J,{className:"w-3.5 h-3.5"})," Subscribed"]})}),e.jsx("td",{className:"py-3.5 text-pearl-400 text-[11px]",children:u.firstSeen}),e.jsx("td",{className:"py-3.5 pr-2 text-right",children:e.jsx("button",{onClick:()=>i(u.id),className:"text-xs text-champagne-400 hover:text-champagne-300",children:u.isOptedOut?"Re-enable":"Opt-Out"})})]},u.id))})]})})})]})},Fa=[{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}],Ga=()=>{const[o,r]=n.useState(Fa),[t,m]=n.useState(""),[s,l]=n.useState("all"),[i,f]=n.useState(null),[u,c]=n.useState(!1),[d,x]=n.useState(`{