tokentracker-cli 0.35.2 → 0.36.1
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/{ActivityHeatmap-Bb0omCiI.js → ActivityHeatmap-DPmiMH4Q.js} +1 -1
- package/dashboard/dist/assets/{Card-CtI3QMH6.js → Card-BlIsxuah.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-VF6RdezJ.js +19 -0
- package/dashboard/dist/assets/{DevicePage-CyWx9gIK.js → DevicePage-CzlnwSOX.js} +1 -1
- package/dashboard/dist/assets/{DialogTitle-C9pIgpxK.js → DialogTitle-Ds8Zyp-H.js} +2 -2
- package/dashboard/dist/assets/{FadeIn-D1DCy1c9.js → FadeIn-DCdF-JKA.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-D2qhRbZX.js → HeaderGithubStar-C1g-qMrd.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-B_L_cKmD.js → IpCheckPage-BPNjooka.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-MT2qg0bE.js → LandingPage-BDwl_l3N.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-BXi46kQk.js → LeaderboardAvatar-V0mkCkzN.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-CrhD0iRk.js → LeaderboardPage-c2ebFIDI.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfileModal-DRylJ_fc.js → LeaderboardProfileModal-DHdkIr5W.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-DfVriPxC.js → LeaderboardProfilePage-xWY6PJI0.js} +1 -1
- package/dashboard/dist/assets/LimitsPage-rc2lvN6C.js +2 -0
- package/dashboard/dist/assets/{LocalOnlyNotice-CQbMwbCe.js → LocalOnlyNotice-ChC9Z6ZN.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-BuLVMfu2.js → LoginPage-B6vOBqIw.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-BpAU63FH.js → PopoverPopup-DRWRI_6O.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-ZDWZ0OtH.js +1 -0
- package/dashboard/dist/assets/{SkillsPage-BV3LnVvE.js → SkillsPage-CAJxaQG0.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-C-39lx67.js → WidgetsPage-BkZjVQSS.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-DTDJesAM.js → WrappedPage-CXYvtLhV.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-BKtVvn2f.js → agent-logos-DjQzMdSw.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-BjAWXJOu.js → arrow-up-right-OURL9IAS.js} +1 -1
- package/dashboard/dist/assets/check-CESu4eR-.js +1 -0
- package/dashboard/dist/assets/{chevron-down-D6_2sGG-.js → chevron-down-BjIFZNid.js} +1 -1
- package/dashboard/dist/assets/{download-BVdUICgW.js → download-C1FtauDf.js} +1 -1
- package/dashboard/dist/assets/{info-BUs_fkaX.js → info-BTIZccVB.js} +1 -1
- package/dashboard/dist/assets/{main-BBMM0Tgo.js → main-QElo_0bY.js} +16 -15
- package/dashboard/dist/assets/{use-limits-display-prefs-BJRhaKEd.js → use-limits-display-prefs-ClE847BF.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-lyrRoQkg.js → use-native-settings-D20qXg2x.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-COFMsRkg.js → use-usage-limits-CIWlA4Jt.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-C3yqfWiI.js → useCurrency-CUAxzIqS.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/subscriptions.js +25 -13
- package/src/lib/usage-limits.js +40 -9
- package/dashboard/dist/assets/DashboardPage-jCAhwrGj.js +0 -19
- package/dashboard/dist/assets/LimitsPage-Ni3_-kEb.js +0 -2
- package/dashboard/dist/assets/SettingsPage-DX7f066p.js +0 -1
- package/dashboard/dist/assets/check-CRcTlhgH.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as i,M as f,A as s,r as E,ax as I,i as P,L as M,ay as R}from"./main-BBMM0Tgo.js";import{u as C}from"./use-usage-limits-COFMsRkg.js";import{L as u,u as O}from"./use-limits-display-prefs-BJRhaKEd.js";import{C as j}from"./Card-CtI3QMH6.js";import{F as T}from"./FadeIn-D1DCy1c9.js";import{L as S}from"./LocalOnlyNotice-CQbMwbCe.js";import"./arrow-up-right-BjAWXJOu.js";import"./download-BVdUICgW.js";const A=[3,2,3,3,2,2,3];function x({className:t}){return i.jsx("div",{className:f("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function D(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(x,{className:"h-3 w-12 shrink-0"}),i.jsx(x,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(x,{className:"h-3 w-[30px] shrink-0"}),i.jsx(x,{className:"h-3 w-6 shrink-0"})]})}function G({bars:t,index:e}){const r=e%3===0?"w-24":e%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(x,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(x,{className:f("h-4",r)})]}),Array.from({length:t},(n,a)=>i.jsx(D,{},a))]})}function H(){return i.jsx(j,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(x,{className:"h-3.5 w-28"}),A.map((t,e)=>i.jsx(G,{bars:t,index:e},e))]})})}function o(t){if(!t)return null;const e=typeof t=="number"?t*1e3:Date.parse(t);if(!Number.isFinite(e))return null;const r=e-Date.now();if(r<=0)return s("shared.time.now");const n=Math.floor(r/6e4);if(n<60)return`${n}m`;const a=Math.floor(n/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function $(t,e){const r=e===u.REMAINING?100-t:t;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function l({label:t,pct:e,reset:r,mode:n=u.USED}){const a=Math.max(0,Math.min(100,Number(e)||0)),d=n===u.REMAINING?100-a:a,p=Math.round(d),y=d>0&&p===0?Math.max(d,.35):d,w=d>0&&p===0?"<1":String(p);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:t}),i.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:`${$(d,n)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${y}%`,minWidth:d>0?"3px":0}})}),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:[w,"%"]}),r?i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r}):null]})}function m({name:t,icon:e,children:r}){const a=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[e?i.jsx("img",{src:e,alt:"",className:a}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:t})]}),r]})}const F=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],B={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:t,tone:e="neutral"}){const r=e==="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:t})}function U(t,e,r){const n=B[t];if(!n)return null;if(!e?.configured)return i.jsx(m,{name:n.name,icon:n.icon,children:i.jsx(c,{children:s("limits.status.not_connected")})},t);if(e.error)return i.jsx(m,{name:n.name,icon:n.icon,children:i.jsx(c,{tone:"error",children:s("shared.error.prefix",{error:e.error})})},t);switch(t){case"claude":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.five_hour?i.jsx(l,{label:"5h",pct:e.five_hour.utilization,reset:o(e.five_hour.resets_at),mode:r}):null,e.seven_day?i.jsx(l,{label:"7d",pct:e.seven_day.utilization,reset:o(e.seven_day.resets_at),mode:r}):null,e.seven_day_opus?i.jsx(l,{label:"Opus",pct:e.seven_day_opus.utilization,reset:o(e.seven_day_opus.resets_at),mode:r}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?i.jsx(c,{children:s("limits.status.no_data")}):null]},"claude");case"codex":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:"5h",pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:"7d",pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"codex");case"cursor":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:s("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:s("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(l,{label:s("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"cursor");case"gemini":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:"Pro",pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:"Flash",pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(l,{label:"Lite",pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"gemini");case"kimi":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:s("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:s("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(l,{label:s("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,e.parallel_limit?i.jsx(c,{children:s("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kimi");case"kiro":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:s("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:s("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kiro");case"antigravity":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:"Claude",pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:"G Pro",pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(l,{label:"Flash",pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"antigravity");case"copilot":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:s("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:s("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:i.jsx(z,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function z({defaultDir:t}){const[e,r]=E.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${t||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
2
|
-
`),d=async()=>{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:s("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:s("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:d,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:e?s("limits.copilot.otelHint.copied"):s("limits.copilot.otelHint.copy")})]})}function Y({claude:t,codex:e,cursor:r,gemini:n,kimi:a,kiro:d,antigravity:p,copilot:y,order:w,visibility:h,displayMode:v}){const k={claude:t,codex:e,cursor:r,gemini:n,kimi:a,kiro:d,antigravity:p,copilot:y},N=Array.isArray(w)&&w.length>0?w:F,g=v===u.REMAINING?u.REMAINING:u.USED,L=g===u.REMAINING?s("limits.settings.display_mode_remaining"):s("limits.settings.display_mode_used"),b=N.filter(_=>!h||h[_]!==!1).map(_=>U(_,k[_],g)).filter(Boolean);return i.jsx(T,{delay:.15,children:i.jsx(j,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[s("limits.panel.title"),s("limits.panel.mode_separator"),L]}),b.length>0?b:i.jsx(c,{children:s("limits.status.all_hidden")})]})})})}const K=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function ie(){const t=I(),{data:e,error:r,isLoading:n}=C(t?{initialRefresh:!0,initialState:t,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),a=O();return!K&&!P()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(S,{})}):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:s("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:s("limits.page.subtitle")})]}),i.jsx(M,{to:"/settings","aria-label":s("limits.page.openSettings"),title:s("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(R,{className:"h-4 w-4","aria-hidden":!0})})]}),n?i.jsx(H,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:s("shared.error.prefix",{error:r})}):null,i.jsx(Y,{claude:e?.claude,codex:e?.codex,cursor:e?.cursor,gemini:e?.gemini,kimi:e?.kimi,kiro:e?.kiro,antigravity:e?.antigravity,copilot:e?.copilot,order:a.order,visibility:a.visibility,displayMode:a.displayMode})]})]})})})}export{ie as LimitsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as v,r as l,ag as Q,aa as q,aC as L,j as t,m as A,M as f,A as s,O as X,an as ee,aD as te,ar as ne,as as ae,at as O,aE as ie,aF as se,N as oe,R as re,J as le,K as ce,V as ue,aG as de,aH as ge,aI as he,aJ as pe,E as me,aK as be,aL as xe,aM as fe,aN as ye,aO as ve,aP as ke,aQ as je,a8 as Ne}from"./main-BBMM0Tgo.js";import{a as Se,b as E,u as we,L as G}from"./use-limits-display-prefs-BJRhaKEd.js";import{S as k,T as j,a as b,b as _,u as P}from"./use-native-settings-lyrRoQkg.js";import{C as Ce}from"./check-CRcTlhgH.js";import{u as Le}from"./useCurrency-C3yqfWiI.js";import{C as D}from"./chevron-down-D6_2sGG-.js";import{I as Ee}from"./info-BUs_fkaX.js";import{D as Ge}from"./download-BVdUICgW.js";import"./Card-CtI3QMH6.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"}]],Ae=v("activity",Ie);const Oe=[["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=v("copy",Oe);const Pe=[["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=v("grip-vertical",Pe);const Te=[["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"}]],Me=v("languages",Te);const Ue=[["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"}]],Re=v("log-out",Ue);const Fe=[["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"}]],He=v("pencil",Fe),$e=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,n=new WeakMap,i=()=>e.forEach($e);return{add:a=>{e.add(a),n.set(a,a.addEventListener("willUpdate",i))},remove:a=>{e.delete(a);const o=n.get(a);o&&(o(),n.delete(a)),i()},dirty:i}}const Be=l.createContext(null);function ze(){const e=l.useRef(!1);return Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ve(){const e=ze(),[n,i]=l.useState(0),a=l.useCallback(()=>{e.current&&i(n+1)},[n]);return[l.useCallback(()=>q.postRender(a),[a]),n]}const T=e=>e===!0,Ke=e=>T(e===!0)||e==="id",Ze=({children:e,id:n,inherit:i=!0})=>{const a=l.useContext(L),o=l.useContext(Be),[r,c]=Ve(),u=l.useRef(null),g=a.id||o;u.current===null&&(Ke(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:T(i)&&a.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return t.jsx(L.Provider,{value:h,children:e})},We=new Set(["cursor","kiro","copilot","kimi"]);function Je({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:f("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:f("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Ye({prefs:e}){const{order:n,visibility:i,toggle:a,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))},x=()=>{c(null),g(null)},y=d=>{d.preventDefault(),c(null),g(null)};return t.jsx(Ze,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const p=i[d]!==!1,N=r===d;return t.jsxs(A.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:x,onDrop:y,className:f("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:[t.jsx(De,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),t.jsx("img",{src:Se[d],alt:"",width:18,height:18,className:f("h-[18px] w-[18px] shrink-0 pointer-events-none",We.has(d)&&"dark:invert"),draggable:!1}),t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:E[d]}),t.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:t.jsx(Je,{checked:p,onChange:()=>a(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${E[d]}`})})]},d)})})})}function Qe(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},a=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof a=="string"&&a.trim()?a.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 Xe(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),a=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||a?.[1];return o?`https://github.com/${o}`:null}function w(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function et(e,n,i){const[a,o]=l.useState(()=>ee()),r=n&&i&&te(),c=l.useCallback(async()=>{const u=!a;if(ne(u),o(u),!!u)try{await ae(()=>e())}catch(g){w("cloud sync",g)}},[a,e]);return{cloudSyncOn:a,handleCloudSyncToggle:c,showLocalCloudSync:r}}function tt(e){const[n,i]=l.useState(!1),[a,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[x,y]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[F,C]=l.useState(""),[H,$]=l.useState(""),[B,z]=l.useState(!1),[V,K]=l.useState(null),Z=l.useMemo(()=>Qe(e),[e]),W=l.useMemo(()=>qe(e),[e]),J=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Y=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:i,setShowGithubOn:S}),[]);return{anonymousOn:a,customDisplayName:h,displayName:Z,editingGithub:B,editingName:x,email:W,githubError:V,githubInput:H,githubUrl:F,loadSetters:Y,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:z,setEditingName:y,setGithubError:K,setGithubInput:$,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:S,showGithubOn:N,userId:J}}function nt(e,n,i){l.useEffect(()=>{if(!n)return;let a=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await O({getAccessToken:e});if(!a||!o)return;const r=await ie({accessToken:o});if(!a)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{a&&i.setProfileLoading(!1)}})(),()=>{a=!1}},[e,n,i])}function at(e,n){return l.useCallback(async(i,{label:a,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const c=await O({getAccessToken:e});if(!c)return!1;const u=await se({accessToken:c,...i});return r?.(u),!0}catch(c){return o?o(c):w(a||"mutate profile",c),!1}finally{n.setProfileSaving(!1)}},[e,n])}function it(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function st(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function ot(e,n){const i=l.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function rt(e,n){const i=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await n({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[n,e]),a=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:a}}function lt(e,n){const i=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),a=l.useCallback(async()=>{const r=Xe(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({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)}})},[n,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:a,handleShowGithubToggle:i,startEditingGithub:o}}function ct(){const e=X(),n=tt(e.user),i=et(e.getAccessToken,e.enabled,e.signedIn);nt(e.getAccessToken,e.signedIn,n.loadSetters);const a=at(e.getAccessToken,n),o=ot(n,a),r=rt(n,a),c=lt(n,a);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:it(n,{...o,...r}),github:st(n,c),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function M({disabled:e,onCancel:n,onSave:i,saveLabel:a=s("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:a}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function ut({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:a,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),t.jsx(M,{disabled:a||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:a?s("settings.account.saving"):void 0})]})}function dt({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:a,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),t.jsx(M,{disabled:a,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:a?s("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function U({disabled:e=!1,label:n,onClick:i,title:a}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:a,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(He,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function R({actions:e,editing:n,editor:i,hint:a,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),n?null:e]})})}function gt({name:e}){const n=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(U,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function ht({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:a,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:x,startEditingName:y}=e,d=n?s("settings.account.displayNameAnonymousHint"):i||a;return t.jsx(R,{label:s("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(ut,{nameInput:u,setEditingName:m,setNameInput:x,profileSaving:h,handleSaveName:c}),actions:t.jsx(gt,{name:e})})}function pt({github:e}){const{editingGithub:n,githubError:i,githubInput:a,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x,showGithubOn:y,startEditingGithub:d}=e;return t.jsx(R,{label:s("settings.account.githubUrl"),editing:n,hint:o||s("settings.account.githubUrlHint"),editor:t.jsx(dt,{githubError:i,githubInput:a,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(U,{label:s("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function mt(){const{openLoginModal:e}=oe();return t.jsx(k,{title:s("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function bt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(ht,{name:e}),t.jsx(pt,{github:n})]})}function xt(){const e=ct();return e.enabled?e.signedIn?t.jsxs(k,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(yt,{onSignOut:e.signOut}),children:[t.jsx(ft,{userId:e.userId}),t.jsx(vt,{settings:e}),t.jsx(kt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(jt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(mt,{}):null}function ft({userId:e}){const[n,i]=re.useState(!1);if(!e)return null;const a=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:a,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:[n?t.jsx(Ce,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?s("settings.account.copied"):s("settings.account.copy")]})]})}function yt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function vt({settings:e}){return e.showLocalCloudSync?t.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function kt({checked:e,disabled:n,onChange:i}){return t.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:s("settings.account.publicProfile")})})}function jt({visible:e,name:n,github:i}){return t.jsx(le,{initial:!1,children:e?t.jsx(A.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(bt,{name:n,github:i})},"public-profile-fields"):null})}function Nt(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:de},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ge},{value:"system",label:s("settings.appearance.theme.system"),Icon:he}]}function St(){return[{value:be,label:s("settings.appearance.language.system")},{value:xe,label:s("settings.appearance.language.english")},{value:fe,label:s("settings.appearance.language.chinese")},{value:ye,label:s("settings.appearance.language.traditional_chinese")},{value:ve,label:s("settings.appearance.language.japanese")},{value:ke,label:s("settings.appearance.language.korean")}]}function wt(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Ct(e,n){const i=s(`settings.appearance.currency.rate_source.${e}`),a=wt(n),o=a?s("settings.appearance.currency.rate_updated",{when:a}):s("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Lt({locale:e,setLocale:n}){const i=St();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx(Me,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.language.label"),className:f("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-8 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500","dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))}),t.jsx(D,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Et({currency:e,setCurrency:n}){const i=pe();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.currency.label"),className:f("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-3 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500","dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.code,children:s(a.labelKey)},a.code))}),t.jsx(D,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Gt({currency:e,rate:n,rateSource:i,rateFetchedAt:a}){if(e===me)return t.jsx(t.Fragment,{children:s("settings.appearance.currency.hint")});const o=Ct(i,a);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function It(){const{theme:e,setTheme:n}=ce(),{locale:i,setLocale:a}=ue(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Le();return t.jsxs(k,{title:s("settings.section.appearance"),children:[t.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:t.jsx(_,{options:Nt(),value:e,onChange:n})}),t.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:t.jsx(Lt,{locale:i,setLocale:a})}),t.jsx(b,{label:s("settings.appearance.currency.label"),hint:t.jsx(Gt,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:t.jsx(Et,{currency:o,setCurrency:g})})]})}function At(){const{available:e,settings:n,setSetting:i,runAction:a}=P();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,c=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(k,{title:s("settings.section.menubar"),children:[r?t.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,t.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>a("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(je,{className:f("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),t.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:t.jsxs("button",{type:"button",onClick:()=>a("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Ot(){const{available:e,settings:n,runAction:i}=P(),a=e&&n?.version;return t.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:[a?t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["TokenTrackerBar v",n.version]}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,t.jsxs("a",{href:Ne,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function _t({prefs:e}){return t.jsx(_,{options:[{value:G.USED,label:s("limits.settings.display_mode_used")},{value:G.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Bt(){const e=we();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(It,{}),t.jsx(At,{}),t.jsx(xt,{}),t.jsx(k,{title:s("settings.section.limits"),action:t.jsx(_t,{prefs:e}),children:t.jsx(Ye,{prefs:e})})]}),t.jsx(Ot,{})]})})})}export{Bt as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c}from"./main-BBMM0Tgo.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
|