tokentracker-cli 0.79.7 → 0.79.8

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 (71) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-BgLKRfg6.js → AchievementBadge-Ctu3c_8t.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-DAZPKi69.js → AchievementsPage-B3kBTHDB.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-Bpck20e3.js → AchievementsSection-CAnTXGpC.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-Di0rpmTQ.js → BadgeDetailModal-oTUXEQk9.js} +1 -1
  5. package/dashboard/dist/assets/{Card-CiVg1n9y.js → Card-BHt5f5cD.js} +1 -1
  6. package/dashboard/dist/assets/{ClawdAnimated-Dhw6SxU-.js → ClawdAnimated-ChxXY3l0.js} +1 -1
  7. package/dashboard/dist/assets/CommunityStatsModal-CVLlItP1.js +1 -0
  8. package/dashboard/dist/assets/{ConfirmModal-DD1Ri-dh.js → ConfirmModal-ClrILpb3.js} +1 -1
  9. package/dashboard/dist/assets/{Controls-BQxSK041.js → Controls-D_XBBpIh.js} +1 -1
  10. package/dashboard/dist/assets/DashboardPage-CizTJox2.js +19 -0
  11. package/dashboard/dist/assets/{DevicePage-BgByRtlZ.js → DevicePage-J7DW7yeX.js} +1 -1
  12. package/dashboard/dist/assets/{DialogClose-DigAXf6w.js → DialogClose-B1r9gzUF.js} +1 -1
  13. package/dashboard/dist/assets/DialogDescription-Bd9-kaCS.js +1 -0
  14. package/dashboard/dist/assets/{DialogTitle-Du1uOZMr.js → DialogTitle-BL2puDA7.js} +1 -1
  15. package/dashboard/dist/assets/{FadeIn-Da6jgqZ_.js → FadeIn-Cd-YT4oT.js} +1 -1
  16. package/dashboard/dist/assets/{HeaderGithubStar-Cqqy7vB7.js → HeaderGithubStar-BAtl4a-K.js} +1 -1
  17. package/dashboard/dist/assets/{IpCheckPage-DkTAw_dO.js → IpCheckPage-BXK_cYN2.js} +1 -1
  18. package/dashboard/dist/assets/{LandingPage-Dvb9s-kJ.js → LandingPage-C_16AbpF.js} +1 -1
  19. package/dashboard/dist/assets/{LeaderboardAvatar-Ch7SLsZ_.js → LeaderboardAvatar-B0vUuCYU.js} +1 -1
  20. package/dashboard/dist/assets/LeaderboardPage-Duhdaq09.js +2 -0
  21. package/dashboard/dist/assets/LeaderboardProfileModal-CFFyHRTB.js +73 -0
  22. package/dashboard/dist/assets/{LeaderboardProfilePage-DRautoWL.js → LeaderboardProfilePage-CjTelV-4.js} +2 -2
  23. package/dashboard/dist/assets/{LimitsPage-Bwc3XCCg.js → LimitsPage-DIcXRgSv.js} +1 -1
  24. package/dashboard/dist/assets/{LocalOnlyNotice-DftNXQsE.js → LocalOnlyNotice-DC7wXWds.js} +1 -1
  25. package/dashboard/dist/assets/{LoginPage-CffpNmm-.js → LoginPage--8hYT3aq.js} +1 -1
  26. package/dashboard/dist/assets/{PetPage-C_lq7mMA.js → PetPage-ByWUW7-V.js} +1 -1
  27. package/dashboard/dist/assets/{PopoverPopup-B7L6V9OS.js → PopoverPopup-g_v1fmhH.js} +1 -1
  28. package/dashboard/dist/assets/{ResetPasswordPage-P-VatRkZ.js → ResetPasswordPage-BfunstIi.js} +1 -1
  29. package/dashboard/dist/assets/{Select-NpNBO_zW.js → Select-C4ShPt1t.js} +1 -1
  30. package/dashboard/dist/assets/{SelectItemText-DEqB9ndy.js → SelectItemText-gw_TdvY6.js} +1 -1
  31. package/dashboard/dist/assets/SettingsPage-BFCFrDuA.js +1 -0
  32. package/dashboard/dist/assets/{SkillsPage-Dy_sojV5.js → SkillsPage-BNQDySeK.js} +1 -1
  33. package/dashboard/dist/assets/{WidgetsPage-CzbeMPoq.js → WidgetsPage-B3bHP3Vk.js} +1 -1
  34. package/dashboard/dist/assets/{WrappedPage-C9sMo5ha.js → WrappedPage-6amxWnWT.js} +1 -1
  35. package/dashboard/dist/assets/{agent-logos-D95HrgpM.js → agent-logos-DPIQzYms.js} +1 -1
  36. package/dashboard/dist/assets/{arrow-up-right-jaA_F8VA.js → arrow-up-right-CKcE2mif.js} +1 -1
  37. package/dashboard/dist/assets/check-B5V4_ezt.js +1 -0
  38. package/dashboard/dist/assets/{copy-BUsG8Dxq.js → copy-vi-V2M_I.js} +1 -1
  39. package/dashboard/dist/assets/{download-B89jns_I.js → download-BH0Spg15.js} +1 -1
  40. package/dashboard/dist/assets/{flame-DYJfKTkq.js → flame-C3jUAnqA.js} +1 -1
  41. package/dashboard/dist/assets/{format-tokens-Ck4iJNuB.js → format-tokens-tnfJT09G.js} +1 -1
  42. package/dashboard/dist/assets/{info-DgaOnN42.js → info-CGCZ5JvP.js} +1 -1
  43. package/dashboard/dist/assets/{link-2-l6SkcxP3.js → link-2-CXULWwZY.js} +1 -1
  44. package/dashboard/dist/assets/{loader-circle-BTZ18vzb.js → loader-circle-B324hSa3.js} +1 -1
  45. package/dashboard/dist/assets/{main-BVPlyJJu.js → main-vGUuyRq-.js} +21 -17
  46. package/dashboard/dist/assets/provider-display-CeoAhoCb.js +42 -0
  47. package/dashboard/dist/assets/{trash-2-DDKBUuG2.js → trash-2-L9vxbDeP.js} +1 -1
  48. package/dashboard/dist/assets/{use-community-stats-KM2l89gG.js → use-community-stats-DLE30Lh0.js} +1 -1
  49. package/dashboard/dist/assets/{use-limits-display-prefs-1RM6rjBg.js → use-limits-display-prefs-BxN--PEW.js} +1 -1
  50. package/dashboard/dist/assets/use-native-settings-Dn5gWQkJ.js +1 -0
  51. package/dashboard/dist/assets/{use-ordered-list-B3ExZ03c.js → use-ordered-list-DYoz2NJ9.js} +1 -1
  52. package/dashboard/dist/assets/{use-quality-per-dollar-pref-oapCFOoT.js → use-quality-per-dollar-pref-JXorBQsT.js} +1 -1
  53. package/dashboard/dist/assets/{use-transform-Cd2VlHK0.js → use-transform-BTTF5vPC.js} +1 -1
  54. package/dashboard/dist/assets/{use-usage-limits-BMwpdXJP.js → use-usage-limits-BUemSWQ9.js} +1 -1
  55. package/dashboard/dist/assets/{useCurrency-BA2GiiJp.js → useCurrency-Cxv4RR3U.js} +1 -1
  56. package/dashboard/dist/assets/{useScrollLock-CBHwgGF7.js → useScrollLock-DTPnHKfF.js} +1 -1
  57. package/dashboard/dist/assets/useTokenFormat-DMAb2ec3.js +1 -0
  58. package/dashboard/dist/assets/{zap-C3aLlz8b.js → zap-CG8zuY9S.js} +1 -1
  59. package/dashboard/dist/index.html +1 -1
  60. package/dashboard/dist/share.html +1 -1
  61. package/package.json +1 -1
  62. package/src/lib/pricing/seed-snapshot.json +1 -1
  63. package/dashboard/dist/assets/CommunityStatsModal-DosBW4lR.js +0 -1
  64. package/dashboard/dist/assets/DashboardPage-B7F7CLG5.js +0 -19
  65. package/dashboard/dist/assets/DialogDescription-CS0HEX8l.js +0 -1
  66. package/dashboard/dist/assets/LeaderboardPage-BbPfFFuF.js +0 -2
  67. package/dashboard/dist/assets/LeaderboardProfileModal-PFZaQLMG.js +0 -73
  68. package/dashboard/dist/assets/SettingsPage-uCZ0OdF3.js +0 -1
  69. package/dashboard/dist/assets/check-ShRr2Grp.js +0 -1
  70. package/dashboard/dist/assets/provider-display-DuQlae7O.js +0 -42
  71. package/dashboard/dist/assets/use-native-settings-S7AyC9Ou.js +0 -1
@@ -1 +0,0 @@
1
- import{r as n,b7 as a}from"./main-BVPlyJJu.js";import{u as p}from"./DialogTitle-Du1uOZMr.js";import{u as c}from"./useScrollLock-CBHwgGF7.js";const x=n.forwardRef(function(e,r){const{render:l,className:u,style:m,id:s,...t}=e,{store:i}=p(),o=c(s);return i.useSyncedValueWithCleanup("descriptionElementId",o),a("p",e,{ref:r,props:[{id:o},t]})});export{x as D};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-PFZaQLMG.js","assets/main-BVPlyJJu.js","assets/main-ilWqzAfD.css","assets/provider-display-DuQlae7O.js","assets/useCurrency-BA2GiiJp.js","assets/info-DgaOnN42.js","assets/LeaderboardAvatar-Ch7SLsZ_.js","assets/AchievementBadge-BgLKRfg6.js","assets/zap-C3aLlz8b.js","assets/flame-DYJfKTkq.js","assets/AchievementsSection-Bpck20e3.js","assets/format-tokens-Ck4iJNuB.js","assets/arrow-up-right-jaA_F8VA.js","assets/link-2-l6SkcxP3.js","assets/check-ShRr2Grp.js","assets/DialogTitle-Du1uOZMr.js","assets/useScrollLock-CBHwgGF7.js","assets/CommunityStatsModal-DosBW4lR.js","assets/DialogClose-DigAXf6w.js","assets/DialogDescription-CS0HEX8l.js"])))=>i.map(i=>d[i]);
2
- import{c as ua,j as e,R as xa,E as n,P as d,r as c,as as ga,at as ba,Z as pa,_ as ha,au as fa,a as ya,b as ka,av as wa,aw as ja,ax as se,a6 as va,ay as Na,m as _a,S as pe,L as Sa,H as X,Q as he,F as Ca,az as La,aA as Ma,aB as Be,aC as Aa,a4 as Ge,I as Ea}from"./main-BVPlyJJu.js";import{S as Pa}from"./Select-NpNBO_zW.js";import{a as Ka,C as Ra,u as Ta,b as za,c as $e,D as Ia,d as Ba,S as $a,h as Ua,s as Da,K as Oa,P as Fa}from"./use-ordered-list-B3ExZ03c.js";import{u as Ga}from"./useCurrency-BA2GiiJp.js";import{L as J}from"./LeaderboardAvatar-Ch7SLsZ_.js";import{s as Ha,a as Ya,A as Wa,t as Va,b as Za}from"./AchievementBadge-BgLKRfg6.js";import{u as Ja}from"./use-community-stats-KM2l89gG.js";import"./SelectItemText-DEqB9ndy.js";import"./useScrollLock-CBHwgGF7.js";import"./check-ShRr2Grp.js";import"./zap-C3aLlz8b.js";import"./flame-DYJfKTkq.js";const qa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Xa=ua("arrow-right",qa),Qa=a=>{let{transform:r}=a;return{...r,y:0}};function H(a,{min:r,max:o,fallback:s}){const i=Number(a);if(!Number.isFinite(i))return s;const l=Math.floor(i);return l<r?r:l>o?o:l}function er(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),s=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const i=new Set([1,o,s-2,s-1,s,s+1,s+2]),l=Array.from(i).filter(u=>Number.isInteger(u)&&u>=1&&u<=o).sort((u,g)=>u-g),p=[];let f=null;for(const u of l)f!=null&&u-f>1&&p.push(null),p.push(u),f=u;return p}function ar({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,s=o?H(r,{min:0,max:1e6,fallback:0}):null,i=H(a,{min:1,max:o?Math.max(1,s||1):1e6,fallback:1}),l=i>1,p=o?i<s:!0;return{canPrev:l,canNext:p,safePage:i,safeTotal:s}}function rr({entries:a,me:r,meLabel:o}){const s=Array.isArray(a)?a:[],i=r&&typeof r.rank=="number"?r.rank:null;return!i||s.some(p=>!!p?.is_me)?s:[{rank:i,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...s]}function tr(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.ceil(o/s)}const or=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function sr({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 ${or.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ne=xa.memo(function({badges:r,max:o=3,className:s=""}){const i=Ha((r||[]).filter(l=>l&&Ya.has(l.id)&&(l.tier||0)>=1)).slice(0,o);return i.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${s}`,children:i.map((l,p)=>e.jsx("span",{title:n("achievements.mini.tooltip",{name:n(Za(l.id,"name")),tier:n(`achievements.tier.${Va(l.tier)}`)}),style:{zIndex:i.length-p},className:`pointer-events-auto relative inline-flex ${p>0?"-ml-1.5":""}`,children:e.jsx(Wa,{badgeId:l.id,tier:l.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},l.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}],He="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",Ye="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 ie(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function le(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function nr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",s=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(ie(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(le(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),q.map(i=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",s)})},i.key))]})}function ir({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(s,i)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},i))})]})}function lr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(Ye,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),q.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(nr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(ir,{index:o},o))})]})}function dr({id:a,thClassName:r,children:o}){const{attributes:s,listeners:i,setNodeRef:l,transform:p,transition:f,isDragging:u}=Ka({id:a}),g=Ra.Transform.toString(p)||"";c.useLayoutEffect(()=>{const h=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 h.forEach(x=>{x.style.transform=g,x.style.transition=f||"",x.style.zIndex=u?"20":"",x.style.position=g?"relative":"",x.style.boxShadow=u?b:""}),()=>{h.forEach(x=>{x.style.transform="",x.style.transition="",x.style.zIndex="",x.style.position="",x.style.boxShadow=""})}},[a,g,f,u]);const j={transform:g,transition:f,position:g?"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:l,style:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...s,...i,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",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 cr="tokentracker.leaderboard.columnOrder.v1";function mr(a){return Ta(cr,a)}const ur=50;function xr(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.min(100,Math.max(1,Math.ceil(o/s*100)))}function We(a){return typeof a=="string"?a.trim():""}function gr(a){const r=We(a);return r?r.toLowerCase()==="anonymous":!0}function br({me:a,totalEntries:r,meLabel:o,onOpenProfile:s,onJumpToMe:i,canJump:l,className:p}){const f=a&&typeof a.rank=="number"?a.rank:null;if(!f)return null;const u=Number(r)||0,g=xr(f,u),j=We(a?.display_name),h=!j||gr(j)?o||"You":j,b=a?.user_id||h,x=s||(l?i:null),A=typeof x=="function",_=A?"button":"div",Q=A?{type:"button",onClick:x,"aria-label":n(s?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(_,{...Q,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",A?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",p),children:[e.jsx(J,{size:"sm",avatarUrl:a?.avatar_url,displayName:h,seed:b}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:h}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",f.toLocaleString()]}),g!=null&&g<=ur&&e.jsx("span",{className:d("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",g<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:n("leaderboard.summary.percentile",{p:String(g)})}),A?e.jsx(Xa,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const pr=c.lazy(()=>Ge(()=>import("./LeaderboardProfileModal-PFZaQLMG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])).then(a=>({default:a.LeaderboardProfileModal}))),hr=c.lazy(()=>Ge(()=>import("./CommunityStatsModal-DosBW4lR.js"),__vite__mapDeps([17,1,2,11,15,16,18,19])).then(a=>({default:a.CommunityStatsModal}))),de=[10,20,50,100],ce=20,Ve="tokentracker:leaderboard:pageSize";function fr(){if(typeof window>"u")return ce;try{const a=window.localStorage.getItem(Ve),r=Number(a);if(de.includes(r))return r}catch{}return ce}function me(a,r,o){const s=Number(a);if(!Number.isFinite(s)||s<=0)return"-";const i=Ca(r),l=r===Ea?s:s*o;return l>=1e3?`${i}${Math.round(l).toLocaleString()}`:l>=10?`${i}${Math.round(l)}`:`${i}${l.toFixed(2)}`}function yr(a){const r=Number(a);return Number.isFinite(r)&&Math.abs(r)>=1e12?`${Number((r/1e12).toFixed(1))}T`:X(a)}function ue({value:a}){return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:X(a)}),e.jsx("span",{className:"hidden sm:inline",children:he(a)})]})}function kr({communityStats:a,onClick:r}){return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:n("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:yr(a.tokenFloor)}),e.jsx("span",{className:"hidden sm:inline",children:Math.round(a.tokenFloor).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("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:X(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:n("leaderboard.community.devs_chip")})]})]})}function Ue(a,r,o){const s=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",i=r?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60";return o.map(l=>e.jsx("td",{"data-column-key":l.key,className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",s,i),children:he(a?.[l.key])},l.key))}function wr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const jr={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 vr({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 Nr({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(pe,{provider:"GITHUB",size:11})})}function _r({entry:a,orderedColumns:r}){const o=r.filter(s=>{const i=Number(a?.[s.key]);return Number.isFinite(i)&&i>0});return o.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:o.map(s=>{const i=n(s.copyKey);return e.jsxs("span",{title:i,"aria-label":`${i}: ${he(a?.[s.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(pe,{provider:wr(s),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:X(a?.[s.key])})]},s.key)})})}function Sr({entry:a,entryIdx:r,name:o,meLabel:s,currency:i,rate:l,orderedColumns:p,placeholder:f,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 g=!!a?.is_me,j=!g&&ge(a?.display_name),h=typeof a?.user_id=="string"?a.user_id:null,b=!!h,x=g?s:o,A=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),u(h))};return e.jsxs("div",{role:b?"button":void 0,tabIndex:b?0:void 0,onClick:b?()=>u(h):void 0,onKeyDown:b?A:void 0,"aria-label":b?n("leaderboard.profile_modal.row_aria",{name:x}):void 0,className:d("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",g?"bg-gradient-to-br from-oai-brand-50/70 via-oai-brand-50/20 to-transparent dark:from-oai-brand-950/20 dark:via-oai-brand-950/5 dark:to-transparent border-oai-brand-200/60 dark:border-oai-brand-500/25":j?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",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-brand-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(vr,{rank:a?.rank,placeholder:f})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:d("inline-flex rounded-full p-0.5 transition-all duration-300",jr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(J,{size:"md",avatarUrl:a?.avatar_url,displayName:x,seed:be(a,x)})}),a?.github_url&&e.jsx(Nr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:d("min-w-0 truncate text-sm tracking-tight",g?"font-semibold text-oai-black dark:text-oai-white":j?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:x}),e.jsx(ne,{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:n("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:me(a?.estimated_cost_usd,i,l)})]})]}),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:n("leaderboard.column.total")}),e.jsx("div",{className:d("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",g?"text-oai-black dark:text-oai-white":j?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(ue,{value:a?.total_tokens})})]})]}),e.jsx(_r,{entry:a,orderedColumns:p})]},`mobile-row-${a?.rank}-${x}`)}const Cr={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 De({rank:a,placeholder:r}){const o=Cr[a];return o?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Oe(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Lr(a){if(!a)return n("shared.error.prefix",{error:n("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||n("leaderboard.error.unknown");return n("shared.error.prefix",{error:o})}function xe(a){return typeof a!="string"?"":a.trim()}function ge(a){const r=xe(a);return r?r.toLowerCase()==="anonymous":!0}function be(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Fe({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":n("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(pe,{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:n("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[n("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:n("leaderboard.github.tooltipSettingsLink")})," ",n("leaderboard.github.tooltipSuffix")]})]})]})}function Fr({auth:a,signedIn:r,sessionSoftExpired:o}){const s=ga(),i=ba(),{openLoginModal:l}=pa(),{signedIn:p,loading:f,user:u}=ha(),{currency:g,rate:j}=Ga(),h=c.useMemo(()=>fa(),[]),b=ya(),x=r&&!o,A=c.useMemo(()=>x&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,x]),_=x?A:null,Q=x&&ka(_),ee=n("shared.placeholder.short"),Ze=c.useMemo(()=>q.map(t=>t.key),[]),{order:ae,reorder:fe}=mr(Ze),ye=c.useMemo(()=>{const t=new Map;for(const m of q)t.set(m.key,m);return t},[]),B=c.useMemo(()=>ae.map(t=>ye.get(t)).filter(Boolean),[ae,ye]),Je=za($e(Fa,{activationConstraint:{distance:6}}),$e(Oa,{coordinateGetter:Da})),qe=c.useCallback(t=>{const{active:m,over:w}=t;!w||m.id===w.id||fe(String(m.id),String(w.id))},[fe]),[re,P]=c.useState(1),[S,Xe]=c.useState(fr),[ke,we]=c.useState(null),[Qe,je]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&we(t.trim())},[]),ea=c.useCallback(()=>we(null),[]),aa=c.useCallback(t=>{const m=de.includes(t)?t:ce;Xe(m),P(1);try{window.localStorage.setItem(Ve,String(m))}catch{}},[]),[ve,ra]=c.useState(0),[ta,oa]=c.useState(()=>wa()),[Ne,_e]=c.useState(!1),N=c.useMemo(()=>{const t=new URLSearchParams(s?.search||"");return Oe(t.get("period"))||"total"},[s?.search]),sa=t=>{const m=Oe(t);if(!m||m===N)return;const w=new URLSearchParams(s?.search||"");w.set("period",m),P(1),i(`${s?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{f||b||p||l()},[p,f,b,l]),c.useEffect(()=>{P(1)},[N]);const W=c.useMemo(()=>(H(re,{min:1,max:1e6,fallback:1})-1)*S,[re,S]),T=c.useMemo(()=>b?"mock":f?"unavailable":p?"cloud":r?"local":h?"public":"unavailable",[f,p,h,b,r]),k=c.useMemo(()=>ja({accessMode:T,baseUrl:h,mockEnabled:b,userId:u?.id||null,period:N,pageSize:S,offset:W}),[u?.id,T,h,W,b,S,N]),[$,U]=c.useState(()=>{const t=se(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!h&&!b||!b&&T==="unavailable"){U({loading:!1,error:null,data:null,contextKey:null});return}const t=se(k);let m=!0;return U(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await va({userId:u?.id||null,period:N,limit:S,offset:W});m&&(Na(w,{activeContextKey:k,contextKey:k,source:ve>0?"manual-refresh":"page-load"}),U({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!m)return;const E=Lr(w);U(F=>F.contextKey===k?{...F,loading:!1,error:E}:{loading:!1,error:E,data:null,contextKey:k})}),()=>{m=!1}},[h,T,u?.id,k,W,ve,b,N,S]);const te=c.useMemo(()=>$.contextKey===k?null:se(k),[k,$.contextKey]),v=c.useMemo(()=>$.contextKey===k?$:te?{loading:!1,error:null,data:te.data,contextKey:k}:{loading:!!(h||b)&&T!=="unavailable",error:null,data:null,contextKey:k},[T,h,k,$,b,te]),C=v.data,D=C?.total_pages??null,na=C?.total_entries??0,K=C?.page??re,ia=c.useMemo(()=>er(K,D),[K,D]),Se=C?.from||null,Ce=C?.to||null,Le=C?.generated_at||null,Me=Ja(),R=C?.me||null,z=n("leaderboard.me_label"),Ae=n("leaderboard.anon_label"),Ee=n("leaderboard.period.week"),Pe=n("leaderboard.period.month"),Ke=n("leaderboard.period.total"),Re=N==="month"?Pe:N==="total"?Ke:Ee,V=c.useMemo(()=>{const t=Array.isArray(C?.entries)?C.entries:[];return rr({entries:t,me:R,meLabel:z})},[C?.entries,R,z]),I=c.useMemo(()=>tr(R?.rank,S),[R?.rank,S]),la=I!=null&&I===K,da=c.useCallback(()=>{I!=null&&P(I)},[I]),ca=async()=>{_e(!0);try{La(!0),oa(!0),await Ma(()=>Be(_));const t=await Be(_);t&&await Aa({accessToken:t,period:N,source:"leaderboard-enable-sync"}),ra(m=>m+1)}catch(t){console.warn("[tokentracker] sync:",t)}finally{_e(!1)}},{canPrev:Te,canNext:ze}=ar({page:K,totalPages:D}),Z=Array.isArray(V)&&V.length!==0;let O=null;v.loading&&!Z?O=e.jsx(lr,{rows:S}):v.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:v.error})}):Z?O=e.jsxs(Ia,{sensors:Je,collisionDetection:Ba,modifiers:[Qa],onDragEnd:qe,children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:n("leaderboard.column.rank")}),e.jsx("th",{className:d(Ye,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:n("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:n("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:n("leaderboard.column.est_cost")}),e.jsx($a,{items:ae,strategy:Ua,children:B.map(t=>e.jsx(dr,{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(sr,{iconSrc:t.icon,label:n(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:V.map((t,m)=>{if(t?.is_ellipsis){const M=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:M,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-${m}`)}const w=!!t?.is_me,E=typeof t?.user_id=="string"?t.user_id:null,F=xe(t?.display_name),ma=ge(F)?Ae:F,L=w?z:ma,G=!!E,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>Y(E):void 0,onKeyDown:G?M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),Y(E))}:void 0,"aria-label":n("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const M=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",M?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(ie(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",M&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx(De,{rank:t?.rank,placeholder:ee})}),e.jsx("td",{className:le(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(J,{avatarUrl:t?.avatar_url,displayName:L,seed:be(t,L)})}),t?.github_url&&e.jsx(Fe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ne,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(ue,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:me(t?.estimated_cost_usd,g,j)}),Ue(t,!0,B)]},`row-${t?.rank}-${L}${M?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:d("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(ie(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(De,{rank:t?.rank,placeholder:ee})}),e.jsx("td",{className:le(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(J,{avatarUrl:t?.avatar_url,displayName:L,seed:be(t,L)})}),t?.github_url&&e.jsx(Fe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ne,{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(ue,{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:me(t?.estimated_cost_usd,g,j)}),Ue(t,!1,B)]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:V.map((t,m)=>{const w=xe(t?.display_name),E=ge(w)?Ae:w;return e.jsx(Sr,{entry:t,entryIdx:m,name:t?.is_me?z:E,meLabel:z,currency:g,rate:j,orderedColumns:B,placeholder:ee,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${m}`)})})]}):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:n("leaderboard.empty")})});let oe=null;return typeof D=="number"?oe=ia.map((t,m)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.pagination.ellipsis")},`ellipsis-${m}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===K?"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:()=>P(t),disabled:v.loading,children:String(t)},`page-${t}`)):oe=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.pagination.page_unknown",{page:String(K)})}),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:n("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"?n("leaderboard.range.total"):Se&&Ce?n("leaderboard.range",{period:Re,from:Se,to:Ce}):n("leaderboard.range_loading",{period:Re}),Le&&e.jsx("span",{className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-400 dark:border-oai-gray-800 dark:text-oai-gray-500 sm:inline-block",children:n("leaderboard.generated_at",{ts:Le})})]}),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 m=N===t;return e.jsxs("button",{onClick:()=>sa(t),disabled:v.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",m?"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"?Ee:t==="month"?Pe:Ke}),m&&e.jsx(_a.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(kr,{communityStats:Me,onClick:()=>je(!0)}),e.jsx(br,{me:R,totalEntries:na,meLabel:z,onOpenProfile:R?.user_id?()=>Y(R.user_id):void 0,onJumpToMe:da,canJump:I!=null&&!la&&!v.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.signin_prompt")}),e.jsx("button",{onClick:l,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:n("leaderboard.signin_button")})]}),x&&Q&&!ta&&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:n("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ca,disabled:Ne,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:Ne?n("leaderboard.sync_button.busy"):n("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&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:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:n("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:S,onValueChange:t=>aa(Number(t)),disabled:v.loading,ariaLabel:n("leaderboard.pagination.page_size_label"),options:de.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Te&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>P(t=>Math.max(1,t-1)),disabled:!Te||v.loading,children:n("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:[K," / ",D||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:oe}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",ze&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>P(t=>t+1),disabled:!ze||v.loading,children:n("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:n("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:n("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(pr,{isOpen:!!ke,userId:ke,period:N,accessToken:_,onClose:ea}),e.jsx(hr,{isOpen:Qe,onClose:()=>je(!1),communityStats:Me})]})]})}export{Fr as LeaderboardPage};
@@ -1,73 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-Di0rpmTQ.js","assets/main-BVPlyJJu.js","assets/main-ilWqzAfD.css","assets/AchievementBadge-BgLKRfg6.js","assets/zap-C3aLlz8b.js","assets/flame-DYJfKTkq.js","assets/use-transform-Cd2VlHK0.js","assets/AchievementsSection-Bpck20e3.js","assets/format-tokens-Ck4iJNuB.js","assets/DialogTitle-Du1uOZMr.js","assets/useScrollLock-CBHwgGF7.js"])))=>i.map(i=>d[i]);
2
- import{c as se,_ as G,r as p,dz as ie,j as e,E as n,dA as oe,aB as ne,dB as le,P as c,dC as de,aF as ce,L as me,R as O,k as xe,S as U,X as ge,H as X,a4 as he,G as pe,ai as ue}from"./main-BVPlyJJu.js";import{A as fe,f as be}from"./provider-display-DuQlae7O.js";import{u as ye}from"./useCurrency-BA2GiiJp.js";import{L as Y}from"./LeaderboardAvatar-Ch7SLsZ_.js";import{H as ke,A as q,s as ve,a as je,b as Ne,t as _e,h as we}from"./AchievementBadge-BgLKRfg6.js";import{A as Ae}from"./AchievementsSection-Bpck20e3.js";import{A as T}from"./arrow-up-right-jaA_F8VA.js";import{L as Se}from"./link-2-l6SkcxP3.js";import{C as ze}from"./check-ShRr2Grp.js";import{D as Ce,a as Ie,b as Pe,c as De,d as Le,e as Me}from"./DialogTitle-Du1uOZMr.js";import"./info-DgaOnN42.js";import"./zap-C3aLlz8b.js";import"./flame-DYJfKTkq.js";import"./format-tokens-Ck4iJNuB.js";import"./useScrollLock-CBHwgGF7.js";const $e=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Be=se("code-xml",$e),R="tokentracker_anon_id";let A=null;function F(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)})}function H(){if(A)return A;try{let a=localStorage.getItem(R);return a||(a=F(),localStorage.setItem(R,a)),A=a,a}catch{return A=F(),A}}function K({userId:a}){const{signedIn:r,getAccessToken:s}=G(),[t,i]=p.useState(!1),[o,m]=p.useState(0),[d,g]=p.useState(!1),[u,S]=p.useState(!1),[z,L]=p.useState(!1),[v,j]=p.useState([]),[C,N]=p.useState(!1),y=p.useRef(0),k=p.useCallback(async()=>{if(r)try{const l=await s();if(l)return{accessToken:l,anonId:H()}}catch{}return{anonId:H()}},[r,s]);p.useEffect(()=>{let l=!1;return a?(g(!1),(async()=>{const x=await k();try{const h=await ie({userId:a,...x});if(l)return;m(Number(h?.count)||0),i(!!h?.liked),g(!0)}catch{if(l)return;m(0),i(!1),g(!0)}})(),()=>{l=!0}):(g(!1),()=>{l=!0})},[a,k]);const _=()=>{L(!0),setTimeout(()=>L(!1),450),N(!0),setTimeout(()=>N(!1),500);const l=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],x=["circle","heart"],h=[];for(let b=0;b<12;b++){const I=(b*30+Math.random()*20-10)*(Math.PI/180),P=45+Math.random()*45,Z=Math.cos(I)*P,J=Math.sin(I)*P-(10+Math.random()*15),Q=Math.random()*360-180,ee=6+Math.random()*8,ae=l[Math.floor(Math.random()*l.length)],re=x[Math.floor(Math.random()*x.length)],te=++y.current;h.push({id:te,tx:Z,ty:J,rot:Q,size:ee,color:ae,shape:re})}j(b=>[...b,...h]),setTimeout(()=>{j(b=>b.filter(I=>!h.find(P=>P.id===I.id)))},850)},w=async l=>{S(!0);try{const x=await k(),h=await oe({userId:a,action:l,...x});h&&Number.isFinite(Number(h.count))&&m(Number(h.count)),h&&typeof h.liked=="boolean"&&i(h.liked)}catch{i(x=>!x),m(x=>l==="like"?Math.max(0,x-1):x+1)}finally{S(!1)}},f=l=>{l.stopPropagation(),!(!a||!d||u)&&(t?(i(!1),m(x=>Math.max(0,x-1)),w("unlike")):(i(!0),m(x=>x+1),_(),w("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
3
- @keyframes tt-like-pop {
4
- 0% { transform: scale(1); }
5
- 25% { transform: scale(0.75); }
6
- 50% { transform: scale(1.35); }
7
- 75% { transform: scale(0.9); }
8
- 100% { transform: scale(1); }
9
- }
10
- @keyframes tt-particle-fly {
11
- 0% {
12
- transform: translate(0, 0) scale(1) rotate(0deg);
13
- opacity: 1;
14
- }
15
- 70% {
16
- opacity: 0.8;
17
- }
18
- 100% {
19
- transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
20
- opacity: 0;
21
- }
22
- }
23
- @keyframes tt-num-scroll {
24
- 0% { transform: translateY(8px); opacity: 0; }
25
- 100% { transform: translateY(0); opacity: 1; }
26
- }
27
- .tt-animate-pop {
28
- animation: tt-like-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
29
- }
30
- .tt-particle {
31
- position: absolute;
32
- top: 50%;
33
- left: 50%;
34
- margin-top: -6px;
35
- margin-left: -6px;
36
- pointer-events: none;
37
- z-index: 50;
38
- }
39
- .tt-num-anim {
40
- animation: tt-num-scroll 0.25s ease-out forwards;
41
- }
42
- `}}),v.map(l=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${l.tx}px`,"--ty":`${l.ty}px`,"--rot":`${l.rot}deg`,width:`${l.size}px`,height:`${l.size}px`,backgroundColor:l.shape==="circle"?l.color:"transparent",borderRadius:l.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:l.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:l.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},l.id)),e.jsxs("button",{type:"button",onClick:f,disabled:!d||u,"aria-label":t?n("leaderboard.profile.like.aria_unlike"):n("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:z?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(ke,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${C?"tt-num-anim":""}`,children:d?o:"·"})]})]})}function Ue({badge:a,badgeLabel:r,className:s="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${s}`,children:[e.jsx(Y,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(q,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Te({badges:a,isOwn:r=!1,onSelect:s,className:t=""}){const i=ve((Array.isArray(a)?a:[]).filter(o=>o&&je.has(o.id))).filter(o=>r||(o.tier||0)>=1);return i.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:i.map((o,m)=>{const d=(o.tier||0)>=1,g=n(Ne(o.id,"name")),u=d?n(`achievements.tier.${_e(o.tier)}`):n("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:s?()=>s(o):void 0,title:`${g} · ${u}`,"aria-label":n("achievements.badge.aria",{name:g,tier:u}),style:{zIndex:i.length-m},className:"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:o.id,tier:o.tier,locked:!d,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},o.id)})})}const Re=O.lazy(()=>he(()=>import("./BadgeDetailModal-Di0rpmTQ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function Fe(a,r,s){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:pe(t,{decimals:2,currency:r,rate:s})}function E(a,r,s){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Fe(t,r,s);const i=r==="USD"?t:t*(s||1);return`${r==="USD"?"$":""}${X(i,{decimals:1})}`}function B(a){const r=Number(a);return!Number.isFinite(r)||r<=0?"0":X(r,{decimals:1})}function He(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const s=r.map(i=>({day:i.date,total_tokens:i.total_tokens,models:i.models||null})),t=r[r.length-1]?.date;return xe({dailyRows:s,weeks:52,to:t})}const Ee=`
43
- @keyframes tt-shimmer {
44
- 100% { transform: translateX(100%); }
45
- }
46
- .tt-shimmer-bar {
47
- position: relative;
48
- overflow: hidden;
49
- }
50
- .tt-shimmer-bar::after {
51
- position: absolute;
52
- top: 0; right: 0; bottom: 0; left: 0;
53
- transform: translateX(-100%);
54
- background-image: linear-gradient(
55
- 90deg,
56
- rgba(0, 0, 0, 0) 0%,
57
- rgba(0, 0, 0, 0.02) 20%,
58
- rgba(0, 0, 0, 0.06) 60%,
59
- rgba(0, 0, 0, 0) 100%
60
- );
61
- animation: tt-shimmer 1.6s infinite;
62
- content: '';
63
- }
64
- .dark .tt-shimmer-bar::after {
65
- background-image: linear-gradient(
66
- 90deg,
67
- rgba(255, 255, 255, 0) 0%,
68
- rgba(255, 255, 255, 0.02) 20%,
69
- rgba(255, 255, 255, 0.06) 60%,
70
- rgba(255, 255, 255, 0) 100%
71
- );
72
- }
73
- `;function We({variant:a="modal"}){const r="rounded bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar",s=a==="page";return e.jsxs("div",{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:Ee}}),s?e.jsxs("div",{className:"flex items-start gap-5 px-6 sm:px-8 pt-8 pb-7 animate-fade-in",children:[e.jsx("div",{className:"h-[68px] w-[68px] rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 flex items-start justify-between gap-4 pt-0.5",children:[e.jsxs("div",{className:"min-w-0 space-y-2.5",children:[e.jsx("div",{className:c(r,"h-7 w-48")}),e.jsx("div",{className:c(r,"h-3.5 w-32")})]}),e.jsxs("div",{className:"shrink-0 space-y-1.5 flex flex-col items-end",children:[e.jsx("div",{className:c(r,"h-2.5 w-8")}),e.jsx("div",{className:c(r,"h-7 w-12")})]})]})]}):e.jsxs("div",{className:"flex items-start gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60 animate-fade-in",children:[e.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[e.jsx("div",{className:c(r,"h-4 w-40")}),e.jsx("div",{className:c(r,"h-3 w-56")})]}),e.jsx("div",{className:c(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:c("space-y-6",s?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"px-6 py-5"),children:[e.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((t,i)=>e.jsxs("div",{children:[e.jsx("div",{className:c(r,"h-6 w-20")}),e.jsx("div",{className:c(r,"mt-2 h-3 w-14")})]},i))}),e.jsx("div",{className:"space-y-3 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:Array.from({length:3}).map((t,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-3 w-24")}),e.jsx("div",{className:c(r,"h-3 w-44")})]},i))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-44 mb-4")}),e.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((t,i)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},i))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((t,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-4 w-4")}),e.jsx("div",{className:c(r,"h-3 w-16")}),e.jsx("div",{className:c(r,"h-[3px] flex-1")}),e.jsx("div",{className:c(r,"h-3 w-12")})]},i))})]})]})]})}function V(a){if(!a)return null;const r=String(a).match(/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})/i);return r?r[1]:null}function M({children:a}){return e.jsx("h3",{className:"text-[11px] uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400 mb-3",children:a})}function D({value:a,label:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-black tabular-nums tracking-tight leading-none text-oai-black dark:text-white",style:{fontFamily:'"DIN Alternate-Bold", "DIN Alternate", "DIN Condensed-Bold", "Impact", -apple-system, sans-serif',fontWeight:900},children:a}),e.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function $({label:a,children:r}){return e.jsxs("div",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"shrink-0 w-28 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"min-w-0 flex-1 text-oai-gray-900 dark:text-oai-gray-100 tabular-nums truncate flex items-baseline gap-2 flex-wrap",children:r})]})}function Ge({user:a,onClose:r}){const s=V(a?.github_url);return e.jsxs("div",{className:"flex items-center gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60",children:[e.jsx(Y,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"lg",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.rank?e.jsx("span",{className:c("shrink-0 inline-flex items-center px-2 py-0.5 rounded text-xs font-bold font-mono uppercase tracking-wider border shadow-sm",a.rank===1&&"bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400 dark:bg-amber-400/10",a.rank===2&&"bg-slate-500/10 text-slate-600 border-slate-500/20 dark:text-slate-400 dark:bg-slate-400/10",a.rank===3&&"bg-orange-500/10 text-orange-700 border-orange-500/20 dark:text-orange-400 dark:bg-orange-400/10",a.rank>3&&"bg-oai-gray-100 dark:bg-oai-gray-900/60 text-oai-gray-500 dark:text-oai-gray-400 border-oai-gray-200/60 dark:border-oai-gray-800"),children:n("leaderboard.profile_modal.rank",{rank:a.rank})}):null]}),s&&e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-[12px] text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200 transition-colors",children:[e.jsx(U,{provider:"GITHUB",size:11}),e.jsxs("span",{children:["@",s]})]})]}),a?.user_id&&e.jsx("div",{className:"shrink-0 flex items-center justify-center",children:e.jsx(K,{userId:a.user_id})}),r&&e.jsx("button",{type:"button",onClick:r,className:"shrink-0 -mr-1 -mt-1 flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors group","aria-label":n("leaderboard.profile_modal.close"),children:e.jsx(ge,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function Oe({user:a,topBadge:r}){const s=V(a?.github_url),t=Number(a?.rank)||0,i=t===1?"text-amber-500 dark:text-amber-400":t===2?"text-slate-500 dark:text-slate-300":t===3?"text-orange-600 dark:text-orange-400":"text-oai-gray-400 dark:text-oai-gray-500";return e.jsxs("div",{className:"flex items-center gap-5 px-6 sm:px-8 pt-8 pb-7",children:[e.jsx(Ue,{badge:r,avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"xl",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"truncate text-2xl sm:text-[28px] font-semibold tracking-tight leading-tight text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.user_id&&e.jsx(K,{userId:a.user_id})]}),s?e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(U,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",s]})]}):null]}),t?e.jsxs("div",{className:"shrink-0 text-right leading-none",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:c("mt-1.5 text-3xl font-black tabular-nums tracking-tight",i),children:n("leaderboard.profile_modal.rank",{rank:t})})]}):null]})]})}function Xe({data:a}){const r=Array.isArray(a)?a:[];return r.length===0?e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.providers.none")}):e.jsx("ul",{className:"space-y-2",children:r.map(s=>{const t=Math.max(0,Math.min(1,Number(s?.percent)||0));return e.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center w-4 h-4",children:e.jsx(U,{provider:String(s.source).toUpperCase(),size:14})}),e.jsx("span",{className:"w-20 shrink-0 text-oai-gray-700 dark:text-oai-gray-300",children:be(s.source)}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(t*100).toFixed(1)}%`}})}),e.jsx("span",{className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:B(s.total_tokens)}),e.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(t*100).toFixed(0),"%"]})]},s.source)})})}function W({icon:a,label:r,value:s}){const[t,i]=p.useState(!1),o=async()=>{await ue(s)&&(i(!0),setTimeout(()=>i(!1),1600))};return e.jsxs("button",{type:"button",onClick:o,className:c("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",t?"border-emerald-500/30 text-emerald-600 dark:text-emerald-400 bg-emerald-500/[0.06]":"border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-gray-900 dark:hover:text-oai-gray-100 hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[t?e.jsx(ze,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t?n("leaderboard.profile_modal.badge.copied"):r})]})}function Ye({data:a,currency:r,rate:s,onClose:t,variant:i="modal"}){const{user:o,totals:m,streak:d,best_day:g,models:u,by_provider:S,heatmap:z,period:L}=a,v=i==="page",j=p.useMemo(()=>He(z),[z]),C=u?.favorite?.model_name,N=Number(u?.count)||0,y=Array.isArray(a.badges)?a.badges:[],[k,_]=p.useState(null),w=G(),f=!!(w?.user?.id&&o?.user_id&&w.user.id===o.user_id),l=o?.user_id?`https://www.tokentracker.cc/u/${o.user_id}`:null,x=o?.user_id?`[![My AI coding usage](${de()}/functions/tokentracker-embed-svg?user_id=${o.user_id}&theme=dark)](${l}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[v?e.jsx(Oe,{user:o,topBadge:we(y)}):e.jsx(Ge,{user:o,onClose:t}),e.jsxs("div",{className:c("space-y-6",v?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5"),children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-4",children:[e.jsx(D,{value:B(m?.total_tokens),label:n("leaderboard.profile_modal.stat.total_tokens")}),e.jsx(D,{value:E(m?.estimated_cost_usd,r,s),label:n("leaderboard.profile_modal.stat.total_cost")}),e.jsx(D,{value:String(m?.active_days??0),label:n("leaderboard.profile_modal.stat.active_days")}),e.jsx(D,{value:E(m?.avg_per_day_usd,r,s),label:n("leaderboard.profile_modal.stat.avg_per_day")})]}),e.jsxs("dl",{className:"space-y-2 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsxs($,{label:n("leaderboard.profile_modal.streak.current"),children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:n("leaderboard.profile_modal.streak.days",{count:d?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",d?.longest_days??0,")"]})]}),e.jsx($,{label:n("leaderboard.profile_modal.best_day.title"),children:g?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:B(g.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",g.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.best_day.none")})}),e.jsx($,{label:n("leaderboard.profile_modal.models.favorite"),children:C?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30 truncate max-w-[200px] inline-block align-bottom",children:C}),N>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:n("leaderboard.profile_modal.models.count",{count:N})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.models.none")})})]}),(f||y.some(h=>(h?.tier||0)>=1))&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(M,{children:n("achievements.section.title")}),v?e.jsx(Ae,{achievements:y,isOwn:f&&!!a.badges_include_unearned,scope:"cloud",onSelect:_}):e.jsx(Te,{badges:y,isOwn:f&&!!a.badges_include_unearned,onSelect:_})]}),j&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(M,{children:n("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(fe,{heatmap:j,hideLegend:!0,embedded:!0})})]}),e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(M,{children:n("leaderboard.profile_modal.providers.title")}),e.jsx(Xe,{data:S})]}),o?.user_id&&(t||f)&&e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-3",children:[t&&(ce()?e.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer",onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(T,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]}):e.jsxs(me,{to:`/u/${o.user_id}`,onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(T,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),f&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{icon:Se,label:n("leaderboard.profile_modal.badge.copy_url"),value:l}),e.jsx(W,{icon:Be,label:n("leaderboard.profile_modal.badge.copy"),value:x})]})]})]}),k&&e.jsx(O.Suspense,{fallback:null,children:e.jsx(Re,{badge:k,onClose:()=>_(null)})})]})}function qe({userId:a,period:r,accessToken:s,enabled:t=!0}){const[i,o]=p.useState({loading:!1,error:null,data:null});return p.useEffect(()=>{if(!t||!a)return;let m=!0;return o({loading:!0,error:null,data:null}),(async()=>{try{const d=s?await ne(s):null;if(!m)return;const g=await le({accessToken:d,userId:a,period:r||"week"});if(!m)return;o({loading:!1,error:null,data:g})}catch(d){if(!m)return;d?.status===404?o({loading:!1,error:null,data:null}):o({loading:!1,error:d?.message||String(d),data:null})}})(),()=>{m=!1}},[t,a,r,s]),i}function ca({isOpen:a,onClose:r,userId:s,period:t,accessToken:i}){const{currency:o,rate:m}=ye(),d=qe({userId:s,period:t,accessToken:i,enabled:a});return e.jsx(Ce,{open:a,onOpenChange:g=>{g||r?.()},children:e.jsxs(Ie,{children:[e.jsx(Pe,{className:"cost-modal-backdrop"}),e.jsx(De,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(Le,{className:c("cost-modal-popup","relative w-full max-w-[540px] max-h-[calc(100vh-2rem)] flex flex-col","rounded-2xl bg-white dark:bg-oai-gray-950","shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)]","ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden","dark:border-t dark:border-white/[0.08]"),children:[e.jsx(Me,{render:e.jsx("h2",{className:"sr-only"}),children:d.data?.user?.display_name||n("leaderboard.profile_modal.loading")}),d.loading&&e.jsx(We,{}),!d.loading&&d.error&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:n("leaderboard.profile_modal.error")})}),!d.loading&&!d.error&&!d.data&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.empty")})}),!d.loading&&!d.error&&d.data&&e.jsx(Ye,{data:d.data,currency:o,rate:m,onClose:r})]})})]})})}export{ca as LeaderboardProfileModal,Ye as ProfileContent,We as ProfileSkeleton,qe as useLeaderboardProfileData};
@@ -1 +0,0 @@
1
- import{c as w,r as c,aN as te,f as ne,aO as G,j as t,m as D,S as ae,P as k,E as a,_ as ie,av as se,aP as oe,az as re,aA as le,aB as T,aQ as ce,aR as ue,Z as de,R as C,W as ge,Y as he,a7 as U,aS as pe,aT as me,a3 as be,aU as fe,I as xe,aV as ye,aW as ve,aX as je,aY as ke,aZ as Ne,a_ as Se,a$ as we,b0 as Ce,ar as Le,b1 as A}from"./main-BVPlyJJu.js";import{b as I,l as P,u as Ee,L as O}from"./use-limits-display-prefs-1RM6rjBg.js";import{S as N,T as j,a as x,b as M}from"./Controls-BQxSK041.js";import{u as Ge,P as Ae}from"./use-quality-per-dollar-pref-oapCFOoT.js";import{C as Ie}from"./check-ShRr2Grp.js";import{C as Pe}from"./copy-BUsG8Dxq.js";import{u as Oe}from"./useCurrency-BA2GiiJp.js";import{S as R}from"./Select-NpNBO_zW.js";import{I as _e}from"./info-DgaOnN42.js";import{u as F}from"./use-native-settings-S7AyC9Ou.js";import{C as De}from"./ConfirmModal-DD1Ri-dh.js";import{D as Te}from"./download-B89jns_I.js";import"./Card-CiVg1n9y.js";import"./SelectItemText-DEqB9ndy.js";import"./useScrollLock-CBHwgGF7.js";import"./DialogTitle-Du1uOZMr.js";import"./DialogDescription-CS0HEX8l.js";const Ue=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Me=w("activity",Ue);const Re=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Fe=w("grip-vertical",Re);const He=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],$e=w("languages",He);const Ve=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Be=w("log-out",Ve),ze=e=>!e.isLayoutDirty&&e.willUpdate(!1);function _(){const e=new Set,n=new WeakMap,i=()=>e.forEach(ze);return{add:s=>{e.add(s),n.set(s,s.addEventListener("willUpdate",i))},remove:s=>{e.delete(s);const o=n.get(s);o&&(o(),n.delete(s)),i()},dirty:i}}const Ze=c.createContext(null);function We(){const e=c.useRef(!1);return te(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function qe(){const e=We(),[n,i]=c.useState(0),s=c.useCallback(()=>{e.current&&i(n+1)},[n]);return[c.useCallback(()=>ne.postRender(s),[s]),n]}const H=e=>e===!0,Ke=e=>H(e===!0)||e==="id",Ye=({children:e,id:n,inherit:i=!0})=>{const s=c.useContext(G),o=c.useContext(Ze),[r,l]=qe(),u=c.useRef(null),g=s.id||o;u.current===null&&(Ke(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:H(i)&&s.group||_()});const p=c.useMemo(()=>({...u.current,forceRender:r}),[l]);return t.jsx(G.Provider,{value:p,children:e})},Qe="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Je({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:k("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:k("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Xe({prefs:e}){const{order:n,visibility:i,toggle:s,moveToward:o}=e,[r,l]=c.useState(null),[u,g]=c.useState(null),p=d=>m=>{l(d),m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",d)},b=d=>m=>{m.preventDefault(),m.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{l(null),g(null)},y=d=>{d.preventDefault(),l(null),g(null)};return t.jsx(Ye,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const m=i[d]!==!1,h=r===d;return t.jsxs(D.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:p(d),onDragOver:b(d),onDragEnd:f,onDrop:y,className:k("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",h&&"opacity-40"),style:{cursor:h?"grabbing":"grab"},children:[t.jsx(Fe,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),I(d)?t.jsx(ae,{provider:I(d),size:18,className:k("pointer-events-none",Qe)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:P(d)}),t.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:t.jsx(Je,{checked:m,onChange:()=>s(d),ariaLabel:`${a("limits.settings.toggle_visible")}: ${P(d)}`})})]},d)})})})}function et(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},s=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof s=="string"&&s.trim()?s.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function tt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function nt(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),s=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||s?.[1];return o?`https://github.com/${o}`:null}function L(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function at(e,n,i){const[s,o]=c.useState(()=>se()),r=n&&i&&oe(),l=c.useCallback(async()=>{const u=!s;if(re(u),o(u),!!u)try{await le(()=>e())}catch(g){L("cloud sync",g)}},[s,e]);return{cloudSyncOn:s,handleCloudSyncToggle:l,showLocalCloudSync:r}}function it(e){const[n,i]=c.useState(!1),[s,o]=c.useState(!1),[r,l]=c.useState(!1),[u,g]=c.useState(!1),[p,b]=c.useState(null),[f,y]=c.useState(!1),[d,m]=c.useState(""),[h,v]=c.useState(!1),[S,E]=c.useState(""),[z,Z]=c.useState(""),[W,q]=c.useState(!1),[K,Y]=c.useState(null),Q=c.useMemo(()=>et(e),[e]),J=c.useMemo(()=>tt(e),[e]),X=c.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),ee=c.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:b,setGithubUrl:E,setProfileLoading:l,setPublicProfileOn:i,setShowGithubOn:v}),[]);return{anonymousOn:s,customDisplayName:p,displayName:Q,editingGithub:W,editingName:f,email:J,githubError:K,githubInput:z,githubUrl:S,loadSetters:ee,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:b,setEditingGithub:q,setEditingName:y,setGithubError:Y,setGithubInput:Z,setGithubUrl:E,setNameInput:m,setProfileLoading:l,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:v,showGithubOn:h,userId:X}}function st(e,n,i){c.useEffect(()=>{if(!n)return;let s=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await T({getAccessToken:e});if(!s||!o)return;const r=await ce({accessToken:o});if(!s)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){L("load public profile",o)}finally{s&&i.setProfileLoading(!1)}})(),()=>{s=!1}},[e,n,i])}function ot(e,n){return c.useCallback(async(i,{label:s,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await T({getAccessToken:e});if(!l)return!1;const u=await ue({accessToken:l,...i});return r?.(u),!0}catch(l){return o?o(l):L(s||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function rt(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function lt(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function ct(e,n){const i=c.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:c.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function ut(e,n,i){const s=c.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),i?.()}})},[n,e,i]),o=c.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:s,startEditingName:o}}function dt(e,n){const i=c.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),s=c.useCallback(async()=>{const r=nt(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=c.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:s,handleShowGithubToggle:i,startEditingGithub:o}}function gt(){const e=ie(),n=it(e.user),i=at(e.getAccessToken,e.enabled,e.signedIn);st(e.getAccessToken,e.signedIn,n.loadSetters);const s=ot(e.getAccessToken,n),o=ct(n,s),r=ut(n,s,e.refreshDisplayName),l=dt(n,s);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:rt(n,{...o,...r}),github:lt(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function $({disabled:e,onCancel:n,onSave:i,saveLabel:s=a("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:s}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function ht({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:s,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),t.jsx($,{disabled:s||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:s?a("settings.account.saving"):void 0})]})}function pt({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:s,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{l(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx($,{disabled:s,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:s?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function V({disabled:e=!1,label:n,onClick:i,title:s}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:s,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function B({actions:e,editing:n,editor:i,hint:s,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s})]}),n?null:e]})})}function mt({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(V,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function bt({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:s,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:u,profileLoading:g,profileSaving:p,setEditingName:b,setNameInput:f,startEditingName:y}=e,d=n?a("settings.account.displayNameAnonymousHint"):i||s;return t.jsx(B,{label:a("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(ht,{nameInput:u,setEditingName:b,setNameInput:f,profileSaving:p,handleSaveName:l}),actions:t.jsx(mt,{name:e})})}function ft({github:e}){const{editingGithub:n,githubError:i,githubInput:s,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:u,profileSaving:g,setEditingGithub:p,setGithubError:b,setGithubInput:f,showGithubOn:y,startEditingGithub:d}=e,{enabled:m,toggle:h}=Ge();return t.jsxs(t.Fragment,{children:[t.jsx(B,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(pt,{githubError:i,githubInput:s,handleSaveGithub:r,profileSaving:g,setEditingGithub:p,setGithubError:b,setGithubInput:f}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(V,{label:a("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:l,disabled:u||g,ariaLabel:a("settings.account.githubUrl")})]})}),o&&t.jsx(x,{label:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a("settings.labs.qpd.label")}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:a("qpd.card.badge")})]}),hint:a("settings.labs.qpd.hint"),control:t.jsx(j,{checked:m,onChange:h,ariaLabel:a("settings.labs.qpd.aria")})})]})}function xt(){const{openLoginModal:e}=de();return t.jsx(N,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function yt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(bt,{name:e}),t.jsx(ft,{github:n})]})}function vt(){const e=gt();return e.enabled?e.signedIn?t.jsxs(N,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(kt,{onSignOut:e.signOut}),children:[t.jsx(jt,{userId:e.userId}),t.jsx(Nt,{settings:e}),t.jsx(St,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(wt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(xt,{}):null}function jt({userId:e}){const[n,i]=C.useState(!1);if(!e)return null;const s=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function kt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function Nt({settings:e}){return e.showLocalCloudSync?t.jsx(x,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function St({checked:e,disabled:n,onChange:i}){return t.jsx(x,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function wt({visible:e,name:n,github:i}){return t.jsx(ge,{initial:!1,children:e?t.jsx(D.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(yt,{name:n,github:i})},"public-profile-fields"):null})}function Ct(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:pe},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:me},{value:"system",label:a("settings.appearance.theme.system"),Icon:be}]}function Lt(){return[{value:ye,label:a("settings.appearance.language.system")},{value:ve,label:a("settings.appearance.language.english")},{value:je,label:a("settings.appearance.language.chinese")},{value:ke,label:a("settings.appearance.language.traditional_chinese")},{value:Ne,label:a("settings.appearance.language.japanese")},{value:Se,label:a("settings.appearance.language.korean")},{value:we,label:a("settings.appearance.language.german")}]}function Et(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Gt(e,n){const i=a(`settings.appearance.currency.rate_source.${e}`),s=Et(n),o=s?a("settings.appearance.currency.rate_updated",{when:s}):a("settings.appearance.currency.rate_never");return`${i} · ${o}`}function At({locale:e,setLocale:n}){const i=Lt();return t.jsx(R,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx($e,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function It({currency:e,setCurrency:n}){const i=fe().map(s=>({value:s.code,label:a(s.labelKey)}));return t.jsx(R,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Pt({currency:e,rate:n,rateSource:i,rateFetchedAt:s}){if(e===xe)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=Gt(i,s);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Ot(){const{theme:e,setTheme:n}=he(),{locale:i,setLocale:s}=U(),{currency:o,rate:r,rateSource:l,rateFetchedAt:u,setCurrency:g}=Oe();return t.jsxs(N,{title:a("settings.section.appearance"),children:[t.jsx(x,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(M,{options:Ct(),value:e,onChange:n})}),t.jsx(x,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(At,{locale:i,setLocale:s})}),t.jsx(x,{label:a("settings.appearance.currency.label"),hint:t.jsx(Pt,{currency:o,rate:r,rateSource:l,rateFetchedAt:u}),control:t.jsx(It,{currency:o,setCurrency:g})})]})}function _t(){const{available:e,settings:n,setSetting:i,runAction:s}=F();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,l=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(N,{title:a("settings.section.menubar"),children:[r?t.jsx(x,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(x,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>s("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ce,{className:k("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(x,{label:a("settings.menubar.updates"),hint:l||void 0,control:t.jsxs("button",{type:"button",onClick:()=>s("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function Dt(e,n){function i(r){return r.replace(/^v/,"").split(".").map(Number)}const s=i(e),o=i(n);for(let r=0;r<Math.max(s.length,o.length);r++){const l=s[r]||0,u=o[r]||0;if(l<u)return!0;if(l>u)return!1}return!1}function Tt(){const{available:e,settings:n,runAction:i}=F(),s=e&&n?.version,[o,r]=C.useState(!1),[l,u]=C.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:g}=U(),p="0.79.7",b=async()=>{r(!0);try{const h=await fetch("https://api.github.com/repos/mm7894215/TokenTracker/releases/latest");if(!h.ok)throw new Error("Failed to fetch");const v=await h.json(),S=v.tag_name;Dt(p,S)?u({open:!0,latestVersion:S,htmlUrl:v.html_url}):A({title:a("settings.menubar.updates.upToDate")})}catch(h){console.error("Check updates failed:",h),A({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},f=a("settings.menubar.updates.modalTitle"),y=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),d=a("settings.menubar.updates.modalConfirm"),m=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:b,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Le,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Me,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(De,{open:l.open,title:f,description:y,confirmLabel:d,cancelLabel:m,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),u(h=>({...h,open:!1}))},onCancel:()=>u(h=>({...h,open:!1}))})]})}function Ut({prefs:e}){return t.jsx(M,{options:[{value:O.USED,label:a("limits.settings.display_mode_used")},{value:O.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function tn(){const e=Ee();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Ot,{}),t.jsx(_t,{}),t.jsx(vt,{}),t.jsx(N,{title:a("settings.section.limits"),action:t.jsx(Ut,{prefs:e}),children:t.jsx(Xe,{prefs:e})})]}),t.jsx(Tt,{})]})})})}export{tn as SettingsPage};
@@ -1 +0,0 @@
1
- import{c}from"./main-BVPlyJJu.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
@@ -1,42 +0,0 @@
1
- import{c as ue,r as i,j as e,E as s,Y as We,k as Fe,G as Ie,X as He,aD as Ge,H as Oe}from"./main-BVPlyJJu.js";import{u as qe}from"./useCurrency-BA2GiiJp.js";import{I as Ke}from"./info-DgaOnN42.js";const Ve=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Ze=ue("maximize-2",Ve);const Je=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Qe=ue("pause",Je);const et=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],tt=ue("play",et);const at=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],rt=ue("rotate-ccw",at);const ot=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],nt=ue("terminal",ot),Q={emerald:{light:["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],dark:["#2d333b","#065f46","#059669","#10b981","#34d399"],gridColor:{light:"rgba(16, 185, 129, 0.12)",dark:"rgba(52, 211, 153, 0.08)"}},ocean:{light:["#f1f5f9","#93c5fd","#60a5fa","#3b82f6","#1d4ed8"],dark:["#1e293b","#1e3a8a","#2563eb","#3b82f6","#60a5fa"],gridColor:{light:"rgba(59, 130, 246, 0.12)",dark:"rgba(96, 165, 250, 0.08)"}},neon:{light:["#faf5ff","#ebd5ff","#c084fc","#a855f7","#7e22ce"],dark:["#2e1065","#581c87","#8b5cf6","#a855f7","#c084fc"],gridColor:{light:"rgba(168, 85, 247, 0.12)",dark:"rgba(192, 132, 252, 0.08)"}},amber:{light:["#fffbeb","#fde68a","#f59e0b","#d97706","#b45309"],dark:["#451a03","#78350f","#b45309","#d97706","#f59e0b"],gridColor:{light:"rgba(245, 158, 11, 0.12)",dark:"rgba(245, 158, 11, 0.08)"}}};function st(o,d){const h=/^#([0-9a-f]{6})$/i.exec(o);if(!h)return o;const c=parseInt(h[1],16),M=c>>16&255,P=c>>8&255,$=c&255,S=E=>Math.max(0,Math.min(255,Math.round(E*d)));return`rgb(${S(M)}, ${S(P)}, ${S($)})`}function O(o,d,h,c,M){const P=Math.cos(c),$=Math.sin(c),S=o*P-d*$,E=o*$+d*P,L=h,T=Math.cos(M),x=Math.sin(M),N=S,ee=E*T-L*x,F=E*x+L*T;return{x:N,y:ee,z:F}}function lt(o,d,h,c,M){return O(o,d,h,c,M)}function Se(o,d){const h=Number(d).toLocaleString();if(o>=4){const c=Math.floor(Math.random()*3)+1;return s(`heatmap.3d.voxel.joke.${c}`,{value:h})}else return o===3?s("heatmap.3d.voxel.level3",{value:h}):o===2?s("heatmap.3d.voxel.level2",{value:h}):o===1?s("heatmap.3d.voxel.level1",{value:h}):s("heatmap.3d.voxel.level0")}function Te({weeks:o,palette:d="auto",isDark:h=!1,interactive:c=!1,autoRotateInit:M=!1,onResetViewRef:P=null}){const $=Q[d]||(d==="auto"?Q.emerald:null),S=$?h?$.dark:$.light:Array.isArray(d)?d:h?Q.emerald.dark:Q.emerald.light,E=$?h?$.gridColor.dark:$.gridColor.light:h?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",L=-.2,T=.88,[x,N]=i.useState({yaw:L,pitch:T}),[ee,F]=i.useState(M),[pe,R]=i.useState(1),j=c?13:10.5,he=i.useMemo(()=>{const t=[],r=o.length;if(r===0||!c)return[];for(let l=0;l<=7;l++){const n=(l-3.5)*j,m=O(-r/2*j,n,0,x.yaw,x.pitch),p=O(r/2*j,n,0,x.yaw,x.pitch);t.push({d:`M${m.x},${m.y} L${p.x},${p.y}`,key:`horiz-${l}`})}for(let l=0;l<=r;l+=4){const n=(l-r/2)*j,m=O(n,-3.5*j,0,x.yaw,x.pitch),p=O(n,3.5*j,0,x.yaw,x.pitch);t.push({d:`M${m.x},${m.y} L${p.x},${p.y}`,key:`vert-${l}`})}if(r%4!==0){const l=(r-r/2)*j,n=O(l,-3.5*j,0,x.yaw,x.pitch),m=O(l,3.5*j,0,x.yaw,x.pitch);t.push({d:`M${n.x},${n.y} L${m.x},${m.y}`,key:"vert-last"})}return t},[o.length,x,j,c]);i.useEffect(()=>{P&&(P.current={reset:()=>{N({yaw:L,pitch:T}),F(!1),R(1),ye()},toggleAutoRotate:t=>{F(t)}})},[P]);const q=i.useRef(null),I=i.useRef(null),W=i.useRef(!1),ie=i.useRef({x:0,y:0}),K=i.useRef({yaw:L,pitch:T}),Y=i.useRef({x:0,y:0}),re=i.useRef({x:0,y:0,time:0}),oe=i.useRef(null),[fe,ge]=i.useState(0),V=i.useRef(null),ne=i.useRef(!0);i.useEffect(()=>(ne.current=!0,()=>{ne.current=!1}),[]);const ye=()=>{V.current&&cancelAnimationFrame(V.current),ge(0);const t=performance.now(),r=1200,l=n=>{if(!ne.current)return;const m=n-t,p=Math.min(1,m/r),k=1-Math.pow(1-p,3);ge(k),p<1?V.current=requestAnimationFrame(l):V.current=null};V.current=requestAnimationFrame(l)};i.useEffect(()=>(ye(),()=>{V.current&&cancelAnimationFrame(V.current)}),[c]),i.useEffect(()=>{if(!ee||W.current||typeof window>"u"||typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let r;const l=()=>{if(typeof document<"u"&&document.visibilityState==="hidden"){r=requestAnimationFrame(l);return}N(n=>({yaw:n.yaw+.002,pitch:n.pitch})),r=requestAnimationFrame(l)};return r=requestAnimationFrame(l),()=>cancelAnimationFrame(r)},[ee]);const ce=(t,r)=>{c&&(W.current=!0,ie.current={x:t,y:r},K.current={yaw:x.yaw,pitch:x.pitch},Y.current={x:0,y:0},re.current={x:t,y:r,time:performance.now()},oe.current&&cancelAnimationFrame(oe.current))},U=(t,r)=>{if(!W.current)return;const l=t-ie.current.x,n=r-ie.current.y,m=performance.now(),p=m-re.current.time;p>0&&(Y.current={x:(t-re.current.x)/p,y:(r-re.current.y)/p}),re.current={x:t,y:r,time:m};const k=.005,f=K.current.yaw-l*k,g=Math.PI/2.3,D=Math.max(-g,Math.min(g,K.current.pitch-n*k));N({yaw:f,pitch:D})},be=()=>{if(!W.current)return;W.current=!1;let t=-Y.current.x*12,r=-Y.current.y*12;const l=.95,n=()=>{W.current||(t*=l,r*=l,!(Math.abs(t)<.01&&Math.abs(r)<.01)&&(N(m=>{const p=m.yaw+t*.005,k=Math.PI/2.3,f=Math.max(-k,Math.min(k,m.pitch+r*.005));return{yaw:p,pitch:f}}),oe.current=requestAnimationFrame(n)))};oe.current=requestAnimationFrame(n)},[b,de]=i.useState(null),[Z,xe]=i.useState({x:0,y:0,shiftX:0}),y=i.useRef(null);i.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),i.useEffect(()=>{if(!c||!I.current)return;const t=l=>{l.preventDefault();const n=-l.deltaY*.0025;R(m=>{const p=m+n;return Math.max(.5,Math.min(3,p))})},r=I.current;return r.addEventListener("wheel",t,{passive:!1}),()=>{r.removeEventListener("wheel",t)}},[c]);const C=i.useMemo(()=>{const t=[];return o.forEach((r,l)=>{(Array.isArray(r)?r:[]).forEach((n,m)=>{n&&t.push({key:n.day||`${l}-${m}`,col:l,row:m,level:n.level||0,value:n.value||0,day:n.day,models:n.models||null})})}),t},[o]),ve=j-(c?1.8:1.5),ke=c?38:28,J=t=>Math.max(1.8,Number(t)/4*ke),te=i.useMemo(()=>{if(C.length===0)return[];const t=o.length;return C.map(r=>{const l=J(r.level),n=Math.sqrt(Math.pow(r.col-t/2,2)+Math.pow(r.row-3.5,2)),m=Math.sqrt(Math.pow(t/2,2)+Math.pow(3.5,2)),p=n/m*.4,k=Math.min(1,Math.max(0,(fe-p)*(1/.6))),f=l*k,g=(r.col-t/2)*j,D=(r.row-3.5)*j,w=ve/2,G=[{x:g-w,y:D-w,z:0},{x:g+w,y:D-w,z:0},{x:g+w,y:D+w,z:0},{x:g-w,y:D+w,z:0},{x:g-w,y:D-w,z:f},{x:g+w,y:D-w,z:f},{x:g+w,y:D+w,z:f},{x:g-w,y:D+w,z:f}].map(B=>O(B.x,B.y,B.z,x.yaw,x.pitch)),me=O(g,D,f/2,x.yaw,x.pitch),Le=[{name:"top",indices:[4,5,6,7],scale:1,normal:[0,0,1]},{name:"bottom",indices:[3,2,1,0],scale:.4,normal:[0,0,-1]},{name:"left",indices:[3,0,4,7],scale:.55,normal:[-1,0,0]},{name:"right",indices:[1,2,6,5],scale:.75,normal:[1,0,0]},{name:"front",indices:[0,1,5,4],scale:.85,normal:[0,-1,0]},{name:"back",indices:[2,3,7,6],scale:.65,normal:[0,1,0]}],Ae=S[Math.min(4,Math.max(0,Number(r.level)||0))],Ne=[],Re=.35,De=-.4,Pe=.83;return Le.forEach(B=>{const we=lt(B.normal[0],B.normal[1],B.normal[2],x.yaw,x.pitch);if(we.z>.001){const Ce=G[B.indices[0]],ze=G[B.indices[1]],Me=G[B.indices[2]],_e=G[B.indices[3]],Ye=`M${Ce.x},${Ce.y} L${ze.x},${ze.y} L${Me.x},${Me.y} L${_e.x},${_e.y} Z`,Ue=we.x*Re+we.y*De+we.z*Pe,Xe=h?.18:0,Be=B.scale*(.82+.28*Math.max(0,Ue))+Xe;Ne.push({name:B.name,d:Ye,fill:st(Ae,Be)})}}),{...r,centerProj:me,renderedFaces:Ne}})},[C,x,S,o.length,fe,j,ve,ke]),se=i.useMemo(()=>[...te].sort((t,r)=>t.centerProj.z-r.centerProj.z),[te]),_=i.useMemo(()=>{if(se.length===0)return{minX:-100,minY:-100,maxX:100,maxY:100};let t=1/0,r=1/0,l=-1/0,n=-1/0;return se.forEach(m=>{const p=j*2,k=m.centerProj.x,f=m.centerProj.y;k-p<t&&(t=k-p),k+p>l&&(l=k+p),f-p<r&&(r=f-p),f+p>n&&(n=f+p)}),{minX:t,minY:r,maxX:l,maxY:n}},[se,j]),A=12,a=_.maxX-_.minX+A*2,u=_.maxY-_.minY+A*2,z=a/pe,v=u/pe,X=_.minX-A+(a-z)/2,H=_.minY-A+(u-v)/2,le=`${X} ${H} ${z} ${v}`;return C.length===0?e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:s("heatmap.empty")}):e.jsxs("div",{ref:I,className:`relative select-none outline-none ${c?"cursor-grab active:cursor-grabbing w-full h-full flex items-center justify-center":"w-full overflow-hidden flex justify-center"}`,onMouseDown:t=>{if(!c)return;ce(t.clientX,t.clientY);const r=n=>U(n.clientX,n.clientY),l=()=>{be(),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",l)},onTouchStart:t=>{!c||t.touches.length===0||ce(t.touches[0].clientX,t.touches[0].clientY)},onTouchMove:t=>{!c||t.touches.length===0||U(t.touches[0].clientX,t.touches[0].clientY)},onTouchEnd:()=>{c&&be()},children:[e.jsxs("svg",{ref:q,viewBox:le,width:c?"95%":"100%",height:c?"95%":"auto",role:"img","aria-label":s("heatmap.iso.aria")||"3D interactive activity heatmap",style:{display:"block",width:"100%",height:"auto",maxWidth:c?"none":`${a}px`,maxHeight:c?"78vh":"none"},className:"transition-transform duration-300 ease-out",children:[c&&he.map(t=>e.jsx("path",{d:t.d,fill:"none",stroke:E,strokeWidth:.25,strokeDasharray:"1.5 2.5",strokeLinecap:"round"},t.key)),se.map(t=>{const r=b&&b.key===t.key;return e.jsxs("g",{onMouseEnter:l=>{if(y.current&&(clearTimeout(y.current),y.current=null),de(t),c&&q.current){const n=O((t.col-o.length/2)*j,(t.row-3.5)*j,J(t.level),x.yaw,x.pitch);let m=0,p=0;const k=q.current;if(I.current&&typeof k.createSVGPoint=="function"&&typeof k.getScreenCTM=="function")try{const w=k.createSVGPoint();w.x=n.x,w.y=n.y;const ae=k.getScreenCTM();if(ae){const G=w.matrixTransform(ae),me=I.current.getBoundingClientRect();m=G.x-me.left,p=G.y-me.top}}catch{const ae=k.getBoundingClientRect(),G=_.maxX-_.minX+A*2,me=_.maxY-_.minY+A*2;m=(n.x-(_.minX-A))/G*ae.width,p=(n.y-(_.minY-A))/me*ae.height}else{const w=k.getBoundingClientRect(),ae=_.maxX-_.minX+A*2,G=_.maxY-_.minY+A*2;m=(n.x-(_.minX-A))/ae*w.width,p=(n.y-(_.minY-A))/G*w.height}const f=140;let g=0;const D=I.current?I.current.getBoundingClientRect().width:k.getBoundingClientRect().width;m<f?g=f-m:m>D-f&&(g=D-f-m),xe({x:m,y:p,shiftX:g})}},onMouseLeave:()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{de(null)},150)},className:"transition-all duration-200",style:{filter:r?"brightness(1.15) drop-shadow(0 4px 6px rgba(0,0,0,0.15))":"none",cursor:c?"pointer":"default"},children:[!c&&t.day&&e.jsx("title",{children:`${t.day}: ${Number(t.value).toLocaleString()} tokens`}),t.renderedFaces.map((l,n)=>e.jsx("path",{d:l.d,fill:l.fill,stroke:l.fill,strokeWidth:.25,strokeLinejoin:"round"},n))]},t.key)})]}),c&&b&&e.jsxs("div",{onMouseEnter:()=>{y.current&&(clearTimeout(y.current),y.current=null)},onMouseLeave:()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{de(null)},150)},className:"absolute z-[9999] w-0 h-0 transition-all duration-100 ease-out",style:{left:`${Z.x}px`,top:`${Z.y}px`},children:[e.jsxs("div",{className:"absolute left-0 bottom-[10px] backdrop-blur-md bg-white/90 dark:bg-oai-gray-900/90 border border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-xl rounded-xl p-3.5 max-w-[280px] min-w-[200px] flex flex-col gap-2 animate-in fade-in zoom-in-95 duration-100",style:{transform:`translateX(calc(-50% + ${Z.shiftX}px))`},children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-oai-gray-100 dark:border-oai-gray-800/80 pb-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-oai-gray-500 dark:text-oai-gray-400",children:b.day}),(()=>{const t=b.level===0?h?"#9ca3af":"#6b7280":S[b.level];return e.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:t+"22",color:t,border:`1px solid ${t}44`},children:["Level ",b.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:Number(b.value).toLocaleString()}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),b.models&&Object.keys(b.models).length>0?e.jsxs("div",{className:"mt-1.5 border-t border-oai-gray-100 dark:border-oai-gray-800/60 pt-2 flex flex-col gap-1.5",children:[e.jsx("div",{className:"text-[10px] font-semibold text-oai-gray-400 dark:text-oai-gray-500 uppercase tracking-wider",children:"Model Breakdown"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-[150px] overflow-y-auto pr-1.5 scrollbar-thin",children:Object.entries(b.models).map(([t,r])=>({name:t,val:Number(r)})).sort((t,r)=>r.val-t.val).map(({name:t,val:r})=>{const l=Number(b.value)||1,n=Math.round(r/l*100);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] gap-3",children:[e.jsx("span",{className:"font-medium text-oai-gray-750 dark:text-oai-gray-200 truncate max-w-[120px]",title:t,children:t}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:r.toLocaleString()}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[n,"%"]})]})]}),e.jsx("div",{className:"w-full h-1 bg-oai-gray-100 dark:bg-oai-gray-800/85 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${n}%`,backgroundColor:S[4],boxShadow:`0 0 4px ${S[4]}55`}})})]},t)})})]}):e.jsx("p",{className:"text-[11px] text-oai-gray-600 dark:text-oai-gray-300 leading-relaxed font-normal mt-1 border-t border-dashed border-oai-gray-100 dark:border-oai-gray-800/60 pt-1.5",children:Se(b.level,b.value)})]})]}),e.jsx("div",{className:"absolute bottom-[6px] left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 border-r border-b border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-sm",style:{marginBottom:"1px"}})]})]})}const it=12,ct=3,dt=26,mt=["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],xt=["#121212","#065f46","#059669","#10b981","#34d399"];function $e(o){const d=Number(o);return Number.isFinite(d)?d<1e3?d.toLocaleString():Oe(d,{decimals:2}):"0"}function ut(o){if(typeof o!="string")return null;const d=/^(\d{4})-(\d{2})-(\d{2})$/.exec(o.trim());if(!d)return null;const h=new Date(Date.UTC(Number(d[1]),Number(d[2])-1,Number(d[3])));return Number.isFinite(h.getTime())?h:null}function Ee(o,d){return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()+d))}function pt(o,d){return Math.floor((Date.UTC(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate())-Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()))/864e5)}function ht(o,d){const h=d==="mon"?1:0,c=o.getUTCDay();return Ee(o,-((c-h+7)%7))}function ft(o,d,h,c){if(!o)return[];const M=ut(d)||new Date,P=[];for(let T=11;T>=0;T-=1)P.push(new Date(Date.UTC(M.getUTCFullYear(),M.getUTCMonth()-T,1)));const $=ht(M,h),S=Ee($,-(o-1)*7),E=[],L=new Set;for(const T of P){const x=Math.floor(pt(S,T)/7);x<0||x>=o||L.has(x)||(L.add(x),E.push({label:c[T.getUTCMonth()],index:x}))}return E}function wt({heatmap:o,timeZoneLabel:d,timeZoneShortLabel:h,hideLegend:c=!1,embedded:M=!1}){const{resolvedTheme:P}=We(),{currency:$,rate:S}=qe(),E=P==="dark",L=E?xt:mt,T=i.useRef(null),x=i.useRef(null),[N,ee]=i.useState(null),[F,pe]=i.useState({x:0,y:0,shiftX:0,flipY:!1}),R=i.useRef(null);i.useEffect(()=>()=>{R.current&&clearTimeout(R.current)},[]);const[j,he]=i.useState(!1),[q,I]=i.useState(!1),[W,ie]=i.useState(!1),K=i.useRef(null),[Y,re]=i.useState("emerald"),oe=[s("heatmap.month.jan"),s("heatmap.month.feb"),s("heatmap.month.mar"),s("heatmap.month.apr"),s("heatmap.month.may"),s("heatmap.month.jun"),s("heatmap.month.jul"),s("heatmap.month.aug"),s("heatmap.month.sep"),s("heatmap.month.oct"),s("heatmap.month.nov"),s("heatmap.month.dec")],fe=(a,u)=>{if(!u||!u.day)return;R.current&&(clearTimeout(R.current),R.current=null),ee(u);const z=a.currentTarget.getBoundingClientRect(),v=typeof window<"u"?window.innerWidth:1024,X=z.left+z.width/2,H=z.top<300,le=H?z.bottom:z.top,t=140;let r=0;X<t?r=t-X:X>v-t&&(r=v-t-X),pe({x:X,y:le,shiftX:r,flipY:H})},ge=()=>{R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{ee(null)},150)},V=()=>{I(!1),he(!0)},ne=()=>{I(!0)},ye=a=>{a.target===a.currentTarget&&q&&(he(!1),I(!1))};i.useEffect(()=>{if(!j||q)return;const a=u=>{u.key==="Escape"&&ne()};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[j,q]);const ce=i.useMemo(()=>({emerald:{accentText:"text-emerald-500 dark:text-emerald-400",accentBg:"bg-emerald-500/10 dark:bg-emerald-400/10",accentBorder:"border-emerald-500/20 dark:border-emerald-400/15",hoverBorder:"hover:border-emerald-500/30 dark:hover:border-emerald-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(16,185,129,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(52,211,153,0.25)]",rawColor:"#10b981"},ocean:{accentText:"text-blue-500 dark:text-blue-400",accentBg:"bg-blue-500/10 dark:bg-blue-400/10",accentBorder:"border-blue-500/20 dark:border-blue-400/15",hoverBorder:"hover:border-blue-500/30 dark:hover:border-blue-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(59,130,246,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(96,165,250,0.25)]",rawColor:"#3b82f6"},neon:{accentText:"text-purple-500 dark:text-purple-400",accentBg:"bg-purple-500/10 dark:bg-purple-400/10",accentBorder:"border-purple-500/20 dark:border-purple-400/15",hoverBorder:"hover:border-purple-500/30 dark:hover:border-purple-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(168,85,247,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(192,132,252,0.25)]",rawColor:"#a855f7"},amber:{accentText:"text-amber-500 dark:text-amber-400",accentBg:"bg-amber-500/10 dark:bg-amber-400/10",accentBorder:"border-amber-500/20 dark:border-amber-400/15",hoverBorder:"hover:border-amber-500/30 dark:hover:border-amber-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(245,158,11,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(245,158,11,0.25)]",rawColor:"#f59e0b"}}),[]),U=ce[Y]||ce.emerald,be=Q[Y]?E?Q[Y].dark:Q[Y].light:E?Q.emerald.dark:Q.emerald.light,[b,de]=i.useState(()=>{if(M)return"2d";try{return window.localStorage?.getItem("tt:heatmap-view")==="3d"?"3d":"2d"}catch{return"2d"}});i.useEffect(()=>{if(!M)try{window.localStorage?.setItem("tt:heatmap-view",b)}catch{}},[b,M]),i.useEffect(()=>{if(b!=="2d")return;const a=T.current;a&&(a.scrollLeft=a.scrollWidth)},[o?.weeks,b]),i.useEffect(()=>{const a=T.current;if(!a)return;const u=()=>{R.current&&(clearTimeout(R.current),R.current=null),ee(null)};return a.addEventListener("scroll",u),()=>a.removeEventListener("scroll",u)},[]);const Z=o?.week_starts_on==="mon"?"mon":"sun",xe=i.useMemo(()=>{const a=Array.isArray(o?.weeks)?o.weeks:[];if(!a.length)return{weeks:[]};const u=[];for(const z of a)for(const v of Array.isArray(z)?z:[])v?.day&&u.push({day:v.day,total_tokens:v.total_tokens??v.value??0,billable_total_tokens:v.billable_total_tokens??v.value??v.total_tokens??0,models:v.models??null});return Fe({dailyRows:u,weeks:Math.max(52,a.length),to:o?.to,weekStartsOn:Z})},[o?.to,o?.weeks,Z]),y=xe?.weeks||[],C=i.useMemo(()=>{let a=0,u=0,z={day:"无数据",value:0},v=0,X=0;const H=[];y.forEach(f=>{(Array.isArray(f)?f:[]).forEach(g=>{g&&g.day&&H.push(g)})}),H.sort((f,g)=>f.day.localeCompare(g.day)),H.forEach(f=>{const g=Number(f.value)||0;a+=g,g>0?(u++,v++,v>X&&(X=v)):v=0,g>z.value&&(z={day:f.day,value:g})});const le=H.length||365,t=(u/le*100).toFixed(1);let r="heatmap.3d.modal.ai.eval.default",l="heatmap.3d.modal.ai.title.default";a>=15e6?(l="heatmap.3d.modal.ai.title.peak",r="heatmap.3d.modal.ai.eval.peak"):a>=5e6?(l="heatmap.3d.modal.ai.title.heavy",r="heatmap.3d.modal.ai.eval.heavy"):a>=1e6?(l="heatmap.3d.modal.ai.title.core",r="heatmap.3d.modal.ai.eval.core"):a>=2e4&&(l="heatmap.3d.modal.ai.title.steady",r="heatmap.3d.modal.ai.eval.steady");const n=o?.total_cost_usd,m=Number(n),k=n!=null&&(typeof n!="string"||n.trim()!=="")&&Number.isFinite(m)?m:a/15e5;return{totalTokens:a,activeDays:u,activeRate:t,maxSingleDay:z,maxStreak:X,aiEvaluationTitleKey:l,aiEvaluationKey:r,totalCostUsd:k}},[y,o?.total_cost_usd]),je=i.useMemo(()=>Ie(C.totalCostUsd,{currency:$,rate:S}),[C.totalCostUsd,$,S]),ve=Z==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(a=>s(`heatmap.day.${a.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(a=>s(`heatmap.day.${a.toLowerCase()}`)),ke=i.useMemo(()=>ft(y.length,xe?.to,Z,oe),[xe?.to,y.length,Z,oe]);if(!y.length)return e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:s("heatmap.empty")});const J=M?10:it,te=M?2:ct,se=M?22:dt,_=se+y.length*J+Math.max(0,y.length-1)*te,A=`${se}px repeat(${y.length}, ${J}px)`;return e.jsxs("div",{ref:x,className:M?"relative":"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[!M&&e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:s("heatmap.title")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{role:"tablist","aria-label":"Heatmap view",className:"flex rounded-md border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 text-[10px]",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":b==="2d",onClick:()=>de("2d"),className:b==="2d"?"px-2 py-0.5 rounded bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-oai-white font-medium":"px-2 py-0.5 rounded text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200",children:s("heatmap.view.2d")}),e.jsx("button",{type:"button",role:"tab","aria-selected":b==="3d",onClick:()=>de("3d"),className:b==="3d"?"px-2 py-0.5 rounded bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-oai-white font-medium":"px-2 py-0.5 rounded text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200",children:s("heatmap.view.3d")})]}),e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-450",children:h||s("heatmap.legend.utc")})]})]}),b==="3d"&&e.jsxs("div",{onClick:V,className:"cursor-pointer group relative overflow-hidden rounded-lg hover:border-oai-gray-350 dark:hover:border-oai-gray-700 border border-transparent transition-all",title:s("heatmap.3d.hover_tip"),children:[e.jsx(Te,{weeks:y,isDark:E,palette:Y}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-oai-gray-900/5 to-transparent pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity flex items-end justify-center pb-2",children:e.jsxs("span",{className:"text-[10px] bg-white/95 dark:bg-oai-gray-900/95 shadow border border-oai-gray-200/60 dark:border-oai-gray-800/80 px-2.5 py-1 rounded-full font-medium text-oai-gray-500 dark:text-oai-gray-400 flex items-center gap-1 transform translate-y-2 group-hover:translate-y-0 transition-transform duration-200",children:[e.jsx(Ze,{size:9}),s("heatmap.3d.hover_tip")]})})]}),b==="2d"&&e.jsx("div",{ref:T,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:e.jsxs("div",{style:{minWidth:_},children:[e.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:A,columnGap:te},children:[e.jsx("span",{}),ke.map(a=>e.jsx("span",{style:{gridColumnStart:a.index+2},className:"whitespace-nowrap",children:a.label},`${a.label}-${a.index}`))]}),e.jsxs("div",{className:"grid",style:{gridTemplateColumns:A,columnGap:te},children:[e.jsx("div",{className:"grid text-[10px] text-oai-gray-400 dark:text-oai-gray-400 sticky left-0 bg-white dark:bg-oai-gray-900 pr-2",style:{gridTemplateRows:`repeat(7, ${J}px)`,rowGap:te},children:ve.map(a=>e.jsx("span",{className:"leading-none",children:a},a))}),e.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${J}px)`,gap:te},children:y.map((a,u)=>(Array.isArray(a)?a:[]).map((z,v)=>{if(!z)return null;const X=z.day||`e-${u}-${v}`,H=Number(z.level)||0,le=L[H]||L[0];return e.jsx("span",{onMouseEnter:t=>fe(t,z),onMouseLeave:ge,className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10 cursor-pointer",style:{width:J,height:J,background:le}},X)}))})]})]})}),!c&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mt-3",children:[e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:s("heatmap.legend.less")}),e.jsx("div",{className:"flex gap-0.5",children:L.map((a,u)=>e.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:a}},u))}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:s("heatmap.legend.more")})]}),j&&e.jsx("div",{onAnimationEnd:ye,onClick:a=>{a.target===a.currentTarget&&ne()},className:`fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6 backdrop-blur-md bg-black/15 dark:bg-black/40 ${q?"animate-tt-fade-out":"animate-tt-fade-in"}`,children:e.jsxs("div",{className:`relative w-full max-w-6xl h-[88vh] backdrop-blur-2xl bg-white/90 dark:bg-oai-gray-900/90 border border-oai-gray-200/50 dark:border-white/10 shadow-2xl rounded-2xl flex flex-col md:flex-row overflow-hidden ${q?"animate-tt-modal-exit":"animate-tt-modal"}`,children:[e.jsx("button",{type:"button",onClick:ne,className:"absolute top-4 right-4 z-50 p-2 rounded-full border border-oai-gray-200/60 dark:border-oai-gray-800/60 bg-white/50 dark:bg-oai-gray-900/50 text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:rotate-90 hover:scale-105 active:scale-95 transition-all duration-300",children:e.jsx(He,{size:16})}),e.jsxs("div",{className:"w-full md:w-[340px] border-b md:border-b-0 md:border-r border-zinc-200/50 dark:border-zinc-800/40 p-5 md:p-6 flex flex-col gap-6 overflow-y-auto backdrop-blur-md bg-zinc-50/50 dark:bg-zinc-950/50",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[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 opacity-75",style:{backgroundColor:U.rawColor}}),e.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5",style:{backgroundColor:U.rawColor}})]}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:"3D Insight"})]}),e.jsx("h4",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight leading-none mt-2 select-none",children:s("heatmap.3d.modal.title")}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-400 dark:text-zinc-500 mt-2 font-normal select-none",children:s("heatmap.3d.modal.desc")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-5 gap-y-5 border-y border-zinc-200/50 dark:border-zinc-800/50 py-5 select-none",children:[e.jsxs("div",{className:"flex flex-col gap-1 relative group cursor-help",children:[e.jsx("div",{className:"absolute left-0 bottom-full mb-2 pointer-events-none opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-200 z-50",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-950 text-zinc-900 dark:text-zinc-50 text-[10px] font-semibold font-mono rounded-lg px-2.5 py-1.5 shadow-xl border border-zinc-200 dark:border-zinc-800/80 whitespace-nowrap flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-zinc-400 dark:text-zinc-500",children:s("heatmap.3d.modal.stats.precision_total_tokens")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[C.totalTokens.toLocaleString()," Tokens"]})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:s("heatmap.3d.modal.stats.total_tokens")}),e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:$e(C.totalTokens)}),e.jsx("div",{className:"opacity-30 group-hover:opacity-60 transition-opacity",children:e.jsx("svg",{width:"24",height:"10",viewBox:"0 0 24 10",fill:"none",children:e.jsx("path",{d:"M1 9C3 7 5 7 7 4C9 1 11 0 13 2C15 4 17 0 23 0",stroke:U.rawColor,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:s("heatmap.3d.modal.stats.estimated_cost")}),e.jsx("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:je})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:s("heatmap.3d.modal.stats.active_rate_days")}),e.jsxs("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[C.activeRate,"% ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",C.activeDays,"D)"]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:s("heatmap.3d.modal.stats.max_streak")}),e.jsxs("span",{className:"text-xl font-black text-amber-500 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[C.maxStreak," ",e.jsx("span",{className:"text-[10px] font-bold text-amber-500/80 font-mono",children:s("heatmap.3d.modal.stats.days_suffix")})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 col-span-2 relative group cursor-help",children:[e.jsx("div",{className:"absolute left-0 bottom-full mb-2 pointer-events-none opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-200 z-50",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-950 text-zinc-900 dark:text-zinc-50 text-[10px] font-semibold font-mono rounded-lg px-2.5 py-1.5 shadow-xl border border-zinc-200 dark:border-zinc-800/80 whitespace-nowrap flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-zinc-400 dark:text-zinc-500",children:s("heatmap.3d.modal.stats.precision_peak_value")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[C.maxSingleDay.value>0?C.maxSingleDay.value.toLocaleString():s("heatmap.3d.modal.stats.no_data")," Tokens"]}),e.jsx("span",{className:"text-[8px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:C.maxSingleDay.day!=="无数据"?C.maxSingleDay.day:s("heatmap.3d.modal.stats.no_data")})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:s("heatmap.3d.modal.stats.peak_day")}),e.jsxs("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[C.maxSingleDay.value>0?$e(C.maxSingleDay.value):s("heatmap.3d.modal.stats.no_data")," ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",C.maxSingleDay.day!=="无数据"?C.maxSingleDay.day:s("heatmap.3d.modal.stats.no_data"),")"]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2.5 py-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[e.jsx(nt,{size:11,style:{color:U.rawColor}}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono",style:{color:U.rawColor},children:s(C.aiEvaluationTitleKey)})]}),e.jsxs("div",{className:"pl-3.5 border-l-2 relative transition-all duration-300 group",style:{borderColor:U.rawColor},children:[e.jsx("div",{className:"absolute inset-y-0 left-0 w-[3px] blur-[2px] opacity-15 pointer-events-none rounded-full",style:{backgroundColor:U.rawColor}}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-400 font-normal",children:s(C.aiEvaluationKey)})]})]}),e.jsx("div",{className:"mt-auto border-t border-zinc-200/50 dark:border-zinc-800/50 pt-4 select-none",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:s("heatmap.3d.modal.legend.title")}),e.jsx("span",{className:"text-[10px] font-medium text-zinc-500 dark:text-zinc-400",children:s(`heatmap.3d.modal.palette.${Y}`)})]}),e.jsx("div",{className:"flex gap-1",children:be.map((a,u)=>e.jsx("div",{className:"flex-1 h-1 rounded-[2px]",style:{backgroundColor:a},title:`Level ${u}`},u))})]})})]}),e.jsxs("div",{className:"flex-1 h-full relative flex items-center justify-center overflow-hidden p-4",children:[e.jsx("div",{className:"absolute top-1/4 left-1/3 w-96 h-96 rounded-full blur-[130px] pointer-events-none -translate-x-1/2 -translate-y-1/2 transition-all duration-500",style:{backgroundColor:U.rawColor+"15"}}),e.jsx("div",{className:"absolute bottom-1/4 right-1/3 w-80 h-80 rounded-full blur-[120px] pointer-events-none translate-x-1/2 translate-y-1/2 bg-purple-500/[0.04] dark:bg-purple-500/[0.08]"}),e.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 flex items-center gap-3 p-1.5 backdrop-blur-md bg-white/70 dark:bg-oai-gray-900/75 border border-oai-gray-200/60 dark:border-oai-gray-800/80 rounded-full shadow-lg z-30 select-none",children:[e.jsx("div",{className:"flex items-center gap-1.5 px-2",children:Object.keys(ce).map(a=>{const u=Y===a;return e.jsx("button",{type:"button",onClick:()=>re(a),title:s(`heatmap.3d.modal.palette.${a}`),className:`w-3.5 h-3.5 rounded-full transition-all duration-200 relative hover:scale-125 ${a==="emerald"?"bg-[#10b981]":a==="ocean"?"bg-[#3b82f6]":a==="neon"?"bg-[#a855f7]":"bg-[#f59e0b]"}`,children:u&&e.jsx("span",{className:"absolute inset-0 rounded-full ring-2 ring-offset-1 ring-offset-white dark:ring-offset-oai-gray-900 ring-oai-gray-900 dark:ring-white scale-110"})},a)})}),e.jsx("div",{className:"w-[1px] h-4 bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsxs("div",{className:"flex items-center gap-1 pr-1",children:[e.jsx("button",{type:"button",onClick:()=>{const a=!W;ie(a),K.current&&K.current.toggleAutoRotate(a)},title:W?s("heatmap.3d.modal.control.pause"):s("heatmap.3d.modal.control.play"),className:`p-1.5 rounded-full transition-all duration-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 ${W?U.accentText:"text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250"}`,children:W?e.jsx(Qe,{size:12}):e.jsx(tt,{size:12})}),e.jsx("button",{type:"button",onClick:()=>{ie(!1),K.current&&K.current.reset()},title:s("heatmap.3d.modal.control.reset"),className:"p-1.5 rounded-full text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-all duration-200",children:e.jsx(rt,{size:12})})]})]}),e.jsx(Te,{weeks:y,isDark:E,interactive:!0,palette:Y,autoRotateInit:W,onResetViewRef:K}),e.jsxs("div",{className:"absolute bottom-4 right-4 flex items-center gap-1.5 text-[9px] font-bold text-oai-gray-400 bg-white/80 dark:bg-oai-gray-900/80 border border-oai-gray-200/50 dark:border-oai-gray-800/80 rounded-md px-2.5 py-1.5 select-none pointer-events-none backdrop-blur-md shadow-sm",children:[e.jsx(Ke,{size:10,className:U.accentText}),e.jsx("span",{children:s("heatmap.3d.modal.footer.tip")})]})]})]})}),N&&!j&&typeof document<"u"&&Ge.createPortal(e.jsxs("div",{className:"fixed z-[9999] w-0 h-0 transition-all duration-100 ease-out pointer-events-none",style:{position:"fixed",left:`${F.x}px`,top:`${F.y}px`},children:[e.jsxs("div",{className:`absolute left-0 ${F.flipY?"top-[10px]":"bottom-[10px]"} backdrop-blur-md bg-white/95 dark:bg-oai-gray-900/95 border border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-xl rounded-xl p-3.5 max-w-[280px] min-w-[200px] flex flex-col gap-2 animate-in fade-in zoom-in-95 duration-100`,style:{transform:`translateX(calc(-50% + ${F.shiftX}px))`},children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-oai-gray-100 dark:border-oai-gray-800/80 pb-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-oai-gray-500 dark:text-oai-gray-400",children:N.day}),(()=>{const a=N.level===0?E?"#9ca3af":"#6b7280":L[N.level];return e.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:a+"22",color:a,border:`1px solid ${a}44`},children:["Level ",N.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:Number(N.total_tokens??N.value).toLocaleString()}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),N.models&&Object.keys(N.models).length>0?e.jsxs("div",{className:"mt-1.5 border-t border-oai-gray-100 dark:border-oai-gray-800/60 pt-2 flex flex-col gap-1.5",children:[e.jsx("div",{className:"text-[10px] font-semibold text-oai-gray-400 dark:text-oai-gray-500 uppercase tracking-wider",children:"Model Breakdown"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-[150px] overflow-y-auto pr-1.5 oai-scrollbar",children:Object.entries(N.models).map(([a,u])=>({name:a,val:Number(u)})).sort((a,u)=>u.val-a.val).map(({name:a,val:u})=>{const z=Number(N.total_tokens??N.value)||1,v=Math.round(u/z*100);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] gap-3",children:[e.jsx("span",{className:"font-medium text-oai-gray-750 dark:text-oai-gray-200 truncate max-w-[120px]",title:a,children:a}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:u.toLocaleString()}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[v,"%"]})]})]}),e.jsx("div",{className:"w-full h-1 bg-oai-gray-100 dark:bg-oai-gray-800/85 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${v}%`,backgroundColor:L[4],boxShadow:`0 0 4px ${L[4]}55`}})})]},a)})})]}):e.jsx("p",{className:"text-[11px] text-oai-gray-600 dark:text-oai-gray-300 leading-relaxed font-normal mt-1 border-t border-dashed border-oai-gray-100 dark:border-oai-gray-800/60 pt-1.5",children:Se(N.level,N.total_tokens??N.value)})]})]}),e.jsx("div",{className:`absolute left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 shadow-sm ${F.flipY?"top-[6px] border-l border-t":"bottom-[6px] border-r border-b"} border-oai-gray-200/50 dark:border-oai-gray-800/50`,style:F.flipY?{marginTop:"1px"}:{marginBottom:"1px"}})]}),document.body),e.jsx("style",{children:`
2
- @keyframes tt-fade-in {
3
- from { opacity: 0; }
4
- to { opacity: 1; }
5
- }
6
- @keyframes tt-fade-out {
7
- from { opacity: 1; }
8
- to { opacity: 0; }
9
- }
10
- @keyframes tt-modal-entrance {
11
- from {
12
- opacity: 0;
13
- transform: scale(0.96) translateY(10px);
14
- }
15
- to {
16
- opacity: 1;
17
- transform: scale(1) translateY(0);
18
- }
19
- }
20
- @keyframes tt-modal-exit {
21
- from {
22
- opacity: 1;
23
- transform: scale(1) translateY(0);
24
- }
25
- to {
26
- opacity: 0;
27
- transform: scale(0.96) translateY(10px);
28
- }
29
- }
30
- .animate-tt-fade-in {
31
- animation: tt-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
32
- }
33
- .animate-tt-fade-out {
34
- animation: tt-fade-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
35
- }
36
- .animate-tt-modal {
37
- animation: tt-modal-entrance 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
38
- }
39
- .animate-tt-modal-exit {
40
- animation: tt-modal-exit 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
41
- }
42
- `})]})}const gt={anythingllm:"AnythingLLM"};function yt(o){return String(o||"").trim().toLowerCase().replace(/[\s_-]+/g,"")}function jt(o){const d=String(o||"").trim();if(!d)return"";const h=gt[yt(d)];return h||d.charAt(0).toUpperCase()+d.slice(1)}export{wt as A,Ze as M,nt as T,jt as f};
@@ -1 +0,0 @@
1
- import{r as s,aF as b,ca as f,b4 as g,b5 as r,b3 as S,c9 as v}from"./main-BVPlyJJu.js";function A(){const[u,i]=s.useState(null),t=b()&&f();s.useEffect(()=>{if(!t)return;const e=g(n=>i(n));return r(),e},[t]);const c=s.useCallback((e,n)=>{t&&(i(a=>a&&{...a,[e]:n}),S(e,n))},[t]),o=s.useCallback(e=>{t&&v(e)},[t]),l=s.useCallback(()=>{t&&r()},[t]);return{available:t,settings:u,setSetting:c,runAction:o,refresh:l}}export{A as u};