tokentracker-cli 1.5.11 → 1.5.12

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 (110) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-Dcte0u7Q.js → AchievementBadge-DvcPjqX7.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-CSuHRFRk.js → AchievementsPage-C9AkvdHe.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-CKLbhnv4.js → AchievementsSection-g0JGNGfT.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-CeQAQnvy.js → BadgeDetailModal-BHxQ8umD.js} +1 -1
  5. package/dashboard/dist/assets/{BotAnimated-B-uisSLq.js → BotAnimated-C5Byp7Ml.js} +1 -1
  6. package/dashboard/dist/assets/{Card-BaFF9XpS.js → Card-BV1iTPCd.js} +1 -1
  7. package/dashboard/dist/assets/{CloudCheckoutPage-n4hJyA7o.js → CloudCheckoutPage-DcAvPHXS.js} +1 -1
  8. package/dashboard/dist/assets/{CloudPage-B7HR5YUJ.js → CloudPage-pw82pCP6.js} +2 -2
  9. package/dashboard/dist/assets/{CommandPalette-YHHk_FjS.js → CommandPalette-B88IfMHd.js} +1 -1
  10. package/dashboard/dist/assets/{CommunityStatsModal-oTjaJqEp.js → CommunityStatsModal-DwtEZ96Z.js} +1 -1
  11. package/dashboard/dist/assets/{ConfirmModal-8chTLqb2.js → ConfirmModal-Cx1-1xUk.js} +1 -1
  12. package/dashboard/dist/assets/{Controls-DRR74Es9.js → Controls-hHP6yz1h.js} +1 -1
  13. package/dashboard/dist/assets/{DashboardPage-BIGhKTFj.js → DashboardPage-Cz98astU.js} +1 -1
  14. package/dashboard/dist/assets/{DateRangePopover-C-3zJFYI.js → DateRangePopover-BjsUociY.js} +1 -1
  15. package/dashboard/dist/assets/{DevicePage-DAo-TVTs.js → DevicePage-C0ZyCHAD.js} +1 -1
  16. package/dashboard/dist/assets/{DialogClose-n5dJOtW8.js → DialogClose-eeerEmfs.js} +1 -1
  17. package/dashboard/dist/assets/DialogDescription-DG_4qSj0.js +1 -0
  18. package/dashboard/dist/assets/{DialogTitle-rghekf5V.js → DialogTitle-Bn14t_Xd.js} +1 -1
  19. package/dashboard/dist/assets/{ElectricLogo-mkepHqQS.js → ElectricLogo-OyoU_h0I.js} +1 -1
  20. package/dashboard/dist/assets/{FadeIn-DuQUR18k.js → FadeIn-BbC4-H2A.js} +1 -1
  21. package/dashboard/dist/assets/{HeaderGithubStar-9OXB09VZ.js → HeaderGithubStar-B2CCV29J.js} +1 -1
  22. package/dashboard/dist/assets/{HoverTooltip-CrAJfXcz.js → HoverTooltip-DiD_l4GJ.js} +1 -1
  23. package/dashboard/dist/assets/{IpCheckPage-OZWjldBU.js → IpCheckPage-1HwHzeVT.js} +1 -1
  24. package/dashboard/dist/assets/{LandingPage-D2mCb-I4.js → LandingPage-Cx_xIavm.js} +2 -2
  25. package/dashboard/dist/assets/{LeaderboardPage-CMYDxbyB.js → LeaderboardPage-BsP635cI.js} +2 -2
  26. package/dashboard/dist/assets/{LeaderboardProBadge-C_wZHdAl.js → LeaderboardProBadge-B7uhXYjD.js} +1 -1
  27. package/dashboard/dist/assets/{LeaderboardProfileModal-jaz4TCLd.js → LeaderboardProfileModal-_QOUdhsi.js} +3 -3
  28. package/dashboard/dist/assets/{LeaderboardProfilePage-BiRXu9ZP.js → LeaderboardProfilePage-CSpx6Rw5.js} +1 -1
  29. package/dashboard/dist/assets/{LimitsPage-CGrDj2ZJ.js → LimitsPage-DOj_2vh6.js} +1 -1
  30. package/dashboard/dist/assets/{LocalOnlyNotice-I6rapOVN.js → LocalOnlyNotice-DnkG5DmI.js} +1 -1
  31. package/dashboard/dist/assets/{LoginCard-OVOd8XAz.js → LoginCard-Ds9kOBpV.js} +1 -1
  32. package/dashboard/dist/assets/{LoginModal-B22tSrCo.js → LoginModal-B-7fS0gK.js} +1 -1
  33. package/dashboard/dist/assets/{LoginPage-BFbZ-C0F.js → LoginPage-B2K2tXvd.js} +1 -1
  34. package/dashboard/dist/assets/{PetPage-CcURQ2Hs.js → PetPage-DwsDJxX_.js} +2 -2
  35. package/dashboard/dist/assets/{PopoverPopup-X18Fm0Xt.js → PopoverPopup-CqUafQx4.js} +1 -1
  36. package/dashboard/dist/assets/{ProviderIcon-DY-51nC9.js → ProviderIcon-BcE1tBpR.js} +1 -1
  37. package/dashboard/dist/assets/{ResetPasswordPage-CPKNnuE_.js → ResetPasswordPage-CP17McXH.js} +1 -1
  38. package/dashboard/dist/assets/{Select-Sp_Ah2BS.js → Select-BcFrd0ex.js} +1 -1
  39. package/dashboard/dist/assets/{SelectItemText-D-D_9JvK.js → SelectItemText-C-FBw54p.js} +1 -1
  40. package/dashboard/dist/assets/{SelfHostPage-DIV0cqLC.js → SelfHostPage--4KcyhvD.js} +1 -1
  41. package/dashboard/dist/assets/{ServiceStatusPage-VmTYOQy8.js → ServiceStatusPage-C4GQ-8Tm.js} +1 -1
  42. package/dashboard/dist/assets/{SessionsPage-Boz5daY1.js → SessionsPage-DMW3U0i3.js} +1 -1
  43. package/dashboard/dist/assets/{SettingsPage-CK9QNuZp.js → SettingsPage-sYLabRGu.js} +3 -3
  44. package/dashboard/dist/assets/{SkillsPage-BEF7x0dw.js → SkillsPage-CkjmvAds.js} +1 -1
  45. package/dashboard/dist/assets/{TokenGalaxy-DJINXgr5.js → TokenGalaxy-BfJtQKzg.js} +1 -1
  46. package/dashboard/dist/assets/{TooltipPopup-BbUjKoYP.js → TooltipPopup-BxvShS92.js} +1 -1
  47. package/dashboard/dist/assets/{TrendMonitor-DJfrpPt5.js → TrendMonitor-C9cHT4G_.js} +1 -1
  48. package/dashboard/dist/assets/{WidgetsPage-aSUO2zkf.js → WidgetsPage-BqlH3M7h.js} +1 -1
  49. package/dashboard/dist/assets/{WrappedPage-COERhj_i.js → WrappedPage-D2A1zcGs.js} +1 -1
  50. package/dashboard/dist/assets/{__vite-browser-external-B_Ak9BfX.js → __vite-browser-external-RPZeXrAv.js} +2 -2
  51. package/dashboard/dist/assets/{agent-logos-ZJdYFI4_.js → agent-logos-CKAwJGNX.js} +1 -1
  52. package/dashboard/dist/assets/{arrow-left-D616rGCU.js → arrow-left-sB5X7dRY.js} +1 -1
  53. package/dashboard/dist/assets/{arrow-right-B-MgiFDB.js → arrow-right-Cvwg139b.js} +1 -1
  54. package/dashboard/dist/assets/{arrow-up-right-DFDvNYfd.js → arrow-up-right-H5sP370z.js} +1 -1
  55. package/dashboard/dist/assets/{calendar-days-D8_AIpYW.js → calendar-days-B6p2eInB.js} +1 -1
  56. package/dashboard/dist/assets/{check-CVT0rVJu.js → check-DgFRXvUP.js} +1 -1
  57. package/dashboard/dist/assets/{chevron-down-DaRfvtjf.js → chevron-down-D-ny8IBp.js} +1 -1
  58. package/dashboard/dist/assets/{cloud-checkout-Afmz3pTU.js → cloud-checkout-CT_OgBOA.js} +1 -1
  59. package/dashboard/dist/assets/{composite-BP8srk6k.js → composite-BJuoijSA.js} +1 -1
  60. package/dashboard/dist/assets/{copy-CSh5ZeL3.js → copy-JdswLd9u.js} +1 -1
  61. package/dashboard/dist/assets/{download-DD5b8DO2.js → download-BI-n3YEd.js} +1 -1
  62. package/dashboard/dist/assets/{external-link-Bxalzr1x.js → external-link-CH7tksO4.js} +1 -1
  63. package/dashboard/dist/assets/{flame-DmLbd0WE.js → flame-CP7hkBXq.js} +1 -1
  64. package/dashboard/dist/assets/{format-tokens-C9l4wsWw.js → format-tokens-Biw6wloc.js} +1 -1
  65. package/dashboard/dist/assets/{gift-BTUos8LQ.js → gift-Dz9MeN8q.js} +1 -1
  66. package/dashboard/dist/assets/{icons-CuHtmj-_.js → icons-DP4Ni8VA.js} +1 -1
  67. package/dashboard/dist/assets/{index-G6Vgxebm.js → index-BkeoJvCA.js} +1 -1
  68. package/dashboard/dist/assets/{index-BIBZvmJq.js → index-CIfh9hNs.js} +1 -1
  69. package/dashboard/dist/assets/{index-CS9Tss-E.js → index-SXavLLcl.js} +1 -1
  70. package/dashboard/dist/assets/{index-9TRHBut4.js → index-kQETJkOr.js} +1 -1
  71. package/dashboard/dist/assets/{info-D-BzxoMg.js → info-Bba3RZJA.js} +1 -1
  72. package/dashboard/dist/assets/{link-2-B5p2Qkwq.js → link-2-B2C7-GOt.js} +1 -1
  73. package/dashboard/dist/assets/{loader-circle-Dt8s_KQR.js → loader-circle-Dld8yUT7.js} +1 -1
  74. package/dashboard/dist/assets/{local-usage-transfer-Bu-B5mnF.js → local-usage-transfer-CAuRHyVW.js} +1 -1
  75. package/dashboard/dist/assets/{modifiers.esm-C4eH0Muk.js → modifiers.esm-CtFVyyHC.js} +1 -1
  76. package/dashboard/dist/assets/{monitor-smartphone-Cm16yNxN.js → monitor-smartphone-iFNG6h_M.js} +1 -1
  77. package/dashboard/dist/assets/{play-B8EgTxWo.js → play-C7GLNAdX.js} +1 -1
  78. package/dashboard/dist/assets/{plus-BxfcxXGQ.js → plus-CSKQToSA.js} +1 -1
  79. package/dashboard/dist/assets/{provider-display-IAeTGJgJ.js → provider-display-BwVQXnb2.js} +1 -1
  80. package/dashboard/dist/assets/{react-CtkV3-wh.js → react-Cy_Eczdb.js} +1 -1
  81. package/dashboard/dist/assets/{safePolygon-DSioykei.js → safePolygon-DiPfgohh.js} +1 -1
  82. package/dashboard/dist/assets/{search-CG-kvRWe.js → search-DKyVdlXG.js} +1 -1
  83. package/dashboard/dist/assets/{server-BALmdWhf.js → server-DaU0lAOr.js} +1 -1
  84. package/dashboard/dist/assets/{shield-check-wza85ghk.js → shield-check-DWiYKLWx.js} +1 -1
  85. package/dashboard/dist/assets/{skills-api-BHJwPBqa.js → skills-api-CXotXIRt.js} +1 -1
  86. package/dashboard/dist/assets/{sortable.esm-DorFDKrr.js → sortable.esm-ON-92Wzk.js} +1 -1
  87. package/dashboard/dist/assets/{store-DbhIVK4c.js → store-C91MN0gm.js} +1 -1
  88. package/dashboard/dist/assets/{terminal-Bc6vt9uT.js → terminal-CZUta1FC.js} +1 -1
  89. package/dashboard/dist/assets/{trash-CREyY2nF.js → trash-dOvHm24W.js} +1 -1
  90. package/dashboard/dist/assets/{use-community-stats-Bvve505O.js → use-community-stats-BD3O7D_G.js} +1 -1
  91. package/dashboard/dist/assets/{use-latest-request-guard-e-8mh_k7.js → use-latest-request-guard-Geg2sygc.js} +1 -1
  92. package/dashboard/dist/assets/{use-limits-display-prefs-BWRgNpTD.js → use-limits-display-prefs-Ck2CuPqb.js} +1 -1
  93. package/dashboard/dist/assets/{use-native-settings-DMnUqS86.js → use-native-settings-3DH5xldB.js} +1 -1
  94. package/dashboard/dist/assets/{use-ordered-list-Bl_gCA3S.js → use-ordered-list-BonkP7AB.js} +1 -1
  95. package/dashboard/dist/assets/use-reduced-motion-uryC1l51.js +1 -0
  96. package/dashboard/dist/assets/{use-transform-ClgKBuvp.js → use-transform-C32HObUN.js} +1 -1
  97. package/dashboard/dist/assets/{use-usage-limits-5G-X_GcH.js → use-usage-limits-6GFRuUdV.js} +1 -1
  98. package/dashboard/dist/assets/{useCurrency-BAiCSmN2.js → useCurrency-BsGBVGb5.js} +1 -1
  99. package/dashboard/dist/assets/{usePositioner-BSnQWD-E.js → usePositioner-DvFrrUs0.js} +1 -1
  100. package/dashboard/dist/assets/{useTokenFormat-CCOw1o2r.js → useTokenFormat-Dryg74BA.js} +1 -1
  101. package/dashboard/dist/assets/{zap-C_I-50QM.js → zap-BL_hxkkj.js} +1 -1
  102. package/dashboard/dist/index.html +1 -1
  103. package/dashboard/dist/ip-check.html +1 -1
  104. package/dashboard/dist/leaderboard.html +1 -1
  105. package/dashboard/dist/share.html +1 -1
  106. package/package.json +1 -1
  107. package/src/commands/serve.js +1 -1
  108. package/src/lib/pricing/seed-snapshot.json +1 -1
  109. package/dashboard/dist/assets/DialogDescription-DqRRqHn4.js +0 -1
  110. package/dashboard/dist/assets/use-reduced-motion-CycTdnVI.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-jaz4TCLd.js","assets/__vite-browser-external-B_Ak9BfX.js","assets/__vite-browser-external-D-6XhI1J.css","assets/provider-display-IAeTGJgJ.js","assets/useCurrency-BAiCSmN2.js","assets/useTokenFormat-CCOw1o2r.js","assets/terminal-Bc6vt9uT.js","assets/play-B8EgTxWo.js","assets/info-D-BzxoMg.js","assets/LeaderboardProBadge-C_wZHdAl.js","assets/TooltipPopup-BbUjKoYP.js","assets/composite-BP8srk6k.js","assets/store-DbhIVK4c.js","assets/safePolygon-DSioykei.js","assets/usePositioner-BSnQWD-E.js","assets/ProviderIcon-DY-51nC9.js","assets/AchievementBadge-Dcte0u7Q.js","assets/zap-C_I-50QM.js","assets/flame-DmLbd0WE.js","assets/calendar-days-D8_AIpYW.js","assets/shield-check-wza85ghk.js","assets/AchievementsSection-CKLbhnv4.js","assets/react-CtkV3-wh.js","assets/format-tokens-C9l4wsWw.js","assets/use-reduced-motion-CycTdnVI.js","assets/arrow-up-right-DFDvNYfd.js","assets/link-2-B5p2Qkwq.js","assets/check-CVT0rVJu.js","assets/DialogTitle-rghekf5V.js","assets/CommunityStatsModal-oTjaJqEp.js","assets/icons-CuHtmj-_.js","assets/TrendMonitor-DJfrpPt5.js","assets/DateRangePopover-C-3zJFYI.js","assets/use-latest-request-guard-e-8mh_k7.js","assets/PopoverPopup-X18Fm0Xt.js","assets/SelectItemText-D-D_9JvK.js","assets/DialogDescription-DqRRqHn4.js","assets/DialogClose-n5dJOtW8.js"])))=>i.map(i=>d[i]);
2
- import{j as e,V as xa,c as s,y as c,r as d,at as pa,d as ba,u as ha,a as ya,bd as fa,W as ka,aB as wa,a7 as va,be as De,bf as ja,bg as ie,g as Na,bh as _a,L as Sa,bi as Ca,i as Aa,bj as La,bk as Ea,aQ as Ta,_ as He,h as Ma,z as Pa}from"./__vite-browser-external-B_Ak9BfX.js";import{S as Ka}from"./Select-Sp_Ah2BS.js";import{m as Ra}from"./react-CtkV3-wh.js";import{u as Ia,C as za,a as Ba,b as $e,D as Da,c as $a,S as Ua,h as Oa,s as Fa,K as Ga,P as Ha}from"./sortable.esm-DorFDKrr.js";import{r as Wa}from"./modifiers.esm-C4eH0Muk.js";import{P as ye}from"./ProviderIcon-DY-51nC9.js";import{u as Ya}from"./useCurrency-BAiCSmN2.js";import{u as Q}from"./useTokenFormat-CCOw1o2r.js";import{L as X,a as ne}from"./LeaderboardProBadge-C_wZHdAl.js";import{s as Va,c as Ja,A as Za,t as Xa,b as qa}from"./AchievementBadge-Dcte0u7Q.js";import{L as We,u as Qa}from"./use-ordered-list-Bl_gCA3S.js";import{A as er}from"./arrow-right-B-MgiFDB.js";import{u as ar}from"./use-community-stats-Bvve505O.js";import"./chevron-down-DaRfvtjf.js";import"./check-CVT0rVJu.js";import"./SelectItemText-D-D_9JvK.js";import"./composite-BP8srk6k.js";import"./usePositioner-BSnQWD-E.js";import"./TooltipPopup-BbUjKoYP.js";import"./store-DbhIVK4c.js";import"./safePolygon-DSioykei.js";import"./zap-C_I-50QM.js";import"./flame-DmLbd0WE.js";import"./calendar-days-D8_AIpYW.js";import"./shield-check-wza85ghk.js";function H(a,{min:r,max:o,fallback:i}){const l=Number(a);if(!Number.isFinite(l))return i;const n=Math.floor(l);return n<r?r:n>o?o:n}function rr(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),i=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,i-2,i-1,i,i+1,i+2]),n=Array.from(l).filter(u=>Number.isInteger(u)&&u>=1&&u<=o).sort((u,h)=>u-h),m=[];let p=null;for(const u of n)p!=null&&u-p>1&&m.push(null),m.push(u),p=u;return m}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,i=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,i||1):1e6,fallback:1}),n=l>1,m=o?l<i:!0;return{canPrev:n,canNext:m,safePage:l,safeTotal:i}}function or({entries:a,me:r,meLabel:o}){const i=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||i.some(m=>!!m?.is_me)?i:[{rank:l,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,pro_active:r?.pro_active===!0,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:[]},...i]}function sr(a,r){const o=Number(a),i=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(i)||i<1?null:Math.ceil(o/i)}const ir=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function nr({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 ${ir.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const le=xa.memo(function({badges:r,max:o=3,className:i=""}){const l=Va((r||[]).filter(n=>n&&Ja.has(n.id)&&(n.tier||0)>=1)).slice(0,o);return l.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${i}`,children:l.map((n,m)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(qa(n.id,"name")),tier:s(`achievements.tier.${Xa(n.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Za,{badgeId:n.id,tier:n.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},n.id))})}),q=[{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}],Ye="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",Ve="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 de(a){return c("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-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function ce(a){return c("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-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function f({className:a}){return e.jsx("div",{className:c("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",i=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:c(de(!1),"!group-hover:bg-transparent"),children:e.jsx(f,{className:"h-4 w-6"})}),e.jsx("td",{className:c(ce(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(f,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(f,{className:c("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(f,{className:c("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(f,{className:"h-4 w-12"})}),q.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(f,{className:c("h-4",i)})},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(f,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(f,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(f,{className:c("h-4",r)}),e.jsx(f,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(f,{className:"ml-auto h-3 w-8"}),e.jsx(f,{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},(i,l)=>e.jsx(f,{className:"h-5 w-12 rounded-full"},l))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx(We,{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:c(Ye,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(f,{className:"h-3.5 w-6"})}),e.jsx("th",{className:c(Ve,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(f,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(f,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(f,{className:"h-3.5 w-14"})}),q.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(f,{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:i,listeners:l,setNodeRef:n,transform:m,transition:p,isDragging:u}=Ia({id:a}),h=za.Transform.toString(m)||"";d.useLayoutEffect(()=>{const y=document.querySelectorAll(`td[data-column-key="${a}"]`),b="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return y.forEach(x=>{x.style.transform=h,x.style.transition=p||"",x.style.zIndex=u?"20":"",x.style.position=h?"relative":"",x.style.boxShadow=u?b:""}),()=>{y.forEach(x=>{x.style.transform="",x.style.transition="",x.style.zIndex="",x.style.position="",x.style.boxShadow=""})}},[a,h,p,u]);const v={transform:h,transition:p,position:h?"relative":void 0,zIndex:u?20:void 0,boxShadow:u?"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:n,style:v,className:c(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...i,...l,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:c("-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",u&&"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 gr="tokentracker.leaderboard.columnOrder.v1";function ur(a){return Qa(gr,a)}const xr=50;function pr(a,r){const o=Number(a),i=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(i)||i<1?null:Math.min(100,Math.max(1,Math.ceil(o/i*100)))}function Je(a){return typeof a=="string"?a.trim():""}function br(a){const r=Je(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:i,onJumpToMe:l,canJump:n,className:m}){const p=a&&typeof a.rank=="number"?a.rank:null;if(!p)return null;const u=Number(r)||0,h=pr(p,u),v=Je(a?.display_name),y=!v||br(v)?o||"You":v,b=a?.user_id||y,x=i||(n?l:null),E=typeof x=="function",C=E?"button":"div",ee=E?{type:"button",onClick:x,"aria-label":s(i?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,className:c("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",E?"border-oai-gray-200 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:hover:border-oai-gray-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-gray-100/40 dark:hover:bg-oai-gray-900/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(X,{size:"sm",avatarUrl:a?.avatar_url,displayName:y,seed:b,proActive:a?.pro_active===!0}),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-gray-800 dark:group-hover:text-oai-gray-100 transition-colors",children:y}),a?.pro_active===!0&&e.jsx("span",{className:"leaderboard-pro-badge",role:"img","aria-label":s("leaderboard.pro.badge_aria"),"aria-description":s("leaderboard.pro.tooltip"),children:s("leaderboard.pro.badge")}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",p.toLocaleString()]}),h!=null&&h<=xr&&e.jsx("span",{className:"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 bg-oai-gray-100 text-oai-gray-700 dark:bg-oai-gray-800 dark:text-oai-gray-300 ring-oai-gray-300/30 dark:ring-oai-gray-600/30",children:s("leaderboard.summary.percentile",{p:String(h)})}),E?e.jsx(er,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-gray-600 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-oai-gray-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]})]})}const yr=d.lazy(()=>He(()=>import("./LeaderboardProfileModal-jaz4TCLd.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,24,25,26,27,28])).then(a=>({default:a.LeaderboardProfileModal}))),fr=d.lazy(()=>He(()=>import("./CommunityStatsModal-oTjaJqEp.js"),__vite__mapDeps([29,1,2,22,30,5,15,31,4,32,33,6,34,12,11,35,14,13,24,16,17,18,19,20,28,36,37])).then(a=>({default:a.CommunityStatsModal}))),me=[10,20,50,100],ge=20,Ze="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return ge;try{const a=window.localStorage.getItem(Ze),r=Number(a);if(me.includes(r))return r}catch{}return ge}function ue(a,r,o){const i=Number(a);if(!Number.isFinite(i)||i<=0)return"-";const l=Ca(r),n=r===Pa?i:i*o;return n>=1e3?`${l}${Math.round(n).toLocaleString()}`:n>=10?`${l}${Math.round(n)}`:`${l}${n.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=Ma();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 vr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:i}=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-gray-400 hover:bg-oai-gray-100/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-gray-500/80 dark:hover:bg-oai-gray-900/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-oai-gray-400/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-oai-gray-400 dark:bg-oai-gray-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:i(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:Aa(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 Ue({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:i,formatTokensTooltip:l}=Q(),n=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",m=r?"bg-oai-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900";return o.map(p=>e.jsx("td",{"data-column-key":p.key,title:l(a?.[p.key]),className:c("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",n,m),children:i(a?.[p.key])},p.key))}function jr(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(ye,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:i}=Q(),l=r.filter(n=>{const m=Number(a?.[n.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(n=>{const m=s(n.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${i(a?.[n.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(ye,{provider:jr(n),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[n.key])})]},n.key)})})}function Ar({entry:a,entryIdx:r,name:o,meLabel:i,currency:l,rate:n,orderedColumns:m,placeholder:p,onOpenProfile:u}){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 h=!!a?.is_me,v=!h&&be(a?.display_name),y=typeof a?.user_id=="string"?a.user_id:null,b=!!y,x=h?i:o,E=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),u(y))};return e.jsxs("div",{role:b?"button":void 0,tabIndex:b?0:void 0,onClick:b?()=>u(y):void 0,onKeyDown:b?E:void 0,"aria-label":b?s("leaderboard.profile_modal.row_aria",{name:x}):void 0,className:c("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",h?"bg-oai-gray-50 dark:bg-oai-gray-900 border-oai-gray-300/60 dark:border-oai-gray-500/25":v?"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",b&&"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-gray-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:p})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:c("inline-flex rounded-full p-0.5 transition-all duration-300",a?.pro_active!==!0&&(Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80"),v&&"opacity-60 grayscale-[15%]"),children:e.jsx(X,{size:"md",avatarUrl:a?.avatar_url,displayName:x,seed:he(a,x),proActive:a?.pro_active===!0})}),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:c("min-w-0 truncate text-sm tracking-tight",h?"font-semibold text-oai-black dark:text-oai-white":v?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:x}),e.jsx(ne,{proActive:a?.pro_active===!0}),e.jsx(le,{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:c("ml-1 tabular-nums font-medium",v?"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,n)})]})]}),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:c("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",h?"text-oai-black dark:text-oai-white":v?"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}-${x}`)}const Lr={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 Oe({rank:a,placeholder:r}){const o=Lr[a];return o?e.jsx("span",{className:c("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 Fe(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Er(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 pe(a){return typeof a!="string"?"":a.trim()}function be(a){const r=pe(a);return r?r.toLowerCase()==="anonymous":!0}function he(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Ge({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(ye,{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(Sa,{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 ot({auth:a,signedIn:r,sessionSoftExpired:o}){const i=pa(),l=ba(),{openLoginModal:n}=ha(),{signedIn:m,loading:p,user:u}=ya(),{currency:h,rate:v}=Ya(),y=d.useMemo(()=>fa(),[]),b=ka(),x=r&&!o,E=d.useMemo(()=>x&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,x]),C=x?E:null,ee=x&&wa(C),ae=s("shared.placeholder.short"),Xe=d.useMemo(()=>q.map(t=>t.key),[]),{order:re,reorder:fe}=ur(Xe),ke=d.useMemo(()=>{const t=new Map;for(const g of q)t.set(g.key,g);return t},[]),B=d.useMemo(()=>re.map(t=>ke.get(t)).filter(Boolean),[re,ke]),qe=Ba($e(Ha,{activationConstraint:{distance:6}}),$e(Ga,{coordinateGetter:Fa})),Qe=d.useCallback(t=>{const{active:g,over:w}=t;!w||g.id===w.id||fe(String(g.id),String(w.id))},[fe]),[te,M]=d.useState(1),[_,ea]=d.useState(kr),[we,ve]=d.useState(null),[je,Ne]=d.useState(!1),W=d.useCallback(t=>{typeof t=="string"&&t.trim()&&ve(t.trim())},[]),aa=d.useCallback(()=>ve(null),[]),ra=d.useCallback(t=>{const g=me.includes(t)?t:ge;ea(g),M(1);try{window.localStorage.setItem(Ze,String(g))}catch{}},[]),[_e,ta]=d.useState(0),[oa,sa]=d.useState(()=>va()),[Se,Ce]=d.useState(!1);d.useEffect(()=>{if(typeof window>"u")return;const t=()=>{ta(g=>g+1)};return window.addEventListener(De,t),()=>{window.removeEventListener(De,t)}},[]);const N=d.useMemo(()=>{const t=new URLSearchParams(i?.search||"");return Fe(t.get("period"))||"total"},[i?.search]),ia=t=>{const g=Fe(t);if(!g||g===N)return;const w=new URLSearchParams(i?.search||"");w.set("period",g),M(1),l(`${i?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};d.useEffect(()=>{p||b||m||n()},[m,p,b,n]),d.useEffect(()=>{M(1)},[N]);const Y=d.useMemo(()=>(H(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),R=d.useMemo(()=>b?"mock":p?"unavailable":m?"cloud":r?"local":y?"public":"unavailable",[p,m,y,b,r]),k=d.useMemo(()=>ja({accessMode:R,baseUrl:y,mockEnabled:b,userId:u?.id||null,period:N,pageSize:_,offset:Y}),[u?.id,R,y,Y,b,_,N]),[D,$]=d.useState(()=>{const t=ie(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});d.useEffect(()=>{if(!y&&!b||!b&&R==="unavailable"){$({loading:!1,error:null,data:null,contextKey:null});return}const t=ie(k);let g=!0;return $(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await Na({userId:u?.id||null,period:N,limit:_,offset:Y});g&&(_a(w,{activeContextKey:k,contextKey:k,source:_e>0?"manual-refresh":"page-load"}),$({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!g)return;const T=Er(w);$(F=>F.contextKey===k?{...F,loading:!1,error:T}:{loading:!1,error:T,data:null,contextKey:k})}),()=>{g=!1}},[y,R,u?.id,k,Y,_e,b,N,_]);const oe=d.useMemo(()=>D.contextKey===k?null:ie(k),[k,D.contextKey]),j=d.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(y||b)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,y,k,D,b,oe]),S=j.data,U=S?.total_pages??null,na=S?.total_entries??0,P=S?.page??te,la=d.useMemo(()=>rr(P,U),[P,U]),Ae=S?.from||null,Le=S?.to||null,da=S?.generated_at||null,V=wr(da),Ee=ar(),K=S?.me||null,I=s("leaderboard.me_label"),Te=s("leaderboard.anon_label"),Me=s("leaderboard.period.week"),Pe=s("leaderboard.period.month"),Ke=s("leaderboard.period.total"),Re=N==="month"?Pe:N==="total"?Ke:Me,J=d.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:K,meLabel:I})},[S?.entries,K,I]),z=d.useMemo(()=>sr(K?.rank,_),[K?.rank,_]),ca=z!=null&&z===P,ma=d.useCallback(()=>{z!=null&&M(z)},[z]),ga=async()=>{Ce(!0);try{La(!0),sa(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{Ce(!1)}},{canPrev:Ie,canNext:ze}=tr({page:P,totalPages:U}),Z=Array.isArray(J)&&J.length!==0;let O=null;j.loading&&!Z?O=e.jsx(cr,{rows:_}):j.error&&!Z?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:j.error})}):Z?O=e.jsxs(Da,{sensors:qe,collisionDetection:$a,modifiers:[Wa],onDragEnd:Qe,children:[e.jsx(We,{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:c(Ye,"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:c(Ve,"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(Ua,{items:re,strategy:Oa,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(nr,{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,g)=>{if(t?.is_ellipsis){const L=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:L,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-${g}`)}const w=!!t?.is_me,T=typeof t?.user_id=="string"?t.user_id:null,F=pe(t?.display_name),ua=be(F)?Te:F,A=w?I:ua,G=!!T,Be=G?{role:"button",tabIndex:0,onClick:G?()=>W(T):void 0,onKeyDown:G?L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),W(T))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:A})}:{};if(w){const L=!!t?.is_pinned;return e.jsxs("tr",{...Be,className:c("bg-oai-gray-50 dark:bg-oai-gray-900 transition-colors",L?"border-t border-b border-oai-gray-300/40 dark:border-oai-gray-500/20":"border-y border-oai-gray-300/40 dark:border-oai-gray-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-500/60"),children:[e.jsx("td",{className:c(de(!0),"font-semibold text-oai-gray-700 dark:text-oai-gray-300",L&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-gray-500 dark:before:bg-oai-gray-400"),children:e.jsx(Oe,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:ce(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:c("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&t?.pro_active!==!0&&"gh-avatar-frame"),children:[e.jsx("span",{className:c("inline-flex rounded-full p-px",t?.github_url&&t?.pro_active!==!0&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(X,{avatarUrl:t?.avatar_url,displayName:A,seed:he(t,A),proActive:t?.pro_active===!0})}),t?.github_url&&e.jsx(Ge,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:A}),e.jsx(ne,{proActive:t?.pro_active===!0}),e.jsx(le,{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-gray-50 dark:bg-oai-gray-900",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-gray-700 dark:text-oai-gray-300 whitespace-nowrap text-right tabular-nums bg-oai-gray-50 dark:bg-oai-gray-900",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,h,v)}),e.jsx(Ue,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${A}${L?"-pin":""}`)}return e.jsxs("tr",{...Be,className:c("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-gray-500/60"),children:[e.jsx("td",{className:c(de(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(Oe,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:ce(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:c("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&t?.pro_active!==!0&&"gh-avatar-frame"),children:[e.jsx("span",{className:c("inline-flex rounded-full p-px",t?.github_url&&t?.pro_active!==!0&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(X,{avatarUrl:t?.avatar_url,displayName:A,seed:he(t,A),proActive:t?.pro_active===!0})}),t?.github_url&&e.jsx(Ge,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:A}),e.jsx(ne,{proActive:t?.pro_active===!0}),e.jsx(le,{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,h,v)}),e.jsx(Ue,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${A}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,g)=>{const w=pe(t?.display_name),T=be(w)?Te:w;return e.jsx(Ar,{entry:t,entryIdx:g,name:t?.is_me?I:T,meLabel:I,currency:h,rate:v,orderedColumns:B,placeholder:ae,onOpenProfile:W},`mobile-${t?.rank??"ellipsis"}-${g}`)})})]}):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=la.map((t,g)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.pagination.ellipsis")},`ellipsis-${g}`):e.jsx("button",{className:c("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:j.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"):Ae&&Le?s("leaderboard.range",{period:Re,from:Ae,to:Le}):s("leaderboard.range_loading",{period:Re}),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 g=N===t;return e.jsxs("button",{onClick:()=>ia(t),disabled:j.loading,className:c("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",g?"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"?Me:t==="month"?Pe:Ke}),g&&e.jsx(Ra.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(vr,{communityStats:Ee,onClick:()=>Ne(!0)}),e.jsx(hr,{me:K,totalEntries:na,meLabel:I,onOpenProfile:K?.user_id?()=>W(K.user_id):void 0,onJumpToMe:ma,canJump:z!=null&&!ca&&!j.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:n,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")})]}),x&&ee&&!oa&&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:ga,disabled:Se,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:Se?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:[j.error&&Z?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:j.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(Ka,{id:"leaderboard-page-size",value:_,onValueChange:t=>ra(Number(t)),disabled:j.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:me.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:c("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",Ie&&!j.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:!Ie||j.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:c("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",ze&&!j.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:!ze||j.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(d.Suspense,{fallback:null,children:[e.jsx(yr,{isOpen:!!we,userId:we,period:N,accessToken:C,onClose:aa}),je&&e.jsx(fr,{isOpen:je,onClose:()=>Ne(!1),communityStats:Ee})]})]})}export{ot as LeaderboardPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-_QOUdhsi.js","assets/__vite-browser-external-RPZeXrAv.js","assets/__vite-browser-external-D-6XhI1J.css","assets/provider-display-BwVQXnb2.js","assets/useCurrency-BsGBVGb5.js","assets/useTokenFormat-Dryg74BA.js","assets/terminal-CZUta1FC.js","assets/play-C7GLNAdX.js","assets/info-Bba3RZJA.js","assets/LeaderboardProBadge-B7uhXYjD.js","assets/TooltipPopup-BxvShS92.js","assets/composite-BJuoijSA.js","assets/store-C91MN0gm.js","assets/safePolygon-DiPfgohh.js","assets/usePositioner-DvFrrUs0.js","assets/ProviderIcon-BcE1tBpR.js","assets/AchievementBadge-DvcPjqX7.js","assets/zap-BL_hxkkj.js","assets/flame-CP7hkBXq.js","assets/calendar-days-B6p2eInB.js","assets/shield-check-DWiYKLWx.js","assets/AchievementsSection-g0JGNGfT.js","assets/react-Cy_Eczdb.js","assets/format-tokens-Biw6wloc.js","assets/use-reduced-motion-uryC1l51.js","assets/arrow-up-right-H5sP370z.js","assets/link-2-B2C7-GOt.js","assets/check-DgFRXvUP.js","assets/DialogTitle-Bn14t_Xd.js","assets/CommunityStatsModal-DwtEZ96Z.js","assets/icons-DP4Ni8VA.js","assets/TrendMonitor-C9cHT4G_.js","assets/DateRangePopover-BjsUociY.js","assets/use-latest-request-guard-Geg2sygc.js","assets/PopoverPopup-CqUafQx4.js","assets/SelectItemText-C-FBw54p.js","assets/DialogDescription-DG_4qSj0.js","assets/DialogClose-eeerEmfs.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,V as xa,c as s,y as c,r as d,at as pa,d as ba,u as ha,a as ya,bd as fa,W as ka,aB as wa,a7 as va,be as De,bf as ja,bg as ie,g as Na,bh as _a,L as Sa,bi as Ca,i as Aa,bj as La,bk as Ea,aQ as Ta,_ as He,h as Ma,z as Pa}from"./__vite-browser-external-RPZeXrAv.js";import{S as Ka}from"./Select-BcFrd0ex.js";import{m as Ra}from"./react-Cy_Eczdb.js";import{u as Ia,C as za,a as Ba,b as $e,D as Da,c as $a,S as Ua,h as Oa,s as Fa,K as Ga,P as Ha}from"./sortable.esm-ON-92Wzk.js";import{r as Wa}from"./modifiers.esm-CtFVyyHC.js";import{P as ye}from"./ProviderIcon-BcE1tBpR.js";import{u as Ya}from"./useCurrency-BsGBVGb5.js";import{u as Q}from"./useTokenFormat-Dryg74BA.js";import{L as X,a as ne}from"./LeaderboardProBadge-B7uhXYjD.js";import{s as Va,c as Ja,A as Za,t as Xa,b as qa}from"./AchievementBadge-DvcPjqX7.js";import{L as We,u as Qa}from"./use-ordered-list-BonkP7AB.js";import{A as er}from"./arrow-right-Cvwg139b.js";import{u as ar}from"./use-community-stats-BD3O7D_G.js";import"./chevron-down-D-ny8IBp.js";import"./check-DgFRXvUP.js";import"./SelectItemText-C-FBw54p.js";import"./composite-BJuoijSA.js";import"./usePositioner-DvFrrUs0.js";import"./TooltipPopup-BxvShS92.js";import"./store-C91MN0gm.js";import"./safePolygon-DiPfgohh.js";import"./zap-BL_hxkkj.js";import"./flame-CP7hkBXq.js";import"./calendar-days-B6p2eInB.js";import"./shield-check-DWiYKLWx.js";function H(a,{min:r,max:o,fallback:i}){const l=Number(a);if(!Number.isFinite(l))return i;const n=Math.floor(l);return n<r?r:n>o?o:n}function rr(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),i=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,i-2,i-1,i,i+1,i+2]),n=Array.from(l).filter(u=>Number.isInteger(u)&&u>=1&&u<=o).sort((u,h)=>u-h),m=[];let p=null;for(const u of n)p!=null&&u-p>1&&m.push(null),m.push(u),p=u;return m}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,i=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,i||1):1e6,fallback:1}),n=l>1,m=o?l<i:!0;return{canPrev:n,canNext:m,safePage:l,safeTotal:i}}function or({entries:a,me:r,meLabel:o}){const i=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||i.some(m=>!!m?.is_me)?i:[{rank:l,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,pro_active:r?.pro_active===!0,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:[]},...i]}function sr(a,r){const o=Number(a),i=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(i)||i<1?null:Math.ceil(o/i)}const ir=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function nr({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 ${ir.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const le=xa.memo(function({badges:r,max:o=3,className:i=""}){const l=Va((r||[]).filter(n=>n&&Ja.has(n.id)&&(n.tier||0)>=1)).slice(0,o);return l.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${i}`,children:l.map((n,m)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(qa(n.id,"name")),tier:s(`achievements.tier.${Xa(n.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Za,{badgeId:n.id,tier:n.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},n.id))})}),q=[{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}],Ye="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",Ve="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 de(a){return c("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-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function ce(a){return c("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-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function f({className:a}){return e.jsx("div",{className:c("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",i=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:c(de(!1),"!group-hover:bg-transparent"),children:e.jsx(f,{className:"h-4 w-6"})}),e.jsx("td",{className:c(ce(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(f,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(f,{className:c("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(f,{className:c("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(f,{className:"h-4 w-12"})}),q.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(f,{className:c("h-4",i)})},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(f,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(f,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(f,{className:c("h-4",r)}),e.jsx(f,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(f,{className:"ml-auto h-3 w-8"}),e.jsx(f,{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},(i,l)=>e.jsx(f,{className:"h-5 w-12 rounded-full"},l))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx(We,{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:c(Ye,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(f,{className:"h-3.5 w-6"})}),e.jsx("th",{className:c(Ve,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(f,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(f,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(f,{className:"h-3.5 w-14"})}),q.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(f,{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:i,listeners:l,setNodeRef:n,transform:m,transition:p,isDragging:u}=Ia({id:a}),h=za.Transform.toString(m)||"";d.useLayoutEffect(()=>{const y=document.querySelectorAll(`td[data-column-key="${a}"]`),b="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return y.forEach(x=>{x.style.transform=h,x.style.transition=p||"",x.style.zIndex=u?"20":"",x.style.position=h?"relative":"",x.style.boxShadow=u?b:""}),()=>{y.forEach(x=>{x.style.transform="",x.style.transition="",x.style.zIndex="",x.style.position="",x.style.boxShadow=""})}},[a,h,p,u]);const v={transform:h,transition:p,position:h?"relative":void 0,zIndex:u?20:void 0,boxShadow:u?"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:n,style:v,className:c(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...i,...l,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:c("-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",u&&"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 gr="tokentracker.leaderboard.columnOrder.v1";function ur(a){return Qa(gr,a)}const xr=50;function pr(a,r){const o=Number(a),i=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(i)||i<1?null:Math.min(100,Math.max(1,Math.ceil(o/i*100)))}function Je(a){return typeof a=="string"?a.trim():""}function br(a){const r=Je(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:i,onJumpToMe:l,canJump:n,className:m}){const p=a&&typeof a.rank=="number"?a.rank:null;if(!p)return null;const u=Number(r)||0,h=pr(p,u),v=Je(a?.display_name),y=!v||br(v)?o||"You":v,b=a?.user_id||y,x=i||(n?l:null),E=typeof x=="function",C=E?"button":"div",ee=E?{type:"button",onClick:x,"aria-label":s(i?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,className:c("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",E?"border-oai-gray-200 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:hover:border-oai-gray-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-gray-100/40 dark:hover:bg-oai-gray-900/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(X,{size:"sm",avatarUrl:a?.avatar_url,displayName:y,seed:b,proActive:a?.pro_active===!0}),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-gray-800 dark:group-hover:text-oai-gray-100 transition-colors",children:y}),a?.pro_active===!0&&e.jsx("span",{className:"leaderboard-pro-badge",role:"img","aria-label":s("leaderboard.pro.badge_aria"),"aria-description":s("leaderboard.pro.tooltip"),children:s("leaderboard.pro.badge")}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",p.toLocaleString()]}),h!=null&&h<=xr&&e.jsx("span",{className:"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 bg-oai-gray-100 text-oai-gray-700 dark:bg-oai-gray-800 dark:text-oai-gray-300 ring-oai-gray-300/30 dark:ring-oai-gray-600/30",children:s("leaderboard.summary.percentile",{p:String(h)})}),E?e.jsx(er,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-gray-600 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-oai-gray-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]})]})}const yr=d.lazy(()=>He(()=>import("./LeaderboardProfileModal-_QOUdhsi.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,24,25,26,27,28])).then(a=>({default:a.LeaderboardProfileModal}))),fr=d.lazy(()=>He(()=>import("./CommunityStatsModal-DwtEZ96Z.js"),__vite__mapDeps([29,1,2,22,30,5,15,31,4,32,33,6,34,12,11,35,14,13,24,16,17,18,19,20,28,36,37])).then(a=>({default:a.CommunityStatsModal}))),me=[10,20,50,100],ge=20,Ze="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return ge;try{const a=window.localStorage.getItem(Ze),r=Number(a);if(me.includes(r))return r}catch{}return ge}function ue(a,r,o){const i=Number(a);if(!Number.isFinite(i)||i<=0)return"-";const l=Ca(r),n=r===Pa?i:i*o;return n>=1e3?`${l}${Math.round(n).toLocaleString()}`:n>=10?`${l}${Math.round(n)}`:`${l}${n.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=Ma();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 vr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:i}=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-gray-400 hover:bg-oai-gray-100/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-gray-500/80 dark:hover:bg-oai-gray-900/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-oai-gray-400/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-oai-gray-400 dark:bg-oai-gray-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:i(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:Aa(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 Ue({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:i,formatTokensTooltip:l}=Q(),n=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",m=r?"bg-oai-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900";return o.map(p=>e.jsx("td",{"data-column-key":p.key,title:l(a?.[p.key]),className:c("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",n,m),children:i(a?.[p.key])},p.key))}function jr(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(ye,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:i}=Q(),l=r.filter(n=>{const m=Number(a?.[n.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(n=>{const m=s(n.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${i(a?.[n.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(ye,{provider:jr(n),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[n.key])})]},n.key)})})}function Ar({entry:a,entryIdx:r,name:o,meLabel:i,currency:l,rate:n,orderedColumns:m,placeholder:p,onOpenProfile:u}){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 h=!!a?.is_me,v=!h&&be(a?.display_name),y=typeof a?.user_id=="string"?a.user_id:null,b=!!y,x=h?i:o,E=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),u(y))};return e.jsxs("div",{role:b?"button":void 0,tabIndex:b?0:void 0,onClick:b?()=>u(y):void 0,onKeyDown:b?E:void 0,"aria-label":b?s("leaderboard.profile_modal.row_aria",{name:x}):void 0,className:c("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",h?"bg-oai-gray-50 dark:bg-oai-gray-900 border-oai-gray-300/60 dark:border-oai-gray-500/25":v?"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",b&&"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-gray-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:p})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:c("inline-flex rounded-full p-0.5 transition-all duration-300",a?.pro_active!==!0&&(Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80"),v&&"opacity-60 grayscale-[15%]"),children:e.jsx(X,{size:"md",avatarUrl:a?.avatar_url,displayName:x,seed:he(a,x),proActive:a?.pro_active===!0})}),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:c("min-w-0 truncate text-sm tracking-tight",h?"font-semibold text-oai-black dark:text-oai-white":v?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:x}),e.jsx(ne,{proActive:a?.pro_active===!0}),e.jsx(le,{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:c("ml-1 tabular-nums font-medium",v?"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,n)})]})]}),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:c("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",h?"text-oai-black dark:text-oai-white":v?"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}-${x}`)}const Lr={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 Oe({rank:a,placeholder:r}){const o=Lr[a];return o?e.jsx("span",{className:c("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 Fe(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Er(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 pe(a){return typeof a!="string"?"":a.trim()}function be(a){const r=pe(a);return r?r.toLowerCase()==="anonymous":!0}function he(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Ge({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(ye,{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(Sa,{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 ot({auth:a,signedIn:r,sessionSoftExpired:o}){const i=pa(),l=ba(),{openLoginModal:n}=ha(),{signedIn:m,loading:p,user:u}=ya(),{currency:h,rate:v}=Ya(),y=d.useMemo(()=>fa(),[]),b=ka(),x=r&&!o,E=d.useMemo(()=>x&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,x]),C=x?E:null,ee=x&&wa(C),ae=s("shared.placeholder.short"),Xe=d.useMemo(()=>q.map(t=>t.key),[]),{order:re,reorder:fe}=ur(Xe),ke=d.useMemo(()=>{const t=new Map;for(const g of q)t.set(g.key,g);return t},[]),B=d.useMemo(()=>re.map(t=>ke.get(t)).filter(Boolean),[re,ke]),qe=Ba($e(Ha,{activationConstraint:{distance:6}}),$e(Ga,{coordinateGetter:Fa})),Qe=d.useCallback(t=>{const{active:g,over:w}=t;!w||g.id===w.id||fe(String(g.id),String(w.id))},[fe]),[te,M]=d.useState(1),[_,ea]=d.useState(kr),[we,ve]=d.useState(null),[je,Ne]=d.useState(!1),W=d.useCallback(t=>{typeof t=="string"&&t.trim()&&ve(t.trim())},[]),aa=d.useCallback(()=>ve(null),[]),ra=d.useCallback(t=>{const g=me.includes(t)?t:ge;ea(g),M(1);try{window.localStorage.setItem(Ze,String(g))}catch{}},[]),[_e,ta]=d.useState(0),[oa,sa]=d.useState(()=>va()),[Se,Ce]=d.useState(!1);d.useEffect(()=>{if(typeof window>"u")return;const t=()=>{ta(g=>g+1)};return window.addEventListener(De,t),()=>{window.removeEventListener(De,t)}},[]);const N=d.useMemo(()=>{const t=new URLSearchParams(i?.search||"");return Fe(t.get("period"))||"total"},[i?.search]),ia=t=>{const g=Fe(t);if(!g||g===N)return;const w=new URLSearchParams(i?.search||"");w.set("period",g),M(1),l(`${i?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};d.useEffect(()=>{p||b||m||n()},[m,p,b,n]),d.useEffect(()=>{M(1)},[N]);const Y=d.useMemo(()=>(H(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),R=d.useMemo(()=>b?"mock":p?"unavailable":m?"cloud":r?"local":y?"public":"unavailable",[p,m,y,b,r]),k=d.useMemo(()=>ja({accessMode:R,baseUrl:y,mockEnabled:b,userId:u?.id||null,period:N,pageSize:_,offset:Y}),[u?.id,R,y,Y,b,_,N]),[D,$]=d.useState(()=>{const t=ie(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});d.useEffect(()=>{if(!y&&!b||!b&&R==="unavailable"){$({loading:!1,error:null,data:null,contextKey:null});return}const t=ie(k);let g=!0;return $(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await Na({userId:u?.id||null,period:N,limit:_,offset:Y});g&&(_a(w,{activeContextKey:k,contextKey:k,source:_e>0?"manual-refresh":"page-load"}),$({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!g)return;const T=Er(w);$(F=>F.contextKey===k?{...F,loading:!1,error:T}:{loading:!1,error:T,data:null,contextKey:k})}),()=>{g=!1}},[y,R,u?.id,k,Y,_e,b,N,_]);const oe=d.useMemo(()=>D.contextKey===k?null:ie(k),[k,D.contextKey]),j=d.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(y||b)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,y,k,D,b,oe]),S=j.data,U=S?.total_pages??null,na=S?.total_entries??0,P=S?.page??te,la=d.useMemo(()=>rr(P,U),[P,U]),Ae=S?.from||null,Le=S?.to||null,da=S?.generated_at||null,V=wr(da),Ee=ar(),K=S?.me||null,I=s("leaderboard.me_label"),Te=s("leaderboard.anon_label"),Me=s("leaderboard.period.week"),Pe=s("leaderboard.period.month"),Ke=s("leaderboard.period.total"),Re=N==="month"?Pe:N==="total"?Ke:Me,J=d.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:K,meLabel:I})},[S?.entries,K,I]),z=d.useMemo(()=>sr(K?.rank,_),[K?.rank,_]),ca=z!=null&&z===P,ma=d.useCallback(()=>{z!=null&&M(z)},[z]),ga=async()=>{Ce(!0);try{La(!0),sa(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{Ce(!1)}},{canPrev:Ie,canNext:ze}=tr({page:P,totalPages:U}),Z=Array.isArray(J)&&J.length!==0;let O=null;j.loading&&!Z?O=e.jsx(cr,{rows:_}):j.error&&!Z?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:j.error})}):Z?O=e.jsxs(Da,{sensors:qe,collisionDetection:$a,modifiers:[Wa],onDragEnd:Qe,children:[e.jsx(We,{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:c(Ye,"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:c(Ve,"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(Ua,{items:re,strategy:Oa,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(nr,{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,g)=>{if(t?.is_ellipsis){const L=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:L,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-${g}`)}const w=!!t?.is_me,T=typeof t?.user_id=="string"?t.user_id:null,F=pe(t?.display_name),ua=be(F)?Te:F,A=w?I:ua,G=!!T,Be=G?{role:"button",tabIndex:0,onClick:G?()=>W(T):void 0,onKeyDown:G?L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),W(T))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:A})}:{};if(w){const L=!!t?.is_pinned;return e.jsxs("tr",{...Be,className:c("bg-oai-gray-50 dark:bg-oai-gray-900 transition-colors",L?"border-t border-b border-oai-gray-300/40 dark:border-oai-gray-500/20":"border-y border-oai-gray-300/40 dark:border-oai-gray-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-500/60"),children:[e.jsx("td",{className:c(de(!0),"font-semibold text-oai-gray-700 dark:text-oai-gray-300",L&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-gray-500 dark:before:bg-oai-gray-400"),children:e.jsx(Oe,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:ce(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:c("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&t?.pro_active!==!0&&"gh-avatar-frame"),children:[e.jsx("span",{className:c("inline-flex rounded-full p-px",t?.github_url&&t?.pro_active!==!0&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(X,{avatarUrl:t?.avatar_url,displayName:A,seed:he(t,A),proActive:t?.pro_active===!0})}),t?.github_url&&e.jsx(Ge,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:A}),e.jsx(ne,{proActive:t?.pro_active===!0}),e.jsx(le,{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-gray-50 dark:bg-oai-gray-900",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-gray-700 dark:text-oai-gray-300 whitespace-nowrap text-right tabular-nums bg-oai-gray-50 dark:bg-oai-gray-900",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,h,v)}),e.jsx(Ue,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${A}${L?"-pin":""}`)}return e.jsxs("tr",{...Be,className:c("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-gray-500/60"),children:[e.jsx("td",{className:c(de(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(Oe,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:ce(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:c("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&t?.pro_active!==!0&&"gh-avatar-frame"),children:[e.jsx("span",{className:c("inline-flex rounded-full p-px",t?.github_url&&t?.pro_active!==!0&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(X,{avatarUrl:t?.avatar_url,displayName:A,seed:he(t,A),proActive:t?.pro_active===!0})}),t?.github_url&&e.jsx(Ge,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:A}),e.jsx(ne,{proActive:t?.pro_active===!0}),e.jsx(le,{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,h,v)}),e.jsx(Ue,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${A}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,g)=>{const w=pe(t?.display_name),T=be(w)?Te:w;return e.jsx(Ar,{entry:t,entryIdx:g,name:t?.is_me?I:T,meLabel:I,currency:h,rate:v,orderedColumns:B,placeholder:ae,onOpenProfile:W},`mobile-${t?.rank??"ellipsis"}-${g}`)})})]}):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=la.map((t,g)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.pagination.ellipsis")},`ellipsis-${g}`):e.jsx("button",{className:c("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:j.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"):Ae&&Le?s("leaderboard.range",{period:Re,from:Ae,to:Le}):s("leaderboard.range_loading",{period:Re}),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 g=N===t;return e.jsxs("button",{onClick:()=>ia(t),disabled:j.loading,className:c("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",g?"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"?Me:t==="month"?Pe:Ke}),g&&e.jsx(Ra.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(vr,{communityStats:Ee,onClick:()=>Ne(!0)}),e.jsx(hr,{me:K,totalEntries:na,meLabel:I,onOpenProfile:K?.user_id?()=>W(K.user_id):void 0,onJumpToMe:ma,canJump:z!=null&&!ca&&!j.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:n,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")})]}),x&&ee&&!oa&&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:ga,disabled:Se,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:Se?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:[j.error&&Z?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:j.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(Ka,{id:"leaderboard-page-size",value:_,onValueChange:t=>ra(Number(t)),disabled:j.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:me.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:c("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",Ie&&!j.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:!Ie||j.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:c("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",ze&&!j.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:!ze||j.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(d.Suspense,{fallback:null,children:[e.jsx(yr,{isOpen:!!we,userId:we,period:N,accessToken:C,onClose:aa}),je&&e.jsx(fr,{isOpen:je,onClose:()=>Ne(!1),communityStats:Ee})]})]})}export{ot as LeaderboardPage};
@@ -1 +1 @@
1
- import{V as u,j as o,y as m,r as b,c as n}from"./__vite-browser-external-B_Ak9BfX.js";import{T as g,F as j,a as y,b as w,c as P,d as T,e as v}from"./TooltipPopup-BbUjKoYP.js";function C(a){let e=0;const r=String(a??"");for(let t=0;t<r.length;t+=1)e=Math.imul(31,e)+r.charCodeAt(t)|0;return Math.abs(e)%360}function E(a){const e=String(a??"").trim();if(!e)return"?";const r=e.split(/\s+/).filter(Boolean);if(r.length>=2){const t=r[0][0]||"",i=r[1][0]||"";return`${t}${i}`.toUpperCase()}return e.slice(0,2).toUpperCase()}const h={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 L({avatarUrl:a,displayName:e,seed:r,size:t="md",proActive:i=!1,className:s}){const d=h[t]||h.md,f=C(r??e??""),l=typeof a=="string"?a.trim():"",[x,c]=u.useState(!1),p=i===!0?"leaderboard-pro-avatar":null;return u.useEffect(()=>{c(!1)},[l]),l&&!x?o.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",onError:()=>c(!0),className:m("rounded-full object-cover ring-1 ring-white/10",d,s,p)}):o.jsx("div",{className:m("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,s,p),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:E(e)})}const S=function(e){const{delay:r,closeDelay:t,timeout:i=400}=e,s=b.useMemo(()=>({open:r,close:t}),[r,t]);return o.jsx(g.Provider,{value:r,children:o.jsx(j,{delay:s,timeoutMs:i,children:e.children})})};function M({proActive:a=!1}){return a!==!0?null:o.jsx(S,{delay:350,children:o.jsxs(y,{children:[o.jsx(w,{render:o.jsx("span",{role:"img",tabIndex:0}),className:"leaderboard-pro-badge","aria-label":n("leaderboard.pro.badge_aria"),"aria-description":n("leaderboard.pro.tooltip"),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.stopPropagation()},children:n("leaderboard.pro.badge")}),o.jsx(P,{children:o.jsx(T,{side:"top",sideOffset:6,className:"leaderboard-pro-tooltip-layer",children:o.jsx(v,{className:"leaderboard-pro-tooltip",children:n("leaderboard.pro.tooltip")})})})]})})}export{L,M as a};
1
+ import{V as u,j as o,y as m,r as b,c as n}from"./__vite-browser-external-RPZeXrAv.js";import{T as g,F as j,a as y,b as w,c as P,d as T,e as v}from"./TooltipPopup-BxvShS92.js";function C(a){let e=0;const r=String(a??"");for(let t=0;t<r.length;t+=1)e=Math.imul(31,e)+r.charCodeAt(t)|0;return Math.abs(e)%360}function E(a){const e=String(a??"").trim();if(!e)return"?";const r=e.split(/\s+/).filter(Boolean);if(r.length>=2){const t=r[0][0]||"",i=r[1][0]||"";return`${t}${i}`.toUpperCase()}return e.slice(0,2).toUpperCase()}const h={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 L({avatarUrl:a,displayName:e,seed:r,size:t="md",proActive:i=!1,className:s}){const d=h[t]||h.md,f=C(r??e??""),l=typeof a=="string"?a.trim():"",[x,c]=u.useState(!1),p=i===!0?"leaderboard-pro-avatar":null;return u.useEffect(()=>{c(!1)},[l]),l&&!x?o.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",onError:()=>c(!0),className:m("rounded-full object-cover ring-1 ring-white/10",d,s,p)}):o.jsx("div",{className:m("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,s,p),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:E(e)})}const S=function(e){const{delay:r,closeDelay:t,timeout:i=400}=e,s=b.useMemo(()=>({open:r,close:t}),[r,t]);return o.jsx(g.Provider,{value:r,children:o.jsx(j,{delay:s,timeoutMs:i,children:e.children})})};function M({proActive:a=!1}){return a!==!0?null:o.jsx(S,{delay:350,children:o.jsxs(y,{children:[o.jsx(w,{render:o.jsx("span",{role:"img",tabIndex:0}),className:"leaderboard-pro-badge","aria-label":n("leaderboard.pro.badge_aria"),"aria-description":n("leaderboard.pro.tooltip"),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.stopPropagation()},children:n("leaderboard.pro.badge")}),o.jsx(P,{children:o.jsx(T,{side:"top",sideOffset:6,className:"leaderboard-pro-tooltip-layer",children:o.jsx(v,{className:"leaderboard-pro-tooltip",children:n("leaderboard.pro.tooltip")})})})]})})}export{L,M as a};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-CeQAQnvy.js","assets/__vite-browser-external-B_Ak9BfX.js","assets/__vite-browser-external-D-6XhI1J.css","assets/react-CtkV3-wh.js","assets/AchievementBadge-Dcte0u7Q.js","assets/zap-C_I-50QM.js","assets/flame-DmLbd0WE.js","assets/calendar-days-D8_AIpYW.js","assets/shield-check-wza85ghk.js","assets/use-transform-ClgKBuvp.js","assets/use-reduced-motion-CycTdnVI.js","assets/AchievementsSection-CKLbhnv4.js","assets/format-tokens-C9l4wsWw.js","assets/DialogTitle-rghekf5V.js","assets/composite-BP8srk6k.js","assets/store-DbhIVK4c.js"])))=>i.map(i=>d[i]);
2
- import{o as ie,a as G,r as p,aO as ne,j as e,c as i,aP as le,Q as de,U as ce,aQ as me,aR as xe,y as m,x as ge,aA as X,A as pe,L as he,V as Y,an as ue,l as fe,az as be,X as ye,i as ke,_ as je,aS as ve}from"./__vite-browser-external-B_Ak9BfX.js";import{A as _e,f as Ne}from"./provider-display-IAeTGJgJ.js";import{u as we}from"./useCurrency-BAiCSmN2.js";import{u as K}from"./useTokenFormat-CCOw1o2r.js";import{L as V,a as q}from"./LeaderboardProBadge-C_wZHdAl.js";import{P as R}from"./ProviderIcon-DY-51nC9.js";import{H as Ae,A as Q,s as Se,c as Me,b as ze,t as De,h as Pe}from"./AchievementBadge-Dcte0u7Q.js";import{A as Ce}from"./AchievementsSection-CKLbhnv4.js";import{A as F}from"./arrow-up-right-DFDvNYfd.js";import{L as Te}from"./link-2-B5p2Qkwq.js";import{C as Ie}from"./check-CVT0rVJu.js";import{D as Be,a as Le,b as $e,c as Ue,d as Re,e as Fe}from"./DialogTitle-rghekf5V.js";import"./terminal-Bc6vt9uT.js";import"./play-B8EgTxWo.js";import"./info-D-BzxoMg.js";import"./TooltipPopup-BbUjKoYP.js";import"./composite-BP8srk6k.js";import"./store-DbhIVK4c.js";import"./safePolygon-DSioykei.js";import"./usePositioner-BSnQWD-E.js";import"./zap-C_I-50QM.js";import"./flame-DmLbd0WE.js";import"./calendar-days-D8_AIpYW.js";import"./shield-check-wza85ghk.js";import"./react-CtkV3-wh.js";import"./format-tokens-C9l4wsWw.js";import"./use-reduced-motion-CycTdnVI.js";const J={name:"code-xml",size:24,node:[["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"}]],aliases:["code-2"]};J.node;const Oe=ie(J),O="tokentracker_anon_id";let z=null;function H(){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 E(){if(z)return z;try{let a=localStorage.getItem(O);return a||(a=H(),localStorage.setItem(O,a)),z=a,a}catch{return z=H(),z}}function ee({userId:a}){const{signedIn:r,getAccessToken:o}=G(),[t,s]=p.useState(!1),[n,x]=p.useState(0),[l,c]=p.useState(!1),[u,k]=p.useState(!1),[v,D]=p.useState(!1),[P,b]=p.useState([]),[A,C]=p.useState(!1),T=p.useRef(0),_=p.useCallback(async()=>{if(r)try{const d=await o();if(d)return{accessToken:d,anonId:E()}}catch{}return{anonId:E()}},[r,o]);p.useEffect(()=>{let d=!1;return a?(c(!1),(async()=>{const g=await _();try{const h=await ne({userId:a,...g});if(d)return;x(Number(h?.count)||0),s(!!h?.liked),c(!0)}catch{if(d)return;x(0),s(!1),c(!0)}})(),()=>{d=!0}):(c(!1),()=>{d=!0})},[a,_]);const I=()=>{D(!0),setTimeout(()=>D(!1),450),C(!0),setTimeout(()=>C(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],g=["circle","heart"],h=[];for(let f=0;f<12;f++){const j=(f*30+Math.random()*20-10)*(Math.PI/180),w=45+Math.random()*45,y=Math.cos(j)*w,M=Math.sin(j)*w-(10+Math.random()*15),$=Math.random()*360-180,re=6+Math.random()*8,te=d[Math.floor(Math.random()*d.length)],se=g[Math.floor(Math.random()*g.length)],oe=++T.current;h.push({id:oe,tx:y,ty:M,rot:$,size:re,color:te,shape:se})}b(f=>[...f,...h]),setTimeout(()=>{b(f=>f.filter(j=>!h.find(w=>w.id===j.id)))},850)},S=async d=>{k(!0);try{const g=await _(),h=await le({userId:a,action:d,...g});h&&Number.isFinite(Number(h.count))&&x(Number(h.count)),h&&typeof h.liked=="boolean"&&s(h.liked)}catch{s(g=>!g),x(g=>d==="like"?Math.max(0,g-1):g+1)}finally{k(!1)}},N=d=>{d.stopPropagation(),!(!a||!l||u)&&(t?(s(!1),x(g=>Math.max(0,g-1)),S("unlike")):(s(!0),x(g=>g+1),I(),S("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-BHxQ8umD.js","assets/__vite-browser-external-RPZeXrAv.js","assets/__vite-browser-external-D-6XhI1J.css","assets/react-Cy_Eczdb.js","assets/AchievementBadge-DvcPjqX7.js","assets/zap-BL_hxkkj.js","assets/flame-CP7hkBXq.js","assets/calendar-days-B6p2eInB.js","assets/shield-check-DWiYKLWx.js","assets/use-transform-C32HObUN.js","assets/use-reduced-motion-uryC1l51.js","assets/AchievementsSection-g0JGNGfT.js","assets/format-tokens-Biw6wloc.js","assets/DialogTitle-Bn14t_Xd.js","assets/composite-BJuoijSA.js","assets/store-C91MN0gm.js"])))=>i.map(i=>d[i]);
2
+ import{o as ie,a as G,r as p,aO as ne,j as e,c as i,aP as le,Q as de,U as ce,aQ as me,aR as xe,y as m,x as ge,aA as X,A as pe,L as he,V as Y,an as ue,l as fe,az as be,X as ye,i as ke,_ as je,aS as ve}from"./__vite-browser-external-RPZeXrAv.js";import{A as _e,f as Ne}from"./provider-display-BwVQXnb2.js";import{u as we}from"./useCurrency-BsGBVGb5.js";import{u as K}from"./useTokenFormat-Dryg74BA.js";import{L as V,a as q}from"./LeaderboardProBadge-B7uhXYjD.js";import{P as R}from"./ProviderIcon-BcE1tBpR.js";import{H as Ae,A as Q,s as Se,c as Me,b as ze,t as De,h as Pe}from"./AchievementBadge-DvcPjqX7.js";import{A as Ce}from"./AchievementsSection-g0JGNGfT.js";import{A as F}from"./arrow-up-right-H5sP370z.js";import{L as Te}from"./link-2-B2C7-GOt.js";import{C as Ie}from"./check-DgFRXvUP.js";import{D as Be,a as Le,b as $e,c as Ue,d as Re,e as Fe}from"./DialogTitle-Bn14t_Xd.js";import"./terminal-CZUta1FC.js";import"./play-C7GLNAdX.js";import"./info-Bba3RZJA.js";import"./TooltipPopup-BxvShS92.js";import"./composite-BJuoijSA.js";import"./store-C91MN0gm.js";import"./safePolygon-DiPfgohh.js";import"./usePositioner-DvFrrUs0.js";import"./zap-BL_hxkkj.js";import"./flame-CP7hkBXq.js";import"./calendar-days-B6p2eInB.js";import"./shield-check-DWiYKLWx.js";import"./react-Cy_Eczdb.js";import"./format-tokens-Biw6wloc.js";import"./use-reduced-motion-uryC1l51.js";const J={name:"code-xml",size:24,node:[["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"}]],aliases:["code-2"]};J.node;const Oe=ie(J),O="tokentracker_anon_id";let z=null;function H(){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 E(){if(z)return z;try{let a=localStorage.getItem(O);return a||(a=H(),localStorage.setItem(O,a)),z=a,a}catch{return z=H(),z}}function ee({userId:a}){const{signedIn:r,getAccessToken:o}=G(),[t,s]=p.useState(!1),[n,x]=p.useState(0),[l,c]=p.useState(!1),[u,k]=p.useState(!1),[v,D]=p.useState(!1),[P,b]=p.useState([]),[A,C]=p.useState(!1),T=p.useRef(0),_=p.useCallback(async()=>{if(r)try{const d=await o();if(d)return{accessToken:d,anonId:E()}}catch{}return{anonId:E()}},[r,o]);p.useEffect(()=>{let d=!1;return a?(c(!1),(async()=>{const g=await _();try{const h=await ne({userId:a,...g});if(d)return;x(Number(h?.count)||0),s(!!h?.liked),c(!0)}catch{if(d)return;x(0),s(!1),c(!0)}})(),()=>{d=!0}):(c(!1),()=>{d=!0})},[a,_]);const I=()=>{D(!0),setTimeout(()=>D(!1),450),C(!0),setTimeout(()=>C(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],g=["circle","heart"],h=[];for(let f=0;f<12;f++){const j=(f*30+Math.random()*20-10)*(Math.PI/180),w=45+Math.random()*45,y=Math.cos(j)*w,M=Math.sin(j)*w-(10+Math.random()*15),$=Math.random()*360-180,re=6+Math.random()*8,te=d[Math.floor(Math.random()*d.length)],se=g[Math.floor(Math.random()*g.length)],oe=++T.current;h.push({id:oe,tx:y,ty:M,rot:$,size:re,color:te,shape:se})}b(f=>[...f,...h]),setTimeout(()=>{b(f=>f.filter(j=>!h.find(w=>w.id===j.id)))},850)},S=async d=>{k(!0);try{const g=await _(),h=await le({userId:a,action:d,...g});h&&Number.isFinite(Number(h.count))&&x(Number(h.count)),h&&typeof h.liked=="boolean"&&s(h.liked)}catch{s(g=>!g),x(g=>d==="like"?Math.max(0,g-1):g+1)}finally{k(!1)}},N=d=>{d.stopPropagation(),!(!a||!l||u)&&(t?(s(!1),x(g=>Math.max(0,g-1)),S("unlike")):(s(!0),x(g=>g+1),I(),S("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{o as ie,a as G,r as p,aO as ne,j as e,c as i,aP as le,Q as de,U as ce,aQ
39
39
  .tt-num-anim {
40
40
  animation: tt-num-scroll 0.25s ease-out forwards;
41
41
  }
42
- `}}),P.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:N,disabled:!l||u,"aria-label":t?i("leaderboard.profile.like.aria_unlike"):i("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:v?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(Ae,{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"} ${A?"tt-num-anim":""}`,children:l?n:"·"})]})]})}function He({badge:a,badgeLabel:r,className:o="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${o}`,children:[e.jsx(V,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(Q,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Ee({badges:a,isOwn:r=!1,onSelect:o,className:t=""}){const s=Se((Array.isArray(a)?a:[]).filter(n=>n&&Me.has(n.id))).filter(n=>r||(n.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((n,x)=>{const l=(n.tier||0)>=1,c=i(ze(n.id,"name")),u=l?i(`achievements.tier.${De(n.tier)}`):i("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:o?()=>o(n):void 0,title:`${c} · ${u}`,"aria-label":i("achievements.badge.aria",{name:c,tier:u}),style:{zIndex:s.length-x},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(Q,{badgeId:n.id,tier:n.tier,locked:!l,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},n.id)})})}const We=Y.lazy(()=>je(()=>import("./BadgeDetailModal-CeQAQnvy.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])));function Ze(a,r,o){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:X(t,{decimals:2,currency:r,rate:o})}function W(a,r,o){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Ze(t,r,o);const s=r==="USD"?t:t*(o||1);return`${r==="USD"?"$":""}${ke(s,{decimals:1})}`}function Ge(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const o=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return be({dailyRows:o,weeks:52,to:t})}const Xe=`
42
+ `}}),P.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:N,disabled:!l||u,"aria-label":t?i("leaderboard.profile.like.aria_unlike"):i("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:v?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(Ae,{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"} ${A?"tt-num-anim":""}`,children:l?n:"·"})]})]})}function He({badge:a,badgeLabel:r,className:o="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${o}`,children:[e.jsx(V,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(Q,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Ee({badges:a,isOwn:r=!1,onSelect:o,className:t=""}){const s=Se((Array.isArray(a)?a:[]).filter(n=>n&&Me.has(n.id))).filter(n=>r||(n.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((n,x)=>{const l=(n.tier||0)>=1,c=i(ze(n.id,"name")),u=l?i(`achievements.tier.${De(n.tier)}`):i("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:o?()=>o(n):void 0,title:`${c} · ${u}`,"aria-label":i("achievements.badge.aria",{name:c,tier:u}),style:{zIndex:s.length-x},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(Q,{badgeId:n.id,tier:n.tier,locked:!l,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},n.id)})})}const We=Y.lazy(()=>je(()=>import("./BadgeDetailModal-BHxQ8umD.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])));function Ze(a,r,o){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:X(t,{decimals:2,currency:r,rate:o})}function W(a,r,o){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Ze(t,r,o);const s=r==="USD"?t:t*(o||1);return`${r==="USD"?"$":""}${ke(s,{decimals:1})}`}function Ge(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const o=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return be({dailyRows:o,weeks:52,to:t})}const Xe=`
43
43
  @keyframes tt-shimmer {
44
44
  100% { transform: translateX(100%); }
45
45
  }
@@ -1,4 +1,4 @@
1
- import{r as _,j as p,ao as xe,u as ge,a as ve,A as be,L as Tt,ap as we,c as Y,aq as ye}from"./__vite-browser-external-B_Ak9BfX.js";import{u as ke}from"./useCurrency-BAiCSmN2.js";import{H as Me}from"./HeaderGithubStar-9OXB09VZ.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-jaz4TCLd.js";import{D as Te}from"./download-DD5b8DO2.js";import"./provider-display-IAeTGJgJ.js";import"./useTokenFormat-CCOw1o2r.js";import"./terminal-Bc6vt9uT.js";import"./play-B8EgTxWo.js";import"./info-D-BzxoMg.js";import"./LeaderboardProBadge-C_wZHdAl.js";import"./TooltipPopup-BbUjKoYP.js";import"./composite-BP8srk6k.js";import"./store-DbhIVK4c.js";import"./safePolygon-DSioykei.js";import"./usePositioner-BSnQWD-E.js";import"./ProviderIcon-DY-51nC9.js";import"./AchievementBadge-Dcte0u7Q.js";import"./zap-C_I-50QM.js";import"./flame-DmLbd0WE.js";import"./calendar-days-D8_AIpYW.js";import"./shield-check-wza85ghk.js";import"./AchievementsSection-CKLbhnv4.js";import"./react-CtkV3-wh.js";import"./format-tokens-C9l4wsWw.js";import"./use-reduced-motion-CycTdnVI.js";import"./arrow-up-right-DFDvNYfd.js";import"./link-2-B5p2Qkwq.js";import"./check-CVT0rVJu.js";import"./DialogTitle-rghekf5V.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,ao as xe,u as ge,a as ve,A as be,L as Tt,ap as we,c as Y,aq as ye}from"./__vite-browser-external-RPZeXrAv.js";import{u as ke}from"./useCurrency-BsGBVGb5.js";import{H as Me}from"./HeaderGithubStar-B2CCV29J.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-_QOUdhsi.js";import{D as Te}from"./download-BI-n3YEd.js";import"./provider-display-BwVQXnb2.js";import"./useTokenFormat-Dryg74BA.js";import"./terminal-CZUta1FC.js";import"./play-C7GLNAdX.js";import"./info-Bba3RZJA.js";import"./LeaderboardProBadge-B7uhXYjD.js";import"./TooltipPopup-BxvShS92.js";import"./composite-BJuoijSA.js";import"./store-C91MN0gm.js";import"./safePolygon-DiPfgohh.js";import"./usePositioner-DvFrrUs0.js";import"./ProviderIcon-BcE1tBpR.js";import"./AchievementBadge-DvcPjqX7.js";import"./zap-BL_hxkkj.js";import"./flame-CP7hkBXq.js";import"./calendar-days-B6p2eInB.js";import"./shield-check-DWiYKLWx.js";import"./AchievementsSection-g0JGNGfT.js";import"./react-Cy_Eczdb.js";import"./format-tokens-Biw6wloc.js";import"./use-reduced-motion-uryC1l51.js";import"./arrow-up-right-H5sP370z.js";import"./link-2-B2C7-GOt.js";import"./check-DgFRXvUP.js";import"./DialogTitle-Bn14t_Xd.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=`
@@ -1,4 +1,4 @@
1
- import{o as Q,j as e,y as Xe,c as i,h as W,r as p,bV as de,aW as Ot,X as Lt,E as Ie,p as Ae,w as Je,q as Ft,bW as $t,V as _,bX as zt,bY as Ut,al as Bt,B as ie,bZ as Gt,e as Wt,W as ke,R as Kt,L as qt,b_ as Vt,t as Yt}from"./__vite-browser-external-B_Ak9BfX.js";import{m as He}from"./react-CtkV3-wh.js";import{P as se,c as Zt,r as he,a as Xt,u as Jt,b as Qt,s as ea}from"./use-usage-limits-5G-X_GcH.js";import{b as Qe,c as D,l as xe,d as et,u as ta,h as Oe}from"./use-limits-display-prefs-BWRgNpTD.js";import{F as aa}from"./FadeIn-DuQUR18k.js";import{P as tt}from"./ProviderIcon-DY-51nC9.js";import{H as ia}from"./HoverTooltip-CrAJfXcz.js";import{L as Le}from"./loader-circle-Dt8s_KQR.js";import{P as at,a as it,b as rt,c as st,d as nt}from"./PopoverPopup-X18Fm0Xt.js";import{C as ne}from"./chevron-down-DaRfvtjf.js";import{G as ra}from"./gift-BTUos8LQ.js";import{C as sa}from"./ConfirmModal-8chTLqb2.js";import{I as Fe,L as na}from"./LocalOnlyNotice-I6rapOVN.js";import{S as je}from"./Select-Sp_Ah2BS.js";import{P as oa}from"./plus-BxfcxXGQ.js";import{u as la}from"./use-reduced-motion-CycTdnVI.js";import"./use-latest-request-guard-e-8mh_k7.js";import"./store-DbhIVK4c.js";import"./composite-BP8srk6k.js";import"./SelectItemText-D-D_9JvK.js";import"./usePositioner-BSnQWD-E.js";import"./safePolygon-DSioykei.js";import"./DialogTitle-rghekf5V.js";import"./DialogDescription-DqRRqHn4.js";import"./arrow-up-right-DFDvNYfd.js";import"./download-DD5b8DO2.js";import"./check-CVT0rVJu.js";const ot={name:"bell-off",size:24,node:[["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"}]]};ot.node;const ca=Q(ot);const lt={name:"bell",size:24,node:[["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"}]]};lt.node;const da=Q(lt);const ct={name:"calendar-clock",size:24,node:[["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"}]]};ct.node;const dt=Q(ct);const ut={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};ut.node;const Pe=Q(ut);const mt={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};mt.node;const ua=Q(mt);const xt={name:"infinity",size:24,node:[["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"}]]};xt.node;const pt=Q(xt),ma=[3,2,3,3,2,2,3];function Z({className:t}){return e.jsx("div",{className:Xe("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function xa(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-3 w-12 shrink-0"}),e.jsx(Z,{className:"flex-1 h-1.5 rounded-full min-w-0"}),e.jsx(Z,{className:"h-3 w-[30px] shrink-0"}),e.jsx(Z,{className:"h-3 w-6 shrink-0"})]})}function pa({bars:t,index:a}){const r=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return e.jsxs("div",{className:"rounded-xl border border-oai-gray-200 bg-white dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-oai-gray-200 px-4 py-4 dark:border-oai-gray-800 sm:px-5",children:[e.jsx(Z,{className:"h-[22px] w-[22px] shrink-0 rounded"}),e.jsx(Z,{className:Xe("h-4",r)})]}),e.jsx("div",{className:"flex flex-col gap-2 px-4 py-4 sm:px-5",children:Array.from({length:t},(n,s)=>e.jsx(xa,{},s))})]})}function ga(){return e.jsx("div",{className:"flex flex-col gap-3","aria-hidden":"true",children:ma.map((t,a)=>e.jsx(pa,{bars:t,index:a},a))})}const _e=100;function $e(t){const a=Date.parse(t);return Number.isFinite(a)?a:null}function ha(t){return Math.max(0,Math.min(_e,Math.round(t)))}function fa(t){return new Intl.DateTimeFormat(W(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t))}function ba(t,a,r){if(t==null||t>=a)return _e;const n=a-t,s=a-r;return ha(s/n*_e)}function ya(t){const a=t.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function va(t,{now:a}={}){if(!t||typeof t!="object")return null;const r=ya(t);if(r===void 0)return null;const n=Array.isArray(t.credits)?t.credits:[],s=a instanceof Date?a.getTime():Number(a??Date.now()),o=[];for(const c of n){const l=$e(c?.expires_at);if(l==null)continue;const d=o.length+1;o.push({key:`reset-${d}`,label:i("limits.codex_reset_bank.row_label",{index:d}),expiresAt:fa(l),expiresMs:l,percent:ba($e(c?.granted_at),l,s)})}return r===0?null:o.length>0?{kind:"rows",availableCount:r??o.length,rows:o}:r>0?{kind:"count_only",availableCount:r,rows:[]}:null}const oe=864e5;function G(t,a){const r=new Date(t),n=r.getUTCDate(),s=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+a,1,r.getUTCHours(),r.getUTCMinutes())),o=new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth()+1,0)).getUTCDate();return s.setUTCDate(Math.min(n,o)),s.getTime()}function gt(t,a){if(a==="weekly")return t-7*oe;if(a==="yearly")return G(t,-12);const r=new Date(t),n=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),0)).getUTCDate(),s=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()-1,1,r.getUTCHours(),r.getUTCMinutes()));return s.setUTCDate(Math.min(r.getUTCDate(),n)),s.getTime()}function ht(t,a){return a==="weekly"?t+7*oe:a==="yearly"?G(t,12):G(t,1)}function ka(t){if(t.startedAt!=null){const a=new Date(t.startedAt).getTime();if(Number.isFinite(a))return a}return gt(new Date(t.nextBillingAt).getTime(),t.cycle)}function ja(t,a,r){if(t.startedAt!=null){const n=new Date(t.startedAt).getTime();if(Number.isFinite(n))return n}return gt(r,a)}function wa(t,a,r){if(a==="weekly"){const l=7*oe,d=r<=t?0:Math.floor((r-t)/l);return{startMs:t+d*l,endMs:t+(d+1)*l}}const n=a==="yearly"?12:1,s=n*30.436875*oe;let o=r<=t?0:Math.floor((r-t)/s);for(;o>0&&G(t,o*n)>r;)o-=1;let c=0;for(;G(t,(o+1)*n)<=r&&c<12e3;)o+=1,c+=1;return{startMs:G(t,o*n),endMs:G(t,(o+1)*n)}}function pe(t,a){const r=new Date(t.nextBillingAt).getTime();if(!Number.isFinite(r))return null;const n=["weekly","monthly","yearly"].includes(t.cycle)?t.cycle:"monthly",s=ja(t,n,r);if(!Number.isFinite(s))return null;let o,c,l=!1;t.autoRenew?{startMs:o,endMs:c}=wa(s,n,a):t.startedAt!=null?(o=s,c=ht(s,n),l=c<=a):(o=s,c=r,l=c<=a);const d=Math.max(1,c-o),u=l?1:Math.max(0,Math.min(1,(a-o)/d));return{endMs:c,startMs:o,progress:u,cycleDays:Math.max(1,Math.round(d/oe)),expired:l}}function ft(t,a){const r=t-a;if(r<=0)return i("subscriptions.expired");const n=Math.ceil(r/6e4);if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function Se(t,a){const r=t-a;if(r<=0)return i("subscriptions.expired");const n=Math.floor(r/6e4),s=Math.floor(n/1440),o=Math.floor(n%1440/60),c=n%60;return i("subscriptions.countdown",{days:s,hours:o,minutes:c})}const V="inline-flex h-7 items-center justify-center gap-1 rounded-md px-2 text-xs text-oai-gray-600 hover:bg-oai-gray-100 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 disabled:opacity-50";function bt({connected:t=!1,onSaved:a}){const[r,n]=p.useState(null),[s,o]=p.useState("idle"),[c,l]=p.useState(!1),[d,u]=p.useState(!1),m=p.useRef(a);if(m.current=a,p.useEffect(()=>{if(!r)return;let h=!0,f;const j=async()=>{try{const w=await de("poll",r.attemptId);if(!h)return;if(w.status==="pending"){f=setTimeout(j,2e3);return}n(null),o(w.status),w.status==="connected"&&m.current?.()}catch{h&&(n(null),o("failed"))}};return f=setTimeout(j,2e3),()=>{h=!1,clearTimeout(f),de("cancel",r.attemptId).catch(()=>{})}},[r]),!Ot())return null;const x=async()=>{l(!1),o("starting");const h=Ie()||Ae(),f=h?null:window.open("about:blank","_blank");f&&(f.opener=null);try{const j=await de("start");n(j),o("pending"),u(!h&&!f),Ie()?Je({type:"action",name:"openURL",value:j.authUrl}):Ae()?await Ft().postMessage(j.authUrl):f&&f.location.replace(j.authUrl)}catch{f?.close(),n(null),o("failed")}},y=async()=>{l(!1),o("starting");try{await de("disconnect"),o("idle"),m.current?.()}catch{o("failed")}},b=s==="failed"||s==="expired"?i(s==="expired"?"limits.cursor.connection.expired":"limits.cursor.connection.failed"):null;return e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5",onClick:h=>h.stopPropagation(),onKeyDown:h=>h.stopPropagation(),children:[r?e.jsxs(e.Fragment,{children:[d?e.jsx("a",{className:V,href:r.authUrl,target:"_blank",rel:"noopener noreferrer",children:i("limits.cursor.connection.open")}):e.jsxs("span",{role:"status",className:"inline-flex items-center gap-1.5 px-1 text-xs text-oai-gray-500",children:[e.jsx(Le,{size:12,className:"motion-safe:animate-spin","aria-hidden":!0}),i("limits.cursor.connection.waiting")]}),e.jsx("button",{className:V,type:"button","aria-label":i("limits.cursor.connection.cancel"),onClick:()=>{n(null),o("idle")},children:e.jsx(Lt,{size:13,"aria-hidden":!0})})]}):null,!r&&t?e.jsxs(at,{open:c,onOpenChange:l,children:[e.jsx(it,{className:V,"aria-label":i("limits.cursor.connection.manage"),disabled:s==="starting",title:b||i("limits.cursor.connection.manage"),children:e.jsx(ua,{size:16,"aria-hidden":!0})}),e.jsx(rt,{children:e.jsx(st,{side:"bottom",align:"end",sideOffset:6,className:"z-50",children:e.jsxs(nt,{className:"flex min-w-36 flex-col rounded-lg bg-white p-1 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",onClick:h=>h.stopPropagation(),children:[e.jsx("button",{className:`${V} justify-start`,type:"button",onClick:x,children:i("limits.cursor.connection.reconnect")}),e.jsx("button",{className:`${V} justify-start`,type:"button",onClick:y,children:i("limits.cursor.connection.disconnect")})]})})})]}):null,!r&&!t?e.jsxs("button",{className:`${V} border border-oai-gray-300 bg-oai-gray-50 font-medium dark:border-oai-gray-700 dark:bg-oai-gray-800`,type:"button",disabled:s==="starting",onClick:x,title:b||void 0,children:[s==="starting"?e.jsx(Le,{size:12,className:"motion-safe:animate-spin","aria-hidden":!0}):null,i(b?"limits.cursor.connection.retry":"limits.cursor.connection.connect")]}):null,b?e.jsx("span",{role:"alert",className:"sr-only",children:b}):null]})}const Na="shrink-0 text-oai-black dark:text-oai-white",_a={opencodeGo:"OPENCODE_GO_API_KEY",commandCode:"COMMAND_CODE_API_KEY",deepseek:"DEEPSEEK_API_KEY"},Sa={opencodeGo:"opencode-go",commandCode:"command-code",deepseek:"deepseek"};function yt(){const t=typeof navigator>"u"?"":navigator.userAgent||"";return/Windows/i.test(t)?"windows":/Linux/i.test(t)?"linux":"macos"}function vt(){return yt()==="windows"?i("limits.commandCode.setupHint.snippet_login_windows"):i("limits.commandCode.setupHint.snippet_login")}function kt(){return i("limits.devin.setupHint.snippet_login")}function Ca(t){const a=he(t);if(!Number.isFinite(a))return null;const r=a-Date.now();if(r<=0)return i("shared.time.now");const n=Math.floor(r/6e4);if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function jt(t,a){const r=a===D.REMAINING?100-t:t;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function ge(t,a="used_percent"){return t?a==="utilization"?t.utilization:t.used_percent:null}function fe(t,a="reset_at"){return t?a==="resets_at"?t.resets_at:t.reset_at:null}function me(t){const a=Math.max(0,Math.min(100,Number(t)||0)),r=Math.round(a);return a>0&&r===0?i("limits.bar.sub_one_percent"):String(r)}function X(t,{useGrouping:a=!0,maximumFractionDigits:r}={}){const n=Number(t);return Number.isFinite(n)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:r??(n>=100?0:2),useGrouping:a}).format(n):null}function wt(t,a){if(!t||typeof t!="object"||!(Number(t.limit_credits)>0))return null;const r={useGrouping:t.unit!=="calls",maximumFractionDigits:a},n=X(t.used_credits,r),s=X(t.limit_credits,r),o=X(t.remaining_credits,r);if(!n||!s||!o)return null;const c=t.unit==="calls"?"limits.qoder_calls.detail":"limits.codex_credits.detail";return i(c,{used:n,limit:s,remaining:o})}function Me(t,a,r){return Zt({usedPercent:ge(t.window,t.pctField),windowSeconds:Xt(t,t.window),resetMs:he(fe(t.window,t.resetField)),mode:a,now:r})}function J(t){return Number.isFinite(t)?new Intl.DateTimeFormat(W(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):null}function Pa(t,a,r){const n=[_t(t,a,r)],s=he(fe(t.window,t.resetField)),o=J(s);o&&n.push(i(t.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:o}));const c=wt(t.window,t.creditPrecision);return c&&n.push(c),n.join(`
1
+ import{o as Q,j as e,y as Xe,c as i,h as W,r as p,bV as de,aW as Ot,X as Lt,E as Ie,p as Ae,w as Je,q as Ft,bW as $t,V as _,bX as zt,bY as Ut,al as Bt,B as ie,bZ as Gt,e as Wt,W as ke,R as Kt,L as qt,b_ as Vt,t as Yt}from"./__vite-browser-external-RPZeXrAv.js";import{m as He}from"./react-Cy_Eczdb.js";import{P as se,c as Zt,r as he,a as Xt,u as Jt,b as Qt,s as ea}from"./use-usage-limits-6GFRuUdV.js";import{b as Qe,c as D,l as xe,d as et,u as ta,h as Oe}from"./use-limits-display-prefs-Ck2CuPqb.js";import{F as aa}from"./FadeIn-BbC4-H2A.js";import{P as tt}from"./ProviderIcon-BcE1tBpR.js";import{H as ia}from"./HoverTooltip-DiD_l4GJ.js";import{L as Le}from"./loader-circle-Dld8yUT7.js";import{P as at,a as it,b as rt,c as st,d as nt}from"./PopoverPopup-CqUafQx4.js";import{C as ne}from"./chevron-down-D-ny8IBp.js";import{G as ra}from"./gift-Dz9MeN8q.js";import{C as sa}from"./ConfirmModal-Cx1-1xUk.js";import{I as Fe,L as na}from"./LocalOnlyNotice-DnkG5DmI.js";import{S as je}from"./Select-BcFrd0ex.js";import{P as oa}from"./plus-CSKQToSA.js";import{u as la}from"./use-reduced-motion-uryC1l51.js";import"./use-latest-request-guard-Geg2sygc.js";import"./store-C91MN0gm.js";import"./composite-BJuoijSA.js";import"./SelectItemText-C-FBw54p.js";import"./usePositioner-DvFrrUs0.js";import"./safePolygon-DiPfgohh.js";import"./DialogTitle-Bn14t_Xd.js";import"./DialogDescription-DG_4qSj0.js";import"./arrow-up-right-H5sP370z.js";import"./download-BI-n3YEd.js";import"./check-DgFRXvUP.js";const ot={name:"bell-off",size:24,node:[["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"}]]};ot.node;const ca=Q(ot);const lt={name:"bell",size:24,node:[["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"}]]};lt.node;const da=Q(lt);const ct={name:"calendar-clock",size:24,node:[["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"}]]};ct.node;const dt=Q(ct);const ut={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};ut.node;const Pe=Q(ut);const mt={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};mt.node;const ua=Q(mt);const xt={name:"infinity",size:24,node:[["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"}]]};xt.node;const pt=Q(xt),ma=[3,2,3,3,2,2,3];function Z({className:t}){return e.jsx("div",{className:Xe("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function xa(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-3 w-12 shrink-0"}),e.jsx(Z,{className:"flex-1 h-1.5 rounded-full min-w-0"}),e.jsx(Z,{className:"h-3 w-[30px] shrink-0"}),e.jsx(Z,{className:"h-3 w-6 shrink-0"})]})}function pa({bars:t,index:a}){const r=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return e.jsxs("div",{className:"rounded-xl border border-oai-gray-200 bg-white dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-oai-gray-200 px-4 py-4 dark:border-oai-gray-800 sm:px-5",children:[e.jsx(Z,{className:"h-[22px] w-[22px] shrink-0 rounded"}),e.jsx(Z,{className:Xe("h-4",r)})]}),e.jsx("div",{className:"flex flex-col gap-2 px-4 py-4 sm:px-5",children:Array.from({length:t},(n,s)=>e.jsx(xa,{},s))})]})}function ga(){return e.jsx("div",{className:"flex flex-col gap-3","aria-hidden":"true",children:ma.map((t,a)=>e.jsx(pa,{bars:t,index:a},a))})}const _e=100;function $e(t){const a=Date.parse(t);return Number.isFinite(a)?a:null}function ha(t){return Math.max(0,Math.min(_e,Math.round(t)))}function fa(t){return new Intl.DateTimeFormat(W(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t))}function ba(t,a,r){if(t==null||t>=a)return _e;const n=a-t,s=a-r;return ha(s/n*_e)}function ya(t){const a=t.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function va(t,{now:a}={}){if(!t||typeof t!="object")return null;const r=ya(t);if(r===void 0)return null;const n=Array.isArray(t.credits)?t.credits:[],s=a instanceof Date?a.getTime():Number(a??Date.now()),o=[];for(const c of n){const l=$e(c?.expires_at);if(l==null)continue;const d=o.length+1;o.push({key:`reset-${d}`,label:i("limits.codex_reset_bank.row_label",{index:d}),expiresAt:fa(l),expiresMs:l,percent:ba($e(c?.granted_at),l,s)})}return r===0?null:o.length>0?{kind:"rows",availableCount:r??o.length,rows:o}:r>0?{kind:"count_only",availableCount:r,rows:[]}:null}const oe=864e5;function G(t,a){const r=new Date(t),n=r.getUTCDate(),s=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()+a,1,r.getUTCHours(),r.getUTCMinutes())),o=new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth()+1,0)).getUTCDate();return s.setUTCDate(Math.min(n,o)),s.getTime()}function gt(t,a){if(a==="weekly")return t-7*oe;if(a==="yearly")return G(t,-12);const r=new Date(t),n=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),0)).getUTCDate(),s=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()-1,1,r.getUTCHours(),r.getUTCMinutes()));return s.setUTCDate(Math.min(r.getUTCDate(),n)),s.getTime()}function ht(t,a){return a==="weekly"?t+7*oe:a==="yearly"?G(t,12):G(t,1)}function ka(t){if(t.startedAt!=null){const a=new Date(t.startedAt).getTime();if(Number.isFinite(a))return a}return gt(new Date(t.nextBillingAt).getTime(),t.cycle)}function ja(t,a,r){if(t.startedAt!=null){const n=new Date(t.startedAt).getTime();if(Number.isFinite(n))return n}return gt(r,a)}function wa(t,a,r){if(a==="weekly"){const l=7*oe,d=r<=t?0:Math.floor((r-t)/l);return{startMs:t+d*l,endMs:t+(d+1)*l}}const n=a==="yearly"?12:1,s=n*30.436875*oe;let o=r<=t?0:Math.floor((r-t)/s);for(;o>0&&G(t,o*n)>r;)o-=1;let c=0;for(;G(t,(o+1)*n)<=r&&c<12e3;)o+=1,c+=1;return{startMs:G(t,o*n),endMs:G(t,(o+1)*n)}}function pe(t,a){const r=new Date(t.nextBillingAt).getTime();if(!Number.isFinite(r))return null;const n=["weekly","monthly","yearly"].includes(t.cycle)?t.cycle:"monthly",s=ja(t,n,r);if(!Number.isFinite(s))return null;let o,c,l=!1;t.autoRenew?{startMs:o,endMs:c}=wa(s,n,a):t.startedAt!=null?(o=s,c=ht(s,n),l=c<=a):(o=s,c=r,l=c<=a);const d=Math.max(1,c-o),u=l?1:Math.max(0,Math.min(1,(a-o)/d));return{endMs:c,startMs:o,progress:u,cycleDays:Math.max(1,Math.round(d/oe)),expired:l}}function ft(t,a){const r=t-a;if(r<=0)return i("subscriptions.expired");const n=Math.ceil(r/6e4);if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function Se(t,a){const r=t-a;if(r<=0)return i("subscriptions.expired");const n=Math.floor(r/6e4),s=Math.floor(n/1440),o=Math.floor(n%1440/60),c=n%60;return i("subscriptions.countdown",{days:s,hours:o,minutes:c})}const V="inline-flex h-7 items-center justify-center gap-1 rounded-md px-2 text-xs text-oai-gray-600 hover:bg-oai-gray-100 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 disabled:opacity-50";function bt({connected:t=!1,onSaved:a}){const[r,n]=p.useState(null),[s,o]=p.useState("idle"),[c,l]=p.useState(!1),[d,u]=p.useState(!1),m=p.useRef(a);if(m.current=a,p.useEffect(()=>{if(!r)return;let h=!0,f;const j=async()=>{try{const w=await de("poll",r.attemptId);if(!h)return;if(w.status==="pending"){f=setTimeout(j,2e3);return}n(null),o(w.status),w.status==="connected"&&m.current?.()}catch{h&&(n(null),o("failed"))}};return f=setTimeout(j,2e3),()=>{h=!1,clearTimeout(f),de("cancel",r.attemptId).catch(()=>{})}},[r]),!Ot())return null;const x=async()=>{l(!1),o("starting");const h=Ie()||Ae(),f=h?null:window.open("about:blank","_blank");f&&(f.opener=null);try{const j=await de("start");n(j),o("pending"),u(!h&&!f),Ie()?Je({type:"action",name:"openURL",value:j.authUrl}):Ae()?await Ft().postMessage(j.authUrl):f&&f.location.replace(j.authUrl)}catch{f?.close(),n(null),o("failed")}},y=async()=>{l(!1),o("starting");try{await de("disconnect"),o("idle"),m.current?.()}catch{o("failed")}},b=s==="failed"||s==="expired"?i(s==="expired"?"limits.cursor.connection.expired":"limits.cursor.connection.failed"):null;return e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5",onClick:h=>h.stopPropagation(),onKeyDown:h=>h.stopPropagation(),children:[r?e.jsxs(e.Fragment,{children:[d?e.jsx("a",{className:V,href:r.authUrl,target:"_blank",rel:"noopener noreferrer",children:i("limits.cursor.connection.open")}):e.jsxs("span",{role:"status",className:"inline-flex items-center gap-1.5 px-1 text-xs text-oai-gray-500",children:[e.jsx(Le,{size:12,className:"motion-safe:animate-spin","aria-hidden":!0}),i("limits.cursor.connection.waiting")]}),e.jsx("button",{className:V,type:"button","aria-label":i("limits.cursor.connection.cancel"),onClick:()=>{n(null),o("idle")},children:e.jsx(Lt,{size:13,"aria-hidden":!0})})]}):null,!r&&t?e.jsxs(at,{open:c,onOpenChange:l,children:[e.jsx(it,{className:V,"aria-label":i("limits.cursor.connection.manage"),disabled:s==="starting",title:b||i("limits.cursor.connection.manage"),children:e.jsx(ua,{size:16,"aria-hidden":!0})}),e.jsx(rt,{children:e.jsx(st,{side:"bottom",align:"end",sideOffset:6,className:"z-50",children:e.jsxs(nt,{className:"flex min-w-36 flex-col rounded-lg bg-white p-1 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",onClick:h=>h.stopPropagation(),children:[e.jsx("button",{className:`${V} justify-start`,type:"button",onClick:x,children:i("limits.cursor.connection.reconnect")}),e.jsx("button",{className:`${V} justify-start`,type:"button",onClick:y,children:i("limits.cursor.connection.disconnect")})]})})})]}):null,!r&&!t?e.jsxs("button",{className:`${V} border border-oai-gray-300 bg-oai-gray-50 font-medium dark:border-oai-gray-700 dark:bg-oai-gray-800`,type:"button",disabled:s==="starting",onClick:x,title:b||void 0,children:[s==="starting"?e.jsx(Le,{size:12,className:"motion-safe:animate-spin","aria-hidden":!0}):null,i(b?"limits.cursor.connection.retry":"limits.cursor.connection.connect")]}):null,b?e.jsx("span",{role:"alert",className:"sr-only",children:b}):null]})}const Na="shrink-0 text-oai-black dark:text-oai-white",_a={opencodeGo:"OPENCODE_GO_API_KEY",commandCode:"COMMAND_CODE_API_KEY",deepseek:"DEEPSEEK_API_KEY"},Sa={opencodeGo:"opencode-go",commandCode:"command-code",deepseek:"deepseek"};function yt(){const t=typeof navigator>"u"?"":navigator.userAgent||"";return/Windows/i.test(t)?"windows":/Linux/i.test(t)?"linux":"macos"}function vt(){return yt()==="windows"?i("limits.commandCode.setupHint.snippet_login_windows"):i("limits.commandCode.setupHint.snippet_login")}function kt(){return i("limits.devin.setupHint.snippet_login")}function Ca(t){const a=he(t);if(!Number.isFinite(a))return null;const r=a-Date.now();if(r<=0)return i("shared.time.now");const n=Math.floor(r/6e4);if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function jt(t,a){const r=a===D.REMAINING?100-t:t;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function ge(t,a="used_percent"){return t?a==="utilization"?t.utilization:t.used_percent:null}function fe(t,a="reset_at"){return t?a==="resets_at"?t.resets_at:t.reset_at:null}function me(t){const a=Math.max(0,Math.min(100,Number(t)||0)),r=Math.round(a);return a>0&&r===0?i("limits.bar.sub_one_percent"):String(r)}function X(t,{useGrouping:a=!0,maximumFractionDigits:r}={}){const n=Number(t);return Number.isFinite(n)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:r??(n>=100?0:2),useGrouping:a}).format(n):null}function wt(t,a){if(!t||typeof t!="object"||!(Number(t.limit_credits)>0))return null;const r={useGrouping:t.unit!=="calls",maximumFractionDigits:a},n=X(t.used_credits,r),s=X(t.limit_credits,r),o=X(t.remaining_credits,r);if(!n||!s||!o)return null;const c=t.unit==="calls"?"limits.qoder_calls.detail":"limits.codex_credits.detail";return i(c,{used:n,limit:s,remaining:o})}function Me(t,a,r){return Zt({usedPercent:ge(t.window,t.pctField),windowSeconds:Xt(t,t.window),resetMs:he(fe(t.window,t.resetField)),mode:a,now:r})}function J(t){return Number.isFinite(t)?new Intl.DateTimeFormat(W(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):null}function Pa(t,a,r){const n=[_t(t,a,r)],s=he(fe(t.window,t.resetField)),o=J(s);o&&n.push(i(t.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:o}));const c=wt(t.window,t.creditPrecision);return c&&n.push(c),n.join(`
2
2
  `)}const Nt=ia,ze=[1,.65,.45,.3,.2];function Ce(t){return ze[Math.min(t,ze.length-1)]}function Ue({paceX:t,paceOver:a}){return 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(${t}% - 3px)`,width:"6px"}}),e.jsx("div",{className:`absolute top-0 h-full ${a?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${t}% - 1px)`,width:"2px"}})]})}function Ma({label:t,pct:a,reset:r,mode:n=D.USED,pacePercent:s=null,paceOver:o=!1,title:c=null,segments:l=null}){const d=Math.max(0,Math.min(100,Number(a)||0)),u=n===D.REMAINING?100-d:d,m=jt(u,n),x=Math.round(u),y=u>0&&x===0?Math.max(u,.35):u;let b=String(x);u>0&&x===0&&(b=i("limits.bar.sub_one_percent"));const h=s==null?null:Math.max(0,Math.min(100,s)),f=l?.map(M=>Math.max(0,Math.min(100,Number(M.pct)||0))),j=f?.reduce((M,N)=>M+N,0)||0,w=l?Math.max(0,d-j):0,L=Math.max(0,100-j-w);return e.jsxs("div",{className:"group relative flex items-center gap-2",children:[e.jsx(Nt,{text:c}),e.jsx("span",{"data-limit-label":"",className:"text-xs sm:text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t}),l?e.jsxs("div",{"data-limit-segments":"",className:"relative flex min-w-0 flex-1 h-1.5 overflow-hidden",style:{gap:"min(2px, 1%)"},children:[l.map((M,N)=>e.jsx("div",{"data-limit-segment":M.key,className:`${m} min-w-0 rounded-full h-full transition-[flex-grow] duration-500 ease-out`,style:{flex:`${f[N]} 1 0px`,opacity:Ce(N)}},M.key)),w?e.jsx("div",{"data-limit-unallocated-used":"",className:`${m} min-w-0 rounded-full h-full`,style:{flex:`${w} 1 0px`,opacity:Ce(l.length)}}):null,L?e.jsx("div",{"data-limit-remainder":"",className:"min-w-0 rounded-full h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{flex:`${L} 1 0px`}}):null,h!=null&&e.jsx(Ue,{paceX:h,paceOver:o})]}):e.jsxs("div",{className:"relative min-w-0 flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[e.jsx("div",{className:`${m} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${y}%`,minWidth:u>0?"3px":0}}),h!=null&&e.jsx(Ue,{paceX:h,paceOver:o})]}),e.jsxs("span",{className:"text-xs sm:text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300 w-11 text-right shrink-0 whitespace-nowrap",children:[b,"%"]}),r&&e.jsx("span",{className:"text-xs tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-8 text-right shrink-0",children:r})]})}function Da({segments:t,fillColor:a}){return e.jsx("div",{"data-limit-legend":"",className:"-mt-0.5 flex flex-wrap gap-x-3 gap-y-0.5 text-[11px] leading-snug",style:{paddingLeft:"calc(var(--tt-limits-label-w, 0px) + 0.5rem)"},children:t.map((r,n)=>e.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap",children:[e.jsx("span",{"aria-hidden":!0,className:`${a} inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{opacity:Ce(n)}}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:r.label??i(r.labelKey)}),e.jsxs("span",{className:"tabular-nums text-oai-gray-700 dark:text-oai-gray-200",children:[me(r.pct),"%"]})]},r.key))})}function _t(t,a,r){const n=t.label??i(t.labelKey),s=r===D.REMAINING,o=d=>s?100-d:d;if(a.expectedPercent==null){const d=Math.max(0,Math.min(100,Number(ge(t.window,t.pctField))||0)),u=me(o(d));return s?i("limits.explain.remaining",{label:n,used:u}):i("limits.explain.used",{label:n,used:u})}if(a.paceOver){if(a.runsOutEta)return i("limits.explain.ahead_eta",{label:n,eta:a.runsOutEta});const d=me(o(a.projectedEnd??100));return i(s?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:n,pct:d})}const c=Math.max(0,Math.min(100,Number(ge(t.window,t.pctField))||0)),l=me(o(a.projectedEnd??c));return i(s?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:n,pct:l})}function St({pace:t}){return t.pacePercent!=null}function Ea(t,a){return t.some(r=>St(r)&&(r.mode??a)===D.REMAINING)}function De({rows:t,mode:a,now:r=Date.now()}){if(t.length===0)return null;const n=Ea(t,a),s=t.some(St);return e.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[t.map(({spec:o,pace:c,mode:l=a})=>{const d=J(he(fe(o.window,o.resetField)));return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[_t(o,c,l),d?e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",i(o.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:d})]}):null,o.showCreditDetail?e.jsx("div",{children:wt(o.window,o.creditPrecision)}):null]},o.key)}),s?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:i(n?"limits.explain.body_remaining":"limits.explain.body")}):null]})}function re(t){if(!t)return null;const a=Date.now()-new Date(t).getTime();if(a<0)return null;const r=Math.floor(a/6e4);if(r<1)return i("shared.time.now");if(r<60)return i("shared.time.m_ago",{n:r});const n=Math.floor(r/60);if(n<24)return i("shared.time.h_ago",{n});const s=Math.floor(n/24);return i("shared.time.d_ago",{n:s})}const Be={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"}},Ra={claude:"claude",codex:"codex",antigravity:"agy"};function Y({label:t,age:a=null,tone:r="live",tooltip:n=null}){const s=Be[r]||Be.live,o=r==="live";return e.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:c=>c.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 ${s.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 ${s.pulse} opacity-75`}),e.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${s.dot}`})]}):e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${s.dot}`}),t,a?e.jsxs(e.Fragment,{children:[" · ",a]}):null]}),n?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:[n,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 Ct({name:t,providerId:a,children:r,expandable:n=!1,expanded:s=!1,onToggle:o,badge:c=null,rightAdornment:l=null,toggleOnHeader:d=!1,actions:u=null}){const m=et(a),x=e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[m?e.jsx(tt,{provider:m,size:22,className:Na}):null,e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:t}),l?e.jsx("span",{className:"shrink-0",children:l}):null,c]}),y="rounded-xl border border-oai-gray-200 bg-white dark:border-oai-gray-800 dark:bg-oai-gray-900",b="flex w-full items-center justify-between gap-3 border-b border-oai-gray-200 px-4 py-3 text-left dark:border-oai-gray-800 sm:px-5",h=e.jsx("div",{className:"flex flex-col gap-2 px-4 py-4 sm:px-5",children:r});return n?d?e.jsxs("div",{className:y,children:[e.jsxs("button",{type:"button","aria-expanded":s,onClick:o,className:`${b} rounded-t-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500`,children:[x,e.jsx(ne,{size:16,"aria-hidden":!0,className:`shrink-0 text-oai-gray-400 transition-transform ${s?"rotate-180":""}`})]}),h]}):e.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o?.())},className:`${y} cursor-pointer transition-colors hover:border-oai-gray-300 dark:hover:border-oai-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500`,children:[e.jsxs("div",{className:b,children:[x,e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[u,e.jsx(ne,{size:16,"aria-hidden":!0,className:`shrink-0 text-oai-gray-400 transition-transform ${s?"rotate-180":""}`})]})]}),h]}):e.jsxs("div",{className:y,children:[e.jsxs("div",{className:b,children:[x,u]}),h]})}function Pt({subscription:t}){const a=t.autoRenew?i("subscriptions.badge.auto_renew"):i("subscriptions.badge.stops"),r=t.autoRenew?pt:Pe;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(r,{size:14,strokeWidth:2,"aria-hidden":!0})})}function Mt({subscription:t,now:a,mode:r=D.USED}){const n=pe(t,a);if(!n)return null;const{endMs:s,expired:o}=n,c=!o&&s-a<=3*864e5,l=o?100:n.progress*100,d=r===D.REMAINING?100-l:l,u=o?100:Math.max(0,Math.min(100,d)),m=Math.round(u),x=u>0&&m===0?i("limits.bar.sub_one_percent"):`${m}%`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"data-limit-label":"",className:"text-xs sm:text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:i("subscriptions.inline.label")}),e.jsx("div",{className:"relative min-w-0 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":c?"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:`${u}%`,minWidth:u>0?"3px":0}})}),e.jsx("span",{className:"text-xs sm:text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300 w-11 text-right shrink-0 whitespace-nowrap",children:x}),e.jsx("span",{className:`text-xs tabular-nums shrink-0 whitespace-nowrap w-8 text-right ${o?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:ft(s,a)})]})}function Dt({subscription:t,now:a}){const r=pe(t,a);if(!r)return null;const n=new Intl.DateTimeFormat(W(),{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:i("subscriptions.inline.label")}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:":"}),e.jsx("span",{children:t.autoRenew?i("subscriptions.label.renews_at"):i("subscriptions.label.expires_at")}),e.jsx("span",{children:" "}),e.jsx("span",{className:"font-mono tabular-nums",children:n.format(new Date(r.endMs))}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{className:r.expired?"text-oai-error":void 0,children:Se(r.endMs,a)}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{children:t.autoRenew?i("subscriptions.status.auto_renew"):i("subscriptions.status.manual")})]})}const Ta=Qe;function A({children:t,tone:a="neutral"}){return a==="error"?e.jsxs("div",{className:"flex items-start gap-2 text-xs leading-relaxed text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx($t,{size:15,"aria-hidden":!0,className:"mt-0.5 shrink-0 text-red-500 dark:text-red-400"}),e.jsx("span",{className:"min-w-0 break-words",children:t})]}):e.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:t})}function Ee({rows:t,mode:a,extra:r=null,expanded:n=!1}){const s=t.length===0&&!r;return e.jsxs(e.Fragment,{children:[t.map(({spec:o,pace:c,mode:l=a})=>{const d=ge(o.window,o.pctField),m=n&&o.productPool&&Array.isArray(o.segments)&&o.segments.length!==0?o.segments:null,x=m&&l!==D.REMAINING?m:null;return e.jsxs(_.Fragment,{children:[e.jsx(Ma,{label:o.label??i(o.labelKey),pct:d,reset:Ca(fe(o.window,o.resetField)),mode:l,segments:x,pacePercent:c.pacePercent,paceOver:c.paceOver,title:Pa(o,c,l)}),m?e.jsxs(e.Fragment,{children:[e.jsx(Da,{segments:m,fillColor:jt(d,D.USED)}),l===D.REMAINING?e.jsx("div",{"data-limit-share-note":"",className:"-mt-0.5 text-[11px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",style:{paddingLeft:"calc(var(--tt-limits-label-w, 0px) + 0.5rem)"},children:i("limits.grok.shares_are_used")}):null]}):null]},o.key)}),s?e.jsx(A,{children:i("limits.status.no_data")}):null,r]})}function Ia(t){if(!Number.isFinite(t.expiresMs))return null;const a=Math.floor((t.expiresMs-Date.now())/864e5);return a<0?null:a===0?i("limits.reset_bank.hover_detail_today",{date:t.expiresAt}):i("limits.reset_bank.hover_detail",{date:t.expiresAt,days:a})}function Aa({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(Nt,{text:Ia(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 min-w-0 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 Ha({model:t}){const a=t.kind==="count_only"?i("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:i("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(r=>e.jsx(Aa,{row:r},r.key))]})}const Oa={five_hour:5*3600*1e3,weekly:168*3600*1e3};function Et(t,a){if(!t||typeof t!="object")return!1;if(t.error)return!0;for(const r of["five_hour","weekly"])for(const n of t[r]||[])if(Date.parse(n?.expires_at)>a)return!0;return!1}function La({data:t}){const[a,r]=p.useState(!1),n=Date.now();if(!Et(t,n))return null;const s=[{key:"five_hour",label:i("limits.label.zcode_5h")},{key:"weekly",label:i("limits.label.zcode_weekly")}].map(l=>{const d=(t[l.key]||[]).filter(h=>Date.parse(h.expires_at)>n).sort((h,f)=>Date.parse(h.expires_at)-Date.parse(f.expires_at)),u=new Map;for(const h of d){const f=Date.parse(h.expires_at);u.set(f,(u.get(f)||0)+1)}const x=[...u.entries()].sort((h,f)=>h[0]-f[0]).map(([h,f])=>f>1?i("limits.zcode.reset_bank.batch",{time:J(h),count:f}):J(h)).join(`
3
3
  `),y=Oa[l.key]||0,b=d.length&&y?Math.max(0,Math.min(100,(Date.parse(d[0].expires_at)-n)/y*100)):0;return{...l,cards:d,batchTitle:x,countdownPercent:b}});let o=0;const c=[];for(const l of s)o+=l.cards.length,l.cards.length&&c.push(l);return e.jsxs("div",{className:"mt-2 border-t border-oai-gray-200/60 pt-2 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button","aria-expanded":a,onClick:l=>{l.stopPropagation(),r(d=>!d)},onKeyDown:l=>l.stopPropagation(),className:"flex w-full items-center gap-1.5 rounded text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsx(Pe,{size:13,"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",children:i("limits.zcode.reset_bank.title")}),o?e.jsx("span",{className:"rounded-full bg-oai-gray-100 px-2 py-0.5 text-[10px] tabular-nums text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:i("limits.zcode.reset_bank.count",{count:o})}):null,e.jsx(ne,{size:13,"aria-hidden":!0,className:`ml-auto transition-transform ${a?"rotate-180":""}`})]}),t.error?e.jsx(A,{tone:"error",children:t.error}):null,a&&!t.error?e.jsx("div",{className:"mt-2 flex flex-col gap-1.5",children:c.map(l=>e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{"data-limit-label":"",className:"shrink-0 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",style:{width:"var(--tt-limits-label-w)"},children:l.label}),e.jsx("span",{className:"rounded-full bg-oai-gray-100 px-2 py-0.5 tabular-nums text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:i("limits.zcode.reset_bank.count",{count:l.cards.length})}),e.jsx("div",{className:"relative min-w-0 flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",title:l.batchTitle,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:`${l.countdownPercent}%`,minWidth:l.countdownPercent>0?"3px":0}})}),l.cards.length?e.jsx("span",{className:"ml-auto shrink-0 whitespace-nowrap text-right text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500",title:l.batchTitle,children:i("limits.zcode.reset_bank.earliest",{time:J(Date.parse(l.cards[0].expires_at))})}):null]},l.key))}):null]})}function Fa({data:t}){const a=Array.isArray(t?.balances)?t.balances:[];return e.jsxs("div",{className:"mt-1 space-y-1","data-deepseek-balance":"",children:[a.map(r=>{const n=String(r?.currency||"").toUpperCase(),s=X(r?.total,{maximumFractionDigits:2}),o=Number(r?.granted)>0?X(r.granted,{maximumFractionDigits:2}):null;return!n||!s?null:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"data-limit-label":"",className:"text-xs sm:text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:i("limits.deepseek.balance_label",{currency:n})}),e.jsx("span",{className:"text-xs sm:text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300",children:s}),o?e.jsx("span",{className:"text-[10.5px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:i("limits.deepseek.granted_detail",{amount:o})}):null]},n)}),t?.is_available===!1?e.jsx("div",{className:"mt-1",children:e.jsx(A,{tone:"error",children:i("limits.deepseek.unavailable")})}):null]})}function Rt(t,a){if(t==="deepseek_balance")return e.jsx(Fa,{data:a});if(t==="zcode_reset_bank")return Et(a.reset_credits,Date.now())?e.jsx(La,{data:a.reset_credits}):null;if(t==="codex_meta"){const r=va(a.reset_credits);return r?e.jsx(Ha,{model:r}):null}if(t==="kimi_parallel"&&a.parallel_limit)return e.jsx(A,{children:i("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 r=X(a.tracked_credits,{maximumFractionDigits:2});return e.jsx(A,{children:i("limits.label.kiro_tracked_credits",{credits:r,count:Number(a.tracked_credit_records)})})}return t==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?e.jsx(Ga,{defaultDir:a.otel_default_dir}):null}function $a({data:t,mode:a,now:r}){const[n,s]=p.useState(!1),o=p.useRef(null),c=Re(o),l=[...new Set((t.buckets||[]).map(m=>m.plan_name).filter(Boolean))],d=l.length?l.join(" · "):i("limits.zcode.start_grants"),u=se.zcode.windows(t).filter(m=>m.window).map(m=>({spec:m,pace:Me(m,a,r)}));return e.jsxs("div",{className:"mt-2 border-t border-oai-gray-200/60 pt-2 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button","aria-expanded":n,onClick:m=>{m.stopPropagation(),s(x=>!x)},onKeyDown:m=>m.stopPropagation(),className:"flex w-full items-center gap-1.5 rounded text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsx(ra,{size:13,"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",title:d,children:d}),e.jsx(ne,{size:13,"aria-hidden":!0,className:`ml-auto transition-transform ${n?"rotate-180":""}`})]}),n?e.jsx("div",{ref:o,"data-limit-label-group":"",className:"mt-2 flex flex-col gap-1.5",style:c>0?{"--tt-limits-label-w":`${c}px`}:void 0,children:t.error?e.jsx(A,{tone:"error",children:t.error}):e.jsxs(e.Fragment,{children:[e.jsx(Ee,{rows:u,mode:a}),e.jsx(De,{rows:u,mode:a,now:r}),(t.buckets||[]).filter(m=>Number.isFinite(m.remaining_units)&&Number.isFinite(m.total_units)).map((m,x)=>e.jsx("div",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:i("limits.zcode.grant_amount",{remaining:m.remaining_units.toLocaleString(W()),total:m.total_units.toLocaleString(W())})},m.entitlement_id||x))]})}):null]})}function za({data:t,mode:a,now:r}){const[n,s]=p.useState(!1),o=p.useRef(null),c=Re(o),l=i(t.region==="zai"?"limits.zcode.region.zai":"limits.zcode.region.bigmodel"),d=t.plan_label||i("limits.zcode.start_grants"),u=i("limits.zcode.other_region.title",{region:l,plan:d}),m=se.zcode.windows(t).filter(y=>y.window).map(y=>({spec:y,mode:a,pace:Me(y,a,r)})),x=Date.parse(t.log_timestamp);return e.jsxs("div",{className:"mt-2 border-t border-oai-gray-200/60 pt-2 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button","aria-expanded":n,onClick:y=>{y.stopPropagation(),s(b=>!b)},onKeyDown:y=>y.stopPropagation(),className:"flex w-full items-center gap-1.5 rounded text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsx(zt,{size:13,"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",title:u,children:u}),e.jsx(ne,{size:13,"aria-hidden":!0,className:`ml-auto transition-transform ${n?"rotate-180":""}`})]}),n?e.jsxs("div",{ref:o,"data-limit-label-group":"",className:"mt-2 flex flex-col gap-1.5",style:c>0?{"--tt-limits-label-w":`${c}px`}:void 0,children:[e.jsx(Ee,{rows:m,mode:a}),e.jsx(De,{rows:m,mode:a,now:r}),Number.isFinite(x)?e.jsx(A,{children:i("limits.zcode.other_region.snapshot",{time:J(x)})}):null]}):null]})}function Ua(t,a,r,n,s,o,c=null,l=null,d=Date.now(),u=null){const m=se[t];if(!m)return null;const x=m.windows(a).filter(b=>b.window).map(b=>({spec:b,mode:n,pace:Me(b,n,d)})),y=Rt(m.extra,a);return e.jsxs(Ct,{name:r,providerId:t,expandable:x.length>0||!!l,expanded:s,onToggle:o,badge:c,rightAdornment:l?e.jsx(Pt,{subscription:l}):null,actions:t==="cursor"&&a.connection_source==="browser"?e.jsx(bt,{connected:!0,onSaved:u}):null,toggleOnHeader:t==="zcode",children:[e.jsx(Ee,{mode:n,rows:x,extra:y,expanded:s}),t==="opencodeGo"||t==="commandCode"||t==="deepseek"?e.jsx(Tt,{providerId:t,data:a,onSaved:u}):null,l?e.jsx(Mt,{subscription:l,now:d,mode:n}):null,s?e.jsx(De,{rows:x,mode:n,now:d}):null,s&&l?e.jsx(Dt,{subscription:l,now:d}):null,t==="zcode"&&a.start_plan?.configured?e.jsx($a,{data:a.start_plan,mode:n,now:d}):null,t==="zcode"&&a.other_region?e.jsx(za,{data:a.other_region,mode:n,now:d}):null]},t)}function ue(t,a,r,n,s=null,o=Date.now(),c=D.USED,l=null){const d=!!s;return e.jsxs(Ct,{name:xe(t),actions:l,providerId:t,expandable:d,expanded:r,onToggle:n,rightAdornment:d?e.jsx(Pt,{subscription:s}):null,children:[a,d?e.jsx(Mt,{subscription:s,now:o,mode:c}):null,d&&r?e.jsx("div",{className:"mt-1",children:e.jsx(Dt,{subscription:s,now:o})}):null]},t)}function Ba(t,a,r,n,s,o=null,c=Date.now(),l=null){if(!se[t])return null;const d=t==="cursor"?e.jsx(bt,{connected:a?.connection_source==="browser",onSaved:l}):null;if(t==="claude"&&a?.limits_status==="not_applicable")return ue(t,e.jsx(A,{children:i("limits.claude.custom_backend")}),n,s,o,c,r);if(!a?.configured)return ue(t,e.jsxs(e.Fragment,{children:[t==="cursor"?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1 text-xs leading-relaxed text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("p",{children:i("limits.cursor.connection.description")}),e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:i("limits.cursor.connection.privacy")})]}),d]}):e.jsx(A,{children:i("limits.status.not_connected")}),t==="opencodeGo"?e.jsx(I,{title:i("limits.opencodeGo.setupHint.title"),children:e.jsx(Ge,{onSaved:l})}):null,t==="commandCode"?e.jsx(I,{title:i("limits.commandCode.setupHint.title"),children:e.jsx(We,{onSaved:l})}):null,t==="codingPlan"?e.jsx(I,{title:i("limits.codingPlan.setupHint.title"),children:e.jsx(Ve,{})}):null,t==="agentPlan"?e.jsx(I,{title:i("limits.agentPlan.setupHint.title"),children:e.jsx(Ye,{})}):null,t==="devin"?e.jsx(I,{title:i("limits.devin.setupHint.title"),children:e.jsx(qe,{})}):null,t==="deepseek"?e.jsx(I,{title:i("limits.deepseek.setupHint.title"),children:e.jsx(Ke,{onSaved:l})}):null]}),n,s,o,c,r);if(t==="opencodeGo"&&a.subscription_status==="inactive")return ue(t,e.jsx(A,{children:i("limits.opencodeGo.status.inactive")}),n,s,o,c,r);if(a.error)return ue(t,e.jsxs(e.Fragment,{children:[e.jsx(A,{tone:"error",children:t==="cursor"&&a.auth_action_required==="reauth"?i("limits.cursor.connection.expired"):a.error}),t==="kiro"?Rt(se.kiro.extra,a):null,t==="deepseek"?e.jsx(I,{title:i("limits.deepseek.setupHint.title"),children:e.jsx(Ke,{onSaved:l})}):null,t==="deepseek"?e.jsx(Tt,{providerId:t,data:a,onSaved:l}):null,t==="opencodeGo"?e.jsx(I,{title:i("limits.opencodeGo.setupHint.title"),children:e.jsx(Ge,{onSaved:l})}):null,t==="commandCode"?e.jsx(I,{title:i("limits.commandCode.setupHint.title"),children:e.jsx(We,{onSaved:l})}):null,t==="codingPlan"?e.jsx(I,{title:i("limits.codingPlan.setupHint.title"),children:e.jsx(Ve,{})}):null,t==="agentPlan"?e.jsx(I,{title:i("limits.agentPlan.setupHint.title"),children:e.jsx(Ye,{})}):null,t==="devin"?e.jsx(I,{title:i("limits.devin.setupHint.title"),children:e.jsx(qe,{})}):null]}),n,s,o,c,r,d);const u=xe(t),m=a.plan_label?`${u} ${a.plan_label}`:u;let x=null;if(a.auth_action_required==="reauth"){const b=t==="commandCode"?vt():t==="devin"?kt():Ra[t];x=e.jsx(Y,{label:i("limits.reauth.badge"),age:re(a.cached_at),tone:"stale",tooltip:b?i("limits.reauth.tooltip",{command:b}):null})}if(!x&&t==="antigravity")if(a.cached){const b=re(a.cached_at);x=e.jsx(Y,{label:i("limits.label.antigravity_cached"),age:b,tone:"cached",tooltip:i("limits.tooltip.antigravity_cached")})}else x=e.jsx(Y,{label:i("limits.label.antigravity_live"),tone:"live",tooltip:i("limits.tooltip.antigravity_live")});!x&&(t==="qoder"||t==="qoderCn")&&a.cached&&(x=e.jsx(Y,{label:i("limits.label.antigravity_cached"),age:re(a.cached_at),tone:"cached",tooltip:i("limits.tooltip.qoder_cached")})),!x&&(t==="codingPlan"||t==="agentPlan")&&a.cached&&(x=e.jsx(Y,{label:i("limits.label.antigravity_cached"),age:re(a.cached_at),tone:"cached",tooltip:i("limits.tooltip.ark_cached")}));const y=a.provenance;return y?.stale&&!x&&(x=e.jsx(Y,{label:i("limits.provenance.stale"),age:re(y.captured_at),tone:"stale",tooltip:i("limits.provenance.tooltip",{source:y.source,confidence:y.confidence})})),Ua(t,a,m,r,n,s,x,o,c,l)}function Ga({defaultDir:t}){const[a,r]=p.useState(!1),s=["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(`
4
4
  `),o=async c=>{c.stopPropagation();try{await navigator.clipboard.writeText(s),r(!0),setTimeout(()=>r(!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:i("limits.copilot.otelHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug",children:i("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:s}),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?i("limits.copilot.otelHint.copied"):i("limits.copilot.otelHint.copy")})]})}function E({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 be(){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 ye({provider:t,onSaved:a}){const[r,n]=p.useState(""),[s,o]=p.useState("idle"),[c,l]=p.useState(!1),d=async u=>{u.preventDefault(),u.stopPropagation();const m=r.trim();if(!(!m||s==="saving")){o("saving"),l(!1);try{await Ut(t,m),n(""),o("saved"),a?.()}catch{o("idle"),l(!0)}}};return e.jsxs("form",{className:"mt-1.5 space-y-1.5",onSubmit:d,onClick:u=>u.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"password",value:r,onChange:u=>{n(u.target.value),o("idle"),l(!1)},placeholder:i("limits.apiKey.placeholder"),"aria-label":i("limits.apiKey.placeholder"),autoComplete:"new-password",spellCheck:!1,className:"min-w-0 flex-1 rounded-md border border-oai-gray-300 bg-white px-2 py-1 font-mono text-[11px] text-oai-gray-800 outline-none focus:border-oai-brand dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:text-oai-gray-100"}),e.jsx("button",{type:"submit",disabled:!r.trim()||s==="saving",className:"shrink-0 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 disabled:opacity-50 transition-colors",children:s==="saving"?i("limits.apiKey.saving"):s==="saved"?i("limits.apiKey.saved"):i("limits.apiKey.save")})]}),e.jsx("div",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:c?i("limits.apiKey.save_failed"):i("limits.apiKey.local_note")})]})}function Tt({providerId:t,data:a,onSaved:r}){if(a?.credential_source!=="env")return null;const n=_a[t],s=Sa[t];return!n||!s?null:e.jsxs("div",{className:"mt-1.5 rounded-md border border-amber-300/60 bg-amber-50/60 px-2 py-1.5 text-[10.5px] leading-snug text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",children:[e.jsx("div",{children:i("limits.apiKey.env_note",{env:n})}),e.jsx(ye,{provider:s,onSaved:r}),yt()==="macos"?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.jsx("code",{className:"rounded bg-white/70 px-1 py-0.5 font-mono text-[10px] dark:bg-oai-gray-900/60",children:i("limits.apiKey.env_unset_command",{env:n})}),e.jsx("span",{children:i("limits.apiKey.env_unset_note")})]}):null]})}function I({title:t,children:a}){return e.jsxs("div",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",onClick:r=>r.stopPropagation(),onKeyDown:r=>r.stopPropagation(),children:[e.jsx("div",{className:"font-medium text-oai-gray-800 dark:text-oai-gray-100",children:t}),a]})}function Ge({onSaved:t}){return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:i("limits.opencodeGo.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(E,{n:"1",children:[e.jsx("div",{children:i("limits.opencodeGo.setupHint.step1")}),e.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:a=>a.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:[i("limits.opencodeGo.setupHint.cta"),e.jsx(be,{})]})]}),e.jsx(E,{n:"2",children:e.jsx("div",{children:i("limits.opencodeGo.setupHint.step2")})}),e.jsxs(E,{n:"3",children:[e.jsx("div",{children:i("limits.opencodeGo.setupHint.step3")}),e.jsx(ye,{provider:"opencode-go",onSaved:t})]})]})]})}function We({onSaved:t}){const a=vt();return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:i("limits.commandCode.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(E,{n:"1",children:[e.jsx("div",{children:i("limits.commandCode.setupHint.step1")}),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:a})]}),e.jsxs(E,{n:"2",children:[e.jsx("div",{children:i("limits.commandCode.setupHint.step2")}),e.jsx(ye,{provider:"command-code",onSaved:t})]})]})]})}function Ke({onSaved:t}){return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:i("limits.deepseek.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(E,{n:"1",children:[e.jsx("div",{children:i("limits.deepseek.setupHint.step1")}),e.jsxs("a",{href:"https://platform.deepseek.com",target:"_blank",rel:"noreferrer",onClick:a=>a.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:[i("limits.deepseek.setupHint.cta"),e.jsx(be,{})]})]}),e.jsxs(E,{n:"2",children:[e.jsx("div",{children:i("limits.deepseek.setupHint.step2")}),e.jsx(ye,{provider:"deepseek",onSaved:t})]})]})]})}function qe(){const t=kt();return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:i("limits.devin.setupHint.subtitle")}),e.jsx("ol",{className:"mt-2.5 space-y-2.5",children:e.jsxs(E,{n:"1",children:[e.jsx("div",{children:i("limits.devin.setupHint.step1")}),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:t}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:i("limits.devin.setupHint.note")})]})})]})}function Ve(){const[t,a]=p.useState(!1),r=["npm install -g @volcengine/ark-cli","arkcli auth login volc-sso # browser SSO (recommended)","arkcli auth status # verify the session"].join(`
@@ -1 +1 @@
1
- import{r as h,j as e,c as r}from"./__vite-browser-external-B_Ak9BfX.js";import{A as p}from"./arrow-up-right-DFDvNYfd.js";import{D as b}from"./download-DD5b8DO2.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-RPZeXrAv.js";import{A as p}from"./arrow-up-right-H5sP370z.js";import{D as b}from"./download-BI-n3YEd.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};