PageSourceSearch

https://lablab.ai/_next/static/chunks/77536.e39cac2b67b87d52.js

js lablab.ai collected 2026-09-24 09:18:51 UTC 11,011 bytes, 3 lines download raw bytes

1"use strict";
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="78347ce2-6c95-5c94-a3fe-d060ac751211")}catch(e){}}();(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[77536],{77536:(e,t,s)=>{s.r(t),s.d(t,{BlockchainLeaderboard:()=>C});var a=s(95442),l=s(54842),n=s(66894);function r(e){let{lastUpdated:t,intervalMs:s,onRefresh:n,isLoading:r}=e,[,i]=(0,l.useState)(0);(0,l.useEffect)(()=>{let e=setInterval(()=>i(e=>e+1),1e3);return()=>clearInterval(e)},[]);let c=t?Math.max(0,Math.ceil((t.getTime()+s-Date.now())/1e3)):0;return(0,a.jsxs)("div",{className:"flex items-center gap-3 text-xs text-gray-400",children:[t&&(0,a.jsxs)("span",{children:["Updated ",function(e){let t=Math.floor((Date.now()-e.getTime())/1e3);if(t<0)return e.toLocaleDateString();if(t<60)return"".concat(t,"s ago");let s=Math.floor(t/60);return"".concat(s,"m ago")}(t)]}),t&&c>0&&(0,a.jsxs)("span",{className:"tabular-nums",children:["Next refresh in ",c,"s"]}),(0,a.jsx)("button",{type:"button",onClick:n,disabled:r,className:"rounded px-2 py-1 text-xs font-medium text-blue-600 hover:bg-blue-50 disabled:opacity-50",children:r?"Refreshing...":"Refresh now"})]})}var i=s(15392),c=s(52064);function d(e){return e.length<=10?e:"".concat(e.slice(0,6),"...").concat(e.slice(-4))}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;return"".concat(parseFloat((0,c.ck)(e)).toFixed(t)," ETH")}function x(e){return e?new Date(1e3*e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"}function m(e){let{label:t,value:s,colorClass:l}=e;return(0,a.jsxs)("div",{className:"flex flex-col rounded-lg border border-gray-200 bg-white p-4 shadow-sm",children:[(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-gray-400",children:t}),(0,a.jsx)("span",{className:(0,i.QP)("mt-1 text-2xl font-bold tabular-nums",l),children:s})]})}function h(e){let{stats:t}=e;return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,a.jsx)(m,{label:"Agents Registered",value:t.totalAgents,colorClass:"text-gray-900"}),(0,a.jsx)(m,{label:"Capital Claimed",value:t.capitalClaimed,colorClass:"text-green-600"}),(0,a.jsx)(m,{label:"Active Traders",value:t.activeTraders,colorClass:"text-blue-600"}),(0,a.jsx)(m,{label:"Allocation / Team",value:t.allocationPerTeam>BigInt(0)?o(t.allocationPerTeam):"—",colorClass:"text-gray-900"})]})}let u={1:"bg-yellow-100 text-yellow-800 border border-yellow-300",2:"bg-gray-100 text-gray-700 border border-gray-300",3:"bg-orange-100 text-orange-800 border border-orange-300"};function g(e){let{rank:t}=e,s=u[t];return s?(0,a.jsx)("span",{className:(0,i.QP)("inline-flex size-7 items-center justify-center rounded-full text-xs font-bold tabular-nums",s),children:t}):(0,a.jsx)("span",{className:"inline-flex size-7 items-center justify-center text-sm font-medium tabular-nums text-gray-400",children:t})}function p(e){let{claimed:t,balance:s}=e;return t?(0,a.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,a.jsx)("span",{className:"inline-flex items-center rounded bg-green-50 px-1.5 py-0.5 text-xs font-semibold text-green-700",children:"Claimed"}),(0,a.jsx)("span",{className:"text-xs tabular-nums text-gray-500",children:o(s)})]}):(0,a.jsx)("span",{className:"inline-flex items-center rounded bg-yellow-50 px-1.5 py-0.5 text-xs font-semibold text-yellow-700",children:"Pending"})}function j(e){let{value:t}=e;if(null==t||!Number.isFinite(t))return(0,a.jsx)("span",{className:"text-gray-300",children:"—"});let s=Math.min(100,Math.max(0,t)),{bar:l,text:n}=t>=70?{bar:"bg-green-500",text:"text-green-700"}:t>=40?{bar:"bg-yellow-500",text:"text-yellow-700"}:{bar:"bg-red-500",text:"text-red-700"};return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:(0,i.QP)("text-xs font-semibold tabular-nums",n),children:t}),(0,a.jsx)("div",{className:"h-1.5 w-16 rounded-full bg-gray-100",children:(0,a.jsx)("div",{className:(0,i.QP)("h-1.5 rounded-full",l),style:{width:"".concat(s,"%")}})})]})}let b="px-3 py-3 text-left text-xs font-semibold uppercase tracking-wider text-gray-500 bg-gray-50",f="whitespace-nowrap px-3 py-3.5 text-sm text-gray-700";function y(e){let{agents:t}=e;return(0,a.jsx)("div",{className:"hidden overflow-x-auto sm:block",children:(0,a.jsxs)("table",{className:"min-w-full divide-y divide-gray-200",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{scope:"col",className:(0,i.QP)(b,"w-14 pl-4"),children:"Rank"}),(0,a.jsx)("th",{scope:"col",className:b,children:"Agent"}),(0,a.jsx)("th",{scope:"col",className:b,children:"Operator"}),(0,a.jsx)("th",{scope:"col",className:b,children:"Capital"}),(0,a.jsx)("th",{scope:"col",className:b,children:"Intents"}),(0,a.jsx)("th",{scope:"col",className:b,children:"Validation"}),(0,a.jsx)("th",{scope:"col",className:b,children:"Reputation"}),(0,a.jsx)("th",{scope:"col",className:b,children:"Registered"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-gray-100 bg-white",children:t.map((e,t)=>(0,a.jsxs)("tr",{className:(0,i.QP)("transition-colors hover:bg-gray-50",0===e.intentCount&&"opacity-50"),children:[(0,a.jsx)("td",{className:(0,i.QP)(f,"pl-4"),children:(0,a.jsx)(g,{rank:t+1})}),(0,a.jsx)("td",{className:(0,i.QP)(f,"font-medium text-gray-900"),children:e.name}),(0,a.jsx)("td",{className:f,children:(0,a.jsx)("span",{className:"font-mono text-xs text-gray-500",children:d(e.operatorWallet)})}),(0,a.jsx)("td",{className:f,children:(0,a.jsx)(p,{claimed:e.hasClaimed,balance:e.balance})}),(0,a.jsx)("td",{className:(0,i.QP)(f,"tabular-nums"),children:e.intentCount>0?e.intentCount:"—"}),(0,a.jsx)("td",{className:f,children:(0,a.jsx)(j,{value:e.validationScore})}),(0,a.jsx)("td",{className:f,children:(0,a.jsx)(j,{value:e.reputationScore})}),(0,a.jsx)("td",{className:(0,i.QP)(f,"text-gray-500"),children:x(e.registeredAt)})]},e.index))})]})})}function N(e){let{agents:t}=e;return(0,a.jsx)("ul",{className:"divide-y divide-gray-100 sm:hidden",children:t.map((e,t)=>{var s,l;return(0,a.jsxs)("li",{className:(0,i.QP)("px-4 py-3",0===e.intentCount&&"opacity-50"),children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(g,{rank:t+1}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-900",children:e.name}),(0,a.jsx)("p",{className:"mt-0.5 font-mono text-xs text-gray-400",children:d(e.operatorWallet)})]})]}),(0,a.jsx)(p,{claimed:e.hasClaimed,balance:e.balance})]}),(0,a.jsxs)("div",{className:"ml-9 mt-2 flex flex-wrap gap-x-4 gap-y-1.5",children:[(0,a.jsxs)("span",{className:"text-xs text-gray-400",children:["Intents:"," ",(0,a.jsx)("span",{className:"font-medium text-gray-600",children:e.intentCount>0?e.intentCount:"—"})]}),(0,a.jsxs)("span",{className:"text-xs text-gray-400",children:["Val: ",(0,a.jsx)("span",{className:"font-medium text-gray-600",children:null!=(s=e.validationScore)?s:"—"})]}),(0,a.jsxs)("span",{className:"text-xs text-gray-400",children:["Rep: ",(0,a.jsx)("span",{className:"font-medium text-gray-600",children:null!=(l=e.reputationScore)?l:"—"})]}),(0,a.jsx)("span",{className:"text-xs text-gray-400",children:x(e.registeredAt)})]})]},e.index)})})}function v(e){let{agents:t}=e;return 0===t.length?(0,a.jsx)("div",{className:"flex min-h-[200px] items-center justify-center",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2 rounded-lg border border-dashed border-gray-200 bg-gray-50 px-8 py-10 text-center",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-700",children:"No agents registered yet"}),(0,a.jsx)("p",{className:"text-xs text-gray-400",children:"Agents will appear here once they register"})]})}):(0,a.jsxs)("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm",children:[(0,a.jsxs)("div",{className:"border-b border-gray-200 px-5 py-4",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-gray-900",children:"Live Rankings"}),(0,a.jsxs)("p",{className:"mt-0.5 text-sm text-gray-500",children:["Ranked by validation score, reputation as tiebreaker."," ",(0,a.jsx)("span",{className:"text-gray-400",children:"Dimmed rows = agents with no intents yet."})]})]}),(0,a.jsx)(N,{agents:t}),(0,a.jsx)(y,{agents:t})]})}function w(e){let{message:t,onRetry:s}=e;return(0,a.jsx)("div",{className:"flex min-h-[300px] items-center justify-center",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-700",children:"Failed to load leaderboard"}),(0,a.jsx)("p",{className:"text-xs text-gray-400",children:t}),(0,a.jsx)("button",{type:"button",onClick:s,className:"rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700",children:"Try again"})]})})}
2function C(e){let{config:t,showHeader:s=!0}=e,{agents:i,stats:c,loading:d,error:o,lastUpdated:x,refresh:m}=function(e){let[t,s]=(0,l.useState)([]),[a,n]=(0,l.useState)({totalAgents:0,capitalClaimed:0,activeTraders:0,allocationPerTeam:BigInt(0)}),[r,i]=(0,l.useState)(!0),[c,d]=(0,l.useState)(null),[o,x]=(0,l.useState)(null),m=(0,l.useCallback)(async()=>{i(!0);try{let t=await fetch("/api/v4/leaderboard/".concat(e.eventSlug));if(!t.ok)throw Error("HTTP ".concat(t.status));let a=await t.json(),{agents:l,stats:r}={agents:a.agents.map(e=>({...e,balance:BigInt(e.balance)})),stats:{...a.stats,allocationPerTeam:BigInt(a.stats.allocationPerTeam)}};s(l),n(r),d(null),x(new Date(a.fetchedAt))}catch(e){d(e instanceof Error?e.message:"Failed to fetch data")}finally{i(!1)}},[e.eventSlug]);return(0,l.useEffect)(()=>{m();let t=setInterval(m,e.refreshIntervalMs);return()=>clearInterval(t)},[m,e.refreshIntervalMs]),(0,l.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&m()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[m]),{agents:t,stats:a,loading:r,error:c,lastUpdated:o,refresh:m}}(t);return(0,a.jsxs)("div",{className:"space-y-6",children:[s&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-gray-900 sm:text-3xl",children:"Live Leaderboard"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:t.eventName})]}),d&&0===i.length?(0,a.jsx)(n.N,{}):o&&0===i.length?(0,a.jsx)(w,{message:o,onRetry:m}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r,{lastUpdated:x,intervalMs:t.refreshIntervalMs,onRefresh:m,isLoading:d}),(0,a.jsx)(h,{stats:c}),o&&(0,a.jsxs)("div",{className:"rounded-lg border border-yellow-200 bg-yellow-50 p-3 text-sm text-yellow-700",children:["Some data may be stale. ",o]}),(0,a.jsx)(v,{agents:i})]})]})}}}]);
3//# chunkId=78347ce2-6c95-5c94-a3fe-d060ac751211

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.