1import{o as ie}from"./rolldown-runtime-ChpBd9eV.js";import{Cn as ve,Ei as G,Ia as je,La as ye,Ni as ee,Sr as L,Ta as Ne,U as ke,_i as z,_t as te,bi as ae,da as $,gi as se,ha as $e,ji as q,pn as re,tt as Te,vi as le,xi as I}from"./chat-page-evUfHQgD.js";import{Gn as De,Sr as Se,Vr as Re,mr as Le,yr as Pe}from"./community-page-CrngAMw5.js";import{vt as ne}from"./education-page-vD6yUpCZ.js";import{N as V}from"./icons-vendor-Td9zWZcy.js";var c=ie(ye(),1),Fe=ie(je(),1),e=Ne(),Ae=i=>i>=95?{letter:"A+",label:"Outstanding",tier:"elite"}:i>=85?{letter:"A",label:"Excellent",tier:"elite"}:i>=77?{letter:"B+",label:"Very Good",tier:"strong"}:i>=70?{letter:"B",label:"Good",tier:"strong"}:i>=62?{letter:"C+",label:"Above Avg",tier:"average"}:i>=55?{letter:"C",label:"Average",tier:"average"}:i>=45?{letter:"D+",label:"Below Avg",tier:"warning"}:i>=40?{letter:"D",label:"Poor",tier:"warning"}:{letter:"F",label:"Failing",tier:"critical"},Ue={elite:{text:"text-emerald-400",bg:"bg-emerald-500/12",border:"border-emerald-500/25",ring:"#34d399",ringBg:"#34d39920",gradient:"from-emerald-500 to-teal-400",glow:"shadow-emerald-500/20"},strong:{text:"text-blue-400",bg:"bg-blue-500/12",border:"border-blue-500/25",ring:"#60a5fa",ringBg:"#60a5fa20",gradient:"from-blue-500 to-cyan-400",glow:"shadow-blue-500/20"},average:{text:"text-amber-400",bg:"bg-amber-500/12",border:"border-amber-500/25",ring:"#fbbf24",ringBg:"#fbbf2420",gradient:"from-amber-500 to-yellow-400",glow:"shadow-amber-500/20"},warning:{text:"text-orange-400",bg:"bg-orange-500/12",border:"border-orange-500/25",ring:"#fb923c",ringBg:"#fb923c20",gradient:"from-orange-500 to-amber-400",glow:"shadow-orange-500/20"},critical:{text:"text-red-400",bg:"bg-red-500/12",border:"border-red-500/25",ring:"#f87171",ringBg:"#f8717120",gradient:"from-red-500 to-rose-400",glow:"shadow-red-500/20"}},Me=i=>({green:"elite",blue:"strong",yellow:"average",orange:"warning",red:"critical"})[i]||"strong",ze=({isOpen:i,onClose:P,userId:h,userData:oe,userProfile:de,currentUserId:Ce})=>{const T=oe||de,[ce,H]=(0,c.useState)(null),x=ce||T;(0,c.useEffect)(()=>{if(!i)return;const t=l=>{l.key==="Escape"&&P()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[i,P]),(0,c.useEffect)(()=>{if(!i)return;const t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=t}},[i]);const[S,K]=(0,c.useState)("trades"),[M,C]=(0,c.useState)([]),[k,W]=(0,c.useState)([]),[a,E]=(0,c.useState)(null),[u,_]=(0,c.useState)(null),[p,O]=(0,c.useState)(null),[F,Q]=(0,c.useState)(!0);(0,c.useEffect)(()=>{i&&h&&xe(),i||(W([]),C([]),E(null),_(null),O(null),H(null),K("trades"))},[i,h,T]);const xe=async()=>{Q(!0);try{let t={...T||{}};try{const[r,m]=await Promise.all([se(ee(L,"userProfiles",h)),se(ee(L,"users",h))]);if(r.exists()&&Object.assign(t,r.data()),m.exists()){const d=m.data();d.photoURL&&(t.photoURL=d.photoURL),d.displayName&&(t.displayName=t.displayName||d.displayName),d.username&&(t.username=t.username||d.username),d.bio&&(t.bio=t.bio||d.bio)}}catch{}H(t);try{O(await De(h))}catch(r){console.warn("[UserProfileModal] Discipline score fetch failed:",r)}const l=r=>r.entryTime?.toDate?r.entryTime.toDate():r.entryTime?new Date(r.entryTime):r.createdAt?.toDate?r.createdAt.toDate():r.createdAt?new Date(r.createdAt):new Date(0);let s=[];const v=T?.recentTrades||T?.trades||[];if(v.length>0&&(console.log("[UserProfileModal] Using pre-fetched trades:",v.length),s=[...v]),s.length===0){const r=Le.getState().trades||[];r.length>0&&(console.log("[UserProfileModal] Using tradeLogsStore trades:",r.length),s=[...r])}s.length===0&&(console.log("[UserProfileModal] Querying Firestore for userId:",h),((await z(I(q(L,"trades"),G("userId","==",h))).catch(r=>(console.warn("[UserProfileModal] top-level trades error:",r.message),{docs:[]}))).docs||[]).forEach(r=>{s.push(Se({id:r.id,...r.data()}))})),console.log("[UserProfileModal] Total trades loaded:",s.length),s.sort((r,m)=>l(m)-l(r)),W(s.slice(0,20)),E(J(s));const y=new Date;y.setDate(1),y.setHours(0,0,0,0),_(J(s.filter(r=>(r.entryTime?.toDate?.()||new Date(r.entryTime||r.createdAt))>=y)));const R=T?.posts||[];let N=[];if(R.length>0)console.log("[UserProfileModal] Using pre-fetched posts:",R.length),N=[...R];else{const[r,m]=await Promise.all([z(I(q(L,"communityPosts"),G("userId","==",h),ae("createdAt","desc"),le(10))).catch(()=>({docs:[]})),z(I(q(L,"posts"),G("authorId","==",h),ae("createdAt","desc"),le(10))).catch(()=>({docs:[]}))]),d=new Set;[r,m].forEach(B=>
1{(B.docs||[]).forEach(D=>{d.has(D.id)||(d.add(D.id),N.push({id:D.id,...D.data()}))})})}N.sort((r,m)=>{const d=r.createdAt?.toDate?.()||new Date(r.createdAt||0);return(m.createdAt?.toDate?.()||new Date(m.createdAt||0))-d}),C(N.slice(0,10))}catch(t){console.error("Error loading user profile data:",t),W([]),C([]),E(null),_(null)}finally{Q(!1)}},b=Pe,J=t=>{if(!t||t.length===0)return{totalTrades:0,totalWins:0,totalLosses:0,winRate:0,totalPL:0,avgWin:0,avgLoss:0,bestTrade:0,worstTrade:0,profitFactor:0,winStreak:0};const l=t.filter(n=>b(n)!==0||n.exitPrice||n.status==="closed"),s=l.length,v=l.filter(n=>b(n)>0),y=l.filter(n=>b(n)<0),R=l.reduce((n,j)=>n+b(j),0),N=v.reduce((n,j)=>n+b(j),0),r=Math.abs(y.reduce((n,j)=>n+b(j),0)),m=v.length>0?N/v.length:0,d=y.length>0?r/y.length:0,B=s>0?v.length/s*100:0,D=r>0?N/r:N>0?999:0,U=l.map(n=>b(n)),be=U.length>0?Math.max(...U):0,fe=U.length>0?Math.min(...U):0;let Z=0;const ge=[...l].sort((n,j)=>{const we=n.entryTime?.toDate?.()||new Date(n.entryTime||n.createdAt||0);return(j.entryTime?.toDate?.()||new Date(j.entryTime||j.createdAt||0))-we});for(const n of ge)if(b(n)>0)Z++;else break;return{totalTrades:s,totalWins:v.length,totalLosses:y.length,winRate:B,totalPL:R,avgWin:m,avgLoss:d,bestTrade:be,worstTrade:fe,profitFactor:D,winStreak:Z}},X=(0,c.useMemo)(()=>{if(!k||k.length===0)return[];const t={};return k.forEach(l=>{const s=l.ticker||l.symbol;s&&(t[s]||(t[s]={symbol:s,count:0,pl:0}),t[s].count++,t[s].pl+=b(l))}),Object.values(t).sort((l,s)=>s.count-l.count).slice(0,5)},[k]);if(!i)return null;const Y=t=>{const l=parseFloat(t)||0;return l>=0?`+$${l.toFixed(2)}`:`-$${Math.abs(l).toFixed(2)}`},me=t=>t?(t?.toDate?.()||new Date(t)).toLocaleDateString("en-US",{month:"short",day:"numeric"}):"N/A",he=t=>{if(!t)return"";const l=t?.toDate?.()||new Date(t),s=Date.now()-l.getTime();return s<36e5?`${Math.floor(s/6e4)}m ago`:s<864e5?`${Math.floor(s/36e5)}h ago`:s<6048e5?`${Math.floor(s/864e5)}d ago`:l.toLocaleDateString("en-US",{month:"short",day:"numeric"})},ue=[{id:"trades",label:"Trades",icon:(0,e.jsx)(re,{className:"w-4 h-4"}),count:k.length},{id:"stats",label:"Stats",icon:(0,e.jsx)(ve,{className:"w-4 h-4"})},{id:"posts",label:"Posts",icon:(0,e.jsx)(V,{className:"w-4 h-4"}),count:M.length}];new Date().toLocaleDateString("en-US",{month:"long"});const f=p?.score!=null?Math.round(p.score):null,g=f!=null?Ae(f):null,w=g?g.tier:p?.bandColor?Me(p.bandColor):"strong",o=Ue[w],A=2*Math.PI*42,pe=f!=null?A*(1-f/100):A;return(0,Fe.createPortal)((0,e.jsx)($e,{children:(0,e.jsxs)($.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 z-[9999] flex items-end sm:items-center justify-center bg-black/80 backdrop-blur-sm p-0 sm:p-4",children:[(0,e.jsx)("button",{type:"button","aria-label":"Close",className:"absolute inset-0 cursor-default",onClick:P}),(0,e.jsxs)($.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{type:"spring",damping:30,stiffness:340,mass:.8},onClick:t=>t.stopPropagation(),className:"relative z-[1] w-full flex flex-col bg-[#0c1021] border border-white/[0.08] shadow-[0_32px_64px_rgba(0,0,0,0.7)] rounded-t-[20px] max-h-[94dvh] sm:rounded-[20px] sm:max-w-[560px] sm:max-h-[90vh]",children:[(0,e.jsx)("div",{className:"flex justify-center pt-2.5 pb-0 sm:hidden flex-shrink-0",children:(0,e.jsx)("div",{className:"w-9 h-[3px] rounded-full bg-white/[0.12]"})}),(0,e.jsxs)("div",{className:"relative overflow-hidden flex-shrink-0",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-600/[0.08] via-violet-600/[0.06] to-emerald-600/[0.05]"}),(0,e.jsx)("div",{className:"absolute inset-0 opacity-[0.03]",style:{backgroundImage:"radial-gradient(circle at 1px 1px, white 1px, transparent 0)",backgroundSize:"24px 24px"}}),(0,e.jsxs)("div",{className:"relative px-5 pt-5 pb-4",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3.5",children:[(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)(ke,{user:x,userId:h,photoURL:x?.photoURL,displayName:x?.displayName||x?.name,size:56,className:"ring-2 ring-white/[0.12] rounded-full"}),(0,e.jsx)("div",{className:"absolute -bottom-0.5 -right-0.5 w-4 h-4 rounded-full bg-emerald-500 border-[2.5px] border-[#0c1021]"})]}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("h2",{className:"text-[17px] font-bold text-white leading-tight truncate",children:x?.displayName||x?.name||x?.username||"Unknown User"}),(0,e.jsxs)("p",{className:"text-[13px] text-slate-500 leading-tight",children:["@",x?.username||x?.email?.split("@")[0]||"user"]}),x?.bio&&(0,e.jsx)("p",{className:"text-[11px] text-slate-600 mt-0.5 line-clamp-1",children:x.bio})]})]}),(0,e.jsx)("button",{onClick:P,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-xl bg-white/[0.05] hover:bg-white/[0.1] text-slate-400 hover:text-white transition-all flex-shrink-0",children:(0,e.jsx)(Te,{className:"w-[18px] h-[18px]"})})]}),!F&&f!=null&&g&&(0,e.jsx)("div",{className:`mt-4 rounded-2xl border ${o.border} ${o.bg} p-4 shadow-lg ${o.glow}`,children:(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsxs)("div",{className:"relative w-[88px] h-[88px] flex-shrink-0",children:[(0,e.jsxs)("svg",{className:"w-[88px] h-[88px] -rotate-90",viewBox:"0 0 96 96",children:[(0,e.jsx)("circle",{cx:"48",cy:"48",r:"42",fill:"none",stroke:"currentColor",strokeWidth:"4",className:"text-white/[0.06]"}),(0,e.jsx)($.circle,{cx:"48",cy:"48",r:"42",fill:"none",stroke:o.ring,strokeWidth:"4.5",strokeLinecap:"round",strokeDasharray:A,initial:{strokeDashoffset:A},animate:{strokeDashoffset:pe},transition:{duration:1.2,ease:[.33,1,.68,1],delay:.2}})]}),(0,e.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,e.jsx)("span",{className:`text-[28px] font-black leading-none ${o.text}`,children:g.letter}),(0,e.jsxs)("span",{className:"text-[9px] font-semibold text-slate-500 uppercase tracking-wider mt-0.5",children:[f,"/100"]})]})]}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,e.jsx)(te,{className:`w-4 h-4 ${o.text} flex-shrink-0`}),(0,e.jsx)("span",{className:`text-[13px] font-bold ${o.text}`,children:p.band||g.label})]}),(0,e.jsxs)("p",{className:"text-[11px] text-slate-500 leading-relaxed mb-2.5",children:[g.label," discipline â ",w==="elite"?"rules followed consistently":w==="strong"?"solid rule adherence":w==="average"?"some rules being missed":w==="warning"?"needs process reinforcement":"focus on fundamentals"]}),p.components&&(0,e.jsx)("div",{className:"space-y-1.5",children:[{key:"ruleAdherence",label:"Rules"},{key:"severityControl",label:"Control"},{key:"recoverySpeed",label:"Recovery"},{key:"consistency",label:"Consistency"}].map(t=>{const l=p.components[t.key];if(!l)return null;const s=Math.min(Math.round(l.raw||0),100);return(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[10px] w-[4rem] text-right text-slate-500 font-medium",children:t.label}),(0,e.jsx)("div",{className:"flex-1 h-[5px] bg-white/[0.06] rounded-full overflow-hidden",children:(0,e.jsx)($.div,{className:`h-full rounded-full bg-gradient-to-r ${o.gradient}`,initial:{width:0},animate:{width:`${s}%`},transition:{duration:.8,ease:"easeOut",delay:.3}})}
1),(0,e.jsx)("span",{className:"text-[10px] text-slate-500 w-7 text-right tabular-nums font-medium",children:s})]},t.key)})})]})]})}),!F&&u&&u.totalTrades>0&&(0,e.jsx)("div",{className:"mt-3 grid grid-cols-4 gap-2",children:[{value:`${u.totalPL>=0?"+":""}$${Math.abs(u.totalPL).toFixed(0)}`,label:"P/L",color:u.totalPL>=0?"text-emerald-400":"text-red-400"},{value:`${u.totalTrades}`,label:"Trades",color:"text-white"},{value:`${u.winRate.toFixed(0)}%`,label:"Win Rate",color:u.winRate>=50?"text-emerald-400":"text-amber-400"},{value:u.winStreak>0?`${u.winStreak}ð¥`:"0",label:"Streak",color:"text-white"}].map(t=>(0,e.jsxs)("div",{className:"bg-white/[0.04] rounded-xl px-2 py-2.5 text-center border border-white/[0.06]",children:[(0,e.jsx)("p",{className:`text-[15px] font-bold leading-none ${t.color}`,children:t.value}),(0,e.jsx)("p",{className:"text-[9px] text-slate-600 uppercase tracking-wider mt-1 font-medium",children:t.label})]},t.label))}),!F&&X.length>0&&(0,e.jsx)("div",{className:"flex gap-1.5 mt-3 flex-wrap",children:X.map(t=>(0,e.jsxs)("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-semibold border ${t.pl>=0?"bg-emerald-500/8 text-emerald-400 border-emerald-500/15":"bg-red-500/8 text-red-400 border-red-500/15"}`,children:[t.symbol," (",t.count,")"]},t.symbol))})]})]}),(0,e.jsx)("div",{className:"flex border-b border-white/[0.06] px-1 flex-shrink-0",children:ue.map(t=>(0,e.jsxs)("button",{onClick:()=>K(t.id),className:`flex items-center gap-1.5 px-4 py-2.5 text-[12px] font-medium transition-all relative ${S===t.id?"text-white":"text-slate-500 hover:text-slate-300"}`,children:[t.icon,t.label,t.count!==void 0&&t.count>0&&(0,e.jsx)("span",{className:"text-[9px] bg-white/[0.08] px-1.5 py-0.5 rounded-full ml-0.5",children:t.count}),S===t.id&&(0,e.jsx)($.div,{layoutId:"profileTab",className:"absolute bottom-0 left-2 right-2 h-[2px] bg-gradient-to-r from-blue-500 to-violet-500 rounded-full"})]},t.id))}),(0,e.jsx)("div",{className:"profile-modal-scroll flex-1 overflow-y-auto overscroll-contain touch-pan-y min-h-0 p-4",style:{WebkitOverflowScrolling:"touch"},children:F?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-48 gap-3",children:[(0,e.jsx)("div",{className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),(0,e.jsx)("p",{className:"text-[12px] text-slate-500",children:"Loading profileâ¦"})]}):(0,e.jsxs)(e.Fragment,{children:[S==="trades"&&(0,e.jsx)("div",{className:"space-y-2",children:k.length>0?k.map(t=>{const l=b(t),s=l>0;return(0,e.jsxs)("div",{className:`p-3 rounded-xl border transition-colors ${s?"bg-emerald-500/[0.04] border-emerald-500/[0.1]":l<0?"bg-red-500/[0.04] border-red-500/[0.1]":"bg-white/[0.02] border-white/[0.06]"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[13px] font-bold text-white",children:t.ticker||t.symbol||"???"}),(0,e.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded-md font-semibold ${(t.tradeType||t.side||"long").toLowerCase()==="long"?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:(t.tradeType||t.side||"LONG").toUpperCase()}),t.setup&&(0,e.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 bg-violet-500/10 text-violet-400 rounded-md font-medium",children:t.setup})]}),(0,e.jsx)("span",{className:`text-[13px] font-bold tabular-nums ${s?"text-emerald-400":l<0?"text-red-400":"text-slate-500"}`,children:Y(l)})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3 mt-1.5 text-[11px] text-slate-600",children:[(0,e.jsxs)("span",{children:["Entry $",(parseFloat(t.entryPrice)||0).toFixed(2)]}),t.exitPrice&&(0,e.jsxs)("span",{children:["Exit $",parseFloat(t.exitPrice).toFixed(2)]}),(0,e.jsx)("span",{className:"ml-auto",children:me(t.entryTime)})]}),t.notes&&(0,e.jsxs)("p",{className:"text-[10px] text-slate-600 mt-1.5 italic line-clamp-1",children:['"',t.notes,'"']})]},t.id)}):(0,e.jsxs)("div",{className:"text-center py-16",children:[(0,e.jsx)(re,{className:"w-10 h-10 mx-auto mb-2 text-slate-800"}),(0,e.jsx)("p",{className:"text-[13px] text-slate-500",children:"No trades logged yet"})]})}),S==="stats"&&(0,e.jsx)("div",{className:"space-y-4",children:a&&a.totalTrades>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"bg-white/[0.02] rounded-2xl border border-white/[0.06] p-4",children:[(0,e.jsxs)("h3",{className:"text-[11px] text-slate-500 uppercase tracking-wider font-semibold mb-3 flex items-center gap-1.5",children:[(0,e.jsx)(ne,{className:"w-3.5 h-3.5 text-amber-400"})," All-Time Performance"]}),(0,e.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[{label:"Total P/L",value:`$${a.totalPL.toFixed(2)}`,color:a.totalPL>=0?"text-emerald-400":"text-red-400"},{label:"Win Rate",value:`${a.winRate.toFixed(1)}%`,color:a.winRate>=50?"text-emerald-400":"text-amber-400"},{label:"Avg Win",value:`+$${a.avgWin.toFixed(2)}`,color:"text-emerald-400"},{label:"Avg Loss",value:`-$${a.avgLoss.toFixed(2)}`,color:"text-red-400"},{label:"Best Trade",value:`+$${a.bestTrade.toFixed(2)}`,color:"text-emerald-400"},{label:"Worst Trade",value:`-$${Math.abs(a.worstTrade).toFixed(2)}`,color:"text-red-400"},{label:"Profit Factor",value:a.profitFactor>=999?"â":a.profitFactor.toFixed(2),color:a.profitFactor>=1?"text-blue-400":"text-amber-400"},{label:"Win Streak",value:`${a.winStreak}`,color:a.winStreak>0?"text-violet-400":"text-slate-500"}].map(t=>(0,e.jsxs)("div",{className:"flex items-center justify-between p-2.5 bg-white/[0.03] rounded-xl border border-white/[0.04]",children:[(0,e.jsx)("span",{className:"text-[11px] text-slate-500",children:t.label}),(0,e.jsx)("span",{className:`text-[13px] font-bold tabular-nums ${t.color}`,children:t.value})]},t.label))})]}),(0,e.jsxs)("div",{className:"bg-white/[0.02] rounded-2xl border border-white/[0.06] p-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between text-[11px] mb-2",children:[(0,e.jsxs)("span",{className:"text-emerald-400 font-semibold",children:[a.totalWins," Wins"]}),(0,e.jsxs)("span",{className:"text-slate-600 text-[10px]",children:[a.totalTrades," total"]}),(0,e.jsxs)("span",{className:"text-red-400 font-semibold",children:[a.totalLosses," Losses"]})]}),(0,e.jsxs)("div",{className:"h-2.5 bg-white/[0.04] rounded-full overflow-hidden flex",children:[(0,e.jsx)("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-emerald-400 transition-all",style:{width:`${a.totalTrades>0?a.totalWins/a.totalTrades*100:50}%`,borderRadius:a.totalLosses===0?"9999px":"9999px 0 0 9999px"}}),(0,e.jsx)("div",{className:"h-full bg-gradient-to-r from-red-400 to-red-500 transition-all",style:{width:`${a.totalTrades>0?a.totalLosses/a.totalTrades*100:50}%`,borderRadius:a.totalWins===0?"9999px":"0 9999px 9999px 0"}})]})]}),f!=null&&g&&(0,e.jsxs)("div",{className:`rounded-2xl border p-4 ${o.bg} ${o.border}`,children:[(0,e.jsxs)("h3",{className:"text-[11px] text-slate-500 uppercase tracking-wider font-semibold mb-3 flex items-center gap-1.5",children:[(0,e.jsx)(te,{className:`w-3.5 h-3.5 ${o.text}`})," Discipline Grade"]}),(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsxs)("div",{className:"relative w-20 h-20 flex-shrink-0",children:[(0,e.jsxs)("svg",{className:"w-20 h-20
1-rotate-90",viewBox:"0 0 96 96",children:[(0,e.jsx)("circle",{cx:"48",cy:"48",r:"36",fill:"none",stroke:"currentColor",strokeWidth:"5",className:"text-white/[0.06]"}),(0,e.jsx)($.circle,{cx:"48",cy:"48",r:"36",fill:"none",stroke:o.ring,strokeWidth:"5.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*36,initial:{strokeDashoffset:2*Math.PI*36},animate:{strokeDashoffset:2*Math.PI*36*(1-f/100)},transition:{duration:1,ease:[.33,1,.68,1],delay:.15}})]}),(0,e.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,e.jsx)("span",{className:`text-xl font-black leading-none ${o.text}`,children:g.letter}),(0,e.jsxs)("span",{className:"text-[8px] text-slate-500 font-semibold mt-0.5",children:[f,"/100"]})]})]}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("p",{className:`text-[13px] font-bold ${o.text}`,children:p.band||g.label}),(0,e.jsx)("p",{className:"text-[11px] text-slate-500 mt-0.5 leading-relaxed",children:w==="elite"?"Outstanding process discipline â rules followed consistently.":w==="strong"?"Solid rule adherence with consistent behavior patterns.":w==="average"?"Some rules are being missed â review your process.":w==="warning"?"Multiple rule breaches detected â needs reinforcement.":"Significant adherence issues â focus on fundamentals."}),p.components&&(0,e.jsx)("div",{className:"mt-2.5 space-y-1.5",children:[{key:"ruleAdherence",label:"Rules",icon:"ð"},{key:"severityControl",label:"Severity",icon:"ð¡ï¸"},{key:"recoverySpeed",label:"Recovery",icon:"â¡"},{key:"consistency",label:"Consistency",icon:"ð"}].map(t=>{const l=p.components[t.key];if(!l)return null;const s=Math.min(Math.round(l.raw||0),100);return(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[10px] w-[3.5rem] text-right text-slate-500 truncate",children:t.label}),(0,e.jsx)("div",{className:"flex-1 h-[5px] bg-white/[0.06] rounded-full overflow-hidden",children:(0,e.jsx)($.div,{className:`h-full rounded-full bg-gradient-to-r ${o.gradient}`,initial:{width:0},animate:{width:`${s}%`},transition:{duration:.7,ease:"easeOut",delay:.25}})}),(0,e.jsx)("span",{className:"text-[10px] text-slate-500 w-6 text-right tabular-nums",children:s})]},t.key)})})]})]})]}),(0,e.jsx)("div",{className:`rounded-2xl border p-4 ${a.winRate>=60?"bg-emerald-500/[0.04] border-emerald-500/[0.12]":a.winRate>=50?"bg-blue-500/[0.04] border-blue-500/[0.12]":a.winRate>=40?"bg-amber-500/[0.04] border-amber-500/[0.12]":"bg-white/[0.02] border-white/[0.06]"}`,children:(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("span",{className:"text-2xl",children:a.winRate>=60?"ð":a.winRate>=50?"ð":a.winRate>=40?"âï¸":"ð"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("p",{className:"text-[13px] font-bold text-white",children:a.winRate>=60?"Expert Trader":a.winRate>=50?"Experienced":a.winRate>=40?"Developing":"Beginner"}),(0,e.jsx)("p",{className:"text-[11px] text-slate-500",children:a.winRate>=60?"Exceptional consistency":a.winRate>=50?"Solid risk management":a.winRate>=40?"Building skills":"Focus on process"})]}),(0,e.jsxs)("div",{className:`px-2.5 py-1 rounded-lg text-[11px] font-bold ${a.winRate>=60?"bg-emerald-500/15 text-emerald-400":a.winRate>=50?"bg-blue-500/15 text-blue-400":a.winRate>=40?"bg-amber-500/15 text-amber-400":"bg-white/[0.06] text-slate-500"}`,children:["Lv ",a.winRate>=60?"4":a.winRate>=50?"3":a.winRate>=40?"2":"1"]})]})})]}):(0,e.jsxs)("div",{className:"text-center py-16",children:[(0,e.jsx)(ne,{className:"w-10 h-10 mx-auto mb-2 text-slate-800"}),(0,e.jsx)("p",{className:"text-[13px] text-slate-500",children:"No performance data available"})]})}),S==="posts"&&(0,e.jsx)("div",{className:"space-y-2.5",children:M.length>0?M.map(t=>(0,e.jsxs)("div",{className:"bg-white/[0.02] rounded-xl border border-white/[0.06] p-4",children:[(0,e.jsx)("p",{className:"text-[13px] text-white/90 whitespace-pre-wrap line-clamp-4 leading-relaxed",children:t.content||t.text||t.caption||""}),(t.imageUrl||t.mediaUrls&&t.mediaUrls[0])&&(0,e.jsx)("img",{src:t.imageUrl||t.mediaUrls[0],alt:"",className:"mt-2.5 rounded-xl max-h-40 object-cover w-full"}),(0,e.jsxs)("div",{className:"flex items-center gap-4 mt-3 text-[11px] text-slate-600",children:[(0,e.jsx)("span",{children:he(t.createdAt)}),t.likes&&(0,e.jsxs)("span",{className:"flex items-center gap-1 text-red-400/70",children:[(0,e.jsx)(Re,{className:"w-3 h-3"}),Array.isArray(t.likes)?t.likes.length:t.likes]}),(t.commentCount||t.comments)&&(0,e.jsxs)("span",{className:"flex items-center gap-1",children:[(0,e.jsx)(V,{className:"w-3 h-3"}),t.commentCount||t.comments]}),t.tradeData&&(0,e.jsxs)("span",{className:`ml-auto font-bold ${(t.tradeData.pl||0)>=0?"text-emerald-400":"text-red-400"}`,children:[t.tradeData.symbol," ",Y(t.tradeData.pl||0)]})]})]},t.id)):(0,e.jsxs)("div",{className:"text-center py-16",children:[(0,e.jsx)(V,{className:"w-10 h-10 mx-auto mb-2 text-slate-800"}),(0,e.jsx)("p",{className:"text-[13px] text-slate-500",children:"No posts yet"})]})})]})}),(0,e.jsx)("div",{className:"flex-shrink-0",style:{height:"env(safe-area-inset-bottom, 0px)"}})]},"profile-card")]},"profile-overlay")}),document.body)};export{ze as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.