tokentracker-cli 0.80.3 → 0.80.4
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-DZHEunSw.js → AchievementBadge-DX-LggX4.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-CH4_Zsan.js → AchievementsPage-B8wkE9xP.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-BA3td1pA.js → AchievementsSection-DtzmIf9I.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-khvs3rx7.js → BadgeDetailModal-CZqdIWZQ.js} +1 -1
- package/dashboard/dist/assets/{Card-Sl8aV1zN.js → Card-BSUag_Em.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-Ckc04uUA.js → ClawdAnimated-Dkhj87ak.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-CIWJXo8n.js → CommunityStatsModal-C9mK6lce.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-BbX1_Acr.js → ConfirmModal-Bjh9H-Vd.js} +1 -1
- package/dashboard/dist/assets/{Controls-DDRUA8kk.js → Controls-BYSv1KGd.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-BjYHD7cb.js +19 -0
- package/dashboard/dist/assets/{DevicePage-BiA-gmZ1.js → DevicePage-DHBd7LbW.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-46nkMBGD.js → DialogClose-Be-pyoVu.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-doJbC76C.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-VrlohERZ.js → DialogTitle-DeXrE3Jr.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-BbX2o5wT.js → FadeIn-BIj6T_Ni.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-6tlcPgRa.js → HeaderGithubStar-CVPu84a0.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-4tLP-C-I.js → IpCheckPage-2JMGIL_x.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-CHs8DEmW.js → LandingPage-B42AweLO.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-DS4YJUH4.js → LeaderboardAvatar-j3c8hJFh.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-BQW1lH85.js → LeaderboardPage-cOLb_Ssc.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-_BFaNtZo.js → LeaderboardProfileModal-DvdDUUFU.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-CQGuRTYs.js → LeaderboardProfilePage-Pg2Sggtd.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-AzUTHKc6.js → LimitsPage-DNMNpIgQ.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-OGd7dgNy.js → LocalOnlyNotice-Bm0n3EVD.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-DOC8GSnx.js → LoginPage-DlZ1jBtd.js} +1 -1
- package/dashboard/dist/assets/{PetPage-Dg3hDk0V.js → PetPage-5Qk5nTRF.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-wqRxeiRe.js → PopoverPopup-RoYcoamh.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-BXeHwRbw.js → ResetPasswordPage-PbCAaF56.js} +1 -1
- package/dashboard/dist/assets/{Select-xQYnyBsI.js → Select-B3plxksi.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-D7zYmQgG.js → SelectItemText-Deyr9uQd.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-DXyfLAb0.js → SettingsPage-DloJH8fs.js} +1 -1
- package/dashboard/dist/assets/{SkillsPage-74oAqvsD.js → SkillsPage-DHhXoof-.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-Cw0sIgNF.js → WidgetsPage-CNGHvVDr.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-DVISe20W.js → WrappedPage-2ZN38qnG.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-B0LNabNz.js → agent-logos-DApZ1E-T.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-BRWnpJfw.js → arrow-up-right-DMGmqVqe.js} +1 -1
- package/dashboard/dist/assets/check-D1YFQP0r.js +1 -0
- package/dashboard/dist/assets/{copy-DlYjqSlM.js → copy-CvnjBsmb.js} +1 -1
- package/dashboard/dist/assets/{download-CPtlHzrk.js → download-sDeO57uc.js} +1 -1
- package/dashboard/dist/assets/{flame-DJub-92G.js → flame-CyiQUQcA.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-rn8Gt9IU.js → format-tokens-DlkEG-2M.js} +1 -1
- package/dashboard/dist/assets/{info-D8UdiUIR.js → info-482LCF96.js} +1 -1
- package/dashboard/dist/assets/{link-2-Cy3M4kYA.js → link-2-DY_0gFgX.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-DAwJfPbD.js → loader-circle-xebF61S5.js} +1 -1
- package/dashboard/dist/assets/main-BbNuscIe.css +1 -0
- package/dashboard/dist/assets/{main-CdcVAe5U.js → main-DY9GCwr_.js} +4 -3
- package/dashboard/dist/assets/{provider-display-DWv_Dxvz.js → provider-display-B6jUb-Ud.js} +1 -1
- package/dashboard/dist/assets/{trash-2-D3istTDT.js → trash-2-D0iohG1v.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-fL_RF-Ik.js → use-community-stats-DPHOiIBu.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-B_A1dohk.js → use-limits-display-prefs-BfSnFqTR.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-EwqsoWJV.js → use-native-settings-Cx_HZy8t.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-BaxsXpRO.js → use-ordered-list-IRGftZaJ.js} +1 -1
- package/dashboard/dist/assets/{use-quality-per-dollar-pref-BLbCWOIu.js → use-quality-per-dollar-pref-BoE3jESh.js} +1 -1
- package/dashboard/dist/assets/{use-transform-U6ELcsuU.js → use-transform-BJNb33iJ.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-B1o7RupE.js → use-usage-limits-Dyoqxe1m.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-B681uTdf.js → useCurrency-f-244MeL.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-C4RZac0I.js → useScrollLock-D6X4FH8b.js} +1 -1
- package/dashboard/dist/assets/useTokenFormat-Cz_Gqk4n.js +1 -0
- package/dashboard/dist/assets/{zap-DMz4UIzI.js → zap-DN1VaJU3.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/DashboardPage-CQbIzUJ3.js +0 -19
- package/dashboard/dist/assets/DialogDescription-BDmQqHT1.js +0 -1
- package/dashboard/dist/assets/check-CdnSDWAp.js +0 -1
- package/dashboard/dist/assets/main-ilWqzAfD.css +0 -1
- package/dashboard/dist/assets/useTokenFormat-C_ILPUqQ.js +0 -1
package/dashboard/dist/assets/{LeaderboardAvatar-DS4YJUH4.js → LeaderboardAvatar-j3c8hJFh.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as l,j as c,P as h}from"./main-
|
|
1
|
+
import{R as l,j as c,P as h}from"./main-DY9GCwr_.js";function x(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function d(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=x(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:d(t)})}export{g as L};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-
|
|
2
|
-
import{c as ma,j as e,R as xa,E as n,P as d,r as c,at as ua,au as ga,Z as ba,_ as pa,av as ha,a as fa,b as ya,aw as ka,ax as wa,ay as se,a6 as ja,az as va,m as Na,S as pe,L as _a,F as Sa,H as Ca,aA as La,aB as Ma,aC as Ie,aD as Aa,a4 as Fe,I as Ea}from"./main-CdcVAe5U.js";import{S as Ta}from"./Select-xQYnyBsI.js";import{a as Pa,C as Ka,u as Ra,b as za,c as Be,D as Ia,d as Ba,S as $a,h as Ua,s as Da,K as Oa,P as Fa}from"./use-ordered-list-BaxsXpRO.js";import{u as Ga}from"./useCurrency-B681uTdf.js";import{u as X}from"./useTokenFormat-C_ILPUqQ.js";import{L as J}from"./LeaderboardAvatar-DS4YJUH4.js";import{s as Ha,a as Ya,A as Wa,t as Va,b as Za}from"./AchievementBadge-DZHEunSw.js";import{u as Ja}from"./use-community-stats-fL_RF-Ik.js";import"./SelectItemText-D7zYmQgG.js";import"./useScrollLock-C4RZac0I.js";import"./check-CdnSDWAp.js";import"./zap-DMz4UIzI.js";import"./flame-DJub-92G.js";const qa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Xa=ma("arrow-right",qa),Qa=a=>{let{transform:r}=a;return{...r,y:0}};function H(a,{min:r,max:o,fallback:s}){const l=Number(a);if(!Number.isFinite(l))return s;const i=Math.floor(l);return i<r?r:i>o?o:i}function er(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),s=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,s-2,s-1,s,s+1,s+2]),i=Array.from(l).filter(u=>Number.isInteger(u)&&u>=1&&u<=o).sort((u,p)=>u-p),m=[];let b=null;for(const u of i)b!=null&&u-b>1&&m.push(null),m.push(u),b=u;return m}function ar({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,s=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,s||1):1e6,fallback:1}),i=l>1,m=o?l<s:!0;return{canPrev:i,canNext:m,safePage:l,safeTotal:s}}function rr({entries:a,me:r,meLabel:o}){const s=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||s.some(m=>!!m?.is_me)?s:[{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:[]},...s]}function tr(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.ceil(o/s)}const or=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function sr({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${or.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ne=xa.memo(function({badges:r,max:o=3,className:s=""}){const l=Ha((r||[]).filter(i=>i&&Ya.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 ${s}`,children:l.map((i,m)=>e.jsx("span",{title:n("achievements.mini.tooltip",{name:n(Za(i.id,"name")),tier:n(`achievements.tier.${Va(i.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Wa,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),q=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],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 ie(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function le(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function nr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",s=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(ie(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(le(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),q.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",s)})},l.key))]})}function ir({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(s,l)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},l))})]})}function lr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(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"})}),q.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(nr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(ir,{index:o},o))})]})}function dr({id:a,thClassName:r,children:o}){const{attributes:s,listeners:l,setNodeRef:i,transform:m,transition:b,isDragging:u}=Pa({id:a}),p=Ka.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=u?"20":"",g.style.position=p?"relative":"",g.style.boxShadow=u?h:""}),()=>{f.forEach(g=>{g.style.transform="",g.style.transition="",g.style.zIndex="",g.style.position="",g.style.boxShadow=""})}},[a,p,b,u]);const j={transform:p,transition:b,position:p?"relative":void 0,zIndex:u?20:void 0,boxShadow:u?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:i,style:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...s,...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",u&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const cr="tokentracker.leaderboard.columnOrder.v1";function mr(a){return Ra(cr,a)}const xr=50;function ur(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.min(100,Math.max(1,Math.ceil(o/s*100)))}function Ye(a){return typeof a=="string"?a.trim():""}function gr(a){const r=Ye(a);return r?r.toLowerCase()==="anonymous":!0}function br({me:a,totalEntries:r,meLabel:o,onOpenProfile:s,onJumpToMe:l,canJump:i,className:m}){const b=a&&typeof a.rank=="number"?a.rank:null;if(!b)return null;const u=Number(r)||0,p=ur(b,u),j=Ye(a?.display_name),f=!j||gr(j)?o||"You":j,h=a?.user_id||f,g=s||(i?l:null),A=typeof g=="function",_=A?"button":"div",Q=A?{type:"button",onClick:g,"aria-label":n(s?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(_,{...Q,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",A?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",m),children:[e.jsx(J,{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<=xr&&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:n("leaderboard.summary.percentile",{p:String(p)})}),A?e.jsx(Xa,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const pr=c.lazy(()=>Fe(()=>import("./LeaderboardProfileModal-_BFaNtZo.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])).then(a=>({default:a.LeaderboardProfileModal}))),hr=c.lazy(()=>Fe(()=>import("./CommunityStatsModal-CIWJXo8n.js"),__vite__mapDeps([18,1,2,12,5,16,17,19,20])).then(a=>({default:a.CommunityStatsModal}))),de=[10,20,50,100],ce=20,We="tokentracker:leaderboard:pageSize";function fr(){if(typeof window>"u")return ce;try{const a=window.localStorage.getItem(We),r=Number(a);if(de.includes(r))return r}catch{}return ce}function me(a,r,o){const s=Number(a);if(!Number.isFinite(s)||s<=0)return"-";const l=Sa(r),i=r===Ea?s:s*o;return i>=1e3?`${l}${Math.round(i).toLocaleString()}`:i>=10?`${l}${Math.round(i)}`:`${l}${i.toFixed(2)}`}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=X();return e.jsx("span",{title:o(a),children:r(a)})}function yr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:s}=X();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:n("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:e.jsx("span",{title:s(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children: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:n("leaderboard.community.devs_chip")})]})]})}function $e({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:s,formatTokensTooltip:l}=X(),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/60";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:s(a?.[b.key])},b.key))}function kr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const wr={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 jr({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 vr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(pe,{provider:"GITHUB",size:11})})}function Nr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:s}=X(),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=n(i.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${s(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(pe,{provider:kr(i),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[i.key])})]},i.key)})})}function _r({entry:a,entryIdx:r,name:o,meLabel:s,currency:l,rate:i,orderedColumns:m,placeholder:b,onOpenProfile:u}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,j=!p&&ge(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,g=p?s:o,A=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),u(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>u(f):void 0,onKeyDown:h?A:void 0,"aria-label":h?n("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(jr,{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",wr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(J,{size:"md",avatarUrl:a?.avatar_url,displayName:g,seed:be(a,g)})}),a?.github_url&&e.jsx(vr,{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(ne,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:n("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:me(a?.estimated_cost_usd,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:n("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(Nr,{entry:a,orderedColumns:m})]},`mobile-row-${a?.rank}-${g}`)}const Sr={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 Ue({rank:a,placeholder:r}){const o=Sr[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 De(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Cr(a){if(!a)return n("shared.error.prefix",{error:n("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||n("leaderboard.error.unknown");return n("shared.error.prefix",{error:o})}function ue(a){return typeof a!="string"?"":a.trim()}function ge(a){const r=ue(a);return r?r.toLowerCase()==="anonymous":!0}function be(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function 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":n("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(pe,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:n("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[n("leaderboard.github.tooltipPrefix")," ",e.jsx(_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:n("leaderboard.github.tooltipSettingsLink")})," ",n("leaderboard.github.tooltipSuffix")]})]})]})}function Fr({auth:a,signedIn:r,sessionSoftExpired:o}){const s=ua(),l=ga(),{openLoginModal:i}=ba(),{signedIn:m,loading:b,user:u}=pa(),{currency:p,rate:j}=Ga(),f=c.useMemo(()=>ha(),[]),h=fa(),g=r&&!o,A=c.useMemo(()=>g&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,g]),_=g?A:null,Q=g&&ya(_),ee=n("shared.placeholder.short"),Ve=c.useMemo(()=>q.map(t=>t.key),[]),{order:ae,reorder:he}=mr(Ve),fe=c.useMemo(()=>{const t=new Map;for(const x of q)t.set(x.key,x);return t},[]),B=c.useMemo(()=>ae.map(t=>fe.get(t)).filter(Boolean),[ae,fe]),Ze=za(Be(Fa,{activationConstraint:{distance:6}}),Be(Oa,{coordinateGetter:Da})),Je=c.useCallback(t=>{const{active:x,over:w}=t;!w||x.id===w.id||he(String(x.id),String(w.id))},[he]),[re,T]=c.useState(1),[S,qe]=c.useState(fr),[ye,ke]=c.useState(null),[Xe,we]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&ke(t.trim())},[]),Qe=c.useCallback(()=>ke(null),[]),ea=c.useCallback(t=>{const x=de.includes(t)?t:ce;qe(x),T(1);try{window.localStorage.setItem(We,String(x))}catch{}},[]),[je,aa]=c.useState(0),[ra,ta]=c.useState(()=>ka()),[ve,Ne]=c.useState(!1),N=c.useMemo(()=>{const t=new URLSearchParams(s?.search||"");return De(t.get("period"))||"total"},[s?.search]),oa=t=>{const x=De(t);if(!x||x===N)return;const w=new URLSearchParams(s?.search||"");w.set("period",x),T(1),l(`${s?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{b||h||m||i()},[m,b,h,i]),c.useEffect(()=>{T(1)},[N]);const W=c.useMemo(()=>(H(re,{min:1,max:1e6,fallback:1})-1)*S,[re,S]),R=c.useMemo(()=>h?"mock":b?"unavailable":m?"cloud":r?"local":f?"public":"unavailable",[b,m,f,h,r]),k=c.useMemo(()=>wa({accessMode:R,baseUrl:f,mockEnabled:h,userId:u?.id||null,period:N,pageSize:S,offset:W}),[u?.id,R,f,W,h,S,N]),[$,U]=c.useState(()=>{const t=se(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!f&&!h||!h&&R==="unavailable"){U({loading:!1,error:null,data:null,contextKey:null});return}const t=se(k);let x=!0;return U(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await ja({userId:u?.id||null,period:N,limit:S,offset:W});x&&(va(w,{activeContextKey:k,contextKey:k,source:je>0?"manual-refresh":"page-load"}),U({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!x)return;const E=Cr(w);U(F=>F.contextKey===k?{...F,loading:!1,error:E}:{loading:!1,error:E,data:null,contextKey:k})}),()=>{x=!1}},[f,R,u?.id,k,W,je,h,N,S]);const te=c.useMemo(()=>$.contextKey===k?null:se(k),[k,$.contextKey]),v=c.useMemo(()=>$.contextKey===k?$:te?{loading:!1,error:null,data:te.data,contextKey:k}:{loading:!!(f||h)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,f,k,$,h,te]),C=v.data,D=C?.total_pages??null,sa=C?.total_entries??0,P=C?.page??re,na=c.useMemo(()=>er(P,D),[P,D]),_e=C?.from||null,Se=C?.to||null,Ce=C?.generated_at||null,Le=Ja(),K=C?.me||null,z=n("leaderboard.me_label"),Me=n("leaderboard.anon_label"),Ae=n("leaderboard.period.week"),Ee=n("leaderboard.period.month"),Te=n("leaderboard.period.total"),Pe=N==="month"?Ee:N==="total"?Te:Ae,V=c.useMemo(()=>{const t=Array.isArray(C?.entries)?C.entries:[];return rr({entries:t,me:K,meLabel:z})},[C?.entries,K,z]),I=c.useMemo(()=>tr(K?.rank,S),[K?.rank,S]),ia=I!=null&&I===P,la=c.useCallback(()=>{I!=null&&T(I)},[I]),da=async()=>{Ne(!0);try{La(!0),ta(!0),await Ma(()=>Ie(_));const t=await Ie(_);t&&await Aa({accessToken:t,period:N,source:"leaderboard-enable-sync"}),aa(x=>x+1)}catch(t){console.warn("[tokentracker] sync:",t)}finally{Ne(!1)}},{canPrev:Ke,canNext:Re}=ar({page:P,totalPages:D}),Z=Array.isArray(V)&&V.length!==0;let O=null;v.loading&&!Z?O=e.jsx(lr,{rows:S}):v.error&&!Z?O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):Z?O=e.jsxs(Ia,{sensors:Ze,collisionDetection:Ba,modifiers:[Qa],onDragEnd:Je,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:n("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:n("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:n("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:n("leaderboard.column.est_cost")}),e.jsx($a,{items:ae,strategy:Ua,children:B.map(t=>e.jsx(dr,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(sr,{iconSrc:t.icon,label:n(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:V.map((t,x)=>{if(t?.is_ellipsis){const M=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:M,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${x}`)}const w=!!t?.is_me,E=typeof t?.user_id=="string"?t.user_id:null,F=ue(t?.display_name),ca=ge(F)?Me:F,L=w?z:ca,G=!!E,ze=G?{role:"button",tabIndex:0,onClick:G?()=>Y(E):void 0,onKeyDown:G?M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),Y(E))}:void 0,"aria-label":n("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const M=!!t?.is_pinned;return e.jsxs("tr",{...ze,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",M?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(ie(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",M&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx(Ue,{rank:t?.rank,placeholder:ee})}),e.jsx("td",{className:le(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(J,{avatarUrl:t?.avatar_url,displayName:L,seed:be(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ne,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(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:me(t?.estimated_cost_usd,p,j)}),e.jsx($e,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${M?"-pin":""}`)}return e.jsxs("tr",{...ze,className:d("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(ie(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(Ue,{rank:t?.rank,placeholder:ee})}),e.jsx("td",{className:le(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(J,{avatarUrl:t?.avatar_url,displayName:L,seed:be(t,L)})}),t?.github_url&&e.jsx(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(ne,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(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:me(t?.estimated_cost_usd,p,j)}),e.jsx($e,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:V.map((t,x)=>{const w=ue(t?.display_name),E=ge(w)?Me:w;return e.jsx(_r,{entry:t,entryIdx:x,name:t?.is_me?z:E,meLabel:z,currency:p,rate:j,orderedColumns:B,placeholder:ee,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${x}`)})})]}):O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.empty")})});let oe=null;return typeof D=="number"?oe=na.map((t,x)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.pagination.ellipsis")},`ellipsis-${x}`):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:()=>T(t),disabled:v.loading,children:String(t)},`page-${t}`)):oe=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.pagination.page_unknown",{page:String(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:n("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?n("leaderboard.range.total"):_e&&Se?n("leaderboard.range",{period:Pe,from:_e,to:Se}):n("leaderboard.range_loading",{period:Pe}),Ce&&e.jsx("span",{className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-400 dark:border-oai-gray-800 dark:text-oai-gray-500 sm:inline-block",children:n("leaderboard.generated_at",{ts:Ce})})]}),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 x=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",x?"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"?Ae:t==="month"?Ee:Te}),x&&e.jsx(Na.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(yr,{communityStats:Le,onClick:()=>we(!0)}),e.jsx(br,{me:K,totalEntries:sa,meLabel:z,onOpenProfile:K?.user_id?()=>Y(K.user_id):void 0,onJumpToMe:la,canJump:I!=null&&!ia&&!v.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.signin_prompt")}),e.jsx("button",{onClick: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:n("leaderboard.signin_button")})]}),g&&Q&&!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:n("leaderboard.sync_prompt")}),e.jsx("button",{onClick:da,disabled:ve,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:ve?n("leaderboard.sync_button.busy"):n("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&Z?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:n("leaderboard.pagination.page_size_label")}),e.jsx(Ta,{id:"leaderboard-page-size",value:S,onValueChange:t=>ea(Number(t)),disabled:v.loading,ariaLabel:n("leaderboard.pagination.page_size_label"),options:de.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",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:()=>T(t=>Math.max(1,t-1)),disabled:!Ke||v.loading,children:n("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",D||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:oe}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",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:()=>T(t=>t+1),disabled:!Re||v.loading,children:n("leaderboard.pagination.next")})]})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:n("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:n("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(pr,{isOpen:!!ye,userId:ye,period:N,accessToken:_,onClose:Qe}),e.jsx(hr,{isOpen:Xe,onClose:()=>we(!1),communityStats:Le})]})]})}export{Fr as LeaderboardPage};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-DvdDUUFU.js","assets/main-DY9GCwr_.js","assets/main-BbNuscIe.css","assets/provider-display-B6jUb-Ud.js","assets/useCurrency-f-244MeL.js","assets/useTokenFormat-Cz_Gqk4n.js","assets/info-482LCF96.js","assets/LeaderboardAvatar-j3c8hJFh.js","assets/AchievementBadge-DX-LggX4.js","assets/zap-DN1VaJU3.js","assets/flame-CyiQUQcA.js","assets/AchievementsSection-DtzmIf9I.js","assets/format-tokens-DlkEG-2M.js","assets/arrow-up-right-DMGmqVqe.js","assets/link-2-DY_0gFgX.js","assets/check-D1YFQP0r.js","assets/DialogTitle-DeXrE3Jr.js","assets/useScrollLock-D6X4FH8b.js","assets/CommunityStatsModal-C9mK6lce.js","assets/DialogClose-Be-pyoVu.js","assets/DialogDescription-doJbC76C.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as ma,j as e,R as xa,E as n,P as d,r as c,at as ua,au as ga,Z as ba,_ as pa,av as ha,a as fa,b as ya,aw as ka,ax as wa,ay as se,a6 as ja,az as va,m as Na,S as pe,L as _a,F as Sa,H as Ca,aA as La,aB as Ma,aC as Ie,aD as Aa,a4 as Fe,I as Ea}from"./main-DY9GCwr_.js";import{S as Ta}from"./Select-B3plxksi.js";import{a as Pa,C as Ka,u as Ra,b as za,c as Be,D as Ia,d as Ba,S as $a,h as Ua,s as Da,K as Oa,P as Fa}from"./use-ordered-list-IRGftZaJ.js";import{u as Ga}from"./useCurrency-f-244MeL.js";import{u as X}from"./useTokenFormat-Cz_Gqk4n.js";import{L as J}from"./LeaderboardAvatar-j3c8hJFh.js";import{s as Ha,a as Ya,A as Wa,t as Va,b as Za}from"./AchievementBadge-DX-LggX4.js";import{u as Ja}from"./use-community-stats-DPHOiIBu.js";import"./SelectItemText-Deyr9uQd.js";import"./useScrollLock-D6X4FH8b.js";import"./check-D1YFQP0r.js";import"./zap-DN1VaJU3.js";import"./flame-CyiQUQcA.js";const qa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Xa=ma("arrow-right",qa),Qa=a=>{let{transform:r}=a;return{...r,y:0}};function H(a,{min:r,max:o,fallback:s}){const l=Number(a);if(!Number.isFinite(l))return s;const i=Math.floor(l);return i<r?r:i>o?o:i}function er(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),s=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,s-2,s-1,s,s+1,s+2]),i=Array.from(l).filter(u=>Number.isInteger(u)&&u>=1&&u<=o).sort((u,p)=>u-p),m=[];let b=null;for(const u of i)b!=null&&u-b>1&&m.push(null),m.push(u),b=u;return m}function ar({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,s=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,s||1):1e6,fallback:1}),i=l>1,m=o?l<s:!0;return{canPrev:i,canNext:m,safePage:l,safeTotal:s}}function rr({entries:a,me:r,meLabel:o}){const s=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||s.some(m=>!!m?.is_me)?s:[{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:[]},...s]}function tr(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.ceil(o/s)}const or=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function sr({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${or.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ne=xa.memo(function({badges:r,max:o=3,className:s=""}){const l=Ha((r||[]).filter(i=>i&&Ya.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 ${s}`,children:l.map((i,m)=>e.jsx("span",{title:n("achievements.mini.tooltip",{name:n(Za(i.id,"name")),tier:n(`achievements.tier.${Va(i.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Wa,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),q=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],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 ie(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function le(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function nr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",s=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(ie(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(le(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),q.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",s)})},l.key))]})}function ir({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(s,l)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},l))})]})}function lr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(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"})}),q.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(nr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(ir,{index:o},o))})]})}function dr({id:a,thClassName:r,children:o}){const{attributes:s,listeners:l,setNodeRef:i,transform:m,transition:b,isDragging:u}=Pa({id:a}),p=Ka.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=u?"20":"",g.style.position=p?"relative":"",g.style.boxShadow=u?h:""}),()=>{f.forEach(g=>{g.style.transform="",g.style.transition="",g.style.zIndex="",g.style.position="",g.style.boxShadow=""})}},[a,p,b,u]);const j={transform:p,transition:b,position:p?"relative":void 0,zIndex:u?20:void 0,boxShadow:u?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:i,style:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...s,...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",u&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const cr="tokentracker.leaderboard.columnOrder.v1";function mr(a){return Ra(cr,a)}const xr=50;function ur(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.min(100,Math.max(1,Math.ceil(o/s*100)))}function Ye(a){return typeof a=="string"?a.trim():""}function gr(a){const r=Ye(a);return r?r.toLowerCase()==="anonymous":!0}function br({me:a,totalEntries:r,meLabel:o,onOpenProfile:s,onJumpToMe:l,canJump:i,className:m}){const b=a&&typeof a.rank=="number"?a.rank:null;if(!b)return null;const u=Number(r)||0,p=ur(b,u),j=Ye(a?.display_name),f=!j||gr(j)?o||"You":j,h=a?.user_id||f,g=s||(i?l:null),A=typeof g=="function",_=A?"button":"div",Q=A?{type:"button",onClick:g,"aria-label":n(s?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(_,{...Q,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",A?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",m),children:[e.jsx(J,{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<=xr&&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:n("leaderboard.summary.percentile",{p:String(p)})}),A?e.jsx(Xa,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const pr=c.lazy(()=>Fe(()=>import("./LeaderboardProfileModal-DvdDUUFU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])).then(a=>({default:a.LeaderboardProfileModal}))),hr=c.lazy(()=>Fe(()=>import("./CommunityStatsModal-C9mK6lce.js"),__vite__mapDeps([18,1,2,12,5,16,17,19,20])).then(a=>({default:a.CommunityStatsModal}))),de=[10,20,50,100],ce=20,We="tokentracker:leaderboard:pageSize";function fr(){if(typeof window>"u")return ce;try{const a=window.localStorage.getItem(We),r=Number(a);if(de.includes(r))return r}catch{}return ce}function me(a,r,o){const s=Number(a);if(!Number.isFinite(s)||s<=0)return"-";const l=Sa(r),i=r===Ea?s:s*o;return i>=1e3?`${l}${Math.round(i).toLocaleString()}`:i>=10?`${l}${Math.round(i)}`:`${l}${i.toFixed(2)}`}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=X();return e.jsx("span",{title:o(a),children:r(a)})}function yr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:s}=X();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:n("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:e.jsx("span",{title:s(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children: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:n("leaderboard.community.devs_chip")})]})]})}function $e({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:s,formatTokensTooltip:l}=X(),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/60";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:s(a?.[b.key])},b.key))}function kr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const wr={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 jr({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 vr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(pe,{provider:"GITHUB",size:11})})}function Nr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:s}=X(),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=n(i.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${s(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(pe,{provider:kr(i),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[i.key])})]},i.key)})})}function _r({entry:a,entryIdx:r,name:o,meLabel:s,currency:l,rate:i,orderedColumns:m,placeholder:b,onOpenProfile:u}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,j=!p&&ge(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,g=p?s:o,A=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),u(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>u(f):void 0,onKeyDown:h?A:void 0,"aria-label":h?n("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(jr,{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",wr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(J,{size:"md",avatarUrl:a?.avatar_url,displayName:g,seed:be(a,g)})}),a?.github_url&&e.jsx(vr,{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(ne,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:n("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:me(a?.estimated_cost_usd,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:n("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(Nr,{entry:a,orderedColumns:m})]},`mobile-row-${a?.rank}-${g}`)}const Sr={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 Ue({rank:a,placeholder:r}){const o=Sr[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 De(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Cr(a){if(!a)return n("shared.error.prefix",{error:n("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||n("leaderboard.error.unknown");return n("shared.error.prefix",{error:o})}function ue(a){return typeof a!="string"?"":a.trim()}function ge(a){const r=ue(a);return r?r.toLowerCase()==="anonymous":!0}function be(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function 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":n("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(pe,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:n("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[n("leaderboard.github.tooltipPrefix")," ",e.jsx(_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:n("leaderboard.github.tooltipSettingsLink")})," ",n("leaderboard.github.tooltipSuffix")]})]})]})}function Fr({auth:a,signedIn:r,sessionSoftExpired:o}){const s=ua(),l=ga(),{openLoginModal:i}=ba(),{signedIn:m,loading:b,user:u}=pa(),{currency:p,rate:j}=Ga(),f=c.useMemo(()=>ha(),[]),h=fa(),g=r&&!o,A=c.useMemo(()=>g&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,g]),_=g?A:null,Q=g&&ya(_),ee=n("shared.placeholder.short"),Ve=c.useMemo(()=>q.map(t=>t.key),[]),{order:ae,reorder:he}=mr(Ve),fe=c.useMemo(()=>{const t=new Map;for(const x of q)t.set(x.key,x);return t},[]),B=c.useMemo(()=>ae.map(t=>fe.get(t)).filter(Boolean),[ae,fe]),Ze=za(Be(Fa,{activationConstraint:{distance:6}}),Be(Oa,{coordinateGetter:Da})),Je=c.useCallback(t=>{const{active:x,over:w}=t;!w||x.id===w.id||he(String(x.id),String(w.id))},[he]),[re,T]=c.useState(1),[S,qe]=c.useState(fr),[ye,ke]=c.useState(null),[Xe,we]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&ke(t.trim())},[]),Qe=c.useCallback(()=>ke(null),[]),ea=c.useCallback(t=>{const x=de.includes(t)?t:ce;qe(x),T(1);try{window.localStorage.setItem(We,String(x))}catch{}},[]),[je,aa]=c.useState(0),[ra,ta]=c.useState(()=>ka()),[ve,Ne]=c.useState(!1),N=c.useMemo(()=>{const t=new URLSearchParams(s?.search||"");return De(t.get("period"))||"total"},[s?.search]),oa=t=>{const x=De(t);if(!x||x===N)return;const w=new URLSearchParams(s?.search||"");w.set("period",x),T(1),l(`${s?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{b||h||m||i()},[m,b,h,i]),c.useEffect(()=>{T(1)},[N]);const W=c.useMemo(()=>(H(re,{min:1,max:1e6,fallback:1})-1)*S,[re,S]),R=c.useMemo(()=>h?"mock":b?"unavailable":m?"cloud":r?"local":f?"public":"unavailable",[b,m,f,h,r]),k=c.useMemo(()=>wa({accessMode:R,baseUrl:f,mockEnabled:h,userId:u?.id||null,period:N,pageSize:S,offset:W}),[u?.id,R,f,W,h,S,N]),[$,U]=c.useState(()=>{const t=se(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!f&&!h||!h&&R==="unavailable"){U({loading:!1,error:null,data:null,contextKey:null});return}const t=se(k);let x=!0;return U(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await ja({userId:u?.id||null,period:N,limit:S,offset:W});x&&(va(w,{activeContextKey:k,contextKey:k,source:je>0?"manual-refresh":"page-load"}),U({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!x)return;const E=Cr(w);U(F=>F.contextKey===k?{...F,loading:!1,error:E}:{loading:!1,error:E,data:null,contextKey:k})}),()=>{x=!1}},[f,R,u?.id,k,W,je,h,N,S]);const te=c.useMemo(()=>$.contextKey===k?null:se(k),[k,$.contextKey]),v=c.useMemo(()=>$.contextKey===k?$:te?{loading:!1,error:null,data:te.data,contextKey:k}:{loading:!!(f||h)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,f,k,$,h,te]),C=v.data,D=C?.total_pages??null,sa=C?.total_entries??0,P=C?.page??re,na=c.useMemo(()=>er(P,D),[P,D]),_e=C?.from||null,Se=C?.to||null,Ce=C?.generated_at||null,Le=Ja(),K=C?.me||null,z=n("leaderboard.me_label"),Me=n("leaderboard.anon_label"),Ae=n("leaderboard.period.week"),Ee=n("leaderboard.period.month"),Te=n("leaderboard.period.total"),Pe=N==="month"?Ee:N==="total"?Te:Ae,V=c.useMemo(()=>{const t=Array.isArray(C?.entries)?C.entries:[];return rr({entries:t,me:K,meLabel:z})},[C?.entries,K,z]),I=c.useMemo(()=>tr(K?.rank,S),[K?.rank,S]),ia=I!=null&&I===P,la=c.useCallback(()=>{I!=null&&T(I)},[I]),da=async()=>{Ne(!0);try{La(!0),ta(!0),await Ma(()=>Ie(_));const t=await Ie(_);t&&await Aa({accessToken:t,period:N,source:"leaderboard-enable-sync"}),aa(x=>x+1)}catch(t){console.warn("[tokentracker] sync:",t)}finally{Ne(!1)}},{canPrev:Ke,canNext:Re}=ar({page:P,totalPages:D}),Z=Array.isArray(V)&&V.length!==0;let O=null;v.loading&&!Z?O=e.jsx(lr,{rows:S}):v.error&&!Z?O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):Z?O=e.jsxs(Ia,{sensors:Ze,collisionDetection:Ba,modifiers:[Qa],onDragEnd:Je,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:n("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:n("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:n("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:n("leaderboard.column.est_cost")}),e.jsx($a,{items:ae,strategy:Ua,children:B.map(t=>e.jsx(dr,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(sr,{iconSrc:t.icon,label:n(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:V.map((t,x)=>{if(t?.is_ellipsis){const M=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:M,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${x}`)}const w=!!t?.is_me,E=typeof t?.user_id=="string"?t.user_id:null,F=ue(t?.display_name),ca=ge(F)?Me:F,L=w?z:ca,G=!!E,ze=G?{role:"button",tabIndex:0,onClick:G?()=>Y(E):void 0,onKeyDown:G?M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),Y(E))}:void 0,"aria-label":n("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const M=!!t?.is_pinned;return e.jsxs("tr",{...ze,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",M?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(ie(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",M&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx(Ue,{rank:t?.rank,placeholder:ee})}),e.jsx("td",{className:le(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(J,{avatarUrl:t?.avatar_url,displayName:L,seed:be(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ne,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(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:me(t?.estimated_cost_usd,p,j)}),e.jsx($e,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${M?"-pin":""}`)}return e.jsxs("tr",{...ze,className:d("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(ie(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(Ue,{rank:t?.rank,placeholder:ee})}),e.jsx("td",{className:le(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(J,{avatarUrl:t?.avatar_url,displayName:L,seed:be(t,L)})}),t?.github_url&&e.jsx(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(ne,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(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:me(t?.estimated_cost_usd,p,j)}),e.jsx($e,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:V.map((t,x)=>{const w=ue(t?.display_name),E=ge(w)?Me:w;return e.jsx(_r,{entry:t,entryIdx:x,name:t?.is_me?z:E,meLabel:z,currency:p,rate:j,orderedColumns:B,placeholder:ee,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${x}`)})})]}):O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.empty")})});let oe=null;return typeof D=="number"?oe=na.map((t,x)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.pagination.ellipsis")},`ellipsis-${x}`):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:()=>T(t),disabled:v.loading,children:String(t)},`page-${t}`)):oe=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.pagination.page_unknown",{page:String(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:n("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?n("leaderboard.range.total"):_e&&Se?n("leaderboard.range",{period:Pe,from:_e,to:Se}):n("leaderboard.range_loading",{period:Pe}),Ce&&e.jsx("span",{className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-400 dark:border-oai-gray-800 dark:text-oai-gray-500 sm:inline-block",children:n("leaderboard.generated_at",{ts:Ce})})]}),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 x=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",x?"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"?Ae:t==="month"?Ee:Te}),x&&e.jsx(Na.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(yr,{communityStats:Le,onClick:()=>we(!0)}),e.jsx(br,{me:K,totalEntries:sa,meLabel:z,onOpenProfile:K?.user_id?()=>Y(K.user_id):void 0,onJumpToMe:la,canJump:I!=null&&!ia&&!v.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.signin_prompt")}),e.jsx("button",{onClick: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:n("leaderboard.signin_button")})]}),g&&Q&&!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:n("leaderboard.sync_prompt")}),e.jsx("button",{onClick:da,disabled:ve,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:ve?n("leaderboard.sync_button.busy"):n("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&Z?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:n("leaderboard.pagination.page_size_label")}),e.jsx(Ta,{id:"leaderboard-page-size",value:S,onValueChange:t=>ea(Number(t)),disabled:v.loading,ariaLabel:n("leaderboard.pagination.page_size_label"),options:de.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",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:()=>T(t=>Math.max(1,t-1)),disabled:!Ke||v.loading,children:n("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",D||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:oe}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",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:()=>T(t=>t+1),disabled:!Re||v.loading,children:n("leaderboard.pagination.next")})]})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:n("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:n("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(pr,{isOpen:!!ye,userId:ye,period:N,accessToken:_,onClose:Qe}),e.jsx(hr,{isOpen:Xe,onClose:()=>we(!1),communityStats:Le})]})]})}export{Fr as LeaderboardPage};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-
|
|
2
|
-
import{c as te,_ as O,r as h,dD as se,j as e,E as n,dE as ie,aC as oe,dF as ne,P as c,dG as le,aG as de,L as ce,R as W,dH as me,ai as xe,k as ge,S as $,X as pe,H as he,a4 as ue,G as fe,aj as be}from"./main-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-CZqdIWZQ.js","assets/main-DY9GCwr_.js","assets/main-BbNuscIe.css","assets/AchievementBadge-DX-LggX4.js","assets/zap-DN1VaJU3.js","assets/flame-CyiQUQcA.js","assets/use-transform-BJNb33iJ.js","assets/AchievementsSection-DtzmIf9I.js","assets/format-tokens-DlkEG-2M.js","assets/DialogTitle-DeXrE3Jr.js","assets/useScrollLock-D6X4FH8b.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as te,_ as O,r as h,dD as se,j as e,E as n,dE as ie,aC as oe,dF as ne,P as c,dG as le,aG as de,L as ce,R as W,dH as me,ai as xe,k as ge,S as $,X as pe,H as he,a4 as ue,G as fe,aj as be}from"./main-DY9GCwr_.js";import{A as ye,f as ke}from"./provider-display-B6jUb-Ud.js";import{u as je}from"./useCurrency-f-244MeL.js";import{u as G}from"./useTokenFormat-Cz_Gqk4n.js";import{L as X}from"./LeaderboardAvatar-j3c8hJFh.js";import{H as ve,A as Y,s as Ne,a as _e,b as we,t as Ae,h as Se}from"./AchievementBadge-DX-LggX4.js";import{A as Ce}from"./AchievementsSection-DtzmIf9I.js";import{A as B}from"./arrow-up-right-DMGmqVqe.js";import{L as ze}from"./link-2-DY_0gFgX.js";import{C as Me}from"./check-D1YFQP0r.js";import{D as Ie,a as Pe,b as De,c as Le,d as Te,e as $e}from"./DialogTitle-DeXrE3Jr.js";import"./info-482LCF96.js";import"./zap-DN1VaJU3.js";import"./flame-CyiQUQcA.js";import"./format-tokens-DlkEG-2M.js";import"./useScrollLock-D6X4FH8b.js";const Be=[["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"}]],Ue=te("code-xml",Be),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 K({userId:a}){const{signedIn:r,getAccessToken:i}=O(),[t,s]=h.useState(!1),[l,x]=h.useState(0),[o,g]=h.useState(!1),[f,b]=h.useState(!1),[S,C]=h.useState(!1),[z,D]=h.useState([]),[v,N]=h.useState(!1),M=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?(g(!1),(async()=>{const m=await y();try{const p=await se({userId:a,...m});if(d)return;x(Number(p?.count)||0),s(!!p?.liked),g(!0)}catch{if(d)return;x(0),s(!1),g(!0)}})(),()=>{d=!0}):(g(!1),()=>{d=!0})},[a,y]);const k=()=>{C(!0),setTimeout(()=>C(!1),450),N(!0),setTimeout(()=>N(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let u=0;u<12;u++){const j=(u*30+Math.random()*20-10)*(Math.PI/180),I=45+Math.random()*45,V=Math.cos(j)*I,Z=Math.sin(j)*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=++M.current;p.push({id:re,tx:V,ty:Z,rot:J,size:Q,color:ee,shape:ae})}D(u=>[...u,...p]),setTimeout(()=>{D(u=>u.filter(j=>!p.find(I=>I.id===j.id)))},850)},_=async d=>{b(!0);try{const m=await y(),p=await ie({userId:a,action:d,...m});p&&Number.isFinite(Number(p.count))&&x(Number(p.count)),p&&typeof p.liked=="boolean"&&s(p.liked)}catch{s(m=>!m),x(m=>d==="like"?Math.max(0,m-1):m+1)}finally{b(!1)}},w=d=>{d.stopPropagation(),!(!a||!o||f)&&(t?(s(!1),x(m=>Math.max(0,m-1)),_("unlike")):(s(!0),x(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{c as te,_ as O,r as h,dD as se,j as e,E as n,dE as ie,aC as oe,dF as ne,P
|
|
|
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:!o||f,"aria-label":t?n("leaderboard.profile.like.aria_unlike"):n("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:S?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(ve,{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"} ${v?"tt-num-anim":""}`,children:o?l:"·"})]})]})}function Fe({badge:a,badgeLabel:r,className:i="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${i}`,children:[e.jsx(X,{...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(Y,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Re({badges:a,isOwn:r=!1,onSelect:i,className:t=""}){const s=Ne((Array.isArray(a)?a:[]).filter(l=>l&&_e.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,x)=>{const o=(l.tier||0)>=1,g=n(we(l.id,"name")),f=o?n(`achievements.tier.${Ae(l.tier)}`):n("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:i?()=>i(l):void 0,title:`${g} · ${f}`,"aria-label":n("achievements.badge.aria",{name:g,tier:f}),style:{zIndex:s.length-x},className:"group relative shrink-0 -mr-2.5 rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60",children:e.jsx(Y,{badgeId:l.id,tier:l.tier,locked:!o,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 He=W.lazy(()=>ue(()=>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:!o||f,"aria-label":t?n("leaderboard.profile.like.aria_unlike"):n("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:S?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(ve,{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"} ${v?"tt-num-anim":""}`,children:o?l:"·"})]})]})}function Fe({badge:a,badgeLabel:r,className:i="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${i}`,children:[e.jsx(X,{...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(Y,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Re({badges:a,isOwn:r=!1,onSelect:i,className:t=""}){const s=Ne((Array.isArray(a)?a:[]).filter(l=>l&&_e.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,x)=>{const o=(l.tier||0)>=1,g=n(we(l.id,"name")),f=o?n(`achievements.tier.${Ae(l.tier)}`):n("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:i?()=>i(l):void 0,title:`${g} · ${f}`,"aria-label":n("achievements.badge.aria",{name:g,tier:f}),style:{zIndex:s.length-x},className:"group relative shrink-0 -mr-2.5 rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60",children:e.jsx(Y,{badgeId:l.id,tier:l.tier,locked:!o,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 He=W.lazy(()=>ue(()=>import("./BadgeDetailModal-CZqdIWZQ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function Ee(a,r,i){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:fe(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 Ee(t,r,i);const s=r==="USD"?t:t*(i||1);return`${r==="USD"?"$":""}${he(s,{decimals:1})}`}function Oe(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 ge({dailyRows:i,weeks:52,to:t})}const We=`
|
|
43
43
|
@keyframes tt-shimmer {
|
|
44
44
|
100% { transform: translateX(100%); }
|
|
45
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as _,j as p,Y as xe,Z as ge,_ as ve,aG as be,L as Tt,aH as we,E as Y,ar as ye}from"./main-
|
|
1
|
+
import{r as _,j as p,Y as xe,Z as ge,_ as ve,aG as be,L as Tt,aH as we,E as Y,ar as ye}from"./main-DY9GCwr_.js";import{u as ke}from"./useCurrency-f-244MeL.js";import{H as Me}from"./HeaderGithubStar-CVPu84a0.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-DvdDUUFU.js";import{D as Te}from"./download-sDeO57uc.js";import"./provider-display-B6jUb-Ud.js";import"./useTokenFormat-Cz_Gqk4n.js";import"./info-482LCF96.js";import"./LeaderboardAvatar-j3c8hJFh.js";import"./AchievementBadge-DX-LggX4.js";import"./zap-DN1VaJU3.js";import"./flame-CyiQUQcA.js";import"./AchievementsSection-DtzmIf9I.js";import"./format-tokens-DlkEG-2M.js";import"./arrow-up-right-DMGmqVqe.js";import"./link-2-DY_0gFgX.js";import"./check-D1YFQP0r.js";import"./DialogTitle-DeXrE3Jr.js";import"./useScrollLock-D6X4FH8b.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,Ee=16,je=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{j as i,P as R,E as n,O as C,r as b,S as Y,aJ as q,a as J,L as Q,aK as Z}from"./main-
|
|
1
|
+
import{j as i,P as R,E as n,O as C,r as b,S as Y,aJ as q,a as J,L as Q,aK as Z}from"./main-DY9GCwr_.js";import{u as ee}from"./use-usage-limits-Dyoqxe1m.js";import{L as p,a as te,l as v,b as ie,u as re}from"./use-limits-display-prefs-BfSnFqTR.js";import{C as D}from"./Card-BSUag_Em.js";import{F as ae}from"./FadeIn-BIj6T_Ni.js";import{L as ne}from"./LocalOnlyNotice-Bm0n3EVD.js";import"./arrow-up-right-DMGmqVqe.js";import"./download-sDeO57uc.js";const oe=[3,2,3,3,2,2,3];function g({className:e}){return i.jsx("div",{className:R("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function le(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(g,{className:"h-3 w-12 shrink-0"}),i.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(g,{className:"h-3 w-[30px] shrink-0"}),i.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function se({bars:e,index:t}){const r=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(g,{className:R("h-4",r)})]}),Array.from({length:e},(o,a)=>i.jsx(le,{},a))]})}function de(){return i.jsx(D,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(g,{className:"h-3.5 w-28"}),oe.map((e,t)=>i.jsx(se,{bars:e,index:t},t))]})})}function ce(e,t){if(!(e>0))return null;const r=(e-t)/e;return Number.isFinite(r)?Math.min(Math.max(r,0),1):null}function ue(e,t,r=.03){return e>t+r}function me(e){const t=Math.max(0,Math.floor(e)),r=Math.floor(t/3600);return r>24?`${Math.floor(r/24)}d`:r>0?`${r}h`:`${Math.floor(t/60)}m`}function xe(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const r=t[e.windowSecondsField];return typeof r=="number"&&r>0?r:null}return null}function _(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function pe({usedPercent:e,windowSeconds:t,resetMs:r,mode:o,now:a=Date.now()}){const s=Math.min(Math.max(Number(e)||0,0),100)/100,d={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(r))return d;const c=Math.max(0,(r-a)/1e3),l=ce(t,c);if(l==null)return d;if(d.expectedPercent=Math.round(l*100),d.paceOver=ue(s,l),s>=.05){const u=o==="remaining"?1-l:l;d.pacePercent=u*100}if(l>.02&&s>0){const u=t*l,m=s/u,x=s/l;x>=1&&m>0?d.runsOutEta=me((1-s)/m):d.projectedEnd=Math.round(Math.min(x,1)*100)}return d}const E=100;function O(e){const t=Date.parse(e);return Number.isFinite(t)?t:null}function ye(e){return Math.max(0,Math.min(E,Math.round(e)))}function ge(e){return new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function he(e,t,r){if(e==null||e>=t)return E;const o=t-e,a=t-r;return ye(a/o*E)}function be(e){const t=e.available_count;return t===null?null:Number.isInteger(t)&&t>=0?t:void 0}function we(e,{now:t}={}){if(!e||typeof e!="object")return null;const r=be(e);if(r===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],a=t instanceof Date?t.getTime():Number(t??Date.now()),s=[];for(const d of o){const c=O(d?.expires_at);if(c==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:n("limits.codex_reset_bank.row_label",{index:l}),expiresAt:ge(c),expiresMs:c,percent:he(O(d?.granted_at),c,a)})}return r===0?null:s.length>0?{kind:"rows",availableCount:r??s.length,rows:s}:r>0?{kind:"count_only",availableCount:r,rows:[]}:null}const T={claude:{windows(e){const t=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(r=>({key:`scoped-${r.label}`,label:r.label,window:r,pctField:"utilization",resetField:"resets_at",windowSeconds:604800})):[];return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},...t]}},codex:{extra:"codex_meta",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"credits",labelKey:"limits.label.codex_credits",window:e.credit_window},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return e.plan_kind==="coding-plan"?[{key:"5h",labelKey:"limits.label.zcode_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.zcode_weekly",window:e.secondary_window},{key:"tools",labelKey:"limits.label.zcode_tools",window:e.tertiary_window}]:[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}}},fe="shrink-0 text-oai-black dark:text-oai-white";function _e(e){const t=_(e);if(!Number.isFinite(t))return null;const r=t-Date.now();if(r<=0)return n("shared.time.now");const o=Math.floor(r/6e4);if(o<60)return`${o}m`;const a=Math.floor(o/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function ke(e,t){const r=t===p.REMAINING?100-e:e;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function f(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function k(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function j(e){const t=Math.max(0,Math.min(100,Number(e)||0)),r=Math.round(t);return t>0&&r===0?n("limits.bar.sub_one_percent"):String(r)}function N(e){const t=Number(e);return Number.isFinite(t)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:t>=100?0:2}).format(t):null}function ve(e){if(!e||typeof e!="object")return null;const t=N(e.used_credits),r=N(e.limit_credits),o=N(e.remaining_credits);return!t||!r||!o?null:n("limits.codex_credits.detail",{used:t,limit:r,remaining:o})}function je(e,t){return pe({usedPercent:f(e.window,e.pctField),windowSeconds:xe(e,e.window),resetMs:_(k(e.window,e.resetField)),mode:t})}function A(e){return Number.isFinite(e)?new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function Ne(e,t,r){const o=[$(e,t,r)],a=_(k(e.window,e.resetField)),s=A(a);if(s&&o.push(n("limits.hover.resets_at",{time:s})),e.key==="credits"){const d=ve(e.window);d&&o.push(d)}return o.join(`
|
|
2
2
|
`)}function G({text:e}){return e?i.jsx("div",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-max max-w-[260px] -translate-x-1/2 whitespace-pre-line rounded-xl border border-oai-gray-200/50 dark:border-oai-gray-800/50 bg-white/90 dark:bg-oai-gray-900/90 backdrop-blur-md px-2.5 py-1.5 text-[10.5px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-xl opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:e}):null}function Me({label:e,pct:t,reset:r,mode:o=p.USED,pacePercent:a=null,paceOver:s=!1,title:d=null}){const c=Math.max(0,Math.min(100,Number(t)||0)),l=o===p.REMAINING?100-c:c,u=Math.round(l),m=l>0&&u===0?Math.max(l,.35):l;let x=String(u);l>0&&u===0&&(x=n("limits.bar.sub_one_percent"));const h=a==null?null:Math.max(0,Math.min(100,a));return i.jsxs("div",{className:"group relative flex items-center gap-2",children:[i.jsx(G,{text:d}),i.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:e}),i.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[i.jsx("div",{className:`${ke(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${m}%`,minWidth:l>0?"3px":0}}),h!=null&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${h}% - 3px)`,width:"6px"}}),i.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${h}% - 1px)`,width:"2px"}})]})]}),i.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:[x,"%"]}),r&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r})]})}function $(e,t,r){const o=e.label??n(e.labelKey),a=r===p.REMAINING,s=l=>a?100-l:l;if(t.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)),u=j(s(l));return a?n("limits.explain.remaining",{label:o,used:u}):n("limits.explain.used",{label:o,used:u})}if(t.paceOver){if(t.runsOutEta)return n("limits.explain.ahead_eta",{label:o,eta:t.runsOutEta});const l=j(s(t.projectedEnd??100));return n(a?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const d=Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)),c=j(s(t.projectedEnd??d));return n(a?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:c})}function Ee({rows:e,mode:t}){if(e.length===0)return null;const r=t===p.REMAINING;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:a})=>{const s=A(_(k(o.window,o.resetField)));return i.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[$(o,a,t),s?i.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",n("limits.hover.resets_at",{time:s})]}):null]},o.key)}),i.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:n(r?"limits.explain.body_remaining":"limits.explain.body")})]})}function Se(e){if(!e)return null;const t=Date.now()-new Date(e).getTime();if(t<0)return null;const r=Math.floor(t/6e4);if(r<1)return n("shared.time.now");if(r<60)return n("shared.time.m_ago",{n:r});const o=Math.floor(r/60);if(o<24)return n("shared.time.h_ago",{n:o});const a=Math.floor(o/24);return n("shared.time.d_ago",{n:a})}function S({name:e,providerId:t,children:r,expandable:o=!1,expanded:a=!1,onToggle:s,badge:d=null}){const c=ie(t),l=i.jsxs("div",{className:"flex items-center gap-1.5",children:[c?i.jsx(Y,{provider:c,size:14,className:fe}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),d]});return o?i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":a,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,r]}):i.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,r]})}const Pe=te;function w({children:e,tone:t="neutral"}){const r=t==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:e})}function Ie({rows:e,mode:t,extra:r=null}){const o=e.length===0&&!r;return i.jsxs(i.Fragment,{children:[e.map(({spec:a,pace:s})=>i.jsx(Me,{label:a.label??n(a.labelKey),pct:f(a.window,a.pctField),reset:_e(k(a.window,a.resetField)),mode:t,pacePercent:s.pacePercent,paceOver:s.paceOver,title:Ne(a,s,t)},a.key)),o?i.jsx(w,{children:n("limits.status.no_data")}):null,r]})}function Fe(e){if(!Number.isFinite(e.expiresMs))return null;const t=Math.floor((e.expiresMs-Date.now())/864e5);return t<0?null:t===0?n("limits.reset_bank.hover_detail_today",{date:e.expiresAt}):n("limits.reset_bank.hover_detail",{date:e.expiresAt,days:t})}function Le({row:e}){const t=Math.max(0,Math.min(100,Number(e.percent)||0));return i.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[i.jsx(G,{text:Fe(e)}),i.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:e.label}),i.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${t}%`,minWidth:t>0?"3px":0}})}),i.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:e.expiresAt})]})}function Oe({model:e}){const t=e.kind==="count_only"?n("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[i.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.codex_reset_bank.title")}),t?i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:t}):e.rows.map(r=>i.jsx(Le,{row:r},r.key))]})}function Ke(e,t){if(e==="codex_meta"){const r=we(t.reset_credits);return r?i.jsx(Oe,{model:r}):null}return e==="kimi_parallel"&&t.parallel_limit?i.jsx(w,{children:n("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(De,{defaultDir:t.otel_default_dir}):null}function Re(e,t,r,o,a,s,d=null){const c=T[e];if(!c)return null;const l=c.windows(t).filter(m=>m.window).map(m=>({spec:m,pace:je(m,o)})),u=Ke(c.extra,t);return i.jsxs(S,{name:r,providerId:e,expandable:l.length>0,expanded:a,onToggle:s,badge:d,children:[i.jsx(Ie,{mode:o,rows:l,extra:u}),a?i.jsx(Ee,{rows:l,mode:o}):null]},e)}function Ce(e,t,r,o,a){if(!T[e])return null;if(!t?.configured)return i.jsxs(S,{name:v(e),providerId:e,children:[i.jsx(w,{children:n("limits.status.not_connected")}),e==="opencodeGo"?i.jsx(K,{}):null]},e);if(t.error)return i.jsxs(S,{name:v(e),providerId:e,children:[i.jsx(w,{tone:"error",children:n("shared.error.prefix",{error:t.error})}),e==="opencodeGo"?i.jsx(K,{}):null]},e);const s=v(e),d=t.plan_label?`${s} ${t.plan_label}`:s;let c=null;if(e==="antigravity")if(t.cached){const l=Se(t.cached_at);c=i.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:u=>u.stopPropagation(),children:[i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-oai-gray-100 dark:bg-oai-gray-800 border border-oai-gray-200/50 dark:border-oai-gray-700/50 text-oai-gray-500 dark:text-oai-gray-400 leading-normal",children:[i.jsx("span",{className:"h-1 w-1 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"}),n("limits.label.antigravity_cached"),l?i.jsxs(i.Fragment,{children:[" · ",l]}):null]}),i.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[n("limits.tooltip.antigravity_cached"),i.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"})]})]})}else c=i.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-emerald-500/10 dark:bg-emerald-500/15 border border-emerald-500/20 text-emerald-600 dark:text-emerald-400 leading-normal",children:[i.jsxs("span",{className:"relative flex h-1 w-1",children:[i.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),i.jsx("span",{className:"relative inline-flex rounded-full h-1 w-1 bg-emerald-500"})]}),n("limits.label.antigravity_live")]}),i.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[n("limits.tooltip.antigravity_live"),i.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"})]})]});return Re(e,t,d,r,o,a,c)}function De({defaultDir:e}){const[t,r]=b.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
3
3
|
`),s=async d=>{d.stopPropagation();try{await navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.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:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:n("limits.copilot.otelHint.body")}),i.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:a}),i.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:t?n("limits.copilot.otelHint.copied"):n("limits.copilot.otelHint.copy")})]})}function M({n:e,children:t}){return i.jsxs("li",{className:"flex gap-2.5",children:[i.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:e}),i.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:t})]})}function Te(){return i.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:i.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function K(){const[e,t]=b.useState(!1),r=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
|
|
4
4
|
`),o=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),1600)}catch{}};return i.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:[i.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:n("limits.opencodeGo.setupHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:n("limits.opencodeGo.setupHint.subtitle")}),i.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[i.jsxs(M,{n:"1",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step1")}),i.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:a=>a.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[n("limits.opencodeGo.setupHint.cta"),i.jsx(Te,{})]})]}),i.jsxs(M,{n:"2",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step2")}),i.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_workspace")}),i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_cookie")})]})]}),i.jsxs(M,{n:"3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:n("limits.opencodeGo.setupHint.step3")}),i.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:e?n("limits.opencodeGo.setupHint.copied"):n("limits.opencodeGo.setupHint.copy")})]}),i.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:r}),i.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Ae(e){const[t,r]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const a=o.querySelectorAll("[data-limit-label]");let s=0,d=null;if(a.length>0)try{d=document.createElement("canvas").getContext("2d")}catch{d=null}if(d){const l=window.getComputedStyle(a[0]);d.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of a)s=Math.max(s,d.measureText(u.textContent).width)}const c=Math.ceil(s);r(l=>l===c?l:c)}),t}function Ge({claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m,order:x,visibility:h,displayMode:H}){const z={claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m},P=b.useRef(null),I=Ae(P),[W,B]=b.useState(null),U=Array.isArray(x)&&x.length>0?x:Pe,F=H===p.REMAINING?p.REMAINING:p.USED,V=F===p.REMAINING?n("limits.settings.display_mode_remaining"):n("limits.settings.display_mode_used"),L=U.filter(y=>!h||h[y]!==!1).map(y=>Ce(y,z[y],F,W===y,()=>B(X=>X===y?null:y))).filter(Boolean);return i.jsx(ae,{delay:.15,children:i.jsx(D,{children:i.jsxs("div",{ref:P,className:"flex flex-col gap-3",style:I>0?{"--tt-limits-label-w":`${I}px`}:void 0,children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[n("limits.panel.title"),n("limits.panel.mode_separator"),V]}),L.length>0?L:i.jsx(w,{children:n("limits.status.all_hidden")})]})})})}const $e=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function qe(){const e=q(),{data:t,error:r,isLoading:o}=ee(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),a=re();return!$e&&!J()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(ne,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("limits.page.subtitle")})]}),i.jsx(Q,{to:"/settings","aria-label":n("limits.page.openSettings"),title:n("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(Z,{className:"h-4 w-4","aria-hidden":!0})})]}),o?i.jsx(de,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:n("shared.error.prefix",{error:r})}):null,i.jsx(Ge,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,zcode:t?.zcode,opencodeGo:t?.opencodeGo,order:a.order,visibility:a.visibility,displayMode:a.displayMode})]})]})})})}export{qe as LimitsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,E as t}from"./main-
|
|
1
|
+
import{j as e,E as t}from"./main-DY9GCwr_.js";import{A as r}from"./arrow-up-right-DMGmqVqe.js";import{D as o}from"./download-sDeO57uc.js";const i="https://github.com/mm7894215/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{au as p,aM as w,_ as v,r,E as s,j as e,L as y,a1 as j}from"./main-
|
|
1
|
+
import{au as p,aM as w,_ as v,r,E as s,j as e,L as y,a1 as j}from"./main-DY9GCwr_.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 k(){const i=p(),[t,u]=w(),{enabled:n,loading:f,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||f)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,f,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(()=>{u(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[u]);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{k as LoginPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as P,aG as R,cV as B,r as n,cW as F,cX as H,cY as O,cZ as E,E as i,j as e,P as b,b2 as q}from"./main-CdcVAe5U.js";import{T as $,b as W}from"./Controls-DDRUA8kk.js";import{n as Z,C as L}from"./ClawdAnimated-Ckc04uUA.js";import{F as A}from"./FadeIn-BbX2o5wT.js";import{L as X}from"./link-2-Cy3M4kYA.js";import{L as Y}from"./loader-circle-DAwJfPbD.js";import{Z as G}from"./zap-DMz4UIzI.js";import{T as J}from"./trash-2-D3istTDT.js";import"./Card-Sl8aV1zN.js";const Q=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],ee=P("file-archive",Q);const te=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],ae=P("monitor-up",te);const re=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],ie=P("upload",re),se={visible:!1,character:"clawd",size:"medium"};function oe(){const t=R()&&B(),[a,s]=n.useState(se);n.useEffect(()=>{if(!t)return;const d=F(o=>{s({visible:!!o.visible,character:Z(o.character),size:["small","medium","large"].includes(o.size)?o.size:"medium"})});return H(),d},[t]);const l=n.useCallback((d,o)=>{s(u=>({...u,[d]:o})),t&&O(d,o)},[t]);return{available:t,settings:a,setSetting:l}}const y=[{id:"clawd",displayName:"Clawd",nameKey:"pet.character.clawd",spriteVersionNumber:1,custom:!1},{id:"sprout",displayName:"Sprout",nameKey:"pet.character.sprout",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/sprout/spritesheet.webp"},{id:"byte",displayName:"Byte",nameKey:"pet.character.byte",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/byte/spritesheet.webp"},{id:"ember",displayName:"Ember",nameKey:"pet.character.ember",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/ember/spritesheet.webp"}];async function C(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Pet request failed with HTTP ${t.status}`);return a}async function ne(){const t=await fetch("/functions/tokentracker-pets",{headers:{Accept:"application/json"},cache:"no-store"}),a=await C(t);return[...y,...Array.isArray(a.pets)?a.pets:[]]}async function M(t){const a=await E();return C(await fetch("/functions/tokentracker-pets",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function le(t){return M({action:"install_url",url:t})}async function I(t){const a=await E();return C(await fetch("/api/pets/import",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/zip",...a},cache:"no-store",body:t}))}function de(t){return M({action:"remove",id:t})}let S=y;function ce(){const[t,a]=n.useState(S),[s,l]=n.useState(!0),[d,o]=n.useState(!1),u=n.useCallback(async()=>{l(!0);try{const p=await ne();return S=p,a(p),o(!0),p}catch{return S=y,a(y),o(!1),y}finally{l(!1)}},[]);return n.useEffect(()=>{u()},[u]),{pets:t,loading:s,available:d,refresh:u}}const pe={clawd:"from-oai-amber-50 dark:from-orange-950/70",sprout:"from-oai-brand-100 dark:from-emerald-950/70",byte:"from-oai-gray-200 dark:from-slate-800/70",ember:"from-orange-100 dark:from-orange-950/80"};function me(){const t=i("pet.import.subtitle"),a="codex-pets.net",s=t.indexOf(a);return s<0?t:e.jsxs(e.Fragment,{children:[t.slice(0,s),e.jsx("a",{href:"https://codex-pets.net",target:"_blank",rel:"noreferrer",className:"underline decoration-oai-gray-400 underline-offset-2 transition-colors hover:text-oai-black dark:decoration-oai-gray-500 dark:hover:text-white",children:a}),t.slice(s+a.length)]})}const k=[{id:"idle-living",labelKey:"pet.state.calm"},{id:"working-thinking",labelKey:"pet.state.focus"},{id:"working-juggling",labelKey:"pet.state.multitask"},{id:"working-wizard",labelKey:"pet.state.streak"},{id:"happy",labelKey:"pet.state.celebrate"},{id:"sleeping",labelKey:"pet.state.rest"}];function ue({character:t,selected:a,onSelect:s,onRemove:l,removeDisabled:d}){const o=t.nameKey?i(t.nameKey):t.displayName;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:s,"aria-pressed":a,className:b("relative w-full overflow-hidden rounded-xl border p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"border-oai-brand-500/40 bg-white dark:border-oai-brand-500/25 dark:bg-oai-gray-900/80":"border-oai-gray-200/80 bg-white/55 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:bg-oai-gray-950/55 dark:hover:border-oai-gray-600"),children:[e.jsx("div",{className:b("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",pe[t.id]||"from-oai-gray-200/80 dark:from-oai-gray-800/70")}),e.jsxs("div",{className:"relative flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center",children:e.jsx(L,{state:"idle-living",character:t.id,pet:t,size:44})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:o}),t.spriteVersionNumber===2?e.jsx("span",{className:"shrink-0 rounded border border-oai-gray-300/80 px-1 text-[9px] font-semibold text-oai-gray-500 dark:border-oai-gray-600 dark:text-oai-gray-400",children:i("pet.format.v2")}):null,a?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-oai-brand-500","aria-hidden":!0}):null]})]})]}),l?e.jsx("button",{type:"button",disabled:d,onClick:l,"aria-label":`${i("pet.import.remove")} · ${o}`,className:b("absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-md border border-oai-gray-200/90 bg-white/95 text-oai-gray-500 transition-opacity hover:text-red-600 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-40 dark:border-oai-gray-700 dark:bg-oai-gray-900/95 dark:text-oai-gray-400 dark:hover:text-red-400",a?"opacity-100":"opacity-0 group-hover:opacity-100"),children:e.jsx(J,{className:"h-3 w-3","aria-hidden":!0})}):null]})}function xe({pet:t,state:a,onStateChange:s}){const[l,d]=n.useState(null),o=n.useRef(null),u=k.find(function(x){return x.id===a}),p=i(u?.labelKey||"pet.state.calm");return e.jsxs("section",{className:"relative flex min-h-[400px] flex-col overflow-hidden bg-oai-gray-50 dark:bg-oai-gray-950 sm:min-h-[440px] lg:min-h-[480px]",onPointerMove:c=>{if(t?.spriteVersionNumber!==2||!o.current)return;const x=o.current.getBoundingClientRect(),v=c.clientX-(x.left+x.width/2),m=c.clientY-(x.top+x.height/2),j=(Math.atan2(v,-m)*180/Math.PI+360)%360;d(Math.round(j/22.5)%16)},onPointerLeave:()=>d(null),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.16] dark:opacity-[0.12]",style:{backgroundImage:"radial-gradient(currentColor 0.7px, transparent 0.7px)",backgroundSize:"14px 14px"},"aria-hidden":!0}),e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.preview.states")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-black/5 bg-white/65 px-3 py-1.5 text-[11px] font-medium text-oai-gray-600 backdrop-blur-md dark:border-white/10 dark:bg-black/20 dark:text-oai-gray-300",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),p]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsx("div",{ref:o,className:"relative flex h-52 w-52 items-center justify-center sm:h-56 sm:w-56 lg:h-64 lg:w-64",children:e.jsx("div",{className:"origin-bottom lg:scale-[1.18]",children:e.jsx(L,{state:a,character:t?.id||"clawd",pet:t,size:190,lookDirectionIndex:l})})})}),e.jsx("div",{className:"relative border-t border-oai-gray-200/70 bg-white/85 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-950/85",children:e.jsx("div",{className:"grid grid-cols-3 gap-1","aria-label":i("pet.preview.states"),children:k.map(c=>e.jsxs("button",{type:"button",onClick:()=>s(c.id),"aria-pressed":a===c.id,className:b("flex min-h-10 flex-col items-center justify-center gap-1 rounded-lg px-1.5 text-xs transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500",a===c.id?"font-semibold text-oai-black dark:text-white":"font-medium text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[e.jsx("span",{children:i(c.labelKey)}),e.jsx("span",{className:b("h-1 w-1 rounded-full transition-colors duration-200",a===c.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},c.id))})})]})}function Ne(){const{available:t,settings:a,setSetting:s}=oe(),{pets:l,loading:d,available:o,refresh:u}=ce(),[p,c]=n.useState(""),[x,v]=n.useState(""),[m,j]=n.useState(!1),[K,z]=n.useState("idle-living"),[T,_]=n.useState(!0),f=a.character||"clawd",V=l.find(r=>r.id===f)||l[0],w=m?{kind:"busy",text:i("pet.import.busy")}:x?{kind:"error",text:x}:null;n.useEffect(()=>{!d&&l.length>0&&!l.some(r=>r.id===f)&&s("character","clawd")},[d,l,f,s]);async function N(r,g=i("pet.import.success")){j(!0),v("");try{const h=await r();await u(),h?.pet?.id&&s("character",h.pet.id),q({title:g,timeout:4e3}),c("")}catch(h){v(h?.message||i("pet.import.failed"))}finally{j(!1)}}n.useEffect(()=>{if(!T)return;const r=window.setInterval(()=>{z(g=>{const h=k.findIndex(D=>D.id===g);return k[(h+1)%k.length].id})},5e3);return()=>window.clearInterval(r)},[T]);const U=[{value:"small",label:i("pet.size.small")},{value:"medium",label:i("pet.size.medium")},{value:"large",label:i("pet.size.large")}];return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-14 pt-8 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(A,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:i("pet.page.title")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.page.subtitle")})]})}),e.jsx(A,{y:12,delay:.04,children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-oai-gray-200 bg-white/75 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 lg:grid lg:grid-cols-[1.12fr_0.88fr]",children:[e.jsx(xe,{pet:V,state:K,onStateChange:r=>{_(!1),z(r)}}),e.jsxs("aside",{className:"flex flex-col border-t border-oai-gray-200 p-5 dark:border-oai-gray-800 lg:min-h-[480px] lg:border-l lg:border-t-0",children:[e.jsxs("section",{"aria-labelledby":"pet-character-title",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"pet-character-title",className:"text-sm font-semibold",children:i("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2",children:l.map(r=>e.jsx(ue,{character:r,selected:f===r.id,onSelect:()=>s("character",r.id),removeDisabled:m,onRemove:o&&r.custom?()=>N(async()=>(await de(r.id),f===r.id&&s("character","clawd"),null),i("pet.import.removed")):void 0},r.id))})]}),o?e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800","aria-labelledby":"pet-import-title",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-4 w-4 text-oai-gray-500","aria-hidden":!0}),e.jsx("h2",{id:"pet-import-title",className:"text-sm font-semibold",children:i("pet.import.title")})]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:e.jsx(me,{})}),e.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:r=>{r.preventDefault(),!m&&p.trim()&&N(()=>le(p))},children:[e.jsxs("label",{className:"relative flex min-w-0 flex-1 items-center",children:[e.jsx(X,{className:"pointer-events-none absolute left-3 h-3.5 w-3.5 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{value:p,onChange:r=>c(r.target.value),"aria-label":i("pet.import.url_label"),placeholder:"codex-pets.net/#/pets/…",className:"h-9 w-full rounded-lg border border-oai-gray-200 bg-white pl-9 pr-3 text-xs outline-none focus:border-oai-brand-500 dark:border-oai-gray-700 dark:bg-oai-gray-950"})]}),e.jsxs("button",{type:"submit",disabled:m||!p.trim(),className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-oai-black px-3.5 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[m?e.jsx(Y,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,i("pet.import.add")]})]}),e.jsxs("label",{onDragOver:r=>r.preventDefault(),onDrop:r=>{if(r.preventDefault(),m)return;const g=r.dataTransfer?.files?.[0];g&&N(()=>I(g))},className:b("mt-2 flex h-9 w-full cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",m&&"pointer-events-none opacity-40"),children:[e.jsx(ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),i("pet.import.zip"),e.jsx("input",{type:"file",accept:".zip,.codex-pet.zip,application/zip",className:"sr-only",disabled:m,onChange:r=>{const g=r.target.files?.[0];g&&N(()=>I(g)),r.target.value=""}})]}),w?e.jsx("p",{role:w.kind==="error"?"alert":"status",className:b("mt-2 text-xs",w.kind==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400"),children:w.text}):null]}):null,e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("h2",{className:"text-sm font-semibold",children:i("pet.controls.title")})]}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:i("pet.controls.show")}),e.jsx($,{checked:a.visible,onChange:()=>s("visible",!a.visible),disabled:!t,ariaLabel:i("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:i("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(W,{options:U,value:a.size,onChange:r=>s("size",r),disabled:!t})})]})]})]}),t?null:e.jsxs("div",{className:"mt-6 flex gap-2 rounded-xl bg-oai-gray-100 p-3 text-xs leading-relaxed text-oai-gray-500 dark:bg-oai-gray-800/70 dark:text-oai-gray-400",children:[e.jsx(G,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),i("pet.controls.native_only")]})]})]})})]})})})}export{Ne as PetPage};
|
|
1
|
+
import{c as P,aG as R,cV as B,r as n,cW as F,cX as H,cY as O,cZ as E,E as i,j as e,P as b,b2 as q}from"./main-DY9GCwr_.js";import{T as $,b as W}from"./Controls-BYSv1KGd.js";import{n as Z,C as L}from"./ClawdAnimated-Dkhj87ak.js";import{F as A}from"./FadeIn-BIj6T_Ni.js";import{L as X}from"./link-2-DY_0gFgX.js";import{L as Y}from"./loader-circle-xebF61S5.js";import{Z as G}from"./zap-DN1VaJU3.js";import{T as J}from"./trash-2-D0iohG1v.js";import"./Card-BSUag_Em.js";const Q=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],ee=P("file-archive",Q);const te=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],ae=P("monitor-up",te);const re=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],ie=P("upload",re),se={visible:!1,character:"clawd",size:"medium"};function oe(){const t=R()&&B(),[a,s]=n.useState(se);n.useEffect(()=>{if(!t)return;const d=F(o=>{s({visible:!!o.visible,character:Z(o.character),size:["small","medium","large"].includes(o.size)?o.size:"medium"})});return H(),d},[t]);const l=n.useCallback((d,o)=>{s(u=>({...u,[d]:o})),t&&O(d,o)},[t]);return{available:t,settings:a,setSetting:l}}const y=[{id:"clawd",displayName:"Clawd",nameKey:"pet.character.clawd",spriteVersionNumber:1,custom:!1},{id:"sprout",displayName:"Sprout",nameKey:"pet.character.sprout",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/sprout/spritesheet.webp"},{id:"byte",displayName:"Byte",nameKey:"pet.character.byte",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/byte/spritesheet.webp"},{id:"ember",displayName:"Ember",nameKey:"pet.character.ember",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/ember/spritesheet.webp"}];async function C(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Pet request failed with HTTP ${t.status}`);return a}async function ne(){const t=await fetch("/functions/tokentracker-pets",{headers:{Accept:"application/json"},cache:"no-store"}),a=await C(t);return[...y,...Array.isArray(a.pets)?a.pets:[]]}async function M(t){const a=await E();return C(await fetch("/functions/tokentracker-pets",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function le(t){return M({action:"install_url",url:t})}async function I(t){const a=await E();return C(await fetch("/api/pets/import",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/zip",...a},cache:"no-store",body:t}))}function de(t){return M({action:"remove",id:t})}let S=y;function ce(){const[t,a]=n.useState(S),[s,l]=n.useState(!0),[d,o]=n.useState(!1),u=n.useCallback(async()=>{l(!0);try{const p=await ne();return S=p,a(p),o(!0),p}catch{return S=y,a(y),o(!1),y}finally{l(!1)}},[]);return n.useEffect(()=>{u()},[u]),{pets:t,loading:s,available:d,refresh:u}}const pe={clawd:"from-oai-amber-50 dark:from-orange-950/70",sprout:"from-oai-brand-100 dark:from-emerald-950/70",byte:"from-oai-gray-200 dark:from-slate-800/70",ember:"from-orange-100 dark:from-orange-950/80"};function me(){const t=i("pet.import.subtitle"),a="codex-pets.net",s=t.indexOf(a);return s<0?t:e.jsxs(e.Fragment,{children:[t.slice(0,s),e.jsx("a",{href:"https://codex-pets.net",target:"_blank",rel:"noreferrer",className:"underline decoration-oai-gray-400 underline-offset-2 transition-colors hover:text-oai-black dark:decoration-oai-gray-500 dark:hover:text-white",children:a}),t.slice(s+a.length)]})}const k=[{id:"idle-living",labelKey:"pet.state.calm"},{id:"working-thinking",labelKey:"pet.state.focus"},{id:"working-juggling",labelKey:"pet.state.multitask"},{id:"working-wizard",labelKey:"pet.state.streak"},{id:"happy",labelKey:"pet.state.celebrate"},{id:"sleeping",labelKey:"pet.state.rest"}];function ue({character:t,selected:a,onSelect:s,onRemove:l,removeDisabled:d}){const o=t.nameKey?i(t.nameKey):t.displayName;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:s,"aria-pressed":a,className:b("relative w-full overflow-hidden rounded-xl border p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"border-oai-brand-500/40 bg-white dark:border-oai-brand-500/25 dark:bg-oai-gray-900/80":"border-oai-gray-200/80 bg-white/55 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:bg-oai-gray-950/55 dark:hover:border-oai-gray-600"),children:[e.jsx("div",{className:b("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",pe[t.id]||"from-oai-gray-200/80 dark:from-oai-gray-800/70")}),e.jsxs("div",{className:"relative flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center",children:e.jsx(L,{state:"idle-living",character:t.id,pet:t,size:44})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:o}),t.spriteVersionNumber===2?e.jsx("span",{className:"shrink-0 rounded border border-oai-gray-300/80 px-1 text-[9px] font-semibold text-oai-gray-500 dark:border-oai-gray-600 dark:text-oai-gray-400",children:i("pet.format.v2")}):null,a?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-oai-brand-500","aria-hidden":!0}):null]})]})]}),l?e.jsx("button",{type:"button",disabled:d,onClick:l,"aria-label":`${i("pet.import.remove")} · ${o}`,className:b("absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-md border border-oai-gray-200/90 bg-white/95 text-oai-gray-500 transition-opacity hover:text-red-600 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-40 dark:border-oai-gray-700 dark:bg-oai-gray-900/95 dark:text-oai-gray-400 dark:hover:text-red-400",a?"opacity-100":"opacity-0 group-hover:opacity-100"),children:e.jsx(J,{className:"h-3 w-3","aria-hidden":!0})}):null]})}function xe({pet:t,state:a,onStateChange:s}){const[l,d]=n.useState(null),o=n.useRef(null),u=k.find(function(x){return x.id===a}),p=i(u?.labelKey||"pet.state.calm");return e.jsxs("section",{className:"relative flex min-h-[400px] flex-col overflow-hidden bg-oai-gray-50 dark:bg-oai-gray-950 sm:min-h-[440px] lg:min-h-[480px]",onPointerMove:c=>{if(t?.spriteVersionNumber!==2||!o.current)return;const x=o.current.getBoundingClientRect(),v=c.clientX-(x.left+x.width/2),m=c.clientY-(x.top+x.height/2),j=(Math.atan2(v,-m)*180/Math.PI+360)%360;d(Math.round(j/22.5)%16)},onPointerLeave:()=>d(null),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.16] dark:opacity-[0.12]",style:{backgroundImage:"radial-gradient(currentColor 0.7px, transparent 0.7px)",backgroundSize:"14px 14px"},"aria-hidden":!0}),e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.preview.states")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-black/5 bg-white/65 px-3 py-1.5 text-[11px] font-medium text-oai-gray-600 backdrop-blur-md dark:border-white/10 dark:bg-black/20 dark:text-oai-gray-300",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),p]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsx("div",{ref:o,className:"relative flex h-52 w-52 items-center justify-center sm:h-56 sm:w-56 lg:h-64 lg:w-64",children:e.jsx("div",{className:"origin-bottom lg:scale-[1.18]",children:e.jsx(L,{state:a,character:t?.id||"clawd",pet:t,size:190,lookDirectionIndex:l})})})}),e.jsx("div",{className:"relative border-t border-oai-gray-200/70 bg-white/85 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-950/85",children:e.jsx("div",{className:"grid grid-cols-3 gap-1","aria-label":i("pet.preview.states"),children:k.map(c=>e.jsxs("button",{type:"button",onClick:()=>s(c.id),"aria-pressed":a===c.id,className:b("flex min-h-10 flex-col items-center justify-center gap-1 rounded-lg px-1.5 text-xs transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500",a===c.id?"font-semibold text-oai-black dark:text-white":"font-medium text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[e.jsx("span",{children:i(c.labelKey)}),e.jsx("span",{className:b("h-1 w-1 rounded-full transition-colors duration-200",a===c.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},c.id))})})]})}function Ne(){const{available:t,settings:a,setSetting:s}=oe(),{pets:l,loading:d,available:o,refresh:u}=ce(),[p,c]=n.useState(""),[x,v]=n.useState(""),[m,j]=n.useState(!1),[K,z]=n.useState("idle-living"),[T,_]=n.useState(!0),f=a.character||"clawd",V=l.find(r=>r.id===f)||l[0],w=m?{kind:"busy",text:i("pet.import.busy")}:x?{kind:"error",text:x}:null;n.useEffect(()=>{!d&&l.length>0&&!l.some(r=>r.id===f)&&s("character","clawd")},[d,l,f,s]);async function N(r,g=i("pet.import.success")){j(!0),v("");try{const h=await r();await u(),h?.pet?.id&&s("character",h.pet.id),q({title:g,timeout:4e3}),c("")}catch(h){v(h?.message||i("pet.import.failed"))}finally{j(!1)}}n.useEffect(()=>{if(!T)return;const r=window.setInterval(()=>{z(g=>{const h=k.findIndex(D=>D.id===g);return k[(h+1)%k.length].id})},5e3);return()=>window.clearInterval(r)},[T]);const U=[{value:"small",label:i("pet.size.small")},{value:"medium",label:i("pet.size.medium")},{value:"large",label:i("pet.size.large")}];return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-14 pt-8 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(A,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:i("pet.page.title")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.page.subtitle")})]})}),e.jsx(A,{y:12,delay:.04,children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-oai-gray-200 bg-white/75 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 lg:grid lg:grid-cols-[1.12fr_0.88fr]",children:[e.jsx(xe,{pet:V,state:K,onStateChange:r=>{_(!1),z(r)}}),e.jsxs("aside",{className:"flex flex-col border-t border-oai-gray-200 p-5 dark:border-oai-gray-800 lg:min-h-[480px] lg:border-l lg:border-t-0",children:[e.jsxs("section",{"aria-labelledby":"pet-character-title",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"pet-character-title",className:"text-sm font-semibold",children:i("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2",children:l.map(r=>e.jsx(ue,{character:r,selected:f===r.id,onSelect:()=>s("character",r.id),removeDisabled:m,onRemove:o&&r.custom?()=>N(async()=>(await de(r.id),f===r.id&&s("character","clawd"),null),i("pet.import.removed")):void 0},r.id))})]}),o?e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800","aria-labelledby":"pet-import-title",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-4 w-4 text-oai-gray-500","aria-hidden":!0}),e.jsx("h2",{id:"pet-import-title",className:"text-sm font-semibold",children:i("pet.import.title")})]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:e.jsx(me,{})}),e.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:r=>{r.preventDefault(),!m&&p.trim()&&N(()=>le(p))},children:[e.jsxs("label",{className:"relative flex min-w-0 flex-1 items-center",children:[e.jsx(X,{className:"pointer-events-none absolute left-3 h-3.5 w-3.5 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{value:p,onChange:r=>c(r.target.value),"aria-label":i("pet.import.url_label"),placeholder:"codex-pets.net/#/pets/…",className:"h-9 w-full rounded-lg border border-oai-gray-200 bg-white pl-9 pr-3 text-xs outline-none focus:border-oai-brand-500 dark:border-oai-gray-700 dark:bg-oai-gray-950"})]}),e.jsxs("button",{type:"submit",disabled:m||!p.trim(),className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-oai-black px-3.5 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[m?e.jsx(Y,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,i("pet.import.add")]})]}),e.jsxs("label",{onDragOver:r=>r.preventDefault(),onDrop:r=>{if(r.preventDefault(),m)return;const g=r.dataTransfer?.files?.[0];g&&N(()=>I(g))},className:b("mt-2 flex h-9 w-full cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",m&&"pointer-events-none opacity-40"),children:[e.jsx(ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),i("pet.import.zip"),e.jsx("input",{type:"file",accept:".zip,.codex-pet.zip,application/zip",className:"sr-only",disabled:m,onChange:r=>{const g=r.target.files?.[0];g&&N(()=>I(g)),r.target.value=""}})]}),w?e.jsx("p",{role:w.kind==="error"?"alert":"status",className:b("mt-2 text-xs",w.kind==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400"),children:w.text}):null]}):null,e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("h2",{className:"text-sm font-semibold",children:i("pet.controls.title")})]}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:i("pet.controls.show")}),e.jsx($,{checked:a.visible,onChange:()=>s("visible",!a.visible),disabled:!t,ariaLabel:i("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:i("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(W,{options:U,value:a.size,onChange:r=>s("size",r),disabled:!t})})]})]})]}),t?null:e.jsxs("div",{className:"mt-6 flex gap-2 rounded-xl bg-oai-gray-100 p-3 text-xs leading-relaxed text-oai-gray-500 dark:bg-oai-gray-800/70 dark:text-oai-gray-400",children:[e.jsx(G,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),i("pet.controls.native_only")]})]})]})})]})})})}export{Ne as PetPage};
|