tokentracker-cli 0.95.2 → 0.96.0

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.
Files changed (107) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-DtB1MwFe.js → AchievementBadge-Bb2ljquW.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage--vddu0dC.js → AchievementsPage-ByUP2x8a.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-CDl9hsbj.js → AchievementsSection-_L6sCLTw.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-C7WsIRy9.js → BadgeDetailModal-B9n_-45B.js} +1 -1
  5. package/dashboard/dist/assets/{BotAnimated-CmXyzIhX.js → BotAnimated-lWmg-aZg.js} +1 -1
  6. package/dashboard/dist/assets/{Card-SUbC3VNS.js → Card-aSp259T0.js} +1 -1
  7. package/dashboard/dist/assets/{ClawdAnimated-BdEbs8Me.js → ClawdAnimated-Cy-XaTXW.js} +2 -2
  8. package/dashboard/dist/assets/{CommandPalette-D1RLLeHB.js → CommandPalette-CNwtKCUm.js} +1 -1
  9. package/dashboard/dist/assets/{CommunityStatsModal-5ESGJgZQ.js → CommunityStatsModal-DJSezaPV.js} +1 -1
  10. package/dashboard/dist/assets/{ConfirmModal-DsCd51b2.js → ConfirmModal-CVjmhZd6.js} +1 -1
  11. package/dashboard/dist/assets/{Controls-BVrLC_QD.js → Controls-BIj6yVxE.js} +1 -1
  12. package/dashboard/dist/assets/{DashboardPage-DtUOG6og.js → DashboardPage-BjYZLmqQ.js} +1 -1
  13. package/dashboard/dist/assets/{DevicePage-zYjj-m5V.js → DevicePage-ptsI2fZc.js} +1 -1
  14. package/dashboard/dist/assets/{DialogClose-D66yBqkd.js → DialogClose-D1pLoZ56.js} +1 -1
  15. package/dashboard/dist/assets/DialogDescription-KY7X94CG.js +1 -0
  16. package/dashboard/dist/assets/{DialogTitle-C4ia00lc.js → DialogTitle-DfSBUjWf.js} +1 -1
  17. package/dashboard/dist/assets/{FadeIn-DF2c8XaR.js → FadeIn-DBn4L_BV.js} +1 -1
  18. package/dashboard/dist/assets/{HeaderGithubStar-Cnr3aqcX.js → HeaderGithubStar-EJLBwEqp.js} +1 -1
  19. package/dashboard/dist/assets/{HoverTooltip-DBOpxlH7.js → HoverTooltip-DaSrZhYd.js} +1 -1
  20. package/dashboard/dist/assets/{IpCheckPage-CUY6KBaV.js → IpCheckPage-diQTVaYt.js} +1 -1
  21. package/dashboard/dist/assets/{LandingPage-DKL8hZEq.js → LandingPage-BqCxjwar.js} +2 -2
  22. package/dashboard/dist/assets/{LeaderboardAvatar-DRYeMNlq.js → LeaderboardAvatar-CQImCsPN.js} +1 -1
  23. package/dashboard/dist/assets/{LeaderboardPage-DpD9Az3k.js → LeaderboardPage-D2ZDUi_O.js} +2 -2
  24. package/dashboard/dist/assets/{LeaderboardProfileModal-Dfg0V13F.js → LeaderboardProfileModal-DHvADX1d.js} +3 -3
  25. package/dashboard/dist/assets/{LeaderboardProfilePage-DH-jcVDu.js → LeaderboardProfilePage-CJsedB28.js} +1 -1
  26. package/dashboard/dist/assets/LimitsPage-CAwff24b.js +6 -0
  27. package/dashboard/dist/assets/{LocalOnlyNotice-Bj_m0hw7.js → LocalOnlyNotice-Cmnvu9tI.js} +1 -1
  28. package/dashboard/dist/assets/{LoginCard-BVKvtx60.js → LoginCard-BQmKkD7X.js} +1 -1
  29. package/dashboard/dist/assets/{LoginModal-mUGiSIJN.js → LoginModal-2oPROePZ.js} +1 -1
  30. package/dashboard/dist/assets/{LoginPage-BORCuCUt.js → LoginPage-aqdUJoQK.js} +1 -1
  31. package/dashboard/dist/assets/{PetPage-D1JfEOVA.js → PetPage-Bn3p_o5r.js} +1 -1
  32. package/dashboard/dist/assets/{PopoverPopup-DK3et-HG.js → PopoverPopup-DXD_YdiB.js} +1 -1
  33. package/dashboard/dist/assets/{ProviderIcon-By8FAjxR.js → ProviderIcon-BZZ45-gY.js} +1 -1
  34. package/dashboard/dist/assets/{ResetPasswordPage-DPa81jqa.js → ResetPasswordPage-Bn5ITiHQ.js} +1 -1
  35. package/dashboard/dist/assets/{SegmentedControl-DLzS-2eZ.js → SegmentedControl-hGXboQZy.js} +1 -1
  36. package/dashboard/dist/assets/{Select-C05W6XEM.js → Select-BP8aVRZ1.js} +1 -1
  37. package/dashboard/dist/assets/{SelectItemText-CcfB3blP.js → SelectItemText-Odx47kND.js} +1 -1
  38. package/dashboard/dist/assets/{ServiceStatusPage-ByqLbHv1.js → ServiceStatusPage-DUueam0N.js} +1 -1
  39. package/dashboard/dist/assets/SessionsPage-BA9IFqQ1.js +2 -0
  40. package/dashboard/dist/assets/{SettingsPage-DAcndJZQ.js → SettingsPage-DLOHHB4f.js} +2 -2
  41. package/dashboard/dist/assets/{SkillsPage-BuuqQuNU.js → SkillsPage-Ds2vH_PG.js} +1 -1
  42. package/dashboard/dist/assets/{TokenGalaxy-DzccxkXW.js → TokenGalaxy-CWBR4jnB.js} +1 -1
  43. package/dashboard/dist/assets/{ToolbarRootContext-XUDMp5uy.js → ToolbarRootContext-Bmg56vYz.js} +1 -1
  44. package/dashboard/dist/assets/{TrendMonitor-B-yYabbz.js → TrendMonitor-BQzcllvg.js} +1 -1
  45. package/dashboard/dist/assets/{WidgetsPage-CwUDjEFo.js → WidgetsPage-Bu3tHDjO.js} +1 -1
  46. package/dashboard/dist/assets/{WrappedPage-Dr9ow3gH.js → WrappedPage-BrAMJhgy.js} +1 -1
  47. package/dashboard/dist/assets/{__vite-browser-external-DPOlUkcY.js → __vite-browser-external-4IGm4Djn.js} +12 -12
  48. package/dashboard/dist/assets/{agent-logos-Cqc_suYk.js → agent-logos-B8lT-HcI.js} +1 -1
  49. package/dashboard/dist/assets/{arrow-up-right-DSsR3Ntr.js → arrow-up-right-rpBCOTg2.js} +1 -1
  50. package/dashboard/dist/assets/{check-Cy35lAKh.js → check-DIKw7TYH.js} +1 -1
  51. package/dashboard/dist/assets/{composite-BDwOlhhX.js → composite-_NeXO0lv.js} +1 -1
  52. package/dashboard/dist/assets/{copy-4szu5cYh.js → copy-CsfAtL7P.js} +1 -1
  53. package/dashboard/dist/assets/{download-DdGW6Krz.js → download-DM1W9pIW.js} +1 -1
  54. package/dashboard/dist/assets/{external-link-DwSt83cq.js → external-link-CwbuMbeQ.js} +1 -1
  55. package/dashboard/dist/assets/{flame-DubukWqK.js → flame-DcYbLdhE.js} +1 -1
  56. package/dashboard/dist/assets/{format-tokens-B70EdQcN.js → format-tokens-CEvr3dNy.js} +1 -1
  57. package/dashboard/dist/assets/{icons-B86TLdAj.js → icons-DaGMVsJ5.js} +1 -1
  58. package/dashboard/dist/assets/{index-B_KMoBeK.js → index-BVVLPj3N.js} +1 -1
  59. package/dashboard/dist/assets/{index-DI-W-pun.js → index-ChZkJjpk.js} +1 -1
  60. package/dashboard/dist/assets/{index-DzEMcUwI.js → index-T7OjmEuX.js} +1 -1
  61. package/dashboard/dist/assets/{info-BzFpLbl6.js → info-CAjN3dX4.js} +1 -1
  62. package/dashboard/dist/assets/limits-providers-jn7Yln_V.js +1 -0
  63. package/dashboard/dist/assets/{link-2-BQp7-3T7.js → link-2-DaWH2Tyc.js} +1 -1
  64. package/dashboard/dist/assets/{loader-circle-lrDmbIg5.js → loader-circle-CnF8qPi1.js} +1 -1
  65. package/dashboard/dist/assets/{maximize-2-Cnd_Oth8.js → maximize-2-B-2Pnj6g.js} +1 -1
  66. package/dashboard/dist/assets/{modifiers.esm-CPTpZdHU.js → modifiers.esm-BoDOvUKl.js} +1 -1
  67. package/dashboard/dist/assets/{monitor-smartphone-C7UY1zRx.js → monitor-smartphone-DDgwxG_E.js} +1 -1
  68. package/dashboard/dist/assets/{plus-Bglp9N_7.js → plus-DIc1YUWB.js} +1 -1
  69. package/dashboard/dist/assets/{provider-display-CGsFySs6.js → provider-display-yeNsVCO_.js} +1 -1
  70. package/dashboard/dist/assets/{react-DKXriBSF.js → react-DZqS6YTX.js} +1 -1
  71. package/dashboard/dist/assets/{search-D_LLDRdU.js → search-D6tEppYJ.js} +1 -1
  72. package/dashboard/dist/assets/{skills-api-CJWjKIco.js → skills-api-vsA1rc1Z.js} +1 -1
  73. package/dashboard/dist/assets/{sortable.esm-zlY09tye.js → sortable.esm-DDCnS1HI.js} +1 -1
  74. package/dashboard/dist/assets/{store-8e16Ac2h.js → store-Crne4DqF.js} +1 -1
  75. package/dashboard/dist/assets/{terminal-CR228ekj.js → terminal-Ca7dkLMF.js} +1 -1
  76. package/dashboard/dist/assets/{trash-2-BjLWewOp.js → trash-2-CjEAS5ic.js} +1 -1
  77. package/dashboard/dist/assets/{use-community-stats-DhOJPaVg.js → use-community-stats-BHx2YxyK.js} +1 -1
  78. package/dashboard/dist/assets/{use-latest-request-guard-lcGhb-NC.js → use-latest-request-guard-BLGbXQdf.js} +1 -1
  79. package/dashboard/dist/assets/{use-limits-display-prefs-DJIImtLN.js → use-limits-display-prefs-DBkAp6ob.js} +1 -1
  80. package/dashboard/dist/assets/{use-ordered-list-BJZfZuoJ.js → use-ordered-list-BTfW5M9u.js} +1 -1
  81. package/dashboard/dist/assets/use-reduced-motion-D_kUnDs4.js +1 -0
  82. package/dashboard/dist/assets/{use-session-efficiency-pref-C-l4b1cD.js → use-session-efficiency-pref-DBmd-MqH.js} +1 -1
  83. package/dashboard/dist/assets/{use-transform-UjIt477N.js → use-transform-Bp5XrwaQ.js} +1 -1
  84. package/dashboard/dist/assets/{use-usage-limits-DqoTZrqT.js → use-usage-limits-BmqRcyhH.js} +1 -1
  85. package/dashboard/dist/assets/{useCurrency-CnM8aB4v.js → useCurrency-B0YsRDj-.js} +1 -1
  86. package/dashboard/dist/assets/{useTokenFormat-D4pAK2ld.js → useTokenFormat-PP3D0Ket.js} +1 -1
  87. package/dashboard/dist/assets/{zap-Du1IyEtj.js → zap-BVOm1aBH.js} +1 -1
  88. package/dashboard/dist/index.html +1 -1
  89. package/dashboard/dist/ip-check.html +1 -1
  90. package/dashboard/dist/leaderboard.html +1 -1
  91. package/dashboard/dist/share.html +1 -1
  92. package/package.json +1 -1
  93. package/src/lib/ark-agent-plan-limits.js +437 -0
  94. package/src/lib/ark-coding-plan-limits.js +104 -27
  95. package/src/lib/codex-model-attribution.js +128 -0
  96. package/src/lib/codex-rollout-parser.js +98 -4
  97. package/src/lib/pricing/curated-overrides.json +6 -6
  98. package/src/lib/pricing/index.js +38 -1
  99. package/src/lib/pricing/seed-snapshot.json +1 -1
  100. package/src/lib/rollout.js +50 -9
  101. package/src/lib/session-analytics.js +374 -110
  102. package/src/lib/usage-limits.js +19 -5
  103. package/dashboard/dist/assets/DialogDescription-BVlaoajd.js +0 -1
  104. package/dashboard/dist/assets/LimitsPage-CVCKPScf.js +0 -5
  105. package/dashboard/dist/assets/SessionsPage-CEDv1thj.js +0 -2
  106. package/dashboard/dist/assets/limits-providers-DxZOjiXQ.js +0 -1
  107. package/dashboard/dist/assets/use-reduced-motion-DdpxZQoh.js +0 -1
@@ -1 +1 @@
1
- import{d as l,j as c,e as h}from"./__vite-browser-external-DPOlUkcY.js";function d(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function x(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=d(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:x(t)})}export{g as L};
1
+ import{d as l,j as c,e as h}from"./__vite-browser-external-4IGm4Djn.js";function d(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function x(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=d(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:x(t)})}export{g as L};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-Dfg0V13F.js","assets/__vite-browser-external-DPOlUkcY.js","assets/__vite-browser-external-CCMdjCX2.css","assets/provider-display-CGsFySs6.js","assets/useCurrency-CnM8aB4v.js","assets/useTokenFormat-D4pAK2ld.js","assets/maximize-2-Cnd_Oth8.js","assets/terminal-CR228ekj.js","assets/info-BzFpLbl6.js","assets/LeaderboardAvatar-DRYeMNlq.js","assets/ProviderIcon-By8FAjxR.js","assets/AchievementBadge-DtB1MwFe.js","assets/zap-Du1IyEtj.js","assets/flame-DubukWqK.js","assets/AchievementsSection-CDl9hsbj.js","assets/react-DKXriBSF.js","assets/format-tokens-B70EdQcN.js","assets/use-reduced-motion-DdpxZQoh.js","assets/arrow-up-right-DSsR3Ntr.js","assets/link-2-BQp7-3T7.js","assets/check-Cy35lAKh.js","assets/DialogTitle-C4ia00lc.js","assets/composite-BDwOlhhX.js","assets/store-8e16Ac2h.js","assets/CommunityStatsModal-5ESGJgZQ.js","assets/icons-B86TLdAj.js","assets/TrendMonitor-B-yYabbz.js","assets/use-latest-request-guard-lcGhb-NC.js","assets/PopoverPopup-DK3et-HG.js","assets/ToolbarRootContext-XUDMp5uy.js","assets/DialogDescription-BVlaoajd.js","assets/DialogClose-D66yBqkd.js"])))=>i.map(i=>d[i]);
2
- import{m as ua,j as e,d as xa,c as s,e as d,r as c,al as ga,f as ba,u as pa,a as ha,am as fa,J as ya,an as ka,ao as wa,ap as ze,aq as ja,ar as ne,g as va,as as Na,L as _a,at as Sa,l as Ca,au as La,av as Ea,a8 as Ta,_ as Fe,k as Aa,x as Ma}from"./__vite-browser-external-DPOlUkcY.js";import{S as Pa}from"./Select-C05W6XEM.js";import{m as Ka}from"./react-DKXriBSF.js";import{u as Ra,C as Ia,a as za,b as Be,D as Ba,c as Da,S as $a,h as Ua,s as Oa,K as Fa,P as Ga}from"./sortable.esm-zlY09tye.js";import{r as Ha}from"./modifiers.esm-CPTpZdHU.js";import{P as he}from"./ProviderIcon-By8FAjxR.js";import{u as Ya}from"./useCurrency-CnM8aB4v.js";import{u as Q}from"./useTokenFormat-D4pAK2ld.js";import{L as Z}from"./LeaderboardAvatar-DRYeMNlq.js";import{s as Wa,c as Va,A as Ja,t as qa,b as Za}from"./AchievementBadge-DtB1MwFe.js";import{u as Xa}from"./use-ordered-list-BJZfZuoJ.js";import{u as Qa}from"./use-community-stats-DhOJPaVg.js";import"./ToolbarRootContext-XUDMp5uy.js";import"./composite-BDwOlhhX.js";import"./check-Cy35lAKh.js";import"./SelectItemText-CcfB3blP.js";import"./zap-Du1IyEtj.js";import"./flame-DubukWqK.js";const er=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ar=ua("arrow-right",er);function H(a,{min:r,max:o,fallback:n}){const l=Number(a);if(!Number.isFinite(l))return n;const i=Math.floor(l);return i<r?r:i>o?o:i}function rr(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),n=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,n-2,n-1,n,n+1,n+2]),i=Array.from(l).filter(x=>Number.isInteger(x)&&x>=1&&x<=o).sort((x,p)=>x-p),m=[];let b=null;for(const x of i)b!=null&&x-b>1&&m.push(null),m.push(x),b=x;return m}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,n=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,n||1):1e6,fallback:1}),i=l>1,m=o?l<n:!0;return{canPrev:i,canNext:m,safePage:l,safeTotal:n}}function or({entries:a,me:r,meLabel:o}){const n=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||n.some(m=>!!m?.is_me)?n:[{rank:l,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...n]}function sr(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.ceil(o/n)}const nr=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function ir({iconSrc:a,label:r}){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 ${nr.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ie=xa.memo(function({badges:r,max:o=3,className:n=""}){const l=Wa((r||[]).filter(i=>i&&Va.has(i.id)&&(i.tier||0)>=1)).slice(0,o);return l.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${n}`,children:l.map((i,m)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(Za(i.id,"name")),tier:s(`achievements.tier.${qa(i.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Ja,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),X=[{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}],Ge="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",He="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 le(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")}function de(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")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function lr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=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(le(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(de(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),X.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",n)})},l.key))]})}function dr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(n,l)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},l))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",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(Ge,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),X.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(lr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(dr,{index:o},o))})]})}function mr({id:a,thClassName:r,children:o}){const{attributes:n,listeners:l,setNodeRef:i,transform:m,transition:b,isDragging:x}=Ra({id:a}),p=Ia.Transform.toString(m)||"";c.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${a}"]`),h="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(g=>{g.style.transform=p,g.style.transition=b||"",g.style.zIndex=x?"20":"",g.style.position=p?"relative":"",g.style.boxShadow=x?h:""}),()=>{f.forEach(g=>{g.style.transform="",g.style.transition="",g.style.zIndex="",g.style.position="",g.style.boxShadow=""})}},[a,p,b,x]);const j={transform:p,transition:b,position:p?"relative":void 0,zIndex:x?20:void 0,boxShadow:x?"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:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...l,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",x&&"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"})]})}),o]})})}const ur="tokentracker.leaderboard.columnOrder.v1";function xr(a){return Xa(ur,a)}const gr=50;function br(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(o/n*100)))}function Ye(a){return typeof a=="string"?a.trim():""}function pr(a){const r=Ye(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:n,onJumpToMe:l,canJump:i,className:m}){const b=a&&typeof a.rank=="number"?a.rank:null;if(!b)return null;const x=Number(r)||0,p=br(b,x),j=Ye(a?.display_name),f=!j||pr(j)?o||"You":j,h=a?.user_id||f,g=n||(i?l:null),T=typeof g=="function",C=T?"button":"div",ee=T?{type:"button",onClick:g,"aria-label":s(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,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",T?"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]",m),children:[e.jsx(Z,{size:"sm",avatarUrl:a?.avatar_url,displayName:f,seed:h}),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:f}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",b.toLocaleString()]}),p!=null&&p<=gr&&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",p<=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:s("leaderboard.summary.percentile",{p:String(p)})}),T?e.jsx(ar,{"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 fr=c.lazy(()=>Fe(()=>import("./LeaderboardProfileModal-Dfg0V13F.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(a=>({default:a.LeaderboardProfileModal}))),yr=c.lazy(()=>Fe(()=>import("./CommunityStatsModal-5ESGJgZQ.js"),__vite__mapDeps([24,1,2,15,25,5,10,26,4,27,7,28,23,22,29,6,17,11,12,13,21,30,31])).then(a=>({default:a.CommunityStatsModal}))),ce=[10,20,50,100],me=20,We="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return me;try{const a=window.localStorage.getItem(We),r=Number(a);if(ce.includes(r))return r}catch{}return me}function ue(a,r,o){const n=Number(a);if(!Number.isFinite(n)||n<=0)return"-";const l=Sa(r),i=r===Ma?n:n*o;return i>=1e3?`${l}${Math.round(i).toLocaleString()}`:i>=10?`${l}${Math.round(i)}`:`${l}${i.toFixed(2)}`}function wr(a){if(typeof a!="string"||!a.trim())return null;const r=new Date(a);if(!Number.isFinite(r.getTime()))return null;const o=Aa();return{dateTime:r.toISOString(),display:new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(r),exact:new Intl.DateTimeFormat(o,{dateStyle:"full",timeStyle:"long"}).format(r)}}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=Q();return e.jsx("span",{title:o(a),children:r(a)})}function jr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:n}=Q();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:s("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:e.jsx("span",{title:n(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("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.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:Ca(a.totalEntries)}),e.jsx("span",{className:"hidden sm:inline",children:(Number(a.totalEntries)||0).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.devs_chip")})]})]})}function De({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:n,formatTokensTooltip:l}=Q(),i=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",m=r?"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";return o.map(b=>e.jsx("td",{"data-column-key":b.key,title:l(a?.[b.key]),className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",i,m),children:n(a?.[b.key])},b.key))}function vr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const Nr={1:"ring-2 ring-amber-400 dark:ring-amber-500/80 shadow-[0_0_8px_rgba(245,158,11,0.25)]",2:"ring-2 ring-slate-350 dark:ring-slate-450 shadow-[0_0_8px_rgba(148,163,184,0.2)]",3:"ring-2 ring-orange-400 dark:ring-orange-500/70 shadow-[0_0_8px_rgba(249,115,22,0.25)]"};function _r({rank:a,placeholder:r}){return a===1?e.jsx("span",{className:"text-base font-extrabold italic text-amber-500 dark:text-amber-400 tracking-tighter",children:"1"}):a===2?e.jsx("span",{className:"text-base font-extrabold italic text-slate-400 dark:text-slate-350 tracking-tighter",children:"2"}):a===3?e.jsx("span",{className:"text-base font-extrabold italic text-orange-500 dark:text-orange-400 tracking-tighter",children:"3"}):e.jsx("span",{className:"text-[13px] font-bold tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:a==null?r:`#${a}`})}function Sr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(he,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:n}=Q(),l=r.filter(i=>{const m=Number(a?.[i.key]);return Number.isFinite(m)&&m>0});return l.length===0?null:e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-2 border-t border-oai-gray-100/70 pt-3 dark:border-oai-gray-800/60",children:l.map(i=>{const m=s(i.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${n(a?.[i.key])}`,className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-oai-gray-50/80 dark:bg-oai-gray-900/60 px-2 py-0.5 border border-oai-gray-100/80 dark:border-oai-gray-800/40 text-[10px] font-medium text-oai-gray-600 dark:text-oai-gray-300 transition-colors",children:[e.jsx(he,{provider:vr(i),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[i.key])})]},i.key)})})}function Lr({entry:a,entryIdx:r,name:o,meLabel:n,currency:l,rate:i,orderedColumns:m,placeholder:b,onOpenProfile:x}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,j=!p&&be(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,g=p?n:o,T=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),x(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>x(f):void 0,onKeyDown:h?T:void 0,"aria-label":h?s("leaderboard.profile_modal.row_aria",{name:g}):void 0,className:d("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",p?"bg-gradient-to-br from-oai-brand-50/70 via-oai-brand-50/20 to-transparent dark:from-oai-brand-950/20 dark:via-oai-brand-950/5 dark:to-transparent border-oai-brand-200/60 dark:border-oai-brand-500/25":j?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",h&&"cursor-pointer hover:border-oai-gray-200 dark:hover:border-oai-gray-700/80 active:scale-[0.985] active:bg-oai-gray-50/60 dark:active:bg-oai-gray-900/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(_r,{rank:a?.rank,placeholder:b})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:d("inline-flex rounded-full p-0.5 transition-all duration-300",Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(Z,{size:"md",avatarUrl:a?.avatar_url,displayName:g,seed:pe(a,g)})}),a?.github_url&&e.jsx(Sr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:d("min-w-0 truncate text-sm tracking-tight",p?"font-semibold text-oai-black dark:text-oai-white":j?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:g}),e.jsx(ie,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:s("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:ue(a?.estimated_cost_usd,l,i)})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.08em] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.column.total")}),e.jsx("div",{className:d("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",p?"text-oai-black dark:text-oai-white":j?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(xe,{value:a?.total_tokens})})]})]}),e.jsx(Cr,{entry:a,orderedColumns:m})]},`mobile-row-${a?.rank}-${g}`)}const Er={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 $e({rank:a,placeholder:r}){const o=Er[a];return o?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Ue(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Tr(a){if(!a)return s("shared.error.prefix",{error:s("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||s("leaderboard.error.unknown");return s("shared.error.prefix",{error:o})}function ge(a){return typeof a!="string"?"":a.trim()}function be(a){const r=ge(a);return r?r.toLowerCase()==="anonymous":!0}function pe(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Oe({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:r=>r.stopPropagation(),"aria-label":s("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(he,{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:s("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[s("leaderboard.github.tooltipPrefix")," ",e.jsx(_a,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:s("leaderboard.github.tooltipSettingsLink")})," ",s("leaderboard.github.tooltipSuffix")]})]})]})}function Zr({auth:a,signedIn:r,sessionSoftExpired:o}){const n=ga(),l=ba(),{openLoginModal:i}=pa(),{signedIn:m,loading:b,user:x}=ha(),{currency:p,rate:j}=Ya(),f=c.useMemo(()=>fa(),[]),h=ya(),g=r&&!o,T=c.useMemo(()=>g&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,g]),C=g?T:null,ee=g&&ka(C),ae=s("shared.placeholder.short"),Ve=c.useMemo(()=>X.map(t=>t.key),[]),{order:re,reorder:fe}=xr(Ve),ye=c.useMemo(()=>{const t=new Map;for(const u of X)t.set(u.key,u);return t},[]),B=c.useMemo(()=>re.map(t=>ye.get(t)).filter(Boolean),[re,ye]),Je=za(Be(Ga,{activationConstraint:{distance:6}}),Be(Fa,{coordinateGetter:Oa})),qe=c.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||fe(String(u.id),String(w.id))},[fe]),[te,M]=c.useState(1),[_,Ze]=c.useState(kr),[ke,we]=c.useState(null),[Xe,je]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&we(t.trim())},[]),Qe=c.useCallback(()=>we(null),[]),ea=c.useCallback(t=>{const u=ce.includes(t)?t:me;Ze(u),M(1);try{window.localStorage.setItem(We,String(u))}catch{}},[]),[ve,aa]=c.useState(0),[ra,ta]=c.useState(()=>wa()),[Ne,_e]=c.useState(!1);c.useEffect(()=>{if(typeof window>"u")return;const t=()=>{aa(u=>u+1)};return window.addEventListener(ze,t),()=>{window.removeEventListener(ze,t)}},[]);const N=c.useMemo(()=>{const t=new URLSearchParams(n?.search||"");return Ue(t.get("period"))||"total"},[n?.search]),oa=t=>{const u=Ue(t);if(!u||u===N)return;const w=new URLSearchParams(n?.search||"");w.set("period",u),M(1),l(`${n?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{b||h||m||i()},[m,b,h,i]),c.useEffect(()=>{M(1)},[N]);const W=c.useMemo(()=>(H(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),R=c.useMemo(()=>h?"mock":b?"unavailable":m?"cloud":r?"local":f?"public":"unavailable",[b,m,f,h,r]),k=c.useMemo(()=>ja({accessMode:R,baseUrl:f,mockEnabled:h,userId:x?.id||null,period:N,pageSize:_,offset:W}),[x?.id,R,f,W,h,_,N]),[D,$]=c.useState(()=>{const t=ne(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!f&&!h||!h&&R==="unavailable"){$({loading:!1,error:null,data:null,contextKey:null});return}const t=ne(k);let u=!0;return $(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await va({userId:x?.id||null,period:N,limit:_,offset:W});u&&(Na(w,{activeContextKey:k,contextKey:k,source:ve>0?"manual-refresh":"page-load"}),$({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!u)return;const A=Tr(w);$(F=>F.contextKey===k?{...F,loading:!1,error:A}:{loading:!1,error:A,data:null,contextKey:k})}),()=>{u=!1}},[f,R,x?.id,k,W,ve,h,N,_]);const oe=c.useMemo(()=>D.contextKey===k?null:ne(k),[k,D.contextKey]),v=c.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(f||h)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,f,k,D,h,oe]),S=v.data,U=S?.total_pages??null,sa=S?.total_entries??0,P=S?.page??te,na=c.useMemo(()=>rr(P,U),[P,U]),Se=S?.from||null,Ce=S?.to||null,ia=S?.generated_at||null,V=wr(ia),Le=Qa(),K=S?.me||null,I=s("leaderboard.me_label"),Ee=s("leaderboard.anon_label"),Te=s("leaderboard.period.week"),Ae=s("leaderboard.period.month"),Me=s("leaderboard.period.total"),Pe=N==="month"?Ae:N==="total"?Me:Te,J=c.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:K,meLabel:I})},[S?.entries,K,I]),z=c.useMemo(()=>sr(K?.rank,_),[K?.rank,_]),la=z!=null&&z===P,da=c.useCallback(()=>{z!=null&&M(z)},[z]),ca=async()=>{_e(!0);try{La(!0),ta(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{_e(!1)}},{canPrev:Ke,canNext:Re}=tr({page:P,totalPages:U}),q=Array.isArray(J)&&J.length!==0;let O=null;v.loading&&!q?O=e.jsx(cr,{rows:_}):v.error&&!q?O=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:v.error})}):q?O=e.jsxs(Ba,{sensors:Je,collisionDetection:Da,modifiers:[Ha],onDragEnd:qe,children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",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(Ge,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.rank")}),e.jsx("th",{className:d(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("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:s("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:s("leaderboard.column.est_cost")}),e.jsx($a,{items:re,strategy:Ua,children:B.map(t=>e.jsx(mr,{id:t.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(ir,{iconSrc:t.icon,label:s(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:J.map((t,u)=>{if(t?.is_ellipsis){const E=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:E,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=!!t?.is_me,A=typeof t?.user_id=="string"?t.user_id:null,F=ge(t?.display_name),ma=be(F)?Ee:F,L=w?I:ma,G=!!A,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>Y(A):void 0,onKeyDown:G?E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Y(A))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const E=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",E?"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",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",E&&"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($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!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]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ie,{badges:t?.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(xe,{value:t?.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:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${E?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:d("group transition-colors",G&&"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(le(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!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]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ie,{badges:t?.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(xe,{value:t?.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:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,u)=>{const w=ge(t?.display_name),A=be(w)?Ee:w;return e.jsx(Lr,{entry:t,entryIdx:u,name:t?.is_me?I:A,meLabel:I,currency:p,rate:j,orderedColumns:B,placeholder:ae,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${u}`)})})]}):O=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:s("leaderboard.empty")})});let se=null;return typeof U=="number"?se=na.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("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",t===P?"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:()=>M(t),disabled:v.loading,children:String(t)},`page-${t}`)):se=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.pagination.page_unknown",{page:String(P)})}),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-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-3.5 sm:mb-8 sm:grid-cols-[minmax(0,1fr)_auto] sm:gap-4",children:[e.jsx("h1",{className:"col-start-1 row-start-1 min-w-0 whitespace-nowrap text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:col-span-2 sm:row-start-1 sm:text-4xl",children:s("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?s("leaderboard.range.total"):Se&&Ce?s("leaderboard.range",{period:Pe,from:Se,to:Ce}):s("leaderboard.range_loading",{period:Pe}),V&&e.jsx("time",{dateTime:V.dateTime,title:s("leaderboard.generated_at",{ts:V.exact}),className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400 sm:inline-block",children:s("leaderboard.generated_at",{ts:V.display})})]}),e.jsx("div",{className:"col-start-2 row-start-1 inline-flex h-9 shrink-0 items-center rounded-full border border-oai-gray-200 p-1 dark:border-oai-gray-800 sm:col-start-1 sm:row-start-3 sm:justify-self-start",children:["week","month","total"].map(t=>{const u=N===t;return e.jsxs("button",{onClick:()=>oa(t),disabled:v.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:t==="week"?Te:t==="month"?Ae:Me}),u&&e.jsx(Ka.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}})]},t)})}),e.jsxs("div",{className:"col-span-2 row-start-2 mb-0 flex w-full min-w-0 items-center justify-between sm:justify-end gap-2.5 sm:col-span-1 sm:col-start-2 sm:row-start-3 sm:mb-0 sm:w-auto sm:shrink-0",children:[e.jsx(jr,{communityStats:Le,onClick:()=>je(!0)}),e.jsx(hr,{me:K,totalEntries:sa,meLabel:I,onOpenProfile:K?.user_id?()=>Y(K.user_id):void 0,onJumpToMe:da,canJump:z!=null&&!la&&!v.loading,className:"shrink-0"})]})]}),!r&&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:s("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:s("leaderboard.signin_button")})]}),g&&ee&&!ra&&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:s("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ca,disabled:Ne,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:Ne?s("leaderboard.sync_button.busy"):s("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&q?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:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:s("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:_,onValueChange:t=>ea(Number(t)),disabled:v.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:ce.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Ke&&!v.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:()=>M(t=>Math.max(1,t-1)),disabled:!Ke||v.loading,children:s("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",U||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:se}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Re&&!v.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:()=>M(t=>t+1),disabled:!Re||v.loading,children:s("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:s("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/xiufengsun/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:s("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(fr,{isOpen:!!ke,userId:ke,period:N,accessToken:C,onClose:Qe}),e.jsx(yr,{isOpen:Xe,onClose:()=>je(!1),communityStats:Le})]})]})}export{Zr as LeaderboardPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-DHvADX1d.js","assets/__vite-browser-external-4IGm4Djn.js","assets/__vite-browser-external-CCMdjCX2.css","assets/provider-display-yeNsVCO_.js","assets/useCurrency-B0YsRDj-.js","assets/useTokenFormat-PP3D0Ket.js","assets/maximize-2-B-2Pnj6g.js","assets/terminal-Ca7dkLMF.js","assets/info-CAjN3dX4.js","assets/LeaderboardAvatar-CQImCsPN.js","assets/ProviderIcon-BZZ45-gY.js","assets/AchievementBadge-Bb2ljquW.js","assets/zap-BVOm1aBH.js","assets/flame-DcYbLdhE.js","assets/AchievementsSection-_L6sCLTw.js","assets/react-DZqS6YTX.js","assets/format-tokens-CEvr3dNy.js","assets/use-reduced-motion-D_kUnDs4.js","assets/arrow-up-right-rpBCOTg2.js","assets/link-2-DaWH2Tyc.js","assets/check-DIKw7TYH.js","assets/DialogTitle-DfSBUjWf.js","assets/composite-_NeXO0lv.js","assets/store-Crne4DqF.js","assets/CommunityStatsModal-DJSezaPV.js","assets/icons-DaGMVsJ5.js","assets/TrendMonitor-BQzcllvg.js","assets/use-latest-request-guard-BLGbXQdf.js","assets/PopoverPopup-DXD_YdiB.js","assets/ToolbarRootContext-Bmg56vYz.js","assets/DialogDescription-KY7X94CG.js","assets/DialogClose-D1pLoZ56.js"])))=>i.map(i=>d[i]);
2
+ import{m as ua,j as e,d as xa,c as s,e as d,r as c,al as ga,f as ba,u as pa,a as ha,am as fa,J as ya,an as ka,ao as wa,ap as ze,aq as ja,ar as ne,g as va,as as Na,L as _a,at as Sa,l as Ca,au as La,av as Ea,a8 as Ta,_ as Fe,k as Aa,x as Ma}from"./__vite-browser-external-4IGm4Djn.js";import{S as Pa}from"./Select-BP8aVRZ1.js";import{m as Ka}from"./react-DZqS6YTX.js";import{u as Ra,C as Ia,a as za,b as Be,D as Ba,c as Da,S as $a,h as Ua,s as Oa,K as Fa,P as Ga}from"./sortable.esm-DDCnS1HI.js";import{r as Ha}from"./modifiers.esm-BoDOvUKl.js";import{P as he}from"./ProviderIcon-BZZ45-gY.js";import{u as Ya}from"./useCurrency-B0YsRDj-.js";import{u as Q}from"./useTokenFormat-PP3D0Ket.js";import{L as Z}from"./LeaderboardAvatar-CQImCsPN.js";import{s as Wa,c as Va,A as Ja,t as qa,b as Za}from"./AchievementBadge-Bb2ljquW.js";import{u as Xa}from"./use-ordered-list-BTfW5M9u.js";import{u as Qa}from"./use-community-stats-BHx2YxyK.js";import"./ToolbarRootContext-Bmg56vYz.js";import"./composite-_NeXO0lv.js";import"./check-DIKw7TYH.js";import"./SelectItemText-Odx47kND.js";import"./zap-BVOm1aBH.js";import"./flame-DcYbLdhE.js";const er=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ar=ua("arrow-right",er);function H(a,{min:r,max:o,fallback:n}){const l=Number(a);if(!Number.isFinite(l))return n;const i=Math.floor(l);return i<r?r:i>o?o:i}function rr(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),n=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,n-2,n-1,n,n+1,n+2]),i=Array.from(l).filter(x=>Number.isInteger(x)&&x>=1&&x<=o).sort((x,p)=>x-p),m=[];let b=null;for(const x of i)b!=null&&x-b>1&&m.push(null),m.push(x),b=x;return m}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,n=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,n||1):1e6,fallback:1}),i=l>1,m=o?l<n:!0;return{canPrev:i,canNext:m,safePage:l,safeTotal:n}}function or({entries:a,me:r,meLabel:o}){const n=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||n.some(m=>!!m?.is_me)?n:[{rank:l,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...n]}function sr(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.ceil(o/n)}const nr=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function ir({iconSrc:a,label:r}){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 ${nr.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ie=xa.memo(function({badges:r,max:o=3,className:n=""}){const l=Wa((r||[]).filter(i=>i&&Va.has(i.id)&&(i.tier||0)>=1)).slice(0,o);return l.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${n}`,children:l.map((i,m)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(Za(i.id,"name")),tier:s(`achievements.tier.${qa(i.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Ja,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),X=[{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}],Ge="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",He="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 le(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")}function de(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")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function lr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=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(le(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(de(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),X.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",n)})},l.key))]})}function dr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(n,l)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},l))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",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(Ge,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),X.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(lr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(dr,{index:o},o))})]})}function mr({id:a,thClassName:r,children:o}){const{attributes:n,listeners:l,setNodeRef:i,transform:m,transition:b,isDragging:x}=Ra({id:a}),p=Ia.Transform.toString(m)||"";c.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${a}"]`),h="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(g=>{g.style.transform=p,g.style.transition=b||"",g.style.zIndex=x?"20":"",g.style.position=p?"relative":"",g.style.boxShadow=x?h:""}),()=>{f.forEach(g=>{g.style.transform="",g.style.transition="",g.style.zIndex="",g.style.position="",g.style.boxShadow=""})}},[a,p,b,x]);const j={transform:p,transition:b,position:p?"relative":void 0,zIndex:x?20:void 0,boxShadow:x?"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:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...l,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",x&&"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"})]})}),o]})})}const ur="tokentracker.leaderboard.columnOrder.v1";function xr(a){return Xa(ur,a)}const gr=50;function br(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(o/n*100)))}function Ye(a){return typeof a=="string"?a.trim():""}function pr(a){const r=Ye(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:n,onJumpToMe:l,canJump:i,className:m}){const b=a&&typeof a.rank=="number"?a.rank:null;if(!b)return null;const x=Number(r)||0,p=br(b,x),j=Ye(a?.display_name),f=!j||pr(j)?o||"You":j,h=a?.user_id||f,g=n||(i?l:null),T=typeof g=="function",C=T?"button":"div",ee=T?{type:"button",onClick:g,"aria-label":s(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,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",T?"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]",m),children:[e.jsx(Z,{size:"sm",avatarUrl:a?.avatar_url,displayName:f,seed:h}),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:f}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",b.toLocaleString()]}),p!=null&&p<=gr&&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",p<=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:s("leaderboard.summary.percentile",{p:String(p)})}),T?e.jsx(ar,{"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 fr=c.lazy(()=>Fe(()=>import("./LeaderboardProfileModal-DHvADX1d.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(a=>({default:a.LeaderboardProfileModal}))),yr=c.lazy(()=>Fe(()=>import("./CommunityStatsModal-DJSezaPV.js"),__vite__mapDeps([24,1,2,15,25,5,10,26,4,27,7,28,23,22,29,6,17,11,12,13,21,30,31])).then(a=>({default:a.CommunityStatsModal}))),ce=[10,20,50,100],me=20,We="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return me;try{const a=window.localStorage.getItem(We),r=Number(a);if(ce.includes(r))return r}catch{}return me}function ue(a,r,o){const n=Number(a);if(!Number.isFinite(n)||n<=0)return"-";const l=Sa(r),i=r===Ma?n:n*o;return i>=1e3?`${l}${Math.round(i).toLocaleString()}`:i>=10?`${l}${Math.round(i)}`:`${l}${i.toFixed(2)}`}function wr(a){if(typeof a!="string"||!a.trim())return null;const r=new Date(a);if(!Number.isFinite(r.getTime()))return null;const o=Aa();return{dateTime:r.toISOString(),display:new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(r),exact:new Intl.DateTimeFormat(o,{dateStyle:"full",timeStyle:"long"}).format(r)}}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=Q();return e.jsx("span",{title:o(a),children:r(a)})}function jr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:n}=Q();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:s("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:e.jsx("span",{title:n(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("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.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:Ca(a.totalEntries)}),e.jsx("span",{className:"hidden sm:inline",children:(Number(a.totalEntries)||0).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.devs_chip")})]})]})}function De({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:n,formatTokensTooltip:l}=Q(),i=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",m=r?"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";return o.map(b=>e.jsx("td",{"data-column-key":b.key,title:l(a?.[b.key]),className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",i,m),children:n(a?.[b.key])},b.key))}function vr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const Nr={1:"ring-2 ring-amber-400 dark:ring-amber-500/80 shadow-[0_0_8px_rgba(245,158,11,0.25)]",2:"ring-2 ring-slate-350 dark:ring-slate-450 shadow-[0_0_8px_rgba(148,163,184,0.2)]",3:"ring-2 ring-orange-400 dark:ring-orange-500/70 shadow-[0_0_8px_rgba(249,115,22,0.25)]"};function _r({rank:a,placeholder:r}){return a===1?e.jsx("span",{className:"text-base font-extrabold italic text-amber-500 dark:text-amber-400 tracking-tighter",children:"1"}):a===2?e.jsx("span",{className:"text-base font-extrabold italic text-slate-400 dark:text-slate-350 tracking-tighter",children:"2"}):a===3?e.jsx("span",{className:"text-base font-extrabold italic text-orange-500 dark:text-orange-400 tracking-tighter",children:"3"}):e.jsx("span",{className:"text-[13px] font-bold tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:a==null?r:`#${a}`})}function Sr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(he,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:n}=Q(),l=r.filter(i=>{const m=Number(a?.[i.key]);return Number.isFinite(m)&&m>0});return l.length===0?null:e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-2 border-t border-oai-gray-100/70 pt-3 dark:border-oai-gray-800/60",children:l.map(i=>{const m=s(i.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${n(a?.[i.key])}`,className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-oai-gray-50/80 dark:bg-oai-gray-900/60 px-2 py-0.5 border border-oai-gray-100/80 dark:border-oai-gray-800/40 text-[10px] font-medium text-oai-gray-600 dark:text-oai-gray-300 transition-colors",children:[e.jsx(he,{provider:vr(i),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[i.key])})]},i.key)})})}function Lr({entry:a,entryIdx:r,name:o,meLabel:n,currency:l,rate:i,orderedColumns:m,placeholder:b,onOpenProfile:x}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,j=!p&&be(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,g=p?n:o,T=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),x(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>x(f):void 0,onKeyDown:h?T:void 0,"aria-label":h?s("leaderboard.profile_modal.row_aria",{name:g}):void 0,className:d("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",p?"bg-gradient-to-br from-oai-brand-50/70 via-oai-brand-50/20 to-transparent dark:from-oai-brand-950/20 dark:via-oai-brand-950/5 dark:to-transparent border-oai-brand-200/60 dark:border-oai-brand-500/25":j?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",h&&"cursor-pointer hover:border-oai-gray-200 dark:hover:border-oai-gray-700/80 active:scale-[0.985] active:bg-oai-gray-50/60 dark:active:bg-oai-gray-900/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(_r,{rank:a?.rank,placeholder:b})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:d("inline-flex rounded-full p-0.5 transition-all duration-300",Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(Z,{size:"md",avatarUrl:a?.avatar_url,displayName:g,seed:pe(a,g)})}),a?.github_url&&e.jsx(Sr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:d("min-w-0 truncate text-sm tracking-tight",p?"font-semibold text-oai-black dark:text-oai-white":j?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:g}),e.jsx(ie,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:s("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:ue(a?.estimated_cost_usd,l,i)})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.08em] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.column.total")}),e.jsx("div",{className:d("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",p?"text-oai-black dark:text-oai-white":j?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(xe,{value:a?.total_tokens})})]})]}),e.jsx(Cr,{entry:a,orderedColumns:m})]},`mobile-row-${a?.rank}-${g}`)}const Er={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 $e({rank:a,placeholder:r}){const o=Er[a];return o?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Ue(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Tr(a){if(!a)return s("shared.error.prefix",{error:s("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||s("leaderboard.error.unknown");return s("shared.error.prefix",{error:o})}function ge(a){return typeof a!="string"?"":a.trim()}function be(a){const r=ge(a);return r?r.toLowerCase()==="anonymous":!0}function pe(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Oe({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:r=>r.stopPropagation(),"aria-label":s("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(he,{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:s("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[s("leaderboard.github.tooltipPrefix")," ",e.jsx(_a,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:s("leaderboard.github.tooltipSettingsLink")})," ",s("leaderboard.github.tooltipSuffix")]})]})]})}function Zr({auth:a,signedIn:r,sessionSoftExpired:o}){const n=ga(),l=ba(),{openLoginModal:i}=pa(),{signedIn:m,loading:b,user:x}=ha(),{currency:p,rate:j}=Ya(),f=c.useMemo(()=>fa(),[]),h=ya(),g=r&&!o,T=c.useMemo(()=>g&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,g]),C=g?T:null,ee=g&&ka(C),ae=s("shared.placeholder.short"),Ve=c.useMemo(()=>X.map(t=>t.key),[]),{order:re,reorder:fe}=xr(Ve),ye=c.useMemo(()=>{const t=new Map;for(const u of X)t.set(u.key,u);return t},[]),B=c.useMemo(()=>re.map(t=>ye.get(t)).filter(Boolean),[re,ye]),Je=za(Be(Ga,{activationConstraint:{distance:6}}),Be(Fa,{coordinateGetter:Oa})),qe=c.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||fe(String(u.id),String(w.id))},[fe]),[te,M]=c.useState(1),[_,Ze]=c.useState(kr),[ke,we]=c.useState(null),[Xe,je]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&we(t.trim())},[]),Qe=c.useCallback(()=>we(null),[]),ea=c.useCallback(t=>{const u=ce.includes(t)?t:me;Ze(u),M(1);try{window.localStorage.setItem(We,String(u))}catch{}},[]),[ve,aa]=c.useState(0),[ra,ta]=c.useState(()=>wa()),[Ne,_e]=c.useState(!1);c.useEffect(()=>{if(typeof window>"u")return;const t=()=>{aa(u=>u+1)};return window.addEventListener(ze,t),()=>{window.removeEventListener(ze,t)}},[]);const N=c.useMemo(()=>{const t=new URLSearchParams(n?.search||"");return Ue(t.get("period"))||"total"},[n?.search]),oa=t=>{const u=Ue(t);if(!u||u===N)return;const w=new URLSearchParams(n?.search||"");w.set("period",u),M(1),l(`${n?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{b||h||m||i()},[m,b,h,i]),c.useEffect(()=>{M(1)},[N]);const W=c.useMemo(()=>(H(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),R=c.useMemo(()=>h?"mock":b?"unavailable":m?"cloud":r?"local":f?"public":"unavailable",[b,m,f,h,r]),k=c.useMemo(()=>ja({accessMode:R,baseUrl:f,mockEnabled:h,userId:x?.id||null,period:N,pageSize:_,offset:W}),[x?.id,R,f,W,h,_,N]),[D,$]=c.useState(()=>{const t=ne(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!f&&!h||!h&&R==="unavailable"){$({loading:!1,error:null,data:null,contextKey:null});return}const t=ne(k);let u=!0;return $(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await va({userId:x?.id||null,period:N,limit:_,offset:W});u&&(Na(w,{activeContextKey:k,contextKey:k,source:ve>0?"manual-refresh":"page-load"}),$({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!u)return;const A=Tr(w);$(F=>F.contextKey===k?{...F,loading:!1,error:A}:{loading:!1,error:A,data:null,contextKey:k})}),()=>{u=!1}},[f,R,x?.id,k,W,ve,h,N,_]);const oe=c.useMemo(()=>D.contextKey===k?null:ne(k),[k,D.contextKey]),v=c.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(f||h)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,f,k,D,h,oe]),S=v.data,U=S?.total_pages??null,sa=S?.total_entries??0,P=S?.page??te,na=c.useMemo(()=>rr(P,U),[P,U]),Se=S?.from||null,Ce=S?.to||null,ia=S?.generated_at||null,V=wr(ia),Le=Qa(),K=S?.me||null,I=s("leaderboard.me_label"),Ee=s("leaderboard.anon_label"),Te=s("leaderboard.period.week"),Ae=s("leaderboard.period.month"),Me=s("leaderboard.period.total"),Pe=N==="month"?Ae:N==="total"?Me:Te,J=c.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:K,meLabel:I})},[S?.entries,K,I]),z=c.useMemo(()=>sr(K?.rank,_),[K?.rank,_]),la=z!=null&&z===P,da=c.useCallback(()=>{z!=null&&M(z)},[z]),ca=async()=>{_e(!0);try{La(!0),ta(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{_e(!1)}},{canPrev:Ke,canNext:Re}=tr({page:P,totalPages:U}),q=Array.isArray(J)&&J.length!==0;let O=null;v.loading&&!q?O=e.jsx(cr,{rows:_}):v.error&&!q?O=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:v.error})}):q?O=e.jsxs(Ba,{sensors:Je,collisionDetection:Da,modifiers:[Ha],onDragEnd:qe,children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",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(Ge,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.rank")}),e.jsx("th",{className:d(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("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:s("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:s("leaderboard.column.est_cost")}),e.jsx($a,{items:re,strategy:Ua,children:B.map(t=>e.jsx(mr,{id:t.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(ir,{iconSrc:t.icon,label:s(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:J.map((t,u)=>{if(t?.is_ellipsis){const E=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:E,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=!!t?.is_me,A=typeof t?.user_id=="string"?t.user_id:null,F=ge(t?.display_name),ma=be(F)?Ee:F,L=w?I:ma,G=!!A,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>Y(A):void 0,onKeyDown:G?E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Y(A))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const E=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",E?"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",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",E&&"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($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!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]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ie,{badges:t?.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(xe,{value:t?.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:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${E?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:d("group transition-colors",G&&"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(le(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!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]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ie,{badges:t?.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(xe,{value:t?.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:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,u)=>{const w=ge(t?.display_name),A=be(w)?Ee:w;return e.jsx(Lr,{entry:t,entryIdx:u,name:t?.is_me?I:A,meLabel:I,currency:p,rate:j,orderedColumns:B,placeholder:ae,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${u}`)})})]}):O=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:s("leaderboard.empty")})});let se=null;return typeof U=="number"?se=na.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("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",t===P?"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:()=>M(t),disabled:v.loading,children:String(t)},`page-${t}`)):se=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.pagination.page_unknown",{page:String(P)})}),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-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-3.5 sm:mb-8 sm:grid-cols-[minmax(0,1fr)_auto] sm:gap-4",children:[e.jsx("h1",{className:"col-start-1 row-start-1 min-w-0 whitespace-nowrap text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:col-span-2 sm:row-start-1 sm:text-4xl",children:s("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?s("leaderboard.range.total"):Se&&Ce?s("leaderboard.range",{period:Pe,from:Se,to:Ce}):s("leaderboard.range_loading",{period:Pe}),V&&e.jsx("time",{dateTime:V.dateTime,title:s("leaderboard.generated_at",{ts:V.exact}),className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400 sm:inline-block",children:s("leaderboard.generated_at",{ts:V.display})})]}),e.jsx("div",{className:"col-start-2 row-start-1 inline-flex h-9 shrink-0 items-center rounded-full border border-oai-gray-200 p-1 dark:border-oai-gray-800 sm:col-start-1 sm:row-start-3 sm:justify-self-start",children:["week","month","total"].map(t=>{const u=N===t;return e.jsxs("button",{onClick:()=>oa(t),disabled:v.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:t==="week"?Te:t==="month"?Ae:Me}),u&&e.jsx(Ka.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}})]},t)})}),e.jsxs("div",{className:"col-span-2 row-start-2 mb-0 flex w-full min-w-0 items-center justify-between sm:justify-end gap-2.5 sm:col-span-1 sm:col-start-2 sm:row-start-3 sm:mb-0 sm:w-auto sm:shrink-0",children:[e.jsx(jr,{communityStats:Le,onClick:()=>je(!0)}),e.jsx(hr,{me:K,totalEntries:sa,meLabel:I,onOpenProfile:K?.user_id?()=>Y(K.user_id):void 0,onJumpToMe:da,canJump:z!=null&&!la&&!v.loading,className:"shrink-0"})]})]}),!r&&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:s("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:s("leaderboard.signin_button")})]}),g&&ee&&!ra&&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:s("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ca,disabled:Ne,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:Ne?s("leaderboard.sync_button.busy"):s("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&q?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:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:s("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:_,onValueChange:t=>ea(Number(t)),disabled:v.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:ce.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Ke&&!v.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:()=>M(t=>Math.max(1,t-1)),disabled:!Ke||v.loading,children:s("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",U||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:se}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Re&&!v.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:()=>M(t=>t+1),disabled:!Re||v.loading,children:s("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:s("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/xiufengsun/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:s("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(fr,{isOpen:!!ke,userId:ke,period:N,accessToken:C,onClose:Qe}),e.jsx(yr,{isOpen:Xe,onClose:()=>je(!1),communityStats:Le})]})]})}export{Zr as LeaderboardPage};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-C7WsIRy9.js","assets/__vite-browser-external-DPOlUkcY.js","assets/__vite-browser-external-CCMdjCX2.css","assets/react-DKXriBSF.js","assets/AchievementBadge-DtB1MwFe.js","assets/zap-Du1IyEtj.js","assets/flame-DubukWqK.js","assets/use-transform-UjIt477N.js","assets/use-reduced-motion-DdpxZQoh.js","assets/AchievementsSection-CDl9hsbj.js","assets/format-tokens-B70EdQcN.js","assets/DialogTitle-C4ia00lc.js","assets/composite-BDwOlhhX.js","assets/store-8e16Ac2h.js"])))=>i.map(i=>d[i]);
2
- import{m as te,a as E,r as h,a6 as se,j as e,c as o,a7 as ie,G as oe,I as ne,a8 as le,a9 as de,e as c,O as ce,W as me,L as xe,d as W,$ as ge,n as pe,aa as he,X as ue,l as fe,_ as be,a4 as ye,ab as ke}from"./__vite-browser-external-DPOlUkcY.js";import{A as ve,f as je}from"./provider-display-CGsFySs6.js";import{u as Ne}from"./useCurrency-CnM8aB4v.js";import{u as G}from"./useTokenFormat-D4pAK2ld.js";import{L as Z}from"./LeaderboardAvatar-DRYeMNlq.js";import{P as L}from"./ProviderIcon-By8FAjxR.js";import{H as _e,A as X,s as we,c as Ae,b as Se,t as Me,h as ze}from"./AchievementBadge-DtB1MwFe.js";import{A as Ce}from"./AchievementsSection-CDl9hsbj.js";import{A as B}from"./arrow-up-right-DSsR3Ntr.js";import{L as Ie}from"./link-2-BQp7-3T7.js";import{C as Pe}from"./check-Cy35lAKh.js";import{D as Te,a as De,b as $e,c as Le,d as Be,e as Ue}from"./DialogTitle-C4ia00lc.js";import"./maximize-2-Cnd_Oth8.js";import"./terminal-CR228ekj.js";import"./info-BzFpLbl6.js";import"./zap-Du1IyEtj.js";import"./flame-DubukWqK.js";import"./react-DKXriBSF.js";import"./format-tokens-B70EdQcN.js";import"./use-reduced-motion-DdpxZQoh.js";import"./composite-BDwOlhhX.js";import"./store-8e16Ac2h.js";const Fe=[["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"}]],Re=te("code-xml",Fe),U="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 R(){if(A)return A;try{let a=localStorage.getItem(U);return a||(a=F(),localStorage.setItem(U,a)),A=a,a}catch{return A=F(),A}}function Y({userId:a}){const{signedIn:r,getAccessToken:i}=E(),[t,s]=h.useState(!1),[l,g]=h.useState(0),[n,x]=h.useState(!1),[u,f]=h.useState(!1),[S,M]=h.useState(!1),[z,T]=h.useState([]),[j,N]=h.useState(!1),C=h.useRef(0),y=h.useCallback(async()=>{if(r)try{const d=await i();if(d)return{accessToken:d,anonId:R()}}catch{}return{anonId:R()}},[r,i]);h.useEffect(()=>{let d=!1;return a?(x(!1),(async()=>{const m=await y();try{const p=await se({userId:a,...m});if(d)return;g(Number(p?.count)||0),s(!!p?.liked),x(!0)}catch{if(d)return;g(0),s(!1),x(!0)}})(),()=>{d=!0}):(x(!1),()=>{d=!0})},[a,y]);const k=()=>{M(!0),setTimeout(()=>M(!1),450),N(!0),setTimeout(()=>N(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let b=0;b<12;b++){const v=(b*30+Math.random()*20-10)*(Math.PI/180),I=45+Math.random()*45,q=Math.cos(v)*I,V=Math.sin(v)*I-(10+Math.random()*15),J=Math.random()*360-180,Q=6+Math.random()*8,ee=d[Math.floor(Math.random()*d.length)],ae=m[Math.floor(Math.random()*m.length)],re=++C.current;p.push({id:re,tx:q,ty:V,rot:J,size:Q,color:ee,shape:ae})}T(b=>[...b,...p]),setTimeout(()=>{T(b=>b.filter(v=>!p.find(I=>I.id===v.id)))},850)},_=async d=>{f(!0);try{const m=await y(),p=await ie({userId:a,action:d,...m});p&&Number.isFinite(Number(p.count))&&g(Number(p.count)),p&&typeof p.liked=="boolean"&&s(p.liked)}catch{s(m=>!m),g(m=>d==="like"?Math.max(0,m-1):m+1)}finally{f(!1)}},w=d=>{d.stopPropagation(),!(!a||!n||u)&&(t?(s(!1),g(m=>Math.max(0,m-1)),_("unlike")):(s(!0),g(m=>m+1),k(),_("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-B9n_-45B.js","assets/__vite-browser-external-4IGm4Djn.js","assets/__vite-browser-external-CCMdjCX2.css","assets/react-DZqS6YTX.js","assets/AchievementBadge-Bb2ljquW.js","assets/zap-BVOm1aBH.js","assets/flame-DcYbLdhE.js","assets/use-transform-Bp5XrwaQ.js","assets/use-reduced-motion-D_kUnDs4.js","assets/AchievementsSection-_L6sCLTw.js","assets/format-tokens-CEvr3dNy.js","assets/DialogTitle-DfSBUjWf.js","assets/composite-_NeXO0lv.js","assets/store-Crne4DqF.js"])))=>i.map(i=>d[i]);
2
+ import{m as te,a as E,r as h,a6 as se,j as e,c as o,a7 as ie,G as oe,I as ne,a8 as le,a9 as de,e as c,O as ce,W as me,L as xe,d as W,$ as ge,n as pe,aa as he,X as ue,l as fe,_ as be,a4 as ye,ab as ke}from"./__vite-browser-external-4IGm4Djn.js";import{A as ve,f as je}from"./provider-display-yeNsVCO_.js";import{u as Ne}from"./useCurrency-B0YsRDj-.js";import{u as G}from"./useTokenFormat-PP3D0Ket.js";import{L as Z}from"./LeaderboardAvatar-CQImCsPN.js";import{P as L}from"./ProviderIcon-BZZ45-gY.js";import{H as _e,A as X,s as we,c as Ae,b as Se,t as Me,h as ze}from"./AchievementBadge-Bb2ljquW.js";import{A as Ce}from"./AchievementsSection-_L6sCLTw.js";import{A as B}from"./arrow-up-right-rpBCOTg2.js";import{L as Ie}from"./link-2-DaWH2Tyc.js";import{C as Pe}from"./check-DIKw7TYH.js";import{D as Te,a as De,b as $e,c as Le,d as Be,e as Ue}from"./DialogTitle-DfSBUjWf.js";import"./maximize-2-B-2Pnj6g.js";import"./terminal-Ca7dkLMF.js";import"./info-CAjN3dX4.js";import"./zap-BVOm1aBH.js";import"./flame-DcYbLdhE.js";import"./react-DZqS6YTX.js";import"./format-tokens-CEvr3dNy.js";import"./use-reduced-motion-D_kUnDs4.js";import"./composite-_NeXO0lv.js";import"./store-Crne4DqF.js";const Fe=[["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"}]],Re=te("code-xml",Fe),U="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 R(){if(A)return A;try{let a=localStorage.getItem(U);return a||(a=F(),localStorage.setItem(U,a)),A=a,a}catch{return A=F(),A}}function Y({userId:a}){const{signedIn:r,getAccessToken:i}=E(),[t,s]=h.useState(!1),[l,g]=h.useState(0),[n,x]=h.useState(!1),[u,f]=h.useState(!1),[S,M]=h.useState(!1),[z,T]=h.useState([]),[j,N]=h.useState(!1),C=h.useRef(0),y=h.useCallback(async()=>{if(r)try{const d=await i();if(d)return{accessToken:d,anonId:R()}}catch{}return{anonId:R()}},[r,i]);h.useEffect(()=>{let d=!1;return a?(x(!1),(async()=>{const m=await y();try{const p=await se({userId:a,...m});if(d)return;g(Number(p?.count)||0),s(!!p?.liked),x(!0)}catch{if(d)return;g(0),s(!1),x(!0)}})(),()=>{d=!0}):(x(!1),()=>{d=!0})},[a,y]);const k=()=>{M(!0),setTimeout(()=>M(!1),450),N(!0),setTimeout(()=>N(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let b=0;b<12;b++){const v=(b*30+Math.random()*20-10)*(Math.PI/180),I=45+Math.random()*45,q=Math.cos(v)*I,V=Math.sin(v)*I-(10+Math.random()*15),J=Math.random()*360-180,Q=6+Math.random()*8,ee=d[Math.floor(Math.random()*d.length)],ae=m[Math.floor(Math.random()*m.length)],re=++C.current;p.push({id:re,tx:q,ty:V,rot:J,size:Q,color:ee,shape:ae})}T(b=>[...b,...p]),setTimeout(()=>{T(b=>b.filter(v=>!p.find(I=>I.id===v.id)))},850)},_=async d=>{f(!0);try{const m=await y(),p=await ie({userId:a,action:d,...m});p&&Number.isFinite(Number(p.count))&&g(Number(p.count)),p&&typeof p.liked=="boolean"&&s(p.liked)}catch{s(m=>!m),g(m=>d==="like"?Math.max(0,m-1):m+1)}finally{f(!1)}},w=d=>{d.stopPropagation(),!(!a||!n||u)&&(t?(s(!1),g(m=>Math.max(0,m-1)),_("unlike")):(s(!0),g(m=>m+1),k(),_("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
3
3
  @keyframes tt-like-pop {
4
4
  0% { transform: scale(1); }
5
5
  25% { transform: scale(0.75); }
@@ -39,7 +39,7 @@ import{m as te,a as E,r as h,a6 as se,j as e,c as o,a7 as ie,G as oe,I as ne,a8
39
39
  .tt-num-anim {
40
40
  animation: tt-num-scroll 0.25s ease-out forwards;
41
41
  }
42
- `}}),z.map(d=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${d.tx}px`,"--ty":`${d.ty}px`,"--rot":`${d.rot}deg`,width:`${d.size}px`,height:`${d.size}px`,backgroundColor:d.shape==="circle"?d.color:"transparent",borderRadius:d.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:d.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:d.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"})})},d.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!n||u,"aria-label":t?o("leaderboard.profile.like.aria_unlike"):o("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:S?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(_e,{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"} ${j?"tt-num-anim":""}`,children:n?l:"·"})]})]})}function Oe({badge:a,badgeLabel:r,className:i="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${i}`,children:[e.jsx(Z,{...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(X,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function He({badges:a,isOwn:r=!1,onSelect:i,className:t=""}){const s=we((Array.isArray(a)?a:[]).filter(l=>l&&Ae.has(l.id))).filter(l=>r||(l.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((l,g)=>{const n=(l.tier||0)>=1,x=o(Se(l.id,"name")),u=n?o(`achievements.tier.${Me(l.tier)}`):o("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:i?()=>i(l):void 0,title:`${x} · ${u}`,"aria-label":o("achievements.badge.aria",{name:x,tier:u}),style:{zIndex:s.length-g},className:"group relative shrink-0 -mr-2.5 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(X,{badgeId:l.id,tier:l.tier,locked:!n,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},l.id)})})}const Ee=W.lazy(()=>be(()=>import("./BadgeDetailModal-C7WsIRy9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function We(a,r,i){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:ye(t,{decimals:2,currency:r,rate:i})}function O(a,r,i){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return We(t,r,i);const s=r==="USD"?t:t*(i||1);return`${r==="USD"?"$":""}${fe(s,{decimals:1})}`}function Ge(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const i=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return he({dailyRows:i,weeks:52,to:t})}const Ze=`
42
+ `}}),z.map(d=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${d.tx}px`,"--ty":`${d.ty}px`,"--rot":`${d.rot}deg`,width:`${d.size}px`,height:`${d.size}px`,backgroundColor:d.shape==="circle"?d.color:"transparent",borderRadius:d.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:d.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:d.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"})})},d.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!n||u,"aria-label":t?o("leaderboard.profile.like.aria_unlike"):o("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:S?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(_e,{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"} ${j?"tt-num-anim":""}`,children:n?l:"·"})]})]})}function Oe({badge:a,badgeLabel:r,className:i="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${i}`,children:[e.jsx(Z,{...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(X,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function He({badges:a,isOwn:r=!1,onSelect:i,className:t=""}){const s=we((Array.isArray(a)?a:[]).filter(l=>l&&Ae.has(l.id))).filter(l=>r||(l.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((l,g)=>{const n=(l.tier||0)>=1,x=o(Se(l.id,"name")),u=n?o(`achievements.tier.${Me(l.tier)}`):o("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:i?()=>i(l):void 0,title:`${x} · ${u}`,"aria-label":o("achievements.badge.aria",{name:x,tier:u}),style:{zIndex:s.length-g},className:"group relative shrink-0 -mr-2.5 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(X,{badgeId:l.id,tier:l.tier,locked:!n,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},l.id)})})}const Ee=W.lazy(()=>be(()=>import("./BadgeDetailModal-B9n_-45B.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function We(a,r,i){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:ye(t,{decimals:2,currency:r,rate:i})}function O(a,r,i){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return We(t,r,i);const s=r==="USD"?t:t*(i||1);return`${r==="USD"?"$":""}${fe(s,{decimals:1})}`}function Ge(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const i=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return he({dailyRows:i,weeks:52,to:t})}const Ze=`
43
43
  @keyframes tt-shimmer {
44
44
  100% { transform: translateX(100%); }
45
45
  }
@@ -1,4 +1,4 @@
1
- import{r as _,j as p,a0 as xe,u as ge,a as ve,W as be,L as Tt,a1 as we,c as Y,a2 as ye}from"./__vite-browser-external-DPOlUkcY.js";import{u as ke}from"./useCurrency-CnM8aB4v.js";import{H as Me}from"./HeaderGithubStar-Cnr3aqcX.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-Dfg0V13F.js";import{D as Te}from"./download-DdGW6Krz.js";import"./provider-display-CGsFySs6.js";import"./useTokenFormat-D4pAK2ld.js";import"./maximize-2-Cnd_Oth8.js";import"./terminal-CR228ekj.js";import"./info-BzFpLbl6.js";import"./LeaderboardAvatar-DRYeMNlq.js";import"./ProviderIcon-By8FAjxR.js";import"./AchievementBadge-DtB1MwFe.js";import"./zap-Du1IyEtj.js";import"./flame-DubukWqK.js";import"./AchievementsSection-CDl9hsbj.js";import"./react-DKXriBSF.js";import"./format-tokens-B70EdQcN.js";import"./use-reduced-motion-DdpxZQoh.js";import"./arrow-up-right-DSsR3Ntr.js";import"./link-2-BQp7-3T7.js";import"./check-Cy35lAKh.js";import"./DialogTitle-C4ia00lc.js";import"./composite-BDwOlhhX.js";import"./store-8e16Ac2h.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
1
+ import{r as _,j as p,a0 as xe,u as ge,a as ve,W as be,L as Tt,a1 as we,c as Y,a2 as ye}from"./__vite-browser-external-4IGm4Djn.js";import{u as ke}from"./useCurrency-B0YsRDj-.js";import{H as Me}from"./HeaderGithubStar-EJLBwEqp.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-DHvADX1d.js";import{D as Te}from"./download-DM1W9pIW.js";import"./provider-display-yeNsVCO_.js";import"./useTokenFormat-PP3D0Ket.js";import"./maximize-2-B-2Pnj6g.js";import"./terminal-Ca7dkLMF.js";import"./info-CAjN3dX4.js";import"./LeaderboardAvatar-CQImCsPN.js";import"./ProviderIcon-BZZ45-gY.js";import"./AchievementBadge-Bb2ljquW.js";import"./zap-BVOm1aBH.js";import"./flame-DcYbLdhE.js";import"./AchievementsSection-_L6sCLTw.js";import"./react-DZqS6YTX.js";import"./format-tokens-CEvr3dNy.js";import"./use-reduced-motion-D_kUnDs4.js";import"./arrow-up-right-rpBCOTg2.js";import"./link-2-DaWH2Tyc.js";import"./check-DIKw7TYH.js";import"./DialogTitle-DfSBUjWf.js";import"./composite-_NeXO0lv.js";import"./store-Crne4DqF.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
2
2
  attribute vec2 a_position;
3
3
  void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
4
4
  `,Ge=`
@@ -0,0 +1,6 @@
1
+ import{m as V,j as e,e as Ce,c as r,k as re,r as x,Q as Je,B as W,aw as Qe,d as C,h as Ze,J as ke,L as et,ax as tt,q as at,ac as rt}from"./__vite-browser-external-4IGm4Djn.js";import{m as ve}from"./react-DZqS6YTX.js";import{P as xe,c as it,r as ie,a as nt,u as st,b as ot,s as lt}from"./use-usage-limits-BmqRcyhH.js";import{L as j,u as ct}from"./use-limits-display-prefs-DBkAp6ob.js";import{C as Te}from"./Card-aSp259T0.js";import{F as dt}from"./FadeIn-DBn4L_BV.js";import{L as De,l as ee,a as Ee}from"./limits-providers-jn7Yln_V.js";import{P as Ie}from"./ProviderIcon-BZZ45-gY.js";import{H as ut}from"./HoverTooltip-DaSrZhYd.js";import{C as mt}from"./ConfirmModal-CVjmhZd6.js";import{I as je,L as xt}from"./LocalOnlyNotice-Cmnvu9tI.js";import{S as ce}from"./Select-BP8aVRZ1.js";import{P as pt}from"./plus-DIc1YUWB.js";import{P as gt,a as ht,b as ft,c as bt,d as yt}from"./PopoverPopup-DXD_YdiB.js";import{u as kt}from"./use-reduced-motion-D_kUnDs4.js";import"./use-latest-request-guard-BLGbXQdf.js";import"./DialogTitle-DfSBUjWf.js";import"./composite-_NeXO0lv.js";import"./store-Crne4DqF.js";import"./DialogDescription-KY7X94CG.js";import"./arrow-up-right-rpBCOTg2.js";import"./download-DM1W9pIW.js";import"./ToolbarRootContext-Bmg56vYz.js";import"./check-DIKw7TYH.js";import"./SelectItemText-Odx47kND.js";const vt=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],jt=V("bell-off",vt);const wt=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Nt=V("bell",wt);const _t=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],Re=V("calendar-clock",_t);const Mt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],Ae=V("clock",Mt);const Pt=[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]],Oe=V("infinity",Pt),St=[3,2,3,3,2,2,3];function R({className:t}){return e.jsx("div",{className:Ce("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function Ct(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-3 w-12 shrink-0"}),e.jsx(R,{className:"flex-1 h-1.5 rounded-full min-w-0"}),e.jsx(R,{className:"h-3 w-[30px] shrink-0"}),e.jsx(R,{className:"h-3 w-6 shrink-0"})]})}function Tt({bars:t,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(R,{className:"h-[14px] w-[14px] rounded shrink-0"}),e.jsx(R,{className:Ce("h-4",i)})]}),Array.from({length:t},(s,n)=>e.jsx(Ct,{},n))]})}function Dt(){return e.jsx(Te,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(R,{className:"h-3.5 w-28"}),St.map((t,a)=>e.jsx(Tt,{bars:t,index:a},a))]})})}const pe=100;function we(t){const a=Date.parse(t);return Number.isFinite(a)?a:null}function Et(t){return Math.max(0,Math.min(pe,Math.round(t)))}function It(t){return new Intl.DateTimeFormat(re(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t))}function Rt(t,a,i){if(t==null||t>=a)return pe;const s=a-t,n=a-i;return Et(n/s*pe)}function At(t){const a=t.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Ot(t,{now:a}={}){if(!t||typeof t!="object")return null;const i=At(t);if(i===void 0)return null;const s=Array.isArray(t.credits)?t.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),o=[];for(const l of s){const c=we(l?.expires_at);if(c==null)continue;const d=o.length+1;o.push({key:`reset-${d}`,label:r("limits.codex_reset_bank.row_label",{index:d}),expiresAt:It(c),expiresMs:c,percent:Rt(we(l?.granted_at),c,n)})}return i===0?null:o.length>0?{kind:"rows",availableCount:i??o.length,rows:o}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const z=864e5;function A(t,a){const i=new Date(t),s=i.getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()+a,1,i.getUTCHours(),i.getUTCMinutes())),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(s,o)),n.getTime()}function Fe(t,a){if(a==="weekly")return t-7*z;if(a==="yearly")return A(t,-12);const i=new Date(t),s=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),0)).getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()-1,1,i.getUTCHours(),i.getUTCMinutes()));return n.setUTCDate(Math.min(i.getUTCDate(),s)),n.getTime()}function Le(t,a){return a==="weekly"?t+7*z:a==="yearly"?A(t,12):A(t,1)}function Ft(t){if(t.startedAt!=null){const a=new Date(t.startedAt).getTime();if(Number.isFinite(a))return a}return Fe(new Date(t.nextBillingAt).getTime(),t.cycle)}function Lt(t,a,i){if(t.startedAt!=null){const s=new Date(t.startedAt).getTime();if(Number.isFinite(s))return s}return Fe(i,a)}function Ht(t,a,i){if(a==="weekly"){const c=7*z,d=i<=t?0:Math.floor((i-t)/c);return{startMs:t+d*c,endMs:t+(d+1)*c}}const s=a==="yearly"?12:1,n=s*30.436875*z;let o=i<=t?0:Math.floor((i-t)/n);for(;o>0&&A(t,o*s)>i;)o-=1;let l=0;for(;A(t,(o+1)*s)<=i&&l<12e3;)o+=1,l+=1;return{startMs:A(t,o*s),endMs:A(t,(o+1)*s)}}function te(t,a){const i=new Date(t.nextBillingAt).getTime();if(!Number.isFinite(i))return null;const s=["weekly","monthly","yearly"].includes(t.cycle)?t.cycle:"monthly",n=Lt(t,s,i);if(!Number.isFinite(n))return null;let o,l,c=!1;t.autoRenew?{startMs:o,endMs:l}=Ht(n,s,a):t.startedAt!=null?(o=n,l=Le(n,s),c=l<=a):(o=n,l=i,c=l<=a);const d=Math.max(1,l-o),m=c?1:Math.max(0,Math.min(1,(a-o)/d));return{endMs:l,startMs:o,progress:m,cycleDays:Math.max(1,Math.round(d/z)),expired:c}}function He(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.ceil(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function ge(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.floor(i/6e4),n=Math.floor(s/1440),o=Math.floor(s%1440/60),l=s%60;return r("subscriptions.countdown",{days:n,hours:o,minutes:l})}const $t="shrink-0 text-oai-black dark:text-oai-white";function Ut(t){const a=ie(t);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const s=Math.floor(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function Bt(t,a){const i=a===j.REMAINING?100-t:t;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function ae(t,a="used_percent"){return t?a==="utilization"?t.utilization:t.used_percent:null}function ne(t,a="reset_at"){return t?a==="resets_at"?t.resets_at:t.reset_at:null}function de(t){const a=Math.max(0,Math.min(100,Number(t)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function Z(t,{useGrouping:a=!0,maximumFractionDigits:i}={}){const s=Number(t);return Number.isFinite(s)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:i??(s>=100?0:2),useGrouping:a}).format(s):null}function Gt(t){if(!t||typeof t!="object"||!(Number(t.limit_credits)>0))return null;const a={useGrouping:t.unit!=="calls"},i=Z(t.used_credits,a),s=Z(t.limit_credits,a),n=Z(t.remaining_credits,a);if(!i||!s||!n)return null;const o=t.unit==="calls"?"limits.qoder_calls.detail":"limits.codex_credits.detail";return r(o,{used:i,limit:s,remaining:n})}function Wt(t,a){return it({usedPercent:ae(t.window,t.pctField),windowSeconds:nt(t,t.window),resetMs:ie(ne(t.window,t.resetField)),mode:a})}function $e(t){return Number.isFinite(t)?new Intl.DateTimeFormat(re(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):null}function qt(t,a,i){const s=[Be(t,a,i)],n=ie(ne(t.window,t.resetField)),o=$e(n);o&&s.push(r(t.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:o}));const l=Gt(t.window);return l&&s.push(l),s.join(`
2
+ `)}const Ue=ut;function zt({label:t,pct:a,reset:i,mode:s=j.USED,pacePercent:n=null,paceOver:o=!1,title:l=null}){const c=Math.max(0,Math.min(100,Number(a)||0)),d=s===j.REMAINING?100-c:c,m=Math.round(d),g=d>0&&m===0?Math.max(d,.35):d;let h=String(m);d>0&&m===0&&(h=r("limits.bar.sub_one_percent"));const b=n==null?null:Math.max(0,Math.min(100,n));return e.jsxs("div",{className:"group relative flex items-center gap-2",children:[e.jsx(Ue,{text:l}),e.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t}),e.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[e.jsx("div",{className:`${Bt(d,s)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${g}%`,minWidth:d>0?"3px":0}}),b!=null&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${b}% - 3px)`,width:"6px"}}),e.jsx("div",{className:`absolute top-0 h-full ${o?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${b}% - 1px)`,width:"2px"}})]})]}),e.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[h,"%"]}),i&&e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i})]})}function Be(t,a,i){const s=t.label??r(t.labelKey),n=i===j.REMAINING,o=d=>n?100-d:d;if(a.expectedPercent==null){const d=Math.max(0,Math.min(100,Number(ae(t.window,t.pctField))||0)),m=de(o(d));return n?r("limits.explain.remaining",{label:s,used:m}):r("limits.explain.used",{label:s,used:m})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:s,eta:a.runsOutEta});const d=de(o(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:s,pct:d})}const l=Math.max(0,Math.min(100,Number(ae(t.window,t.pctField))||0)),c=de(o(a.projectedEnd??l));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:s,pct:c})}function Vt({pace:t}){return t.pacePercent!=null}function Yt({rows:t,mode:a,now:i=Date.now()}){if(t.length===0)return null;const s=a===j.REMAINING,n=t.some(Vt);return e.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[t.map(({spec:o,pace:l})=>{const c=$e(ie(ne(o.window,o.resetField)));return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[Be(o,l,a),c?e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r(o.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:c})]}):null]},o.key)}),n?e.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:r(s?"limits.explain.body_remaining":"limits.explain.body")}):null]})}function q(t){if(!t)return null;const a=Date.now()-new Date(t).getTime();if(a<0)return null;const i=Math.floor(a/6e4);if(i<1)return r("shared.time.now");if(i<60)return r("shared.time.m_ago",{n:i});const s=Math.floor(i/60);if(s<24)return r("shared.time.h_ago",{n:s});const n=Math.floor(s/24);return r("shared.time.d_ago",{n})}const Ne={live:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-emerald-500",pulse:"bg-emerald-400"},stale:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"},cached:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"}},Kt={claude:"claude",codex:"codex"};function H({label:t,age:a=null,tone:i="live",tooltip:s=null}){const n=Ne[i]||Ne.live,o=i==="live";return e.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider border leading-normal ${n.surface}`,children:[o?e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),e.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),t,a?e.jsxs(e.Fragment,{children:[" · ",a]}):null]}),s?e.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[s,e.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]}):null]})}function Ge({name:t,providerId:a,children:i,expandable:s=!1,expanded:n=!1,onToggle:o,badge:l=null,rightAdornment:c=null}){const d=Ee(a),m=e.jsxs("div",{className:"flex items-center gap-1.5",children:[d?e.jsx(Ie,{provider:d,size:14,className:$t}):null,e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:t}),c?e.jsx("span",{className:"shrink-0",children:c}):null,l]});return s?e.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:o,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),o?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[m,i]}):e.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,i]})}function We({subscription:t}){const a=t.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),i=t.autoRenew?Oe:Ae;return e.jsx("span",{role:"img","aria-label":a,title:a,className:`inline-flex translate-y-px ${t.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:e.jsx(i,{size:14,strokeWidth:2,"aria-hidden":!0})})}function qe({subscription:t,now:a,mode:i=j.USED}){const s=te(t,a);if(!s)return null;const{endMs:n,expired:o}=s,l=!o&&n-a<=3*864e5,c=o?100:s.progress*100,d=i===j.REMAINING?100-c:c,m=o?100:Math.max(0,Math.min(100,d)),g=Math.round(m),h=m>0&&g===0?r("limits.bar.sub_one_percent"):`${g}%`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:r("subscriptions.inline.label")}),e.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:`${o?"bg-red-500":l?"bg-amber-500":"bg-blue-500"} rounded-full h-full block motion-safe:transition-[width] motion-safe:duration-500 ease-out motion-reduce:transition-none`,style:{width:`${m}%`,minWidth:m>0?"3px":0}})}),e.jsx("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:h}),e.jsx("span",{className:`text-[10px] tabular-nums shrink-0 whitespace-nowrap w-6 text-right ${o?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:He(n,a)})]})}function ze({subscription:t,now:a}){const i=te(t,a);if(!i)return null;const s=new Intl.DateTimeFormat(re(),{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("subscriptions.inline.label")}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:":"}),e.jsx("span",{children:t.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")}),e.jsx("span",{children:" "}),e.jsx("span",{className:"font-mono tabular-nums",children:s.format(new Date(i.endMs))}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{className:i.expired?"text-oai-error":void 0,children:ge(i.endMs,a)}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{children:t.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]})}const Xt=De;function O({children:t,tone:a="neutral"}){const i=a==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return e.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:t})}function Jt({rows:t,mode:a,extra:i=null}){const s=t.length===0&&!i;return e.jsxs(e.Fragment,{children:[t.map(({spec:n,pace:o})=>e.jsx(zt,{label:n.label??r(n.labelKey),pct:ae(n.window,n.pctField),reset:Ut(ne(n.window,n.resetField)),mode:a,pacePercent:o.pacePercent,paceOver:o.paceOver,title:qt(n,o,a)},n.key)),s?e.jsx(O,{children:r("limits.status.no_data")}):null,i]})}function Qt(t){if(!Number.isFinite(t.expiresMs))return null;const a=Math.floor((t.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:t.expiresAt}):r("limits.reset_bank.hover_detail",{date:t.expiresAt,days:a})}function Zt({row:t}){const a=Math.max(0,Math.min(100,Number(t.percent)||0));return e.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[e.jsx(Ue,{text:Qt(t)}),e.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t.label}),e.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${a}%`,minWidth:a>0?"3px":0}})}),e.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:t.expiresAt})]})}function ea({model:t}){const a=t.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:t.availableCount}):null;return e.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":t.kind,children:[e.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codex_reset_bank.title")}),a?e.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):t.rows.map(i=>e.jsx(Zt,{row:i},i.key))]})}function Ve(t,a){if(t==="codex_meta"){const i=Ot(a.reset_credits);return i?e.jsx(ea,{model:i}):null}if(t==="kimi_parallel"&&a.parallel_limit)return e.jsx(O,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})});if(t==="kiro_credits"&&Number.isFinite(Number(a.tracked_credits))&&Number(a.tracked_credit_records)>0){const i=Z(a.tracked_credits,{maximumFractionDigits:2});return e.jsx(O,{children:r("limits.label.kiro_tracked_credits",{credits:i,count:Number(a.tracked_credit_records)})})}return t==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?e.jsx(ra,{defaultDir:a.otel_default_dir}):null}function ta(t,a,i,s,n,o,l=null,c=null,d=Date.now()){const m=xe[t];if(!m)return null;const g=m.windows(a).filter(b=>b.window).map(b=>({spec:b,pace:Wt(b,s)})),h=Ve(m.extra,a);return e.jsxs(Ge,{name:i,providerId:t,expandable:g.length>0||!!c,expanded:n,onToggle:o,badge:l,rightAdornment:c?e.jsx(We,{subscription:c}):null,children:[e.jsx(Jt,{mode:s,rows:g,extra:h}),c?e.jsx(qe,{subscription:c,now:d,mode:s}):null,n?e.jsx(Yt,{rows:g,mode:s,now:d}):null,n&&c?e.jsx(ze,{subscription:c,now:d}):null]},t)}function ue(t,a,i,s,n=null,o=Date.now(),l=j.USED){const c=!!n;return e.jsxs(Ge,{name:ee(t),providerId:t,expandable:c,expanded:i,onToggle:s,rightAdornment:c?e.jsx(We,{subscription:n}):null,children:[a,c?e.jsx(qe,{subscription:n,now:o,mode:l}):null,c&&i?e.jsx("div",{className:"mt-1",children:e.jsx(ze,{subscription:n,now:o})}):null]},t)}function aa(t,a,i,s,n,o=null,l=Date.now()){if(!xe[t])return null;if(!a?.configured)return ue(t,e.jsxs(e.Fragment,{children:[e.jsx(O,{children:r("limits.status.not_connected")}),t==="opencodeGo"?e.jsx(_e,{}):null,t==="codingPlan"?e.jsx(Me,{}):null,t==="agentPlan"?e.jsx(Pe,{}):null]}),s,n,o,l,i);if(t==="opencodeGo"&&a.subscription_status==="inactive")return ue(t,e.jsx(O,{children:r("limits.opencodeGo.status.inactive")}),s,n,o,l,i);if(a.error)return ue(t,e.jsxs(e.Fragment,{children:[e.jsx(O,{tone:"error",children:r("shared.error.prefix",{error:a.error})}),t==="kiro"?Ve(xe.kiro.extra,a):null,t==="opencodeGo"?e.jsx(_e,{}):null,t==="codingPlan"?e.jsx(Me,{}):null,t==="agentPlan"?e.jsx(Pe,{}):null]}),s,n,o,l,i);const c=ee(t),d=a.plan_label?`${c} ${a.plan_label}`:c;let m=null;if(t==="antigravity")if(a.cached){const h=q(a.cached_at);m=e.jsx(H,{label:r("limits.label.antigravity_cached"),age:h,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else m=e.jsx(H,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});if((t==="qoder"||t==="qoderCn")&&a.cached&&(m=e.jsx(H,{label:r("limits.label.antigravity_cached"),age:q(a.cached_at),tone:"cached",tooltip:r("limits.tooltip.qoder_cached")})),(t==="codingPlan"||t==="agentPlan")&&a.cached&&(m=e.jsx(H,{label:r("limits.label.antigravity_cached"),age:q(a.cached_at),tone:"cached",tooltip:r("limits.tooltip.ark_cached")})),!m&&a.auth_action_required==="reauth"){const h=Kt[t];m=e.jsx(H,{label:r("limits.reauth.badge"),age:q(a.cached_at),tone:"stale",tooltip:h?r("limits.reauth.tooltip",{command:h}):null})}const g=a.provenance;return g?.stale&&!m&&(m=e.jsx(H,{label:r("limits.provenance.stale"),age:q(g.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:g.source,confidence:g.confidence})})),ta(t,a,d,i,s,n,m,o,l)}function ra({defaultDir:t}){const[a,i]=x.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${t||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
3
+ `),o=async l=>{l.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),e.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:n}),e.jsx("button",{type:"button",onClick:o,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function M({n:t,children:a}){return e.jsxs("li",{className:"flex gap-2.5",children:[e.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:t}),e.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function he(){return e.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function _e(){const[t,a]=x.useState(!1),i=["read -r -s OPENCODE_GO_API_KEY","export OPENCODE_GO_API_KEY",'launchctl setenv OPENCODE_GO_API_KEY "$OPENCODE_GO_API_KEY"'].join(`
4
+ `),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.opencodeGo.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.opencodeGo.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(M,{n:"1",children:[e.jsx("div",{children:r("limits.opencodeGo.setupHint.step1")}),e.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[r("limits.opencodeGo.setupHint.cta"),e.jsx(he,{})]})]}),e.jsx(M,{n:"2",children:e.jsx("div",{children:r("limits.opencodeGo.setupHint.step2")})}),e.jsxs(M,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.opencodeGo.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?r("limits.opencodeGo.setupHint.copied"):r("limits.opencodeGo.setupHint.copy")})]}),e.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:i}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Me(){const[t,a]=x.useState(!1),i=["npm install -g @volcengine/ark-cli","arkcli auth login volc-sso # browser SSO (recommended)","arkcli auth status # verify the session"].join(`
5
+ `),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.codingPlan.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.codingPlan.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(M,{n:"1",children:[e.jsx("div",{children:r("limits.codingPlan.setupHint.step1")}),e.jsxs("a",{href:"https://www.volcengine.com/docs/82379/2536875",target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[r("limits.codingPlan.setupHint.cta"),e.jsx(he,{})]})]}),e.jsxs(M,{n:"2",children:[e.jsx("div",{children:r("limits.codingPlan.setupHint.step2")}),e.jsx("div",{className:"mt-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.codingPlan.setupHint.step2_remote")})]}),e.jsxs(M,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.codingPlan.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?r("limits.codingPlan.setupHint.copied"):r("limits.codingPlan.setupHint.copy")})]}),e.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:i}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codingPlan.setupHint.note_app")})]})]})]})}function Pe(){const[t,a]=x.useState(!1),i=[r("limits.agentPlan.setupHint.snippet_install"),r("limits.agentPlan.setupHint.snippet_login"),r("limits.agentPlan.setupHint.snippet_status")].join(`
6
+ `),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.agentPlan.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(M,{n:"1",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step1")}),e.jsxs("a",{href:"https://www.volcengine.com/docs/82379/2536875",target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[r("limits.agentPlan.setupHint.cta"),e.jsx(he,{})]})]}),e.jsxs(M,{n:"2",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step2")}),e.jsx("div",{className:"mt-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.step2_remote")})]}),e.jsxs(M,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.agentPlan.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?r("limits.agentPlan.setupHint.copied"):r("limits.agentPlan.setupHint.copy")})]}),e.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:i}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.agentPlan.setupHint.note_app")})]})]})]})}function ia(t){const[a,i]=x.useState(0);return x.useLayoutEffect(()=>{const s=t.current;if(!s)return;const n=s.querySelectorAll("[data-limit-label]");let o=0,l=null;if(n.length>0)try{l=document.createElement("canvas").getContext("2d")}catch{l=null}if(l){const d=window.getComputedStyle(n[0]);l.font=`${d.fontStyle} ${d.fontWeight} ${d.fontSize} ${d.fontFamily}`;for(const m of n)o=Math.max(o,l.measureText(m.textContent).width)}const c=Math.ceil(o);i(d=>d===c?d:c)}),a}function na({claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:g,qoder:h,qoderCn:b,codingPlan:N,agentPlan:T,order:w,visibility:k,displayMode:$,subscriptions:se=[],showSubscriptions:Y=!0}){const oe={claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:g,qoder:h,qoderCn:b,codingPlan:N,agentPlan:T},F=x.useRef(null),K=ia(F),[be,P]=x.useState(null),[U,X]=x.useState(()=>Date.now()),D=Array.isArray(w)&&w.length>0?w:Xt,B=$===j.REMAINING?j.REMAINING:j.USED,le=B===j.REMAINING?r("limits.settings.display_mode_remaining"):r("limits.settings.display_mode_used");x.useEffect(()=>{const f=setInterval(()=>X(Date.now()),6e4);return()=>clearInterval(f)},[]);const E=new Map;if(Y)for(const f of se||[]){if(!f?.provider)continue;const _=new Date(f.nextBillingAt).getTime();if(!Number.isFinite(_))continue;const S=E.get(f.provider);if(!S){E.set(f.provider,f);continue}const G=new Date(S.nextBillingAt).getTime(),Q=_>U,I=G>U;(Q&&(!I||G>_)||!Q&&!I&&_>G)&&E.set(f.provider,f)}const J=D.filter(f=>!k||k[f]!==!1||E.has(f)).map(f=>aa(f,oe[f],B,be===f,()=>P(_=>_===f?null:f),E.get(f)||null,U)).filter(Boolean);return e.jsx(dt,{delay:.15,children:e.jsx(Te,{children:e.jsxs("div",{ref:F,className:"flex flex-col gap-3",style:K>0?{"--tt-limits-label-w":`${K}px`}:void 0,children:[e.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[r("limits.panel.title"),r("limits.panel.mode_separator"),le]}),J.length>0?J:e.jsx(O,{children:r("limits.status.all_hidden")})]})})})}async function Ye(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Subscription request failed with HTTP ${t.status}`);return a}async function sa(){const t=await fetch("/functions/tokentracker-subscription-manager",{headers:{Accept:"application/json"},cache:"no-store"}),a=await Ye(t);return Array.isArray(a.subscriptions)?a.subscriptions:[]}async function fe(t){const a=await Je();return Ye(await fetch("/functions/tokentracker-subscription-manager",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function oa(t){return fe({action:"create",subscription:t})}function la(t,a){return fe({action:"update",id:t,subscription:a})}function ca(t){return fe({action:"delete",id:t})}const me={plan:"",provider:"",cycle:"monthly",autoRenew:!0,startedAt:""};function da(t){const a=new Date(t);if(Number.isNaN(a.getTime()))return"";const i=s=>String(s).padStart(2,"0");return`${a.getFullYear()}-${i(a.getMonth()+1)}-${i(a.getDate())}T${i(a.getHours())}:${i(a.getMinutes())}`}function ua({subscriptions:t,onChanged:a}){const[i,s]=x.useState(!1),[n,o]=x.useState(null),[l,c]=x.useState(me),[d,m]=x.useState(!1),[g,h]=x.useState(!1),[b,N]=x.useState(!1),[T,w]=x.useState(!1),[k,$]=x.useState(null),[se,Y]=x.useState(!1),[oe,F]=x.useState(!1),[K,be]=x.useState(null),[P,U]=x.useState(()=>Date.now()),X=x.useRef(null),D=re(),B=x.useMemo(()=>new Intl.DateTimeFormat(D,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),[D]);x.useEffect(()=>{const u=setInterval(()=>U(Date.now()),6e4);return()=>clearInterval(u)},[]),x.useEffect(()=>{if(!i)return;const u=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;X.current?.scrollIntoView?.({behavior:u?"auto":"smooth",block:"nearest"})},[i,n]);const le=x.useMemo(()=>De.map(u=>{const v=(t||[]).some(y=>y.provider===u&&y.id!==n),p=ee(u);return{value:u,label:v?`${p} ${r("subscriptions.form.provider_taken_suffix")}`:p,disabled:v}}),[D,t,n]),E=x.useMemo(()=>[{value:"weekly",label:r("subscriptions.form.cycle_weekly")},{value:"monthly",label:r("subscriptions.form.cycle_monthly")},{value:"yearly",label:r("subscriptions.form.cycle_yearly")}],[D]),J=x.useMemo(()=>[{value:"true",label:r("subscriptions.form.auto_renew_on")},{value:"false",label:r("subscriptions.form.auto_renew_off")}],[D]),f=x.useCallback(()=>{c(me),o(null),h(!1),N(!1),w(!1),s(!0)},[]),_=x.useCallback(u=>{c({plan:u.plan||"",provider:u.provider||"",cycle:u.cycle||"monthly",autoRenew:u.autoRenew,startedAt:da(new Date(Ft(u)).toISOString())}),o(u.id),h(!1),N(!1),w(!1),s(!0)},[]),S=x.useCallback(()=>{s(!1),o(null),c(me),h(!1),N(!1),w(!1)},[]),G=x.useCallback(async u=>{if(u.preventDefault(),h(!1),!l.provider){N(!0);return}if((t||[]).some(L=>L.provider===l.provider&&L.id!==n)){w(!0);return}const p=new Date(l.startedAt).getTime();if(!Number.isFinite(p)){h(!0);return}const y={service:ee(l.provider),plan:l.plan,provider:l.provider||null,autoRenew:l.autoRenew,cycle:l.cycle,startedAt:p,nextBillingAt:Le(p,l.cycle)};m(!0);try{n?await la(n,y):await oa(y),S(),await a?.()}catch{h(!0)}finally{m(!1)}},[S,n,l,a,t]),Q=x.useCallback(async()=>{if(k){Y(!0),F(!1);try{await ca(k.id),k.id===n&&S(),$(null),await a?.()}catch{F(!0)}finally{Y(!1)}}},[S,n,a,k]),I=t||[],ye=()=>{const u=n?I.find(p=>p.id===n):null,v=u?te(u,P):null;return e.jsxs("form",{ref:X,onSubmit:G,className:"grid grid-cols-1 gap-3 px-3 py-3 text-left sm:grid-cols-2",children:[e.jsx("div",{className:"flex items-center justify-between sm:col-span-2",children:e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:n?r("subscriptions.edit"):r("subscriptions.add")})}),v?e.jsxs("div",{className:"sm:col-span-2 rounded-md bg-oai-gray-50 dark:bg-oai-gray-800/50 px-2.5 py-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:u.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:B.format(new Date(v.endMs))})," · ",e.jsx("span",{className:v.expired?"text-oai-error":void 0,children:ge(v.endMs,P)})]}):null,e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-provider",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.provider")}),e.jsx(ce,{id:"subscription-provider",value:l.provider,onValueChange:p=>c({...l,provider:String(p)}),options:le,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-1",children:e.jsx(je,{label:r("subscriptions.form.plan"),value:l.plan,maxLength:120,placeholder:r("subscriptions.form.plan_placeholder"),onChange:p=>c({...l,plan:p.target.value})})}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-cycle",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.cycle")}),e.jsx(ce,{id:"subscription-cycle",value:l.cycle,onValueChange:p=>c({...l,cycle:String(p)}),options:E,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-auto-renew",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.auto_renew")}),e.jsx(ce,{id:"subscription-auto-renew",value:String(l.autoRenew),onValueChange:p=>c({...l,autoRenew:p==="true"}),options:J,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(je,{label:r("subscriptions.form.started_at"),type:"datetime-local",value:l.startedAt,required:!0,onChange:p=>c({...l,startedAt:p.target.value})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 sm:col-span-2",children:[n?e.jsx(W,{type:"button",variant:"secondary",size:"sm",onClick:()=>{const p=I.find(y=>y.id===n);p&&$(p)},className:"!text-red-600 dark:!text-red-400 mr-auto",children:r("subscriptions.delete")}):null,b?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_required")}):null,T?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_taken")}):null,g?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.error")}):null,e.jsx(W,{type:"button",variant:"secondary",size:"sm",onClick:S,children:r("shared.action.cancel")}),e.jsx(W,{type:"submit",size:"sm",disabled:d,children:r("subscriptions.save")})]})]})};return e.jsxs("div",{className:"flex max-h-[min(80vh,42rem)] w-[min(92vw,32rem)] flex-col gap-3 overflow-y-auto rounded-xl border border-oai-gray-200 bg-white p-4 shadow-lg dark:border-oai-gray-700 dark:bg-oai-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"min-w-0",children:e.jsx("span",{className:"block truncate text-sm font-semibold text-oai-black dark:text-white",children:r("limits.page.openSubscriptions")})}),e.jsxs(W,{type:"button",size:"sm",onClick:f,className:"shrink-0 gap-1.5",children:[e.jsx(pt,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("subscriptions.add")})]})]}),I.length===0&&!(i&&!n)?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-700",children:[e.jsx(Re,{className:"h-6 w-6 text-oai-gray-300 dark:text-oai-gray-600 mb-2","aria-hidden":!0}),e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:r("subscriptions.empty.title")}),e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("subscriptions.empty.body")})]}):e.jsxs("ul",{className:"flex flex-col gap-1.5",children:[I.map(u=>{const v=te(u,P);if(!v)return null;const{endMs:p,expired:y}=v,L=y?100:v.progress*100,Ke=!y&&p-P<=3*864e5,Xe=K===u.id;return e.jsxs("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button",onClick:()=>_(u),"aria-label":`${r("subscriptions.edit")} ${u.service}`,"aria-expanded":n===u.id,className:"w-full flex flex-col gap-1.5 px-3 py-2.5 text-left cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Ie,{provider:Ee(u.provider)||"OTHER",size:14}),e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-white truncate",children:u.service}),e.jsx("span",{role:"img","aria-label":u.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),title:u.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),className:`inline-flex shrink-0 translate-y-px ${u.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:u.autoRenew?e.jsx(Oe,{size:14,strokeWidth:2,"aria-hidden":!0}):e.jsx(Ae,{size:14,strokeWidth:2,"aria-hidden":!0})}),u.plan?e.jsx("span",{className:"text-xs rounded-full border border-oai-gray-200 dark:border-oai-gray-700 px-2 py-0.5 text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:u.plan}):null]}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:r("subscriptions.inline.label")}),e.jsx("span",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1 overflow-hidden",children:e.jsx("span",{className:`${y?"bg-red-500":Ke?"bg-amber-500":"bg-blue-500"} rounded-full h-full block transition-[width] duration-500 ease-out`,style:{width:`${L}%`,minWidth:L>0?"3px":0}})}),e.jsx("span",{className:`text-[10px] tabular-nums shrink-0 ${y?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:He(p,P)})]})]}),n===u.id?e.jsx("div",{className:"border-t border-oai-gray-100 dark:border-oai-gray-800",children:ye()}):null,n!==u.id&&Xe?e.jsxs("div",{className:"px-3 pb-3 flex flex-col gap-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("p",{className:"pt-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:u.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:B.format(new Date(p))})," · ",e.jsx("span",{className:y?"text-oai-error":void 0,children:ge(p,P)})," · ",e.jsx("span",{children:u.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(W,{type:"button",variant:"secondary",size:"sm",onClick:()=>_(u),children:r("subscriptions.edit")})})]}):null]},u.id)}),i&&!n?e.jsx("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:ye()}):null]}),e.jsx(mt,{open:!!k,title:r("subscriptions.confirm_delete_title"),description:k?.service||"",error:oe?r("subscriptions.delete_error"):null,confirmLabel:r("subscriptions.delete"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:se,onCancel:()=>{$(null),F(!1)},onConfirm:Q})]})}const Se=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),ma="x-apple.systempreferences:com.apple.preference.notifications";function xa(){const t=kt(),a=at(),i=r("limits.alert.blocked"),s=a?ve.button:ve.div;return e.jsxs(s,{type:a?"button":void 0,onClick:a?()=>rt({type:"action",name:"openURL",value:ma}):void 0,initial:t?!1:{opacity:0,x:14,scale:.9},animate:{opacity:1,x:0,scale:1},transition:{type:"spring",stiffness:320,damping:18},title:i,className:`relative hidden sm:inline-flex min-w-0 max-w-[360px] items-center gap-1.5 rounded-full border border-amber-300/70 bg-amber-50 px-3 py-1.5 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 ${a?"cursor-pointer transition-colors hover:bg-amber-100 dark:hover:bg-amber-500/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60":""}`,children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"truncate",children:i}),e.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-[5px] border-transparent border-l-amber-300/80 dark:border-l-amber-500/40"})]})}function Ha(){const t=Qe(),{data:a,error:i,isLoading:s}=st(t?{initialRefresh:!0,initialState:t,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=ct(),o=ot(),[l,c]=C.useState([]),[d,m]=C.useState(!1),[g,h]=C.useState(!1),[b]=Ze(),N=C.useRef(0),T=C.useCallback(async()=>{if(!Se&&!ke())return;const w=++N.current;try{const k=await sa();if(w!==N.current)return;c(k),m(!1)}catch{if(w!==N.current)return;m(!0)}},[]);return C.useEffect(()=>{T()},[T]),C.useEffect(()=>{b.get("openSubscriptions")==="1"&&h(!0)},[b]),C.useEffect(()=>{o.enabled&&a&&lt(a)},[o.enabled,a]),!Se&&!ke()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(xt,{})}):e.jsx("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:"flex flex-row items-start justify-between gap-4 mb-8",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:r("nav.limits")}),e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:r("limits.page.subtitle")})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[o.enabled&&o.permissionBlocked?e.jsx(xa,{}):null,e.jsxs(gt,{open:g,onOpenChange:h,children:[e.jsx(ht,{"aria-label":r("limits.page.openSubscriptions"),title:r("limits.page.openSubscriptions"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:e.jsx(Re,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(ft,{children:e.jsx(bt,{side:"bottom",align:"end",sideOffset:8,className:"z-50",children:e.jsx(yt,{children:e.jsx(ua,{subscriptions:l,onChanged:T})})})})]}),e.jsx("button",{type:"button",onClick:()=>{o.setEnabled(!o.enabled)},"aria-label":o.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:o.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:`inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 ${o.enabled&&o.permissionBlocked?"text-amber-600 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"}`,children:o.enabled?e.jsx(Nt,{className:"h-4 w-4","aria-hidden":!0}):e.jsx(jt,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(et,{to:"/settings?section=limits","aria-label":r("limits.page.openSettings"),title:r("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:e.jsx(tt,{className:"h-4 w-4","aria-hidden":!0})})]})]}),s?e.jsx(Dt,{}):e.jsxs(e.Fragment,{children:[i?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:r("shared.error.prefix",{error:i})}):null,d?e.jsx("p",{className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("subscriptions.load_error")}):null,e.jsx(na,{claude:a?.claude,codex:a?.codex,cursor:a?.cursor,gemini:a?.gemini,kimi:a?.kimi,kiro:a?.kiro,grok:a?.grok,antigravity:a?.antigravity,copilot:a?.copilot,zcode:a?.zcode,opencodeGo:a?.opencodeGo,qoder:a?.qoder,qoderCn:a?.qoderCn,codingPlan:a?.codingPlan,agentPlan:a?.agentPlan,order:n.order,visibility:n.visibility,displayMode:n.displayMode,subscriptions:l,showSubscriptions:n.showSubscriptions!==!1})]})]})})})}export{Ha as LimitsPage};
@@ -1 +1 @@
1
- import{r as h,j as e,c as r}from"./__vite-browser-external-DPOlUkcY.js";import{A as p}from"./arrow-up-right-DSsR3Ntr.js";import{D as b}from"./download-DdGW6Krz.js";function I({id:t,value:l,onChange:d,placeholder:c,disabled:i=!1,type:x="text",label:s,error:a,className:g="",...m}){const y=h.useId(),o=t||y,n=a?`${o}-error`:void 0,u=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${i?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${a?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${g}`;return e.jsxs("div",{className:"w-full",children:[s&&e.jsx("label",{htmlFor:o,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:s}),e.jsx("input",{id:o,type:x,value:l,onChange:d,placeholder:c,disabled:i,"aria-invalid":a?!0:void 0,"aria-describedby":n,className:u,...m}),a&&e.jsx("p",{id:n,className:"mt-1.5 text-sm text-oai-error",children:a})]})}const f="https://github.com/xiufengsun/TokenTracker/releases/latest";function _(){const t=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:r("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:t,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:r("local_only.open_app")}),e.jsx(p,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(b,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("local_only.download")})]})]})]})})}export{I,_ as L};
1
+ import{r as h,j as e,c as r}from"./__vite-browser-external-4IGm4Djn.js";import{A as p}from"./arrow-up-right-rpBCOTg2.js";import{D as b}from"./download-DM1W9pIW.js";function I({id:t,value:l,onChange:d,placeholder:c,disabled:i=!1,type:x="text",label:s,error:a,className:g="",...m}){const y=h.useId(),o=t||y,n=a?`${o}-error`:void 0,u=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${i?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${a?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${g}`;return e.jsxs("div",{className:"w-full",children:[s&&e.jsx("label",{htmlFor:o,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:s}),e.jsx("input",{id:o,type:x,value:l,onChange:d,placeholder:c,disabled:i,"aria-invalid":a?!0:void 0,"aria-describedby":n,className:u,...m}),a&&e.jsx("p",{id:n,className:"mt-1.5 text-sm text-oai-error",children:a})]})}const f="https://github.com/xiufengsun/TokenTracker/releases/latest";function _(){const t=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:r("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:t,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:r("local_only.open_app")}),e.jsx(p,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(b,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("local_only.download")})]})]})]})})}export{I,_ as L};