tokentracker-cli 0.79.2 → 0.79.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dashboard/dist/assets/{AchievementBadge-DcDkcyk4.js → AchievementBadge-wQQwzQYv.js} +1 -1
- package/dashboard/dist/assets/AchievementsPage-rBd_ycOo.js +2 -0
- package/dashboard/dist/assets/{AchievementsSection-Cj13lk07.js → AchievementsSection-Cwgr4N8D.js} +1 -1
- package/dashboard/dist/assets/BadgeDetailModal-bKdQ_Pls.js +1 -0
- package/dashboard/dist/assets/{Card-DT8qXml-.js → Card-DKUa4bFg.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-BzsZjNGN.js → ClawdAnimated-DaG3163q.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-Byx0RRzc.js → CommunityStatsModal-BrlwrUmW.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-oyMOnK7G.js → ConfirmModal-CIujdHbF.js} +1 -1
- package/dashboard/dist/assets/{Controls-PMRhKPF-.js → Controls-Dzx021Tf.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-DgTwlptV.js +19 -0
- package/dashboard/dist/assets/{DevicePage-CGLIyRA8.js → DevicePage-BycFzKD5.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-zLe-zrd-.js → DialogClose-ucUXpI-0.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-CIldLoYo.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-hGgP0eky.js → DialogTitle-B-NMBFgN.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-DeoGuCrV.js → FadeIn-DR-LZSMh.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-CSZ0XQLV.js → HeaderGithubStar-C6oriixE.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-CJlsBtiO.js → IpCheckPage-I6ebSTLU.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-CK-aWD2Y.js → LandingPage-BARuXijI.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-hrfyPkYI.js → LeaderboardAvatar-BP9WMoUP.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-BTL-rN1o.js +2 -0
- package/dashboard/dist/assets/LeaderboardProfileModal-BeHrOZex.js +73 -0
- package/dashboard/dist/assets/{LeaderboardProfilePage-CXyrCZiT.js → LeaderboardProfilePage-D2YPwVju.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-Ck_M1OHJ.js → LimitsPage-D_31y9iz.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-BzI7RWAf.js → LocalOnlyNotice-Bsme9V7_.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-BUm6w7Np.js → LoginPage-ChdsOwnZ.js} +1 -1
- package/dashboard/dist/assets/{PetPage-DtAyFM55.js → PetPage-DHZP64Lh.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-BlkcABOL.js → PopoverPopup-1Apd7Z6A.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-CBSVeUPI.js → ResetPasswordPage-GchnBNwn.js} +1 -1
- package/dashboard/dist/assets/{Select-BJhSVz1k.js → Select-BBR4yWcP.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-B9zmI-iv.js → SelectItemText-GIvwOKIn.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-DviHKn3P.js → SettingsPage-CbDU59OB.js} +1 -1
- package/dashboard/dist/assets/{SkillsPage-B79FutnV.js → SkillsPage-C3caxrhI.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-AwJIXxE9.js → WidgetsPage-wYGZUIP8.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-CTJB07D4.js → WrappedPage-D9WkTJww.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-BPUbc3yd.js → agent-logos-z6m7ILhw.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-CZZ-UM4M.js → arrow-up-right-BGl1XMiR.js} +1 -1
- package/dashboard/dist/assets/check-Bj3UnGFX.js +1 -0
- package/dashboard/dist/assets/{copy-BGaQZ7P5.js → copy-DoCkcIHR.js} +1 -1
- package/dashboard/dist/assets/{download-BKHLHuIT.js → download-C8qHTN6n.js} +1 -1
- package/dashboard/dist/assets/{flame-sZg_y2Ct.js → flame-B27yR7Au.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-Ck8WH-5G.js → format-tokens-B8_mvUxn.js} +1 -1
- package/dashboard/dist/assets/{info-wPFCesi6.js → info-BpTZWFEB.js} +1 -1
- package/dashboard/dist/assets/{link-2-u9AJ19mI.js → link-2-DDjliaUB.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-B_RhUksQ.js → loader-circle-DkNHiiwy.js} +1 -1
- package/dashboard/dist/assets/main-C6V_dFqw.css +1 -0
- package/dashboard/dist/assets/{main-rco_Tu2D.js → main-CvkyGV2H.js} +9 -8
- package/dashboard/dist/assets/{ActivityHeatmap-BCBaXKEP.js → provider-display-CPhtfhmX.js} +2 -2
- package/dashboard/dist/assets/{trash-2-BWfZEWVm.js → trash-2-CVIlLnop.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-C_l8jtn9.js → use-community-stats-C8PN46hK.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CDMXqVgA.js → use-limits-display-prefs-D7vWwHbD.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-Bgi3a5uc.js → use-native-settings-Bh4ls-JF.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-DbLNv_Fs.js → use-ordered-list-BHptHQDT.js} +1 -1
- package/dashboard/dist/assets/{use-quality-per-dollar-pref-ByfXALmd.js → use-quality-per-dollar-pref-C3EXtrc1.js} +1 -1
- package/dashboard/dist/assets/{use-transform-h2Jds0kA.js → use-transform-BW36bKb3.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-Dg7aMrVT.js → use-usage-limits-BY-RA1uz.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-x0Nv5rZP.js → useCurrency-nB0kdYwU.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-DGfYuwgo.js → useScrollLock-juP-sEAK.js} +1 -1
- package/dashboard/dist/assets/{zap-BQ6Eilqi.js → zap-Blccuc-z.js} +1 -1
- package/dashboard/dist/brand-logos/anythingllm.svg +9 -0
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +2 -2
- package/src/commands/init.js +14 -0
- package/src/commands/status.js +13 -0
- package/src/commands/sync.js +24 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +288 -0
- package/dashboard/dist/assets/AchievementsPage-CV3Bwdzf.js +0 -2
- package/dashboard/dist/assets/BadgeDetailModal-DCOLG1fl.js +0 -1
- package/dashboard/dist/assets/DashboardPage-1aUdHjJF.js +0 -19
- package/dashboard/dist/assets/DialogDescription-DT5tiXAh.js +0 -1
- package/dashboard/dist/assets/LeaderboardPage-CsMfaxrd.js +0 -2
- package/dashboard/dist/assets/LeaderboardProfileModal-C7mhM6ih.js +0 -73
- package/dashboard/dist/assets/check-DZawOdAk.js +0 -1
- package/dashboard/dist/assets/main-KK0yAXww.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as n,b7 as a}from"./main-rco_Tu2D.js";import{u as p}from"./DialogTitle-hGgP0eky.js";import{u as c}from"./useScrollLock-DGfYuwgo.js";const x=n.forwardRef(function(e,r){const{render:l,className:u,style:m,id:s,...t}=e,{store:i}=p(),o=c(s);return i.useSyncedValueWithCleanup("descriptionElementId",o),a("p",e,{ref:r,props:[{id:o},t]})});export{x as D};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-C7mhM6ih.js","assets/main-rco_Tu2D.js","assets/main-KK0yAXww.css","assets/useCurrency-x0Nv5rZP.js","assets/LeaderboardAvatar-hrfyPkYI.js","assets/ActivityHeatmap-BCBaXKEP.js","assets/info-wPFCesi6.js","assets/AchievementBadge-DcDkcyk4.js","assets/zap-BQ6Eilqi.js","assets/flame-sZg_y2Ct.js","assets/AchievementsSection-Cj13lk07.js","assets/format-tokens-Ck8WH-5G.js","assets/arrow-up-right-CZZ-UM4M.js","assets/link-2-u9AJ19mI.js","assets/check-DZawOdAk.js","assets/DialogTitle-hGgP0eky.js","assets/useScrollLock-DGfYuwgo.js","assets/CommunityStatsModal-Byx0RRzc.js","assets/DialogClose-zLe-zrd-.js","assets/DialogDescription-DT5tiXAh.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as da,j as e,R as ca,E as o,P as d,r as l,as as ua,at as ma,Z as xa,_ as ga,au as ba,a as pa,b as ha,av as ya,aw as fa,ax as re,a6 as ka,ay as wa,m as va,S as ja,L as Na,H as _a,Q as Be,F as Sa,az as Ca,aA as La,aB as Le,aC as Aa,a4 as Ue,I as Ma}from"./main-rco_Tu2D.js";import{S as Pa}from"./Select-BJhSVz1k.js";import{a as Ea,C as Ka,u as Ta,b as Ia,c as Ae,D as Ra,d as za,S as Ba,h as Ua,s as $a,K as Oa,P as Da}from"./use-ordered-list-DbLNv_Fs.js";import{u as Fa}from"./useCurrency-x0Nv5rZP.js";import{L as te}from"./LeaderboardAvatar-hrfyPkYI.js";import{s as Ga,a as Ya,A as Ha,t as Wa,b as Va}from"./AchievementBadge-DcDkcyk4.js";import{u as Za}from"./use-community-stats-C_l8jtn9.js";import"./SelectItemText-B9zmI-iv.js";import"./useScrollLock-DGfYuwgo.js";import"./check-DZawOdAk.js";import"./zap-BQ6Eilqi.js";import"./flame-sZg_y2Ct.js";const Ja=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],qa=da("arrow-right",Ja),Qa=a=>{let{transform:t}=a;return{...t,y:0}};function D(a,{min:t,max:s,fallback:n}){const c=Number(a);if(!Number.isFinite(c))return n;const i=Math.floor(c);return i<t?t:i>s?s:i}function Xa(a,t){const s=D(t,{min:0,max:1e6,fallback:0}),n=D(a,{min:1,max:Math.max(1,s||1),fallback:1});if(s<=1)return[1];const c=new Set([1,s,n-2,n-1,n,n+1,n+2]),i=Array.from(c).filter(m=>Number.isInteger(m)&&m>=1&&m<=s).sort((m,h)=>m-h),g=[];let p=null;for(const m of i)p!=null&&m-p>1&&g.push(null),g.push(m),p=m;return g}function er({page:a,totalPages:t}){const s=typeof t=="number"&&Number.isFinite(t)&&t>=0,n=s?D(t,{min:0,max:1e6,fallback:0}):null,c=D(a,{min:1,max:s?Math.max(1,n||1):1e6,fallback:1}),i=c>1,g=s?c<n:!0;return{canPrev:i,canNext:g,safePage:c,safeTotal:n}}function ar({entries:a,me:t,meLabel:s}){const n=Array.isArray(a)?a:[],c=t&&typeof t.rank=="number"?t.rank:null;return!c||n.some(g=>!!g?.is_me)?n:[{rank:c,is_me:!0,is_pinned:!0,user_id:t?.user_id??null,display_name:s,avatar_url:t?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:t?.gpt_tokens??"0",claude_tokens:t?.claude_tokens??"0",gemini_tokens:t?.gemini_tokens??"0",cursor_tokens:t?.cursor_tokens??"0",opencode_tokens:t?.opencode_tokens??"0",openclaw_tokens:t?.openclaw_tokens??"0",hermes_tokens:t?.hermes_tokens??"0",kiro_tokens:t?.kiro_tokens??"0",copilot_tokens:t?.copilot_tokens??"0",kimi_tokens:t?.kimi_tokens??"0",other_tokens:t?.other_tokens??"0",total_tokens:t?.total_tokens??"0",estimated_cost_usd:t?.estimated_cost_usd??null,badges:Array.isArray(t?.badges)?t.badges:[]},...n]}function rr(a,t){const s=Number(a),n=Number(t);return!Number.isFinite(s)||s<1||!Number.isFinite(n)||n<1?null:Math.ceil(s/n)}const tr=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function or({iconSrc:a,label:t}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${tr.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:t})]})}const Me=ca.memo(function({badges:t,max:s=3,className:n=""}){const c=Ga((t||[]).filter(i=>i&&Ya.has(i.id)&&(i.tier||0)>=1)).slice(0,s);return c.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${n}`,children:c.map((i,g)=>e.jsx("span",{title:o("achievements.mini.tooltip",{name:o(Va(i.id,"name")),tier:o(`achievements.tier.${Wa(i.tier)}`)}),style:{zIndex:c.length-g},className:`pointer-events-auto relative inline-flex ${g>0?"-ml-1.5":""}`,children:e.jsx(Ha,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),V=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],$e="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",Oe="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function oe(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function se(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function j({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function sr({index:a}){const t=a<3?"w-24":a<8?"w-20":"w-16",s=a<3?"w-16":"w-12",n=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(oe(!1),"!group-hover:bg-transparent"),children:e.jsx(j,{className:"h-4 w-6"})}),e.jsx("td",{className:d(se(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(j,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(j,{className:d("h-4",t)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",s)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:"h-4 w-12"})}),V.map(c=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",n)})},c.key))]})}function nr({rows:a=10}){return e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d($e,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(Oe,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-14"})}),V.map(t=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-12"})},t.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(t,s)=>e.jsx(sr,{index:s},s))})]})})}function ir({id:a,thClassName:t,children:s}){const{attributes:n,listeners:c,setNodeRef:i,transform:g,transition:p,isDragging:m}=Ea({id:a}),h=Ka.Transform.toString(g)||"";l.useLayoutEffect(()=>{const y=document.querySelectorAll(`td[data-column-key="${a}"]`),f="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return y.forEach(x=>{x.style.transform=h,x.style.transition=p||"",x.style.zIndex=m?"20":"",x.style.position=h?"relative":"",x.style.boxShadow=m?f:""}),()=>{y.forEach(x=>{x.style.transform="",x.style.transition="",x.style.zIndex="",x.style.position="",x.style.boxShadow=""})}},[a,h,p,m]);const L={transform:h,transition:p,position:h?"relative":void 0,zIndex:m?20:void 0,boxShadow:m?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:i,style:L,className:d(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...c,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",m&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),s]})})}const lr="tokentracker.leaderboard.columnOrder.v1";function dr(a){return Ta(lr,a)}const cr=50;function ur(a,t){const s=Number(a),n=Number(t);return!Number.isFinite(s)||s<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(s/n*100)))}function De(a){return typeof a=="string"?a.trim():""}function mr(a){const t=De(a);return t?t.toLowerCase()==="anonymous":!0}function xr({me:a,totalEntries:t,meLabel:s,onOpenProfile:n,onJumpToMe:c,canJump:i,className:g}){const p=a&&typeof a.rank=="number"?a.rank:null;if(!p)return null;const m=Number(t)||0,h=ur(p,m),L=De(a?.display_name),y=!L||mr(L)?s||"You":L,f=a?.user_id||y,x=n||(i?c:null),P=typeof x=="function",E=P?"button":"div",Z=P?{type:"button",onClick:x,"aria-label":o(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(E,{...Z,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",P?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",g),children:[e.jsx(te,{size:"sm",avatarUrl:a?.avatar_url,displayName:y,seed:f}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:y}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",p.toLocaleString()]}),h!=null&&h<=cr&&e.jsx("span",{className:d("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",h<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:o("leaderboard.summary.percentile",{p:String(h)})}),P?e.jsx(qa,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const gr=l.lazy(()=>Ue(()=>import("./LeaderboardProfileModal-C7mhM6ih.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])).then(a=>({default:a.LeaderboardProfileModal}))),br=l.lazy(()=>Ue(()=>import("./CommunityStatsModal-Byx0RRzc.js"),__vite__mapDeps([17,1,2,11,15,16,18,19])).then(a=>({default:a.CommunityStatsModal}))),ne=[10,20,50,100],ie=20,Fe="tokentracker:leaderboard:pageSize";function pr(){if(typeof window>"u")return ie;try{const a=window.localStorage.getItem(Fe),t=Number(a);if(ne.includes(t))return t}catch{}return ie}function Pe(a,t,s){const n=Number(a);if(!Number.isFinite(n)||n<=0)return"-";const c=Sa(t),i=t===Ma?n:n*s;return i>=1e3?`${c}${Math.round(i).toLocaleString()}`:i>=10?`${c}${Math.round(i)}`:`${c}${i.toFixed(2)}`}function Ee({value:a}){return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:_a(a)}),e.jsx("span",{className:"hidden sm:inline",children:Be(a)})]})}function hr({communityStats:a,onClick:t}){return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:t,className:"inline-flex h-9 items-center gap-2.5 rounded-full border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md px-3.5 select-none text-xs text-oai-gray-500 dark:text-oai-gray-400 hover:border-oai-brand-400 dark:hover:border-oai-brand-500/80 hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 transition-all duration-300 active:scale-[0.97] cursor-pointer",title:o("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:Math.round(a.tokenFloor).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:o("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:(Number(a.totalEntries)||0).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:o("leaderboard.community.devs_chip")})]})]})}function Ke(a,t,s){const n=t?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",c=t?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60";return s.map(i=>e.jsx("td",{"data-column-key":i.key,className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",n,c),children:Be(a?.[i.key])},i.key))}const yr={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function Te({rank:a,placeholder:t}){const s=yr[a];return s?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",s.text,s.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??t})}function Ie(a){if(typeof a!="string")return null;const t=a.trim().toLowerCase();return t==="week"||t==="month"||t==="total"?t:null}function fr(a){if(!a)return o("shared.error.prefix",{error:o("leaderboard.error.unknown")});const t=a?.message||String(a),s=String(t||"").trim()||o("leaderboard.error.unknown");return o("shared.error.prefix",{error:s})}function Ge(a){return typeof a!="string"?"":a.trim()}function kr(a){const t=Ge(a);return t?t.toLowerCase()==="anonymous":!0}function Re(a,t){const s=typeof a?.user_id=="string"?a.user_id.trim():"";return s||`${a?.rank??""}:${t}`}function ze({githubUrl:a}){return e.jsxs("span",{className:"absolute left-1/2 top-full -translate-x-1/2 -translate-y-1/2 inline-flex group/gh",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:t=>t.stopPropagation(),"aria-label":o("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(ja,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:o("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[o("leaderboard.github.tooltipPrefix")," ",e.jsx(Na,{to:"/settings",onClick:t=>t.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:o("leaderboard.github.tooltipSettingsLink")})," ",o("leaderboard.github.tooltipSuffix")]})]})]})}function Ir({auth:a,signedIn:t,sessionSoftExpired:s}){const n=ua(),c=ma(),{openLoginModal:i}=xa(),{signedIn:g,loading:p,user:m}=ga(),{currency:h,rate:L}=Fa(),y=l.useMemo(()=>ba(),[]),f=pa(),x=t&&!s,P=l.useMemo(()=>x&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,x]),E=x?P:null,Z=x&&ha(E),le=o("shared.placeholder.short"),Ye=l.useMemo(()=>V.map(r=>r.key),[]),{order:J,reorder:de}=dr(Ye),ce=l.useMemo(()=>{const r=new Map;for(const u of V)r.set(u.key,u);return r},[]),F=l.useMemo(()=>J.map(r=>ce.get(r)).filter(Boolean),[J,ce]),He=Ia(Ae(Da,{activationConstraint:{distance:6}}),Ae(Oa,{coordinateGetter:$a})),We=l.useCallback(r=>{const{active:u,over:w}=r;!w||u.id===w.id||de(String(u.id),String(w.id))},[de]),[q,A]=l.useState(1),[N,Ve]=l.useState(pr),[ue,me]=l.useState(null),[Ze,xe]=l.useState(!1),Q=l.useCallback(r=>{typeof r=="string"&&r.trim()&&me(r.trim())},[]),Je=l.useCallback(()=>me(null),[]),qe=l.useCallback(r=>{const u=ne.includes(r)?r:ie;Ve(u),A(1);try{window.localStorage.setItem(Fe,String(u))}catch{}},[]),[ge,Qe]=l.useState(0),[Xe,ea]=l.useState(()=>ya()),[be,pe]=l.useState(!1),v=l.useMemo(()=>{const r=new URLSearchParams(n?.search||"");return Ie(r.get("period"))||"total"},[n?.search]),aa=r=>{const u=Ie(r);if(!u||u===v)return;const w=new URLSearchParams(n?.search||"");w.set("period",u),A(1),c(`${n?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};l.useEffect(()=>{p||f||g||i()},[g,p,f,i]),l.useEffect(()=>{A(1)},[v]);const G=l.useMemo(()=>(D(q,{min:1,max:1e6,fallback:1})-1)*N,[q,N]),K=l.useMemo(()=>f?"mock":p?"unavailable":g?"cloud":t?"local":y?"public":"unavailable",[p,g,y,f,t]),b=l.useMemo(()=>fa({accessMode:K,baseUrl:y,mockEnabled:f,userId:m?.id||null,period:v,pageSize:N,offset:G}),[m?.id,K,y,G,f,N,v]),[z,B]=l.useState(()=>{const r=re(b);return r?{loading:!1,error:null,data:r.data,contextKey:b}:{loading:!1,error:null,data:null,contextKey:null}});l.useEffect(()=>{if(!y&&!f||!f&&K==="unavailable"){B({loading:!1,error:null,data:null,contextKey:null});return}const r=re(b);let u=!0;return B(r?{loading:!1,error:null,data:r.data,contextKey:b}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await ka({userId:m?.id||null,period:v,limit:N,offset:G});u&&(wa(w,{activeContextKey:b,contextKey:b,source:ge>0?"manual-refresh":"page-load"}),B({loading:!1,error:null,data:w,contextKey:b}))})().catch(w=>{if(!u)return;const R=fr(w);B($=>$.contextKey===b?{...$,loading:!1,error:R}:{loading:!1,error:R,data:null,contextKey:b})}),()=>{u=!1}},[y,K,m?.id,b,G,ge,f,v,N]);const X=l.useMemo(()=>z.contextKey===b?null:re(b),[b,z.contextKey]),k=l.useMemo(()=>z.contextKey===b?z:X?{loading:!1,error:null,data:X.data,contextKey:b}:{loading:!!(y||f)&&K!=="unavailable",error:null,data:null,contextKey:b},[K,y,b,z,f,X]),_=k.data,Y=_?.total_pages??null,ra=_?.total_entries??0,T=_?.page??q,ta=l.useMemo(()=>Xa(T,Y),[T,Y]),he=_?.from||null,ye=_?.to||null,fe=_?.generated_at||null,ke=Za(),M=_?.me||null,H=o("leaderboard.me_label"),oa=o("leaderboard.anon_label"),we=o("leaderboard.period.week"),ve=o("leaderboard.period.month"),je=o("leaderboard.period.total"),Ne=v==="month"?ve:v==="total"?je:we,ee=l.useMemo(()=>{const r=Array.isArray(_?.entries)?_.entries:[];return ar({entries:r,me:M,meLabel:H})},[_?.entries,M,H]),I=l.useMemo(()=>rr(M?.rank,N),[M?.rank,N]),sa=I!=null&&I===T,na=l.useCallback(()=>{I!=null&&A(I)},[I]),ia=async()=>{pe(!0);try{Ca(!0),ea(!0),await La(()=>Le(E));const r=await Le(E);r&&await Aa({accessToken:r,period:v,source:"leaderboard-enable-sync"}),Qe(u=>u+1)}catch(r){console.warn("[tokentracker] sync:",r)}finally{pe(!1)}},{canPrev:_e,canNext:Se}=er({page:T,totalPages:Y}),W=Array.isArray(ee)&&ee.length!==0;let U=null;k.loading&&!W?U=e.jsx(nr,{rows:N}):k.error&&!W?U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:k.error})}):W?U=e.jsx(Ra,{sensors:He,collisionDetection:za,modifiers:[Qa],onDragEnd:We,children:e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-full sm:min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d($e,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:o("leaderboard.column.rank")}),e.jsx("th",{className:d(Oe,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:o("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:o("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:o("leaderboard.column.est_cost")}),e.jsx(Ba,{items:J,strategy:Ua,children:F.map(r=>e.jsx(ir,{id:r.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(or,{iconSrc:r.icon,label:o(r.copyKey)})},r.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:ee.map((r,u)=>{if(r?.is_ellipsis){const C=4+F.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:C,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${u}`)}const w=!!r?.is_me,R=typeof r?.user_id=="string"?r.user_id:null,$=Ge(r?.display_name),la=kr($)?oa:$,S=w?H:la,O=!!R,Ce=O?{role:"button",tabIndex:0,onClick:O?()=>Q(R):void 0,onKeyDown:O?C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),Q(R))}:void 0,"aria-label":o("leaderboard.profile_modal.row_aria",{name:S})}:{};if(w){const C=!!r?.is_pinned;return e.jsxs("tr",{...Ce,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",C?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",O&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(oe(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",C&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx(Te,{rank:r?.rank,placeholder:le})}),e.jsx("td",{className:se(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",r?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",r?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(te,{avatarUrl:r?.avatar_url,displayName:S,seed:Re(r,S)})}),r?.github_url&&e.jsx(ze,{githubUrl:r.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:S}),e.jsx(Me,{badges:r?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(Ee,{value:r?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:Pe(r?.estimated_cost_usd,h,L)}),Ke(r,!0,F)]},`row-${r?.rank}-${S}${C?"-pin":""}`)}return e.jsxs("tr",{...Ce,className:d("group transition-colors",O&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(oe(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(Te,{rank:r?.rank,placeholder:le})}),e.jsx("td",{className:se(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",r?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",r?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(te,{avatarUrl:r?.avatar_url,displayName:S,seed:Re(r,S)})}),r?.github_url&&e.jsx(ze,{githubUrl:r.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:S}),e.jsx(Me,{badges:r?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(Ee,{value:r?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:Pe(r?.estimated_cost_usd,h,L)}),Ke(r,!1,F)]},`row-${r?.rank}-${S}`)})})]})})}):U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:o("leaderboard.empty")})});let ae=null;return typeof Y=="number"?ae=ta.map((r,u)=>r==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:o("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",r===T?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>A(r),disabled:k.loading,children:String(r)},`page-${r}`)):ae=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:o("leaderboard.pagination.page_unknown",{page:String(T)})}),e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-5 sm:mb-6",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-2 sm:mb-3",children:o("leaderboard.title")}),e.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[v==="total"?o("leaderboard.range.total"):he&&ye?o("leaderboard.range",{period:Ne,from:he,to:ye}):o("leaderboard.range_loading",{period:Ne}),fe&&e.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 hidden sm:inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:o("leaderboard.generated_at",{ts:fe})})]})]}),e.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsx("div",{className:"inline-flex h-9 p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-full items-center relative self-start",children:["week","month","total"].map(r=>{const u=v===r;return e.jsxs("button",{onClick:()=>aa(r),disabled:k.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:r==="week"?we:r==="month"?ve:je}),u&&e.jsx(va.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},r)})}),e.jsxs("div",{className:"flex flex-row items-center gap-2.5 self-end sm:self-auto shrink-0 flex-wrap",children:[e.jsx(hr,{communityStats:ke,onClick:()=>xe(!0)}),e.jsx(xr,{me:M,totalEntries:ra,meLabel:H,onOpenProfile:M?.user_id?()=>Q(M.user_id):void 0,onJumpToMe:na,canJump:I!=null&&!sa&&!k.loading,className:"shrink-0"})]})]}),!t&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:o("leaderboard.signin_prompt")}),e.jsx("button",{onClick:i,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:o("leaderboard.signin_button")})]}),x&&Z&&!Xe&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:o("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ia,disabled:be,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:be?o("leaderboard.sync_button.busy"):o("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[k.error&&W?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:k.error})}):null,U,e.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:o("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:N,onValueChange:r=>qe(Number(r)),disabled:k.loading,ariaLabel:o("leaderboard.pagination.page_size_label"),options:ne.map(r=>({value:r,label:String(r)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",_e&&!k.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>A(r=>Math.max(1,r-1)),disabled:!_e||k.loading,children:o("leaderboard.pagination.prev")}),e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:ae}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Se&&!k.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>A(r=>r+1),disabled:!Se||k.loading,children:o("leaderboard.pagination.next")})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:o("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:o("landing.v2.nav.github")})]})}),e.jsxs(l.Suspense,{fallback:null,children:[e.jsx(gr,{isOpen:!!ue,userId:ue,period:v,accessToken:E,onClose:Je}),e.jsx(br,{isOpen:Ze,onClose:()=>xe(!1),communityStats:ke})]})]})}export{Ir as LeaderboardPage};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-DCOLG1fl.js","assets/main-rco_Tu2D.js","assets/main-KK0yAXww.css","assets/AchievementBadge-DcDkcyk4.js","assets/zap-BQ6Eilqi.js","assets/flame-sZg_y2Ct.js","assets/use-transform-h2Jds0kA.js","assets/AchievementsSection-Cj13lk07.js","assets/format-tokens-Ck8WH-5G.js","assets/DialogTitle-hGgP0eky.js","assets/useScrollLock-DGfYuwgo.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as se,_ as G,r as p,dz as ie,j as e,E as n,dA as oe,aB as ne,dB as le,P as c,dC as de,aF as ce,L as me,R as O,k as xe,S as U,X as ge,H as X,a4 as he,G as pe,ai as ue}from"./main-rco_Tu2D.js";import{u as fe}from"./useCurrency-x0Nv5rZP.js";import{L as Y}from"./LeaderboardAvatar-hrfyPkYI.js";import{A as be}from"./ActivityHeatmap-BCBaXKEP.js";import{H as ye,A as q,s as ke,a as je,b as ve,t as Ne,h as _e}from"./AchievementBadge-DcDkcyk4.js";import{A as we}from"./AchievementsSection-Cj13lk07.js";import{A as T}from"./arrow-up-right-CZZ-UM4M.js";import{L as Ae}from"./link-2-u9AJ19mI.js";import{C as Se}from"./check-DZawOdAk.js";import{D as ze,a as Ce,b as Ie,c as Pe,d as $e,e as Le}from"./DialogTitle-hGgP0eky.js";import"./info-wPFCesi6.js";import"./zap-BQ6Eilqi.js";import"./flame-sZg_y2Ct.js";import"./format-tokens-Ck8WH-5G.js";import"./useScrollLock-DGfYuwgo.js";const Me=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Be=se("code-xml",Me),R="tokentracker_anon_id";let A=null;function F(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)})}function H(){if(A)return A;try{let a=localStorage.getItem(R);return a||(a=F(),localStorage.setItem(R,a)),A=a,a}catch{return A=F(),A}}function K({userId:a}){const{signedIn:r,getAccessToken:s}=G(),[t,i]=p.useState(!1),[o,m]=p.useState(0),[d,g]=p.useState(!1),[u,S]=p.useState(!1),[z,L]=p.useState(!1),[j,v]=p.useState([]),[C,N]=p.useState(!1),y=p.useRef(0),k=p.useCallback(async()=>{if(r)try{const l=await s();if(l)return{accessToken:l,anonId:H()}}catch{}return{anonId:H()}},[r,s]);p.useEffect(()=>{let l=!1;return a?(g(!1),(async()=>{const x=await k();try{const h=await ie({userId:a,...x});if(l)return;m(Number(h?.count)||0),i(!!h?.liked),g(!0)}catch{if(l)return;m(0),i(!1),g(!0)}})(),()=>{l=!0}):(g(!1),()=>{l=!0})},[a,k]);const _=()=>{L(!0),setTimeout(()=>L(!1),450),N(!0),setTimeout(()=>N(!1),500);const l=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],x=["circle","heart"],h=[];for(let b=0;b<12;b++){const I=(b*30+Math.random()*20-10)*(Math.PI/180),P=45+Math.random()*45,Z=Math.cos(I)*P,J=Math.sin(I)*P-(10+Math.random()*15),Q=Math.random()*360-180,ee=6+Math.random()*8,ae=l[Math.floor(Math.random()*l.length)],re=x[Math.floor(Math.random()*x.length)],te=++y.current;h.push({id:te,tx:Z,ty:J,rot:Q,size:ee,color:ae,shape:re})}v(b=>[...b,...h]),setTimeout(()=>{v(b=>b.filter(I=>!h.find(P=>P.id===I.id)))},850)},w=async l=>{S(!0);try{const x=await k(),h=await oe({userId:a,action:l,...x});h&&Number.isFinite(Number(h.count))&&m(Number(h.count)),h&&typeof h.liked=="boolean"&&i(h.liked)}catch{i(x=>!x),m(x=>l==="like"?Math.max(0,x-1):x+1)}finally{S(!1)}},f=l=>{l.stopPropagation(),!(!a||!d||u)&&(t?(i(!1),m(x=>Math.max(0,x-1)),w("unlike")):(i(!0),m(x=>x+1),_(),w("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
3
|
-
@keyframes tt-like-pop {
|
|
4
|
-
0% { transform: scale(1); }
|
|
5
|
-
25% { transform: scale(0.75); }
|
|
6
|
-
50% { transform: scale(1.35); }
|
|
7
|
-
75% { transform: scale(0.9); }
|
|
8
|
-
100% { transform: scale(1); }
|
|
9
|
-
}
|
|
10
|
-
@keyframes tt-particle-fly {
|
|
11
|
-
0% {
|
|
12
|
-
transform: translate(0, 0) scale(1) rotate(0deg);
|
|
13
|
-
opacity: 1;
|
|
14
|
-
}
|
|
15
|
-
70% {
|
|
16
|
-
opacity: 0.8;
|
|
17
|
-
}
|
|
18
|
-
100% {
|
|
19
|
-
transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
|
|
20
|
-
opacity: 0;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
@keyframes tt-num-scroll {
|
|
24
|
-
0% { transform: translateY(8px); opacity: 0; }
|
|
25
|
-
100% { transform: translateY(0); opacity: 1; }
|
|
26
|
-
}
|
|
27
|
-
.tt-animate-pop {
|
|
28
|
-
animation: tt-like-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
|
|
29
|
-
}
|
|
30
|
-
.tt-particle {
|
|
31
|
-
position: absolute;
|
|
32
|
-
top: 50%;
|
|
33
|
-
left: 50%;
|
|
34
|
-
margin-top: -6px;
|
|
35
|
-
margin-left: -6px;
|
|
36
|
-
pointer-events: none;
|
|
37
|
-
z-index: 50;
|
|
38
|
-
}
|
|
39
|
-
.tt-num-anim {
|
|
40
|
-
animation: tt-num-scroll 0.25s ease-out forwards;
|
|
41
|
-
}
|
|
42
|
-
`}}),j.map(l=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${l.tx}px`,"--ty":`${l.ty}px`,"--rot":`${l.rot}deg`,width:`${l.size}px`,height:`${l.size}px`,backgroundColor:l.shape==="circle"?l.color:"transparent",borderRadius:l.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:l.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:l.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},l.id)),e.jsxs("button",{type:"button",onClick:f,disabled:!d||u,"aria-label":t?n("leaderboard.profile.like.aria_unlike"):n("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:z?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(ye,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${C?"tt-num-anim":""}`,children:d?o:"·"})]})]})}function De({badge:a,badgeLabel:r,className:s="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${s}`,children:[e.jsx(Y,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(q,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Ue({badges:a,isOwn:r=!1,onSelect:s,className:t=""}){const i=ke((Array.isArray(a)?a:[]).filter(o=>o&&je.has(o.id))).filter(o=>r||(o.tier||0)>=1);return i.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center ${t}`,children:i.map((o,m)=>{const d=(o.tier||0)>=1,g=n(ve(o.id,"name")),u=d?n(`achievements.tier.${Ne(o.tier)}`):n("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:s?()=>s(o):void 0,title:`${g} · ${u}`,"aria-label":n("achievements.badge.aria",{name:g,tier:u}),style:{zIndex:i.length-m},className:`${m>0?"-ml-2.5":""} group relative rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60`,children:e.jsx(q,{badgeId:o.id,tier:o.tier,locked:!d,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},o.id)})})}const Te=O.lazy(()=>he(()=>import("./BadgeDetailModal-DCOLG1fl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function Re(a,r,s){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:pe(t,{decimals:2,currency:r,rate:s})}function E(a,r,s){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Re(t,r,s);const i=r==="USD"?t:t*(s||1);return`${r==="USD"?"$":""}${X(i,{decimals:1})}`}function D(a){const r=Number(a);return!Number.isFinite(r)||r<=0?"0":X(r,{decimals:1})}function Fe(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const s=r.map(i=>({day:i.date,total_tokens:i.total_tokens,models:i.models||null})),t=r[r.length-1]?.date;return xe({dailyRows:s,weeks:52,to:t})}const He=`
|
|
43
|
-
@keyframes tt-shimmer {
|
|
44
|
-
100% { transform: translateX(100%); }
|
|
45
|
-
}
|
|
46
|
-
.tt-shimmer-bar {
|
|
47
|
-
position: relative;
|
|
48
|
-
overflow: hidden;
|
|
49
|
-
}
|
|
50
|
-
.tt-shimmer-bar::after {
|
|
51
|
-
position: absolute;
|
|
52
|
-
top: 0; right: 0; bottom: 0; left: 0;
|
|
53
|
-
transform: translateX(-100%);
|
|
54
|
-
background-image: linear-gradient(
|
|
55
|
-
90deg,
|
|
56
|
-
rgba(0, 0, 0, 0) 0%,
|
|
57
|
-
rgba(0, 0, 0, 0.02) 20%,
|
|
58
|
-
rgba(0, 0, 0, 0.06) 60%,
|
|
59
|
-
rgba(0, 0, 0, 0) 100%
|
|
60
|
-
);
|
|
61
|
-
animation: tt-shimmer 1.6s infinite;
|
|
62
|
-
content: '';
|
|
63
|
-
}
|
|
64
|
-
.dark .tt-shimmer-bar::after {
|
|
65
|
-
background-image: linear-gradient(
|
|
66
|
-
90deg,
|
|
67
|
-
rgba(255, 255, 255, 0) 0%,
|
|
68
|
-
rgba(255, 255, 255, 0.02) 20%,
|
|
69
|
-
rgba(255, 255, 255, 0.06) 60%,
|
|
70
|
-
rgba(255, 255, 255, 0) 100%
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
`;function Ee({variant:a="modal"}){const r="rounded bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar",s=a==="page";return e.jsxs("div",{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:He}}),s?e.jsxs("div",{className:"flex items-start gap-5 px-6 sm:px-8 pt-8 pb-7 animate-fade-in",children:[e.jsx("div",{className:"h-[68px] w-[68px] rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 flex items-start justify-between gap-4 pt-0.5",children:[e.jsxs("div",{className:"min-w-0 space-y-2.5",children:[e.jsx("div",{className:c(r,"h-7 w-48")}),e.jsx("div",{className:c(r,"h-3.5 w-32")})]}),e.jsxs("div",{className:"shrink-0 space-y-1.5 flex flex-col items-end",children:[e.jsx("div",{className:c(r,"h-2.5 w-8")}),e.jsx("div",{className:c(r,"h-7 w-12")})]})]})]}):e.jsxs("div",{className:"flex items-start gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60 animate-fade-in",children:[e.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[e.jsx("div",{className:c(r,"h-4 w-40")}),e.jsx("div",{className:c(r,"h-3 w-56")})]}),e.jsx("div",{className:c(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:c("space-y-6",s?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"px-6 py-5"),children:[e.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((t,i)=>e.jsxs("div",{children:[e.jsx("div",{className:c(r,"h-6 w-20")}),e.jsx("div",{className:c(r,"mt-2 h-3 w-14")})]},i))}),e.jsx("div",{className:"space-y-3 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:Array.from({length:3}).map((t,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-3 w-24")}),e.jsx("div",{className:c(r,"h-3 w-44")})]},i))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-44 mb-4")}),e.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((t,i)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},i))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((t,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-4 w-4")}),e.jsx("div",{className:c(r,"h-3 w-16")}),e.jsx("div",{className:c(r,"h-[3px] flex-1")}),e.jsx("div",{className:c(r,"h-3 w-12")})]},i))})]})]})]})}function V(a){if(!a)return null;const r=String(a).match(/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})/i);return r?r[1]:null}function M({children:a}){return e.jsx("h3",{className:"text-[11px] uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400 mb-3",children:a})}function $({value:a,label:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-black tabular-nums tracking-tight leading-none text-oai-black dark:text-white",style:{fontFamily:'"DIN Alternate-Bold", "DIN Alternate", "DIN Condensed-Bold", "Impact", -apple-system, sans-serif',fontWeight:900},children:a}),e.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function B({label:a,children:r}){return e.jsxs("div",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"shrink-0 w-28 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"min-w-0 flex-1 text-oai-gray-900 dark:text-oai-gray-100 tabular-nums truncate flex items-baseline gap-2 flex-wrap",children:r})]})}function We({user:a,onClose:r}){const s=V(a?.github_url);return e.jsxs("div",{className:"flex items-center gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60",children:[e.jsx(Y,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"lg",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.rank?e.jsx("span",{className:c("shrink-0 inline-flex items-center px-2 py-0.5 rounded text-xs font-bold font-mono uppercase tracking-wider border shadow-sm",a.rank===1&&"bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400 dark:bg-amber-400/10",a.rank===2&&"bg-slate-500/10 text-slate-600 border-slate-500/20 dark:text-slate-400 dark:bg-slate-400/10",a.rank===3&&"bg-orange-500/10 text-orange-700 border-orange-500/20 dark:text-orange-400 dark:bg-orange-400/10",a.rank>3&&"bg-oai-gray-100 dark:bg-oai-gray-900/60 text-oai-gray-500 dark:text-oai-gray-400 border-oai-gray-200/60 dark:border-oai-gray-800"),children:n("leaderboard.profile_modal.rank",{rank:a.rank})}):null]}),s&&e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-[12px] text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200 transition-colors",children:[e.jsx(U,{provider:"GITHUB",size:11}),e.jsxs("span",{children:["@",s]})]})]}),a?.user_id&&e.jsx("div",{className:"shrink-0 flex items-center justify-center",children:e.jsx(K,{userId:a.user_id})}),r&&e.jsx("button",{type:"button",onClick:r,className:"shrink-0 -mr-1 -mt-1 flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors group","aria-label":n("leaderboard.profile_modal.close"),children:e.jsx(ge,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function Ge({user:a,topBadge:r}){const s=V(a?.github_url),t=Number(a?.rank)||0,i=t===1?"text-amber-500 dark:text-amber-400":t===2?"text-slate-500 dark:text-slate-300":t===3?"text-orange-600 dark:text-orange-400":"text-oai-gray-400 dark:text-oai-gray-500";return e.jsxs("div",{className:"flex items-center gap-5 px-6 sm:px-8 pt-8 pb-7",children:[e.jsx(De,{badge:r,avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"xl",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"truncate text-2xl sm:text-[28px] font-semibold tracking-tight leading-tight text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.user_id&&e.jsx(K,{userId:a.user_id})]}),s?e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(U,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",s]})]}):null]}),t?e.jsxs("div",{className:"shrink-0 text-right leading-none",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:c("mt-1.5 text-3xl font-black tabular-nums tracking-tight",i),children:n("leaderboard.profile_modal.rank",{rank:t})})]}):null]})]})}function Oe({data:a}){const r=Array.isArray(a)?a:[];return r.length===0?e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.providers.none")}):e.jsx("ul",{className:"space-y-2",children:r.map(s=>{const t=Math.max(0,Math.min(1,Number(s?.percent)||0));return e.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center w-4 h-4",children:e.jsx(U,{provider:String(s.source).toUpperCase(),size:14})}),e.jsx("span",{className:"shrink-0 capitalize w-16 text-oai-gray-700 dark:text-oai-gray-300",children:s.source}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(t*100).toFixed(1)}%`}})}),e.jsx("span",{className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:D(s.total_tokens)}),e.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(t*100).toFixed(0),"%"]})]},s.source)})})}function W({icon:a,label:r,value:s}){const[t,i]=p.useState(!1),o=async()=>{await ue(s)&&(i(!0),setTimeout(()=>i(!1),1600))};return e.jsxs("button",{type:"button",onClick:o,className:c("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",t?"border-emerald-500/30 text-emerald-600 dark:text-emerald-400 bg-emerald-500/[0.06]":"border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-gray-900 dark:hover:text-oai-gray-100 hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[t?e.jsx(Se,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t?n("leaderboard.profile_modal.badge.copied"):r})]})}function Xe({data:a,currency:r,rate:s,onClose:t,variant:i="modal"}){const{user:o,totals:m,streak:d,best_day:g,models:u,by_provider:S,heatmap:z,period:L}=a,j=i==="page",v=p.useMemo(()=>Fe(z),[z]),C=u?.favorite?.model_name,N=Number(u?.count)||0,y=Array.isArray(a.badges)?a.badges:[],[k,_]=p.useState(null),w=G(),f=!!(w?.user?.id&&o?.user_id&&w.user.id===o.user_id),l=o?.user_id?`https://www.tokentracker.cc/u/${o.user_id}`:null,x=o?.user_id?`[}/functions/tokentracker-embed-svg?user_id=${o.user_id}&theme=dark)](${l}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[j?e.jsx(Ge,{user:o,topBadge:_e(y)}):e.jsx(We,{user:o,onClose:t}),e.jsxs("div",{className:c("space-y-6",j?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5"),children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-4",children:[e.jsx($,{value:D(m?.total_tokens),label:n("leaderboard.profile_modal.stat.total_tokens")}),e.jsx($,{value:E(m?.estimated_cost_usd,r,s),label:n("leaderboard.profile_modal.stat.total_cost")}),e.jsx($,{value:String(m?.active_days??0),label:n("leaderboard.profile_modal.stat.active_days")}),e.jsx($,{value:E(m?.avg_per_day_usd,r,s),label:n("leaderboard.profile_modal.stat.avg_per_day")})]}),e.jsxs("dl",{className:"space-y-2 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsxs(B,{label:n("leaderboard.profile_modal.streak.current"),children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:n("leaderboard.profile_modal.streak.days",{count:d?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",d?.longest_days??0,")"]})]}),e.jsx(B,{label:n("leaderboard.profile_modal.best_day.title"),children:g?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:D(g.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",g.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.best_day.none")})}),e.jsx(B,{label:n("leaderboard.profile_modal.models.favorite"),children:C?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30 truncate max-w-[200px] inline-block align-bottom",children:C}),N>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:n("leaderboard.profile_modal.models.count",{count:N})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.models.none")})})]}),(f||y.some(h=>(h?.tier||0)>=1))&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(M,{children:n("achievements.section.title")}),j?e.jsx(we,{achievements:y,isOwn:f&&!!a.badges_include_unearned,scope:"cloud",onSelect:_}):e.jsx(Ue,{badges:y,isOwn:f&&!!a.badges_include_unearned,onSelect:_})]}),v&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(M,{children:n("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(be,{heatmap:v,hideLegend:!0,embedded:!0})})]}),e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(M,{children:n("leaderboard.profile_modal.providers.title")}),e.jsx(Oe,{data:S})]}),o?.user_id&&(t||f)&&e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-3",children:[t&&(ce()?e.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer",onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(T,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]}):e.jsxs(me,{to:`/u/${o.user_id}`,onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(T,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),f&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{icon:Ae,label:n("leaderboard.profile_modal.badge.copy_url"),value:l}),e.jsx(W,{icon:Be,label:n("leaderboard.profile_modal.badge.copy"),value:x})]})]})]}),k&&e.jsx(O.Suspense,{fallback:null,children:e.jsx(Te,{badge:k,onClose:()=>_(null)})})]})}function Ye({userId:a,period:r,accessToken:s,enabled:t=!0}){const[i,o]=p.useState({loading:!1,error:null,data:null});return p.useEffect(()=>{if(!t||!a)return;let m=!0;return o({loading:!0,error:null,data:null}),(async()=>{try{const d=s?await ne(s):null;if(!m)return;const g=await le({accessToken:d,userId:a,period:r||"week"});if(!m)return;o({loading:!1,error:null,data:g})}catch(d){if(!m)return;d?.status===404?o({loading:!1,error:null,data:null}):o({loading:!1,error:d?.message||String(d),data:null})}})(),()=>{m=!1}},[t,a,r,s]),i}function da({isOpen:a,onClose:r,userId:s,period:t,accessToken:i}){const{currency:o,rate:m}=fe(),d=Ye({userId:s,period:t,accessToken:i,enabled:a});return e.jsx(ze,{open:a,onOpenChange:g=>{g||r?.()},children:e.jsxs(Ce,{children:[e.jsx(Ie,{className:"cost-modal-backdrop"}),e.jsx(Pe,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs($e,{className:c("cost-modal-popup","relative w-full max-w-[540px] max-h-[calc(100vh-2rem)] flex flex-col","rounded-2xl bg-white dark:bg-oai-gray-950","shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)]","ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden","dark:border-t dark:border-white/[0.08]"),children:[e.jsx(Le,{render:e.jsx("h2",{className:"sr-only"}),children:d.data?.user?.display_name||n("leaderboard.profile_modal.loading")}),d.loading&&e.jsx(Ee,{}),!d.loading&&d.error&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:n("leaderboard.profile_modal.error")})}),!d.loading&&!d.error&&!d.data&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.empty")})}),!d.loading&&!d.error&&d.data&&e.jsx(Xe,{data:d.data,currency:o,rate:m,onClose:r})]})})]})})}export{da as LeaderboardProfileModal,Xe as ProfileContent,Ee as ProfileSkeleton,Ye as useLeaderboardProfileData};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c}from"./main-rco_Tu2D.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
|