tokentracker-cli 0.77.2 → 0.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.de.md +21 -0
  2. package/README.md +21 -0
  3. package/dashboard/dist/assets/ActivityHeatmap-5352XxLR.js +42 -0
  4. package/dashboard/dist/assets/{Card-D_aKGDr7.js → Card-Ca_hYHhx.js} +1 -1
  5. package/dashboard/dist/assets/{ClawdAnimated-vRiBiNhb.js → ClawdAnimated-DSgOS5ND.js} +1 -1
  6. package/dashboard/dist/assets/{CommunityStatsModal-CjetJZ-5.js → CommunityStatsModal-o8uQVQxu.js} +1 -1
  7. package/dashboard/dist/assets/ConfirmModal-D1hi9XUf.js +1 -0
  8. package/dashboard/dist/assets/Controls-CwnKP56V.js +1 -0
  9. package/dashboard/dist/assets/DashboardPage-CDv0TIOL.js +19 -0
  10. package/dashboard/dist/assets/{DevicePage-YAo4ert4.js → DevicePage-BlfIHcZX.js} +1 -1
  11. package/dashboard/dist/assets/DialogClose-CismfYwe.js +1 -0
  12. package/dashboard/dist/assets/DialogDescription-DWKp1yez.js +1 -0
  13. package/dashboard/dist/assets/{DialogTitle-CA5znwms.js → DialogTitle-DuuTVbUb.js} +1 -1
  14. package/dashboard/dist/assets/{FadeIn--ff4ZbC-.js → FadeIn-DpnitRKo.js} +1 -1
  15. package/dashboard/dist/assets/{HeaderGithubStar-CTZvanhz.js → HeaderGithubStar-D6zy-ADl.js} +1 -1
  16. package/dashboard/dist/assets/{IpCheckPage-Bg47gNVu.js → IpCheckPage-yUNp0VNe.js} +1 -1
  17. package/dashboard/dist/assets/{LandingPage-DZ8Mz38n.js → LandingPage-BvmpAaVn.js} +1 -1
  18. package/dashboard/dist/assets/LeaderboardAvatar-2WTIeXye.js +1 -0
  19. package/dashboard/dist/assets/LeaderboardPage-Bq3-VO7w.js +2 -0
  20. package/dashboard/dist/assets/{LeaderboardProfileModal-CfVMENby.js → LeaderboardProfileModal-DH0EEK6q.js} +3 -3
  21. package/dashboard/dist/assets/{LeaderboardProfilePage-C4bGXJCE.js → LeaderboardProfilePage-uJAng2JE.js} +3 -3
  22. package/dashboard/dist/assets/{LimitsPage-BAQ10X55.js → LimitsPage-D8UohgJm.js} +2 -2
  23. package/dashboard/dist/assets/{LocalOnlyNotice-gtHCn7Mx.js → LocalOnlyNotice-Dv_BnDVV.js} +1 -1
  24. package/dashboard/dist/assets/{LoginPage-TXvIBzoW.js → LoginPage-D6b6DZU3.js} +1 -1
  25. package/dashboard/dist/assets/PetPage-DfpBkuCa.js +1 -0
  26. package/dashboard/dist/assets/{PopoverPopup-CQxxgUXk.js → PopoverPopup-CjzdZn-9.js} +1 -1
  27. package/dashboard/dist/assets/{ResetPasswordPage-tN0tmSfP.js → ResetPasswordPage-BnOCFkwe.js} +1 -1
  28. package/dashboard/dist/assets/Select-CHtQAiLD.js +1 -0
  29. package/dashboard/dist/assets/{SelectItemText-2LjzGvo5.js → SelectItemText-Vjqvf8wO.js} +1 -1
  30. package/dashboard/dist/assets/SettingsPage-B-iHGL4q.js +1 -0
  31. package/dashboard/dist/assets/SkillsPage-DtG2aV-q.js +1 -0
  32. package/dashboard/dist/assets/WidgetsPage-4kqTtWfK.js +1 -0
  33. package/dashboard/dist/assets/{WrappedPage-YxshTScX.js → WrappedPage-DMMRpani.js} +1 -1
  34. package/dashboard/dist/assets/agent-logos-D0vYkEpX.js +1 -0
  35. package/dashboard/dist/assets/{arrow-up-right-Bm3t-iA0.js → arrow-up-right-BAQYGZkR.js} +1 -1
  36. package/dashboard/dist/assets/check-C3RPBZiS.js +1 -0
  37. package/dashboard/dist/assets/{copy-DUNz-xWm.js → copy-gG_BLBs8.js} +1 -1
  38. package/dashboard/dist/assets/{download-COSLX73O.js → download-BQOcg3gT.js} +1 -1
  39. package/dashboard/dist/assets/{format-tokens-CR28AiQO.js → format-tokens-CGK6lQAf.js} +1 -1
  40. package/dashboard/dist/assets/{info-Cm7V_KDO.js → info-C_BrDrcq.js} +1 -1
  41. package/dashboard/dist/assets/{link-2-CYqDGrkv.js → link-2-DFwCBbIZ.js} +1 -1
  42. package/dashboard/dist/assets/{loader-circle-6XAdy2ec.js → loader-circle-BMFI_BJ8.js} +1 -1
  43. package/dashboard/dist/assets/main-Dy8Y_qst.css +1 -0
  44. package/dashboard/dist/assets/main-w0hAaCsy.js +1190 -0
  45. package/dashboard/dist/assets/{trash-2-DKLewOQb.js → trash-2-GeZ6IzgV.js} +1 -1
  46. package/dashboard/dist/assets/{use-community-stats-AdPaun74.js → use-community-stats-pC8cmVof.js} +1 -1
  47. package/dashboard/dist/assets/{use-limits-display-prefs-Bau4ykMw.js → use-limits-display-prefs-DnFpPcA3.js} +1 -1
  48. package/dashboard/dist/assets/use-native-settings-CvcOSUhn.js +1 -0
  49. package/dashboard/dist/assets/{use-ordered-list-BVaEJaWa.js → use-ordered-list-CbMroVZ8.js} +2 -2
  50. package/dashboard/dist/assets/{use-quality-per-dollar-pref-Htlc-uFe.js → use-quality-per-dollar-pref-Bn3Al6yX.js} +1 -1
  51. package/dashboard/dist/assets/{use-usage-limits-BnzWTJQS.js → use-usage-limits-D08q_Dr8.js} +1 -1
  52. package/dashboard/dist/assets/{useCurrency-bd6TLRsc.js → useCurrency-h3kqF52v.js} +1 -1
  53. package/dashboard/dist/assets/{useScrollLock-ajoWrfku.js → useScrollLock-9au2731u.js} +1 -1
  54. package/dashboard/dist/index.html +2 -2
  55. package/dashboard/dist/share.html +2 -2
  56. package/package.json +1 -1
  57. package/src/commands/status.js +119 -12
  58. package/src/commands/sync.js +158 -83
  59. package/src/lib/install-resolver.js +1 -0
  60. package/src/lib/local-api.js +202 -56
  61. package/src/lib/pricing/seed-snapshot.json +1 -1
  62. package/src/lib/rollout.js +18 -2
  63. package/dashboard/dist/assets/ActivityHeatmap-CH6m_ZJM.js +0 -42
  64. package/dashboard/dist/assets/ConfirmModal-C6bZw6FZ.js +0 -1
  65. package/dashboard/dist/assets/Controls-Cj22oGL3.js +0 -1
  66. package/dashboard/dist/assets/DashboardPage-DPxiQkQw.js +0 -19
  67. package/dashboard/dist/assets/DialogClose-hhTDeRp1.js +0 -1
  68. package/dashboard/dist/assets/DialogDescription-gxEpcUbJ.js +0 -1
  69. package/dashboard/dist/assets/LeaderboardAvatar-3T57GKKK.js +0 -1
  70. package/dashboard/dist/assets/LeaderboardPage-wP_yCU9I.js +0 -2
  71. package/dashboard/dist/assets/PetPage-Dj1jrxYe.js +0 -1
  72. package/dashboard/dist/assets/Select-DnbHYPS4.js +0 -1
  73. package/dashboard/dist/assets/SettingsPage-DosKS_L6.js +0 -1
  74. package/dashboard/dist/assets/SkillsPage-DaCJ25vT.js +0 -1
  75. package/dashboard/dist/assets/WidgetsPage-CCGemQVD.js +0 -1
  76. package/dashboard/dist/assets/agent-logos-SeuxwQsp.js +0 -1
  77. package/dashboard/dist/assets/check-D8Owfjyw.js +0 -1
  78. package/dashboard/dist/assets/main-BCstrDYE.js +0 -1172
  79. package/dashboard/dist/assets/main-BYdJ5vWR.css +0 -1
  80. package/dashboard/dist/assets/use-native-settings-CidwlprT.js +0 -1
@@ -0,0 +1 @@
1
+ import{R as l,j as c,W as h}from"./main-w0hAaCsy.js";function x(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function d(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=x(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:d(t)})}export{g as L};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-DH0EEK6q.js","assets/main-w0hAaCsy.js","assets/main-Dy8Y_qst.css","assets/useCurrency-h3kqF52v.js","assets/LeaderboardAvatar-2WTIeXye.js","assets/ActivityHeatmap-5352XxLR.js","assets/info-C_BrDrcq.js","assets/arrow-up-right-BAQYGZkR.js","assets/link-2-DFwCBbIZ.js","assets/check-C3RPBZiS.js","assets/DialogTitle-DuuTVbUb.js","assets/useScrollLock-9au2731u.js","assets/CommunityStatsModal-o8uQVQxu.js","assets/format-tokens-CGK6lQAf.js","assets/DialogClose-CismfYwe.js","assets/DialogDescription-DWKp1yez.js"])))=>i.map(i=>d[i]);
2
+ import{c as la,j as e,W as d,r as i,N as n,aw as da,ax as ca,a3 as ua,a4 as ma,ay as xa,l as ga,n as ba,az as pa,aA as ha,aB as re,ac as ya,aC as fa,h as ka,Z as wa,L as va,Q as ja,Y as Ie,O as Na,aD as _a,aE as Sa,aF as Le,aG as Ca,aa as Be,S as La}from"./main-w0hAaCsy.js";import{S as Pa}from"./Select-CHtQAiLD.js";import{a as Ma,C as Ea,u as Aa,b as Ka,c as Pe,D as Ta,d as Ra,S as za,h as Ia,s as Ba,K as Ua,P as Oa}from"./use-ordered-list-CbMroVZ8.js";import{u as Da}from"./useCurrency-h3kqF52v.js";import{L as te}from"./LeaderboardAvatar-2WTIeXye.js";import{u as $a}from"./use-community-stats-pC8cmVof.js";import"./SelectItemText-Vjqvf8wO.js";import"./useScrollLock-9au2731u.js";import"./check-C3RPBZiS.js";const Fa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ga=la("arrow-right",Fa),Ya=a=>{let{transform:r}=a;return{...r,y:0}};function $(a,{min:r,max:o,fallback:s}){const c=Number(a);if(!Number.isFinite(c))return s;const l=Math.floor(c);return l<r?r:l>o?o:l}function Ha(a,r){const o=$(r,{min:0,max:1e6,fallback:0}),s=$(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const c=new Set([1,o,s-2,s-1,s,s+1,s+2]),l=Array.from(c).filter(m=>Number.isInteger(m)&&m>=1&&m<=o).sort((m,h)=>m-h),b=[];let p=null;for(const m of l)p!=null&&m-p>1&&b.push(null),b.push(m),p=m;return b}function Wa({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,s=o?$(r,{min:0,max:1e6,fallback:0}):null,c=$(a,{min:1,max:o?Math.max(1,s||1):1e6,fallback:1}),l=c>1,b=o?c<s:!0;return{canPrev:l,canNext:b,safePage:c,safeTotal:s}}function Va({entries:a,me:r,meLabel:o}){const s=Array.isArray(a)?a:[],c=r&&typeof r.rank=="number"?r.rank:null;return!c||s.some(b=>!!b?.is_me)?s:[{rank:c,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},...s]}function Za(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 Ja=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function qa({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 ${Ja.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const V=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Ue="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",Oe="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function oe(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function ne(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function j({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function Qa({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(oe(!1),"!group-hover:bg-transparent"),children:e.jsx(j,{className:"h-4 w-6"})}),e.jsx("td",{className:d(ne(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(j,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(j,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:"h-4 w-12"})}),V.map(c=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",s)})},c.key))]})}function Xa({rows:a=10}){return e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ue,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(Oe,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-14"})}),V.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{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(Qa,{index:o},o))})]})})}function er({id:a,thClassName:r,children:o}){const{attributes:s,listeners:c,setNodeRef:l,transform:b,transition:p,isDragging:m}=Ma({id:a}),h=Ea.Transform.toString(b)||"";i.useLayoutEffect(()=>{const y=document.querySelectorAll(`td[data-column-key="${a}"]`),f="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return y.forEach(x=>{x.style.transform=h,x.style.transition=p||"",x.style.zIndex=m?"20":"",x.style.position=h?"relative":"",x.style.boxShadow=m?f:""}),()=>{y.forEach(x=>{x.style.transform="",x.style.transition="",x.style.zIndex="",x.style.position="",x.style.boxShadow=""})}},[a,h,p,m]);const L={transform:h,transition:p,position:h?"relative":void 0,zIndex:m?20:void 0,boxShadow:m?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:l,style:L,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...s,...c,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",m&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const ar="tokentracker.leaderboard.columnOrder.v1";function rr(a){return Aa(ar,a)}const tr=50;function or(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 De(a){return typeof a=="string"?a.trim():""}function nr(a){const r=De(a);return r?r.toLowerCase()==="anonymous":!0}function sr({me:a,totalEntries:r,meLabel:o,onOpenProfile:s,onJumpToMe:c,canJump:l,className:b}){const p=a&&typeof a.rank=="number"?a.rank:null;if(!p)return null;const m=Number(r)||0,h=or(p,m),L=De(a?.display_name),y=!L||nr(L)?o||"You":L,f=a?.user_id||y,x=s||(l?c:null),E=typeof x=="function",A=E?"button":"div",Z=E?{type:"button",onClick:x,"aria-label":n(s?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(A,{...Z,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",E?"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]",b),children:[e.jsx(te,{size:"sm",avatarUrl:a?.avatar_url,displayName:y,seed:f}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:y}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",p.toLocaleString()]}),h!=null&&h<=tr&&e.jsx("span",{className:d("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",h<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:n("leaderboard.summary.percentile",{p:String(h)})}),E?e.jsx(Ga,{"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 ir=i.lazy(()=>Be(()=>import("./LeaderboardProfileModal-DH0EEK6q.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(a=>({default:a.LeaderboardProfileModal}))),lr=i.lazy(()=>Be(()=>import("./CommunityStatsModal-o8uQVQxu.js"),__vite__mapDeps([12,1,2,13,10,11,14,15])).then(a=>({default:a.CommunityStatsModal}))),se=[10,20,50,100],ie=20,$e="tokentracker:leaderboard:pageSize";function dr(){if(typeof window>"u")return ie;try{const a=window.localStorage.getItem($e),r=Number(a);if(se.includes(r))return r}catch{}return ie}function Me(a,r,o){const s=Number(a);if(!Number.isFinite(s)||s<=0)return"-";const c=Na(r),l=r===La?s:s*o;return l>=1e3?`${c}${Math.round(l).toLocaleString()}`:l>=10?`${c}${Math.round(l)}`:`${c}${l.toFixed(2)}`}function Ee({value:a}){return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:ja(a)}),e.jsx("span",{className:"hidden sm:inline",children:Ie(a)})]})}function cr({communityStats:a,onClick:r}){return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex h-9 items-center gap-2.5 rounded-full border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md px-3.5 select-none text-xs text-oai-gray-500 dark:text-oai-gray-400 hover:border-oai-brand-400 dark:hover:border-oai-brand-500/80 hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 transition-all duration-300 active:scale-[0.97] cursor-pointer",title: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.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:Math.round(a.tokenFloor).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children: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.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:(Number(a.totalEntries)||0).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.community.devs_chip")})]})]})}function Ae(a,r,o){const s=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",c=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,c),children:Ie(a?.[l.key])},l.key))}const ur={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 Ke({rank:a,placeholder:r}){const o=ur[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 Te(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function mr(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 Fe(a){return typeof a!="string"?"":a.trim()}function xr(a){const r=Fe(a);return r?r.toLowerCase()==="anonymous":!0}function Re(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function ze({githubUrl:a}){return e.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":n("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:e.jsx(wa,{provider:"GITHUB",size:16})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute right-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(va,{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 _r({auth:a,signedIn:r,sessionSoftExpired:o}){const s=da(),c=ca(),{openLoginModal:l}=ua(),{signedIn:b,loading:p,user:m}=ma(),{currency:h,rate:L}=Da(),y=i.useMemo(()=>xa(),[]),f=ga(),x=r&&!o,E=i.useMemo(()=>x&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,x]),A=x?E:null,Z=x&&ba(A),le=n("shared.placeholder.short"),Ge=i.useMemo(()=>V.map(t=>t.key),[]),{order:J,reorder:de}=rr(Ge),ce=i.useMemo(()=>{const t=new Map;for(const u of V)t.set(u.key,u);return t},[]),F=i.useMemo(()=>J.map(t=>ce.get(t)).filter(Boolean),[J,ce]),Ye=Ka(Pe(Oa,{activationConstraint:{distance:6}}),Pe(Ua,{coordinateGetter:Ba})),He=i.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||de(String(u.id),String(w.id))},[de]),[q,P]=i.useState(1),[N,We]=i.useState(dr),[ue,me]=i.useState(null),[Ve,xe]=i.useState(!1),Q=i.useCallback(t=>{typeof t=="string"&&t.trim()&&me(t.trim())},[]),Ze=i.useCallback(()=>me(null),[]),Je=i.useCallback(t=>{const u=se.includes(t)?t:ie;We(u),P(1);try{window.localStorage.setItem($e,String(u))}catch{}},[]),[ge,qe]=i.useState(0),[Qe,Xe]=i.useState(()=>pa()),[be,pe]=i.useState(!1),v=i.useMemo(()=>{const t=new URLSearchParams(s?.search||"");return Te(t.get("period"))||"total"},[s?.search]),ea=t=>{const u=Te(t);if(!u||u===v)return;const w=new URLSearchParams(s?.search||"");w.set("period",u),P(1),c(`${s?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};i.useEffect(()=>{p||f||b||l()},[b,p,f,l]),i.useEffect(()=>{P(1)},[v]);const G=i.useMemo(()=>($(q,{min:1,max:1e6,fallback:1})-1)*N,[q,N]),K=i.useMemo(()=>f?"mock":p?"unavailable":b?"cloud":r?"local":y?"public":"unavailable",[p,b,y,f,r]),g=i.useMemo(()=>ha({accessMode:K,baseUrl:y,mockEnabled:f,userId:m?.id||null,period:v,pageSize:N,offset:G}),[m?.id,K,y,G,f,N,v]),[I,B]=i.useState(()=>{const t=re(g);return t?{loading:!1,error:null,data:t.data,contextKey:g}:{loading:!1,error:null,data:null,contextKey:null}});i.useEffect(()=>{if(!y&&!f||!f&&K==="unavailable"){B({loading:!1,error:null,data:null,contextKey:null});return}const t=re(g);let u=!0;return B(t?{loading:!1,error:null,data:t.data,contextKey:g}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await ya({userId:m?.id||null,period:v,limit:N,offset:G});u&&(fa(w,{activeContextKey:g,contextKey:g,source:ge>0?"manual-refresh":"page-load"}),B({loading:!1,error:null,data:w,contextKey:g}))})().catch(w=>{if(!u)return;const z=mr(w);B(O=>O.contextKey===g?{...O,loading:!1,error:z}:{loading:!1,error:z,data:null,contextKey:g})}),()=>{u=!1}},[y,K,m?.id,g,G,ge,f,v,N]);const X=i.useMemo(()=>I.contextKey===g?null:re(g),[g,I.contextKey]),k=i.useMemo(()=>I.contextKey===g?I:X?{loading:!1,error:null,data:X.data,contextKey:g}:{loading:!!(y||f)&&K!=="unavailable",error:null,data:null,contextKey:g},[K,y,g,I,f,X]),_=k.data,Y=_?.total_pages??null,aa=_?.total_entries??0,T=_?.page??q,ra=i.useMemo(()=>Ha(T,Y),[T,Y]),he=_?.from||null,ye=_?.to||null,fe=_?.generated_at||null,ke=$a(),M=_?.me||null,H=n("leaderboard.me_label"),ta=n("leaderboard.anon_label"),we=n("leaderboard.period.week"),ve=n("leaderboard.period.month"),je=n("leaderboard.period.total"),Ne=v==="month"?ve:v==="total"?je:we,ee=i.useMemo(()=>{const t=Array.isArray(_?.entries)?_.entries:[];return Va({entries:t,me:M,meLabel:H})},[_?.entries,M,H]),R=i.useMemo(()=>Za(M?.rank,N),[M?.rank,N]),oa=R!=null&&R===T,na=i.useCallback(()=>{R!=null&&P(R)},[R]),sa=async()=>{pe(!0);try{_a(!0),Xe(!0),await Sa(()=>Le(A));const t=await Le(A);t&&await Ca({accessToken:t,period:v,source:"leaderboard-enable-sync"}),qe(u=>u+1)}catch(t){console.warn("[tokentracker] sync:",t)}finally{pe(!1)}},{canPrev:_e,canNext:Se}=Wa({page:T,totalPages:Y}),W=Array.isArray(ee)&&ee.length!==0;let U=null;k.loading&&!W?U=e.jsx(Xa,{rows:N}):k.error&&!W?U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:k.error})}):W?U=e.jsx(Ta,{sensors:Ye,collisionDetection:Ra,modifiers:[Ya],onDragEnd:He,children:e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-full sm:min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ue,"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(Oe,"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(za,{items:J,strategy:Ia,children:F.map(t=>e.jsx(er,{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(qa,{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:ee.map((t,u)=>{if(t?.is_ellipsis){const C=4+F.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:C,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${u}`)}const w=!!t?.is_me,z=typeof t?.user_id=="string"?t.user_id:null,O=Fe(t?.display_name),ia=xr(O)?ta:O,S=w?H:ia,D=!!z,Ce=D?{role:"button",tabIndex:0,onClick:D?()=>Q(z):void 0,onKeyDown:D?C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),Q(z))}:void 0,"aria-label":n("leaderboard.profile_modal.row_aria",{name:S})}:{};if(w){const C=!!t?.is_pinned;return e.jsxs("tr",{...Ce,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",C?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",D&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(oe(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",C&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx(Ke,{rank:t?.rank,placeholder:le})}),e.jsx("td",{className:ne(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(te,{avatarUrl:t?.avatar_url,displayName:S,seed:Re(t,S)}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:S}),t?.github_url&&e.jsx(ze,{githubUrl:t.github_url})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(Ee,{value: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,h,L)}),Ae(t,!0,F)]},`row-${t?.rank}-${S}${C?"-pin":""}`)}return e.jsxs("tr",{...Ce,className:d("group transition-colors",D&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(oe(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(Ke,{rank:t?.rank,placeholder:le})}),e.jsx("td",{className:ne(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(te,{avatarUrl:t?.avatar_url,displayName:S,seed:Re(t,S)}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:S}),t?.github_url&&e.jsx(ze,{githubUrl:t.github_url})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(Ee,{value: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,h,L)}),Ae(t,!1,F)]},`row-${t?.rank}-${S}`)})})]})})}):U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.empty")})});let ae=null;return typeof Y=="number"?ae=ra.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===T?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>P(t),disabled:k.loading,children:String(t)},`page-${t}`)):ae=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.pagination.page_unknown",{page:String(T)})}),e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-5 sm:mb-6",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-2 sm:mb-3",children:n("leaderboard.title")}),e.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[v==="total"?n("leaderboard.range.total"):he&&ye?n("leaderboard.range",{period:Ne,from:he,to:ye}):n("leaderboard.range_loading",{period:Ne}),fe&&e.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 hidden sm:inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:n("leaderboard.generated_at",{ts:fe})})]})]}),e.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsx("div",{className:"inline-flex h-9 p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-full items-center relative self-start",children:["week","month","total"].map(t=>{const u=v===t;return e.jsxs("button",{onClick:()=>ea(t),disabled:k.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:t==="week"?we:t==="month"?ve:je}),u&&e.jsx(ka.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},t)})}),e.jsxs("div",{className:"flex flex-row items-center gap-2.5 self-end sm:self-auto shrink-0 flex-wrap",children:[e.jsx(cr,{communityStats:ke,onClick:()=>xe(!0)}),e.jsx(sr,{me:M,totalEntries:aa,meLabel:H,onOpenProfile:M?.user_id?()=>Q(M.user_id):void 0,onJumpToMe:na,canJump:R!=null&&!oa&&!k.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&&Z&&!Qe&&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:sa,disabled:be,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:be?n("leaderboard.sync_button.busy"):n("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[k.error&&W?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:k.error})}):null,U,e.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:n("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:N,onValueChange:t=>Je(Number(t)),disabled:k.loading,ariaLabel:n("leaderboard.pagination.page_size_label"),options:se.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:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",_e&&!k.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>P(t=>Math.max(1,t-1)),disabled:!_e||k.loading,children:n("leaderboard.pagination.prev")}),e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:ae}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Se&&!k.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>P(t=>t+1),disabled:!Se||k.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(i.Suspense,{fallback:null,children:[e.jsx(ir,{isOpen:!!ue,userId:ue,period:v,accessToken:A,onClose:Ze}),e.jsx(lr,{isOpen:Ve,onClose:()=>xe(!1),communityStats:ke})]})]})}export{_r as LeaderboardPage};
@@ -1,4 +1,4 @@
1
- import{c as E,a2 as X,r as g,da as te,j as e,N as i,db as se,aE as oe,dc as ie,a0 as d,dd as ne,aI as le,L as de,s as ce,$ as D,X as xe,Q as G,P as me,an as ge}from"./main-BCstrDYE.js";import{u as pe}from"./useCurrency-bd6TLRsc.js";import{L as Y}from"./LeaderboardAvatar-3T57GKKK.js";import{A as he}from"./ActivityHeatmap-CH6m_ZJM.js";import{A as U}from"./arrow-up-right-Bm3t-iA0.js";import{L as fe}from"./link-2-CYqDGrkv.js";import{C as ue}from"./check-D8Owfjyw.js";import{D as be,a as ye,b as ke,c as je,d as ve,e as Ne}from"./DialogTitle-CA5znwms.js";import"./info-Cm7V_KDO.js";import"./useScrollLock-ajoWrfku.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"}]],we=E("code-xml",_e);const Ae=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Se=E("heart",Ae),T="tokentracker_anon_id";let v=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(v)return v;try{let a=localStorage.getItem(T);return a||(a=F(),localStorage.setItem(T,a)),v=a,a}catch{return v=F(),v}}function q({userId:a}){const{signedIn:r,getAccessToken:s}=X(),[t,o]=g.useState(!1),[c,x]=g.useState(0),[l,h]=g.useState(!1),[b,N]=g.useState(!1),[_,L]=g.useState(!1),[w,y]=g.useState([]),[A,k]=g.useState(!1),S=g.useRef(0),u=g.useCallback(async()=>{if(r)try{const n=await s();if(n)return{accessToken:n,anonId:H()}}catch{}return{anonId:H()}},[r,s]);g.useEffect(()=>{let n=!1;return a?(h(!1),(async()=>{const m=await u();try{const p=await te({userId:a,...m});if(n)return;x(Number(p?.count)||0),o(!!p?.liked),h(!0)}catch{if(n)return;x(0),o(!1),h(!0)}})(),()=>{n=!0}):(h(!1),()=>{n=!0})},[a,u]);const j=()=>{L(!0),setTimeout(()=>L(!1),450),k(!0),setTimeout(()=>k(!1),500);const n=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let f=0;f<12;f++){const z=(f*30+Math.random()*20-10)*(Math.PI/180),C=45+Math.random()*45,K=Math.cos(z)*C,Q=Math.sin(z)*C-(10+Math.random()*15),V=Math.random()*360-180,J=6+Math.random()*8,ee=n[Math.floor(Math.random()*n.length)],ae=m[Math.floor(Math.random()*m.length)],re=++S.current;p.push({id:re,tx:K,ty:Q,rot:V,size:J,color:ee,shape:ae})}y(f=>[...f,...p]),setTimeout(()=>{y(f=>f.filter(z=>!p.find(C=>C.id===z.id)))},850)},M=async n=>{N(!0);try{const m=await u(),p=await se({userId:a,action:n,...m});p&&Number.isFinite(Number(p.count))&&x(Number(p.count)),p&&typeof p.liked=="boolean"&&o(p.liked)}catch{o(m=>!m),x(m=>n==="like"?Math.max(0,m-1):m+1)}finally{N(!1)}},Z=n=>{n.stopPropagation(),!(!a||!l||b)&&(t?(o(!1),x(m=>Math.max(0,m-1)),M("unlike")):(o(!0),x(m=>m+1),j(),M("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
1
+ import{c as E,a4 as X,r as g,db as te,j as e,N as i,dc as se,aF as oe,dd as ie,W as d,de as ne,aJ as le,L as de,s as ce,Z as D,X as xe,Q as G,P as me,ao as ge}from"./main-w0hAaCsy.js";import{u as pe}from"./useCurrency-h3kqF52v.js";import{L as Y}from"./LeaderboardAvatar-2WTIeXye.js";import{A as he}from"./ActivityHeatmap-5352XxLR.js";import{A as U}from"./arrow-up-right-BAQYGZkR.js";import{L as fe}from"./link-2-DFwCBbIZ.js";import{C as ue}from"./check-C3RPBZiS.js";import{D as be,a as ye,b as ke,c as je,d as ve,e as Ne}from"./DialogTitle-DuuTVbUb.js";import"./info-C_BrDrcq.js";import"./useScrollLock-9au2731u.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"}]],we=E("code-xml",_e);const Ae=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Se=E("heart",Ae),T="tokentracker_anon_id";let v=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(v)return v;try{let a=localStorage.getItem(T);return a||(a=F(),localStorage.setItem(T,a)),v=a,a}catch{return v=F(),v}}function Z({userId:a}){const{signedIn:r,getAccessToken:s}=X(),[t,o]=g.useState(!1),[c,x]=g.useState(0),[l,h]=g.useState(!1),[b,N]=g.useState(!1),[_,P]=g.useState(!1),[w,y]=g.useState([]),[A,k]=g.useState(!1),S=g.useRef(0),u=g.useCallback(async()=>{if(r)try{const n=await s();if(n)return{accessToken:n,anonId:H()}}catch{}return{anonId:H()}},[r,s]);g.useEffect(()=>{let n=!1;return a?(h(!1),(async()=>{const m=await u();try{const p=await te({userId:a,...m});if(n)return;x(Number(p?.count)||0),o(!!p?.liked),h(!0)}catch{if(n)return;x(0),o(!1),h(!0)}})(),()=>{n=!0}):(h(!1),()=>{n=!0})},[a,u]);const j=()=>{P(!0),setTimeout(()=>P(!1),450),k(!0),setTimeout(()=>k(!1),500);const n=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let f=0;f<12;f++){const z=(f*30+Math.random()*20-10)*(Math.PI/180),C=45+Math.random()*45,J=Math.cos(z)*C,K=Math.sin(z)*C-(10+Math.random()*15),Q=Math.random()*360-180,V=6+Math.random()*8,ee=n[Math.floor(Math.random()*n.length)],ae=m[Math.floor(Math.random()*m.length)],re=++S.current;p.push({id:re,tx:J,ty:K,rot:Q,size:V,color:ee,shape:ae})}y(f=>[...f,...p]),setTimeout(()=>{y(f=>f.filter(z=>!p.find(C=>C.id===z.id)))},850)},M=async n=>{N(!0);try{const m=await u(),p=await se({userId:a,action:n,...m});p&&Number.isFinite(Number(p.count))&&x(Number(p.count)),p&&typeof p.liked=="boolean"&&o(p.liked)}catch{o(m=>!m),x(m=>n==="like"?Math.max(0,m-1):m+1)}finally{N(!1)}},O=n=>{n.stopPropagation(),!(!a||!l||b)&&(t?(o(!1),x(m=>Math.max(0,m-1)),M("unlike")):(o(!0),x(m=>m+1),j(),M("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
2
2
  @keyframes tt-like-pop {
3
3
  0% { transform: scale(1); }
4
4
  25% { transform: scale(0.75); }
@@ -38,7 +38,7 @@ import{c as E,a2 as X,r as g,da as te,j as e,N as i,db as se,aE as oe,dc as ie,a
38
38
  .tt-num-anim {
39
39
  animation: tt-num-scroll 0.25s ease-out forwards;
40
40
  }
41
- `}}),w.map(n=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${n.tx}px`,"--ty":`${n.ty}px`,"--rot":`${n.rot}deg`,width:`${n.size}px`,height:`${n.size}px`,backgroundColor:n.shape==="circle"?n.color:"transparent",borderRadius:n.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:n.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:n.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"})})},n.id)),e.jsxs("button",{type:"button",onClick:Z,disabled:!l||b,"aria-label":t?i("leaderboard.profile.like.aria_unlike"):i("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:_?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(Se,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${A?"tt-num-anim":""}`,children:l?c:"·"})]})]})}function Me(a,r,s){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:me(t,{decimals:2,currency:r,rate:s})}function R(a,r,s){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Me(t,r,s);const o=r==="USD"?t:t*(s||1);return`${r==="USD"?"$":""}${G(o,{decimals:1})}`}function $(a){const r=Number(a);return!Number.isFinite(r)||r<=0?"0":G(r,{decimals:1})}function ze(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const s=r.map(o=>({day:o.date,total_tokens:o.total_tokens,models:o.models||null})),t=r[r.length-1]?.date;return ce({dailyRows:s,weeks:52,to:t})}const Ce=`
41
+ `}}),w.map(n=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${n.tx}px`,"--ty":`${n.ty}px`,"--rot":`${n.rot}deg`,width:`${n.size}px`,height:`${n.size}px`,backgroundColor:n.shape==="circle"?n.color:"transparent",borderRadius:n.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:n.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:n.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"})})},n.id)),e.jsxs("button",{type:"button",onClick:O,disabled:!l||b,"aria-label":t?i("leaderboard.profile.like.aria_unlike"):i("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:_?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(Se,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${A?"tt-num-anim":""}`,children:l?c:"·"})]})]})}function Me(a,r,s){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:me(t,{decimals:2,currency:r,rate:s})}function R(a,r,s){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Me(t,r,s);const o=r==="USD"?t:t*(s||1);return`${r==="USD"?"$":""}${G(o,{decimals:1})}`}function $(a){const r=Number(a);return!Number.isFinite(r)||r<=0?"0":G(r,{decimals:1})}function ze(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const s=r.map(o=>({day:o.date,total_tokens:o.total_tokens,models:o.models||null})),t=r[r.length-1]?.date;return ce({dailyRows:s,weeks:52,to:t})}const Ce=`
42
42
  @keyframes tt-shimmer {
43
43
  100% { transform: translateX(100%); }
44
44
  }
@@ -69,4 +69,4 @@ import{c as E,a2 as X,r as g,da as te,j as e,N as i,db as se,aE as oe,dc as ie,a
69
69
  rgba(255, 255, 255, 0) 100%
70
70
  );
71
71
  }
72
- `;function Ie({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:Ce}}),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:d(r,"h-7 w-48")}),e.jsx("div",{className:d(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:d(r,"h-2.5 w-8")}),e.jsx("div",{className:d(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:d(r,"h-4 w-40")}),e.jsx("div",{className:d(r,"h-3 w-56")})]}),e.jsx("div",{className:d(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:d("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,o)=>e.jsxs("div",{children:[e.jsx("div",{className:d(r,"h-6 w-20")}),e.jsx("div",{className:d(r,"mt-2 h-3 w-14")})]},o))}),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,o)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:d(r,"h-3 w-24")}),e.jsx("div",{className:d(r,"h-3 w-44")})]},o))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:d(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,o)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},o))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:d(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((t,o)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:d(r,"h-4 w-4")}),e.jsx("div",{className:d(r,"h-3 w-16")}),e.jsx("div",{className:d(r,"h-[3px] flex-1")}),e.jsx("div",{className:d(r,"h-3 w-12")})]},o))})]})]})]})}function O(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 B({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 I({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 P({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 Le({user:a,onClose:r}){const s=O(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:d("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:i("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(D,{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(q,{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":i("leaderboard.profile_modal.close"),children:e.jsx(xe,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function Pe({user:a}){const r=O(a?.github_url),s=Number(a?.rank)||0,t=s===1?"text-amber-500 dark:text-amber-400":s===2?"text-slate-500 dark:text-slate-300":s===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(Y,{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"}),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(q,{userId:a.user_id})]}),r?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(D,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",r]})]}):null]}),s?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:i("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:d("mt-1.5 text-3xl font-black tabular-nums tracking-tight",t),children:i("leaderboard.profile_modal.rank",{rank:s})})]}):null]})]})}function $e({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:i("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(D,{provider:String(s.source).toUpperCase(),size:14})}),e.jsx("span",{className:"shrink-0 capitalize w-16 text-oai-gray-700 dark:text-oai-gray-300",children:s.source}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(t*100).toFixed(1)}%`}})}),e.jsx("span",{className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:$(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,o]=g.useState(!1),c=async()=>{await ge(s)&&(o(!0),setTimeout(()=>o(!1),1600))};return e.jsxs("button",{type:"button",onClick:c,className:d("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(ue,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t?i("leaderboard.profile_modal.badge.copied"):r})]})}function De({data:a,currency:r,rate:s,onClose:t,variant:o="modal"}){const{user:c,totals:x,streak:l,best_day:h,models:b,by_provider:N,heatmap:_,period:L}=a,w=o==="page",y=g.useMemo(()=>ze(_),[_]),A=b?.favorite?.model_name,k=Number(b?.count)||0,S=X(),u=!!(S?.user?.id&&c?.user_id&&S.user.id===c.user_id),j=c?.user_id?`https://www.tokentracker.cc/u/${c.user_id}`:null,M=c?.user_id?`[![My AI coding usage](${ne()}/functions/tokentracker-embed-svg?user_id=${c.user_id}&theme=dark)](${j}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[w?e.jsx(Pe,{user:c}):e.jsx(Le,{user:c,onClose:t}),e.jsxs("div",{className:d("space-y-6",w?"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(I,{value:$(x?.total_tokens),label:i("leaderboard.profile_modal.stat.total_tokens")}),e.jsx(I,{value:R(x?.estimated_cost_usd,r,s),label:i("leaderboard.profile_modal.stat.total_cost")}),e.jsx(I,{value:String(x?.active_days??0),label:i("leaderboard.profile_modal.stat.active_days")}),e.jsx(I,{value:R(x?.avg_per_day_usd,r,s),label:i("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(P,{label:i("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:i("leaderboard.profile_modal.streak.days",{count:l?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",l?.longest_days??0,")"]})]}),e.jsx(P,{label:i("leaderboard.profile_modal.best_day.title"),children:h?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:$(h.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",h.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:i("leaderboard.profile_modal.best_day.none")})}),e.jsx(P,{label:i("leaderboard.profile_modal.models.favorite"),children:A?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:A}),k>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:i("leaderboard.profile_modal.models.count",{count:k})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:i("leaderboard.profile_modal.models.none")})})]}),y&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(B,{children:i("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(he,{heatmap:y,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(B,{children:i("leaderboard.profile_modal.providers.title")}),e.jsx($e,{data:N})]}),c?.user_id&&(t||u)&&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&&(le()?e.jsxs("a",{href:j,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:i("leaderboard.profile_modal.view_full")}),e.jsx(U,{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(de,{to:`/u/${c.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:i("leaderboard.profile_modal.view_full")}),e.jsx(U,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),u&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{icon:fe,label:i("leaderboard.profile_modal.badge.copy_url"),value:j}),e.jsx(W,{icon:we,label:i("leaderboard.profile_modal.badge.copy"),value:M})]})]})]})]})}function Ue({userId:a,period:r,accessToken:s,enabled:t=!0}){const[o,c]=g.useState({loading:!1,error:null,data:null});return g.useEffect(()=>{if(!t||!a)return;let x=!0;return c({loading:!0,error:null,data:null}),(async()=>{try{const l=s?await oe(s):null;if(!x)return;const h=await ie({accessToken:l,userId:a,period:r||"week"});if(!x)return;c({loading:!1,error:null,data:h})}catch(l){if(!x)return;l?.status===404?c({loading:!1,error:null,data:null}):c({loading:!1,error:l?.message||String(l),data:null})}})(),()=>{x=!1}},[t,a,r,s]),o}function qe({isOpen:a,onClose:r,userId:s,period:t,accessToken:o}){const{currency:c,rate:x}=pe(),l=Ue({userId:s,period:t,accessToken:o,enabled:a});return e.jsx(be,{open:a,onOpenChange:h=>{h||r?.()},children:e.jsxs(ye,{children:[e.jsx(ke,{className:"cost-modal-backdrop"}),e.jsx(je,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(ve,{className:d("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(Ne,{render:e.jsx("h2",{className:"sr-only"}),children:l.data?.user?.display_name||i("leaderboard.profile_modal.loading")}),l.loading&&e.jsx(Ie,{}),!l.loading&&l.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:i("leaderboard.profile_modal.error")})}),!l.loading&&!l.error&&!l.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:i("leaderboard.profile_modal.empty")})}),!l.loading&&!l.error&&l.data&&e.jsx(De,{data:l.data,currency:c,rate:x,onClose:r})]})})]})})}export{qe as LeaderboardProfileModal,De as ProfileContent,Ie as ProfileSkeleton,Ue as useLeaderboardProfileData};
72
+ `;function Le({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:Ce}}),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:d(r,"h-7 w-48")}),e.jsx("div",{className:d(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:d(r,"h-2.5 w-8")}),e.jsx("div",{className:d(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:d(r,"h-4 w-40")}),e.jsx("div",{className:d(r,"h-3 w-56")})]}),e.jsx("div",{className:d(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:d("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,o)=>e.jsxs("div",{children:[e.jsx("div",{className:d(r,"h-6 w-20")}),e.jsx("div",{className:d(r,"mt-2 h-3 w-14")})]},o))}),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,o)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:d(r,"h-3 w-24")}),e.jsx("div",{className:d(r,"h-3 w-44")})]},o))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:d(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,o)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},o))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:d(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((t,o)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:d(r,"h-4 w-4")}),e.jsx("div",{className:d(r,"h-3 w-16")}),e.jsx("div",{className:d(r,"h-[3px] flex-1")}),e.jsx("div",{className:d(r,"h-3 w-12")})]},o))})]})]})]})}function q(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 B({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 L({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 I({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 Pe({user:a,onClose:r}){const s=q(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:d("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:i("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(D,{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(Z,{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":i("leaderboard.profile_modal.close"),children:e.jsx(xe,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function Ie({user:a}){const r=q(a?.github_url),s=Number(a?.rank)||0,t=s===1?"text-amber-500 dark:text-amber-400":s===2?"text-slate-500 dark:text-slate-300":s===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(Y,{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"}),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(Z,{userId:a.user_id})]}),r?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(D,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",r]})]}):null]}),s?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:i("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:d("mt-1.5 text-3xl font-black tabular-nums tracking-tight",t),children:i("leaderboard.profile_modal.rank",{rank:s})})]}):null]})]})}function $e({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:i("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(D,{provider:String(s.source).toUpperCase(),size:14})}),e.jsx("span",{className:"shrink-0 capitalize w-16 text-oai-gray-700 dark:text-oai-gray-300",children:s.source}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(t*100).toFixed(1)}%`}})}),e.jsx("span",{className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:$(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,o]=g.useState(!1),c=async()=>{await ge(s)&&(o(!0),setTimeout(()=>o(!1),1600))};return e.jsxs("button",{type:"button",onClick:c,className:d("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(ue,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t?i("leaderboard.profile_modal.badge.copied"):r})]})}function De({data:a,currency:r,rate:s,onClose:t,variant:o="modal"}){const{user:c,totals:x,streak:l,best_day:h,models:b,by_provider:N,heatmap:_,period:P}=a,w=o==="page",y=g.useMemo(()=>ze(_),[_]),A=b?.favorite?.model_name,k=Number(b?.count)||0,S=X(),u=!!(S?.user?.id&&c?.user_id&&S.user.id===c.user_id),j=c?.user_id?`https://www.tokentracker.cc/u/${c.user_id}`:null,M=c?.user_id?`[![My AI coding usage](${ne()}/functions/tokentracker-embed-svg?user_id=${c.user_id}&theme=dark)](${j}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[w?e.jsx(Ie,{user:c}):e.jsx(Pe,{user:c,onClose:t}),e.jsxs("div",{className:d("space-y-6",w?"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(L,{value:$(x?.total_tokens),label:i("leaderboard.profile_modal.stat.total_tokens")}),e.jsx(L,{value:R(x?.estimated_cost_usd,r,s),label:i("leaderboard.profile_modal.stat.total_cost")}),e.jsx(L,{value:String(x?.active_days??0),label:i("leaderboard.profile_modal.stat.active_days")}),e.jsx(L,{value:R(x?.avg_per_day_usd,r,s),label:i("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(I,{label:i("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:i("leaderboard.profile_modal.streak.days",{count:l?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",l?.longest_days??0,")"]})]}),e.jsx(I,{label:i("leaderboard.profile_modal.best_day.title"),children:h?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:$(h.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",h.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:i("leaderboard.profile_modal.best_day.none")})}),e.jsx(I,{label:i("leaderboard.profile_modal.models.favorite"),children:A?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:A}),k>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:i("leaderboard.profile_modal.models.count",{count:k})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:i("leaderboard.profile_modal.models.none")})})]}),y&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(B,{children:i("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(he,{heatmap:y,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(B,{children:i("leaderboard.profile_modal.providers.title")}),e.jsx($e,{data:N})]}),c?.user_id&&(t||u)&&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&&(le()?e.jsxs("a",{href:j,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:i("leaderboard.profile_modal.view_full")}),e.jsx(U,{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(de,{to:`/u/${c.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:i("leaderboard.profile_modal.view_full")}),e.jsx(U,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),u&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{icon:fe,label:i("leaderboard.profile_modal.badge.copy_url"),value:j}),e.jsx(W,{icon:we,label:i("leaderboard.profile_modal.badge.copy"),value:M})]})]})]})]})}function Ue({userId:a,period:r,accessToken:s,enabled:t=!0}){const[o,c]=g.useState({loading:!1,error:null,data:null});return g.useEffect(()=>{if(!t||!a)return;let x=!0;return c({loading:!0,error:null,data:null}),(async()=>{try{const l=s?await oe(s):null;if(!x)return;const h=await ie({accessToken:l,userId:a,period:r||"week"});if(!x)return;c({loading:!1,error:null,data:h})}catch(l){if(!x)return;l?.status===404?c({loading:!1,error:null,data:null}):c({loading:!1,error:l?.message||String(l),data:null})}})(),()=>{x=!1}},[t,a,r,s]),o}function Ze({isOpen:a,onClose:r,userId:s,period:t,accessToken:o}){const{currency:c,rate:x}=pe(),l=Ue({userId:s,period:t,accessToken:o,enabled:a});return e.jsx(be,{open:a,onOpenChange:h=>{h||r?.()},children:e.jsxs(ye,{children:[e.jsx(ke,{className:"cost-modal-backdrop"}),e.jsx(je,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(ve,{className:d("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(Ne,{render:e.jsx("h2",{className:"sr-only"}),children:l.data?.user?.display_name||i("leaderboard.profile_modal.loading")}),l.loading&&e.jsx(Le,{}),!l.loading&&l.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:i("leaderboard.profile_modal.error")})}),!l.loading&&!l.error&&!l.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:i("leaderboard.profile_modal.empty")})}),!l.loading&&!l.error&&l.data&&e.jsx(De,{data:l.data,currency:c,rate:x,onClose:r})]})})]})})}export{Ze as LeaderboardProfileModal,De as ProfileContent,Le as ProfileSkeleton,Ue as useLeaderboardProfileData};
@@ -1,4 +1,4 @@
1
- import{r as _,j as p,_ as xe,a1 as ge,a2 as ve,aI as be,L as Tt,aJ as we,N as Y,at as ye}from"./main-BCstrDYE.js";import{u as ke}from"./useCurrency-bd6TLRsc.js";import{H as Me}from"./HeaderGithubStar-CTZvanhz.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-CfVMENby.js";import{D as Te}from"./download-COSLX73O.js";import"./LeaderboardAvatar-3T57GKKK.js";import"./ActivityHeatmap-CH6m_ZJM.js";import"./info-Cm7V_KDO.js";import"./arrow-up-right-Bm3t-iA0.js";import"./link-2-CYqDGrkv.js";import"./check-D8Owfjyw.js";import"./DialogTitle-CA5znwms.js";import"./useScrollLock-ajoWrfku.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Ie(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Fe=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
1
+ import{r as _,j as p,a2 as xe,a3 as ge,a4 as ve,aJ as be,L as Tt,aK as we,N as Y,au as ye}from"./main-w0hAaCsy.js";import{u as ke}from"./useCurrency-h3kqF52v.js";import{H as Me}from"./HeaderGithubStar-D6zy-ADl.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-DH0EEK6q.js";import{D as Te}from"./download-BQOcg3gT.js";import"./LeaderboardAvatar-2WTIeXye.js";import"./ActivityHeatmap-5352XxLR.js";import"./info-C_BrDrcq.js";import"./arrow-up-right-BAQYGZkR.js";import"./link-2-DFwCBbIZ.js";import"./check-C3RPBZiS.js";import"./DialogTitle-DuuTVbUb.js";import"./useScrollLock-9au2731u.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
2
2
  attribute vec2 a_position;
3
3
  void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
4
4
  `,Ge=`
@@ -185,7 +185,7 @@ import{r as _,j as p,_ as xe,a1 as ge,a2 as ve,aI as be,L as Tt,aJ as we,N as Y,
185
185
 
186
186
  gl_FragColor = vec4(col, alpha * u_shaderOpacity);
187
187
  }
188
- `;function Rt(t,e,a){const r=t.createShader(e);if(!r)throw new Error("metal-fx: gl.createShader returned null");if(t.shaderSource(r,a),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`metal-fx: shader compile failed: ${o??"(no info log)"}`)}return r}function De(t,e,a){const r=t.createProgram();if(!r)throw new Error("metal-fx: gl.createProgram returned null");if(t.attachShader(r,e),t.attachShader(r,a),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS)){const o=t.getProgramInfoLog(r);throw t.deleteProgram(r),new Error(`metal-fx: program link failed: ${o??"(no info log)"}`)}return r}const Yt=140,Jt=40,Kt=1.6,Zt=1.3;let s=null,bt=null;function Ue(t){bt=t}const qe=["u_resolution","u_time","u_color1","u_color2","u_color3","u_color4","u_color5","u_color6","u_color7","u_alpha1","u_alpha2","u_alpha3","u_alpha4","u_alpha5","u_alpha6","u_alpha7","u_intensity","u_scale","u_direction","u_softness","u_distortion","u_complexity","u_shape","u_vignette","u_vigOpacity","u_blur","u_shaderOpacity"];function It(t){t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);const e=Rt(t,t.VERTEX_SHADER,He),a=Rt(t,t.FRAGMENT_SHADER,Ge),r=De(t,e,a);t.useProgram(r);const o=t.createBuffer();if(!o)throw new Error("metal-fx: gl.createBuffer returned null");t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),t.STATIC_DRAW);const n=t.getAttribLocation(r,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0);const i={};for(const u of qe)i[u]=t.getUniformLocation(r,u);return{program:r,buffer:o,uniforms:i}}function te(){if(s)return s;const t=Math.min(Ne,typeof window<"u"&&window.devicePixelRatio||1),e=Math.round(Le*t),a=typeof OffscreenCanvas<"u";let r,o;if(a)r=new OffscreenCanvas(e,e),o=r.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1});else{const h=document.createElement("canvas");h.width=e,h.height=e,o=h.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1,preserveDrawingBuffer:!0})??h.getContext("experimental-webgl"),r=h}if(!o)throw new Error("metal-fx: WebGL not supported");const{program:n,buffer:i,uniforms:u}=It(o),l=h=>{h.preventDefault(),s&&(s.contextLost=!0)},c=()=>{if(!s)return;const h=It(s.gl);s.program=h.program,s.buffer=h.buffer,s.uniforms=h.uniforms,s.presetDirty=!0,s.contextLost=!1,bt?.()};return r.addEventListener("webglcontextlost",l,!1),r.addEventListener("webglcontextrestored",c,!1),s={glCanvas:r,gl:o,program:n,buffer:i,uniforms:u,preset:Xt.chromatic.modes.dark,presetDirty:!0,contextLost:!1,useOffscreen:a,frameBitmap:null,startMs:performance.now(),pausedMs:0,pausedAtMs:null,rafId:0,dpr:t,instances:new Set,frameCount:0,glowQueue:[],glowIdx:0,glowSkip:0,glowPixels:new Uint8Array(e*e*4),glowPixelsW:e,glowPixelsH:e},s}function Qe(){var t;if(!s)return;const{gl:e,program:a,buffer:r,frameBitmap:o}=s;try{o?.close(),e.deleteBuffer(r),e.deleteProgram(a),(t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext()}catch{}s=null}let Ft=0;function dt(){if(!s)return;const t=performance.now();if(t-Ft<Pe)return;Ft=t;const{gl:e,glCanvas:a}=s,r=a.width,o=a.height;(s.glowPixelsW!==r||s.glowPixelsH!==o)&&(s.glowPixelsW=r,s.glowPixelsH=o,s.glowPixels=new Uint8Array(r*o*4)),e.readPixels(0,0,r,o,e.RGBA,e.UNSIGNED_BYTE,s.glowPixels)}const J={bx:0,by:0};function kt(t,e,a){if(!s)return J.bx=0,J.by=0,J;const{glCanvas:r}=s,o=r.width,n=r.height,i=t.dpr,u=t.cssWidth*i,l=t.cssHeight*i,c=Yt*i,h=Jt*i;let f=u*(o/c)/t.shaderScale,d=l*(n/h)/t.shaderScale;f>o&&(f=o),d>n&&(d=n);const g=(o-f)/2,x=(n-d)/2,m=g+e/t.cssWidth*f,I=x+a/t.cssHeight*d;return J.bx=Math.round(m),J.by=Math.round(n-1-I),J}const G={r:0,g:0,b:0,lum:0,count:0};function ee(t,e,a,r,o,n){const i=Math.max(1,n|0),u=Math.max(0,r-i),l=Math.min(e,r+i+1),c=Math.max(0,o-i),h=Math.min(a,o+i+1);G.r=0,G.g=0,G.b=0,G.lum=0,G.count=0;for(let f=c;f<h;f++){const d=f*e;for(let g=u;g<l;g++){const x=(d+g)*4;G.r+=t[x],G.g+=t[x+1],G.b+=t[x+2],G.lum+=(.2126*t[x]+.7152*t[x+1]+.0722*t[x+2])/255,G.count++}}return G}const R={r:255,g:255,b:255};function Ot(t,e,a,r){if(!s)return 0;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count>0?n.lum/n.count:0}function Ve(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count===0?(R.r=255,R.g=255,R.b=255,R):(R.r=n.r/n.count,R.g=n.g/n.count,R.b=n.b/n.count,R)}function Xe(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),{glowPixels:n,glowPixelsW:i,glowPixelsH:u}=s,l=Math.max(1,r|0),c=Math.max(0,o.bx-l),h=Math.min(i,o.bx+l+1),f=Math.max(0,o.by-l),d=Math.min(u,o.by+l+1);let g=-1;R.r=255,R.g=255,R.b=255;for(let x=f;x<d;x++){const m=x*i;for(let I=c;I<h;I++){const b=(m+I)*4,P=n[b],j=n[b+1],L=n[b+2],C=Math.max(P,j,L),E=Math.min(P,j,L),z=(C>0?(C-E)/C:0)*(.35+.65*(C/255));z>g&&(g=z,R.r=P,R.g=j,R.b=L)}}return R}Ue(()=>{s&&s.instances.size>0&&s.pausedAtMs===null&&nt()});typeof document<"u"&&document.addEventListener("visibilitychange",()=>{!s||s.pausedAtMs!==null||s.contextLost||(document.hidden?oe():s.instances.size>0&&nt())});function Ye(t){const e=te(),a=t.hostCanvas.getContext("2d",{alpha:!0});if(!a)throw new Error("metal-fx: canvas 2D context unavailable");const r=t.scale??1,o={canvas:t.hostCanvas,ctx:a,cssWidth:t.cssWidth,cssHeight:t.cssHeight,cornerRadius:t.cornerRadius,kind:t.kind,ringCssPx:t.ringCssPx??(t.kind==="circle"?2:1)*r,shaderScale:t.shaderScale??(t.kind==="circle"?Zt:Kt)*r,opacityMul:t.opacityMul??1,visible:!0,paused:t.paused??!1,everCopied:!1,dpr:typeof window<"u"&&window.devicePixelRatio||1,scale:r,onAfterFrame:t.onAfterFrame,onFirstCopy:t.onFirstCopy};return ae(o),e.instances.add(o),e.rafId===0&&e.pausedAtMs===null&&nt(),o}function Je(t){if(!s)return;s.instances.delete(t);const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1),s.instances.size===0&&(oe(),Qe())}function Ke(t){s&&(s.glowQueue.includes(t)||s.glowQueue.push(t))}function Ze(t){if(!s)return;const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1)}function rt(t,e){let a=!1;e.cssWidth!==void 0&&e.cssWidth!==t.cssWidth&&(t.cssWidth=e.cssWidth,a=!0),e.cssHeight!==void 0&&e.cssHeight!==t.cssHeight&&(t.cssHeight=e.cssHeight,a=!0),e.cornerRadius!==void 0&&(t.cornerRadius=e.cornerRadius),e.scale!==void 0&&(t.scale=e.scale),e.kind!==void 0&&e.kind!==t.kind&&(t.kind=e.kind,e.shaderScale===void 0&&(t.shaderScale=(e.kind==="circle"?Zt:Kt)*t.scale),e.ringCssPx===void 0&&(t.ringCssPx=(e.kind==="circle"?2:1)*t.scale)),e.shaderScale!==void 0&&(t.shaderScale=e.shaderScale),e.ringCssPx!==void 0&&(t.ringCssPx=e.ringCssPx),e.opacityMul!==void 0&&(t.opacityMul=e.opacityMul),e.paused!==void 0&&e.paused!==t.paused&&(t.paused=e.paused,!e.paused&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()),a&&ae(t)}function ta(t,e){t.visible=e,e&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()}function ea(t,e){const a=te();a.preset=Xt[t].modes[e],a.presetDirty=!0}let wt=null;function aa(t){wt=t}function ae(t){t.dpr=typeof window<"u"&&window.devicePixelRatio||1;const e=Math.max(1,Math.round(t.cssWidth*t.dpr)),a=Math.max(1,Math.round(t.cssHeight*t.dpr));t.canvas.width!==e&&(t.canvas.width=e),t.canvas.height!==a&&(t.canvas.height=a)}function ra(t){const{ctx:e,dpr:a,canvas:r}=t,o=t.ringCssPx*a,n=r.width,i=r.height,u=Math.max(0,(t.cornerRadius-t.ringCssPx)*a);e.save(),e.globalCompositeOperation="destination-out",e.fillStyle="#000",e.beginPath(),e.roundRect(o,o,n-2*o,i-2*o,u),e.fill(),e.restore()}function oa(t){var e;if(!s)return;const a=s.frameBitmap??s.glCanvas,r=t.dpr,o=t.canvas.width,n=t.canvas.height;if(o<1||n<1)return;const i=s.glCanvas.width,u=s.glCanvas.height,l=Yt*r,c=Jt*r;let h=o*(i/l)/t.shaderScale,f=n*(u/c)/t.shaderScale;h>i&&(h=i),f>u&&(f=u);const d=Math.max(0,(i-h)/2),g=Math.max(0,(u-f)/2);if(t.ctx.clearRect(0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=t.opacityMul),t.ctx.drawImage(a,d,g,h,f,0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=1),ra(t),t.onFirstCopy){const x=t.onFirstCopy;t.onFirstCopy=void 0,x()}(e=t.onAfterFrame)==null||e.call(t)}function na(){if(!s)return;const{gl:t,uniforms:e,preset:a,glCanvas:r}=s;e.u_resolution&&t.uniform2f(e.u_resolution,r.width,r.height);for(let o=0;o<7;o++){const n=e[`u_color${o+1}`];if(n){const[u,l,c]=$e(a.colors[o]);t.uniform3f(n,u,l,c)}const i=e[`u_alpha${o+1}`];i&&t.uniform1f(i,a.alphas[o])}e.u_intensity&&t.uniform1f(e.u_intensity,a.intensity),e.u_scale&&t.uniform1f(e.u_scale,a.scale),e.u_direction&&t.uniform1f(e.u_direction,a.direction*Math.PI/180),e.u_softness&&t.uniform1f(e.u_softness,a.softness),e.u_distortion&&t.uniform1f(e.u_distortion,a.distortion),e.u_complexity&&t.uniform1f(e.u_complexity,a.complexity),e.u_shape&&t.uniform1f(e.u_shape,a.shape),e.u_vignette&&t.uniform1f(e.u_vignette,a.vignette),e.u_vigOpacity&&t.uniform1f(e.u_vigOpacity,a.vigOpacity),e.u_blur&&t.uniform1f(e.u_blur,a.blur),e.u_shaderOpacity&&t.uniform1f(e.u_shaderOpacity,a.shaderOpacity),s.presetDirty=!1}function ia(t){if(!s)return;const{gl:e,uniforms:a,preset:r,glCanvas:o}=s,n=(t-s.startMs-s.pausedMs)/1e3*r.speed;e.viewport(0,0,o.width,o.height),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),s.presetDirty&&na(),a.u_time&&e.uniform1f(a.u_time,n),e.drawArrays(e.TRIANGLES,0,6),s.frameCount++}let Pt=0;function re(t){var e;if(!s)return;if(s.contextLost){s.rafId=0;return}let a=!1;for(const r of s.instances)if(r.visible&&(!r.paused||!r.everCopied)){a=!0;break}if(!a){s.rafId=0;return}if(s.rafId=requestAnimationFrame(re),!(t-Pt<Fe)){Pt=t,ia(t),s.useOffscreen&&(s.glowQueue.length>0&&dt(),(e=s.frameBitmap)==null||e.close(),s.frameBitmap=s.glCanvas.transferToImageBitmap());for(const r of s.instances)r.visible&&(r.paused&&r.everCopied||(oa(r),r.everCopied=!0));if(wt&&s.glowQueue.length>0&&++s.glowSkip%Ae===0){const r=s.glowQueue;s.glowIdx>=r.length&&(s.glowIdx=0);const o=r[s.glowIdx];o.visible&&!o.paused&&wt(o,t),s.glowIdx++}}}function nt(){!s||s.rafId!==0||(s.rafId=requestAnimationFrame(re))}function oe(){s&&(s.rafId!==0&&cancelAnimationFrame(s.rafId),s.rafId=0)}const lt={linear:t=>t,smoothstep:t=>t*t*(3-2*t)};function K(t,e,a,r=lt.linear){return{from:t,to:e,dur:a,ease:r,startMs:-1,val:t,done:!1}}function Z(t,e){t.startMs=e,t.val=t.from,t.done=!1}function At(t,e){if(t.done||t.startMs<0)return t.val;const a=Math.min(1,(e-t.startMs)/t.dur);return t.val=t.from+(t.to-t.from)*t.ease(a),a>=1&&(t.done=!0),t.val}const sa=1.5,it=1/3,la=4*it,ca=2*it,da=2*it,ua=1.35*it,ha=13*it;function Mt(t,e,a){const r=Math.max(0,Math.min(a,Math.min(t,e)/2));return 2*Math.max(0,t-2*r)+2*Math.max(0,e-2*r)+2*Math.PI*r}function _t(t,e,a,r){return r==="circle"?2*Math.PI*Math.max(0,Math.min(a,Math.min(t,e)/2)):Mt(t,e,a)}function ot(t,e,a,r,o,n,i,u){const l=u||{x:0,y:0},c=Math.max(0,Math.min(r,Math.min(e,a)/2));if(i==="circle"){const b=2*Math.PI*c;if(b<=1e-4)return l.x=e*.5,l.y=a*.5,l;t=(t%b+b)%b;const P=-Math.PI/2+t/b*Math.PI*2,j=Math.max(0,c-o+n);return l.x=e*.5+j*Math.cos(P),l.y=a*.5+j*Math.sin(P),l}const h=Math.max(0,e-2*c),f=Math.max(0,a-2*c),d=Math.PI*c/2,g=2*(h+f)+4*d;t=(t%g+g)%g;const x=Math.max(0,c-o+n);let m=t;if(m<h)return l.x=c+m,l.y=o-n,l;if(m-=h,m<d){const b=-Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=e-o+n,l.y=c+m,l;if(m-=f,m<d){const b=(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<h)return l.x=e-c-m,l.y=a-o+n,l;if(m-=h,m<d){const b=Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=o-n,l.y=a-c-m,l;m-=f;const I=Math.PI+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(I),l.y=c+x*Math.sin(I),l}function jt(t,e){const a=t*2/e;let r="";for(let o=0;o<=e;o++){const n=-t+o*a;r+=(o===0?"M ":"L ")+n.toFixed(3)+" 0 "}return r}const ft={x:0,y:0},pt={x:0,y:0};function fa(t,e,a,r,o,n){return ot(t-.1,e,a,r,o,0,n,ft),ot(t+.1,e,a,r,o,0,n,pt),Math.atan2(pt.y-ft.y,pt.x-ft.x)}function Et(t,e,a){const r=Math.max(0,Math.min(1,(a-t)/(e-t)));return r*r*(3-2*r)}function pa(t){const e=_t(t.width,t.height,t.cornerRadius,t.kind),a=sa*(t.scale??1),r=[];for(let o=0;o<$t;o++){const n=o/$t*e,i=ot(n,t.width,t.height,t.cornerRadius,a,0,t.kind);r.push({x:i.x,y:i.y,arc:n})}return r}function ma(t,e){const{width:a,height:r,cornerRadius:o}=t,n=t.scale??1,i=t.kind==="circle"?2:1,u=Math.max(0,o-i),l=(-200*n).toFixed(0),c=l,h=(540*n).toFixed(0),f=(440*n).toFixed(0),d=`x="${l}" y="${c}" width="${h}" height="${f}"`,g=`${d} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`,x=I=>(I*n).toFixed(3),m=I=>(I*n).toFixed(3);return["<defs>",`<filter id="${e}_bXl" ${g}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,`<filter id="${e}_bLg" ${g}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,`<filter id="${e}_bMd" ${g}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,`<filter id="${e}_bSm" ${g}><feGaussianBlur stdDeviation="${m(.9)}"/></filter>`,`<filter id="${e}_ebO" ${g}><feGaussianBlur stdDeviation="${m(da)}"/></filter>`,`<filter id="${e}_ebC" ${g}><feGaussianBlur stdDeviation="${m(ua)}"/></filter>`,`<radialGradient id="${e}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,`<mask id="${e}_fm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="black"/><circle id="${e}_fc" cx="0" cy="0" r="${(ha*n).toFixed(3)}" fill="url(#${e}_fg)"/></mask>`,`<mask id="${e}_rm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="#808080"/><rect x="0" y="0" width="${a}" height="${r}" rx="${o}" ry="${o}" fill="white"/><rect x="${i}" y="${i}" width="${a-i*2}" height="${r-i*2}" rx="${u}" ry="${u}" fill="black"/></mask>`,"</defs>",`<g id="${e}_h" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g id="${e}_hI" stroke="white">`,`<path id="${e}_pXl" stroke-width="${x(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${e}_bXl)"/>`,`<path id="${e}_pLg" stroke-width="${x(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${e}_bLg)"/>`,`<path id="${e}_pMd" stroke-width="${x(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bMd)"/>`,`<path id="${e}_pSm" stroke-width="${x(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bSm)"/>`,"</g></g>",`<g id="${e}_e" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g mask="url(#${e}_fm)">`,`<g id="${e}_eI" stroke="white">`,`<path id="${e}_eO" stroke-width="${x(la)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${e}_ebO)"/>`,`<path id="${e}_eC" stroke-width="${x(ca)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${e}_ebC)"/>`,"</g></g></g>"].join("")}const xa=.00875,Lt=.08,Nt=.32,ga=.05,va=3e3,Wt=.85,st=.34,mt=1500,ba=15,wa=.0075,ya=120,ka=1.5,Ma=7.8,_a=9.13952,Ca=1,Sa=1/3,Ta=.8,$a=3.51,Bt=2e3,xt=400,Ra=2.625,Ia=1.008,Fa=.31,ne=140,ie=40,se=20;let Oa=0;const q={x:0,y:0};function zt(t,e){const a=`mfxg_${++Oa}`,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","metal-fx-glow-svg"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e.width} ${e.height}`),r.innerHTML=ma(e,a),t.appendChild(r);const o=b=>r.querySelector(`#${a}_${b}`),n=o("h"),i=o("hI"),u=o("e"),l=o("eI"),c=o("fc"),h=_t(e.width,e.height,e.cornerRadius,e.kind)/Mt(ne,ie,se),f=Math.max(1,Ma*h),d=Math.max(.6,_a*Sa*h),g=jt(f,je),x=jt(d,Ee),m=[o("pXl"),o("pLg"),o("pMd"),o("pSm")],I=[o("eO"),o("eC")];for(const b of m)b.setAttribute("d",g);for(const b of I)b.setAttribute("d",x);return i.style.transformOrigin="0 0",l.style.transformOrigin="0 0",i.style.willChange="transform",l.style.willChange="transform",i.style.transition="transform 100ms linear",l.style.transition="transform 100ms linear",n.style.willChange="opacity",u.style.willChange="opacity",n.style.transition="opacity 100ms linear",u.style.transition="opacity 100ms linear",c.style.willChange="transform",{svg:r,haloGroup:n,haloInner:i,extraGroup:u,extraInner:l,fadeCircle:c,width:e.width,height:e.height,cornerRadius:e.cornerRadius,kind:e.kind,scale:e.scale??1,perim:pa(e),currentIdx:0,appearedAt:0,glowOpacity:0,relocTween:null,relocNextIdx:-1,wanderS:0,wanderTargetS:0,wanderFrames:0,tintFrom:{r:255,g:255,b:255},tintTarget:{r:255,g:255,b:255},tintTween:null,tintHoldUntil:0,lastHaloStroke:"",lastExtraStroke:""}}function Pa(t,e,a,r,o="dark"){var n;const{width:i,height:u,cornerRadius:l,perim:c}=t;if(c.length===0)return;const h=2;let f=-1,d=t.currentIdx,g=0;for(let v=0;v<c.length;v++){const M=c[v],S=Ot(e,M.x,M.y,h);S>f&&(f=S,d=v),v===t.currentIdx&&(g=S)}const x=t.appearedAt>0&&a-t.appearedAt<va,m=st+(Wt-st)*Et(Lt,Nt,g),I=!x&&f-g>ga;if(!t.relocTween||t.relocTween.done)if(t.appearedAt===0)t.currentIdx=d,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0,t.relocTween=K(0,m,mt,lt.smoothstep),Z(t.relocTween,a);else if((n=t.relocTween)!=null&&n.done&&t.relocTween.to===0){t.currentIdx=t.relocNextIdx,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0;const v=c[t.currentIdx],M=Ot(e,v.x,v.y,h),S=st+(Wt-st)*Et(Lt,Nt,M);t.relocTween=K(0,S,mt,lt.smoothstep),Z(t.relocTween,a)}else I?(t.relocNextIdx=d,t.relocTween=K(t.glowOpacity,0,mt,lt.smoothstep),Z(t.relocTween,a)):t.glowOpacity+=(m-t.glowOpacity)*xa;t.relocTween&&(t.glowOpacity=At(t.relocTween,a)),t.glowOpacity=Math.max(0,Math.min(1,t.glowOpacity));const b=_t(i,u,l,t.kind)/Mt(ne,ie,se),P=ba*b;t.wanderFrames++>=ya&&(t.wanderTargetS=(Math.random()*2-1)*P,t.wanderFrames=0),t.wanderS+=(t.wanderTargetS-t.wanderS)*wa;const j=c[t.currentIdx].arc+t.wanderS,L=ka*t.scale;ot(j,i,u,l,L,0,t.kind,q);const C=q.x,E=q.y,z=fa(j,i,u,l,L,t.kind),X=`translate(${C.toFixed(3)}px,${E.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`;t.haloInner.style.transform=X;const N=Ca*b*t.scale;ot(j,i,u,l,L,N,t.kind,q),t.extraInner.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`,t.fadeCircle.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px)`;const $=o==="light",k=$?Xe(e,C,E,h):Ve(e,C,E,h);t.tintTween?t.tintTween.done&&($?(t.tintFrom={r:t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*t.tintTween.val,g:t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*t.tintTween.val,b:t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*t.tintTween.val},t.tintTarget={...k},t.tintTween=K(0,1,xt),Z(t.tintTween,a)):a>=t.tintHoldUntil&&(t.tintFrom={...t.tintTarget},t.tintTarget={...k},t.tintTween=K(0,1,xt),Z(t.tintTween,a),t.tintHoldUntil=a+Bt)):(t.tintFrom={...k},t.tintTarget={...k},t.tintTween=K(0,1,xt),Z(t.tintTween,a),t.tintHoldUntil=$?0:a+Bt),At(t.tintTween,a);const F=t.tintTween.val;let W,B,H;if($)W=Math.round(t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*F),B=Math.round(t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*F),H=Math.round(t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*F);else{const v=t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*F,M=t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*F,S=t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*F,O=Math.max(v,M,S)||1;W=Math.round(255*(v/O)),B=Math.round(255*(M/O)),H=Math.round(255*(S/O))}const y=`rgb(${W},${B},${H})`;if(y!==t.lastHaloStroke&&(t.lastHaloStroke=y,t.haloInner.style.stroke=y),$){const v=Re(W,B,H),[M,S,O]=Ie(v[0],Math.min(1,v[1]*Ra),Math.max(Fa,v[2]*Ia)),D=`rgb(${M},${S},${O})`;D!==t.lastExtraStroke&&(t.lastExtraStroke=D,t.extraInner.style.stroke=D)}else t.lastExtraStroke!=="#ffffff"&&(t.lastExtraStroke="#ffffff",t.extraInner.style.stroke="#ffffff");const w=Math.max(0,Math.min(1,r));t.haloGroup.style.opacity=(t.glowOpacity*Ta*w).toFixed(3),t.extraGroup.style.opacity=Math.min(1,t.glowOpacity*$a*w).toFixed(3)}const yt=12,Ht=32,Gt=1,Dt=.55,Aa=1,ja=1,Ea=.85,La=0,Na=1.3,Ut=3.6,Wa=.7,Ba=1,za=.52,Ha=1,Ga=.044,Da=235,Ua=2.535,qa=.7,Qa=.5,Va=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function Xa(t,e){const a=Math.max(t.left-e.right,e.left-t.right,0),r=Math.max(t.top-e.bottom,e.top-t.bottom,0);return Math.sqrt(a*a+r*r)}function Ya(t,e,a,r){return!(Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top)<a||Math.max(t.left-e.right,e.left-t.right,0)>r)}function Ja(t,e,a,r){return Math.min(t.right,e.right)-Math.max(t.left,e.left)<a?!1:Math.max(t.top-e.bottom,e.top-t.bottom,0)<=r}function V(t,e,a,r,o,n){const i=Math.max(0,Math.min(n,r*.5,o*.5)),u=t.roundRect;if(typeof u=="function"){u.call(t,e,a,r,o,i);return}t.moveTo(e+i,a),t.lineTo(e+r-i,a),t.quadraticCurveTo(e+r,a,e+r,a+i),t.lineTo(e+r,a+o-i),t.quadraticCurveTo(e+r,a+o,e+r-i,a+o),t.lineTo(e+i,a+o),t.quadraticCurveTo(e,a+o,e,a+o-i),t.lineTo(e,a+i),t.quadraticCurveTo(e,a,e+i,a)}function le(t,e,a,r,o){if(!o.flipX&&!o.flipY){t.drawImage(e,0,0,a,r,o.x,o.y,o.w,o.h);return}t.save(),o.flipX&&(t.translate(o.x+o.w,0),t.scale(-1,1)),o.flipY&&(t.translate(0,o.y+o.h),t.scale(1,-1)),t.drawImage(e,0,0,a,r,o.flipX?0:o.x,o.flipY?0:o.y,o.w,o.h),t.restore()}const Ka=4;function Za(t,e,a,r,o,n,i){if(r<=2*i||o<=2*i){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+i,a+i,r-2*i,o-2*i,Math.max(0,n-i)),t.clip("evenodd")}function tr(t,e,a,r,o,n,i,u,l,c,h){const f=Math.max(1,Math.round((yt+Ka*3)*h));let d=Math.max(0,i),g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),Za(t,c.x,c.y,c.w,c.h,c.r,f),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,l),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=u,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ce(t,e,a,r,o,n,i){const u=i|0;if(u<1||r<=2*u||o<=2*u){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+u,a+u,r-2*u,o-2*u,Math.max(0,n-u)),t.clip("evenodd")}function er(t,e,a,r,o,n,i,u,l,c,h,f){let d=u*h,g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),ce(t,i.x,i.y,i.w,i.h,i.r,l),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,f),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=c,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ar(t,e,a,r,o,n,i,u){const l=t.createLinearGradient(r,o,n,i);l.addColorStop(0,`rgba(255,255,255,${u.toFixed(3)})`),l.addColorStop(.5,`rgba(255,255,255,${(u*.45).toFixed(3)})`),l.addColorStop(1,"rgba(255,255,255,0)"),t.save(),ce(t,e.x,e.y,e.w,e.h,e.r,a),t.globalCompositeOperation="lighter",t.lineWidth=a*2,t.strokeStyle=l,t.beginPath(),V(t,e.x,e.y,e.w,e.h,e.r),t.stroke(),t.restore()}function de(t){const e=getComputedStyle(t),a=[parseFloat(e.borderTopLeftRadius)||0,parseFloat(e.borderTopRightRadius)||0,parseFloat(e.borderBottomRightRadius)||0,parseFloat(e.borderBottomLeftRadius)||0].filter(r=>r>0);return a.length?Math.min.apply(null,a):0}function ue(t){const e=getComputedStyle(t),a=Math.max(parseFloat(e.borderTopWidth)||0,parseFloat(e.borderRightWidth)||0,parseFloat(e.borderBottomWidth)||0,parseFloat(e.borderLeftWidth)||0);let r=0,o=0;const n=e.boxShadow;if(n&&n!=="none"){const u=n.replace(/rgba?\([^)]*\)/g,h=>h.replace(/,/g,"\0")).split(/,\s*/);let l=1/0,c=1/0;for(const h of u){const f=h.match(/-?\d+(?:\.\d+)?px/g);if(!f||f.length<4)continue;const d=parseFloat(f[3]);d>0&&(/\binset\b/.test(h)?d<l&&(l=d):d<c&&(c=d))}Number.isFinite(l)&&(r=l),Number.isFinite(c)&&(o=c)}const i=Math.max(a,o);return{width:Math.max(a,r,o)||1,outerCssPx:i}}function qt(t){t.cornerRadius=de(t.el);const e=ue(t.el);t.hairlineWidth=e.width,t.hairlineOuterCssPx=e.outerCssPx}function rr(t){typeof ResizeObserver<"u"&&(t.resizeObserver=new ResizeObserver(()=>qt(t)),t.resizeObserver.observe(t.el)),typeof MutationObserver<"u"&&(t.mutationObserver=new MutationObserver(()=>qt(t)),t.mutationObserver.observe(t.el,{attributes:!0,attributeFilter:["style","class"]}))}function or(t){var e,a;(e=t.resizeObserver)==null||e.disconnect(),t.resizeObserver=null,(a=t.mutationObserver)==null||a.disconnect(),t.mutationObserver=null}const tt=new Set;function nr(t,e,a){if(typeof document>"u"||Va.has(t.tagName))return null;for(const g of tt)if(g.el===t)return g;const r=document.createElement("div");r.setAttribute("data-metal-fx-reflection",""),r.setAttribute("aria-hidden","true");const o=document.createElement("canvas");o.className="metal-fx-reflection-canvas";const n=o.getContext("2d",{alpha:!0});if(!n)return null;const i=document.createElement("canvas");i.className="metal-fx-reflection-stroke-canvas";const u=i.getContext("2d",{alpha:!0});if(!u)return null;r.appendChild(o),r.appendChild(i);const l=getComputedStyle(t);let c=!1;l.position==="static"&&(t.style.position="relative",c=!0);let h=!1;l.isolation!=="isolate"&&(t.style.isolation="isolate",h=!0),t.setAttribute("data-metal-fx-reflect-host",""),t.insertBefore(r,t.firstChild);const f=ue(t),d={el:t,anchor:e,anchorEl:a,wrap:r,canvas:o,ctx:n,strokeCanvas:i,strokeCtx:u,cornerRadius:de(t),hairlineWidth:f.width,hairlineOuterCssPx:f.outerCssPx,appliedPositionRelative:c,appliedIsolation:h,resizeObserver:null,mutationObserver:null};return rr(d),tt.add(d),d}function ir(t){for(const e of tt)if(e.el===t){or(e),e.canvas.width=0,e.canvas.height=0,e.strokeCanvas.width=0,e.strokeCanvas.height=0,e.wrap.parentNode===e.el&&e.el.removeChild(e.wrap),e.el.removeAttribute("data-metal-fx-reflect-host"),e.appliedPositionRelative&&(e.el.style.position=""),e.appliedIsolation&&(e.el.style.isolation=""),tt.delete(e);return}}function sr(){if(tt.size===0)return;const t=typeof window<"u"&&window.devicePixelRatio||1,e=new Map;for(const a of tt){const r=a.el.getBoundingClientRect();let o=e.get(a.anchorEl);if(o||(o=a.anchorEl.getBoundingClientRect(),e.set(a.anchorEl,o)),r.width<1||r.height<1||o.width<1||o.height<1)continue;if(!Ya(o,r,Gt,Ht)&&!Ja(o,r,Gt,Ht)){a.canvas.width!==1&&(a.canvas.width=1,a.canvas.height=1),a.strokeCanvas.width!==1&&(a.strokeCanvas.width=1,a.strokeCanvas.height=1);continue}const n=a.anchor.canvas,i=n.width|0,u=n.height|0;if(i<4||u<4)continue;const l=(o.left+o.right)*.5,c=(o.top+o.bottom)*.5,h=(r.left+r.right)*.5,f=(r.top+r.bottom)*.5,d=l-h,g=c-f,x=Math.max(o.left-r.right,r.left-o.right,0),m=Math.max(o.top-r.bottom,r.top-o.bottom,0),I=x>=m,b=Xa(o,r);let P=1-Math.min(1,b/yt);P=P*P*(3-2*P);const j=Dt+(Aa-Dt)*P,L=Math.min(Ut,j*Na*Wa),C=a.anchor.scale??1,E=Math.max(Ba*C,a.hairlineWidth),z=Math.max(1,Math.round(E*t)),X=Math.max(1,Math.round(Math.max(Ha*C,a.hairlineWidth)*t)),N=a.hairlineOuterCssPx;a.wrap.style.inset=`${-N}px`,a.wrap.style.borderRadius=`${Math.max(0,a.cornerRadius)}px`;const $=Math.max(1,Math.round((r.width+N*2)*t)),k=Math.max(1,Math.round((r.height+N*2)*t));a.canvas.width!==$&&(a.canvas.width=$),a.canvas.height!==k&&(a.canvas.height=k),a.strokeCanvas.width!==$&&(a.strokeCanvas.width=$),a.strokeCanvas.height!==k&&(a.strokeCanvas.height=k);const F=a.ctx;F.setTransform(1,0,0,1,0,0),F.clearRect(0,0,$,k);const W=a.strokeCtx;W.setTransform(1,0,0,1,0,0),W.clearRect(0,0,$,k);const B=Math.min(yt*t,Math.max($,k));let H,y,w,v;I?(H=d>0?$:0,w=d>0?$-B:B,y=k*.5,v=k*.5):(y=g>0?k:0,v=g>0?k-B:B,H=$*.5,w=$*.5);const M=F.createLinearGradient(H,y,w,v);M.addColorStop(0,`rgba(0,0,0,${ja})`),M.addColorStop(.5,`rgba(0,0,0,${Ea})`),M.addColorStop(1,`rgba(0,0,0,${La})`);const S=i/t,O=Math.max(1,Math.round(Da*Math.max(.1,S/140)*t));let D,U,T,A,Q=!1,Ct=!1;if(I){const at=Math.max(o.top,r.top),ht=Math.min(o.bottom,r.bottom);Q=!0,D=d>0?$-O:0,U=Math.round((at-r.top+N)*t),T=O,A=Math.max(1,Math.round((ht-at)*t))}else{const at=Math.max(o.left,r.left),ht=Math.min(o.right,r.right);Ct=!0,D=Math.round((at-r.left+N)*t),U=g>0?k-O:0,T=Math.max(1,Math.round((ht-at)*t)),A=O}const St={x:D,y:U,w:T,h:A,flipX:Q,flipY:Ct},ut={x:0,y:0,w:$,h:k,r:Math.max(0,a.cornerRadius*t)},me=Math.min(Ut,L*Ua*qa*Qa);tr(F,n,i,u,$,k,me,M,St,ut,t),er(W,n,i,u,$,k,ut,L,z,M,za,St),ar(W,ut,X,H,y,w,v,Math.min(.85,Ga*L)),F.globalCompositeOperation="source-over",W.globalCompositeOperation="source-over"}}let gt=!1,Qt=0;function lr(){gt||(gt=!0,!(typeof requestAnimationFrame>"u")&&requestAnimationFrame(t=>{gt=!1,!(t-Qt<Oe)&&(Qt=t,sr())}))}const Vt="metal-fx-styles",cr=`
188
+ `;function Rt(t,e,a){const r=t.createShader(e);if(!r)throw new Error("metal-fx: gl.createShader returned null");if(t.shaderSource(r,a),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`metal-fx: shader compile failed: ${o??"(no info log)"}`)}return r}function De(t,e,a){const r=t.createProgram();if(!r)throw new Error("metal-fx: gl.createProgram returned null");if(t.attachShader(r,e),t.attachShader(r,a),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS)){const o=t.getProgramInfoLog(r);throw t.deleteProgram(r),new Error(`metal-fx: program link failed: ${o??"(no info log)"}`)}return r}const Yt=140,Kt=40,Jt=1.6,Zt=1.3;let s=null,bt=null;function Ue(t){bt=t}const qe=["u_resolution","u_time","u_color1","u_color2","u_color3","u_color4","u_color5","u_color6","u_color7","u_alpha1","u_alpha2","u_alpha3","u_alpha4","u_alpha5","u_alpha6","u_alpha7","u_intensity","u_scale","u_direction","u_softness","u_distortion","u_complexity","u_shape","u_vignette","u_vigOpacity","u_blur","u_shaderOpacity"];function Ft(t){t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);const e=Rt(t,t.VERTEX_SHADER,He),a=Rt(t,t.FRAGMENT_SHADER,Ge),r=De(t,e,a);t.useProgram(r);const o=t.createBuffer();if(!o)throw new Error("metal-fx: gl.createBuffer returned null");t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),t.STATIC_DRAW);const n=t.getAttribLocation(r,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0);const i={};for(const u of qe)i[u]=t.getUniformLocation(r,u);return{program:r,buffer:o,uniforms:i}}function te(){if(s)return s;const t=Math.min(Ne,typeof window<"u"&&window.devicePixelRatio||1),e=Math.round(Le*t),a=typeof OffscreenCanvas<"u";let r,o;if(a)r=new OffscreenCanvas(e,e),o=r.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1});else{const h=document.createElement("canvas");h.width=e,h.height=e,o=h.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1,preserveDrawingBuffer:!0})??h.getContext("experimental-webgl"),r=h}if(!o)throw new Error("metal-fx: WebGL not supported");const{program:n,buffer:i,uniforms:u}=Ft(o),l=h=>{h.preventDefault(),s&&(s.contextLost=!0)},c=()=>{if(!s)return;const h=Ft(s.gl);s.program=h.program,s.buffer=h.buffer,s.uniforms=h.uniforms,s.presetDirty=!0,s.contextLost=!1,bt?.()};return r.addEventListener("webglcontextlost",l,!1),r.addEventListener("webglcontextrestored",c,!1),s={glCanvas:r,gl:o,program:n,buffer:i,uniforms:u,preset:Xt.chromatic.modes.dark,presetDirty:!0,contextLost:!1,useOffscreen:a,frameBitmap:null,startMs:performance.now(),pausedMs:0,pausedAtMs:null,rafId:0,dpr:t,instances:new Set,frameCount:0,glowQueue:[],glowIdx:0,glowSkip:0,glowPixels:new Uint8Array(e*e*4),glowPixelsW:e,glowPixelsH:e},s}function Qe(){var t;if(!s)return;const{gl:e,program:a,buffer:r,frameBitmap:o}=s;try{o?.close(),e.deleteBuffer(r),e.deleteProgram(a),(t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext()}catch{}s=null}let It=0;function dt(){if(!s)return;const t=performance.now();if(t-It<Pe)return;It=t;const{gl:e,glCanvas:a}=s,r=a.width,o=a.height;(s.glowPixelsW!==r||s.glowPixelsH!==o)&&(s.glowPixelsW=r,s.glowPixelsH=o,s.glowPixels=new Uint8Array(r*o*4)),e.readPixels(0,0,r,o,e.RGBA,e.UNSIGNED_BYTE,s.glowPixels)}const K={bx:0,by:0};function kt(t,e,a){if(!s)return K.bx=0,K.by=0,K;const{glCanvas:r}=s,o=r.width,n=r.height,i=t.dpr,u=t.cssWidth*i,l=t.cssHeight*i,c=Yt*i,h=Kt*i;let f=u*(o/c)/t.shaderScale,d=l*(n/h)/t.shaderScale;f>o&&(f=o),d>n&&(d=n);const g=(o-f)/2,x=(n-d)/2,m=g+e/t.cssWidth*f,F=x+a/t.cssHeight*d;return K.bx=Math.round(m),K.by=Math.round(n-1-F),K}const G={r:0,g:0,b:0,lum:0,count:0};function ee(t,e,a,r,o,n){const i=Math.max(1,n|0),u=Math.max(0,r-i),l=Math.min(e,r+i+1),c=Math.max(0,o-i),h=Math.min(a,o+i+1);G.r=0,G.g=0,G.b=0,G.lum=0,G.count=0;for(let f=c;f<h;f++){const d=f*e;for(let g=u;g<l;g++){const x=(d+g)*4;G.r+=t[x],G.g+=t[x+1],G.b+=t[x+2],G.lum+=(.2126*t[x]+.7152*t[x+1]+.0722*t[x+2])/255,G.count++}}return G}const R={r:255,g:255,b:255};function Ot(t,e,a,r){if(!s)return 0;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count>0?n.lum/n.count:0}function Ve(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count===0?(R.r=255,R.g=255,R.b=255,R):(R.r=n.r/n.count,R.g=n.g/n.count,R.b=n.b/n.count,R)}function Xe(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),{glowPixels:n,glowPixelsW:i,glowPixelsH:u}=s,l=Math.max(1,r|0),c=Math.max(0,o.bx-l),h=Math.min(i,o.bx+l+1),f=Math.max(0,o.by-l),d=Math.min(u,o.by+l+1);let g=-1;R.r=255,R.g=255,R.b=255;for(let x=f;x<d;x++){const m=x*i;for(let F=c;F<h;F++){const b=(m+F)*4,P=n[b],j=n[b+1],L=n[b+2],C=Math.max(P,j,L),E=Math.min(P,j,L),z=(C>0?(C-E)/C:0)*(.35+.65*(C/255));z>g&&(g=z,R.r=P,R.g=j,R.b=L)}}return R}Ue(()=>{s&&s.instances.size>0&&s.pausedAtMs===null&&nt()});typeof document<"u"&&document.addEventListener("visibilitychange",()=>{!s||s.pausedAtMs!==null||s.contextLost||(document.hidden?oe():s.instances.size>0&&nt())});function Ye(t){const e=te(),a=t.hostCanvas.getContext("2d",{alpha:!0});if(!a)throw new Error("metal-fx: canvas 2D context unavailable");const r=t.scale??1,o={canvas:t.hostCanvas,ctx:a,cssWidth:t.cssWidth,cssHeight:t.cssHeight,cornerRadius:t.cornerRadius,kind:t.kind,ringCssPx:t.ringCssPx??(t.kind==="circle"?2:1)*r,shaderScale:t.shaderScale??(t.kind==="circle"?Zt:Jt)*r,opacityMul:t.opacityMul??1,visible:!0,paused:t.paused??!1,everCopied:!1,dpr:typeof window<"u"&&window.devicePixelRatio||1,scale:r,onAfterFrame:t.onAfterFrame,onFirstCopy:t.onFirstCopy};return ae(o),e.instances.add(o),e.rafId===0&&e.pausedAtMs===null&&nt(),o}function Ke(t){if(!s)return;s.instances.delete(t);const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1),s.instances.size===0&&(oe(),Qe())}function Je(t){s&&(s.glowQueue.includes(t)||s.glowQueue.push(t))}function Ze(t){if(!s)return;const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1)}function rt(t,e){let a=!1;e.cssWidth!==void 0&&e.cssWidth!==t.cssWidth&&(t.cssWidth=e.cssWidth,a=!0),e.cssHeight!==void 0&&e.cssHeight!==t.cssHeight&&(t.cssHeight=e.cssHeight,a=!0),e.cornerRadius!==void 0&&(t.cornerRadius=e.cornerRadius),e.scale!==void 0&&(t.scale=e.scale),e.kind!==void 0&&e.kind!==t.kind&&(t.kind=e.kind,e.shaderScale===void 0&&(t.shaderScale=(e.kind==="circle"?Zt:Jt)*t.scale),e.ringCssPx===void 0&&(t.ringCssPx=(e.kind==="circle"?2:1)*t.scale)),e.shaderScale!==void 0&&(t.shaderScale=e.shaderScale),e.ringCssPx!==void 0&&(t.ringCssPx=e.ringCssPx),e.opacityMul!==void 0&&(t.opacityMul=e.opacityMul),e.paused!==void 0&&e.paused!==t.paused&&(t.paused=e.paused,!e.paused&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()),a&&ae(t)}function ta(t,e){t.visible=e,e&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()}function ea(t,e){const a=te();a.preset=Xt[t].modes[e],a.presetDirty=!0}let wt=null;function aa(t){wt=t}function ae(t){t.dpr=typeof window<"u"&&window.devicePixelRatio||1;const e=Math.max(1,Math.round(t.cssWidth*t.dpr)),a=Math.max(1,Math.round(t.cssHeight*t.dpr));t.canvas.width!==e&&(t.canvas.width=e),t.canvas.height!==a&&(t.canvas.height=a)}function ra(t){const{ctx:e,dpr:a,canvas:r}=t,o=t.ringCssPx*a,n=r.width,i=r.height,u=Math.max(0,(t.cornerRadius-t.ringCssPx)*a);e.save(),e.globalCompositeOperation="destination-out",e.fillStyle="#000",e.beginPath(),e.roundRect(o,o,n-2*o,i-2*o,u),e.fill(),e.restore()}function oa(t){var e;if(!s)return;const a=s.frameBitmap??s.glCanvas,r=t.dpr,o=t.canvas.width,n=t.canvas.height;if(o<1||n<1)return;const i=s.glCanvas.width,u=s.glCanvas.height,l=Yt*r,c=Kt*r;let h=o*(i/l)/t.shaderScale,f=n*(u/c)/t.shaderScale;h>i&&(h=i),f>u&&(f=u);const d=Math.max(0,(i-h)/2),g=Math.max(0,(u-f)/2);if(t.ctx.clearRect(0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=t.opacityMul),t.ctx.drawImage(a,d,g,h,f,0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=1),ra(t),t.onFirstCopy){const x=t.onFirstCopy;t.onFirstCopy=void 0,x()}(e=t.onAfterFrame)==null||e.call(t)}function na(){if(!s)return;const{gl:t,uniforms:e,preset:a,glCanvas:r}=s;e.u_resolution&&t.uniform2f(e.u_resolution,r.width,r.height);for(let o=0;o<7;o++){const n=e[`u_color${o+1}`];if(n){const[u,l,c]=$e(a.colors[o]);t.uniform3f(n,u,l,c)}const i=e[`u_alpha${o+1}`];i&&t.uniform1f(i,a.alphas[o])}e.u_intensity&&t.uniform1f(e.u_intensity,a.intensity),e.u_scale&&t.uniform1f(e.u_scale,a.scale),e.u_direction&&t.uniform1f(e.u_direction,a.direction*Math.PI/180),e.u_softness&&t.uniform1f(e.u_softness,a.softness),e.u_distortion&&t.uniform1f(e.u_distortion,a.distortion),e.u_complexity&&t.uniform1f(e.u_complexity,a.complexity),e.u_shape&&t.uniform1f(e.u_shape,a.shape),e.u_vignette&&t.uniform1f(e.u_vignette,a.vignette),e.u_vigOpacity&&t.uniform1f(e.u_vigOpacity,a.vigOpacity),e.u_blur&&t.uniform1f(e.u_blur,a.blur),e.u_shaderOpacity&&t.uniform1f(e.u_shaderOpacity,a.shaderOpacity),s.presetDirty=!1}function ia(t){if(!s)return;const{gl:e,uniforms:a,preset:r,glCanvas:o}=s,n=(t-s.startMs-s.pausedMs)/1e3*r.speed;e.viewport(0,0,o.width,o.height),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),s.presetDirty&&na(),a.u_time&&e.uniform1f(a.u_time,n),e.drawArrays(e.TRIANGLES,0,6),s.frameCount++}let Pt=0;function re(t){var e;if(!s)return;if(s.contextLost){s.rafId=0;return}let a=!1;for(const r of s.instances)if(r.visible&&(!r.paused||!r.everCopied)){a=!0;break}if(!a){s.rafId=0;return}if(s.rafId=requestAnimationFrame(re),!(t-Pt<Ie)){Pt=t,ia(t),s.useOffscreen&&(s.glowQueue.length>0&&dt(),(e=s.frameBitmap)==null||e.close(),s.frameBitmap=s.glCanvas.transferToImageBitmap());for(const r of s.instances)r.visible&&(r.paused&&r.everCopied||(oa(r),r.everCopied=!0));if(wt&&s.glowQueue.length>0&&++s.glowSkip%Ae===0){const r=s.glowQueue;s.glowIdx>=r.length&&(s.glowIdx=0);const o=r[s.glowIdx];o.visible&&!o.paused&&wt(o,t),s.glowIdx++}}}function nt(){!s||s.rafId!==0||(s.rafId=requestAnimationFrame(re))}function oe(){s&&(s.rafId!==0&&cancelAnimationFrame(s.rafId),s.rafId=0)}const lt={linear:t=>t,smoothstep:t=>t*t*(3-2*t)};function J(t,e,a,r=lt.linear){return{from:t,to:e,dur:a,ease:r,startMs:-1,val:t,done:!1}}function Z(t,e){t.startMs=e,t.val=t.from,t.done=!1}function At(t,e){if(t.done||t.startMs<0)return t.val;const a=Math.min(1,(e-t.startMs)/t.dur);return t.val=t.from+(t.to-t.from)*t.ease(a),a>=1&&(t.done=!0),t.val}const sa=1.5,it=1/3,la=4*it,ca=2*it,da=2*it,ua=1.35*it,ha=13*it;function Mt(t,e,a){const r=Math.max(0,Math.min(a,Math.min(t,e)/2));return 2*Math.max(0,t-2*r)+2*Math.max(0,e-2*r)+2*Math.PI*r}function _t(t,e,a,r){return r==="circle"?2*Math.PI*Math.max(0,Math.min(a,Math.min(t,e)/2)):Mt(t,e,a)}function ot(t,e,a,r,o,n,i,u){const l=u||{x:0,y:0},c=Math.max(0,Math.min(r,Math.min(e,a)/2));if(i==="circle"){const b=2*Math.PI*c;if(b<=1e-4)return l.x=e*.5,l.y=a*.5,l;t=(t%b+b)%b;const P=-Math.PI/2+t/b*Math.PI*2,j=Math.max(0,c-o+n);return l.x=e*.5+j*Math.cos(P),l.y=a*.5+j*Math.sin(P),l}const h=Math.max(0,e-2*c),f=Math.max(0,a-2*c),d=Math.PI*c/2,g=2*(h+f)+4*d;t=(t%g+g)%g;const x=Math.max(0,c-o+n);let m=t;if(m<h)return l.x=c+m,l.y=o-n,l;if(m-=h,m<d){const b=-Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=e-o+n,l.y=c+m,l;if(m-=f,m<d){const b=(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<h)return l.x=e-c-m,l.y=a-o+n,l;if(m-=h,m<d){const b=Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=o-n,l.y=a-c-m,l;m-=f;const F=Math.PI+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(F),l.y=c+x*Math.sin(F),l}function jt(t,e){const a=t*2/e;let r="";for(let o=0;o<=e;o++){const n=-t+o*a;r+=(o===0?"M ":"L ")+n.toFixed(3)+" 0 "}return r}const ft={x:0,y:0},pt={x:0,y:0};function fa(t,e,a,r,o,n){return ot(t-.1,e,a,r,o,0,n,ft),ot(t+.1,e,a,r,o,0,n,pt),Math.atan2(pt.y-ft.y,pt.x-ft.x)}function Et(t,e,a){const r=Math.max(0,Math.min(1,(a-t)/(e-t)));return r*r*(3-2*r)}function pa(t){const e=_t(t.width,t.height,t.cornerRadius,t.kind),a=sa*(t.scale??1),r=[];for(let o=0;o<$t;o++){const n=o/$t*e,i=ot(n,t.width,t.height,t.cornerRadius,a,0,t.kind);r.push({x:i.x,y:i.y,arc:n})}return r}function ma(t,e){const{width:a,height:r,cornerRadius:o}=t,n=t.scale??1,i=t.kind==="circle"?2:1,u=Math.max(0,o-i),l=(-200*n).toFixed(0),c=l,h=(540*n).toFixed(0),f=(440*n).toFixed(0),d=`x="${l}" y="${c}" width="${h}" height="${f}"`,g=`${d} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`,x=F=>(F*n).toFixed(3),m=F=>(F*n).toFixed(3);return["<defs>",`<filter id="${e}_bXl" ${g}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,`<filter id="${e}_bLg" ${g}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,`<filter id="${e}_bMd" ${g}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,`<filter id="${e}_bSm" ${g}><feGaussianBlur stdDeviation="${m(.9)}"/></filter>`,`<filter id="${e}_ebO" ${g}><feGaussianBlur stdDeviation="${m(da)}"/></filter>`,`<filter id="${e}_ebC" ${g}><feGaussianBlur stdDeviation="${m(ua)}"/></filter>`,`<radialGradient id="${e}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,`<mask id="${e}_fm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="black"/><circle id="${e}_fc" cx="0" cy="0" r="${(ha*n).toFixed(3)}" fill="url(#${e}_fg)"/></mask>`,`<mask id="${e}_rm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="#808080"/><rect x="0" y="0" width="${a}" height="${r}" rx="${o}" ry="${o}" fill="white"/><rect x="${i}" y="${i}" width="${a-i*2}" height="${r-i*2}" rx="${u}" ry="${u}" fill="black"/></mask>`,"</defs>",`<g id="${e}_h" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g id="${e}_hI" stroke="white">`,`<path id="${e}_pXl" stroke-width="${x(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${e}_bXl)"/>`,`<path id="${e}_pLg" stroke-width="${x(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${e}_bLg)"/>`,`<path id="${e}_pMd" stroke-width="${x(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bMd)"/>`,`<path id="${e}_pSm" stroke-width="${x(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bSm)"/>`,"</g></g>",`<g id="${e}_e" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g mask="url(#${e}_fm)">`,`<g id="${e}_eI" stroke="white">`,`<path id="${e}_eO" stroke-width="${x(la)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${e}_ebO)"/>`,`<path id="${e}_eC" stroke-width="${x(ca)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${e}_ebC)"/>`,"</g></g></g>"].join("")}const xa=.00875,Lt=.08,Nt=.32,ga=.05,va=3e3,Wt=.85,st=.34,mt=1500,ba=15,wa=.0075,ya=120,ka=1.5,Ma=7.8,_a=9.13952,Ca=1,Sa=1/3,Ta=.8,$a=3.51,Bt=2e3,xt=400,Ra=2.625,Fa=1.008,Ia=.31,ne=140,ie=40,se=20;let Oa=0;const q={x:0,y:0};function zt(t,e){const a=`mfxg_${++Oa}`,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","metal-fx-glow-svg"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e.width} ${e.height}`),r.innerHTML=ma(e,a),t.appendChild(r);const o=b=>r.querySelector(`#${a}_${b}`),n=o("h"),i=o("hI"),u=o("e"),l=o("eI"),c=o("fc"),h=_t(e.width,e.height,e.cornerRadius,e.kind)/Mt(ne,ie,se),f=Math.max(1,Ma*h),d=Math.max(.6,_a*Sa*h),g=jt(f,je),x=jt(d,Ee),m=[o("pXl"),o("pLg"),o("pMd"),o("pSm")],F=[o("eO"),o("eC")];for(const b of m)b.setAttribute("d",g);for(const b of F)b.setAttribute("d",x);return i.style.transformOrigin="0 0",l.style.transformOrigin="0 0",i.style.willChange="transform",l.style.willChange="transform",i.style.transition="transform 100ms linear",l.style.transition="transform 100ms linear",n.style.willChange="opacity",u.style.willChange="opacity",n.style.transition="opacity 100ms linear",u.style.transition="opacity 100ms linear",c.style.willChange="transform",{svg:r,haloGroup:n,haloInner:i,extraGroup:u,extraInner:l,fadeCircle:c,width:e.width,height:e.height,cornerRadius:e.cornerRadius,kind:e.kind,scale:e.scale??1,perim:pa(e),currentIdx:0,appearedAt:0,glowOpacity:0,relocTween:null,relocNextIdx:-1,wanderS:0,wanderTargetS:0,wanderFrames:0,tintFrom:{r:255,g:255,b:255},tintTarget:{r:255,g:255,b:255},tintTween:null,tintHoldUntil:0,lastHaloStroke:"",lastExtraStroke:""}}function Pa(t,e,a,r,o="dark"){var n;const{width:i,height:u,cornerRadius:l,perim:c}=t;if(c.length===0)return;const h=2;let f=-1,d=t.currentIdx,g=0;for(let v=0;v<c.length;v++){const M=c[v],S=Ot(e,M.x,M.y,h);S>f&&(f=S,d=v),v===t.currentIdx&&(g=S)}const x=t.appearedAt>0&&a-t.appearedAt<va,m=st+(Wt-st)*Et(Lt,Nt,g),F=!x&&f-g>ga;if(!t.relocTween||t.relocTween.done)if(t.appearedAt===0)t.currentIdx=d,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0,t.relocTween=J(0,m,mt,lt.smoothstep),Z(t.relocTween,a);else if((n=t.relocTween)!=null&&n.done&&t.relocTween.to===0){t.currentIdx=t.relocNextIdx,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0;const v=c[t.currentIdx],M=Ot(e,v.x,v.y,h),S=st+(Wt-st)*Et(Lt,Nt,M);t.relocTween=J(0,S,mt,lt.smoothstep),Z(t.relocTween,a)}else F?(t.relocNextIdx=d,t.relocTween=J(t.glowOpacity,0,mt,lt.smoothstep),Z(t.relocTween,a)):t.glowOpacity+=(m-t.glowOpacity)*xa;t.relocTween&&(t.glowOpacity=At(t.relocTween,a)),t.glowOpacity=Math.max(0,Math.min(1,t.glowOpacity));const b=_t(i,u,l,t.kind)/Mt(ne,ie,se),P=ba*b;t.wanderFrames++>=ya&&(t.wanderTargetS=(Math.random()*2-1)*P,t.wanderFrames=0),t.wanderS+=(t.wanderTargetS-t.wanderS)*wa;const j=c[t.currentIdx].arc+t.wanderS,L=ka*t.scale;ot(j,i,u,l,L,0,t.kind,q);const C=q.x,E=q.y,z=fa(j,i,u,l,L,t.kind),X=`translate(${C.toFixed(3)}px,${E.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`;t.haloInner.style.transform=X;const N=Ca*b*t.scale;ot(j,i,u,l,L,N,t.kind,q),t.extraInner.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`,t.fadeCircle.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px)`;const $=o==="light",k=$?Xe(e,C,E,h):Ve(e,C,E,h);t.tintTween?t.tintTween.done&&($?(t.tintFrom={r:t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*t.tintTween.val,g:t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*t.tintTween.val,b:t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*t.tintTween.val},t.tintTarget={...k},t.tintTween=J(0,1,xt),Z(t.tintTween,a)):a>=t.tintHoldUntil&&(t.tintFrom={...t.tintTarget},t.tintTarget={...k},t.tintTween=J(0,1,xt),Z(t.tintTween,a),t.tintHoldUntil=a+Bt)):(t.tintFrom={...k},t.tintTarget={...k},t.tintTween=J(0,1,xt),Z(t.tintTween,a),t.tintHoldUntil=$?0:a+Bt),At(t.tintTween,a);const I=t.tintTween.val;let W,B,H;if($)W=Math.round(t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I),B=Math.round(t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I),H=Math.round(t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I);else{const v=t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I,M=t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I,S=t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I,O=Math.max(v,M,S)||1;W=Math.round(255*(v/O)),B=Math.round(255*(M/O)),H=Math.round(255*(S/O))}const y=`rgb(${W},${B},${H})`;if(y!==t.lastHaloStroke&&(t.lastHaloStroke=y,t.haloInner.style.stroke=y),$){const v=Re(W,B,H),[M,S,O]=Fe(v[0],Math.min(1,v[1]*Ra),Math.max(Ia,v[2]*Fa)),D=`rgb(${M},${S},${O})`;D!==t.lastExtraStroke&&(t.lastExtraStroke=D,t.extraInner.style.stroke=D)}else t.lastExtraStroke!=="#ffffff"&&(t.lastExtraStroke="#ffffff",t.extraInner.style.stroke="#ffffff");const w=Math.max(0,Math.min(1,r));t.haloGroup.style.opacity=(t.glowOpacity*Ta*w).toFixed(3),t.extraGroup.style.opacity=Math.min(1,t.glowOpacity*$a*w).toFixed(3)}const yt=12,Ht=32,Gt=1,Dt=.55,Aa=1,ja=1,Ea=.85,La=0,Na=1.3,Ut=3.6,Wa=.7,Ba=1,za=.52,Ha=1,Ga=.044,Da=235,Ua=2.535,qa=.7,Qa=.5,Va=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function Xa(t,e){const a=Math.max(t.left-e.right,e.left-t.right,0),r=Math.max(t.top-e.bottom,e.top-t.bottom,0);return Math.sqrt(a*a+r*r)}function Ya(t,e,a,r){return!(Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top)<a||Math.max(t.left-e.right,e.left-t.right,0)>r)}function Ka(t,e,a,r){return Math.min(t.right,e.right)-Math.max(t.left,e.left)<a?!1:Math.max(t.top-e.bottom,e.top-t.bottom,0)<=r}function V(t,e,a,r,o,n){const i=Math.max(0,Math.min(n,r*.5,o*.5)),u=t.roundRect;if(typeof u=="function"){u.call(t,e,a,r,o,i);return}t.moveTo(e+i,a),t.lineTo(e+r-i,a),t.quadraticCurveTo(e+r,a,e+r,a+i),t.lineTo(e+r,a+o-i),t.quadraticCurveTo(e+r,a+o,e+r-i,a+o),t.lineTo(e+i,a+o),t.quadraticCurveTo(e,a+o,e,a+o-i),t.lineTo(e,a+i),t.quadraticCurveTo(e,a,e+i,a)}function le(t,e,a,r,o){if(!o.flipX&&!o.flipY){t.drawImage(e,0,0,a,r,o.x,o.y,o.w,o.h);return}t.save(),o.flipX&&(t.translate(o.x+o.w,0),t.scale(-1,1)),o.flipY&&(t.translate(0,o.y+o.h),t.scale(1,-1)),t.drawImage(e,0,0,a,r,o.flipX?0:o.x,o.flipY?0:o.y,o.w,o.h),t.restore()}const Ja=4;function Za(t,e,a,r,o,n,i){if(r<=2*i||o<=2*i){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+i,a+i,r-2*i,o-2*i,Math.max(0,n-i)),t.clip("evenodd")}function tr(t,e,a,r,o,n,i,u,l,c,h){const f=Math.max(1,Math.round((yt+Ja*3)*h));let d=Math.max(0,i),g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),Za(t,c.x,c.y,c.w,c.h,c.r,f),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,l),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=u,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ce(t,e,a,r,o,n,i){const u=i|0;if(u<1||r<=2*u||o<=2*u){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+u,a+u,r-2*u,o-2*u,Math.max(0,n-u)),t.clip("evenodd")}function er(t,e,a,r,o,n,i,u,l,c,h,f){let d=u*h,g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),ce(t,i.x,i.y,i.w,i.h,i.r,l),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,f),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=c,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ar(t,e,a,r,o,n,i,u){const l=t.createLinearGradient(r,o,n,i);l.addColorStop(0,`rgba(255,255,255,${u.toFixed(3)})`),l.addColorStop(.5,`rgba(255,255,255,${(u*.45).toFixed(3)})`),l.addColorStop(1,"rgba(255,255,255,0)"),t.save(),ce(t,e.x,e.y,e.w,e.h,e.r,a),t.globalCompositeOperation="lighter",t.lineWidth=a*2,t.strokeStyle=l,t.beginPath(),V(t,e.x,e.y,e.w,e.h,e.r),t.stroke(),t.restore()}function de(t){const e=getComputedStyle(t),a=[parseFloat(e.borderTopLeftRadius)||0,parseFloat(e.borderTopRightRadius)||0,parseFloat(e.borderBottomRightRadius)||0,parseFloat(e.borderBottomLeftRadius)||0].filter(r=>r>0);return a.length?Math.min.apply(null,a):0}function ue(t){const e=getComputedStyle(t),a=Math.max(parseFloat(e.borderTopWidth)||0,parseFloat(e.borderRightWidth)||0,parseFloat(e.borderBottomWidth)||0,parseFloat(e.borderLeftWidth)||0);let r=0,o=0;const n=e.boxShadow;if(n&&n!=="none"){const u=n.replace(/rgba?\([^)]*\)/g,h=>h.replace(/,/g,"\0")).split(/,\s*/);let l=1/0,c=1/0;for(const h of u){const f=h.match(/-?\d+(?:\.\d+)?px/g);if(!f||f.length<4)continue;const d=parseFloat(f[3]);d>0&&(/\binset\b/.test(h)?d<l&&(l=d):d<c&&(c=d))}Number.isFinite(l)&&(r=l),Number.isFinite(c)&&(o=c)}const i=Math.max(a,o);return{width:Math.max(a,r,o)||1,outerCssPx:i}}function qt(t){t.cornerRadius=de(t.el);const e=ue(t.el);t.hairlineWidth=e.width,t.hairlineOuterCssPx=e.outerCssPx}function rr(t){typeof ResizeObserver<"u"&&(t.resizeObserver=new ResizeObserver(()=>qt(t)),t.resizeObserver.observe(t.el)),typeof MutationObserver<"u"&&(t.mutationObserver=new MutationObserver(()=>qt(t)),t.mutationObserver.observe(t.el,{attributes:!0,attributeFilter:["style","class"]}))}function or(t){var e,a;(e=t.resizeObserver)==null||e.disconnect(),t.resizeObserver=null,(a=t.mutationObserver)==null||a.disconnect(),t.mutationObserver=null}const tt=new Set;function nr(t,e,a){if(typeof document>"u"||Va.has(t.tagName))return null;for(const g of tt)if(g.el===t)return g;const r=document.createElement("div");r.setAttribute("data-metal-fx-reflection",""),r.setAttribute("aria-hidden","true");const o=document.createElement("canvas");o.className="metal-fx-reflection-canvas";const n=o.getContext("2d",{alpha:!0});if(!n)return null;const i=document.createElement("canvas");i.className="metal-fx-reflection-stroke-canvas";const u=i.getContext("2d",{alpha:!0});if(!u)return null;r.appendChild(o),r.appendChild(i);const l=getComputedStyle(t);let c=!1;l.position==="static"&&(t.style.position="relative",c=!0);let h=!1;l.isolation!=="isolate"&&(t.style.isolation="isolate",h=!0),t.setAttribute("data-metal-fx-reflect-host",""),t.insertBefore(r,t.firstChild);const f=ue(t),d={el:t,anchor:e,anchorEl:a,wrap:r,canvas:o,ctx:n,strokeCanvas:i,strokeCtx:u,cornerRadius:de(t),hairlineWidth:f.width,hairlineOuterCssPx:f.outerCssPx,appliedPositionRelative:c,appliedIsolation:h,resizeObserver:null,mutationObserver:null};return rr(d),tt.add(d),d}function ir(t){for(const e of tt)if(e.el===t){or(e),e.canvas.width=0,e.canvas.height=0,e.strokeCanvas.width=0,e.strokeCanvas.height=0,e.wrap.parentNode===e.el&&e.el.removeChild(e.wrap),e.el.removeAttribute("data-metal-fx-reflect-host"),e.appliedPositionRelative&&(e.el.style.position=""),e.appliedIsolation&&(e.el.style.isolation=""),tt.delete(e);return}}function sr(){if(tt.size===0)return;const t=typeof window<"u"&&window.devicePixelRatio||1,e=new Map;for(const a of tt){const r=a.el.getBoundingClientRect();let o=e.get(a.anchorEl);if(o||(o=a.anchorEl.getBoundingClientRect(),e.set(a.anchorEl,o)),r.width<1||r.height<1||o.width<1||o.height<1)continue;if(!Ya(o,r,Gt,Ht)&&!Ka(o,r,Gt,Ht)){a.canvas.width!==1&&(a.canvas.width=1,a.canvas.height=1),a.strokeCanvas.width!==1&&(a.strokeCanvas.width=1,a.strokeCanvas.height=1);continue}const n=a.anchor.canvas,i=n.width|0,u=n.height|0;if(i<4||u<4)continue;const l=(o.left+o.right)*.5,c=(o.top+o.bottom)*.5,h=(r.left+r.right)*.5,f=(r.top+r.bottom)*.5,d=l-h,g=c-f,x=Math.max(o.left-r.right,r.left-o.right,0),m=Math.max(o.top-r.bottom,r.top-o.bottom,0),F=x>=m,b=Xa(o,r);let P=1-Math.min(1,b/yt);P=P*P*(3-2*P);const j=Dt+(Aa-Dt)*P,L=Math.min(Ut,j*Na*Wa),C=a.anchor.scale??1,E=Math.max(Ba*C,a.hairlineWidth),z=Math.max(1,Math.round(E*t)),X=Math.max(1,Math.round(Math.max(Ha*C,a.hairlineWidth)*t)),N=a.hairlineOuterCssPx;a.wrap.style.inset=`${-N}px`,a.wrap.style.borderRadius=`${Math.max(0,a.cornerRadius)}px`;const $=Math.max(1,Math.round((r.width+N*2)*t)),k=Math.max(1,Math.round((r.height+N*2)*t));a.canvas.width!==$&&(a.canvas.width=$),a.canvas.height!==k&&(a.canvas.height=k),a.strokeCanvas.width!==$&&(a.strokeCanvas.width=$),a.strokeCanvas.height!==k&&(a.strokeCanvas.height=k);const I=a.ctx;I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,$,k);const W=a.strokeCtx;W.setTransform(1,0,0,1,0,0),W.clearRect(0,0,$,k);const B=Math.min(yt*t,Math.max($,k));let H,y,w,v;F?(H=d>0?$:0,w=d>0?$-B:B,y=k*.5,v=k*.5):(y=g>0?k:0,v=g>0?k-B:B,H=$*.5,w=$*.5);const M=I.createLinearGradient(H,y,w,v);M.addColorStop(0,`rgba(0,0,0,${ja})`),M.addColorStop(.5,`rgba(0,0,0,${Ea})`),M.addColorStop(1,`rgba(0,0,0,${La})`);const S=i/t,O=Math.max(1,Math.round(Da*Math.max(.1,S/140)*t));let D,U,T,A,Q=!1,Ct=!1;if(F){const at=Math.max(o.top,r.top),ht=Math.min(o.bottom,r.bottom);Q=!0,D=d>0?$-O:0,U=Math.round((at-r.top+N)*t),T=O,A=Math.max(1,Math.round((ht-at)*t))}else{const at=Math.max(o.left,r.left),ht=Math.min(o.right,r.right);Ct=!0,D=Math.round((at-r.left+N)*t),U=g>0?k-O:0,T=Math.max(1,Math.round((ht-at)*t)),A=O}const St={x:D,y:U,w:T,h:A,flipX:Q,flipY:Ct},ut={x:0,y:0,w:$,h:k,r:Math.max(0,a.cornerRadius*t)},me=Math.min(Ut,L*Ua*qa*Qa);tr(I,n,i,u,$,k,me,M,St,ut,t),er(W,n,i,u,$,k,ut,L,z,M,za,St),ar(W,ut,X,H,y,w,v,Math.min(.85,Ga*L)),I.globalCompositeOperation="source-over",W.globalCompositeOperation="source-over"}}let gt=!1,Qt=0;function lr(){gt||(gt=!0,!(typeof requestAnimationFrame>"u")&&requestAnimationFrame(t=>{gt=!1,!(t-Qt<Oe)&&(Qt=t,sr())}))}const Vt="metal-fx-styles",cr=`
189
189
  .metal-fx-root {
190
190
  position: relative;
191
191
  display: inline-flex;
@@ -418,4 +418,4 @@ import{r as _,j as p,_ as xe,a1 as ge,a2 as ve,aI as be,L as Tt,aJ as we,N as Y,
418
418
  [data-metal-fx-reflect-host] {
419
419
  isolation: isolate;
420
420
  }
421
- `;let vt=!1;function dr(){if(vt||typeof document>"u")return;if(document.getElementById(Vt)){vt=!0;return}const t=document.createElement("style");t.id=Vt,t.textContent=cr,document.head.appendChild(t),vt=!0}dr();const ur={position:"absolute",inset:0,width:"100%",height:"100%"},hr={position:"absolute",inset:3},fr={position:"absolute",inset:0,pointerEvents:"none",zIndex:3,borderRadius:"inherit"},ct=new Map;aa((t,e)=>{const a=ct.get(t);a&&Pa(a.handles,t,e,t.opacityMul,a.themeRef.current)});function pr(t){const[e,a]=_.useState(()=>t!=="auto"?t:typeof window>"u"||!window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return _.useEffect(()=>{if(t!=="auto"){a(t);return}if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches?"dark":"light");return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),e}const he=_.forwardRef(function({children:t,variant:e="button",preset:a="chromatic",theme:r="auto",strength:o=1,paused:n=!1,borderRadius:i,normalizeHostStyles:u=!0,reflectionTargets:l,disableGlow:c=!1,shaderScale:h,ringCssPx:f,scale:d=1,className:g,style:x,...m},I){const b=_.useRef(null),P=_.useRef(null),j=_.useRef(null),L=_.useRef(null),C=_.useRef(null),E=_.useRef(null),z=_.useRef("dark"),X=_.useRef(0),[N,$]=_.useState(!1),k=pr(r);z.current=k;const F=e==="circle"?"circle":"pill",W=!c;_.useImperativeHandle(I,()=>b.current,[]);const B=(y,w)=>{if(F==="circle")return Math.min(y,w)/2;const v=typeof i=="number"?i:(()=>{var M;const S=(M=L.current)==null?void 0:M.firstElementChild;if(S){const O=parseFloat(getComputedStyle(S).borderTopLeftRadius);if(Number.isFinite(O)&&O>0)return O}return X.current})();return Math.min(v,Math.min(y,w)/2)};_.useEffect(()=>{ea(a,k)},[a,k]),_.useEffect(()=>{const y=C.current;y&&rt(y,{paused:n})},[n]),_.useEffect(()=>{const y=C.current;if(!y)return;const w={};h!==void 0&&(w.shaderScale=h),f!==void 0&&(w.ringCssPx=f),d!==void 0&&(w.scale=d),Object.keys(w).length>0&&rt(y,w)},[h,f,d]),_.useLayoutEffect(()=>{const y=P.current,w=b.current,v=j.current;if(!y||!w)return;{const T=getComputedStyle(w),A=parseFloat(T.borderTopLeftRadius);X.current=Number.isFinite(A)?A:0}const M=()=>{const T=w.getBoundingClientRect(),A=Math.max(1,Math.round(T.width)),Q=Math.max(1,Math.round(T.height));return{cssWidth:A,cssHeight:Q,cornerRadius:B(A,Q)}},S=M();C.current=Ye({hostCanvas:y,cssWidth:S.cssWidth,cssHeight:S.cssHeight,cornerRadius:S.cornerRadius,kind:F,paused:n,shaderScale:h,ringCssPx:f,scale:d,onFirstCopy:()=>$(!0)}),w.style.setProperty("--mfx-radius",`${S.cornerRadius}px`),w.style.borderRadius=`${S.cornerRadius}px`,v&&(E.current=zt(v,{width:S.cssWidth,height:S.cssHeight,cornerRadius:S.cornerRadius,kind:F,scale:d}));let O=0;const D=new ResizeObserver(()=>{O===0&&(O=requestAnimationFrame(()=>{O=0;const T=M(),A=C.current;A&&(rt(A,{cssWidth:T.cssWidth,cssHeight:T.cssHeight,cornerRadius:T.cornerRadius}),w.style.setProperty("--mfx-radius",`${T.cornerRadius}px`),w.style.borderRadius=`${T.cornerRadius}px`,v&&(v.innerHTML="",E.current=zt(v,{width:T.cssWidth,height:T.cssHeight,cornerRadius:T.cornerRadius,kind:F,scale:d}),A&&E.current&&ct.set(A,{handles:E.current,themeRef:z})))}))});D.observe(w);let U=null;return typeof IntersectionObserver<"u"&&(U=new IntersectionObserver(T=>{const A=C.current;if(A)for(const Q of T)ta(A,Q.isIntersecting)},{rootMargin:"64px"}),U.observe(w)),C.current&&E.current&&(ct.set(C.current,{handles:E.current,themeRef:z}),Ke(C.current)),()=>{D.disconnect(),U?.disconnect(),O!==0&&cancelAnimationFrame(O);const T=C.current;T&&(ct.delete(T),Ze(T),Je(T)),C.current=null,E.current=null,v&&(v.innerHTML="")}},[F]),_.useEffect(()=>{const y=C.current;y&&rt(y,{opacityMul:Math.max(0,Math.min(1,o))})},[o,e]),_.useEffect(()=>{const y=C.current,w=b.current;if(!y||!w||!l||k!=="dark")return;y.onAfterFrame=lr;const v=l.flatMap(M=>M.current?[M.current]:[]);for(const M of v)nr(M,y,w);return()=>{y.onAfterFrame=void 0;for(const M of v)ir(M)}},[l,k]),_.useEffect(()=>{const y=b.current,w=C.current;if(!y||!w)return;const v=B(w.cssWidth,w.cssHeight);rt(w,{cornerRadius:v}),y.style.setProperty("--mfx-radius",`${v}px`),y.style.borderRadius=`${v}px`},[i,k,e,F]);const H=_.useMemo(()=>({...x,"--mfx-strength":String(Math.min(1,Math.max(0,o))),opacity:N?1:0,visibility:N?"visible":"hidden",transition:N?"opacity 0.15s ease-out":"none"}),[x,o,N]);return p.jsxs("div",{...m,ref:b,className:g?`metal-fx-root ${g}`:"metal-fx-root","data-variant":e,"data-shape":F,"data-theme":k,"data-paused":n?"true":void 0,"data-normalize":u?"true":"false",style:H,children:[p.jsx("canvas",{ref:P,className:"metal-fx-canvas",style:ur}),p.jsx("div",{className:"metal-fx-inner","aria-hidden":"true",style:hr}),p.jsx("div",{ref:j,"aria-hidden":"true",style:{...fr,display:W?void 0:"none"}}),p.jsx("div",{ref:L,className:"metal-fx-content",children:t})]})});he.displayName="MetalFx";const et=18;function fe(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.jsx("path",{d:"M12 2v2"}),p.jsx("path",{d:"M12 20v2"}),p.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),p.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),p.jsx("path",{d:"M2 12h2"}),p.jsx("path",{d:"M20 12h2"}),p.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),p.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function pe(){return p.jsx("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function mr(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),p.jsx("path",{d:"M8 21h8"}),p.jsx("path",{d:"M12 17v4"})]})}const xr=[{value:"light",label:"Light",Icon:fe},{value:"dark",label:"Dark",Icon:pe},{value:"system",label:"System",Icon:mr}];function gr(t){return t==="dark"?pe:fe}function vr({theme:t,resolvedTheme:e,onSetTheme:a,className:r="",direction:o="down",align:n="right"}){const[i,u]=_.useState(!1),l=_.useRef(null),c=_.useCallback(()=>u(!1),[]);_.useEffect(()=>{if(!i)return;const f=d=>{l.current&&!l.current.contains(d.target)&&c()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i,c]),_.useEffect(()=>{if(!i)return;const f=d=>{d.key==="Escape"&&c()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,c]);const h=gr(e);return p.jsxs("div",{ref:l,className:`relative ${r}`,children:[p.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,onClick:()=>u(f=>!f),className:"flex items-center justify-center w-9 h-9 rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors",children:p.jsx(h,{})}),i&&p.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${o==="up"?"bottom-full mb-1":"top-full mt-1"} ${n==="left"?"left-0":"right-0"}`,children:xr.map(({value:f,label:d,Icon:g})=>{const x=t===f;return p.jsxs("button",{type:"button",onClick:()=>{a(f),c()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${x?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[p.jsx(g,{}),p.jsx("span",{children:d})]},f)})})]})}const br="https://github.com/mm7894215/TokenTracker/releases/latest";function Pr({auth:t,signedIn:e,sessionSoftExpired:a,userId:r}){const{currency:o,rate:n}=ke(),{theme:i,resolvedTheme:u,setTheme:l}=xe(),{openLoginModal:c}=ge(),{signedIn:h,loading:f}=ve(),d=!be(),g=e&&!a,x=_.useMemo(()=>g&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,g]),m=_e({userId:r,period:"total",accessToken:x});return p.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[p.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:p.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(Tt,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[p.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),p.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),p.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:p.jsx(Me,{})})]}),p.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[p.jsxs(Tt,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[p.jsx(we,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),p.jsx("span",{children:Y("leaderboard.profile.nav.back")})]}),d&&p.jsx(he,{variant:"button",preset:"chromatic",theme:"dark",borderRadius:9999,disableGlow:!0,className:"!bg-black",children:p.jsxs("a",{href:br,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex h-8 items-center gap-1.5 px-3 text-xs font-bold rounded-full bg-black text-white transition-transform duration-200 active:scale-[0.98]",children:[p.jsx(Te,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),p.jsx("span",{className:"hidden sm:inline",children:Y("leaderboard.profile.nav.download")})]})}),f?p.jsx("div",{className:"h-8 w-16 animate-pulse rounded-full bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):h?p.jsx(ye,{}):p.jsx("button",{type:"button",onClick:c,className:"inline-flex h-8 min-w-[76px] items-center justify-center px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm select-none",children:Y("header.auth.sign_in_aria")})]})]})}),p.jsx("main",{className:"flex-1 px-4 pt-4 pb-10 sm:pt-6 sm:pb-16",children:p.jsx("div",{className:"mx-auto max-w-3xl",children:p.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[m.loading&&p.jsx(Ce,{variant:"page"}),!m.loading&&m.error&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:Y("leaderboard.profile_modal.error")})}),!m.loading&&!m.error&&!m.data&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Y("leaderboard.profile_modal.empty")})}),!m.loading&&!m.error&&m.data&&p.jsx(Se,{data:m.data,currency:o,rate:n,variant:"page"})]})})}),p.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 px-4 transition-colors duration-200",children:p.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[p.jsx("p",{children:Y("landing.v2.footer.line")}),p.jsx(vr,{theme:i,resolvedTheme:u,onSetTheme:l,direction:"up",align:"right"})]})})]})}export{Pr as LeaderboardProfilePage};
421
+ `;let vt=!1;function dr(){if(vt||typeof document>"u")return;if(document.getElementById(Vt)){vt=!0;return}const t=document.createElement("style");t.id=Vt,t.textContent=cr,document.head.appendChild(t),vt=!0}dr();const ur={position:"absolute",inset:0,width:"100%",height:"100%"},hr={position:"absolute",inset:3},fr={position:"absolute",inset:0,pointerEvents:"none",zIndex:3,borderRadius:"inherit"},ct=new Map;aa((t,e)=>{const a=ct.get(t);a&&Pa(a.handles,t,e,t.opacityMul,a.themeRef.current)});function pr(t){const[e,a]=_.useState(()=>t!=="auto"?t:typeof window>"u"||!window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return _.useEffect(()=>{if(t!=="auto"){a(t);return}if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches?"dark":"light");return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),e}const he=_.forwardRef(function({children:t,variant:e="button",preset:a="chromatic",theme:r="auto",strength:o=1,paused:n=!1,borderRadius:i,normalizeHostStyles:u=!0,reflectionTargets:l,disableGlow:c=!1,shaderScale:h,ringCssPx:f,scale:d=1,className:g,style:x,...m},F){const b=_.useRef(null),P=_.useRef(null),j=_.useRef(null),L=_.useRef(null),C=_.useRef(null),E=_.useRef(null),z=_.useRef("dark"),X=_.useRef(0),[N,$]=_.useState(!1),k=pr(r);z.current=k;const I=e==="circle"?"circle":"pill",W=!c;_.useImperativeHandle(F,()=>b.current,[]);const B=(y,w)=>{if(I==="circle")return Math.min(y,w)/2;const v=typeof i=="number"?i:(()=>{var M;const S=(M=L.current)==null?void 0:M.firstElementChild;if(S){const O=parseFloat(getComputedStyle(S).borderTopLeftRadius);if(Number.isFinite(O)&&O>0)return O}return X.current})();return Math.min(v,Math.min(y,w)/2)};_.useEffect(()=>{ea(a,k)},[a,k]),_.useEffect(()=>{const y=C.current;y&&rt(y,{paused:n})},[n]),_.useEffect(()=>{const y=C.current;if(!y)return;const w={};h!==void 0&&(w.shaderScale=h),f!==void 0&&(w.ringCssPx=f),d!==void 0&&(w.scale=d),Object.keys(w).length>0&&rt(y,w)},[h,f,d]),_.useLayoutEffect(()=>{const y=P.current,w=b.current,v=j.current;if(!y||!w)return;{const T=getComputedStyle(w),A=parseFloat(T.borderTopLeftRadius);X.current=Number.isFinite(A)?A:0}const M=()=>{const T=w.getBoundingClientRect(),A=Math.max(1,Math.round(T.width)),Q=Math.max(1,Math.round(T.height));return{cssWidth:A,cssHeight:Q,cornerRadius:B(A,Q)}},S=M();C.current=Ye({hostCanvas:y,cssWidth:S.cssWidth,cssHeight:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,paused:n,shaderScale:h,ringCssPx:f,scale:d,onFirstCopy:()=>$(!0)}),w.style.setProperty("--mfx-radius",`${S.cornerRadius}px`),w.style.borderRadius=`${S.cornerRadius}px`,v&&(E.current=zt(v,{width:S.cssWidth,height:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,scale:d}));let O=0;const D=new ResizeObserver(()=>{O===0&&(O=requestAnimationFrame(()=>{O=0;const T=M(),A=C.current;A&&(rt(A,{cssWidth:T.cssWidth,cssHeight:T.cssHeight,cornerRadius:T.cornerRadius}),w.style.setProperty("--mfx-radius",`${T.cornerRadius}px`),w.style.borderRadius=`${T.cornerRadius}px`,v&&(v.innerHTML="",E.current=zt(v,{width:T.cssWidth,height:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,scale:d}),A&&E.current&&ct.set(A,{handles:E.current,themeRef:z})))}))});D.observe(w);let U=null;return typeof IntersectionObserver<"u"&&(U=new IntersectionObserver(T=>{const A=C.current;if(A)for(const Q of T)ta(A,Q.isIntersecting)},{rootMargin:"64px"}),U.observe(w)),C.current&&E.current&&(ct.set(C.current,{handles:E.current,themeRef:z}),Je(C.current)),()=>{D.disconnect(),U?.disconnect(),O!==0&&cancelAnimationFrame(O);const T=C.current;T&&(ct.delete(T),Ze(T),Ke(T)),C.current=null,E.current=null,v&&(v.innerHTML="")}},[I]),_.useEffect(()=>{const y=C.current;y&&rt(y,{opacityMul:Math.max(0,Math.min(1,o))})},[o,e]),_.useEffect(()=>{const y=C.current,w=b.current;if(!y||!w||!l||k!=="dark")return;y.onAfterFrame=lr;const v=l.flatMap(M=>M.current?[M.current]:[]);for(const M of v)nr(M,y,w);return()=>{y.onAfterFrame=void 0;for(const M of v)ir(M)}},[l,k]),_.useEffect(()=>{const y=b.current,w=C.current;if(!y||!w)return;const v=B(w.cssWidth,w.cssHeight);rt(w,{cornerRadius:v}),y.style.setProperty("--mfx-radius",`${v}px`),y.style.borderRadius=`${v}px`},[i,k,e,I]);const H=_.useMemo(()=>({...x,"--mfx-strength":String(Math.min(1,Math.max(0,o))),opacity:N?1:0,visibility:N?"visible":"hidden",transition:N?"opacity 0.15s ease-out":"none"}),[x,o,N]);return p.jsxs("div",{...m,ref:b,className:g?`metal-fx-root ${g}`:"metal-fx-root","data-variant":e,"data-shape":I,"data-theme":k,"data-paused":n?"true":void 0,"data-normalize":u?"true":"false",style:H,children:[p.jsx("canvas",{ref:P,className:"metal-fx-canvas",style:ur}),p.jsx("div",{className:"metal-fx-inner","aria-hidden":"true",style:hr}),p.jsx("div",{ref:j,"aria-hidden":"true",style:{...fr,display:W?void 0:"none"}}),p.jsx("div",{ref:L,className:"metal-fx-content",children:t})]})});he.displayName="MetalFx";const et=18;function fe(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.jsx("path",{d:"M12 2v2"}),p.jsx("path",{d:"M12 20v2"}),p.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),p.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),p.jsx("path",{d:"M2 12h2"}),p.jsx("path",{d:"M20 12h2"}),p.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),p.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function pe(){return p.jsx("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function mr(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),p.jsx("path",{d:"M8 21h8"}),p.jsx("path",{d:"M12 17v4"})]})}const xr=[{value:"light",label:"Light",Icon:fe},{value:"dark",label:"Dark",Icon:pe},{value:"system",label:"System",Icon:mr}];function gr(t){return t==="dark"?pe:fe}function vr({theme:t,resolvedTheme:e,onSetTheme:a,className:r="",direction:o="down",align:n="right"}){const[i,u]=_.useState(!1),l=_.useRef(null),c=_.useCallback(()=>u(!1),[]);_.useEffect(()=>{if(!i)return;const f=d=>{l.current&&!l.current.contains(d.target)&&c()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i,c]),_.useEffect(()=>{if(!i)return;const f=d=>{d.key==="Escape"&&c()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,c]);const h=gr(e);return p.jsxs("div",{ref:l,className:`relative ${r}`,children:[p.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,onClick:()=>u(f=>!f),className:"flex items-center justify-center w-9 h-9 rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors",children:p.jsx(h,{})}),i&&p.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${o==="up"?"bottom-full mb-1":"top-full mt-1"} ${n==="left"?"left-0":"right-0"}`,children:xr.map(({value:f,label:d,Icon:g})=>{const x=t===f;return p.jsxs("button",{type:"button",onClick:()=>{a(f),c()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${x?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[p.jsx(g,{}),p.jsx("span",{children:d})]},f)})})]})}const br="https://github.com/mm7894215/TokenTracker/releases/latest";function Pr({auth:t,signedIn:e,sessionSoftExpired:a,userId:r}){const{currency:o,rate:n}=ke(),{theme:i,resolvedTheme:u,setTheme:l}=xe(),{openLoginModal:c}=ge(),{signedIn:h,loading:f}=ve(),d=!be(),g=e&&!a,x=_.useMemo(()=>g&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,g]),m=_e({userId:r,period:"total",accessToken:x});return p.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[p.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:p.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(Tt,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[p.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),p.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),p.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:p.jsx(Me,{})})]}),p.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[p.jsxs(Tt,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[p.jsx(we,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),p.jsx("span",{children:Y("leaderboard.profile.nav.back")})]}),d&&p.jsx(he,{variant:"button",preset:"chromatic",theme:"dark",borderRadius:9999,disableGlow:!0,className:"!bg-black",children:p.jsxs("a",{href:br,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex h-8 items-center gap-1.5 px-3 text-xs font-bold rounded-full bg-black text-white transition-transform duration-200 active:scale-[0.98]",children:[p.jsx(Te,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),p.jsx("span",{className:"hidden sm:inline",children:Y("leaderboard.profile.nav.download")})]})}),f?p.jsx("div",{className:"h-8 w-16 animate-pulse rounded-full bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):h?p.jsx(ye,{}):p.jsx("button",{type:"button",onClick:c,className:"inline-flex h-8 min-w-[76px] items-center justify-center px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm select-none",children:Y("header.auth.sign_in_aria")})]})]})}),p.jsx("main",{className:"flex-1 px-4 pt-4 pb-10 sm:pt-6 sm:pb-16",children:p.jsx("div",{className:"mx-auto max-w-3xl",children:p.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[m.loading&&p.jsx(Ce,{variant:"page"}),!m.loading&&m.error&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:Y("leaderboard.profile_modal.error")})}),!m.loading&&!m.error&&!m.data&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Y("leaderboard.profile_modal.empty")})}),!m.loading&&!m.error&&m.data&&p.jsx(Se,{data:m.data,currency:o,rate:n,variant:"page"})]})})}),p.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 px-4 transition-colors duration-200",children:p.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[p.jsx("p",{children:Y("landing.v2.footer.line")}),p.jsx(vr,{theme:i,resolvedTheme:u,onSetTheme:l,direction:"up",align:"right"})]})})]})}export{Pr as LeaderboardProfilePage};