immortal-bnb/frontend/.next/static/chunks/app/page-523ea16d0acb6fd0.js
2025-11-08 03:43:07 +03:00

1 line
35 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{8571:function(e,t,s){Promise.resolve().then(s.bind(s,9135)),Promise.resolve().then(s.bind(s,3777)),Promise.resolve().then(s.bind(s,7048)),Promise.resolve().then(s.bind(s,1075)),Promise.resolve().then(s.bind(s,9483)),Promise.resolve().then(s.bind(s,8145)),Promise.resolve().then(s.bind(s,9372))},9135:function(e,t,s){"use strict";s.d(t,{default:function(){return l}});var a=s(7437),r=s(3178);function l(){let{status:e,message:t,walletConnected:s,aiEnabled:l,needsSetup:n,isLoading:d,error:i,isToggling:c,toggleBot:o}=(0,r.p)();return(0,a.jsxs)("div",{className:"bg-slate-800/50 backdrop-blur-sm border border-slate-700 rounded-lg p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-white",children:"Bot Status"}),(0,a.jsx)("div",{className:"px-3 py-1 rounded-full text-sm font-medium ".concat((()=>{switch(e){case"running":return"bg-green-500/20 border-green-500/30";case"stopped":return"bg-yellow-500/20 border-yellow-500/30";case"error":return"bg-red-500/20 border-red-500/30";case"demo":return"bg-blue-500/20 border-blue-500/30";default:return"bg-slate-500/20 border-slate-500/30"}})()," ").concat((()=>{switch(e){case"running":return"text-green-400";case"stopped":return"text-yellow-400";case"error":return"text-red-400";case"demo":return"text-blue-400";default:return"text-slate-400"}})()),children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full ".concat("running"===e?"bg-green-500 animate-pulse":"error"===e?"bg-red-500":"demo"===e?"bg-blue-500":"bg-yellow-500")}),(0,a.jsx)("span",{children:(()=>{switch(e){case"running":return"Running";case"stopped":return"Stopped";case"error":return"Error";case"demo":return"Demo Mode";default:return"Unknown"}})()})]})})]}),n&&(0,a.jsxs)("div",{className:"bg-yellow-500/20 border border-yellow-500/30 text-yellow-400 p-4 rounded-lg mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 mb-2",children:[(0,a.jsx)("div",{className:"w-5 h-5",children:"⚠️"}),(0,a.jsx)("span",{className:"font-medium",children:"Configuration Required"})]}),(0,a.jsxs)("div",{className:"text-sm text-yellow-300 space-y-1",children:[(0,a.jsx)("p",{children:"To start trading, please configure:"}),(0,a.jsxs)("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[(0,a.jsx)("li",{children:"Wallet Private Key (WALLET_PRIVATE_KEY)"}),(0,a.jsx)("li",{children:"OpenRouter AI API Key (OPENROUTER_API_KEY)"}),(0,a.jsx)("li",{children:"Telegram Bot Token (TELEGRAM_BOT_TOKEN) - optional"})]}),(0,a.jsxs)("p",{className:"mt-2 text-xs",children:["Create a ",(0,a.jsx)("code",{children:".env"})," file in the project root with your configuration."]})]})]}),i&&(0,a.jsx)("div",{className:"bg-red-500/20 border border-red-500/30 text-red-400 p-3 rounded-lg mb-4 text-sm",children:i}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("div",{className:"text-sm text-slate-400 mb-1",children:"Status"}),(0,a.jsx)("div",{className:"text-white",children:t})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full ".concat(s?"bg-green-500":"bg-red-500")}),(0,a.jsx)("span",{className:"text-sm text-slate-300",children:"Wallet"})]}),(0,a.jsx)("span",{className:"text-xs text-slate-400",children:s?"Connected":"Not configured"})]}),(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full ".concat(l?"bg-green-500":"bg-red-500")}),(0,a.jsx)("span",{className:"text-sm text-slate-300",children:"AI Engine"})]}),(0,a.jsx)("span",{className:"text-xs text-slate-400",children:l?"Ready":"API key needed"})]})]}),d?(0,a.jsxs)("div",{className:"text-center py-4",children:[(0,a.jsx)("div",{className:"w-6 h-6 border-2 border-slate-400 border-t-transparent rounded-full animate-spin mx-auto mb-2"}),(0,a.jsx)("div",{className:"text-sm text-slate-400",children:"Loading status..."})]}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("button",{onClick:o,disabled:n||c,className:"w-full py-3 px-4 rounded-lg font-medium transition-all duration-200 ".concat(n?"bg-gray-500/20 text-gray-400 cursor-not-allowed":"running"===e?"bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30":"bg-green-500/20 text-green-400 hover:bg-green-500/30 border border-green-500/30"),children:c?(0,a.jsxs)("div",{className:"flex items-center justify-center space-x-2",children:[(0,a.jsx)("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),(0,a.jsx)("span",{children:"Processing..."})]}):n?"Configure Bot First":"running"===e?"Stop Bot":"Start Bot"}),!n&&(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-center",children:[(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-3",children:[(0,a.jsx)("div",{className:"text-sm text-slate-400",children:"Mode"}),(0,a.jsx)("div",{className:"text-white font-medium",children:"demo"===e?"Demo":"Live Trading"})]}),(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-3",children:[(0,a.jsx)("div",{className:"text-sm text-slate-400",children:"Network"}),(0,a.jsx)("div",{className:"text-white font-medium",children:"BNB Chain"})]})]})]})]})}},3777:function(e,t,s){"use strict";s.d(t,{default:function(){return l}});var a=s(7437),r=s(3178);function l(){let{totalProfit:e,profitChange:t,totalTrades:s,successRate:l,activePositions:n,daysProfitable:d,aiStatus:i,isLoading:c,error:o}=(0,r.f_)();return(0,a.jsxs)("div",{className:"bg-slate-800/50 backdrop-blur-sm border border-slate-700 rounded-lg p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"Last 30 days"})]}),o&&(0,a.jsxs)("div",{className:"bg-red-500/20 border border-red-500/30 text-red-400 p-3 rounded-lg mb-4 text-sm",children:["Failed to load dashboard stats: ",o]}),c?(0,a.jsxs)("div",{className:"space-y-4 animate-pulse",children:[(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-4",children:[(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-1/3 mb-2"}),(0,a.jsx)("div",{className:"h-8 bg-slate-700 rounded w-1/2 mb-2"}),(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-1/4"})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3",children:[void 0,void 0,void 0,void 0].map((e,t)=>(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-3",children:[(0,a.jsx)("div",{className:"h-6 bg-slate-700 rounded mb-2"}),(0,a.jsx)("div",{className:"h-3 bg-slate-700 rounded"})]},t))})]}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"bg-slate-900/50 rounded-lg p-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm text-slate-400",children:"Total Profit"}),(0,a.jsxs)("div",{className:"text-2xl font-bold text-green-400",children:["$",e]})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsxs)("div",{className:"text-sm ".concat(t.startsWith("+")?"text-green-400":t.startsWith("-")?"text-red-400":"text-slate-400"),children:[t,"%"]}),(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"This month"})]})]})}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-3",children:[(0,a.jsx)("div",{className:"text-lg font-semibold text-white",children:s}),(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"Total Trades"})]}),(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-3",children:[(0,a.jsxs)("div",{className:"text-lg font-semibold text-blue-400",children:[l,"%"]}),(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"Success Rate"})]}),(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-3",children:[(0,a.jsx)("div",{className:"text-lg font-semibold text-purple-400",children:n}),(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"Active Positions"})]}),(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-3",children:[(0,a.jsx)("div",{className:"text-lg font-semibold text-yellow-400",children:d}),(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"Profitable Days"})]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-r from-purple-500/10 to-blue-500/10 border border-purple-500/30 rounded-lg p-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3 mb-2",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full ".concat(i.isLearning?"bg-purple-500 animate-pulse":"bg-slate-500")}),(0,a.jsx)("span",{className:"text-sm font-medium text-white",children:"AI Learning Status"}),(0,a.jsxs)("div",{className:"ml-auto text-xs text-purple-400",children:["Confidence: ",i.confidence,"%"]})]}),(0,a.jsx)("div",{className:"text-xs text-slate-300 leading-relaxed",children:i.isLearning?"The AI has processed ".concat(i.memoryCount," memories and is actively learning from market patterns. Current confidence level: ").concat(i.confidence>70?"High":i.confidence>40?"Medium":"Low","."):"AI learning is currently paused. Memory evolution will resume when bot is active."}),i.lastUpdate&&(0,a.jsxs)("div",{className:"text-xs text-slate-500 mt-2",children:["Last updated: ",new Date(i.lastUpdate).toLocaleString()]})]})]})]})}},7048:function(e,t,s){"use strict";s.d(t,{default:function(){return m}});var a=s(7437),r=s(2265),l=s(7625),n=s(8336),d=s(6940),i=s(7059),c=s(2994),o=s(8147),x=s(4061),u=s(3178);function m(){let[e,t]=(0,r.useState)("24h"),{totalProfit:s,profitChange:m,chartData:h,stats:b,isLoading:g,error:p}=(0,u.ax)();return(0,a.jsxs)("div",{className:"bg-slate-800/50 backdrop-blur-sm border border-slate-700 rounded-lg p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-white",children:"Performance"}),(0,a.jsx)("div",{className:"flex space-x-2",children:["24h","7d","30d"].map(s=>(0,a.jsx)("button",{onClick:()=>t(s),className:"px-3 py-1 text-xs rounded-md transition-colors ".concat(e===s?"bg-purple-500 text-white":"text-slate-400 hover:text-white"),children:s},s))})]}),p&&(0,a.jsxs)("div",{className:"bg-red-500/20 border border-red-500/30 text-red-400 p-3 rounded-lg mb-4 text-sm",children:["Failed to load performance data: ",p]}),g?(0,a.jsxs)("div",{className:"space-y-4 animate-pulse",children:[(0,a.jsx)("div",{className:"h-6 bg-slate-700 rounded w-1/3"}),(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-1/4"}),(0,a.jsx)("div",{className:"h-64 bg-slate-700 rounded"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"h-6 bg-slate-700 rounded mb-1"}),(0,a.jsx)("div",{className:"h-3 bg-slate-700 rounded"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"h-6 bg-slate-700 rounded mb-1"}),(0,a.jsx)("div",{className:"h-3 bg-slate-700 rounded"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"h-6 bg-slate-700 rounded mb-1"}),(0,a.jsx)("div",{className:"h-3 bg-slate-700 rounded"})]})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("div",{className:"text-2xl font-bold text-white mb-1",children:["$",s]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("span",{className:"text-sm ".concat(m.startsWith("+")?"text-green-400":m.startsWith("-")?"text-red-400":"text-slate-400"),children:[m,"%"]}),(0,a.jsxs)("span",{className:"text-slate-400 text-sm",children:["vs last ",e]})]})]}),(0,a.jsx)("div",{className:"h-64",children:h.length>0?(0,a.jsx)(l.h,{width:"100%",height:"100%",children:(0,a.jsxs)(n.w,{data:h,children:[(0,a.jsx)(d.q,{strokeDasharray:"3 3",stroke:"#374151"}),(0,a.jsx)(i.K,{dataKey:"time",stroke:"#9CA3AF",fontSize:12}),(0,a.jsx)(c.B,{stroke:"#9CA3AF",fontSize:12,domain:["dataMin - 50","dataMax + 50"]}),(0,a.jsx)(o.u,{contentStyle:{backgroundColor:"#1E293B",border:"1px solid #475569",borderRadius:"8px",color:"#F8FAFC"}}),(0,a.jsx)(x.x,{type:"monotone",dataKey:"value",stroke:"#8B5CF6",strokeWidth:2,dot:{fill:"#8B5CF6",strokeWidth:2,r:4},activeDot:{r:6,stroke:"#8B5CF6",strokeWidth:2}})]})}):(0,a.jsx)("div",{className:"flex items-center justify-center h-full text-slate-400",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-lg mb-2",children:"No performance data"}),(0,a.jsx)("div",{className:"text-sm",children:"Start trading to see performance chart"})]})})}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4 mt-4 pt-4 border-t border-slate-700",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-lg font-semibold ".concat(b.todayProfit.startsWith("+")?"text-green-400":b.todayProfit.startsWith("-")?"text-red-400":"text-slate-400"),children:b.todayProfit}),(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"Today"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-lg font-semibold text-purple-400",children:b.todayTrades}),(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"Trades"})]}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsxs)("div",{className:"text-lg font-semibold text-blue-400",children:[b.todayWinRate,"%"]}),(0,a.jsx)("div",{className:"text-xs text-slate-400",children:"Win Rate"})]})]})]})]})}},1075:function(e,t,s){"use strict";s.d(t,{default:function(){return l}});var a=s(7437),r=s(2265);function l(){let[e,t]=(0,r.useState)(!1);return(0,a.jsxs)("div",{className:"bg-slate-800/50 backdrop-blur-sm border border-slate-700 rounded-lg p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-white",children:"\uD83D\uDE80 Quick Setup Guide"}),(0,a.jsx)("button",{onClick:()=>t(!e),className:"text-sm text-blue-400 hover:text-blue-300",children:e?"Hide Guide":"Show Setup"})]}),e&&(0,a.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-4",children:[(0,a.jsx)("h3",{className:"text-white font-medium mb-2",children:"1. Environment Configuration"}),(0,a.jsxs)("p",{className:"text-slate-300 mb-2",children:["Create a ",(0,a.jsx)("code",{className:"bg-slate-700 px-1 rounded",children:".env"})," file in your project root:"]}),(0,a.jsx)("pre",{className:"bg-slate-800 p-3 rounded text-xs text-slate-300 overflow-x-auto",children:"# Required for trading\nWALLET_PRIVATE_KEY=your_wallet_private_key_here\nOPENROUTER_API_KEY=your_openrouter_api_key_here\n\n# Optional\nTELEGRAM_BOT_TOKEN=your_telegram_bot_token_here\nTELEGRAM_CHAT_ID=your_telegram_chat_id_here\n\n# Network Configuration\nTRADING_NETWORK=opbnb # or 'bnb'\nNETWORK=testnet # or 'mainnet'"})]}),(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-4",children:[(0,a.jsx)("h3",{className:"text-white font-medium mb-2",children:"2. Get API Keys"}),(0,a.jsxs)("ul",{className:"space-y-1 text-slate-300",children:[(0,a.jsxs)("li",{children:["• ",(0,a.jsx)("a",{href:"https://openrouter.ai",className:"text-blue-400 hover:underline",children:"OpenRouter AI"})," - For AI trading decisions"]}),(0,a.jsxs)("li",{children:["• ",(0,a.jsx)("a",{href:"https://t.me/botfather",className:"text-blue-400 hover:underline",children:"Telegram BotFather"})," - For notifications (optional)"]}),(0,a.jsx)("li",{children:"• MetaMask/Trust Wallet - For wallet private key"})]})]}),(0,a.jsxs)("div",{className:"bg-slate-900/50 rounded-lg p-4",children:[(0,a.jsx)("h3",{className:"text-white font-medium mb-2",children:"3. Start Trading"}),(0,a.jsxs)("div",{className:"space-y-2 text-slate-300",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:"\uD83D\uDCC1"}),(0,a.jsx)("code",{className:"bg-slate-700 px-2 py-1 rounded",children:"npm install"}),(0,a.jsx)("span",{children:"- Install dependencies"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:"⚡"}),(0,a.jsx)("code",{className:"bg-slate-700 px-2 py-1 rounded",children:"npm run dev"}),(0,a.jsx)("span",{children:"- Start development servers"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{children:"\uD83D\uDD25"}),(0,a.jsx)("code",{className:"bg-slate-700 px-2 py-1 rounded",children:"npm run bot"}),(0,a.jsx)("span",{children:"- Start trading bot"})]})]})]}),(0,a.jsx)("div",{className:"bg-yellow-500/20 border border-yellow-500/30 text-yellow-400 p-3 rounded-lg",children:(0,a.jsxs)("p",{className:"text-sm",children:[(0,a.jsx)("strong",{children:"⚠️ Safety First:"})," Start with testnet and small amounts. Never share your private keys or commit them to version control."]})})]})]})}},9483:function(e,t,s){"use strict";s.d(t,{default:function(){return l}});var a=s(7437),r=s(3178);function l(){let{trades:e,total:t,isLoading:s,error:l,refresh:n}=(0,r.MR)(10),d=e=>{switch(e){case"completed":return"text-green-400 bg-green-500/20";case"pending":return"text-yellow-400 bg-yellow-500/20";case"failed":return"text-red-400 bg-red-500/20";default:return"text-slate-400 bg-slate-500/20"}},i=e=>"buy"===e?"text-blue-400":"text-orange-400",c=e=>e?e.startsWith("+")?"text-green-400":"text-red-400":"text-slate-400";return(0,a.jsxs)("div",{className:"bg-slate-800/50 backdrop-blur-sm border border-slate-700 rounded-lg p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-white",children:"Trading History"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[t>0&&(0,a.jsxs)("span",{className:"text-sm text-slate-400",children:["Showing ",e.length," of ",t]}),(0,a.jsx)("button",{onClick:n,className:"text-sm text-purple-400 hover:text-purple-300 transition-colors",children:s?"Loading...":"Refresh"})]})]}),l&&(0,a.jsxs)("div",{className:"bg-red-500/20 border border-red-500/30 text-red-400 p-3 rounded-lg mb-4 text-sm",children:["Failed to load trading history: ",l,(0,a.jsx)("button",{onClick:n,className:"ml-2 underline hover:no-underline",children:"Try Again"})]}),s?(0,a.jsx)("div",{className:"space-y-3",children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,a.jsxs)("div",{className:"bg-slate-900/50 border border-slate-700 rounded-lg p-4 animate-pulse",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-20"}),(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-12"}),(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-16"})]}),(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-16"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"h-3 bg-slate-700 rounded w-32"}),(0,a.jsx)("div",{className:"h-3 bg-slate-700 rounded w-24"})]})]},t))}):(0,a.jsx)("div",{className:"space-y-3",children:e.map(e=>(0,a.jsxs)("div",{className:"bg-slate-900/50 border border-slate-700 rounded-lg p-4 hover:bg-slate-900/70 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("span",{className:"font-semibold text-white",children:e.pair}),(0,a.jsx)("span",{className:"text-sm font-medium capitalize ".concat(i(e.type)),children:e.type}),(0,a.jsx)("div",{className:"text-xs px-2 py-1 rounded-full ".concat(d(e.status)),children:e.status})]}),e.pnl&&(0,a.jsx)("div",{className:"text-sm font-medium ".concat(c(e.pnl)),children:e.pnl})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,a.jsxs)("div",{className:"text-slate-400",children:[e.amount," BNB @ ",e.price]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("div",{className:"text-slate-500 text-xs",children:new Date(e.timestamp).toLocaleString()}),e.txHash&&(0,a.jsx)("button",{onClick:()=>window.open("https://bscscan.com/tx/".concat(e.txHash),"_blank"),className:"text-xs text-purple-400 hover:text-purple-300 transition-colors",children:"View Tx"})]})]})]},e.id))}),!s&&!l&&0===e.length&&(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("div",{className:"text-slate-400 mb-2",children:"No trades yet"}),(0,a.jsx)("div",{className:"text-sm text-slate-500",children:"Start the bot to see trading history"})]}),e.length>0&&t>e.length&&(0,a.jsx)("div",{className:"mt-4 text-center",children:(0,a.jsxs)("button",{className:"text-sm text-purple-400 hover:text-purple-300 transition-colors",children:["View All ",t," Trades"]})})]})}},8145:function(e,t,s){"use strict";s.d(t,{default:function(){return n}});var a=s(7437),r=s(5347),l=s(3178);function n(){let{isConnected:e,address:t,connect:s,isConnecting:n,error:d,network:i,balance:c}=(0,r.$)(),{balance:o,usdValue:x,isLoading:u,error:m}=(0,l.vL)(t);return(0,a.jsxs)("div",{className:"bg-slate-800/50 backdrop-blur-sm border border-slate-700 rounded-lg p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-white",children:"Wallet Info"}),e?(0,a.jsx)("div",{className:"text-xs text-green-400 bg-green-500/20 px-2 py-1 rounded",children:"Connected"}):(0,a.jsx)("div",{className:"text-xs text-gray-400 bg-gray-500/20 px-2 py-1 rounded",children:"Not Connected"})]}),e?(0,a.jsxs)("div",{className:"space-y-4",children:[m&&(0,a.jsx)("div",{className:"bg-red-500/20 border border-red-500/30 text-red-400 p-3 rounded-lg text-sm",children:m}),u?(0,a.jsxs)("div",{className:"space-y-4 animate-pulse",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-1/3 mb-1"}),(0,a.jsx)("div",{className:"h-8 bg-slate-700 rounded w-2/3 mb-1"}),(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-1/2"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-1/4 mb-1"}),(0,a.jsx)("div",{className:"h-6 bg-slate-700 rounded"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"h-4 bg-slate-700 rounded w-1/4 mb-1"}),(0,a.jsx)("div",{className:"h-6 bg-slate-700 rounded w-1/2"})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm text-slate-400 mb-1",children:"BNB Balance"}),(0,a.jsxs)("div",{className:"text-2xl font-bold text-white",children:[c||o," BNB"]}),(0,a.jsxs)("div",{className:"text-sm text-slate-400",children:["$",x," USD"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm text-slate-400 mb-1",children:"Address"}),(0,a.jsx)("div",{className:"text-sm font-mono text-slate-300 bg-slate-900/50 p-2 rounded break-all",children:t}),(0,a.jsx)("button",{onClick:()=>navigator.clipboard.writeText(t||""),className:"text-xs text-purple-400 hover:text-purple-300 mt-1 transition-colors",children:"Copy Address"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm text-slate-400 mb-1",children:"Network"}),(0,a.jsx)("div",{className:"text-sm text-white bg-yellow-500/20 text-yellow-400 px-2 py-1 rounded inline-block",children:i||"BNB Smart Chain"})]}),(0,a.jsxs)("div",{className:"pt-4 border-t border-slate-700",children:[(0,a.jsx)("div",{className:"text-sm text-slate-400 mb-2",children:"Quick Actions"}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{className:"flex-1 bg-purple-500/20 text-purple-400 hover:bg-purple-500/30 px-3 py-2 rounded text-sm transition-colors",children:"View on Explorer"}),(0,a.jsx)("button",{className:"flex-1 bg-blue-500/20 text-blue-400 hover:bg-blue-500/30 px-3 py-2 rounded text-sm transition-colors",children:"Add BNB"})]})]})]})]}):(0,a.jsxs)("div",{className:"text-center space-y-4",children:[(0,a.jsx)("div",{className:"text-gray-400 text-sm mb-4",children:"Connect your wallet to view balance and trading information"}),(0,a.jsx)("button",{onClick:s,disabled:n,className:"bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 disabled:from-gray-500 disabled:to-gray-600 disabled:cursor-not-allowed text-white font-medium py-3 px-6 rounded-lg transition-all duration-200 transform hover:scale-105 disabled:transform-none",children:n?(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),(0,a.jsx)("span",{children:"Connecting..."})]}):"Connect Wallet"}),d&&(0,a.jsx)("div",{className:"bg-red-500/20 border border-red-500/30 text-red-400 p-3 rounded-lg text-sm",children:d}),(0,a.jsxs)("div",{className:"text-xs text-gray-500 space-y-1",children:[(0,a.jsx)("p",{children:"Supported wallets:"}),(0,a.jsx)("p",{children:"• MetaMask • Trust Wallet • WalletConnect"}),(0,a.jsx)("p",{children:"• Coinbase Wallet • Brave Wallet"})]})]})]})}},9372:function(e,t,s){"use strict";s.d(t,{default:function(){return l}});var a=s(7437),r=s(5347);function l(){let{isConnected:e,address:t,connect:s,disconnect:l}=(0,r.$)();return(0,a.jsx)("header",{className:"border-b border-slate-700 bg-slate-900/50 backdrop-blur-sm",children:(0,a.jsx)("div",{className:"container mx-auto px-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-gradient-to-r from-purple-500 to-blue-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)("span",{className:"text-white font-bold text-sm",children:"IM"})}),(0,a.jsx)("h1",{className:"text-xl font-bold text-white",children:"Immortal AI"})]}),(0,a.jsxs)("nav",{className:"hidden md:flex items-center space-x-8",children:[(0,a.jsx)("a",{href:"#dashboard",className:"text-slate-300 hover:text-white transition-colors",children:"Dashboard"}),(0,a.jsx)("a",{href:"#trading",className:"text-slate-300 hover:text-white transition-colors",children:"Trading"}),(0,a.jsx)("a",{href:"#staking",className:"text-slate-300 hover:text-white transition-colors",children:"Staking"}),(0,a.jsx)("a",{href:"#analytics",className:"text-slate-300 hover:text-white transition-colors",children:"Analytics"})]}),(0,a.jsx)("div",{className:"flex items-center space-x-4",children:e?(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 bg-green-500/20 text-green-400 px-3 py-1 rounded-full text-sm",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,a.jsx)("span",{children:"Connected"})]}),(0,a.jsxs)("div",{className:"text-slate-300 text-sm font-mono",children:[null==t?void 0:t.slice(0,6),"...",null==t?void 0:t.slice(-4)]}),(0,a.jsx)("button",{onClick:l,className:"bg-red-500/20 text-red-400 hover:bg-red-500/30 px-3 py-1 rounded-md text-sm transition-colors",children:"Disconnect"})]}):(0,a.jsx)("button",{onClick:s,className:"bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-md font-medium transition-colors",children:"Connect Wallet"})})]})})})}},5347:function(e,t,s){"use strict";s.d(t,{$:function(){return d},default:function(){return n}});var a=s(7437),r=s(2265);let l=(0,r.createContext)({isConnected:!1,address:null,isConnecting:!1,error:null,network:null,balance:null,connect:async()=>{},disconnect:()=>{},switchNetwork:async()=>{}});function n(e){let{children:t}=e,[s,n]=(0,r.useState)(!1),[d,i]=(0,r.useState)(null),[c,o]=(0,r.useState)(!1),[x,u]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),[b,g]=(0,r.useState)(null);(0,r.useEffect)(()=>{(async()=>{if(window.ethereum)try{let e=await window.ethereum.request({method:"eth_accounts"});e.length>0&&(i(e[0]),n(!0),await p(e[0]))}catch(e){console.error("Failed to check wallet connection:",e)}})()},[]);let p=async e=>{if(window.ethereum)try{let t=await window.ethereum.request({method:"eth_chainId"});h({"0x1":"Ethereum","0x38":"BNB Chain","0xcc":"opBNB Mainnet","0x15eb":"opBNB Testnet"}[t]||"Unknown (".concat(t,")"));let s=await window.ethereum.request({method:"eth_getBalance",params:[e,"latest"]}),a=(parseInt(s,16)/1e18).toFixed(4);g(a)}catch(e){console.error("Failed to update wallet info:",e)}},j=async()=>{if(!window.ethereum){u("No Ethereum wallet found. Please install MetaMask.");return}o(!0),u(null);try{let e=await window.ethereum.request({method:"eth_requestAccounts"});e.length>0&&(i(e[0]),n(!0),await p(e[0]))}catch(e){4001===e.code?u("Connection rejected by user."):u("Failed to connect wallet."),console.error("Failed to connect wallet:",e)}finally{o(!1)}},v=()=>{i(null),n(!1),h(null),g(null),u(null)},f=async e=>{if(!window.ethereum){u("No Ethereum wallet found.");return}try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]}),d&&await p(d)}catch(e){4902===e.code?u("Please add this network to your wallet first."):u("Failed to switch network."),console.error("Failed to switch network:",e)}};return(0,r.useEffect)(()=>{if(!window.ethereum)return;let e=e=>{e.length>0?(i(e[0]),n(!0),p(e[0])):v()},t=()=>{window.location.reload()};return window.ethereum.on("accountsChanged",e),window.ethereum.on("chainChanged",t),()=>{window.ethereum&&(window.ethereum.removeListener("accountsChanged",e),window.ethereum.removeListener("chainChanged",t))}},[]),(0,a.jsx)(l.Provider,{value:{isConnected:s,address:d,isConnecting:c,error:x,network:m,balance:b,connect:j,disconnect:v,switchNetwork:f},children:t})}let d=()=>(0,r.useContext)(l)},3178:function(e,t,s){"use strict";s.d(t,{p:function(){return i},f_:function(){return u},ax:function(){return x},MR:function(){return o},vL:function(){return c}});var a=s(2265);let r=s(257).env.NEXT_PUBLIC_API_URL||"http://localhost:3001";class l{async request(e,t){let s="".concat(this.baseURL).concat(e);try{let e=await fetch(s,{headers:{"Content-Type":"application/json",...null==t?void 0:t.headers},...t});if(!e.ok)throw Error("HTTP ".concat(e.status,": ").concat(e.statusText));return e.json()}catch(t){if(console.error("API request failed for ".concat(e,":"),t),t instanceof Error&&t.message.includes("fetch"))return console.warn("\uD83D\uDD04 Backend not available, using mock data for development"),this.getMockData(e);throw t}}getMockData(e){return e.includes("/api/status")?{status:"demo",message:"Backend not configured - Demo Mode",walletConnected:!1,aiEnabled:!1,needsSetup:!0}:e.includes("/api/wallet/balance")?{balance:"0.0000",usdValue:"0.00",network:"Not Connected",address:"Connect Wallet First"}:e.includes("/api/trades")?{trades:[],total:0,message:"No trades available - Configure wallet first"}:e.includes("/api/stats")?{totalTrades:0,successRate:0,totalProfit:"0.00",needsConfiguration:!0}:{error:"Backend not configured",needsSetup:!0}}async getBotStatus(){return this.request("/api/status")}async getWalletBalance(){return this.request("/api/wallet/balance")}async getTradingHistory(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20;return this.request("/api/trades?limit=".concat(e))}async getPerformanceData(){return this.request("/api/stats")}async startBot(){return this.request("/api/bot/start",{method:"POST"})}async stopBot(){return this.request("/api/bot/stop",{method:"POST"})}async getWalletInfo(e){return this.getWalletBalance()}async getDashboardStats(){return this.request("/api/dashboard/stats")}async getMemories(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.request("/api/memories?limit=".concat(e))}async getTokenData(e){return this.request("/api/token/".concat(e))}async getHealth(){return this.request("/api/health")}constructor(e){this.baseURL=e}}let n=new l(r),d={getBotStatus:()=>n.getBotStatus(),startBot:()=>n.startBot(),stopBot:()=>n.stopBot(),getWalletInfo:e=>n.getWalletInfo(e),getTradingHistory:e=>n.getTradingHistory(e),getPerformanceData:()=>n.getPerformanceData(),getDashboardStats:()=>n.getDashboardStats()};function i(){let[e,t]=(0,a.useState)({status:"stopped",message:"Loading...",walletConnected:!1,aiEnabled:!1,needsSetup:!1,isLoading:!0,error:null}),[s,r]=(0,a.useState)(!1),l=(0,a.useCallback)(async()=>{try{t(e=>({...e,isLoading:!0,error:null}));let e=await d.getBotStatus();t(t=>({...t,...e,isLoading:!1}))}catch(e){t(t=>({...t,status:"demo",message:"Backend not configured - Demo Mode",needsSetup:!0,isLoading:!1,error:e.message}))}},[]),n=(0,a.useCallback)(async()=>{if(!s&&!e.needsSetup){r(!0);try{"running"===e.status?await d.stopBot():await d.startBot(),await l()}catch(e){t(t=>({...t,error:"Failed to toggle bot: ".concat(e.message)}))}finally{r(!1)}}},[e.status,s,l]);return(0,a.useEffect)(()=>{l();let e=setInterval(l,5e3);return()=>clearInterval(e)},[l]),{...e,isToggling:s,toggleBot:n,refresh:l}}function c(e){let[t,s]=(0,a.useState)({balance:"0.0000",usdValue:"0.00",network:"",isLoading:!1,error:null}),r=(0,a.useCallback)(async()=>{if(!e){s({balance:"0.0000",usdValue:"0.00",network:"",isLoading:!1,error:null});return}try{s(e=>({...e,isLoading:!0,error:null}));let t=await d.getWalletInfo(e);s({...t,isLoading:!1,error:null})}catch(e){s(t=>({...t,isLoading:!1,error:e.message}))}},[e]);return(0,a.useEffect)(()=>{if(r(),e){let e=setInterval(r,1e4);return()=>clearInterval(e)}},[r,e]),{...t,refresh:r}}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:20,[t,s]=(0,a.useState)({trades:[],total:0,isLoading:!0,error:null}),r=(0,a.useCallback)(async()=>{try{s(e=>({...e,isLoading:!0,error:null}));let t=await d.getTradingHistory(e);s({...t,isLoading:!1,error:null})}catch(e){s(t=>({...t,isLoading:!1,error:e.message}))}},[e]);return(0,a.useEffect)(()=>{r();let e=setInterval(r,15e3);return()=>clearInterval(e)},[r]),{...t,refresh:r}}function x(){let[e,t]=(0,a.useState)({totalProfit:"0.00",profitChange:"0.00",totalTrades:0,successRate:0,chartData:[],stats:{todayProfit:"0.00",todayTrades:0,todayWinRate:0},isLoading:!0,error:null,needsConfiguration:!1}),s=(0,a.useCallback)(async()=>{try{t(e=>({...e,isLoading:!0,error:null}));let e=await d.getPerformanceData(),s={totalProfit:e.totalProfit||"0.00",profitChange:"0.00",totalTrades:e.totalTrades||0,successRate:e.successRate||0,chartData:[],stats:{todayProfit:"0.00",todayTrades:e.totalTrades||0,todayWinRate:e.successRate||0},isLoading:!1,error:null,needsConfiguration:e.needsConfiguration||!1};t(s)}catch(e){t(t=>({...t,isLoading:!1,error:e.message,needsConfiguration:!0}))}},[]);return(0,a.useEffect)(()=>{s();let e=setInterval(s,3e4);return()=>clearInterval(e)},[s]),{...e,refresh:s}}function u(){let[e,t]=(0,a.useState)({totalProfit:"0.00",profitChange:"0.00",totalTrades:0,successRate:0,activePositions:0,daysProfitable:0,aiStatus:{isLearning:!1,confidence:0,memoryCount:0,lastUpdate:""},isLoading:!0,error:null}),s=(0,a.useCallback)(async()=>{try{t(e=>({...e,isLoading:!0,error:null}));let e=await d.getDashboardStats();t({...e,isLoading:!1,error:null})}catch(e){t(t=>({...t,isLoading:!1,error:e.message}))}},[]);return(0,a.useEffect)(()=>{s();let e=setInterval(s,2e4);return()=>clearInterval(e)},[s]),{...e,refresh:s}}}},function(e){e.O(0,[970,971,117,744],function(){return e(e.s=8571)}),_N_E=e.O()}]);