1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-kF-B_PN5.css"])))=>i.map(i=>d[i]); 2import{c as ct,U as dt,a as ht,r as m,B as J,y as mt,_ as xt,j as e,ak as Ge,al as Ue,am as Xe,an as Qe,L as oe,I as Ve,a5 as ne,a9 as ue,aj as ut,as as be,G as pt,H as ft}from"./index-EOagY1xL.js";import{Q as ze,L as gt}from"./Layout-CbGqocRH.js";import{o as je,r as bt,b as ve,p as re,a as Ke}from"./priceDisplay-B36E1VD1.js";import{C as Ye}from"./crown-DSZAfssj.js";import{D as Ze}from"./addMonths-D3W4pTDR.js";import{C as qe}from"./useDebouncedValue-BJxmesZ3.js";import{T as Ne}from"./submissionMeta-B5ijCL4J.js";import{m as v}from"./motion-BrGqV1p0.js";import{U as pe}from"./floatingChrome-D57i0lRb.js";import{A as ye}from"./index-DVD3Zg7o.js";import{C as yt}from"./PageAnswerCapsule-W0_boT86.js";import{T as wt}from"./eachDayOfInterval-DljY7QXz.js";import{M as Ae}from"./map-DR-YeQrU.js";import{u as jt}from"./useTraderPnLSeries-BUkfBUMn.js";import{S as vt}from"./tutorials-DpfhMTPp.js";import{V as Nt,a as kt}from"./volume-x-xthGRLfx.js";import{T as Le}from"./timer-d1R9up6U.js";import"./SEO-CAUtX4mQ.js";import"./index-C5ikjDJd.js";import"./Combination-BS1XGO-p.js";import"./FeedbackModal-BvPMhMEp.js";import"./copilotBridge-BLi8X6Hb.js";import"./useOrderPreview-DfzhC_kE.js";import"./useWalletDisplayNames-CZRPLpmi.js";import"./topMarketsBoard-fJ1CjvKB.js";
2import"./useMarketAutocomplete-DUOg4jeE.js";import"./useWhaleFeed-nmqv5HF_.js";import"./useArkhamIntel-C_agIJxW.js";import"./KpiCardRow-Bt1XgT0b.js";import"./skeleton-CLPw7O35.js";import"./usePersonalFeed-C_2ua0tJ.js";import"./useMovers-DSN7j7vE.js";import"./shareUtils-dtGEdkhW.js";import"./useWalletSearch-CbO4qcXD.js";import"./useShirtToken-DEnntS7e.js";import"./isAfter-Bzyw8vlL.js";import"./create-config-yFYUlX-f.js";import"./create-visual-element-BUgakVZq.js";/** 3 * @license lucide-react v0.462.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const _t=ct("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);function $t(t){return t===null?"neutral":t>.7?"ecstatic":t>.55?"happy":t>.45?"neutral":t>.3?"sad":"crying"}function Tt(t,s,a){const c=t==="yes"?s:ve(s);return{mood:$t(c),pnlPercent:bt(a,c)}}function Mt(t){const s=je(t,0);return s===null?null:s>=.5?"yes":"no"}function St(t){return dt(t.price,t.avg_price)}function Ct(t){return typeof t!="number"||!Number.isFinite(t)?"â":t>=0?`+${t.toFixed(1)}%`:`${t.toFixed(1)}%`}const Ee={btc:"https://polymarket-upload.s3.us-east-2.amazonaws.com/BTC+fullsize.jpg",eth:"https://polymarket-upload.s3.us-east-2.amazonaws.com/ETH+fullsize.jpg",sol:"https://polymarket-upload.s3.us-east-2.amazonaws.com/SOL+fullsize.jpg"},De={btc:"Bitcoin",eth:"Ethereum",sol:"Solana"},Pt="fed-decision-in-january",we=t=>t>=25e3?"god_whale":t>=5e3?"whale":t>=1e3?"chubby":t>=250?"normal":"skinny",ae=t=>t>=500?"god_whale":t>=250?"whale":t>=50?"chubby":t>=15?"normal":"skinny",It=t=>t==="god_whale"?"helicopter":t==="whale"?"limo":"walk",se=()=>{const t=Date.now(),s=900*1e3,a=Math.floor(t/s)*s;return Math.floor(a/1e3)},zt=t=>{const s=se(),a=900*1e3,c=new Date(s*1e3+a);return{slug:`${t}-updown-15m-${s}`,eventSlug:`${t}-updown-15m-${s}`,endsAt:c,timestamp:s}},Je=async(t,s,a)=>{const{data:c,error:r}=await J.functions.invoke("polymarket-proxy",{body:{endpoint:t,path:s,params:a}});return r?(console.warn(`[PolyTown] Proxy error for ${s}:`,r),null):c},et=async t=>{try{const s=await Je("gamma","/events",`slug=${t}`);if(s&&Array.isArray(s)&&s.length>0){const a=s[0];return{title:a.title||t,markets:a.markets||[],image:a.image||null}}return null}catch(s){return console.warn("[PolyTown] Error fetching event info:",s),null}},At=async t=>{try{const s=[];let a=0;const c=500,r=10,{domeFetch:d}=await xt(async()=>{const{domeFetch:l}=await import("./useTrades-CODNAM8d.js").then(n=>n.g);return{domeFetch:l}},__vite__mapDeps([0]));for(let l=0;l<r;l++){const n=`condition_id=${t}&limit=${c}&offset=${a}`;let o;try{o=await d("/polymarket/orders",n)}catch(g){console.warn("[PolyTown] Dome orders API error:",(g==null?void 0:g.status)||g);break}const i=(o==null?void 0:o.orders)||o||[];if(!Array.isArray(i)||i.length===0||(s.push(...i),console.log(`[PolyTown] Dome page ${l+1}: got ${i.length} orders (total: ${s.length})`),i.length<c))break;a+=c}if(s.length===0)return console.log(`[PolyTown] No orders from Dome for ${t}`),[];const h=new Map;for(const l of s){const n=l.user||l.maker||l.taker||"";if(!n)continue;const o=(l.token_label||l.outcome||"").toLowerCase(),i=o.includes("no")||o.includes("down")?1:0,g=parseFloat(l.shares_normalized||l.shares||l.size||0),k=St(l),N=(l.side||"").toUpperCase();if(g<=0||k===null)continue;const y=`${n}-${i}`,z=h.get(y),T=N==="BUY"?g:-g,w=T*k;z?(z.shares+=T,z.value+=w):h.set(y,{wallet:n,shares:T,value:w,outcomeIndex:i,name:l.user_name||l.pseudonym})}const x=[];for(const[,l]of h)l.shares>0&&x.push({proxyWallet:l.wallet,wallet:l.wallet,amount:Math.abs(l.value),outcomeIndex:l.outcomeIndex,name:l.name});return console.log(`[PolyTown] Dome aggregated ${x.length} holders from ${s.length} orders for ${t}`),x}catch(s){return console.warn("[PolyTown] Dome fallback error:",s),[]}},tt=async t=>{try{const s=await At(t);if(s.length>0)return console.log(`[PolyTown] Using Dome data: ${s.length} holders for ${t}`),s;const a=await Lt(t);return console.log(`[PolyTown] Dome empty, using Polymarket holders: ${a.length} holders for ${t}`),a}catch(s){return console.warn("[PolyTown] Error fetching holders:",s),[]}},Lt=async t=>{try{const s=[],a=new Set;let c=0;const r=50,d=20;for(let h=0;h<d;h++){const x=await Je("data","/holders",`market=${t}&limit=${r}&offset=${c}&minBalance=0.1`);if(!x||!Array.isArray(x)||x.length===0)break;let l=0;for(const n of x)if(n.holders&&Array.isArray(n.holders))for(const o of n.holders){const i=o.proxyWallet||o.wallet||"";i&&!a.has(i)&&(a.add(i),s.push({...o,outcomeIndex:o.outcomeIndex??n.outcomeIndex}),l++)}if(l===0)break;c+=r}return console.log(`[PolyTown] Polymarket found ${s.length} holders for ${t}`),s}catch(s){return console.warn("[PolyTown] Error fetching Polymarket holders:",s),[]}},Et=(t,s)=>{let a=0;for(let d=0;d<t.length;d++){const h=t.charCodeAt(d);a=(a<<5)-a+h,a=a&a}return .2+Math.abs(a)/2147483647*.6},st=(t,s,a=!1)=>{const c=[];for(const r of t){const d=parseFloat(r.amount||0);if(d<=0)continue;const h=r.side||(r.outcomeIndex===0?"yes":"no"),x=a?ae(d):we(d),l=r.proxyWallet||r.wallet||"Unknown";a&&c.length<5&&console.log(`[PolyTown] Crypto position: $${d.toFixed(0)} -> ${x}`);const n=Et(l),{mood:o,pnlPercent:i}=Tt(h,s,n);let g=0;for(let z=0;z<l.length;z++)g=(g<<5)-g+l.charCodeAt(z),g=g&g;const k=20+Math.abs(g)%65,N=Math.abs(g*31&2147483647),y=Math.floor(1+N%500);c.push({wallet:l,side:h,amount_usd:Math.round(d),age_days:0,pnl:i===null?null:Math.round(d*i/100),pnl_percent:i===null?null:Math.round(i*10)/10,rank:null,display_name:r.name||r.pseudonym||null,size_tier:x,mood:o,entry_type:It(x),win_rate:k,trade_count:y})}return c.sort((r,d)=>d.amount_usd-r.amount_usd).slice(0,500)},fe=async t=>{var n;const s=zt(t);console.log(`[PolyTown] Fetching ${t.toUpperCase()} market: ${s.eventSlug}`);const a=await et(s.eventSlug);
7if(!a||!((n=a.markets)!=null&&n.length))return console.log(`[PolyTown] No market data for ${t}`),{id:s.eventSlug,slug:s.slug,title:`${De[t]} Up or Down (15m)`,volume:0,yes_price:null,no_price:null,image:Ee[t],positions:[],yes_count:0,no_count:0,yes_volume:0,no_volume:0,isRealMarket:!0,endsAt:s.endsAt,crypto:t};const c=[];let r=null;for(const o of a.markets)if(o.conditionId){const i=await tt(o.conditionId);r===null&&(o.groupItemTitle==="Up"||!o.groupItemTitle)&&(r=je(o.outcomePrices,0),r!==null&&console.log(`[PolyTown] Found price for ${t}: ${(r*100).toFixed(1)}% (from ${o.groupItemTitle||"default"})`));const g=o.groupItemTitle==="Up";for(const k of i){const N=k.outcomeIndex??0;let y;g?y=N===0:y=N===1,c.push({...k,side:y?"yes":"no"})}}const d=r;console.log(`[PolyTown] Final price for ${t}: ${d===null?"none":`YES=${(d*100).toFixed(1)}%`}`);const h=st(c,d,!0),x=h.filter(o=>o.side==="yes"),l=h.filter(o=>o.side==="no");return{id:s.eventSlug,slug:s.slug,title:a.title||`${De[t]} Up or Down (15m)`,volume:h.reduce((o,i)=>o+i.amount_usd,0),yes_price:d,no_price:ve(d),image:Ee[t],positions:h,yes_count:x.length,no_count:l.length,yes_volume:x.reduce((o,i)=>o+i.amount_usd,0),no_volume:l.reduce((o,i)=>o+i.amount_usd,0),isRealMarket:!0,endsAt:s.endsAt,crypto:t}},Dt=async t=>{var l;console.log(`[PolyTown] Fetching specific market: ${t}`);const s=await et(t);if(!s||!((l=s.markets)!=null&&l.length))return console.log(`[PolyTown] No market data for ${t}`),null;const a=s.markets[0],c=je(a.outcomePrices,0),r=[];for(const n of s.markets)if(n.conditionId){const o=await tt(n.conditionId);for(const i of o)r.push({...i,side:i.outcomeIndex===0?"yes":"no"})}const d=st(r,c,!1),h=d.filter(n=>n.side==="yes"),x=d.filter(n=>n.side==="no");return{id:t,slug:t,title:s.title||t,volume:d.reduce((n,o)=>n+o.amount_usd,0),yes_price:c,no_price:ve(c),image:s.image,positions:d,yes_count:h.length,no_count:x.length,yes_volume:h.reduce((n,o)=>n+o.amount_usd,0),no_volume:x.reduce((n,o)=>n+o.amount_usd,0),isRealMarket:!0}},We=async()=>{const t=se();console.log(`[PolyTown] Fetching data from backend for interval: ${t}`);try{const{data:h,error:x}=await J.functions.invoke("get-polytown-holders");if(x)throw console.error("[PolyTown] Backend error:",x),x;if(h!=null&&h.buildings){const l=h.buildings.map(n=>({...n,endsAt:n.endsAt?new Date(n.endsAt):void 0}));return console.log(`[PolyTown] Backend returned ${l.length} buildings, ${h.total_positions} positions`),{buildings:l,updated_at:h.updated_at,total_positions:h.total_positions,currentInterval:t}}console.warn("[PolyTown] Backend returned no data, falling back to client-side")}catch(h){console.warn("[PolyTown] Backend fetch failed, falling back to client-side:",h)}const[s,a,c,r]=await Promise.all([fe("btc"),fe("eth"),fe("sol"),Dt(Pt)]),d=[s,a,c,r].filter(h=>h!==null);return{buildings:d,updated_at:new Date().toISOString(),total_positions:d.reduce((h,x)=>h+x.positions.length,0),currentInterval:t}},Wt=async()=>{const{data:t,error:s}=await J.functions.invoke("get-polytown-live-trades",{body:{limitPerMarket:80,maxTrades:220}});return s?(console.warn("[PolyTown] Live trade backend error:",s),[]):(Array.isArray(t==null?void 0:t.trades)?t.trades:[]).map(c=>{const r=Number(c.amount_usd||0),d=Number(c.buildingIndex);return!Number.isFinite(r)||r<=0||!Number.isInteger(d)||d<0?null:{id:String(c.id||`${c.wallet}-${c.timestamp}-${r}-${d}`),wallet:String(c.wallet||"Trader"),side:c.side==="no"?"no":"yes",amount_usd:r,buildingIndex:d,size_tier:c.size_tier||ae(r),timestamp:c.timestamp?new Date(c.timestamp):new Date}}).filter(c=>c!==null)},Rt=()=>{const t=ht(),[s,a]=m.useState(()=>se()),[c,r]=m.useState(()=>se()),[d,h]=m.useState([]),x=m.useRef(0),l=m.useRef([]),n=m.useRef(null),[o,i]=m.useState(!1);m.useEffect(()=>{const w=setInterval(()=>{const f=se();if(f!==s&&!o){const j=t.getQueryData(["polytown-data",c]);j!=null&&j.buildings&&(n.current={interval:s,buildings:j.buildings.map(M=>({id:M.id,endsAt:M.endsAt,crypto:M.crypto}))},console.log("[PolyTown] Stored previous interval buildings for resolution check")),a(f),i(!0),t.prefetchQuery({queryKey:["polytown-data",f],queryFn:We}),setTimeout(()=>{console.log(`[PolyTown] Transitioning display to new interval: ${f}`),r(f),h([]),i(!1)},15e3)}},5e3);return()=>clearInterval(w)},[s,c,o,t]);const g=m.useCallback(T=>{const w=T.market_slug||T.event_slug||"",f=w.toLowerCase();if(f.includes("btc")||f.includes("bitcoin"))return 0;if(f.includes("eth")||f.includes("ethereum"))return 1;if(f.includes("sol")||f.includes("solana"))return 2;if(f.includes("fed"))return 3;const j=l.current;for(let M=0;M<j.length;M++)if(w.includes(j[M])||j[M].includes(w))return M;return-1},[]);m.useEffect(()=>{const T=J.channel("polytown-live-trades").on("postgres_changes",{event:"INSERT",schema:"public",table:"trades_history"},w=>{var M;const f=w.new,j=g(f);if(j>=0){const I=parseFloat(f.size)*parseFloat(f.price||1),E=((M=f.side)==null?void 0:M.toLowerCase())==="sell"?"no":"yes",_=j<3,P={id:`trade-${x.current++}`,wallet:f.maker||f.taker||"Unknown",side:E,amount_usd:I,buildingIndex:j,size_tier:_?ae(I):we(I),timestamp:new Date};console.log("[PolyTown] New live trade:",P),h(b=>[...b.slice(-20),P])}}).on("postgres_changes",{event:"INSERT",schema:"public",table:"whale_trades_cache"},w=>{var M;const f=w.new,j=g(f);if(j>=0){const I=j<3,E=f.amount_usd||0,_={id:`whale-${x.current++}`,wallet:f.wallet||"Whale",side:((M=f.side)==null?void 0:M.toLowerCase())==="sell"?"no":"yes",amount_usd:E,buildingIndex:j,size_tier:I?ae(E):we(E),timestamp:new Date};console.log("[PolyTown] New whale trade:",_),h(P=>[...P.slice(-20),_])}
7t.invalidateQueries({queryKey:["polytown-data"]})}).subscribe();return()=>{J.removeChannel(T)}},[t,g]);const k=m.useRef(new Set);m.useEffect(()=>{const T=async()=>{try{const f=await Wt();if(!f||f.length===0)return;const j=[];for(const E of f){const _=E.id;!_||k.current.has(_)||(k.current.add(_),j.push({...E,id:`poll-${x.current++}-${_}`}))}if(j.length===0)return;const I=Math.max(25,Math.min(90,900/j.length));j.forEach((E,_)=>{setTimeout(()=>{h(P=>[...P.slice(-120),E])},Math.round(_*I))}),console.log(`[PolyTown] Streaming ${j.length} live trades (gap ${I.toFixed(0)}ms)`)}catch(f){console.warn("[PolyTown] Live trade poll failed:",f)}};T();const w=setInterval(T,1200);return()=>clearInterval(w)},[g]);const N=m.useCallback(T=>{h(w=>w.filter(f=>f.id!==T))},[]),y=mt({queryKey:["polytown-data",c],queryFn:We,staleTime:4*1e3,refetchInterval:o?!1:5*1e3});m.useEffect(()=>{var T;(T=y.data)!=null&&T.buildings&&(l.current=y.data.buildings.map(w=>w.slug))},[y.data]);const z=m.useCallback(()=>{var T;return((T=n.current)==null?void 0:T.buildings)||null},[]);return{...y,liveTrades:d,removeTrade:N,currentInterval:s,displayInterval:c,isTransitioning:o,getPreviousIntervalBuildings:z}},Ft=async(t,s)=>{try{const a=`${t}-updown-15m-${s}`;console.log(`[Resolution] ð² Simulating resolution for ${a} based on current price`);const{data:c,error:r}=await J.functions.invoke("polymarket-proxy",{body:{endpoint:"gamma",path:"/events",params:`slug=${a}`}});if(r||!c||!Array.isArray(c)||c.length===0)return console.log(`[Resolution] No data for ${a} â no winner shown`),null;const h=c[0].markets||[];for(const x of h)if(x.groupItemTitle==="Up"||!x.groupItemTitle){const l=Mt(x.outcomePrices);if(l===null)continue;return console.log(`[Resolution] ð¯ ${t.toUpperCase()} price-based resolution â ${l.toUpperCase()} WINS!`),l}return console.log(`[Resolution] ${t}: no price â no winner shown`),null}catch(a){return console.warn(`[Resolution] Error simulating ${t}:`,a),null}},Bt=(t,s,a)=>{const[c,r]=m.useState(new Map),d=m.useRef(new Set),h=m.useRef(s),x=m.useRef(t),l=m.useRef(a),n=m.useRef(!1);m.useEffect(()=>{h.current=s},[s]),m.useEffect(()=>{x.current=t},[t]),m.useEffect(()=>{l.current=a},[a]),m.useEffect(()=>{const i=async()=>{var T;if(n.current)return;const k=x.current,N=((T=l.current)==null?void 0:T.call(l))||[],y=[...k];for(const w of N)!k.some(j=>{var M,I;return j.crypto===w.crypto&&((M=j.endsAt)==null?void 0:M.getTime())===((I=w.endsAt)==null?void 0:I.getTime())})&&w.endsAt&&(console.log(`[Resolution] Adding previous building for check: ${w.crypto}`),y.push(w));if(!y.length)return;const z=Date.now();for(let w=0;w<y.length;w++){const f=y[w],j=f.crypto==="btc"?0:f.crypto==="eth"?1:f.crypto==="sol"?2:-1;if(j<0||!f.crypto||!f.endsAt)continue;const M=f.endsAt.getTime(),I=M+500;if(z<I)continue;const E=Math.floor((M-900*1e3)/1e3),_=`${f.crypto}-${E}`;if(!d.current.has(_)){if(z>I+12e4){console.log(`[Resolution] Skipping ${_} - too old`),d.current.add(_);continue}console.log(`[Resolution] â° Timer ended for ${f.crypto.toUpperCase()}! Triggering resolution...`),n.current=!0,d.current.add(_);try{const P=await Ft(f.crypto,E);if(P===null)continue;console.log(`[Resolution] â
${f.crypto.toUpperCase()} RESOLVED: ${P.toUpperCase()} WINS!`);const b={buildingIndex:j,marketId:f.id,winningSide:P,resolvedAt:new Date};r($=>new Map($).set(j,b)),h.current(b)}catch(P){console.warn(`[Resolution] Error resolving ${f.crypto}:`,P)}finally{n.current=!1}}}};i();const g=setInterval(i,2e3);return()=>clearInterval(g)},[]);const o=m.useCallback(i=>{r(g=>{const k=new Map(g);return k.delete(i),k})},[]);return{activeResolutions:c,clearResolution:o}},Re=[{base:"#fcd9b6",highlight:"#fde8d7"},{base:"#e8beac",highlight:"#f5d6c6"},{base:"#d4a574",highlight:"#e5c4a8"},{base:"#c68642",highlight:"#daa06d"},{base:"#8d5524",highlight:"#a66a3a"},{base:"#6b4423",highlight:"#8a5a35"},{base:"#4a3728",highlight:"#6b5344"},{base:"#3b2219",highlight:"#5c3d2e"}],Ot=t=>{let s=0;for(let a=0;a<t.length;a++)s=(s<<5)-s+t.charCodeAt(a),s=s&s;return Re[Math.abs(s)%Re.length]},Fe=m.memo(({trade:t,index:s})=>{const[a,c]=m.useState(!1),r=t.side==="yes"?"#10b981":"#f43f5e",d=t.side==="yes"?"#059669":"#e11d48",h=Ot(t.id),x=h.base,l=h.highlight,n=t.size_tier==="whale"||t.size_tier==="god_whale"?"#fbbf24":"#6b7280",o=t.size_tier==="whale"||t.size_tier==="god_whale",i=`building-char-${t.id}-${s}
7`,g=`blink-delay-${t.id.charCodeAt(0)%6+1}`,k=t.size_tier==="god_whale"?2.4:t.size_tier==="whale"?1.92:t.size_tier==="chubby"?1.62:1.38,N=typeof t.pnl_percent=="number"&&Number.isFinite(t.pnl_percent)?t.pnl_percent:null,y=N===null?"neutral":N>50?"ecstatic":N>20?"happy":N>-10?"neutral":N>-30?"sad":"crying",z=y==="ecstatic"?"ð¤":y==="happy"?"ð":y==="neutral"?"ð":y==="sad"?"ð":"ð",w=(t.wallet.charCodeAt(2)+t.wallet.charCodeAt(5))%365+1,f=w<7?`${w}d`:w<30?`${Math.floor(w/7)}w`:w<365?`${Math.floor(w/30)}mo`:`${Math.floor(w/365)}y`,j=t.size_tier==="god_whale"?"GOD WHALE":t.size_tier==="whale"?"Whale":t.size_tier==="chubby"?"Chonky":t.size_tier==="normal"?"Normal":"Shrimp",M=t.amount_usd>=1e6?`$${(t.amount_usd/1e6).toFixed(1)}M`:t.amount_usd>=1e3?`$${(t.amount_usd/1e3).toFixed(1)}K`:`$${t.amount_usd.toFixed(0)}`,I=Ct(N),E=`${t.wallet.slice(0,6)}...${t.wallet.slice(-4)}`,_=b=>{b.stopPropagation(),c(!a)},P=t.amount_usd>=1e3?`$${(t.amount_usd/1e3).toFixed(0)}k`:`$${t.amount_usd.toFixed(0)}`;return e.jsx(Ge,{delayDuration:100,children:e.jsxs(Ue,{open:a,onOpenChange:c,children:[e.jsx(Xe,{asChild:!0,children:e.jsxs("div",{className:"cursor-pointer flex-shrink-0 flex flex-col items-center",onClick:_,children:[e.jsx("div",{className:"text-[8px] font-bold px-1 rounded whitespace-nowrap mb-0.5",style:{color:t.side==="yes"?"#10b981":"#f43f5e",backgroundColor:"rgba(0,0,0,0.6)",fontSize:`${Math.max(8,6*k)}px`},children:P}),e.jsx("div",{style:{width:20*k,height:28*k},children:e.jsxs("svg",{width:20*k,height:28*k,viewBox:"0 0 40 56",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:`bodyGrad-${i}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:r}),e.jsx("stop",{offset:"100%",stopColor:d})]}),e.jsxs("linearGradient",{id:`skinGrad-${i}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:l}),e.jsx("stop",{offset:"100%",stopColor:x})]})]}),e.jsx("ellipse",{cx:"20",cy:"54",rx:"8",ry:"1.5",fill:"rgba(0,0,0,0.3)"}),e.jsx("rect",{x:"10",y:"28",width:"20",height:"20",rx:"6",fill:`url(#bodyGrad-${i})`}),e.jsx("ellipse",{cx:"8",cy:"36",rx:"2.5",ry:"4",fill:x}),e.jsx("ellipse",{cx:"32",cy:"36",rx:"2.5",ry:"4",fill:x}),e.jsx("circle",{cx:"20",cy:"18",r:"9",fill:`url(#skinGrad-${i})`}),o&&e.jsx("path",{d:"M 12 9 L 14 5 L 17 8 L 20 3 L 23 8 L 26 5 L 28 9 Z",fill:"#fbbf24",stroke:"#f59e0b",strokeWidth:"0.5"}),e.jsx("path",{d:"M 13 13 Q 20 6 27 13",fill:n,stroke:n,strokeWidth:"3",strokeLinecap:"round"}),e.jsxs("g",{className:`character-eyes ${g}`,children:[e.jsx("ellipse",{cx:"16",cy:"17",rx:"3.5",ry:"4",fill:"white"}),e.jsx("ellipse",{cx:"24",cy:"17",rx:"3.5",ry:"4",fill:"white"}),e.jsx("circle",{cx:"16",cy:"17",r:"1.8",fill:"#1a1a2e"}),e.jsx("circle",{cx:"24",cy:"17",r:"1.8",fill:"#1a1a2e"}),e.jsx("circle",{cx:"15",cy:"16",r:"0.8",fill:"white"}),e.jsx("circle",{cx:"23",cy:"16",r:"0.8",fill:"white"})]}),y==="ecstatic"&&e.jsx("path",{d:"M 14 22 Q 20 30 26 22",stroke:"#1a1a2e",strokeWidth:"1.5",fill:"#ff6b6b"}),y==="happy"&&e.jsx("path",{d:"M 16 23 Q 20 27 24 23",stroke:"#1a1a2e",strokeWidth:"1.5",fill:"none"}),y==="neutral"&&e.jsx("line",{x1:"16",y1:"24",x2:"24",y2:"24",stroke:"#1a1a2e",strokeWidth:"1.5"}),y==="sad"&&e.jsx("path",{d:"M 16 25 Q 20 22 24 25",stroke:"#1a1a2e",strokeWidth:"1.5",fill:"none"}),y==="crying"&&e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M 16 25 Q 20 21 24 25",stroke:"#1a1a2e",strokeWidth:"1.5",fill:"none"}),e.jsx("circle",{cx:"14",cy:"20",r:"1",fill:"#60a5fa"}),e.jsx("circle",{cx:"26",cy:"20",r:"1",fill:"#60a5fa"})]}),e.jsx("rect",{x:"14",y:"46",width:"4",height:"6",rx:"2",fill:"#1a1a2e"}),e.jsx("rect",{x:"22",y:"46",width:"4",height:"6",rx:"2",fill:"#1a1a2e"})]})})]})}),e.jsx(Qe,{side:"top",sideOffset:12,avoidCollisions:!0,collisionPadding:20,className:"p-0 border-0 bg-transparent shadow-none pointer-events-auto !z-[99999]",style:{maxWidth:"280px"},children:e.jsx(oe,{to:`/address/${t.wallet}`,className:"block group",onClick:b=>b.stopPropagation(),children:e.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-white/10 bg-gradient-to-br from-slate-900/95 via-slate-800/95 to-slate-900/95 backdrop-blur-xl shadow-2xl",children:[e.jsx("div",{className:`h-1 w-full ${t.side==="yes"?"bg-gradient-to-r from-emerald-500 via-emerald-400 to-teal-500":"bg-gradient-to-r from-rose-500 via-rose-400 to-pink-500"}`}),e.jsxs("div",{className:"p-3 pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[o&&e.jsx("div",{className:`p-1 rounded-md ${t.size_tier==="god_whale"?"bg-gradient-to-br from-amber-500/30 to-yellow-500/30":"bg-gradient-to-br from-purple-500/30 to-indigo-500/30"}`,children:e.jsx(Ye,{className:`h-3.5 w-3.5 ${t.size_tier==="god_whale"?"text-amber-400":"text-purple-400"}`})}),e.jsx("span",{className:"font-mono text-sm font-semibold text-white/90 group-hover:text-white transition-colors",children:E})]}),e.jsx(Ve,{className:"h-3.5 w-3.5 text-white/40 group-hover:text-white/80 transition-colors"})]}),e.jsx("div",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider ${t.size_tier==="god_whale"?"bg-gradient-to-r from-amber-500/20 to-yellow-500/20 text-amber-300 border border-amber-500/30":t.size_tier==="whale"?"bg-gradient-to-r from-purple-500/20 to-indigo-500/20 text-purple-300 border border-purple-500/30":t.size_tier==="chubby"?"bg-gradient-to-r from-blue-500/20 to-cyan-500/20 text-blue-300 border border-blue-500/30":t.side==="yes"?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"bg-rose-500/20 text-rose-300 border border-rose-500/30"}`,children:j})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-px bg-white/5 mx-3 mb-3 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-slate-800/80 p-2 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-white/50 mb-0.5",children:[e.jsx(Ze,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[9px] uppercase tracking-wider",children:"Size"})]}),e.jsx("span",{className:"text-sm font-bold text-white",children:M})]}),e.jsxs("div",{className:"bg-slate-800/80 p-2 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-white/50 mb-0.5",children:[e.jsx(qe,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[9px] uppercase tracking-wider",children:"Age"})]}),e.jsx("span",{className:"text-sm font-bold text-white",children:f})]}),e.jsxs("div",{className:"bg-slate-800/80 p-2 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-white/50 mb-0.5",children:[e.jsx(Ne,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[9px] uppercase tracking-wider",children:"PnL"})]}),e.jsx("span",{className:`text-sm font-bold ${N===null?"text-white/60":N>=0?"text-emerald-400":"text-rose-400"}`,children:I})]})]}),e.jsx("div",{className:"px-3 pb-3",children:e.jsxs("div",{className:`flex items-center justify-center gap-2 py-1.5 rounded-lg ${N===null?"bg-slate-700/50":N>=20?"bg-emerald-500/10":N>=-10?"bg-slate-700/50":"bg-rose-500/10"}`,children:[e.jsx("span",{className:"text-lg",children:z}),e.jsx("span",{className:`text-xs font-medium ${N===null?"text-white/60":N>=20?"text-emerald-400":N>=-10?"text-white/60":"text-rose-400"}`,children:y==="ecstatic"?"On Fire!":y==="happy"?"Winning":y==="neutral"?"Holding Steady":y==="sad"?"Down Bad":"Rekt"})]})}),e.jsx("div",{className:"px-3 pb-2",children:e.jsx("div",{className:"text-center text-[10px] text-white/30 group-hover:text-white/50 transition-colors",children:"Click to view trader profile â"})})]})})})]})})}),Be=m.memo(({building:t,index:s,maxVolume:a,availableMarkets:c,onMarketChange:r,enteredTrades:d=[]})=>{const[h,x]=m.useState(!1),[l,n]=m.useState(!1),o=m.useRef(null),i=d.filter(b=>b.side==="yes"),g=d.filter(b=>b.side==="no"),k=Math.max(i.length,g.length),N=Math.ceil(k/3),y=280,f=60+Math.max(5,N)*60+50,j=Math.max(y,f);t.positions.filter(b=>b.side==="yes"),t.positions.filter(b=>b.side==="no");const M=200,I=ne(t.yes_price),E=ne(t.no_price),_=Ke(I,.5,.5);m.useEffect(()=>{const b=$=>{o.current&&!o.current.contains($.target)&&n(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]);const P=()=>{if(!t.endsAt)return null;const b=new Date(t.endsAt).getTime(),$=Date.now(),H=b-$;if(H<=0)return"Ended";const D=Math.floor(H/(1e3*60*60)),U=Math.floor(H%(1e3*60*60)/(1e3*60));return D>24?`${Math.floor(D/24)}d`:`${D}h ${U}m`};return e.jsxs(v.div,{className:"flex items-end flex-shrink-0 relative",style:{zIndex:h?1e3:l?500:1},initial:{y:100,opacity:0}
7,animate:{y:0,opacity:1},transition:{duration:.8,delay:s*.12,type:"spring",bounce:.3},children:[e.jsxs(oe,{to:`/market/${t.slug}`,className:"hidden xl:flex flex-col items-center mr-2 group self-end",children:[e.jsxs("div",{className:"relative bg-gradient-to-b from-slate-800 to-slate-900 border border-slate-600/50 rounded-lg p-2 w-20 shadow-lg hover:border-purple-500/50 transition-colors",children:[e.jsx("div",{className:"absolute top-0 left-0 w-2 h-2 border-l-2 border-t-2 border-amber-500/60 rounded-tl"}),e.jsx("div",{className:"absolute top-0 right-0 w-2 h-2 border-r-2 border-t-2 border-amber-500/60 rounded-tr"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-2 h-2 border-l-2 border-b-2 border-amber-500/60 rounded-bl"}),e.jsx("div",{className:"absolute bottom-0 right-0 w-2 h-2 border-r-2 border-b-2 border-amber-500/60 rounded-br"}),e.jsx("p",{className:"text-[9px] text-white/90 font-medium line-clamp-3 leading-tight text-center mb-1.5",children:t.title}),e.jsx("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-slate-500/50 to-transparent mb-1.5"}),e.jsxs("div",{className:"flex flex-col gap-1 text-[8px]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-slate-400",children:"Vol"}),e.jsxs("span",{className:"text-purple-400 font-bold",children:["$",ue(t.volume)]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-1",children:[e.jsx("span",{className:"text-emerald-400 font-bold",children:re(I)}),e.jsx("span",{className:"text-slate-500",children:"/"}),e.jsx("span",{className:"text-rose-400 font-bold",children:re(E)})]}),t.endsAt&&e.jsxs("div",{className:"flex items-center justify-center gap-1 text-amber-400/80",children:[e.jsx(qe,{className:"h-2 w-2"}),e.jsx("span",{className:"font-medium",children:P()})]})]})]}),e.jsx("div",{className:"w-1.5 h-8 bg-gradient-to-b from-slate-600 to-slate-700 rounded-b-sm shadow-md"}),e.jsx("div",{className:"w-4 h-1.5 bg-slate-700 rounded-sm"})]}),e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(oe,{to:`/market/${t.slug}`,className:"mb-2 relative group",style:{width:M},children:e.jsxs("div",{className:"relative bg-black/70 backdrop-blur-md border border-white/10 rounded-lg p-2.5 hover:border-white/20 transition-all duration-300 hover:translate-y-[-1px]",children:[e.jsx("p",{className:"text-[11px] text-white font-medium line-clamp-2 leading-tight mb-1.5",children:t.title}),e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsxs("span",{className:"text-purple-400 font-semibold",children:["$",ue(t.volume)]}),e.jsxs("span",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(pe,{className:"h-2.5 w-2.5"}),t.positions.length]})]})]})}),c&&r&&e.jsxs("div",{className:"relative z-30 mb-2",ref:o,children:[e.jsxs("button",{onClick:()=>n(!l),className:"flex items-center gap-1.5 px-3 py-1.5 bg-black/70 backdrop-blur-md rounded-lg border border-white/10 hover:border-purple-500/50 transition-colors text-xs text-white/80 hover:text-white",children:[e.jsx("span",{className:"max-w-[140px] truncate",children:"Change Market"}),e.jsx(ut,{className:`h-3 w-3 transition-transform ${l?"rotate-180":""}`})]}),e.jsx(ye,{children:l&&e.jsx(v.div,{initial:{opacity:0,y:-10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.95},className:"absolute top-full left-1/2 -translate-x-1/2 mt-2 w-64 max-h-60 overflow-y-auto bg-black/95 backdrop-blur-md rounded-xl border border-white/10 shadow-2xl z-50",children:c.map(b=>e.jsxs("button",{onClick:()=>{r(b.id),n(!1)},className:`w-full px-3 py-2.5 text-left hover:bg-white/5 transition-colors flex items-center gap-2 ${b.id===t.id?"bg-purple-500/20":""}`,children:[b.id===t.id&&e.jsx(yt,{className:"h-3 w-3 text-purple-400 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-white truncate",children:b.title}),e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["$",ue(b.volume)]})]})]},b.id))})})]}),e.jsx(v.div,{className:"relative z-20 mb-2",animate:{y:[0,-2,0]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},children:e.jsx("div",{className:"relative bg-black/80 backdrop-blur-md rounded-xl px-4 py-2 border border-white/20 shadow-lg",children:e.jsxs("div",{className:"flex items-center gap-4 font-mono text-sm font-bold",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ne,{className:"h-3.5 w-3.5 text-emerald-400"}),e.jsx("span",{className:"text-emerald-400",children:re(I)})]}),e.jsx("div",{className:"w-px h-4 bg-white/20"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(wt,{className:"h-3.5 w-3.5 text-rose-400"}),e.jsx("span",{className:"text-rose-400",children:re(E)})]})]})})}),e.jsxs("div",{className:"relative flex",style:{height:j,width:M},children:[_!==null&&e.jsx("div",{className:"absolute inset-2 rounded-2xl opacity-40 pointer-events-none",style:{background:`radial-gradient(ellipse at center, ${_==="yes"?"rgba(16, 185, 129, 0.4)":"rgba(244, 63, 94, 0.4)"}, transparent 70%)`}}),e.jsxs("div",{className:"w-1/2 relative rounded-tl-2xl bg-gradient-to-b from-emerald-950/80 via-emerald-900/60 to-emerald-950/90 backdrop-blur-sm border-l border-t border-emerald-500/40",children:[e.jsxs("div",{className:"absolute inset-0 rounded-tl-2xl overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-500/10 to-transparent"}),e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-[2px] bg-gradient-to-b from-emerald-400/60 via-emerald-500/40 to-emerald-400/20"}),e.jsx("div",{className:"absolute left-0 right-0 top-0 h-[2px] bg-gradient-to-r from-emerald-400/60 to-transparent"})]}),e.jsx("div",{className:"absolute inset-4 grid grid-cols-3 gap-1.5 overflow-hidden",children:Array.from({length:Math.floor(j/28)}).map((b,$)=>e.jsx("div",{className:"contents",children:Array.from({length:3}).map((H,D)=>e.jsx(v.div,{className:"h-3 rounded-sm bg-gradient-to-br from-yellow-300/30 to-amber-400/15",animate:{o
7pacity:[.15,.5,.15]},transition:{duration:2+Math.random()*2,repeat:1/0,delay:($*3+D)*.1}},D))},$))}),e.jsx("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-10",children:e.jsx("span",{className:"text-xs font-black text-emerald-400 bg-black/60 px-2 py-0.5 rounded-full tracking-wider",children:"UP"})}),e.jsx("div",{className:"absolute bottom-10 left-0 right-0 flex flex-col-reverse p-1",style:{top:"40px"},children:e.jsx("div",{className:"grid grid-cols-3 gap-1 justify-items-center",style:{direction:"ltr"},children:[...i].sort((b,$)=>$.amount_usd-b.amount_usd).reverse().map((b,$)=>e.jsx(v.div,{initial:{opacity:0,scale:0,y:20},animate:{opacity:1,scale:1,y:0},className:"relative",style:{zIndex:$+1},children:e.jsx(Fe,{trade:b,index:$})},b.id))})}),e.jsxs("div",{className:"absolute bottom-4 left-1.5 flex items-center gap-1 text-[9px] bg-emerald-500/80 text-white px-1 py-0.5 rounded-full font-bold z-10",children:[e.jsx(pe,{className:"h-2 w-2"}),i.length]})]}),e.jsxs("div",{className:"w-1/2 relative rounded-tr-2xl bg-gradient-to-b from-rose-950/80 via-rose-900/60 to-rose-950/90 backdrop-blur-sm border-r border-t border-rose-500/40",children:[e.jsxs("div",{className:"absolute inset-0 rounded-tr-2xl overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-bl from-rose-500/10 to-transparent"}),e.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-[2px] bg-gradient-to-b from-rose-400/60 via-rose-500/40 to-rose-400/20"}),e.jsx("div",{className:"absolute left-0 right-0 top-0 h-[2px] bg-gradient-to-l from-rose-400/60 to-transparent"})]}),e.jsx("div",{className:"absolute inset-4 grid grid-cols-3 gap-1.5 overflow-hidden",children:Array.from({length:Math.floor(j/28)}).map((b,$)=>e.jsx("div",{className:"contents",children:Array.from({length:3}).map((H,D)=>e.jsx(v.div,{className:"h-3 rounded-sm bg-gradient-to-br from-yellow-300/30 to-amber-400/15",animate:{opacity:[.15,.5,.15]},transition:{duration:2+Math.random()*2,repeat:1/0,delay:($*3+D)*.15}},D))},$))}),e.jsx("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-10",children:e.jsx("span",{className:"text-xs font-black text-rose-400 bg-black/60 px-2 py-0.5 rounded-full tracking-wider",children:"DOWN"})}),e.jsx("div",{className:"absolute bottom-10 left-0 right-0 flex flex-col-reverse p-1",style:{to
7p:"40px"},children:e.jsx("div",{className:"grid grid-cols-3 gap-1 justify-items-center",style:{direction:"ltr"},children:[...g].sort((b,$)=>$.amount_usd-b.amount_usd).reverse().map((b,$)=>e.jsx(v.div,{initial:{opacity:0,scale:0,y:20},animate:{opacity:1,scale:1,y:0},className:"relative",style:{zIndex:$+1},children:e.jsx(Fe,{trade:b,index:$})},b.id))})}),e.jsxs("div",{className:"absolute bottom-4 right-1.5 flex items-center gap-1 text-[9px] bg-rose-500/80 text-white px-1 py-0.5 rounded-full font-bold z-10",children:[e.jsx(pe,{className:"h-2 w-2"}),g.length]})]}),e.jsx("div",{className:"absolute left-1/2 top-0 bottom-0 w-px -translate-x-1/2 bg-white/10"}),e.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-10 h-6 z-10",children:e.jsxs("div",{className:"absolute inset-0 bg-gradient-to-t from-amber-900/90 to-amber-800/70 rounded-t-lg border border-amber-600/50",children:[e.jsx(v.div,{className:"absolute inset-1 bg-gradient-to-t from-amber-400/40 to-amber-200/20 rounded-t",animate:{opacity:[.4,.7,.4]},transition:{duration:2,repeat:1/0}}),e.jsx("div",{className:"absolute right-1.5 top-1/2 w-1 h-1 rounded-full bg-amber-300/80"})]})}),e.jsx(v.div,{className:"absolute -top-5 left-1/2 -translate-x-1/2 w-px h-5 bg-gradient-to-t from-white/30 to-transparent",animate:{opacity:[.4,.8,.4]},transition:{duration:1.5,repeat:1/0},children:e.jsx(v.div,{className:"absolute -top-1 left-1/2 -translate-x-1/2 w-1.5 h-1.5 rounded-full bg-red-500",animate:{opacity:[.3,1,.3]},transition:{duration:1,repeat:1/0}})})]})]})]})}),Oe=[{base:"#fcd9b6",highlight:"#fde8d7"},{base:"#e8beac",highlight:"#f5d6c6"},{base:"#d4a574",highlight:"#e5c4a8"},{base:"#c68642",highlight:"#daa06d"},{base:"#8d5524",highlight:"#a66a3a"},{base:"#6b4423",highlight:"#8a5a35"},{base:"#4a3728",highlight:"#6b5344"},{base:"#3b2219",highlight:"#5c3d2e"}],Ht=t=>{let s=0;for(let a=0;a<t.length;a++)s=(s<<5)-s+t.charCodeAt(a),s=s&s;return Oe[Math.abs(s)%Oe.length]},Gt=({trade:t,index:s,direction:a,delay:c,startX:r,isWinner:d})=>{const h=Ht(t.id),x=h.base,l=h.highlight,n=t.size_tier==="whale"||t.size_tier==="god_whale"?"#fbbf24":"#6b7280",o=t.size_tier==="whale"||t.size_tier==="god_whale",i=`exit-char-${t.id}-${s}`,g=t.id.charCodeAt(0)%4;
7t.id.charCodeAt(1)%3;const k=!d&&g===0,N=!d&&g===1,y=!d&&g===2,z=t.size_tier==="god_whale"?1.8:t.size_tier==="whale"?1.5:t.size_tier==="chubby"?1.3:1.1,T=a==="left"?-2e3:2e3,w=a==="left"?-1:1,f=d?"#10b981":x,j=d?"#059669":x,M=d?"#1e40af":"#78716c";return e.jsx(v.div,{className:"absolute",style:{bottom:"8px",left:r,zIndex:100},initial:{x:0,opacity:1},animate:{x:T},transition:{duration:10+Math.random()*4,delay:c,ease:"linear"},children:e.jsx("div",{style:{transform:`scaleX(${w}) scale(${z})`},children:e.jsx(v.div,{animate:{y:[0,-2,0]},transition:{duration:.3,repeat:1/0},children:e.jsxs("svg",{width:"50",height:"70",viewBox:"0 0 60 80",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:`bodyGrad-${i}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:f}),e.jsx("stop",{offset:"100%",stopColor:j})]}),e.jsxs("linearGradient",{id:`skinGrad-${i}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:l}),e.jsx("stop",{offset:"100%",stopColor:x})]}),e.jsxs("linearGradient",{id:`moneyBag-${i}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"#fbbf24"}),e.jsx("stop",{offset:"100%",stopColor:"#b45309"})]})]}),e.jsx("ellipse",{cx:"30",cy:"78",rx:"12",ry:"2",fill:"rgba(0,0,0,0.4)"}),d?e.jsx("rect",{x:"20",y:"32",width:"20",height:"22",rx:"6",fill:`url(#bodyGrad-${i})`}):e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"20",y:"32",width:"20",height:"22",rx:"6",fill:`url(#skinGrad-${i})`}),e.jsx("ellipse",{cx:"26",cy:"40",rx:"1",ry:"0.5",fill:x,opacity:"0.5"}),e.jsx("ellipse",{cx:"34",cy:"40",rx:"1",ry:"0.5",fill:x,opacity:"0.5"})]}),e.jsx("rect",{x:"20",y:"50",width:"20",height:"8",rx:"2",fill:M}),e.jsx("ellipse",{cx:"18",cy:"42",rx:"3",ry:"5",fill:x}),e.jsx("ellipse",{cx:"42",cy:"42",rx:"3",ry:"5",fill:x}),e.jsx("circle",{cx:"30",cy:"22",r:"10",fill:`url(#skinGrad-${i})`}),o&&d&&e.jsx("path",{d:"M 22 12 L 24 7 L 27 10 L 30 4 L 33 10 L 36 7 L 38 12 Z",fill:"#fbbf24",stroke:"#f59e0b",strokeWidth:"0.5"}),N&&e.jsxs("g",{children:[e.jsx("ellipse",{cx:"30",cy:"12",rx:"12",ry:"4",fill:"#dc2626"}),e.jsx("path",{d:"M 18 12 Q 18 6 30 6 Q 42 6 42 12",fill:"#dc2626"}),e.jsx("path",{d:"M 25 9 L 27 5 L 30 8 L 33 5 L 35 9",stroke:"#fbbf24",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"}),e.jsx("ellipse",{cx:"38",cy:"13",rx:"6",ry:"2",fill:"#991b1b"})]}),e.jsx("path",{d:"M 23 16 Q 30 8 37 16",fill:n,stroke:n,strokeWidth:"3",strokeLinecap:"round"}),e.jsx("ellipse",{cx:"26",cy:"21",rx:"3.5",ry:"4",fill:"white"}),e.jsx("ellipse",{cx:"34",cy:"21",rx:"3.5",ry:"4",fill:"white"}),e.jsx("circle",{cx:"26",cy:"21",r:"1.8",fill:"#1a1a2e"}),e.jsx("circle",{cx:"34",cy:"21",r:"1.8",fill:"#1a1a2e"}),e.jsx("circle",{cx:"25",cy:"20",r:"0.8",fill:"white"}),e.jsx("circle",{cx:"33",cy:"20",r:"0.8",fill:"white"}),d?e.jsx("path",{d:"M 24 27 Q 30 34 36 27",stroke:"#1a1a2e",strokeWidth:"1.5",fill:"#ff6b6b"}):e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M 25 29 Q 30 25 35 29",stroke:"#1a1a2e",strokeWidth:"1.5",fill:"none"}),e.jsx(v.ellipse,{cx:"23",cy:"24",rx:"1",ry:"2",fill:"#60a5fa",animate:{y:[0,3,0],opacity:[1,.5,1]},transition:{duration:.8,repeat:1/0}}),e.jsx(v.ellipse,{cx:"37",cy:"24",rx:"1",ry:"2",fill:"#60a5fa",animate:{y:[0,3,0],opacity:[1,.5,1]},transition:{duration:.8,repeat:1/0,delay:.4}})]}),d&&e.jsxs("g",{children:[e.jsxs(v.g,{animate:{rotate:[-5,5,-5]},transition:{duration:.5,repeat:1/0},style:{transformOrigin:"45px 45px"},children:[e.jsx("ellipse",{cx:"48",cy:"48",rx:"8",ry:"10",fill:`url(#moneyBag-${i})`}),e.jsx("path",{d:"M 44 40 Q 48 36 52 40",stroke:"#92400e",strokeWidth:"2",fill:"none"}),e.jsx("text",{x:"48",y:"52",textAnchor:"middle",fontSize:"8",fill:"#1a1a2e",fontWeight:"bold",children:"$"})]}),o&&e.jsxs(v.g,{animate:{rotate:[5,-5,5]},transition:{duration:.5,repeat:1/0,delay:.2},style:{transformOrigin:"8px 45px"},children:[e.jsx("ellipse",{cx:"8",cy:"48",rx:"6",ry:"8",fill:`url(#moneyBag-${i})`}),e.jsx("path",{d:"M 5 42 Q 8 39 11 42",stroke:"#92400e",strokeWidth:"1.5",fill:"none"}),e.jsx("text",{x:"8",y:"51",textAnchor:"middle",fontSize:"6",fill:"#1a1a2e",fontWeight:"bold",children:"$"})]})]}),k&&e.jsxs("g",{children:[e.jsx("line",{x1:"45",y1:"25",x2:"55",y2:"55",stroke:"#8B4513",strokeWidth:"2",strokeLinecap:"round"}),e.jsx("circle",{cx:"48",cy:"22",r:"6",fill:"#dc2626"}),e.jsx("path",{d:"M 45 18 Q 48 16 51 18",stroke:"#991b1b",strokeWidth:"1",fill:"none"}),e.jsx("circle",{cx:"46",cy:"21",r:"1",fill:"#fca5a5"}),e.jsx("circle",{cx:"50",cy:"23",r:"1",fill:"#fca5a5"}),e.jsx("circle",{cx:"48",cy:"25",r:"1",fill:"#fca5a5"})]}),y&&e.jsxs("g",{children:[e.jsx("rect",{x:"44",y:"38",width:"14",height:"10",rx:"1",fill:"#c9a66b",stroke:"#8b6914",strokeWidth:"0.5"}),e.jsx("text",{x:"51",y:"43",textAnchor:"middle",fontSize:"2.5",fill:"#4a3728",fontWeight:"bold",children:"WILL"}),e.jsx("text",{x:"51",y:"46",textAnchor:"middle",fontSize:"2.5",fill:"#4a3728",fontWeight:"bold",children:"TRADE"})]}),e.jsx(v.rect,{x:"24",y:"56",width:"5",height:"14",rx:"2",fill:"#1a1a2e",animate:{rotate:[15,-15,15]},transition:{duration:.3,repeat:1/0},style:{transformOrigin:"26px 56px"}}),e.jsx(v.rect,{x:"31",y:"56",width:"5",height:"14",rx:"2",fill:"#1a1a2e",animate:{rotate:[-15,15,-15]},transition:{duration:.3,repeat:1/0},style:{transformOrigin:"33px 56px"}})]})})})})},Ut=({buildings:t,maxVolume:s,onJumpToTower:a,onScrollToTop:c})=>{const[r,d]=m.useState(!0),h=o=>20+(s>0?o/s:0)*40,x=o=>{const i=Ke(ne(o.yesPrice),.55,.45);return i==="yes"?"bg-emerald-500":i==="no"?"bg-rose-500":i==="even"?"bg-purple-500":"bg-slate-600"},l=t.some(o=>ne(o.yesPrice)===null),n=(o,i=30)=>o.length<=i?o:o.slice(0,i)+"...";return e.jsxs(v.div,{className:"fixed bottom-6 left-6 z-50",initial:{opacity:0,scale:.8,y:20}
7,animate:{opacity:1,scale:1,y:0},transition:{delay:.5,duration:.3},children:[!r&&e.jsxs(v.button,{onClick:()=>d(!0),className:"flex items-center gap-2 px-3 py-2 bg-black/80 backdrop-blur-md rounded-full border border-purple-500/30 hover:border-purple-500/60 transition-colors shadow-lg shadow-purple-500/20",whileHover:{scale:1.05},whileTap:{scale:.95},children:[e.jsx(Ae,{className:"h-4 w-4 text-purple-400"}),e.jsx("span",{className:"text-xs text-white font-medium",children:"Map"})]}),r&&e.jsxs(v.div,{className:"bg-black/90 backdrop-blur-md rounded-xl border border-purple-500/30 shadow-xl shadow-purple-500/20 overflow-hidden",initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"h-3.5 w-3.5 text-purple-400"}),e.jsx("span",{className:"text-xs font-semibold text-white",children:"Tower Map"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(v.button,{onClick:c,className:"p-1.5 rounded-md hover:bg-white/10 transition-colors",whileHover:{scale:1.1},whileTap:{scale:.9},title:"Scroll to top",children:e.jsx(be,{className:"h-3.5 w-3.5 text-cyan-400"})}),e.jsx("button",{onClick:()=>d(!1),className:"text-xs text-muted-foreground hover:text-white transition-colors px-1",children:"â"})]})]}),e.jsxs("div",{className:"p-3",children:[e.jsx("div",{className:"flex items-end justify-center gap-3 min-h-[80px]",children:t.map((o,i)=>{const g=h(o.totalVolume||0),k=x(o);return e.jsxs(v.button,{onClick:()=>a(i),className:"group relative flex flex-col items-center",whileHover:{scale:1.1},whileTap:{scale:.95},children:[e.jsxs(v.div,{className:`w-6 rounded-t-sm ${k} shadow-lg relative overflow-hidden`,style:{height:g},initial:{height:0},animate:{height:g},transition:{delay:i*.1,duration:.4},children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-transparent via-white/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity"}),e.jsx("div",{className:"absolute inset-1 flex flex-col gap-1",children:Array.from({length:Math.floor(g/12)}).map((N,y)=>e.jsx("div",{className:"w-1 h-1 bg-yellow-300/60 rounded-full mx-auto"},y))})]}),e.jsx("div",{className:"w-8 h-1.5 bg-slate-600 rounded-sm"}),e.jsx("span",{className:"mt-1 text-[10px] text-muted-foreground group-hover:text-white transition-colors",children:i+1}),e.jsx("div",{className:"absolute bottom-full mb-2 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10",children:e.jsxs("div",{className:"bg-black/95 border border-white/20 rounded-md px-2 py-1 whitespace-nowrap shadow-lg",children:[e.jsx("p",{className:"text-[10px] text-white font-medium max-w-[120px] truncate",children:n(o.question)}),e.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Click to jump"})]})})]},o.id)})}),e.jsx("div",{className:"mt-1 h-1 bg-gradient-to-r from-transparent via-slate-500/50 to-transparent rounded-full"})]}),e.jsxs("div",{className:"px-3 pb-2 flex items-center justify-center gap-3 text-[9px] text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-sm bg-emerald-500"}),e.jsx("span",{children:"YES heavy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-sm bg-rose-500"}),e.jsx("span",{children:"NO heavy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-sm bg-purple-500"}),e.jsx("span",{children:"Even"})]}),l&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-sm bg-slate-600"}),e.jsx("span",{children:"No price"})]})]})]})]})},Xt=({endsAt:t})=>{const[s,a]=m.useState(0),[c,r]=m.useState(!1);m.useEffect(()=>{if(!t)return;const x=()=>{const n=Date.now(),o=Math.max(0,t.getTime()-n);a(o),o===0&&!c&&(console.log("[CountdownTimer] â° Timer ended! Resolution should trigger soon..."),r(!0))};x();const l=setInterval(x,1e3);return()=>clearInterval(l)},[t,c]),m.useEffect(()=>{r(!1)},[t]);const d=Math.floor(s/6e4),h=Math.floor(s%6e4/1e3);return t?s===0?e.jsxs(v.div,{className:"flex items-center gap-1.5 px-3 py-1.5 bg-amber-500/20 backdrop-blur-md rounded-full border border-amber-500/50",animate:{o
7pacity:[1,.5,1]},transition:{duration:.8,repeat:1/0},children:[e.jsx(Le,{className:"h-3.5 w-3.5 text-amber-400"}),e.jsx("span",{className:"text-xs font-mono font-bold text-amber-400",children:"RESOLVING..."})]}):e.jsxs(v.div,{className:"flex items-center gap-1.5 px-3 py-1.5 bg-black/70 backdrop-blur-md rounded-full border border-purple-500/30",animate:{scale:s<3e4?[1,1.02,1]:1},transition:{duration:.5,repeat:s<3e4?1/0:0},children:[e.jsx(Le,{className:`h-3.5 w-3.5 ${s<3e4?"text-rose-400":"text-purple-400"}`}),e.jsxs("span",{className:`text-xs font-mono font-bold ${s<3e4?"text-rose-400":"text-white"}`,children:[String(d).padStart(2,"0"),":",String(h).padStart(2,"0")]})]}):null},He=[{base:"#fcd9b6",highlight:"#fde8d7"},{base:"#e8beac",highlight:"#f5d6c6"},{base:"#d4a574",highlight:"#e5c4a8"},{base:"#c68642",highlight:"#daa06d"},{base:"#8d5524",highlight:"#a66a3a"},{base:"#6b4423",highlight:"#8a5a35"},{base:"#4a3728",highlight:"#6b5344"},{base:"#3b2219",highlight:"#5c3d2e"}],Qt=t=>{let s=0;for(let a=0;a<t.length;a++)s=(s<<5)-s+t.charCodeAt(a),s=s&s;return He[Math.abs(s)%He.length]},Vt=t=>t===void 0?"none":t>=80?"wizard":t>=70?"crown":t>=50?"cap":t<30?"dunce":"none",Kt=t=>t===void 0?"casual":t>=200?"elite":t>=100?"professional":t>=50?"casual":t>=20?"basic":"shabby",ge=m.memo(({trade:t,uniqueId:s,showLegs:a=!0})=>{const c=Qt(t.id),r=c.base,d=c.highlight,h=t.size_tier==="whale"||t.size_tier==="god_whale",x=Vt(t.win_rate),l=Kt(t.trade_count),n=t.side==="yes"?{h:160,s:84,l:39}:{h:350,s:89,l:60},i=(()=>{switch(l){case"elite":return{primary:`hsl(${n.h}, ${n.s}%, ${n.l-5}%)`,secondary:`hsl(${n.h}, ${n.s}%, ${n.l-15}%)`,accent:"#fbbf24",pattern:"pinstripe"};case"professional":return{primary:`hsl(${n.h}, ${n.s}%, ${n.l}%)`,secondary:`hsl(${n.h}, ${n.s-10}%, ${n.l-10}%)`,accent:"#94a3b8",pattern:"solid"};case"casual":return{primary:`hsl(${n.h}, ${n.s-20}%, ${n.l+5}%)`,secondary:`hsl(${n.h}, ${n.s-20}%, ${n.l-5}%)`,accent:null,pattern:"solid"};case"basic":return{primary:`hsl(${n.h}, ${n.s-40}%, ${n.l+10}%)`,secondary:`hsl(${n.h}, ${n.s-40}%, ${n.l}%)`,accent:null,pattern:"solid"};case"shabby":return{primary:`hsl(${n.h}, ${n.s-60}%, ${n.l+15}%)`,secondary:`hsl(${n.h}, ${n.s-60}%, ${n.l+5}%)`,accent:"#6b7280",pattern:"patched"}}})();return e.jsxs("svg",{width:"28",height:"50",viewBox:"0 0 40 64",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:`bodyGrad-${s}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:i.primary}),e.jsx("stop",{offset:"100%",stopColor:i.secondary})]}),e.jsxs("linearGradient",{id:`skinGrad-${s}`,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:d}),e.jsx("stop",{offset:"100%",stopColor:r})]}),e.jsxs("pattern",{id:`pinstripe-${s}`,width:"2",height:"4",patternUnits:"userSpaceOnUse",children:[e.jsx("rect",{width:"2",height:"4",fill:i.primary}),e.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"4",stroke:i.accent||"#fbbf24",strokeWidth:"0.3",opacity:"0.5"})]})]}),a&&e.jsx("ellipse",{cx:"20",cy:"62",rx:"10",ry:"2",fill:"rgba(0,0,0,0.4)"}),e.jsx("rect",{x:"10",y:"28",width:"20",height:"22",rx:"6",fill:l==="elite"?`url(#pinstripe-${s})`:`url(#bodyGrad-${s})`}),l==="elite"&&e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M 15 28 L 20 35 L 20 50 L 15 50 Z",fill:i.secondary,opacity:"0.3"}),e.jsx("path",{d:"M 25 28 L 20 35 L 20 50 L 25 50 Z",fill:i.secondary,opacity:"0.3"}),e.jsx("circle",{cx:"20",cy:"38",r:"1",fill:"#fbbf24"}),e.jsx("circle",{cx:"20",cy:"44",r:"1",fill:"#fbbf24"})]}),l==="professional"&&e.jsx("path",{d:"M 18 28 L 20 30 L 22 28 L 21 42 L 20 44 L 19 42 Z",fill:"#1a1a2e"}),l==="shabby"&&e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"12",y:"35",width:"4",height:"4",fill:"#6b7280",opacity:"0.6"}),e.jsx("rect",{x:"24",y:"40",width:"3",height:"5",fill:"#6b7280",opacity:"0.6"})]}),e.jsx("ellipse",{cx:"8",cy:"38",rx:"3",ry:"5",fill:r}),e.jsx("ellipse",{cx:"32",cy:"38",rx:"3",ry:"5",fill:r}),e.jsx("circle",{cx:"20",cy:"18",r:"9",fill:`url(#skinGrad-${s})`}),x==="wizard"&&e.jsxs("g",{children:[e.jsx("path",{d:"M 12 12 L 20 -8 L 28 12 Z",fill:"#6366f1",stroke:"#4f46e5",strokeWidth:"0.5"}),e.jsx("path",{d:"M 10 12 Q 20 16 30 12",fill:"#8b5cf6"}),e.jsx("circle",{cx:"18",cy:"2",r:"1.5",fill:"#fbbf24"}),e.jsx("circle",{cx:"22",cy:"6",r:"1",fill:"#fbbf24"})]}),x==="crown"&&h&&e.jsx("path",{d:"M 12 9 L 14 5 L 17 8 L 20 3 L 23 8 L 26 5 L 28 9 Z",fill:"#fbbf24",stroke:"#f59e0b",strokeWidth:"0.5"}),x==="cap"&&e.jsxs("g",{children:[e.jsx("ellipse",{cx:"20",cy:"11",rx:"10",ry:"4",fill:"#3b82f6"}),e.jsx("path",{d:"M 10 11 Q 5 13 8 16",fill:"#3b82f6",stroke:"#2563eb",strokeWidth:"0.5"})]}),x==="dunce"&&e.jsxs("g",{children:[e.jsx("path",{d:"M 14 12 L 20 -2 L 26 12 Z",fill:"#9ca3af",stroke:"#6b7280",strokeWidth:"0.5"}),e.jsx("text",{x:"20",y:"8",fontSize:"6",fill:"#374151",textAnchor:"middle",fontWeight:"bold",children:"D"})]}),x==="none"&&!h&&e.jsx("path",{d:"M 13 13 Q 20 6 27 13",fill:"#6b7280",stroke:"#6b7280",strokeWidth:"3",strokeLinecap:"round"}),x==="none"&&h&&e.jsx("path",{d:"M 12 9 L 14 5 L 17 8 L 20 3 L 23 8 L 26 5 L 28 9 Z",fill:"#fbbf24",stroke:"#f59e0b",strokeWidth:"0.5"}),e.jsx("ellipse",{cx:"16",cy:"17",rx:"3.5",ry:"4",fill:"white"}),e.jsx("ellipse",{cx:"24",cy:"17",rx:"3.5",ry:"4",fill:"white"}),e.jsx("circle",{cx:"16",cy:"17",r:"1.8",fill:"#1a1a2e"}),e.jsx("circle",{cx:"24",cy:"17",r:"1.8",fill:"#1a1a2e"}),e.jsx("circle",{cx:"15",cy:"16",r:"0.8",fill:"white"}),e.jsx("circle",{cx:"23",cy:"16",r:"0.8",fill:"white"}),e.jsx("path",{d:"M 16 23 Q 20 26 24 23",stroke:"#1a1a2e",strokeWidth:"1.5",fill:"none"}),a&&e.jsxs(e.Fragment,{children:[e.jsx("g",{className:"animate-pulse",children:e.jsx("rect",{x:"14",y:"48",width:"4",height:"10",rx:"2",fill:"#1a1a2e"})}),e.jsx("g",{className:"animate-pulse",style:{animationDelay:"0.15s"},children:e.jsx("rect",{x:"22",y:"48",width:"4",height:"10",rx:"2",fill:"#1a1a2e"})})]})]})}),Yt=m.memo(({direction:t,uniqueId:s})=>e.jsxs("svg",{width:"120",height:"45",viewBox:"0 0 120 45",style:{transform:`scaleX(${t})`},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`limoGrad-${s}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"#1a1a2e"}),e.jsx("stop",{offset:"50%",stopColor:"#0f0f1a"}),e.jsx("stop",{offset:"100%",stopColor:"#1a1a2e"})]})}),e.jsx("rect",{x:"5",y:"15",width:"110",height:"20",rx:"5",fill:`url(#limoGrad-${s})`}),e.jsx("path",{d:"M 20 15 Q 25 5 40 5 L 80 5 Q 95 5 100 15",fill:"#0f0f1a"}),e.jsx("rect",{x:"25",y:"8",width:"15",height:"10",rx:"2",fill:"#3b82f6",opacity:"0.7"}),e.jsx("rect",{x:"45",y:"8",width:"12",height:"10",rx:"2",fill:"#3b82f6",opacity:"0.7"}),e.jsx("rect",{x:"62",y:"8",width:"12",height:"10",rx:"2",fill:"#3b82f6",opacity:"0.7"}),e.jsx("rect",{x:"79",y:"8",width:"15",height:"10",rx:"2",fill:"#3b82f6",opacity:"0.7"}),e.jsx("rect",{x:"5",y:"34",width:"110",height:"2",fill:"#c0c0c0"}),e.jsx("circle",{cx:"25",cy:"38",r:"7",fill:"#1a1a2e",stroke:"#333",strokeWidth:"2"}),e.jsx("circle",{cx:"25",cy:"38",r:"3",fill:"#666"}),e.jsx("circle",{cx:"95",cy:"38",r:"7",fill:"#1a1a2e",stroke:"#333",strokeWidth:"2"}),e.jsx("circle",{cx:"95",cy:"38",r:"3",fill:"#666"}),e.jsx("ellipse",{cx:"112",cy:"25",rx:"3",ry:"4",fill:"#fbbf24"}),e.jsx("rect",{x:"8",y:"22",width:"4",height:"8",rx:"1",fill:"#fbbf24"}),e.jsx("rect",{x:"108",y:"22",width:"4",height:"8",rx:"1",fill:"#fbbf24"})]})),Zt=m.memo(({uniqueId:t,rotorAngle:s})=>e.jsxs("svg",{width:"100",height:"70",viewBox:"0 0 100 70",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`heliGrad-${t}`,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"#fbbf24"}),e.jsx("stop",{offset:"100%",stopColor:"#d97706"})]})}),e.jsxs("g",{style:{transform:`rotate(${s}deg)`,transformOrigin:"50px 15px"},children:[e.jsx("rect",{x:"5",y:"13",width:"90",height:"4",rx:"2",fill:"#666"}),e.jsx("rect",{x:"48",y:"5",width:"4",height:"20",rx:"2",fill:"#666"})]}),e.jsx("rect",{x:"47",y:"18",width:"6",height:"8",fill:"#333"}),e.jsx("ellipse",{cx:"50",cy:"40",rx:"30",ry:"15",fill:`url(#heliGrad-${t})`}),e.jsx("ellipse",{cx:"65",cy:"38",rx:"12",ry:"8",fill:"#3b82f6",opacity:"0.8"}),e.jsx("rect",{x:"15",y:"36",width:"20",height:"8",fill:"#d97706"}),e.jsx("ellipse",{cx:"10",cy:"40",rx:"2",ry:"8",fill:"#666"}),e.jsx("rect",{x:"30",y:"55",width:"40",height:"3",rx:"1",fill:"#333"}),e.jsx("rect",{x:"35",y:"52",width:"3",height:"6",fill:"#333"}),e.jsx("rect",{x:"62",y:"52",width:"3",height:"6",fill:"#333"}),e.jsx("path",{d:"M 50 32 L 55 40 L 50 48 L 45 40 Z",fill:"#fff",opacity:"0.8"})]})),qt=m.memo(({walker:t,now:s})=>{const[a,c]=m.useState(!1),{trade:r,startX:d,targetX:h,duration:x,spawnTime:l}
7=t,n=d<h?1:-1,o=(s-l)/1e3,i=x-1,g=Math.min(o/i,1),k=d+(h-d)*g,N=`trade-${r.id}`,y=r.size_tier==="whale",z=r.size_tier==="god_whale",T=`${r.wallet.slice(0,6)}...${r.wallet.slice(-4)}`,w=r.amount_usd>=1e6?`$${(r.amount_usd/1e6).toFixed(1)}M`:r.amount_usd>=1e3?`$${(r.amount_usd/1e3).toFixed(1)}K`:`$${r.amount_usd.toFixed(0)}`,f=r.size_tier==="god_whale"?"GOD WHALE":r.size_tier==="whale"?"Whale":r.size_tier==="chubby"?"Chonky":r.size_tier==="normal"?"Normal":"Shrimp",j=r.pnl_percent??0;j>=0?`${j.toFixed(1)}`:`${j.toFixed(1)}`;const M=_=>{_.stopPropagation(),c(!a)},I=({children:_})=>e.jsx(Ge,{delayDuration:100,children:e.jsxs(Ue,{open:a,onOpenChange:c,children:[e.jsx(Xe,{asChild:!0,children:e.jsx("div",{className:"cursor-pointer",onClick:M,children:_})}),e.jsx(Qe,{side:"top",sideOffset:12,avoidCollisions:!0,collisionPadding:20,className:"p-0 border-0 bg-transparent shadow-none pointer-events-auto !z-[99999]",style:{maxWidth:"280px"},children:e.jsx(oe,{to:`/address/${r.wallet}`,className:"block group",onClick:P=>P.stopPropagation(),children:e.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-white/10 bg-gradient-to-br from-slate-900/95 via-slate-800/95 to-slate-900/95 backdrop-blur-xl shadow-2xl",children:[e.jsx("div",{className:`h-1 w-full ${r.side==="yes"?"bg-gradient-to-r from-emerald-500 via-emerald-400 to-teal-500":"bg-gradient-to-r from-rose-500 via-rose-400 to-pink-500"}`}),e.jsxs("div",{className:"p-3 pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[(y||z)&&e.jsx("div",{className:`p-1 rounded-md ${z?"bg-gradient-to-br from-amber-500/30 to-yellow-500/30":"bg-gradient-to-br from-purple-500/30 to-indigo-500/30"}`,children:e.jsx(Ye,{className:`h-3.5 w-3.5 ${z?"text-amber-400":"text-purple-400"}`})}),e.jsx("span",{className:"font-mono text-sm font-semibold text-white/90 group-hover:text-white transition-colors",children:r.display_name||T})]}),e.jsx(Ve,{className:"h-3.5 w-3.5 text-white/40 group-hover:text-white/80 transition-colors"})]}),e.jsx("div",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider ${z?"bg-gradient-to-r from-amber-500/20 to-yellow-500/20 text-amber-300 border border-amber-500/30":y?"bg-gradient-to-r from-purple-500/20 to-indigo-500/20 text-purple-300 border border-purple-500/30":r.size_tier==="chubby"?"bg-gradient-to-r from-blue-500/20 to-cyan-500/20 text-blue-300 border border-blue-500/30":r.side==="yes"?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"bg-rose-500/20 text-rose-300 border border-rose-500/30"}`,children:f})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-px bg-white/5 mx-3 mb-3 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-slate-800/80 p-2 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-white/50 mb-0.5",children:[e.jsx(Ze,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[9px] uppercase tracking-wider",children:"Size"})]}),e.jsx("span",{className:"text-sm font-bold text-white",children:w})]}),e.jsxs("div",{className:"bg-slate-800/80 p-2 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-white/50 mb-0.5",children:[e.jsx(Ne,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[9px] uppercase tracking-wider",children:"Side"})]}),e.jsx("span",{className:`text-sm font-bold ${r.side==="yes"?"text-emerald-400":"text-rose-400"}`,children:r.side.toUpperCase()})]})]}),e.jsx("div",{className:"px-3 pb-2 text-center",children:e.jsx("span",{className:"text-[10px] text-purple-400",children:"Click to view profile â"})})]})})})]})});if(z){const _=i*.6,P=i*.2,b=i*.2,$=Math.min(o/_,1),H=o>_?Math.min((o-_)/P,1):0,D=o>_+P?Math.min((o-_-P)/b,1):0,U=d+(h-d)*$,V=-80+H*80,K=o*1e3%360,G=D>0,B=G?h+n*-30*(1-D):h;return e.jsxs("div",{className:"absolute",style:{opacity:o<.3?o/.3:1,bottom:"8px"},children:[D<1&&e.jsx("div",{className:"absolute",style:{transform:`translateX(${U-50}px) translateY(${V}px)`,bottom:"30px"},children:e.jsx(Zt,{uniqueId:N,rotorAngle:K})}),G&&e.jsx(I,{children:e.jsxs("div",{className:"absolute",style:{transform:`translateX(${B}px) scale(2.64)`,bottom:"0px"},children:[e.jsx("div",{style:{transform:`scaleX(${n})`},children:e.jsx(ge,{trade:r,uniqueId:N,showLegs:!0})}),(r.size_tier==="chubby"||r.size_tier==="whale"||r.size_tier==="god_whale")&&e.jsxs("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 text-[8px] font-bold px-1 py-0.5 rounded whitespace-nowrap",style:{background:r.side==="yes"?"rgba(16, 185, 129, 0.9)":"rgba(244, 63, 94, 0.9)",color:"white"},children:["$",r.amount_usd>=1e6?`${(r.amount_usd/1e6).toFixed(1)}M`:r.amount_usd>=1e3?`${(r.amount_usd/1e3).toFixed(0)}K`:r.amount_usd.toFixed(0)]})]})})]})}if(y){const _=i*.7,P=i*.3,b=Math.min(o/_,1),$=o>_?Math.min((o-_)/P,1):0,H=d+(h-60-d)*b,D=$>0,U=h-60+n*30,V=D?U+(h-U)*$:h;return e.jsxs("div",{className:"absolute",style:{opacity:o<.3?o/.3:1,bottom:"8px"},children:[$<.8&&e.jsx("div",{className:"absolute",style:{transform:`translateX(${H}px)`,bottom:"0px"},children:e.jsx(Yt,{direction:n,uniqueId:N})}),D&&e.jsx(I,{children:e.jsxs("div",{className:"absolute",style:{transform:`translateX(${V}px) scale(2.16)`,bottom:"0px"},children:[e.jsx("div",{style:{transform:`scaleX(${n})`},children:e.jsx(ge,{trade:r,uniqueId:N,showLegs:!0})}),(r.size_tier==="chubby"||r.size_tier==="whale"||r.size_tier==="god_whale")&&e.jsxs("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 text-[8px] font-bold px-1 py-0.5 rounded whitespace-nowrap",style:{background:r.side==="yes"?"rgba(16, 185, 129, 0.9)":"rgba(244, 63, 94, 0.9)",color:"white"},children:["$",r.amount_usd>=1e6?`${(r.amount_usd/1e6).toFixed(1)}M`:r.amount_usd>=1e3?`${(r.amount_usd/1e3).toFixed(0)}K`:r.amount_usd.toFixed(0)]})]})})]})}const E=r.size_tier==="chubby"?1.8:1.56;return e.jsx(I,{children:e.jsxs("div",{className:"absolute transition-opacity duration-300",style:{transform:`translateX(${k}px) scale(${E})`,opacity:o<.3?o/.3:1,bottom:"8px"},children:[e.jsx("div",{style:{transform:`scaleX(${n})`},children:e.jsx(ge,{trade:r,uniqueId:N,showLegs:!0})}),(r.size_tier==="chubby"||r.size_tier==="whale"||r.size_tier==="god_whale")&&e.jsxs("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 text-[8px] font-bold px-1 py-0.5 rounded whitespace-nowrap",style:{background:r.side==="yes"?"rgba(16, 185, 129, 0.9)":"rgba(244, 63, 94, 0.9)",color:"white"},children:["$",r.amount_usd>=1e6?`${(r.amount_usd/1e6).toFixed(1)}M`:r.amount_usd>=1e3?`${(r.amount_usd/1e3).toFixed(0)}K`:r.amount_usd.toFixed(0)]})]})})}),Jt=()=>{var $e;const{data:t,isLoading:s,error:a,liveTrades:c,removeTrade:r,getPreviousIntervalBuildings:d,currentInterval:h,displayInterval:x,isTransitioning:l}=Rt(),n=jt(),[o,i]=m.useState(!1),g=m.useRef(null),k=m.useRef(null),[N,y]=m.useState({}),[z,T]=m.useState([]),[w,f]=m.useState(Date.now()),j=m.useRef(!1),[M,I]=m.useState(new Map),[E,_]=m.useState(!1),[P,b]=m.useState(!1),$=4,H=!1,D=m.useRef(0),U=m.useRef(0);m.useEffect(()=>{const u=k.current;if(!u)return;const p=()=>{const W=Date.now();if(W-D.current<100)return;D.current=W;const{scrollHeight:A,clientHeight:L,scrollTop:C}=u,F=U.current||A,X=A>
7L+50,Y=A-F,Q=Y>1;Q&&!P&&(u.scrollTop=C+Y),X&&!P&&Q&&_(!0),C<A-L-100&&(P||b(!0),_(!1)),U.current=A},S=setInterval(p,500);return u.addEventListener("scroll",p),()=>{clearInterval(S),u.removeEventListener("scroll",p)}},[P]);const V=m.useRef(!1);m.useEffect(()=>{if(V.current)return;const u=k.current;if(u){const p=setTimeout(()=>{u.scrollTop=u.scrollHeight,V.current=!0,U.current=u.scrollHeight},100);return()=>clearTimeout(p)}},[]);const K=m.useRef(x);m.useEffect(()=>{K.current!==x&&K.current!==void 0&&(console.log(`[PolyTownCity] Display interval changed from ${K.current} to ${x}, resetting for new interval`),j.current=!1,T([]),y({}),I(new Map)),K.current=x},[x]);const G=m.useMemo(()=>{const u=typeof window<"u"?window.innerWidth:1200,p=n?280:200,S=40,W=$,A=W*p+(W-1)*S,L=(u-A)/2;return Array.from({length:W}).map((C,F)=>L+F*(p+S)+p/2)},[n,$]),B=m.useMemo(()=>t!=null&&t.buildings?t.buildings.slice(0,$):[],[t,$]),ie=m.useMemo(()=>B.length?Math.max(...B.map(u=>u.volume),1):1,[B]),le=m.useCallback(u=>{const{buildingIndex:p,winningSide:S}=u;console.log(`[PolyTown] Market resolved! Building ${p}, winner: ${S}`);const W=N[p]||[];W.length>0&&(I(A=>{const L=new Map(A);return L.set(p,{winningSide:S,exitingTrades:[...W]}),L}),y(A=>({...A,[p]:[]})),setTimeout(()=>{I(A=>{const L=new Map(A);return L.delete(p),L})},15e3))},[N]);m.useCallback(u=>{console.log(`[PolyTown] Demo trigger: all towers resolving with winner: ${u}`),B.forEach((p,S)=>{le({buildingIndex:S,winningSide:u,marketId:p.id,resolvedAt:new Date})})},[B,le]),Bt(B.map(u=>({id:u.id,endsAt:u.endsAt,crypto:u.crypto})),le,d);const rt=m.useRef(Date.now()),ke=m.useRef(0),ot=33;m.useEffect(()=>{let u;const p=()=>{const S=Date.now();rt.current=S,S-ke.current>=ot&&(ke.current=S,f(S)),T(W=>{const A=[],L=[];return W.forEach(C=>{S>=C.completeTime?L.push(C):A.push(C)}),L.length>0&&L.forEach(C=>{const F={id:C.trade.id,wallet:C.trade.wallet,side:C.trade.side,amount_usd:C.trade.amount_usd,size_tier:C.trade.size_tier,display_name:C.trade.display_name,pnl_percent:C.trade.pnl_percent};y(X=>{const Z=[...X[C.buildingIndex]||[],F].slice(-200);return{...X,[C.buildingIndex]:Z}})}),L.length>0?A:W}),u=requestAnimationFrame(p)};return u=requestAnimationFrame(p),()=>cancelAnimationFrame(u)},[]),m.useEffect(()=>{if(!(t!=null&&t.buildings)||j.current||G.length===0)return;j.current=!0;const u=typeof window<"u"?window.innerWidth:1200,p=Date.now();let S=null;t.buildings.forEach(R=>{if(R.endsAt){const O=new Date(R.endsAt).getTime();(!S||O<S)&&(S=O)}});const W=120*1e3+15*1e3,A=3e4,L=18e4;let C;if(S){const R=S-p-W;C=Math.max(A,Math.min(L,R))}else C=3e4;console.log(`[PolyTownCity] Spawn window: ${(C/1e3).toFixed(1)}s to get all characters inside`);const F=[];t.buildings.forEach((R,O)=>{O>=$||R.positions.forEach((de,ee)=>{F.push({pos:de,buildingIndex:O,posIndex:ee})})});for(let R=F.length-1;R>0;R--){const O=Math.floor(Math.random()*(R+1));[F[R],F[O]]=[F[O],F[R]]}const X=[],Y=100,Q=.8,Z=300*1e3,ce=Math.max(Z,C-5e3,1e4),q=Math.ceil(F.length*Q),Te=F.length-q;console.log(`[PolyTownCity] First wave: ${q} traders over ${(ce/1e3).toFixed(0)}s`),F.forEach(({pos:R,buildingIndex:O,posIndex:de},ee)=>{const Me=G[O]||400,Se=Math.random()>.5?-50:u+50,nt=Math.abs(Me-Se),at=Y+(Math.random()-.5)*20,Ce=nt/at+.5,he=Ce*1e3;let te;if(ee<q){const me=q>1?ee/(q-1):0,xe=Math.max(0,Math.min(ce,C)-he);te=me*xe}else{const me=ee-q,xe=Te>1?me/(Te-1):0,Ie=Math.min(ce,C),lt=Math.max(0,C-Ie-he);te=Ie+xe*lt}const it=(Math.random()-.5)*300;te=Math.max(0,te+it);const Pe=p+te;X.push({trade:{id:`initial-${O}-${de}`,wallet:R.wallet,side:R.side,amount_usd:R.amount_usd,size_tier:R.size_tier,display_name:R.display_name,pnl_percent:R.pnl_percent,buildingIndex:O},buildingIndex:O,spawnTime:Pe,completeTime:Pe+he,startX:Se,targetX:Me,duration:Ce})}),T(X),console.log(`[PolyTownCity] Scheduled ${X.length} walkers across ${(C/1e3).toFixed(1)}s window`)},[t,G,$]);const _e=m.useRef(new Set);return m.useEffect(()=>{if(!c.length||G.length===0)return;const u=typeof window<"u"?window.innerWidth:1200,p=[];c.forEach(S=>{if(_e.current.has(S.id))return;_e.current.add(S.id);const W=G[S.buildingIndex]||G[0]||400,L=Math.random()>.5?-50:u+50,Q=Math.abs(W-L)/80+1,Z=Date.now();p.push({trade:{...S,buildingIndex:S.buildingIndex}
7,buildingIndex:S.buildingIndex,spawnTime:Z,completeTime:Z+Q*1e3,startX:L,targetX:W,duration:Q}),r(S.id)}),p.length>0&&T(S=>[...S,...p])},[c,G,r]),s?e.jsxs("div",{className:"flex flex-col items-center justify-center h-[70vh] gap-4 bg-gradient-to-b from-slate-950 via-purple-950/20 to-slate-950",children:[e.jsxs(v.div,{className:"relative",animate:{rotate:360},transition:{duration:3,repeat:1/0,ease:"linear"},children:[e.jsx("div",{className:"absolute inset-0 blur-xl bg-gradient-to-r from-cyan-500 via-purple-500 to-pink-500 opacity-50"}),e.jsx(ze,{className:"h-16 w-16 text-cyan-400 relative z-10"})]}),e.jsx(v.p,{className:"text-lg font-medium bg-gradient-to-r from-cyan-400 via-purple-400 to-pink-400 bg-clip-text text-transparent",animate:{opacity:[.5,1,.5]},transition:{duration:2,repeat:1/0},children:"Constructing PolyTown..."})]}):a||!t?e.jsxs("div",{className:"flex flex-col items-center justify-center h-[70vh] gap-4",children:[e.jsx(ze,{className:"h-12 w-12 text-destructive"}),e.jsx("p",{className:"text-destructive",children:"Failed to load PolyTown"})]}):e.jsxs("div",{className:"absolute inset-0 flex flex-col",ref:g,children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-[#0a0a1a] via-[#0f0f2a] to-[#1a1a3a] pointer-events-none z-0"}),e.jsxs("div",{className:"absolute left-0 top-0 bottom-0 w-[100px] pointer-events-none overflow-hidden opacity-40 z-[1]",children:[e.jsx("div",{className:"absolute left-2 top-[10%] w-7 h-[60%] bg-gradient-to-b from-fuchsia-900/30 to-fuchsia-950/40 rounded-sm",children:Array.from({length:12}).map((u,p)=>e.jsx(v.div,{className:"h-2.5 mx-1 my-2 bg-fuchsia-500/25 rounded-sm",animate:{opacity:[.2,.4,.2]},transition:{duration:2,repeat:1/0,delay:p*.15}},p))}),e.jsx("div",{className:"absolute left-10 top-[25%] w-8 h-[50%] bg-gradient-to-b from-pink-900/30 to-pink-950/40 rounded-sm",children:Array.from({length:10}).map((u,p)=>e.jsx(v.div,{className:"h-2 mx-1 my-2 bg-pink-500/25 rounded-sm",animate:{opacity:[.15,.35,.15]},transition:{duration:2.5,repeat:1/0,delay:p*.2}},p))}),e.jsx("div",{className:"absolute left-[60px] top-[40%] w-10 h-[40%] bg-gradient-to-b from-fuchsia-800/20 to-fuchsia-950/35 rounded-sm",children:Array.from({length:8}).map((u,p)=>e.jsx(v.div,{className:"h-1.5 mx-1.5 my-2 bg-fuchsia-400/20 rounded-sm",animate:{opacity:[.15,.3,.15]},transition:{duration:3,repeat:1/0,delay:p*.25}},p))}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-fuchsia-500/10 to-transparent blur-xl"})]}),e.jsxs("div",{className:"absolute right-0 top-0 bottom-0 w-[100px] pointer-events-none overflow-hidden opacity-40 z-[1]",children:[e.jsx("div",{className:"absolute right-2 top-[15%] w-7 h-[55%] bg-gradient-to-b from-blue-900/30 to-blue-950/40 rounded-sm",children:Array.from({length:11}).map((u,p)=>e.jsx(v.div,{className:"h-2.5 mx-1 my-2 bg-blue-500/25 rounded-sm",animate:{opacity:[.2,.4,.2]},transition:{duration:2,repeat:1/0,delay:p*.15}},p))}),e.jsx("div",{className:"absolute right-10 top-[30%] w-8 h-[45%] bg-gradient-to-b from-cyan-900/30 to-cyan-950/40 rounded-sm",children:Array.from({length:9}).map((u,p)=>e.jsx(v.div,{className:"h-2 mx-1 my-2 bg-cyan-500/25 rounded-sm",animate:{opacity:[.15,.35,.15]},transition:{duration:2.5,repeat:1/0,delay:p*.2}},p))}),e.jsx("div",{className:"absolute right-[60px] top-[35%] w-10 h-[45%] bg-gradient-to-b from-blue-800/20 to-blue-950/35 rounded-sm",children:Array.from({length:9}).map((u,p)=>e.jsx(v.div,{className:"h-1.5 mx-1.5 my-2 bg-blue-400/20 rounded-sm",animate:{opacity:[.15,.3,.15]},transition:{duration:3,repeat:1/0,delay:p*.25}},p))}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-l from-cyan-500/10 to-transparent blur-xl"})]}),e.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none z-0",children:Array.from({length:40}).map((u,p)=>e.jsx(v.div,{className:"absolute rounded-full bg-white",style:{left:`${15+Math.random()*70}%`,top:`${Math.random()*30}%`,width:Math.random()>.8?"2px":"1px",height:Math.random()>.8?"2px":"1px"},animate:{opacity:[.1,.5,.1]},transition:{duration:2+Math.random()*3,repeat:1/0,delay:Math.random()*2}},p))}),e.jsxs("div",{className:"absolute inset-0 pointer-events-none z-0",children:[e.jsx(v.div,{className:"absolute bottom-[20%] left-[10%] w-[300px] h-[200px] bg-fuchsia-600/10 blur-[100px] rounded-full",animate:{o
7pacity:[.15,.3,.15]},transition:{duration:4,repeat:1/0}}),e.jsx(v.div,{className:"absolute bottom-[20%] right-[10%] w-[300px] h-[200px] bg-cyan-600/10 blur-[100px] rounded-full",animate:{opacity:[.15,.3,.15]},transition:{duration:5,repeat:1/0,delay:1}}),e.jsx(v.div,{className:"absolute top-[20%] left-1/2 -translate-x-1/2 w-[400px] h-[150px] bg-purple-600/5 blur-[80px] rounded-full",animate:{opacity:[.1,.2,.1]},transition:{duration:6,repeat:1/0,delay:.5}})]}),e.jsxs("div",{className:"relative z-30 flex flex-wrap items-center justify-between gap-2 p-3 md:p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(v.div,{className:"flex items-center gap-2",initial:{opacity:0,y:-20},animate:{opacity:1,y:0},children:[e.jsx(vt,{className:"h-5 w-5 md:h-6 md:w-6 text-purple-400"}),e.jsx("h1",{className:"text-lg md:text-xl font-black tracking-tight",children:e.jsx("span",{className:"bg-gradient-to-r from-cyan-400 via-purple-400 to-pink-400 bg-clip-text text-transparent",children:"PolyTown"})})]}),e.jsxs(v.span,{className:"hidden sm:inline text-xs text-muted-foreground",initial:{opacity:0}
7,animate:{opacity:1},transition:{delay:.3},children:[t.total_positions.toLocaleString()," traders ⢠",$," markets"]})]}),e.jsxs(v.div,{className:"flex flex-wrap items-center justify-center gap-2 text-xs",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.4},children:[e.jsxs("div",{className:"flex items-center gap-2 bg-black/30 backdrop-blur-sm rounded-full px-2.5 py-1 border border-white/5",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-sm bg-emerald-500"}),e.jsx("span",{className:"text-emerald-400 font-medium",children:"YES"})]}),e.jsx("div",{className:"h-3 w-px bg-white/10"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-sm bg-rose-500"}),e.jsx("span",{className:"text-rose-400 font-medium",children:"NO"})]})]}),e.jsxs("div",{className:"hidden lg:flex items-center gap-2 bg-black/30 backdrop-blur-sm rounded-full px-2.5 py-1 border border-white/5",children:[e.jsx("span",{className:"text-muted-foreground",children:"BTC/ETH/SOL 15m + Fed Jan"}),e.jsx("div",{className:"h-3 w-px bg-white/10"}),e.jsx("span",{className:"text-muted-foreground",children:"Top 500 positions per market"})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-1.5 bg-black/30 backdrop-blur-sm rounded-full px-2.5 py-1 border border-white/5",children:[e.jsx(_t,{className:"h-3 w-3 text-purple-400"}),e.jsx("span",{className:"text-muted-foreground",children:"Click any character for trade details"})]}),(($e=B[0])==null?void 0:$e.endsAt)&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"hidden sm:inline text-muted-foreground",children:"ends in:"}),e.jsx(Xt,{endsAt:B[0].endsAt})]})]}),e.jsx(v.div,{className:"flex items-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2},children:e.jsxs(pt,{variant:"outline",size:"sm",onClick:()=>i(!o),className:"gap-1.5 bg-black/40 border-purple-500/30 hover:border-purple-500/60 hover:bg-purple-500/10 backdrop-blur-sm h-8 px-2.5",children:[o?e.jsx(Nt,{className:"h-4 w-4 text-cyan-400"}):e.jsx(kt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden md:inline text-xs",children:o?"On":"Off"})]})})]}),e.jsxs("div",{className:"relative z-20 flex-1 flex flex-col min-h-0 overflow-x-hidden",children:[e.jsx(ye,{children:E&&e.jsxs(v.button,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},onClick:()=>{var u;(u=k.current)==null||u.scrollTo({top:0,behavior:"smooth"}),b(!0)},className:"absolute top-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-2 px-4 py-2 bg-purple-600/90 hover:bg-purple-500 backdrop-blur-md rounded-full border border-purple-400/50 shadow-lg shadow-purple-500/30 transition-all cursor-pointer",children:[e.jsx(be,{className:"h-4 w-4 text-white animate-bounce"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Scroll up to see all traders"}),e.jsx(be,{className:"h-4 w-4 text-white animate-bounce"})]})}),e.jsx("div",{ref:k,className:"flex-1 overflow-y-auto overflow-x-hidden",style:{scrollbarWidth:"thin",scrollbarColor:"rgba(139, 92, 246, 0.3) transparent",overflowAnchor:"none"},children:e.jsxs("div",{className:"min-h-full flex flex-col-reverse",children:[e.jsxs("div",{className:"relative h-24 flex-shrink-0 z-20",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-slate-700/90 via-slate-800/95 to-slate-900"}),e.jsx("div",{className:"absolute top-1/2 left-0 right-0 h-[3px] -translate-y-1/2 flex gap-10 px-4",children:Array.from({length:40}).map((u,p)=>e.jsx("div",{className:"w-12 h-full bg-yellow-400/60 rounded-full flex-shrink-0"},p))}),e.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px] bg-gradient-to-r from-transparent via-purple-400/50 to-transparent"}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-gradient-to-r from-transparent via-purple-400/50 to-transparent"})]}),e.jsxs("div",{className:"absolute inset-0 z-30 overflow-visible",children:[z.filter(u=>w>=u.spawnTime&&w<u.completeTime).map(u=>e.jsx(qt,{walker:u,now:w}
7,u.trade.id)),e.jsx(ye,{children:Array.from(M.entries()).map(([u,{winningSide:p,exitingTrades:S}])=>{const W=G[u]||400;return S.map((A,L)=>{const C=A.side===p;return e.jsx(Gt,{trade:A,index:L,direction:C?"right":"left",delay:L*.1,startX:W+(A.side==="yes"?-30:30),isWinner:C},`exit-${u}-${A.id}`)})})})]})]}),e.jsx("div",{className:"flex items-end justify-center flex-shrink-0 relative z-10",style:{overflowAnchor:"none"},children:n?e.jsx("div",{className:"flex items-end gap-6 overflow-x-auto snap-x snap-mandatory px-4 scrollbar-hide",style:{scrollSnapType:"x mandatory",WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},children:B.map((u,p)=>e.jsx("div",{className:"snap-center flex-shrink-0",children:e.jsx(Be,{building:u,index:p,maxVolume:ie,enteredTrades:N[p]||[]})},u.id))}):e.jsxs("div",{className:"flex items-end justify-center gap-6 md:gap-10 pt-4 flex-wrap",children:[B.map((u,p)=>e.jsx(Be,{building:u,index:p,maxVolume:ie,enteredTrades:N[p]||[]},u.id)),H]})})]})})]}),e.jsx(Ut,{buildings:B.map(u=>({id:u.id,question:u.title,yesPrice:u.yes_price,noPrice:u.no_price,totalVolume:u.volume})),maxVolume:ie,onJumpToTower:u=>{var p;(p=k.current)==null||p.scrollTo({top:0,behavior:"smooth"})},onScrollToTop:()=>{var u;(u=k.current)==null||u.scrollTo({top:0,behavior:"smooth"})}})]})},Os=()=>e.jsxs(gt,{noPadding:!0,hideFooter:!0,children:[e.jsxs(ft,{children:[e.jsx("title",{children:"PolyTown - Live Animated City of Polymarket Traders"}),e.jsx("meta",{name:"description",content:"Watch the top Polymarket markets come alive as a South Park-style animated city. See traders as cartoon characters with positions, PnL, and rank badges."})]}),e.jsxs("div",{className:"flex-1 overflow-visible relative",children:[e.jsx("h1",{className:"sr-only",children:"PolyTown â Live Animated 3D City of Polymarket Traders"}),e.jsx(Jt,{})]})]});export{Os 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.