tokentracker-cli 0.90.1 → 0.90.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{AchievementBadge-CCm2bRPL.js → AchievementBadge-BJl0ibLg.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-5WDOJGj4.js → AchievementsPage-CV6aNe3g.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-BSanOprB.js → AchievementsSection-DxLHu9EV.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-Dt-j-8Dp.js → BadgeDetailModal-ConoHhIL.js} +1 -1
- package/dashboard/dist/assets/{Card-WBsRpfP2.js → Card-C_VQxG6G.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-BRsbkMjg.js → ClawdAnimated-_Mfn4MnU.js} +1 -1
- package/dashboard/dist/assets/{CommandPalette-iqRVfuRt.js → CommandPalette-CCRCnYY9.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-B0UD6Hna.js → CommunityStatsModal-DuICwpdM.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-BbQwXQDL.js → ConfirmModal-CI27robt.js} +1 -1
- package/dashboard/dist/assets/{Controls-CDUMgZN2.js → Controls-Cwu0gtgj.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-zaMMBWF4.js → DashboardPage-GsFvPie1.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-CnWWrfz1.js → DevicePage-BSK76UQE.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-D30L50dn.js → DialogClose-BXQlPs02.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-M_lg2jhD.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-Cvy1243B.js → DialogTitle-DyvhHV1-.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-OtBQOtmZ.js → FadeIn-DaP6F4f8.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar--yBjV0Ft.js → HeaderGithubStar-CKB5puCd.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-CUCz1CCv.js → HoverTooltip-BG6k61dF.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-COJIgfHY.js → IpCheckPage-Oqt1J9S2.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-BH_E3eu9.js → LandingPage-45qoUn79.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-D2FZA-zp.js → LeaderboardAvatar-ZgXnaI_N.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-wmrvEc7Z.js → LeaderboardPage-C7E_LrFk.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-B6dNUb1h.js → LeaderboardProfileModal-D6PUcj3b.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-B35bTvlZ.js → LeaderboardProfilePage-VcC9DK_B.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-B0zXrzFS.js → LimitsPage-B9K0RFQD.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-rZ6i6lZc.js → LocalOnlyNotice-BGsfKEM9.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-jMzbbTEd.js → LoginCard-j5HVFRdP.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-M3ceaKMM.js → LoginModal-N3pWGciC.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-C3jvMlt3.js → LoginPage-TGgL0aXF.js} +1 -1
- package/dashboard/dist/assets/{PetPage-Do6WdobX.js → PetPage-DPi7OT_4.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-BtEnnSN0.js → PopoverPopup-BkptZaPd.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-BIK7rc0D.js → ProviderIcon-zaz4nwxI.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-C5qXJp8o.js → ResetPasswordPage-DQ4qdjBD.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-DnqPXqkf.js → SegmentedControl-CuTrxHXS.js} +1 -1
- package/dashboard/dist/assets/{Select-jVeLCMMw.js → Select-_Txi2j1D.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-CEBAM4fW.js → SelectItemText-DVKhj-YN.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-BFvwtaEh.js → ServiceStatusPage-ChflNSK0.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-rgT2wqMv.js → SessionsPage-CHv6xK2J.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-eP01vowc.js → SettingsPage-DkWAYALG.js} +2 -2
- package/dashboard/dist/assets/{SkillsPage-Db-yUmt4.js → SkillsPage-DnTSlBl-.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-xN2XwViv.js → TokenGalaxy-yAMCaU-k.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-7dRFaSLz.js → ToolbarRootContext-BeDIqB0k.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-DBAfvlqu.js → TrendMonitor-BthLuYwy.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-D06jYB-3.js → WidgetsPage-y_qKZ9Gv.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-BruJzhg_.js → WrappedPage-BGUGI6vk.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-DLAMIXvH.js → __vite-browser-external-CRvi_9hb.js} +2 -2
- package/dashboard/dist/assets/{agent-logos-BU-fwHaZ.js → agent-logos-DwHwn_cb.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-CsqXjuYH.js → arrow-up-right-CjEesyJI.js} +1 -1
- package/dashboard/dist/assets/{check-BYwwPV7c.js → check-KDrH1gwE.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-DFTO4K-h.js → chevron-right-DseqFm-D.js} +1 -1
- package/dashboard/dist/assets/{copy-CYH1tqVs.js → copy-CFJ1QKAQ.js} +1 -1
- package/dashboard/dist/assets/{download-CYTW_7DA.js → download-BQUNGUdh.js} +1 -1
- package/dashboard/dist/assets/{external-link-h_4oGsgX.js → external-link-BCEOLLH2.js} +1 -1
- package/dashboard/dist/assets/{flame-ditVJv52.js → flame-BigtoGg2.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-DmNhMo51.js → format-tokens-CS1GUpAV.js} +1 -1
- package/dashboard/dist/assets/{icons-DUHBy5Pm.js → icons-DpZ1a8Ct.js} +1 -1
- package/dashboard/dist/assets/{index-BDHyJHaM.js → index-DFU_yVc5.js} +1 -1
- package/dashboard/dist/assets/{index-Cf4CvN9c.js → index-DqkwD6eO.js} +1 -1
- package/dashboard/dist/assets/{index-Bs9Z1FMs.js → index-lGAAw1Rv.js} +1 -1
- package/dashboard/dist/assets/{info-D0Q3iN9G.js → info-Br_jtGtO.js} +1 -1
- package/dashboard/dist/assets/{limits-providers-G_ZNj5yH.js → limits-providers-CkqO1LMQ.js} +1 -1
- package/dashboard/dist/assets/{link-2-DUcAmJaa.js → link-2-D-nAhkk-.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-DAzlJG_O.js → loader-circle-CuNPuDRR.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-DQKB3UV2.js → maximize-2-dlvwitfg.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-dcF3BKjk.js → modifiers.esm-ORha_lPI.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-CkUERJcs.js → monitor-smartphone-CI2qvlMB.js} +1 -1
- package/dashboard/dist/assets/{provider-display-DfwC5xE5.js → provider-display-BNCdZ83n.js} +1 -1
- package/dashboard/dist/assets/{react-D7oNu68q.js → react-Dy9iWvqT.js} +1 -1
- package/dashboard/dist/assets/{search-Vzmb_9cW.js → search-Do7tzc3k.js} +1 -1
- package/dashboard/dist/assets/{skills-api-Dm8maVV9.js → skills-api-CJ-8EFac.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-MZdKGRyf.js → sortable.esm-BKQg8NHC.js} +1 -1
- package/dashboard/dist/assets/{store-C17h7vNV.js → store-SUT-n3k3.js} +1 -1
- package/dashboard/dist/assets/{terminal-DwroZX9a.js → terminal-BX4DOxd6.js} +1 -1
- package/dashboard/dist/assets/{trash-2-DUXMc-rb.js → trash-2-VERlG247.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-Ceqx8392.js → use-community-stats-BX6_XUdu.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-Cw7CqToT.js → use-limits-display-prefs-BpC3tYRw.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-_ata-KnQ.js → use-ordered-list-CX-LREPo.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-DbebVWBw.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-BLwuzenN.js → use-session-efficiency-pref-B1G8hzVM.js} +1 -1
- package/dashboard/dist/assets/{use-transform-BZD5G1Vo.js → use-transform-DNCqLbUD.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-SU1KMiWn.js → use-usage-limits-Cvbvf30m.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-C1XiHwOT.js → useCurrency-EciQmJkm.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-BCWru-KW.js → useScrollLock-sLkmam8C.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-B17dq2qN.js → useTokenFormat-nb9na-2-.js} +1 -1
- package/dashboard/dist/assets/{zap-BEIl7X9I.js → zap-BQOWCMov.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/DialogDescription-LhmGzR2P.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-ui885aKl.js +0 -1
package/dashboard/dist/assets/{LeaderboardAvatar-D2FZA-zp.js → LeaderboardAvatar-ZgXnaI_N.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as l,j as c,e as h}from"./__vite-browser-external-
|
|
1
|
+
import{d as l,j as c,e as h}from"./__vite-browser-external-CRvi_9hb.js";function d(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function x(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=d(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:x(t)})}export{g as L};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-
|
|
2
|
-
import{m as ua,j as e,d as xa,c as s,e as d,r as c,an as ga,f as ba,u as pa,a as ha,ao as fa,J as ya,ap as ka,aq as wa,ar as ze,as as ja,at as ne,g as va,au as Na,L as _a,av as Sa,l as Ca,aw as La,ax as Ea,a8 as Ta,_ as Fe,k as Aa,x as Ma}from"./__vite-browser-external-DLAMIXvH.js";import{S as Pa}from"./Select-jVeLCMMw.js";import{m as Ka}from"./react-D7oNu68q.js";import{u as Ra,C as Ia,a as za,b as Be,D as Ba,c as Da,S as $a,h as Ua,s as Oa,K as Fa,P as Ga}from"./sortable.esm-MZdKGRyf.js";import{r as Ha}from"./modifiers.esm-dcF3BKjk.js";import{P as he}from"./ProviderIcon-BIK7rc0D.js";import{u as Ya}from"./useCurrency-C1XiHwOT.js";import{u as Q}from"./useTokenFormat-B17dq2qN.js";import{L as Z}from"./LeaderboardAvatar-D2FZA-zp.js";import{s as Wa,c as Va,A as Ja,t as qa,b as Za}from"./AchievementBadge-CCm2bRPL.js";import{u as Xa}from"./use-ordered-list-_ata-KnQ.js";import{u as Qa}from"./use-community-stats-Ceqx8392.js";import"./ToolbarRootContext-7dRFaSLz.js";import"./useScrollLock-BCWru-KW.js";import"./check-BYwwPV7c.js";import"./SelectItemText-CEBAM4fW.js";import"./zap-BEIl7X9I.js";import"./flame-ditVJv52.js";const er=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ar=ua("arrow-right",er);function H(a,{min:r,max:o,fallback:n}){const l=Number(a);if(!Number.isFinite(l))return n;const i=Math.floor(l);return i<r?r:i>o?o:i}function rr(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),n=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,n-2,n-1,n,n+1,n+2]),i=Array.from(l).filter(x=>Number.isInteger(x)&&x>=1&&x<=o).sort((x,p)=>x-p),m=[];let b=null;for(const x of i)b!=null&&x-b>1&&m.push(null),m.push(x),b=x;return m}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,n=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,n||1):1e6,fallback:1}),i=l>1,m=o?l<n:!0;return{canPrev:i,canNext:m,safePage:l,safeTotal:n}}function or({entries:a,me:r,meLabel:o}){const n=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||n.some(m=>!!m?.is_me)?n:[{rank:l,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...n]}function sr(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.ceil(o/n)}const nr=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function ir({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${nr.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ie=xa.memo(function({badges:r,max:o=3,className:n=""}){const l=Wa((r||[]).filter(i=>i&&Va.has(i.id)&&(i.tier||0)>=1)).slice(0,o);return l.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${n}`,children:l.map((i,m)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(Za(i.id,"name")),tier:s(`achievements.tier.${qa(i.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Ja,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),X=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Ge="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",He="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function le(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function de(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function lr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",n=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(le(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(de(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),X.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",n)})},l.key))]})}function dr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(n,l)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},l))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),X.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(lr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(dr,{index:o},o))})]})}function mr({id:a,thClassName:r,children:o}){const{attributes:n,listeners:l,setNodeRef:i,transform:m,transition:b,isDragging:x}=Ra({id:a}),p=Ia.Transform.toString(m)||"";c.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${a}"]`),h="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(g=>{g.style.transform=p,g.style.transition=b||"",g.style.zIndex=x?"20":"",g.style.position=p?"relative":"",g.style.boxShadow=x?h:""}),()=>{f.forEach(g=>{g.style.transform="",g.style.transition="",g.style.zIndex="",g.style.position="",g.style.boxShadow=""})}},[a,p,b,x]);const j={transform:p,transition:b,position:p?"relative":void 0,zIndex:x?20:void 0,boxShadow:x?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:i,style:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...l,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",x&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const ur="tokentracker.leaderboard.columnOrder.v1";function xr(a){return Xa(ur,a)}const gr=50;function br(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(o/n*100)))}function Ye(a){return typeof a=="string"?a.trim():""}function pr(a){const r=Ye(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:n,onJumpToMe:l,canJump:i,className:m}){const b=a&&typeof a.rank=="number"?a.rank:null;if(!b)return null;const x=Number(r)||0,p=br(b,x),j=Ye(a?.display_name),f=!j||pr(j)?o||"You":j,h=a?.user_id||f,g=n||(i?l:null),T=typeof g=="function",C=T?"button":"div",ee=T?{type:"button",onClick:g,"aria-label":s(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",T?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",m),children:[e.jsx(Z,{size:"sm",avatarUrl:a?.avatar_url,displayName:f,seed:h}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:f}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",b.toLocaleString()]}),p!=null&&p<=gr&&e.jsx("span",{className:d("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",p<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:s("leaderboard.summary.percentile",{p:String(p)})}),T?e.jsx(ar,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const fr=c.lazy(()=>Fe(()=>import("./LeaderboardProfileModal-B6dNUb1h.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(a=>({default:a.LeaderboardProfileModal}))),yr=c.lazy(()=>Fe(()=>import("./CommunityStatsModal-B0UD6Hna.js"),__vite__mapDeps([24,1,2,15,25,5,10,26,4,7,27,28,22,23,29,6,17,11,12,13,21,30,31])).then(a=>({default:a.CommunityStatsModal}))),ce=[10,20,50,100],me=20,We="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return me;try{const a=window.localStorage.getItem(We),r=Number(a);if(ce.includes(r))return r}catch{}return me}function ue(a,r,o){const n=Number(a);if(!Number.isFinite(n)||n<=0)return"-";const l=Sa(r),i=r===Ma?n:n*o;return i>=1e3?`${l}${Math.round(i).toLocaleString()}`:i>=10?`${l}${Math.round(i)}`:`${l}${i.toFixed(2)}`}function wr(a){if(typeof a!="string"||!a.trim())return null;const r=new Date(a);if(!Number.isFinite(r.getTime()))return null;const o=Aa();return{dateTime:r.toISOString(),display:new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(r),exact:new Intl.DateTimeFormat(o,{dateStyle:"full",timeStyle:"long"}).format(r)}}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=Q();return e.jsx("span",{title:o(a),children:r(a)})}function jr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:n}=Q();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:s("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:e.jsx("span",{title:n(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:Ca(a.totalEntries)}),e.jsx("span",{className:"hidden sm:inline",children:(Number(a.totalEntries)||0).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.devs_chip")})]})]})}function De({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:n,formatTokensTooltip:l}=Q(),i=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",m=r?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900";return o.map(b=>e.jsx("td",{"data-column-key":b.key,title:l(a?.[b.key]),className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",i,m),children:n(a?.[b.key])},b.key))}function vr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const Nr={1:"ring-2 ring-amber-400 dark:ring-amber-500/80 shadow-[0_0_8px_rgba(245,158,11,0.25)]",2:"ring-2 ring-slate-350 dark:ring-slate-450 shadow-[0_0_8px_rgba(148,163,184,0.2)]",3:"ring-2 ring-orange-400 dark:ring-orange-500/70 shadow-[0_0_8px_rgba(249,115,22,0.25)]"};function _r({rank:a,placeholder:r}){return a===1?e.jsx("span",{className:"text-base font-extrabold italic text-amber-500 dark:text-amber-400 tracking-tighter",children:"1"}):a===2?e.jsx("span",{className:"text-base font-extrabold italic text-slate-400 dark:text-slate-350 tracking-tighter",children:"2"}):a===3?e.jsx("span",{className:"text-base font-extrabold italic text-orange-500 dark:text-orange-400 tracking-tighter",children:"3"}):e.jsx("span",{className:"text-[13px] font-bold tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:a==null?r:`#${a}`})}function Sr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(he,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:n}=Q(),l=r.filter(i=>{const m=Number(a?.[i.key]);return Number.isFinite(m)&&m>0});return l.length===0?null:e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-2 border-t border-oai-gray-100/70 pt-3 dark:border-oai-gray-800/60",children:l.map(i=>{const m=s(i.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${n(a?.[i.key])}`,className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-oai-gray-50/80 dark:bg-oai-gray-900/60 px-2 py-0.5 border border-oai-gray-100/80 dark:border-oai-gray-800/40 text-[10px] font-medium text-oai-gray-600 dark:text-oai-gray-300 transition-colors",children:[e.jsx(he,{provider:vr(i),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[i.key])})]},i.key)})})}function Lr({entry:a,entryIdx:r,name:o,meLabel:n,currency:l,rate:i,orderedColumns:m,placeholder:b,onOpenProfile:x}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,j=!p&&be(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,g=p?n:o,T=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),x(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>x(f):void 0,onKeyDown:h?T:void 0,"aria-label":h?s("leaderboard.profile_modal.row_aria",{name:g}):void 0,className:d("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",p?"bg-gradient-to-br from-oai-brand-50/70 via-oai-brand-50/20 to-transparent dark:from-oai-brand-950/20 dark:via-oai-brand-950/5 dark:to-transparent border-oai-brand-200/60 dark:border-oai-brand-500/25":j?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",h&&"cursor-pointer hover:border-oai-gray-200 dark:hover:border-oai-gray-700/80 active:scale-[0.985] active:bg-oai-gray-50/60 dark:active:bg-oai-gray-900/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(_r,{rank:a?.rank,placeholder:b})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:d("inline-flex rounded-full p-0.5 transition-all duration-300",Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(Z,{size:"md",avatarUrl:a?.avatar_url,displayName:g,seed:pe(a,g)})}),a?.github_url&&e.jsx(Sr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:d("min-w-0 truncate text-sm tracking-tight",p?"font-semibold text-oai-black dark:text-oai-white":j?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:g}),e.jsx(ie,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:s("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:ue(a?.estimated_cost_usd,l,i)})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.08em] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.column.total")}),e.jsx("div",{className:d("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",p?"text-oai-black dark:text-oai-white":j?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(xe,{value:a?.total_tokens})})]})]}),e.jsx(Cr,{entry:a,orderedColumns:m})]},`mobile-row-${a?.rank}-${g}`)}const Er={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function $e({rank:a,placeholder:r}){const o=Er[a];return o?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Ue(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Tr(a){if(!a)return s("shared.error.prefix",{error:s("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||s("leaderboard.error.unknown");return s("shared.error.prefix",{error:o})}function ge(a){return typeof a!="string"?"":a.trim()}function be(a){const r=ge(a);return r?r.toLowerCase()==="anonymous":!0}function pe(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Oe({githubUrl:a}){return e.jsxs("span",{className:"absolute left-1/2 top-full -translate-x-1/2 -translate-y-1/2 inline-flex group/gh",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":s("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(he,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:s("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[s("leaderboard.github.tooltipPrefix")," ",e.jsx(_a,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:s("leaderboard.github.tooltipSettingsLink")})," ",s("leaderboard.github.tooltipSuffix")]})]})]})}function Zr({auth:a,signedIn:r,sessionSoftExpired:o}){const n=ga(),l=ba(),{openLoginModal:i}=pa(),{signedIn:m,loading:b,user:x}=ha(),{currency:p,rate:j}=Ya(),f=c.useMemo(()=>fa(),[]),h=ya(),g=r&&!o,T=c.useMemo(()=>g&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,g]),C=g?T:null,ee=g&&ka(C),ae=s("shared.placeholder.short"),Ve=c.useMemo(()=>X.map(t=>t.key),[]),{order:re,reorder:fe}=xr(Ve),ye=c.useMemo(()=>{const t=new Map;for(const u of X)t.set(u.key,u);return t},[]),B=c.useMemo(()=>re.map(t=>ye.get(t)).filter(Boolean),[re,ye]),Je=za(Be(Ga,{activationConstraint:{distance:6}}),Be(Fa,{coordinateGetter:Oa})),qe=c.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||fe(String(u.id),String(w.id))},[fe]),[te,M]=c.useState(1),[_,Ze]=c.useState(kr),[ke,we]=c.useState(null),[Xe,je]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&we(t.trim())},[]),Qe=c.useCallback(()=>we(null),[]),ea=c.useCallback(t=>{const u=ce.includes(t)?t:me;Ze(u),M(1);try{window.localStorage.setItem(We,String(u))}catch{}},[]),[ve,aa]=c.useState(0),[ra,ta]=c.useState(()=>wa()),[Ne,_e]=c.useState(!1);c.useEffect(()=>{if(typeof window>"u")return;const t=()=>{aa(u=>u+1)};return window.addEventListener(ze,t),()=>{window.removeEventListener(ze,t)}},[]);const N=c.useMemo(()=>{const t=new URLSearchParams(n?.search||"");return Ue(t.get("period"))||"total"},[n?.search]),oa=t=>{const u=Ue(t);if(!u||u===N)return;const w=new URLSearchParams(n?.search||"");w.set("period",u),M(1),l(`${n?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{b||h||m||i()},[m,b,h,i]),c.useEffect(()=>{M(1)},[N]);const W=c.useMemo(()=>(H(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),R=c.useMemo(()=>h?"mock":b?"unavailable":m?"cloud":r?"local":f?"public":"unavailable",[b,m,f,h,r]),k=c.useMemo(()=>ja({accessMode:R,baseUrl:f,mockEnabled:h,userId:x?.id||null,period:N,pageSize:_,offset:W}),[x?.id,R,f,W,h,_,N]),[D,$]=c.useState(()=>{const t=ne(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!f&&!h||!h&&R==="unavailable"){$({loading:!1,error:null,data:null,contextKey:null});return}const t=ne(k);let u=!0;return $(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await va({userId:x?.id||null,period:N,limit:_,offset:W});u&&(Na(w,{activeContextKey:k,contextKey:k,source:ve>0?"manual-refresh":"page-load"}),$({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!u)return;const A=Tr(w);$(F=>F.contextKey===k?{...F,loading:!1,error:A}:{loading:!1,error:A,data:null,contextKey:k})}),()=>{u=!1}},[f,R,x?.id,k,W,ve,h,N,_]);const oe=c.useMemo(()=>D.contextKey===k?null:ne(k),[k,D.contextKey]),v=c.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(f||h)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,f,k,D,h,oe]),S=v.data,U=S?.total_pages??null,sa=S?.total_entries??0,P=S?.page??te,na=c.useMemo(()=>rr(P,U),[P,U]),Se=S?.from||null,Ce=S?.to||null,ia=S?.generated_at||null,V=wr(ia),Le=Qa(),K=S?.me||null,I=s("leaderboard.me_label"),Ee=s("leaderboard.anon_label"),Te=s("leaderboard.period.week"),Ae=s("leaderboard.period.month"),Me=s("leaderboard.period.total"),Pe=N==="month"?Ae:N==="total"?Me:Te,J=c.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:K,meLabel:I})},[S?.entries,K,I]),z=c.useMemo(()=>sr(K?.rank,_),[K?.rank,_]),la=z!=null&&z===P,da=c.useCallback(()=>{z!=null&&M(z)},[z]),ca=async()=>{_e(!0);try{La(!0),ta(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{_e(!1)}},{canPrev:Ke,canNext:Re}=tr({page:P,totalPages:U}),q=Array.isArray(J)&&J.length!==0;let O=null;v.loading&&!q?O=e.jsx(cr,{rows:_}):v.error&&!q?O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):q?O=e.jsxs(Ba,{sensors:Je,collisionDetection:Da,modifiers:[Ha],onDragEnd:qe,children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.rank")}),e.jsx("th",{className:d(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:s("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:s("leaderboard.column.est_cost")}),e.jsx($a,{items:re,strategy:Ua,children:B.map(t=>e.jsx(mr,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(ir,{iconSrc:t.icon,label:s(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:J.map((t,u)=>{if(t?.is_ellipsis){const E=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:E,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${u}`)}const w=!!t?.is_me,A=typeof t?.user_id=="string"?t.user_id:null,F=ge(t?.display_name),ma=be(F)?Ee:F,L=w?I:ma,G=!!A,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>Y(A):void 0,onKeyDown:G?E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Y(A))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const E=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",E?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",E&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${E?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:d("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,u)=>{const w=ge(t?.display_name),A=be(w)?Ee:w;return e.jsx(Lr,{entry:t,entryIdx:u,name:t?.is_me?I:A,meLabel:I,currency:p,rate:j,orderedColumns:B,placeholder:ae,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${u}`)})})]}):O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.empty")})});let se=null;return typeof U=="number"?se=na.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===P?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>M(t),disabled:v.loading,children:String(t)},`page-${t}`)):se=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.pagination.page_unknown",{page:String(P)})}),e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-3.5 sm:mb-8 sm:grid-cols-[minmax(0,1fr)_auto] sm:gap-4",children:[e.jsx("h1",{className:"col-start-1 row-start-1 min-w-0 whitespace-nowrap text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:col-span-2 sm:row-start-1 sm:text-4xl",children:s("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?s("leaderboard.range.total"):Se&&Ce?s("leaderboard.range",{period:Pe,from:Se,to:Ce}):s("leaderboard.range_loading",{period:Pe}),V&&e.jsx("time",{dateTime:V.dateTime,title:s("leaderboard.generated_at",{ts:V.exact}),className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400 sm:inline-block",children:s("leaderboard.generated_at",{ts:V.display})})]}),e.jsx("div",{className:"col-start-2 row-start-1 inline-flex h-9 shrink-0 items-center rounded-full border border-oai-gray-200 p-1 dark:border-oai-gray-800 sm:col-start-1 sm:row-start-3 sm:justify-self-start",children:["week","month","total"].map(t=>{const u=N===t;return e.jsxs("button",{onClick:()=>oa(t),disabled:v.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:t==="week"?Te:t==="month"?Ae:Me}),u&&e.jsx(Ka.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},t)})}),e.jsxs("div",{className:"col-span-2 row-start-2 mb-0 flex w-full min-w-0 items-center justify-between sm:justify-end gap-2.5 sm:col-span-1 sm:col-start-2 sm:row-start-3 sm:mb-0 sm:w-auto sm:shrink-0",children:[e.jsx(jr,{communityStats:Le,onClick:()=>je(!0)}),e.jsx(hr,{me:K,totalEntries:sa,meLabel:I,onOpenProfile:K?.user_id?()=>Y(K.user_id):void 0,onJumpToMe:da,canJump:z!=null&&!la&&!v.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.signin_prompt")}),e.jsx("button",{onClick:i,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:s("leaderboard.signin_button")})]}),g&&ee&&!ra&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ca,disabled:Ne,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:Ne?s("leaderboard.sync_button.busy"):s("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&q?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:s("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:_,onValueChange:t=>ea(Number(t)),disabled:v.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:ce.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Ke&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>Math.max(1,t-1)),disabled:!Ke||v.loading,children:s("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",U||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:se}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Re&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>t+1),disabled:!Re||v.loading,children:s("leaderboard.pagination.next")})]})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:s("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/xiufengsun/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:s("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(fr,{isOpen:!!ke,userId:ke,period:N,accessToken:C,onClose:Qe}),e.jsx(yr,{isOpen:Xe,onClose:()=>je(!1),communityStats:Le})]})]})}export{Zr as LeaderboardPage};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-D6PUcj3b.js","assets/__vite-browser-external-CRvi_9hb.js","assets/__vite-browser-external-CRYifSM4.css","assets/provider-display-BNCdZ83n.js","assets/useCurrency-EciQmJkm.js","assets/useTokenFormat-nb9na-2-.js","assets/maximize-2-dlvwitfg.js","assets/terminal-BX4DOxd6.js","assets/info-Br_jtGtO.js","assets/LeaderboardAvatar-ZgXnaI_N.js","assets/ProviderIcon-zaz4nwxI.js","assets/AchievementBadge-BJl0ibLg.js","assets/zap-BQOWCMov.js","assets/flame-BigtoGg2.js","assets/AchievementsSection-DxLHu9EV.js","assets/react-Dy9iWvqT.js","assets/format-tokens-CS1GUpAV.js","assets/use-reduced-motion-DbebVWBw.js","assets/arrow-up-right-CjEesyJI.js","assets/link-2-D-nAhkk-.js","assets/check-KDrH1gwE.js","assets/DialogTitle-DyvhHV1-.js","assets/useScrollLock-sLkmam8C.js","assets/store-SUT-n3k3.js","assets/CommunityStatsModal-DuICwpdM.js","assets/icons-DpZ1a8Ct.js","assets/TrendMonitor-BthLuYwy.js","assets/chevron-right-DseqFm-D.js","assets/PopoverPopup-BkptZaPd.js","assets/ToolbarRootContext-BeDIqB0k.js","assets/DialogDescription-M_lg2jhD.js","assets/DialogClose-BXQlPs02.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{m as ua,j as e,d as xa,c as s,e as d,r as c,an as ga,f as ba,u as pa,a as ha,ao as fa,J as ya,ap as ka,aq as wa,ar as ze,as as ja,at as ne,g as va,au as Na,L as _a,av as Sa,l as Ca,aw as La,ax as Ea,a8 as Ta,_ as Fe,k as Aa,x as Ma}from"./__vite-browser-external-CRvi_9hb.js";import{S as Pa}from"./Select-_Txi2j1D.js";import{m as Ka}from"./react-Dy9iWvqT.js";import{u as Ra,C as Ia,a as za,b as Be,D as Ba,c as Da,S as $a,h as Ua,s as Oa,K as Fa,P as Ga}from"./sortable.esm-BKQg8NHC.js";import{r as Ha}from"./modifiers.esm-ORha_lPI.js";import{P as he}from"./ProviderIcon-zaz4nwxI.js";import{u as Ya}from"./useCurrency-EciQmJkm.js";import{u as Q}from"./useTokenFormat-nb9na-2-.js";import{L as Z}from"./LeaderboardAvatar-ZgXnaI_N.js";import{s as Wa,c as Va,A as Ja,t as qa,b as Za}from"./AchievementBadge-BJl0ibLg.js";import{u as Xa}from"./use-ordered-list-CX-LREPo.js";import{u as Qa}from"./use-community-stats-BX6_XUdu.js";import"./ToolbarRootContext-BeDIqB0k.js";import"./useScrollLock-sLkmam8C.js";import"./check-KDrH1gwE.js";import"./SelectItemText-DVKhj-YN.js";import"./zap-BQOWCMov.js";import"./flame-BigtoGg2.js";const er=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ar=ua("arrow-right",er);function H(a,{min:r,max:o,fallback:n}){const l=Number(a);if(!Number.isFinite(l))return n;const i=Math.floor(l);return i<r?r:i>o?o:i}function rr(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),n=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,n-2,n-1,n,n+1,n+2]),i=Array.from(l).filter(x=>Number.isInteger(x)&&x>=1&&x<=o).sort((x,p)=>x-p),m=[];let b=null;for(const x of i)b!=null&&x-b>1&&m.push(null),m.push(x),b=x;return m}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,n=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,n||1):1e6,fallback:1}),i=l>1,m=o?l<n:!0;return{canPrev:i,canNext:m,safePage:l,safeTotal:n}}function or({entries:a,me:r,meLabel:o}){const n=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||n.some(m=>!!m?.is_me)?n:[{rank:l,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...n]}function sr(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.ceil(o/n)}const nr=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function ir({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${nr.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ie=xa.memo(function({badges:r,max:o=3,className:n=""}){const l=Wa((r||[]).filter(i=>i&&Va.has(i.id)&&(i.tier||0)>=1)).slice(0,o);return l.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${n}`,children:l.map((i,m)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(Za(i.id,"name")),tier:s(`achievements.tier.${qa(i.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Ja,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),X=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Ge="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",He="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function le(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function de(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function lr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",n=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(le(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(de(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),X.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",n)})},l.key))]})}function dr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(n,l)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},l))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),X.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(lr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(dr,{index:o},o))})]})}function mr({id:a,thClassName:r,children:o}){const{attributes:n,listeners:l,setNodeRef:i,transform:m,transition:b,isDragging:x}=Ra({id:a}),p=Ia.Transform.toString(m)||"";c.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${a}"]`),h="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(g=>{g.style.transform=p,g.style.transition=b||"",g.style.zIndex=x?"20":"",g.style.position=p?"relative":"",g.style.boxShadow=x?h:""}),()=>{f.forEach(g=>{g.style.transform="",g.style.transition="",g.style.zIndex="",g.style.position="",g.style.boxShadow=""})}},[a,p,b,x]);const j={transform:p,transition:b,position:p?"relative":void 0,zIndex:x?20:void 0,boxShadow:x?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:i,style:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...l,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",x&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const ur="tokentracker.leaderboard.columnOrder.v1";function xr(a){return Xa(ur,a)}const gr=50;function br(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(o/n*100)))}function Ye(a){return typeof a=="string"?a.trim():""}function pr(a){const r=Ye(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:n,onJumpToMe:l,canJump:i,className:m}){const b=a&&typeof a.rank=="number"?a.rank:null;if(!b)return null;const x=Number(r)||0,p=br(b,x),j=Ye(a?.display_name),f=!j||pr(j)?o||"You":j,h=a?.user_id||f,g=n||(i?l:null),T=typeof g=="function",C=T?"button":"div",ee=T?{type:"button",onClick:g,"aria-label":s(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",T?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",m),children:[e.jsx(Z,{size:"sm",avatarUrl:a?.avatar_url,displayName:f,seed:h}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:f}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",b.toLocaleString()]}),p!=null&&p<=gr&&e.jsx("span",{className:d("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",p<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:s("leaderboard.summary.percentile",{p:String(p)})}),T?e.jsx(ar,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const fr=c.lazy(()=>Fe(()=>import("./LeaderboardProfileModal-D6PUcj3b.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(a=>({default:a.LeaderboardProfileModal}))),yr=c.lazy(()=>Fe(()=>import("./CommunityStatsModal-DuICwpdM.js"),__vite__mapDeps([24,1,2,15,25,5,10,26,4,7,27,28,22,23,29,6,17,11,12,13,21,30,31])).then(a=>({default:a.CommunityStatsModal}))),ce=[10,20,50,100],me=20,We="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return me;try{const a=window.localStorage.getItem(We),r=Number(a);if(ce.includes(r))return r}catch{}return me}function ue(a,r,o){const n=Number(a);if(!Number.isFinite(n)||n<=0)return"-";const l=Sa(r),i=r===Ma?n:n*o;return i>=1e3?`${l}${Math.round(i).toLocaleString()}`:i>=10?`${l}${Math.round(i)}`:`${l}${i.toFixed(2)}`}function wr(a){if(typeof a!="string"||!a.trim())return null;const r=new Date(a);if(!Number.isFinite(r.getTime()))return null;const o=Aa();return{dateTime:r.toISOString(),display:new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(r),exact:new Intl.DateTimeFormat(o,{dateStyle:"full",timeStyle:"long"}).format(r)}}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=Q();return e.jsx("span",{title:o(a),children:r(a)})}function jr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:n}=Q();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:s("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:e.jsx("span",{title:n(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:Ca(a.totalEntries)}),e.jsx("span",{className:"hidden sm:inline",children:(Number(a.totalEntries)||0).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.devs_chip")})]})]})}function De({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:n,formatTokensTooltip:l}=Q(),i=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",m=r?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900";return o.map(b=>e.jsx("td",{"data-column-key":b.key,title:l(a?.[b.key]),className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",i,m),children:n(a?.[b.key])},b.key))}function vr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const Nr={1:"ring-2 ring-amber-400 dark:ring-amber-500/80 shadow-[0_0_8px_rgba(245,158,11,0.25)]",2:"ring-2 ring-slate-350 dark:ring-slate-450 shadow-[0_0_8px_rgba(148,163,184,0.2)]",3:"ring-2 ring-orange-400 dark:ring-orange-500/70 shadow-[0_0_8px_rgba(249,115,22,0.25)]"};function _r({rank:a,placeholder:r}){return a===1?e.jsx("span",{className:"text-base font-extrabold italic text-amber-500 dark:text-amber-400 tracking-tighter",children:"1"}):a===2?e.jsx("span",{className:"text-base font-extrabold italic text-slate-400 dark:text-slate-350 tracking-tighter",children:"2"}):a===3?e.jsx("span",{className:"text-base font-extrabold italic text-orange-500 dark:text-orange-400 tracking-tighter",children:"3"}):e.jsx("span",{className:"text-[13px] font-bold tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:a==null?r:`#${a}`})}function Sr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(he,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:n}=Q(),l=r.filter(i=>{const m=Number(a?.[i.key]);return Number.isFinite(m)&&m>0});return l.length===0?null:e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-2 border-t border-oai-gray-100/70 pt-3 dark:border-oai-gray-800/60",children:l.map(i=>{const m=s(i.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${n(a?.[i.key])}`,className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-oai-gray-50/80 dark:bg-oai-gray-900/60 px-2 py-0.5 border border-oai-gray-100/80 dark:border-oai-gray-800/40 text-[10px] font-medium text-oai-gray-600 dark:text-oai-gray-300 transition-colors",children:[e.jsx(he,{provider:vr(i),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[i.key])})]},i.key)})})}function Lr({entry:a,entryIdx:r,name:o,meLabel:n,currency:l,rate:i,orderedColumns:m,placeholder:b,onOpenProfile:x}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,j=!p&&be(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,g=p?n:o,T=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),x(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>x(f):void 0,onKeyDown:h?T:void 0,"aria-label":h?s("leaderboard.profile_modal.row_aria",{name:g}):void 0,className:d("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",p?"bg-gradient-to-br from-oai-brand-50/70 via-oai-brand-50/20 to-transparent dark:from-oai-brand-950/20 dark:via-oai-brand-950/5 dark:to-transparent border-oai-brand-200/60 dark:border-oai-brand-500/25":j?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",h&&"cursor-pointer hover:border-oai-gray-200 dark:hover:border-oai-gray-700/80 active:scale-[0.985] active:bg-oai-gray-50/60 dark:active:bg-oai-gray-900/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(_r,{rank:a?.rank,placeholder:b})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:d("inline-flex rounded-full p-0.5 transition-all duration-300",Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(Z,{size:"md",avatarUrl:a?.avatar_url,displayName:g,seed:pe(a,g)})}),a?.github_url&&e.jsx(Sr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:d("min-w-0 truncate text-sm tracking-tight",p?"font-semibold text-oai-black dark:text-oai-white":j?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:g}),e.jsx(ie,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:s("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:ue(a?.estimated_cost_usd,l,i)})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.08em] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.column.total")}),e.jsx("div",{className:d("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",p?"text-oai-black dark:text-oai-white":j?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(xe,{value:a?.total_tokens})})]})]}),e.jsx(Cr,{entry:a,orderedColumns:m})]},`mobile-row-${a?.rank}-${g}`)}const Er={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function $e({rank:a,placeholder:r}){const o=Er[a];return o?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Ue(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Tr(a){if(!a)return s("shared.error.prefix",{error:s("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||s("leaderboard.error.unknown");return s("shared.error.prefix",{error:o})}function ge(a){return typeof a!="string"?"":a.trim()}function be(a){const r=ge(a);return r?r.toLowerCase()==="anonymous":!0}function pe(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Oe({githubUrl:a}){return e.jsxs("span",{className:"absolute left-1/2 top-full -translate-x-1/2 -translate-y-1/2 inline-flex group/gh",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":s("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(he,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:s("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[s("leaderboard.github.tooltipPrefix")," ",e.jsx(_a,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:s("leaderboard.github.tooltipSettingsLink")})," ",s("leaderboard.github.tooltipSuffix")]})]})]})}function Zr({auth:a,signedIn:r,sessionSoftExpired:o}){const n=ga(),l=ba(),{openLoginModal:i}=pa(),{signedIn:m,loading:b,user:x}=ha(),{currency:p,rate:j}=Ya(),f=c.useMemo(()=>fa(),[]),h=ya(),g=r&&!o,T=c.useMemo(()=>g&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,g]),C=g?T:null,ee=g&&ka(C),ae=s("shared.placeholder.short"),Ve=c.useMemo(()=>X.map(t=>t.key),[]),{order:re,reorder:fe}=xr(Ve),ye=c.useMemo(()=>{const t=new Map;for(const u of X)t.set(u.key,u);return t},[]),B=c.useMemo(()=>re.map(t=>ye.get(t)).filter(Boolean),[re,ye]),Je=za(Be(Ga,{activationConstraint:{distance:6}}),Be(Fa,{coordinateGetter:Oa})),qe=c.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||fe(String(u.id),String(w.id))},[fe]),[te,M]=c.useState(1),[_,Ze]=c.useState(kr),[ke,we]=c.useState(null),[Xe,je]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&we(t.trim())},[]),Qe=c.useCallback(()=>we(null),[]),ea=c.useCallback(t=>{const u=ce.includes(t)?t:me;Ze(u),M(1);try{window.localStorage.setItem(We,String(u))}catch{}},[]),[ve,aa]=c.useState(0),[ra,ta]=c.useState(()=>wa()),[Ne,_e]=c.useState(!1);c.useEffect(()=>{if(typeof window>"u")return;const t=()=>{aa(u=>u+1)};return window.addEventListener(ze,t),()=>{window.removeEventListener(ze,t)}},[]);const N=c.useMemo(()=>{const t=new URLSearchParams(n?.search||"");return Ue(t.get("period"))||"total"},[n?.search]),oa=t=>{const u=Ue(t);if(!u||u===N)return;const w=new URLSearchParams(n?.search||"");w.set("period",u),M(1),l(`${n?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{b||h||m||i()},[m,b,h,i]),c.useEffect(()=>{M(1)},[N]);const W=c.useMemo(()=>(H(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),R=c.useMemo(()=>h?"mock":b?"unavailable":m?"cloud":r?"local":f?"public":"unavailable",[b,m,f,h,r]),k=c.useMemo(()=>ja({accessMode:R,baseUrl:f,mockEnabled:h,userId:x?.id||null,period:N,pageSize:_,offset:W}),[x?.id,R,f,W,h,_,N]),[D,$]=c.useState(()=>{const t=ne(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!f&&!h||!h&&R==="unavailable"){$({loading:!1,error:null,data:null,contextKey:null});return}const t=ne(k);let u=!0;return $(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await va({userId:x?.id||null,period:N,limit:_,offset:W});u&&(Na(w,{activeContextKey:k,contextKey:k,source:ve>0?"manual-refresh":"page-load"}),$({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!u)return;const A=Tr(w);$(F=>F.contextKey===k?{...F,loading:!1,error:A}:{loading:!1,error:A,data:null,contextKey:k})}),()=>{u=!1}},[f,R,x?.id,k,W,ve,h,N,_]);const oe=c.useMemo(()=>D.contextKey===k?null:ne(k),[k,D.contextKey]),v=c.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(f||h)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,f,k,D,h,oe]),S=v.data,U=S?.total_pages??null,sa=S?.total_entries??0,P=S?.page??te,na=c.useMemo(()=>rr(P,U),[P,U]),Se=S?.from||null,Ce=S?.to||null,ia=S?.generated_at||null,V=wr(ia),Le=Qa(),K=S?.me||null,I=s("leaderboard.me_label"),Ee=s("leaderboard.anon_label"),Te=s("leaderboard.period.week"),Ae=s("leaderboard.period.month"),Me=s("leaderboard.period.total"),Pe=N==="month"?Ae:N==="total"?Me:Te,J=c.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:K,meLabel:I})},[S?.entries,K,I]),z=c.useMemo(()=>sr(K?.rank,_),[K?.rank,_]),la=z!=null&&z===P,da=c.useCallback(()=>{z!=null&&M(z)},[z]),ca=async()=>{_e(!0);try{La(!0),ta(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{_e(!1)}},{canPrev:Ke,canNext:Re}=tr({page:P,totalPages:U}),q=Array.isArray(J)&&J.length!==0;let O=null;v.loading&&!q?O=e.jsx(cr,{rows:_}):v.error&&!q?O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):q?O=e.jsxs(Ba,{sensors:Je,collisionDetection:Da,modifiers:[Ha],onDragEnd:qe,children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.rank")}),e.jsx("th",{className:d(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:s("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:s("leaderboard.column.est_cost")}),e.jsx($a,{items:re,strategy:Ua,children:B.map(t=>e.jsx(mr,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(ir,{iconSrc:t.icon,label:s(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:J.map((t,u)=>{if(t?.is_ellipsis){const E=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:E,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${u}`)}const w=!!t?.is_me,A=typeof t?.user_id=="string"?t.user_id:null,F=ge(t?.display_name),ma=be(F)?Ee:F,L=w?I:ma,G=!!A,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>Y(A):void 0,onKeyDown:G?E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Y(A))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const E=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",E?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",E&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${E?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:d("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,u)=>{const w=ge(t?.display_name),A=be(w)?Ee:w;return e.jsx(Lr,{entry:t,entryIdx:u,name:t?.is_me?I:A,meLabel:I,currency:p,rate:j,orderedColumns:B,placeholder:ae,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${u}`)})})]}):O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.empty")})});let se=null;return typeof U=="number"?se=na.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===P?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>M(t),disabled:v.loading,children:String(t)},`page-${t}`)):se=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.pagination.page_unknown",{page:String(P)})}),e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-3.5 sm:mb-8 sm:grid-cols-[minmax(0,1fr)_auto] sm:gap-4",children:[e.jsx("h1",{className:"col-start-1 row-start-1 min-w-0 whitespace-nowrap text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:col-span-2 sm:row-start-1 sm:text-4xl",children:s("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?s("leaderboard.range.total"):Se&&Ce?s("leaderboard.range",{period:Pe,from:Se,to:Ce}):s("leaderboard.range_loading",{period:Pe}),V&&e.jsx("time",{dateTime:V.dateTime,title:s("leaderboard.generated_at",{ts:V.exact}),className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400 sm:inline-block",children:s("leaderboard.generated_at",{ts:V.display})})]}),e.jsx("div",{className:"col-start-2 row-start-1 inline-flex h-9 shrink-0 items-center rounded-full border border-oai-gray-200 p-1 dark:border-oai-gray-800 sm:col-start-1 sm:row-start-3 sm:justify-self-start",children:["week","month","total"].map(t=>{const u=N===t;return e.jsxs("button",{onClick:()=>oa(t),disabled:v.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:t==="week"?Te:t==="month"?Ae:Me}),u&&e.jsx(Ka.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},t)})}),e.jsxs("div",{className:"col-span-2 row-start-2 mb-0 flex w-full min-w-0 items-center justify-between sm:justify-end gap-2.5 sm:col-span-1 sm:col-start-2 sm:row-start-3 sm:mb-0 sm:w-auto sm:shrink-0",children:[e.jsx(jr,{communityStats:Le,onClick:()=>je(!0)}),e.jsx(hr,{me:K,totalEntries:sa,meLabel:I,onOpenProfile:K?.user_id?()=>Y(K.user_id):void 0,onJumpToMe:da,canJump:z!=null&&!la&&!v.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.signin_prompt")}),e.jsx("button",{onClick:i,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:s("leaderboard.signin_button")})]}),g&&ee&&!ra&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ca,disabled:Ne,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:Ne?s("leaderboard.sync_button.busy"):s("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&q?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:s("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:_,onValueChange:t=>ea(Number(t)),disabled:v.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:ce.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Ke&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>Math.max(1,t-1)),disabled:!Ke||v.loading,children:s("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",U||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:se}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Re&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>t+1),disabled:!Re||v.loading,children:s("leaderboard.pagination.next")})]})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:s("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/xiufengsun/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:s("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(fr,{isOpen:!!ke,userId:ke,period:N,accessToken:C,onClose:Qe}),e.jsx(yr,{isOpen:Xe,onClose:()=>je(!1),communityStats:Le})]})]})}export{Zr as LeaderboardPage};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-
|
|
2
|
-
import{m as te,a as E,r as h,a6 as se,j as e,c as o,a7 as ie,G as oe,I as ne,a8 as le,a9 as de,e as c,N as ce,V as me,L as xe,d as W,Y as ge,n as pe,aa as he,X as ue,l as fe,_ as be,a4 as ye,ab as ke}from"./__vite-browser-external-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-ConoHhIL.js","assets/__vite-browser-external-CRvi_9hb.js","assets/__vite-browser-external-CRYifSM4.css","assets/react-Dy9iWvqT.js","assets/AchievementBadge-BJl0ibLg.js","assets/zap-BQOWCMov.js","assets/flame-BigtoGg2.js","assets/use-transform-DNCqLbUD.js","assets/use-reduced-motion-DbebVWBw.js","assets/AchievementsSection-DxLHu9EV.js","assets/format-tokens-CS1GUpAV.js","assets/DialogTitle-DyvhHV1-.js","assets/useScrollLock-sLkmam8C.js","assets/store-SUT-n3k3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{m as te,a as E,r as h,a6 as se,j as e,c as o,a7 as ie,G as oe,I as ne,a8 as le,a9 as de,e as c,N as ce,V as me,L as xe,d as W,Y as ge,n as pe,aa as he,X as ue,l as fe,_ as be,a4 as ye,ab as ke}from"./__vite-browser-external-CRvi_9hb.js";import{A as ve,f as je}from"./provider-display-BNCdZ83n.js";import{u as Ne}from"./useCurrency-EciQmJkm.js";import{u as G}from"./useTokenFormat-nb9na-2-.js";import{L as Y}from"./LeaderboardAvatar-ZgXnaI_N.js";import{P as $}from"./ProviderIcon-zaz4nwxI.js";import{H as _e,A as Z,s as we,c as Ae,b as Se,t as Me,h as ze}from"./AchievementBadge-BJl0ibLg.js";import{A as Ce}from"./AchievementsSection-DxLHu9EV.js";import{A as B}from"./arrow-up-right-CjEesyJI.js";import{L as Ie}from"./link-2-D-nAhkk-.js";import{C as Pe}from"./check-KDrH1gwE.js";import{D as Te,a as De,b as Le,c as $e,d as Be,e as Ue}from"./DialogTitle-DyvhHV1-.js";import"./maximize-2-dlvwitfg.js";import"./terminal-BX4DOxd6.js";import"./info-Br_jtGtO.js";import"./zap-BQOWCMov.js";import"./flame-BigtoGg2.js";import"./react-Dy9iWvqT.js";import"./format-tokens-CS1GUpAV.js";import"./use-reduced-motion-DbebVWBw.js";import"./useScrollLock-sLkmam8C.js";import"./store-SUT-n3k3.js";const Fe=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Re=te("code-xml",Fe),U="tokentracker_anon_id";let A=null;function F(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)})}function R(){if(A)return A;try{let a=localStorage.getItem(U);return a||(a=F(),localStorage.setItem(U,a)),A=a,a}catch{return A=F(),A}}function X({userId:a}){const{signedIn:r,getAccessToken:i}=E(),[t,s]=h.useState(!1),[l,g]=h.useState(0),[n,x]=h.useState(!1),[u,f]=h.useState(!1),[S,M]=h.useState(!1),[z,T]=h.useState([]),[j,N]=h.useState(!1),C=h.useRef(0),y=h.useCallback(async()=>{if(r)try{const d=await i();if(d)return{accessToken:d,anonId:R()}}catch{}return{anonId:R()}},[r,i]);h.useEffect(()=>{let d=!1;return a?(x(!1),(async()=>{const m=await y();try{const p=await se({userId:a,...m});if(d)return;g(Number(p?.count)||0),s(!!p?.liked),x(!0)}catch{if(d)return;g(0),s(!1),x(!0)}})(),()=>{d=!0}):(x(!1),()=>{d=!0})},[a,y]);const k=()=>{M(!0),setTimeout(()=>M(!1),450),N(!0),setTimeout(()=>N(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let b=0;b<12;b++){const v=(b*30+Math.random()*20-10)*(Math.PI/180),I=45+Math.random()*45,V=Math.cos(v)*I,q=Math.sin(v)*I-(10+Math.random()*15),J=Math.random()*360-180,Q=6+Math.random()*8,ee=d[Math.floor(Math.random()*d.length)],ae=m[Math.floor(Math.random()*m.length)],re=++C.current;p.push({id:re,tx:V,ty:q,rot:J,size:Q,color:ee,shape:ae})}T(b=>[...b,...p]),setTimeout(()=>{T(b=>b.filter(v=>!p.find(I=>I.id===v.id)))},850)},_=async d=>{f(!0);try{const m=await y(),p=await ie({userId:a,action:d,...m});p&&Number.isFinite(Number(p.count))&&g(Number(p.count)),p&&typeof p.liked=="boolean"&&s(p.liked)}catch{s(m=>!m),g(m=>d==="like"?Math.max(0,m-1):m+1)}finally{f(!1)}},w=d=>{d.stopPropagation(),!(!a||!n||u)&&(t?(s(!1),g(m=>Math.max(0,m-1)),_("unlike")):(s(!0),g(m=>m+1),k(),_("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
3
3
|
@keyframes tt-like-pop {
|
|
4
4
|
0% { transform: scale(1); }
|
|
5
5
|
25% { transform: scale(0.75); }
|
|
@@ -39,7 +39,7 @@ import{m as te,a as E,r as h,a6 as se,j as e,c as o,a7 as ie,G as oe,I as ne,a8
|
|
|
39
39
|
.tt-num-anim {
|
|
40
40
|
animation: tt-num-scroll 0.25s ease-out forwards;
|
|
41
41
|
}
|
|
42
|
-
`}}),z.map(d=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${d.tx}px`,"--ty":`${d.ty}px`,"--rot":`${d.rot}deg`,width:`${d.size}px`,height:`${d.size}px`,backgroundColor:d.shape==="circle"?d.color:"transparent",borderRadius:d.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:d.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:d.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},d.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!n||u,"aria-label":t?o("leaderboard.profile.like.aria_unlike"):o("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:S?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(_e,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${j?"tt-num-anim":""}`,children:n?l:"·"})]})]})}function He({badge:a,badgeLabel:r,className:i="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${i}`,children:[e.jsx(Y,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(Z,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Oe({badges:a,isOwn:r=!1,onSelect:i,className:t=""}){const s=we((Array.isArray(a)?a:[]).filter(l=>l&&Ae.has(l.id))).filter(l=>r||(l.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((l,g)=>{const n=(l.tier||0)>=1,x=o(Se(l.id,"name")),u=n?o(`achievements.tier.${Me(l.tier)}`):o("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:i?()=>i(l):void 0,title:`${x} · ${u}`,"aria-label":o("achievements.badge.aria",{name:x,tier:u}),style:{zIndex:s.length-g},className:"group relative shrink-0 -mr-2.5 rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60",children:e.jsx(Z,{badgeId:l.id,tier:l.tier,locked:!n,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},l.id)})})}const Ee=W.lazy(()=>be(()=>import("./BadgeDetailModal-
|
|
42
|
+
`}}),z.map(d=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${d.tx}px`,"--ty":`${d.ty}px`,"--rot":`${d.rot}deg`,width:`${d.size}px`,height:`${d.size}px`,backgroundColor:d.shape==="circle"?d.color:"transparent",borderRadius:d.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:d.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:d.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},d.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!n||u,"aria-label":t?o("leaderboard.profile.like.aria_unlike"):o("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:S?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(_e,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${j?"tt-num-anim":""}`,children:n?l:"·"})]})]})}function He({badge:a,badgeLabel:r,className:i="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${i}`,children:[e.jsx(Y,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(Z,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Oe({badges:a,isOwn:r=!1,onSelect:i,className:t=""}){const s=we((Array.isArray(a)?a:[]).filter(l=>l&&Ae.has(l.id))).filter(l=>r||(l.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((l,g)=>{const n=(l.tier||0)>=1,x=o(Se(l.id,"name")),u=n?o(`achievements.tier.${Me(l.tier)}`):o("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:i?()=>i(l):void 0,title:`${x} · ${u}`,"aria-label":o("achievements.badge.aria",{name:x,tier:u}),style:{zIndex:s.length-g},className:"group relative shrink-0 -mr-2.5 rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60",children:e.jsx(Z,{badgeId:l.id,tier:l.tier,locked:!n,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},l.id)})})}const Ee=W.lazy(()=>be(()=>import("./BadgeDetailModal-ConoHhIL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function We(a,r,i){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:ye(t,{decimals:2,currency:r,rate:i})}function H(a,r,i){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return We(t,r,i);const s=r==="USD"?t:t*(i||1);return`${r==="USD"?"$":""}${fe(s,{decimals:1})}`}function Ge(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const i=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return he({dailyRows:i,weeks:52,to:t})}const Ye=`
|
|
43
43
|
@keyframes tt-shimmer {
|
|
44
44
|
100% { transform: translateX(100%); }
|
|
45
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as _,j as p,$ as xe,u as ge,a as ve,V as be,L as Tt,a0 as we,c as Y,a1 as ye}from"./__vite-browser-external-
|
|
1
|
+
import{r as _,j as p,$ as xe,u as ge,a as ve,V as be,L as Tt,a0 as we,c as Y,a1 as ye}from"./__vite-browser-external-CRvi_9hb.js";import{u as ke}from"./useCurrency-EciQmJkm.js";import{H as Me}from"./HeaderGithubStar-CKB5puCd.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-D6PUcj3b.js";import{D as Te}from"./download-BQUNGUdh.js";import"./provider-display-BNCdZ83n.js";import"./useTokenFormat-nb9na-2-.js";import"./maximize-2-dlvwitfg.js";import"./terminal-BX4DOxd6.js";import"./info-Br_jtGtO.js";import"./LeaderboardAvatar-ZgXnaI_N.js";import"./ProviderIcon-zaz4nwxI.js";import"./AchievementBadge-BJl0ibLg.js";import"./zap-BQOWCMov.js";import"./flame-BigtoGg2.js";import"./AchievementsSection-DxLHu9EV.js";import"./react-Dy9iWvqT.js";import"./format-tokens-CS1GUpAV.js";import"./use-reduced-motion-DbebVWBw.js";import"./arrow-up-right-CjEesyJI.js";import"./link-2-D-nAhkk-.js";import"./check-KDrH1gwE.js";import"./DialogTitle-DyvhHV1-.js";import"./useScrollLock-sLkmam8C.js";import"./store-SUT-n3k3.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
|
|
2
2
|
attribute vec2 a_position;
|
|
3
3
|
void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
|
|
4
4
|
`,Ge=`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as W,j as e,e as U,c as r,k as q,r as f,ac as oe,d as se,J as le,L as ce,ad as de,q as ue,ae as me}from"./__vite-browser-external-
|
|
1
|
+
import{m as W,j as e,e as U,c as r,k as q,r as f,ac as oe,d as se,J as le,L as ce,ad as de,q as ue,ae as me}from"./__vite-browser-external-CRvi_9hb.js";import{m as H}from"./react-Dy9iWvqT.js";import{P as C,c as xe,r as M,a as pe,u as ge,b as he,s as fe}from"./use-usage-limits-Cvbvf30m.js";import{L as m,u as be}from"./use-limits-display-prefs-BpC3tYRw.js";import{C as K}from"./Card-C_VQxG6G.js";import{F as ye}from"./FadeIn-DaP6F4f8.js";import{L as ke,l as j,a as ve}from"./limits-providers-CkqO1LMQ.js";import{P as je}from"./ProviderIcon-zaz4nwxI.js";import{H as Ne}from"./HoverTooltip-BG6k61dF.js";import{L as _e}from"./LocalOnlyNotice-BGsfKEM9.js";import{u as we}from"./use-reduced-motion-DbebVWBw.js";import"./arrow-up-right-CjEesyJI.js";import"./download-BQUNGUdh.js";const Pe=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],Me=W("bell-off",Pe);const Ee=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Ie=W("bell",Ee),Le=[3,2,3,3,2,2,3];function g({className:t}){return e.jsx("div",{className:U("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function Ce(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{className:"h-3 w-12 shrink-0"}),e.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),e.jsx(g,{className:"h-3 w-[30px] shrink-0"}),e.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function Se({bars:t,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),e.jsx(g,{className:U("h-4",i)})]}),Array.from({length:t},(o,n)=>e.jsx(Ce,{},n))]})}function Oe(){return e.jsx(K,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(g,{className:"h-3.5 w-28"}),Le.map((t,a)=>e.jsx(Se,{bars:t,index:a},a))]})})}const S=100;function F(t){const a=Date.parse(t);return Number.isFinite(a)?a:null}function Te(t){return Math.max(0,Math.min(S,Math.round(t)))}function Re(t){return new Intl.DateTimeFormat(q(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t))}function Ae(t,a,i){if(t==null||t>=a)return S;const o=a-t,n=a-i;return Te(n/o*S)}function De(t){const a=t.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function He(t,{now:a}={}){if(!t||typeof t!="object")return null;const i=De(t);if(i===void 0)return null;const o=Array.isArray(t.credits)?t.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),s=[];for(const d of o){const c=F(d?.expires_at);if(c==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:r("limits.codex_reset_bank.row_label",{index:l}),expiresAt:Re(c),expiresMs:c,percent:Ae(F(d?.granted_at),c,n)})}return i===0?null:s.length>0?{kind:"rows",availableCount:i??s.length,rows:s}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const Fe="shrink-0 text-oai-black dark:text-oai-white";function Ge(t){const a=M(t);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const o=Math.floor(i/6e4);if(o<60)return`${o}m`;const n=Math.floor(o/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function $e(t,a){const i=a===m.REMAINING?100-t:t;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function P(t,a="used_percent"){return t?a==="utilization"?t.utilization:t.used_percent:null}function E(t,a="reset_at"){return t?a==="resets_at"?t.resets_at:t.reset_at:null}function L(t){const a=Math.max(0,Math.min(100,Number(t)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function _(t,{useGrouping:a=!0,maximumFractionDigits:i}={}){const o=Number(t);return Number.isFinite(o)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:i??(o>=100?0:2),useGrouping:a}).format(o):null}function Be(t){if(!t||typeof t!="object"||!(Number(t.limit_credits)>0))return null;const a={useGrouping:t.unit!=="calls"},i=_(t.used_credits,a),o=_(t.limit_credits,a),n=_(t.remaining_credits,a);if(!i||!o||!n)return null;const s=t.unit==="calls"?"limits.qoder_calls.detail":"limits.codex_credits.detail";return r(s,{used:i,limit:o,remaining:n})}function We(t,a){return xe({usedPercent:P(t.window,t.pctField),windowSeconds:pe(t,t.window),resetMs:M(E(t.window,t.resetField)),mode:a})}function z(t){return Number.isFinite(t)?new Intl.DateTimeFormat(q(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):null}function Ue(t,a,i){const o=[X(t,a,i)],n=M(E(t.window,t.resetField)),s=z(n);s&&o.push(r(t.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:s}));const d=Be(t.window);return d&&o.push(d),o.join(`
|
|
2
2
|
`)}const V=Ne;function qe({label:t,pct:a,reset:i,mode:o=m.USED,pacePercent:n=null,paceOver:s=!1,title:d=null}){const c=Math.max(0,Math.min(100,Number(a)||0)),l=o===m.REMAINING?100-c:c,u=Math.round(l),x=l>0&&u===0?Math.max(l,.35):l;let v=String(u);l>0&&u===0&&(v=r("limits.bar.sub_one_percent"));const y=n==null?null:Math.max(0,Math.min(100,n));return e.jsxs("div",{className:"group relative flex items-center gap-2",children:[e.jsx(V,{text:d}),e.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t}),e.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[e.jsx("div",{className:`${$e(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${x}%`,minWidth:l>0?"3px":0}}),y!=null&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${y}% - 3px)`,width:"6px"}}),e.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${y}% - 1px)`,width:"2px"}})]})]}),e.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[v,"%"]}),i&&e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i})]})}function X(t,a,i){const o=t.label??r(t.labelKey),n=i===m.REMAINING,s=l=>n?100-l:l;if(a.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(P(t.window,t.pctField))||0)),u=L(s(l));return n?r("limits.explain.remaining",{label:o,used:u}):r("limits.explain.used",{label:o,used:u})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:o,eta:a.runsOutEta});const l=L(s(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const d=Math.max(0,Math.min(100,Number(P(t.window,t.pctField))||0)),c=L(s(a.projectedEnd??d));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:c})}function Ke({pace:t}){return t.pacePercent!=null}function ze({rows:t,mode:a}){if(t.length===0)return null;const i=a===m.REMAINING,o=t.some(Ke);return e.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[t.map(({spec:n,pace:s})=>{const d=z(M(E(n.window,n.resetField)));return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[X(n,s,a),d?e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r(n.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:d})]}):null]},n.key)}),o?e.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:r(i?"limits.explain.body_remaining":"limits.explain.body")}):null]})}function N(t){if(!t)return null;const a=Date.now()-new Date(t).getTime();if(a<0)return null;const i=Math.floor(a/6e4);if(i<1)return r("shared.time.now");if(i<60)return r("shared.time.m_ago",{n:i});const o=Math.floor(i/60);if(o<24)return r("shared.time.h_ago",{n:o});const n=Math.floor(o/24);return r("shared.time.d_ago",{n})}const G={live:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-emerald-500",pulse:"bg-emerald-400"},stale:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"},cached:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"}},Ve={claude:"claude",codex:"codex"};function k({label:t,age:a=null,tone:i="live",tooltip:o=null}){const n=G[i]||G.live,s=i==="live";return e.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:d=>d.stopPropagation(),children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider border leading-normal ${n.surface}`,children:[s?e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),e.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),t,a?e.jsxs(e.Fragment,{children:[" · ",a]}):null]}),o?e.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[o,e.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]}):null]})}function w({name:t,providerId:a,children:i,expandable:o=!1,expanded:n=!1,onToggle:s,badge:d=null}){const c=ve(a),l=e.jsxs("div",{className:"flex items-center gap-1.5",children:[c?e.jsx(je,{provider:c,size:14,className:Fe}):null,e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:t}),d]});return o?e.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[l,i]}):e.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,i]})}const Xe=ke;function h({children:t,tone:a="neutral"}){const i=a==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return e.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:t})}function Ye({rows:t,mode:a,extra:i=null}){const o=t.length===0&&!i;return e.jsxs(e.Fragment,{children:[t.map(({spec:n,pace:s})=>e.jsx(qe,{label:n.label??r(n.labelKey),pct:P(n.window,n.pctField),reset:Ge(E(n.window,n.resetField)),mode:a,pacePercent:s.pacePercent,paceOver:s.paceOver,title:Ue(n,s,a)},n.key)),o?e.jsx(h,{children:r("limits.status.no_data")}):null,i]})}function Je(t){if(!Number.isFinite(t.expiresMs))return null;const a=Math.floor((t.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:t.expiresAt}):r("limits.reset_bank.hover_detail",{date:t.expiresAt,days:a})}function Qe({row:t}){const a=Math.max(0,Math.min(100,Number(t.percent)||0));return e.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[e.jsx(V,{text:Je(t)}),e.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t.label}),e.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${a}%`,minWidth:a>0?"3px":0}})}),e.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:t.expiresAt})]})}function Ze({model:t}){const a=t.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:t.availableCount}):null;return e.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":t.kind,children:[e.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codex_reset_bank.title")}),a?e.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):t.rows.map(i=>e.jsx(Qe,{row:i},i.key))]})}function Y(t,a){if(t==="codex_meta"){const i=He(a.reset_credits);return i?e.jsx(Ze,{model:i}):null}if(t==="kimi_parallel"&&a.parallel_limit)return e.jsx(h,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})});if(t==="kiro_credits"&&Number.isFinite(Number(a.tracked_credits))&&Number(a.tracked_credit_records)>0){const i=_(a.tracked_credits,{maximumFractionDigits:2});return e.jsx(h,{children:r("limits.label.kiro_tracked_credits",{credits:i,count:Number(a.tracked_credit_records)})})}return t==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?e.jsx(at,{defaultDir:a.otel_default_dir}):null}function et(t,a,i,o,n,s,d=null){const c=C[t];if(!c)return null;const l=c.windows(a).filter(x=>x.window).map(x=>({spec:x,pace:We(x,o)})),u=Y(c.extra,a);return e.jsxs(w,{name:i,providerId:t,expandable:l.length>0,expanded:n,onToggle:s,badge:d,children:[e.jsx(Ye,{mode:o,rows:l,extra:u}),n?e.jsx(ze,{rows:l,mode:o}):null]},t)}function tt(t,a,i,o,n){if(!C[t])return null;if(!a?.configured)return e.jsxs(w,{name:j(t),providerId:t,children:[e.jsx(h,{children:r("limits.status.not_connected")}),t==="opencodeGo"?e.jsx($,{}):null,t==="codingPlan"?e.jsx(B,{}):null]},t);if(t==="opencodeGo"&&a.subscription_status==="inactive")return e.jsx(w,{name:j(t),providerId:t,children:e.jsx(h,{children:r("limits.opencodeGo.status.inactive")})},t);if(a.error)return e.jsxs(w,{name:j(t),providerId:t,children:[e.jsx(h,{tone:"error",children:r("shared.error.prefix",{error:a.error})}),t==="kiro"?Y(C.kiro.extra,a):null,t==="opencodeGo"?e.jsx($,{}):null,t==="codingPlan"?e.jsx(B,{}):null]},t);const s=j(t),d=a.plan_label?`${s} ${a.plan_label}`:s;let c=null;if(t==="antigravity")if(a.cached){const u=N(a.cached_at);c=e.jsx(k,{label:r("limits.label.antigravity_cached"),age:u,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else c=e.jsx(k,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});if((t==="qoder"||t==="qoderCn"||t==="codingPlan")&&a.cached&&(c=e.jsx(k,{label:r("limits.label.antigravity_cached"),age:N(a.cached_at),tone:"cached",tooltip:r("limits.tooltip.qoder_cached")})),!c&&a.auth_action_required==="reauth"){const u=Ve[t];c=e.jsx(k,{label:r("limits.reauth.badge"),age:N(a.cached_at),tone:"stale",tooltip:u?r("limits.reauth.tooltip",{command:u}):null})}const l=a.provenance;return l?.stale&&!c&&(c=e.jsx(k,{label:r("limits.provenance.stale"),age:N(l.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:l.source,confidence:l.confidence})})),et(t,a,d,i,o,n,c)}function at({defaultDir:t}){const[a,i]=f.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${t||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
3
3
|
`),s=async d=>{d.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),e.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:n}),e.jsx("button",{type:"button",onClick:s,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function b({n:t,children:a}){return e.jsxs("li",{className:"flex gap-2.5",children:[e.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:t}),e.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function J(){return e.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function $(){const[t,a]=f.useState(!1),i=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
|
|
4
4
|
`),o=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.opencodeGo.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.opencodeGo.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(b,{n:"1",children:[e.jsx("div",{children:r("limits.opencodeGo.setupHint.step1")}),e.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[r("limits.opencodeGo.setupHint.cta"),e.jsx(J,{})]})]}),e.jsxs(b,{n:"2",children:[e.jsx("div",{children:r("limits.opencodeGo.setupHint.step2")}),e.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_workspace")}),e.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_cookie")})]})]}),e.jsxs(b,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.opencodeGo.setupHint.step3")}),e.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?r("limits.opencodeGo.setupHint.copied"):r("limits.opencodeGo.setupHint.copy")})]}),e.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:i}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.opencodeGo.setupHint.note_app")})]})]})]})}function B(){const[t,a]=f.useState(!1),i=["npm install -g @volcengine/ark-cli","arkcli auth login volc-sso # browser SSO (recommended)","arkcli auth status # verify the session"].join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,c as t}from"./__vite-browser-external-
|
|
1
|
+
import{j as e,c as t}from"./__vite-browser-external-CRvi_9hb.js";import{A as r}from"./arrow-up-right-CjEesyJI.js";import{D as o}from"./download-BQUNGUdh.js";const i="https://github.com/xiufengsun/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as re,a2 as ce,a as ge,r as o,c as a,j as e,e as h}from"./__vite-browser-external-DLAMIXvH.js";const ue=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],me=re("arrow-left",ue);const xe=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],he=re("mail",xe),be=e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),fe=e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),pe={google:be,github:fe},ye={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function we(i){return ye[i]||String(i||"").replace(/-/g," ")}function ke(i){if(typeof i=="string"&&i.trim())return i.trim();if(i&&typeof i=="object"){if(typeof i.token=="string"&&i.token.trim())return i.token.trim();if(typeof i.otp=="string"&&i.otp.trim())return i.otp.trim()}return""}function je({title:i,subtitle:H,className:ae="",onSuccess:S,hideLogo:D=!1,initialMode:p="signin",tokenFromUrl:P="",initialEmail:y="",initialCode:v=""}){ce();const{enabled:w,signedIn:j,refreshUser:E,signInWithPassword:G,signUp:Z,signInWithOAuth:T,getPublicAuthConfig:V,sendResetPasswordEmail:$,exchangeResetPasswordToken:U,resetPassword:W}=ge(),[n,u]=o.useState(p),[c,k]=o.useState(y),[m,N]=o.useState(""),[A,L]=o.useState(""),[M,te]=o.useState(""),[q,z]=o.useState(v),[_,x]=o.useState(!1),[J,s]=o.useState(null),[C,b]=o.useState(null),[F,O]=o.useState(!1),[oe,se]=o.useState(!!(p!=="signin"||y)),[R,K]=o.useState(!0),[I,Q]=o.useState([]),[X,ie]=o.useState(8);o.useEffect(()=>{p&&u(p)},[p]),o.useEffect(()=>{y&&k(y)},[y]),o.useEffect(()=>{v&&z(v)},[v]),o.useEffect(()=>{if(!w)return;let r=!0;return K(!0),(async()=>{const{data:t,error:l}=await V();if(r){if(l||!t)Q(["google","github"]);else{const d=Array.isArray(t.oAuthProviders)?t.oAuthProviders:[],f=Array.isArray(t.customOAuthProviders)?t.customOAuthProviders:[];Q([...d,...f]),typeof t.passwordMinLength=="number"&&t.passwordMinLength>0&&ie(t.passwordMinLength)}K(!1)}})(),()=>{r=!1}},[w,V]),o.useEffect(()=>{j&&S&&S()},[j,S]);const Y=o.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),ee=o.useMemo(()=>typeof window>"u"?"/reset-password":`${window.location.origin}/reset-password`,[]),B=o.useCallback(async r=>{s(null),x(!0);try{const{error:t}=await T(r,Y);t&&s(t.message||String(t))}finally{x(!1)}},[T,Y]);o.useEffect(()=>{if(!w||R||j||typeof window>"u")return;const r=window.location.search;if(!r)return;const t=new URLSearchParams(r),l=t.get("native")==="1",d=t.get("provider");l&&d&&[...I].includes(d)&&B(d)},[w,R,j,I,B]);const ne=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{if(n==="signup"){const{data:l,error:d}=await Z({email:c.trim(),password:m,name:M.trim()||void 0});if(d){s(d.message||String(d));return}if(l?.requireEmailVerification){b(a("login.verify_email_pending")),u("signin");return}await E();return}const{error:t}=await G({email:c.trim(),password:m});if(t){s(t.message||String(t));return}await E()}finally{x(!1)}},[n,c,m,M,Z,G,E]),le=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{const t=c.trim(),{error:l}=await $({email:t,redirectTo:ee});if(l){s(l.message||String(l));return}k(t),b(a("reset_password.request.sent")),u("reset_confirm")}finally{x(!1)}},[c,ee,$]),de=o.useCallback(async r=>{if(r.preventDefault(),s(null),m!==A){s(a("reset_password.error.password_mismatch"));return}x(!0);try{let t=P;if(!t){const{data:d,error:f}=await U({email:c.trim(),code:q.trim()});if(f){s(f.message||String(f));return}if(t=ke(d),!t){s(a("reset_password.error.missing_token"));return}}const{error:l}=await W({newPassword:m,otp:t});if(l){s(l.message||String(l));return}O(!0),b(a("reset_password.success"))}finally{x(!1)}},[q,A,c,U,m,W,P]);if(!w)return null;const g=n==="reset_email"||n==="reset_confirm";return e.jsxs("div",{className:h("w-full bg-white dark:bg-oai-gray-950 p-6 transition-colors duration-200",ae),children:[g&&e.jsxs("button",{type:"button",onClick:()=>{u("signin"),b(null),s(null),O(!1),N(""),L("")},className:"flex items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors mb-4 focus:outline-none",children:[e.jsx(me,{className:"h-3.5 w-3.5"}),a("reset_password.back_to_sign_in")]}),e.jsxs("div",{className:h("mb-6",g?"text-left":"text-center"),children:[!D&&!g&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),e.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white font-oai tracking-tight",children:a("shared.app_name")})]}),e.jsx("h2",{className:h("text-sm font-semibold text-oai-black dark:text-white tracking-tight mb-1",(D||g)&&"text-base font-bold md:text-lg"),children:g?a("reset_password.title"):i||a("login_modal.subtitle")}),!g&&H&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px] mx-auto",children:H}),g&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px]",children:C&&n==="reset_confirm"&&!F?C:a("reset_password.subtitle")})]}),C&&(!g||F)&&e.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:C}),J&&e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400 text-center",role:"alert",children:J}),n==="reset_email"&&e.jsxs("form",{onSubmit:le,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.request.submit")})]}),n==="reset_confirm"&&(F?e.jsx("button",{type:"button",onClick:()=>{u("signin"),O(!1),b(null),s(null),N(""),L("")},className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors text-center shadow-sm",children:a("reset_password.success_cta")}):e.jsxs("form",{onSubmit:de,className:"space-y-3",children:[!P&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email-confirm",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-code",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.code")}),e.jsx("input",{id:"card-reset-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:q,onChange:r=>z(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.new_password")}),e.jsx("input",{id:"card-reset-password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.confirm_password")}),e.jsx("input",{id:"card-reset-password-confirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:A,onChange:r=>L(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.reset.submit")})]})),!g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2.5 mb-5",children:R?e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"}),e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"})]}):I.map(r=>e.jsxs("button",{type:"button",disabled:_,onClick:()=>B(r),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[pe[r]||null,a("login.oauth.continue",{provider:we(r)})]},r))}),oe?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login_modal.divider_email")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signin"),s(null)},children:a("login.tab.sign_in")}),e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signup"),s(null)},children:a("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:ne,className:"space-y-3",children:[n==="signup"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.name")}),e.jsx("input",{id:"card-name",type:"text",autoComplete:"name",value:M,onChange:r=>te(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:a("login.field.name_placeholder")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.password")}),e.jsx("input",{id:"card-password",type:"password",autoComplete:n==="signup"?"new-password":"current-password",required:!0,minLength:n==="signup"?X:void 0,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),n==="signup"&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:a("login.password_hint",{min:String(X)})}),n==="signin"&&e.jsx("div",{className:"mt-1 text-right",children:e.jsx("button",{type:"button",onClick:()=>{u("reset_email"),s(null),b(null)},className:"text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white no-underline bg-transparent border-0 p-0 cursor-pointer focus:outline-none",children:a("login.forgot_password")})})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:n==="signup"?a("login.submit.sign_up"):a("login.submit.sign_in")})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login.divider")})})]}),e.jsxs("button",{type:"button",onClick:()=>se(!0),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[e.jsx(he,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),a("login_modal.continue_email")]})]})]})]})}export{je as L};
|
|
1
|
+
import{m as re,a2 as ce,a as ge,r as o,c as a,j as e,e as h}from"./__vite-browser-external-CRvi_9hb.js";const ue=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],me=re("arrow-left",ue);const xe=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],he=re("mail",xe),be=e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),fe=e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),pe={google:be,github:fe},ye={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function we(i){return ye[i]||String(i||"").replace(/-/g," ")}function ke(i){if(typeof i=="string"&&i.trim())return i.trim();if(i&&typeof i=="object"){if(typeof i.token=="string"&&i.token.trim())return i.token.trim();if(typeof i.otp=="string"&&i.otp.trim())return i.otp.trim()}return""}function je({title:i,subtitle:H,className:ae="",onSuccess:S,hideLogo:D=!1,initialMode:p="signin",tokenFromUrl:P="",initialEmail:y="",initialCode:v=""}){ce();const{enabled:w,signedIn:j,refreshUser:E,signInWithPassword:G,signUp:Z,signInWithOAuth:T,getPublicAuthConfig:V,sendResetPasswordEmail:$,exchangeResetPasswordToken:U,resetPassword:W}=ge(),[n,u]=o.useState(p),[c,k]=o.useState(y),[m,N]=o.useState(""),[A,L]=o.useState(""),[M,te]=o.useState(""),[q,z]=o.useState(v),[_,x]=o.useState(!1),[J,s]=o.useState(null),[C,b]=o.useState(null),[F,O]=o.useState(!1),[oe,se]=o.useState(!!(p!=="signin"||y)),[R,K]=o.useState(!0),[I,Q]=o.useState([]),[X,ie]=o.useState(8);o.useEffect(()=>{p&&u(p)},[p]),o.useEffect(()=>{y&&k(y)},[y]),o.useEffect(()=>{v&&z(v)},[v]),o.useEffect(()=>{if(!w)return;let r=!0;return K(!0),(async()=>{const{data:t,error:l}=await V();if(r){if(l||!t)Q(["google","github"]);else{const d=Array.isArray(t.oAuthProviders)?t.oAuthProviders:[],f=Array.isArray(t.customOAuthProviders)?t.customOAuthProviders:[];Q([...d,...f]),typeof t.passwordMinLength=="number"&&t.passwordMinLength>0&&ie(t.passwordMinLength)}K(!1)}})(),()=>{r=!1}},[w,V]),o.useEffect(()=>{j&&S&&S()},[j,S]);const Y=o.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),ee=o.useMemo(()=>typeof window>"u"?"/reset-password":`${window.location.origin}/reset-password`,[]),B=o.useCallback(async r=>{s(null),x(!0);try{const{error:t}=await T(r,Y);t&&s(t.message||String(t))}finally{x(!1)}},[T,Y]);o.useEffect(()=>{if(!w||R||j||typeof window>"u")return;const r=window.location.search;if(!r)return;const t=new URLSearchParams(r),l=t.get("native")==="1",d=t.get("provider");l&&d&&[...I].includes(d)&&B(d)},[w,R,j,I,B]);const ne=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{if(n==="signup"){const{data:l,error:d}=await Z({email:c.trim(),password:m,name:M.trim()||void 0});if(d){s(d.message||String(d));return}if(l?.requireEmailVerification){b(a("login.verify_email_pending")),u("signin");return}await E();return}const{error:t}=await G({email:c.trim(),password:m});if(t){s(t.message||String(t));return}await E()}finally{x(!1)}},[n,c,m,M,Z,G,E]),le=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{const t=c.trim(),{error:l}=await $({email:t,redirectTo:ee});if(l){s(l.message||String(l));return}k(t),b(a("reset_password.request.sent")),u("reset_confirm")}finally{x(!1)}},[c,ee,$]),de=o.useCallback(async r=>{if(r.preventDefault(),s(null),m!==A){s(a("reset_password.error.password_mismatch"));return}x(!0);try{let t=P;if(!t){const{data:d,error:f}=await U({email:c.trim(),code:q.trim()});if(f){s(f.message||String(f));return}if(t=ke(d),!t){s(a("reset_password.error.missing_token"));return}}const{error:l}=await W({newPassword:m,otp:t});if(l){s(l.message||String(l));return}O(!0),b(a("reset_password.success"))}finally{x(!1)}},[q,A,c,U,m,W,P]);if(!w)return null;const g=n==="reset_email"||n==="reset_confirm";return e.jsxs("div",{className:h("w-full bg-white dark:bg-oai-gray-950 p-6 transition-colors duration-200",ae),children:[g&&e.jsxs("button",{type:"button",onClick:()=>{u("signin"),b(null),s(null),O(!1),N(""),L("")},className:"flex items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors mb-4 focus:outline-none",children:[e.jsx(me,{className:"h-3.5 w-3.5"}),a("reset_password.back_to_sign_in")]}),e.jsxs("div",{className:h("mb-6",g?"text-left":"text-center"),children:[!D&&!g&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),e.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white font-oai tracking-tight",children:a("shared.app_name")})]}),e.jsx("h2",{className:h("text-sm font-semibold text-oai-black dark:text-white tracking-tight mb-1",(D||g)&&"text-base font-bold md:text-lg"),children:g?a("reset_password.title"):i||a("login_modal.subtitle")}),!g&&H&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px] mx-auto",children:H}),g&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px]",children:C&&n==="reset_confirm"&&!F?C:a("reset_password.subtitle")})]}),C&&(!g||F)&&e.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:C}),J&&e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400 text-center",role:"alert",children:J}),n==="reset_email"&&e.jsxs("form",{onSubmit:le,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.request.submit")})]}),n==="reset_confirm"&&(F?e.jsx("button",{type:"button",onClick:()=>{u("signin"),O(!1),b(null),s(null),N(""),L("")},className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors text-center shadow-sm",children:a("reset_password.success_cta")}):e.jsxs("form",{onSubmit:de,className:"space-y-3",children:[!P&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email-confirm",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-code",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.code")}),e.jsx("input",{id:"card-reset-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:q,onChange:r=>z(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.new_password")}),e.jsx("input",{id:"card-reset-password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.confirm_password")}),e.jsx("input",{id:"card-reset-password-confirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:A,onChange:r=>L(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.reset.submit")})]})),!g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2.5 mb-5",children:R?e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"}),e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"})]}):I.map(r=>e.jsxs("button",{type:"button",disabled:_,onClick:()=>B(r),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[pe[r]||null,a("login.oauth.continue",{provider:we(r)})]},r))}),oe?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login_modal.divider_email")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signin"),s(null)},children:a("login.tab.sign_in")}),e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signup"),s(null)},children:a("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:ne,className:"space-y-3",children:[n==="signup"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.name")}),e.jsx("input",{id:"card-name",type:"text",autoComplete:"name",value:M,onChange:r=>te(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:a("login.field.name_placeholder")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.password")}),e.jsx("input",{id:"card-password",type:"password",autoComplete:n==="signup"?"new-password":"current-password",required:!0,minLength:n==="signup"?X:void 0,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),n==="signup"&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:a("login.password_hint",{min:String(X)})}),n==="signin"&&e.jsx("div",{className:"mt-1 text-right",children:e.jsx("button",{type:"button",onClick:()=>{u("reset_email"),s(null),b(null)},className:"text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white no-underline bg-transparent border-0 p-0 cursor-pointer focus:outline-none",children:a("login.forgot_password")})})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:n==="signup"?a("login.submit.sign_up"):a("login.submit.sign_in")})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login.divider")})})]}),e.jsxs("button",{type:"button",onClick:()=>se(!0),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[e.jsx(he,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),a("login_modal.continue_email")]})]})]})]})}export{je as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as s,a as c,r as l,j as e,X as d}from"./__vite-browser-external-
|
|
1
|
+
import{u as s,a as c,r as l,j as e,X as d}from"./__vite-browser-external-CRvi_9hb.js";import{m as o}from"./react-Dy9iWvqT.js";import{L as m}from"./LoginCard-j5HVFRdP.js";import{A as p}from"./index-DFU_yVc5.js";function b(){const{isOpen:i,closeLoginModal:a}=s(),{enabled:r}=c();return l.useEffect(()=>{if(!i)return;const t=n=>{n.key==="Escape"&&a()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[i,a]),r?e.jsx(p,{children:i&&e.jsxs(o.div,{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[e.jsx(o.div,{className:"absolute inset-0 bg-black/40 dark:bg-black/60",onClick:a,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),e.jsxs(o.div,{className:"relative w-full max-w-[420px] rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 shadow-2xl overflow-hidden",initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.2},onClick:t=>t.stopPropagation(),children:[e.jsx("button",{type:"button",onClick:a,className:"absolute right-4 top-4 z-10 text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:e.jsx(d,{className:"h-5 w-5"})}),e.jsx(m,{onSuccess:a,className:"p-6 bg-transparent"})]})]})}):null}export{b as LoginModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as p,h as w,a as v,r,c as s,j as e,L as y}from"./__vite-browser-external-
|
|
1
|
+
import{f as p,h as w,a as v,r,c as s,j as e,L as y}from"./__vite-browser-external-CRvi_9hb.js";import{L as j}from"./LoginCard-j5HVFRdP.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function L(){const i=p(),[t,f]=w(),{enabled:n,loading:u,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[h,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),m=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&m&&d(s("shared.error.prefix",{error:m}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||u)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,u,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{f(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[f]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[h?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:h}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{L as LoginPage};
|