tokentracker-cli 0.60.3 → 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dashboard/dist/assets/{ActivityHeatmap-cLPCmg1i.js → ActivityHeatmap-DiY-TQE6.js} +1 -1
  2. package/dashboard/dist/assets/{Card-_FGU06_g.js → Card-Dw2Ywh21.js} +1 -1
  3. package/dashboard/dist/assets/DashboardPage-DxFUSPgP.js +19 -0
  4. package/dashboard/dist/assets/{DevicePage-SEcI1kHh.js → DevicePage-BZ6FyruO.js} +1 -1
  5. package/dashboard/dist/assets/{DialogTitle-BXqPt5Ob.js → DialogTitle-By_-gdyZ.js} +1 -1
  6. package/dashboard/dist/assets/{FadeIn-By_JNfKb.js → FadeIn-DbTTDXlD.js} +1 -1
  7. package/dashboard/dist/assets/{HeaderGithubStar-BOfxPmYV.js → HeaderGithubStar-Ddp9MldL.js} +1 -1
  8. package/dashboard/dist/assets/{IpCheckPage-DofM0M8X.js → IpCheckPage-DpRpe-yJ.js} +1 -1
  9. package/dashboard/dist/assets/{LandingPage-Cs-U-Y5I.js → LandingPage-1-X9Dyop.js} +1 -1
  10. package/dashboard/dist/assets/{LeaderboardAvatar-CLLQCHHj.js → LeaderboardAvatar-WLkGqwTq.js} +1 -1
  11. package/dashboard/dist/assets/{LeaderboardPage-Ctco-Kdt.js → LeaderboardPage-hWZKXtzP.js} +3 -3
  12. package/dashboard/dist/assets/{LeaderboardProfileModal-DIu4iePI.js → LeaderboardProfileModal-DCKHaWyv.js} +3 -3
  13. package/dashboard/dist/assets/{LeaderboardProfilePage-BQJbJ4Zk.js → LeaderboardProfilePage-BPYxDyKG.js} +3 -3
  14. package/dashboard/dist/assets/LimitsPage-BBDDxGWY.js +3 -0
  15. package/dashboard/dist/assets/{LocalOnlyNotice-DF1lCLZT.js → LocalOnlyNotice-4EFHus0W.js} +1 -1
  16. package/dashboard/dist/assets/{LoginPage-Br4lL88q.js → LoginPage-D1O2Yp2H.js} +1 -1
  17. package/dashboard/dist/assets/{PopoverPopup-sfd3Ot7l.js → PopoverPopup-BJ1DYzia.js} +1 -1
  18. package/dashboard/dist/assets/{ResetPasswordPage-DPCimfFC.js → ResetPasswordPage-BYTCLfpG.js} +1 -1
  19. package/dashboard/dist/assets/{Select-BTE9IFaB.js → Select-BtUw6eA7.js} +1 -1
  20. package/dashboard/dist/assets/{SelectItemText-fTD-_D4r.js → SelectItemText-uBxS-TJY.js} +1 -1
  21. package/dashboard/dist/assets/SettingsPage-B8lgxPa3.js +1 -0
  22. package/dashboard/dist/assets/{SkillsPage-kLIOS3gm.js → SkillsPage-OalMj85c.js} +1 -1
  23. package/dashboard/dist/assets/WidgetsPage-1qfj_khV.js +1 -0
  24. package/dashboard/dist/assets/{WrappedPage-Bgjnpl0T.js → WrappedPage-DPIgHaEm.js} +1 -1
  25. package/dashboard/dist/assets/{agent-logos-D1CgjfSi.js → agent-logos--zTo3ETT.js} +1 -1
  26. package/dashboard/dist/assets/{arrow-up-right-BCwkxp9i.js → arrow-up-right-Cu9AGOq8.js} +1 -1
  27. package/dashboard/dist/assets/{download-DYn5lZdU.js → download-DfOwf6ht.js} +1 -1
  28. package/dashboard/dist/assets/{info-VYTQzNiq.js → info-B-6dkV8l.js} +1 -1
  29. package/dashboard/dist/assets/{main-ClN5xMKf.js → main-BxMBoQ4o.js} +39 -22
  30. package/dashboard/dist/assets/{main-x6DwHW58.css → main-CJDO0VC9.css} +1 -1
  31. package/dashboard/dist/assets/pencil-D_fU_ajz.js +1 -0
  32. package/dashboard/dist/assets/{use-limits-display-prefs-BZlxCSKp.js → use-limits-display-prefs-CeUpLkAH.js} +1 -1
  33. package/dashboard/dist/assets/{use-native-settings-Cbz2Ycln.js → use-native-settings-k36QjuqG.js} +1 -1
  34. package/dashboard/dist/assets/{use-usage-limits-BYwcAHmE.js → use-usage-limits-DUqHPGiW.js} +1 -1
  35. package/dashboard/dist/assets/{useCurrency-CgeoIGsJ.js → useCurrency-CGfsqycG.js} +1 -1
  36. package/dashboard/dist/assets/{useScrollLock-DqpLDNcl.js → useScrollLock-CPd8fHwH.js} +1 -1
  37. package/dashboard/dist/index.html +2 -2
  38. package/dashboard/dist/share.html +2 -2
  39. package/package.json +1 -1
  40. package/src/lib/opencode-go-limits.js +115 -3
  41. package/src/lib/pricing/seed-snapshot.json +1 -1
  42. package/src/lib/rollout.js +19 -0
  43. package/src/lib/usage-limits.js +212 -77
  44. package/dashboard/dist/assets/DashboardPage-sfNk7IcJ.js +0 -19
  45. package/dashboard/dist/assets/LimitsPage-B6cYrodR.js +0 -3
  46. package/dashboard/dist/assets/SettingsPage-DERfKxU0.js +0 -1
  47. package/dashboard/dist/assets/WidgetsPage-BIaj8VAc.js +0 -1
@@ -1,3 +0,0 @@
1
- import{j as i,V as L,G as o,N as W,r as y,U as B,aG as z,i as U,L as V,aH as X}from"./main-ClN5xMKf.js";import{u as Y}from"./use-usage-limits-BYwcAHmE.js";import{L as x,a as q,l as b,b as J,u as Q}from"./use-limits-display-prefs-BZlxCSKp.js";import{C as O}from"./Card-_FGU06_g.js";import{F as Z}from"./FadeIn-By_JNfKb.js";import{L as ee}from"./LocalOnlyNotice-DF1lCLZT.js";import"./arrow-up-right-BCwkxp9i.js";import"./download-DYn5lZdU.js";const te=[3,2,3,3,2,2,3];function h({className:e}){return i.jsx("div",{className:L("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function ie(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(h,{className:"h-3 w-12 shrink-0"}),i.jsx(h,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(h,{className:"h-3 w-[30px] shrink-0"}),i.jsx(h,{className:"h-3 w-6 shrink-0"})]})}function ne({bars:e,index:t}){const n=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(h,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(h,{className:L("h-4",n)})]}),Array.from({length:e},(a,r)=>i.jsx(ie,{},r))]})}function re(){return i.jsx(O,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(h,{className:"h-3.5 w-28"}),te.map((e,t)=>i.jsx(ne,{bars:e,index:t},t))]})})}function ae(e,t){if(!(e>0))return null;const n=(e-t)/e;return Number.isFinite(n)?Math.min(Math.max(n,0),1):null}function oe(e,t,n=.03){return e>t+n}function le(e){const t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600);return n>24?`${Math.floor(n/24)}d`:n>0?`${n}h`:`${Math.floor(t/60)}m`}function se(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const n=t[e.windowSecondsField];return typeof n=="number"&&n>0?n:null}return null}function R(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function de({usedPercent:e,windowSeconds:t,resetMs:n,mode:a,now:r=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(n))return d;const c=Math.max(0,(n-r)/1e3),l=ae(t,c);if(l==null)return d;if(d.expectedPercent=Math.round(l*100),d.paceOver=oe(s,l),s>=.05){const u=a==="remaining"?1-l:l;d.pacePercent=u*100}if(l>.02&&s>0){const u=t*l,p=s/u,m=s/l;m>=1&&p>0?d.runsOutEta=le((1-s)/p):d.projectedEnd=Math.round(Math.min(m,1)*100)}return d}const k=100;function P(e){const t=Date.parse(e);return Number.isFinite(t)?t:null}function ce(e){return Math.max(0,Math.min(k,Math.round(e)))}function ue(e){return new Intl.DateTimeFormat(W(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function me(e,t,n){if(e==null||e>=t)return k;const a=t-e,r=t-n;return ce(r/a*k)}function xe(e){const t=e.available_count;return t===null?null:Number.isInteger(t)&&t>=0?t:void 0}function pe(e,{now:t}={}){if(!e||typeof e!="object")return null;const n=xe(e);if(n===void 0)return null;const a=Array.isArray(e.credits)?e.credits:[],r=t instanceof Date?t.getTime():Number(t??Date.now()),s=[];for(const d of a){const c=P(d?.expires_at);if(c==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:o("limits.codex_reset_bank.row_label",{index:l}),expiresAt:ue(c),percent:me(P(d?.granted_at),c,r)})}return n===0?null:s.length>0?{kind:"rows",availableCount:n??s.length,rows:s}:n>0?{kind:"count_only",availableCount:n,rows:[]}:null}const K={claude:{windows(e){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}]}},codex:{extra:"codex_reset_bank",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:"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",labelKey:"limits.label.antigravity_claude",window:e.primary_window},{key:"gpro",labelKey:"limits.label.antigravity_gpro",window:e.secondary_window},{key:"flash",labelKey:"limits.label.antigravity_flash",window:e.tertiary_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[{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}]}}},we="shrink-0 text-oai-black dark:text-oai-white";function he(e){const t=R(e);if(!Number.isFinite(t))return null;const n=t-Date.now();if(n<=0)return o("shared.time.now");const a=Math.floor(n/6e4);if(a<60)return`${a}m`;const r=Math.floor(a/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function ye(e,t){const n=t===x.REMAINING?100-e:e;return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function f(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function F(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function ge(e,t){return de({usedPercent:f(e.window,e.pctField),windowSeconds:se(e,e.window),resetMs:R(F(e.window,e.resetField)),mode:t})}function fe({label:e,pct:t,reset:n,mode:a=x.USED,pacePercent:r=null,paceOver:s=!1}){const d=Math.max(0,Math.min(100,Number(t)||0)),c=a===x.REMAINING?100-d:d,l=Math.round(c),u=c>0&&l===0?Math.max(c,.35):c;let p=String(l);c>0&&l===0&&(p=o("limits.bar.sub_one_percent"));const m=r==null?null:Math.max(0,Math.min(100,r));return i.jsxs("div",{className:"flex items-center gap-2",children:[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:`${ye(c,a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:c>0?"3px":0}}),m!=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(${m}% - 3px)`,width:"6px"}}),i.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${m}% - 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:[p,"%"]}),n&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:n})]})}function be(e,t,n){const a=o(e.labelKey),r=n===x.REMAINING,s=l=>r?100-l:l;if(t.expectedPercent==null){const l=Math.round(Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)));return r?o("limits.explain.remaining",{label:a,used:s(l)}):o("limits.explain.used",{label:a,used:l})}if(t.paceOver){if(t.runsOutEta)return o("limits.explain.ahead_eta",{label:a,eta:t.runsOutEta});const l=s(t.projectedEnd??100);return o(r?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:a,pct:l})}const d=Math.round(Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0))),c=s(t.projectedEnd??d);return o(r?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:a,pct:c})}function _e({rows:e,mode:t}){if(e.length===0)return null;const n=t===x.REMAINING;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:a,pace:r})=>i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:be(a,r,t)},a.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:o(n?"limits.explain.body_remaining":"limits.explain.body")})]})}function j({name:e,providerId:t,children:n,expandable:a=!1,expanded:r=!1,onToggle:s}){const d=J(t),c=i.jsxs("div",{className:"flex items-center gap-1.5",children:[d?i.jsx(B,{provider:d,size:14,className:we}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e})]});return a?i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":r,onClick:s,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.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:[c,n]}):i.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,n]})}const ke=q;function g({children:e,tone:t="neutral"}){const n=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 ${n}`,children:e})}function je({rows:e,mode:t,extra:n=null}){const a=e.length===0&&!n;return i.jsxs(i.Fragment,{children:[e.map(({spec:r,pace:s})=>i.jsx(fe,{label:o(r.labelKey),pct:f(r.window,r.pctField),reset:he(F(r.window,r.resetField)),mode:t,pacePercent:s.pacePercent,paceOver:s.paceOver},r.key)),a?i.jsx(g,{children:o("limits.status.no_data")}):null,n]})}function ve({row:e}){const t=Math.max(0,Math.min(100,Number(e.percent)||0));return i.jsxs("div",{className:"flex items-center gap-2","data-reset-bank-row":"",children:[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 Ne({model:e}){const t=e.kind==="count_only"?o("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:o("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(n=>i.jsx(ve,{row:n},n.key))]})}function Me(e,t){if(e==="codex_reset_bank"){const n=pe(t.reset_credits);return n?i.jsx(Ne,{model:n}):null}return e==="kimi_parallel"&&t.parallel_limit?i.jsx(g,{children:o("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(Pe,{defaultDir:t.otel_default_dir}):null}function Ee(e,t,n,a,r,s){const d=K[e];if(!d)return null;const c=d.windows(t).filter(u=>u.window).map(u=>({spec:u,pace:ge(u,a)})),l=Me(d.extra,t);return i.jsxs(j,{name:n,providerId:e,expandable:c.length>0,expanded:r,onToggle:s,children:[i.jsx(je,{mode:a,rows:c,extra:l}),r?i.jsx(_e,{rows:c,mode:a}):null]},e)}function Se(e,t,n,a,r){if(!K[e])return null;if(!t?.configured)return i.jsxs(j,{name:b(e),providerId:e,children:[i.jsx(g,{children:o("limits.status.not_connected")}),e==="opencodeGo"?i.jsx(I,{}):null]},e);if(t.error)return i.jsxs(j,{name:b(e),providerId:e,children:[i.jsx(g,{tone:"error",children:o("shared.error.prefix",{error:t.error})}),e==="opencodeGo"?i.jsx(I,{}):null]},e);const s=b(e),d=t.plan_label?`${s} ${t.plan_label}`:s;return Ee(e,t,d,n,a,r)}function Pe({defaultDir:e}){const[t,n]=y.useState(!1),r=["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(`
2
- `),s=async d=>{d.stopPropagation();try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!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:o("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:o("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:r}),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?o("limits.copilot.otelHint.copied"):o("limits.copilot.otelHint.copy")})]})}function _({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 Ie(){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 I(){const[e,t]=y.useState(!1),n=['export OPENCODE_GO_WORKSPACE_ID="wrk_..."','export OPENCODE_GO_AUTH_COOKIE="..."'].join(`
3
- `),a=async r=>{r.stopPropagation();try{await navigator.clipboard.writeText(n),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:o("limits.opencodeGo.setupHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:o("limits.opencodeGo.setupHint.subtitle")}),i.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[i.jsxs(_,{n:"1",children:[i.jsx("div",{children:o("limits.opencodeGo.setupHint.step1")}),i.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:r=>r.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:[o("limits.opencodeGo.setupHint.cta"),i.jsx(Ie,{})]})]}),i.jsxs(_,{n:"2",children:[i.jsx("div",{children:o("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:o("limits.opencodeGo.setupHint.step2_workspace")}),i.jsx("li",{children:o("limits.opencodeGo.setupHint.step2_cookie")})]})]}),i.jsxs(_,{n:"3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:o("limits.opencodeGo.setupHint.step3")}),i.jsx("button",{type:"button",onClick:a,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?o("limits.opencodeGo.setupHint.copied"):o("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:n}),i.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:o("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Le(e){const[t,n]=y.useState(0);return y.useLayoutEffect(()=>{const a=e.current;if(!a)return;const r=a.querySelectorAll("[data-limit-label]");let s=0,d=null;if(r.length>0)try{d=document.createElement("canvas").getContext("2d")}catch{d=null}if(d){const l=window.getComputedStyle(r[0]);d.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of r)s=Math.max(s,d.measureText(u.textContent).width)}const c=Math.ceil(s);n(l=>l===c?l:c)}),t}function Oe({claude:e,codex:t,cursor:n,gemini:a,kimi:r,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:p,order:m,visibility:v,displayMode:C}){const T={claude:e,codex:t,cursor:n,gemini:a,kimi:r,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:p},N=y.useRef(null),M=Le(N),[G,D]=y.useState(null),A=Array.isArray(m)&&m.length>0?m:ke,E=C===x.REMAINING?x.REMAINING:x.USED,$=E===x.REMAINING?o("limits.settings.display_mode_remaining"):o("limits.settings.display_mode_used"),S=A.filter(w=>!v||v[w]!==!1).map(w=>Se(w,T[w],E,G===w,()=>D(H=>H===w?null:w))).filter(Boolean);return i.jsx(Z,{delay:.15,children:i.jsx(O,{children:i.jsxs("div",{ref:N,className:"flex flex-col gap-3",style:M>0?{"--tt-limits-label-w":`${M}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:[o("limits.panel.title"),o("limits.panel.mode_separator"),$]}),S.length>0?S:i.jsx(g,{children:o("limits.status.all_hidden")})]})})})}const Re=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function He(){const e=z(),{data:t,error:n,isLoading:a}=Y(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),r=Q();return!Re&&!U()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(ee,{})}):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:o("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:o("limits.page.subtitle")})]}),i.jsx(V,{to:"/settings","aria-label":o("limits.page.openSettings"),title:o("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(X,{className:"h-4 w-4","aria-hidden":!0})})]}),a?i.jsx(re,{}):i.jsxs(i.Fragment,{children:[n?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:o("shared.error.prefix",{error:n})}):null,i.jsx(Oe,{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:r.order,visibility:r.visibility,displayMode:r.displayMode})]})]})})})}export{He as LimitsPage};
@@ -1 +0,0 @@
1
- import{c as y,r as l,ao as X,ai as q,aL as L,j as n,m as O,U as ee,V as v,G as s,Y as te,av as ne,aM as ae,az as ie,aA as se,aB as P,aN as oe,aO as re,W as le,R as ce,S as ue,T as de,a2 as ge,aP as he,aQ as pe,aR as me,aS as be,K as fe,aT as xe,aU as ye,aV as ve,aW as je,aX as ke,aY as Ne,aZ as Se,ag as we}from"./main-ClN5xMKf.js";import{b as G,l as A,u as Ce,L as E}from"./use-limits-display-prefs-BZlxCSKp.js";import{S as j,T as k,a as b,b as _,u as T}from"./use-native-settings-Cbz2Ycln.js";import{C as Le}from"./useScrollLock-DqpLDNcl.js";import{u as Ge}from"./useCurrency-CgeoIGsJ.js";import{S as D}from"./Select-BTE9IFaB.js";import{I as Ae}from"./info-VYTQzNiq.js";import{D as Ee}from"./download-DYn5lZdU.js";import"./Card-_FGU06_g.js";import"./SelectItemText-fTD-_D4r.js";const Ie=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Oe=y("activity",Ie);const Pe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],_e=y("copy",Pe);const Te=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],De=y("grip-vertical",Te);const Me=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Ue=y("languages",Me);const Re=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Fe=y("log-out",Re);const He=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],$e=y("pencil",He),Be=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(Be);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const ze=l.createContext(null);function Ve(){const e=l.useRef(!1);return X(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function We(){const e=Ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>q.postRender(i),[i]),t]}const M=e=>e===!0,Ze=e=>M(e===!0)||e==="id",Ke=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(ze),[r,c]=We(),u=l.useRef(null),g=i.id||o;u.current===null&&(Ze(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:M(a)&&i.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:h,children:e})},Ye="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Je({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:v("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:v("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Qe({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},x=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ke,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=a[d]!==!1,N=r===d;return n.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,onDrop:x,className:v("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[n.jsx(De,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),G(d)?n.jsx(ee,{provider:G(d),size:18,className:v("pointer-events-none",Ye)}):null,n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:A(d)}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(Je,{checked:p,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${A(d)}`})})]},d)})})})}function Xe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function qe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function et(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function tt(e,t,a){const[i,o]=l.useState(()=>ne()),r=t&&a&&ae(),c=l.useCallback(async()=>{const u=!i;if(ie(u),o(u),!!u)try{await se(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function nt(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,x]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[W,Z]=l.useState(null),K=l.useMemo(()=>Xe(e),[e]),Y=l.useMemo(()=>qe(e),[e]),J=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:h,displayName:K,editingGithub:z,editingName:f,email:Y,githubError:W,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:V,setEditingName:x,setGithubError:Z,setGithubInput:B,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:N,userId:J}}function at(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!i||!o)return;const r=await oe({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function it(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await re({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function st(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function ot(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function rt(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function lt(e,t,a){const i=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await t({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),a?.()}})},[t,e,a]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function ct(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=et(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function ut(){const e=te(),t=nt(e.user),a=tt(e.getAccessToken,e.enabled,e.signedIn);at(e.getAccessToken,e.signedIn,t.loadSetters);const i=it(e.getAccessToken,t),o=rt(t,i),r=lt(t,i,e.refreshDisplayName),c=ct(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:t.userId,name:st(t,{...o,...r}),github:ot(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function U({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function dt({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),n.jsx(U,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function gt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(U,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function R({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function F({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function ht({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function pt({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:x}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(F,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(dt,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:n.jsx(ht,{name:e})})}function mt({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:x,startEditingGithub:d}=e;return n.jsx(F,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(gt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{label:s("settings.account.edit"),onClick:d}),n.jsx(k,{checked:x,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function bt(){const{openLoginModal:e}=le();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function ft({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(pt,{name:e}),n.jsx(mt,{github:t})]})}function xt(){const e=ut();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(vt,{onSignOut:e.signOut}),children:[n.jsx(yt,{userId:e.userId}),n.jsx(jt,{settings:e}),n.jsx(kt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(Nt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(bt,{}):null}function yt({userId:e}){const[t,a]=ce.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),a(!0),globalThis.setTimeout(()=>a(!1),1200)}catch{a(!1)}};return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),n.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[t?n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}):n.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?s("settings.account.copied"):s("settings.account.copy")]})]})}function vt({onSignOut:e}){return n.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[n.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function jt({settings:e}){return e.showLocalCloudSync?n.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function kt({checked:e,disabled:t,onChange:a}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function Nt({visible:e,name:t,github:a}){return n.jsx(ue,{initial:!1,children:e?n.jsx(O.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:n.jsx(ft,{name:t,github:a})},"public-profile-fields"):null})}function St(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:he},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:s("settings.appearance.theme.system"),Icon:me}]}function wt(){return[{value:xe,label:s("settings.appearance.language.system")},{value:ye,label:s("settings.appearance.language.english")},{value:ve,label:s("settings.appearance.language.chinese")},{value:je,label:s("settings.appearance.language.traditional_chinese")},{value:ke,label:s("settings.appearance.language.japanese")},{value:Ne,label:s("settings.appearance.language.korean")}]}function Ct(e){if(!e)return null;try{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function Lt(e,t){const a=s(`settings.appearance.currency.rate_source.${e}`),i=Ct(t),o=i?s("settings.appearance.currency.rate_updated",{when:i}):s("settings.appearance.currency.rate_never");return`${a} · ${o}`}function Gt({locale:e,setLocale:t}){const a=wt();return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:n.jsx(Ue,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function At({currency:e,setCurrency:t}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Et({currency:e,rate:t,rateSource:a,rateFetchedAt:i}){if(e===fe)return n.jsx(n.Fragment,{children:s("settings.appearance.currency.hint")});const o=Lt(a,i);return n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${e}`}),n.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:n.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function It(){const{theme:e,setTheme:t}=de(),{locale:a,setLocale:i}=ge(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ge();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(_,{options:St(),value:e,onChange:t})}),n.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(Gt,{locale:a,setLocale:i})}),n.jsx(b,{label:s("settings.appearance.currency.label"),hint:n.jsx(Et,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(At,{currency:o,setCurrency:g})})]})}function Ot(){const{available:e,settings:t,setSetting:a,runAction:i}=T();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,u=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[r?n.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Se,{className:v("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Pt(){const{available:e,settings:t,runAction:a}=T(),i=e&&t?.version;return n.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[i?n.jsxs(n.Fragment,{children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),n.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,n.jsxs("a",{href:we,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[n.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function _t({prefs:e}){return n.jsx(_,{options:[{value:E.USED,label:s("limits.settings.display_mode_used")},{value:E.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Vt(){const e=Ce();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(It,{}),n.jsx(Ot,{}),n.jsx(xt,{}),n.jsx(j,{title:s("settings.section.limits"),action:n.jsx(_t,{prefs:e}),children:n.jsx(Qe,{prefs:e})})]}),n.jsx(Pt,{})]})})})}export{Vt as SettingsPage};
@@ -1 +0,0 @@
1
- import{j as e,G as o,c2 as P,aR as I,r as u,a_ as B,R as D,V as M}from"./main-ClN5xMKf.js";import{S as E}from"./Select-BTE9IFaB.js";import{u as K,T as R}from"./use-native-settings-Cbz2Ycln.js";import{F as L,S as G,a as O}from"./FadeIn-By_JNfKb.js";import{A as $}from"./arrow-up-right-BCwkxp9i.js";import{D as z}from"./download-DYn5lZdU.js";import"./SelectItemText-fTD-_D4r.js";import"./useScrollLock-DqpLDNcl.js";import"./Card-_FGU06_g.js";const H=["todayTokens","todayCost"],F=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"codexSpark5h",label:"Codex Spark 5h Limit",shortLabel:"Cx Spark 5h",category:"limits"},{id:"codexSpark7d",label:"Codex Spark 7d Limit",shortLabel:"Cx Spark 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaude",label:"Antigravity Claude Limit",shortLabel:"Ag Cl",category:"limits"},{id:"antigravityGPro",label:"Antigravity Gemini Pro Limit",shortLabel:"Ag GPro",category:"limits"},{id:"antigravityFlash",label:"Antigravity Flash Limit",shortLabel:"Ag Fl",category:"limits"}];function N(t,a=F,r=2){const i=new Set(a.map(n=>n.id)),l=new Set,s=Array.isArray(t)?t.filter(n=>!i.has(n)||l.has(n)?!1:(l.add(n),!0)):[];return(s.length>0?s:H).slice(0,Math.max(1,Number(r)||2))}const U=264,V=124,h="ui-rounded, -apple-system, system-ui",C=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],X={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Y(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:a}){const r=t==="lg",i=r?560:264,l=r?32:22;return e.jsx("div",{className:M("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",r?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:i,aspectRatio:`${U} / ${V}`,borderRadius:l},children:a})})}function Z({size:t="sm"}){const a="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",r=`${a} L264,124 L0,124 Z`,i=`sparkArea-${t}`;return e.jsx(b,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:h,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:h,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:"$673.61"}),e.jsx("path",{d:r,fill:`url(#${i})`,stroke:"none"}),e.jsx("path",{d:a,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const S=(()=>{const r=[];for(let i=0;i<26;i++)for(let l=0;l<7;l++){const s=Math.sin((i+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(s-Math.floor(s))*100);r.push({w:i,d:l,v:c})}return r})();function A(t,a){return t<18?a?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function q(){return e.jsx(b,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:S.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(s.v,!0)},`d-${s.w}-${s.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:S.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(s.v,!1)},`l-${s.w}-${s.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:h,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function J(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],a=22,r=28,i=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*a,g=C[c%C.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:h,children:s.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:h,children:[s.pct,"%"]}),e.jsx("rect",{x:i,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:g})]},s.name)})})})}function Q(){const t=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],a=22,r=28,i=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*a,g=X[s.source],y=Y(s.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:s.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:h,children:[s.pct,"%"]}),e.jsx("rect",{x:i,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},s.label)})})})}function ee(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function te(t,a){switch(t){case"todayTokens":return o("menubar.metric.today_tokens");case"todayCost":return o("menubar.metric.today_cost");case"last7dTokens":return o("menubar.metric.last_7d_tokens");case"totalTokens":return o("menubar.metric.total_tokens");case"totalCost":return o("menubar.metric.total_cost");case"claude5h":return o("menubar.metric.claude_5h");case"claude7d":return o("menubar.metric.claude_7d");case"codex5h":return o("menubar.metric.codex_5h");case"codex7d":return o("menubar.metric.codex_7d");case"codexSpark5h":return o("menubar.metric.codex_spark_5h");case"codexSpark7d":return o("menubar.metric.codex_spark_7d");default:return a}}function ae(t,a){const r=new Set(a.map(l=>l.id)),i=t.filter(l=>r.has(l));for(const l of a){if(i.length>=2)break;i.includes(l.id)||i.push(l.id)}return i.slice(0,2)}function ie({slotConfigs:t,showStats:a}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),a?t.map(({slot:r,item:i},l)=>e.jsxs(D.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:M("flex min-w-[52px] flex-col items-center justify-center py-1.5",l===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:i?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:i?.shortLabel||"Metric"})]})]},r)):null]})})}function se({slot:t,value:a,options:r,disabled:i,onChange:l}){const s=t===0?o("menubar.slot.primary"):o("menubar.slot.secondary");return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:s}),e.jsx(E,{value:a,disabled:i,ariaLabel:s,onValueChange:c=>l(t,c),options:r.map(c=>({value:c.id,label:c.displayLabel})),matchTriggerWidth:!0,className:"w-full px-3 py-2 text-sm font-medium"})]})}function p({label:t,hint:a,checked:r,disabled:i,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),a?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a}):null]}),e.jsx(R,{checked:r,disabled:i,onChange:l,ariaLabel:t})]})}function re(){const{available:t,settings:a,setSetting:r}=K(),i=u.useMemo(()=>(Array.isArray(a?.menuBarAvailableItems)?a.menuBarAvailableItems:F).map(m=>({...m,displayLabel:te(m.id,m.label),previewValue:ee(m)})),[a?.menuBarAvailableItems]),l=Number(a?.menuBarMaxItems)||2,s=u.useMemo(()=>N(a?.menuBarItems,i,l),[i,l,a?.menuBarItems]),c=u.useMemo(()=>ae(s,i),[i,s]),n=a?.showStats!==!1,g=d=>{r("menuBarItems",N(d,i,l))},y=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,g(x))},k=[0,1].map(d=>{const m=c[d]||i[d]?.id||"",v=c[d===0?1:0],W=i.filter(f=>f.id===m||f.id!==v),T=i.find(f=>f.id===m);return{slot:d,currentValue:m,options:W,item:T}}),w=a?.animatedIcon!==!1,j=a?.confettiOnReset!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(ie,{slotConfigs:k,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:k.map(({slot:d,currentValue:m,options:x})=>e.jsx(se,{slot:d,value:m,options:x,disabled:!t||!n,onChange:y},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(p,{label:o("settings.menubar.showStats"),hint:t?o("settings.menubar.showStatsHint"):o("menubar.native_only"),checked:n,disabled:!t,onChange:()=>r("showStats",!n)}),e.jsx(p,{label:o("settings.menubar.animatedIcon"),hint:o("settings.menubar.animatedIconHint"),checked:w,disabled:!t,onChange:()=>r("animatedIcon",!w)}),e.jsx(p,{label:o("settings.menubar.confettiOnReset"),hint:o("settings.menubar.confettiOnResetHint"),checked:j,disabled:!t,onChange:()=>r("confettiOnReset",!j)})]})]})}function le(){const[t,a]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(B()){a("native");return}const r=(navigator.userAgent||"").toLowerCase(),i=/mac/.test(r)&&!/iphone|ipad/.test(r);a(i?"mac-web":"other")},[]),t}function oe(){const t=le();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>P("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[o("widgets.cta.open_gallery"),e.jsx($,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(z,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(I,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.macos_only")]})}const ne=[{id:"summary",Preview:Z,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:q,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:J,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:Q,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ce({Preview:t,nameKey:a,descKey:r}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:o(a)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:o(r)})]})]})}function _({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:o(t)})}function pe(){return e.jsx("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-5xl px-4 sm:px-6",children:[e.jsx(L,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:o("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(oe,{})})]})}),e.jsx(L,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":o("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(_,{titleKey:"widgets.menubar.section.title"}),e.jsx(re,{})]})}),e.jsxs("section",{"aria-label":o("widgets.gallery.section.title"),children:[e.jsx(_,{titleKey:"widgets.gallery.section.title"}),e.jsx(G,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:ne.map(({id:t,Preview:a,nameKey:r,descKey:i})=>e.jsx(O,{children:e.jsx(ce,{Preview:a,nameKey:r,descKey:i})},t))})})]})]})})})}export{pe as WidgetsPage};