tokentracker-cli 0.41.0 → 0.42.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.
- package/README.ja.md +1 -0
- package/README.ko.md +1 -0
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dashboard/dist/assets/{ActivityHeatmap-DAyvtRkn.js → ActivityHeatmap-CImSj13A.js} +1 -1
- package/dashboard/dist/assets/{Card-DByZ3SxT.js → Card-DpjFlMHF.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-CZkSRYE8.js +19 -0
- package/dashboard/dist/assets/{DevicePage-BkGbFsCV.js → DevicePage-BIBlmBPl.js} +1 -1
- package/dashboard/dist/assets/{DialogTitle-BhNOpzk4.js → DialogTitle-BMKzpys0.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CQ0uWwqS.js → FadeIn-B5-cy4YN.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-OlcZIZs-.js → HeaderGithubStar-BM-sbvJG.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-VaBccp0v.js → IpCheckPage-C7-NXbFK.js} +4 -4
- package/dashboard/dist/assets/{LandingPage-BbOOtp0W.js → LandingPage-ouOFlABY.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-B26XN7XT.js → LeaderboardAvatar-DMXPtCkx.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-D43tLe4r.js → LeaderboardPage-CC4CFYAe.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfileModal-Cc3TV4wl.js → LeaderboardProfileModal-D-ncIr24.js} +3 -3
- package/dashboard/dist/assets/LeaderboardProfilePage-DtDMfVuQ.js +421 -0
- package/dashboard/dist/assets/{LimitsPage-HXB3ON_M.js → LimitsPage-qaD7Reti.js} +2 -2
- package/dashboard/dist/assets/{LocalOnlyNotice-BtgOf0xW.js → LocalOnlyNotice-BCy18fW4.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-CHNz2uuj.js → LoginPage-BLPY2ZI-.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-i1aCasNO.js → PopoverPopup-CpIlpO0j.js} +1 -1
- package/dashboard/dist/assets/{Select-Dn4TdKJu.js → Select-BOxMknxo.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-D2YtMFj0.js → SelectItemText-B0SL3Wb5.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-De7GbtPf.js +1 -0
- package/dashboard/dist/assets/{SkillsPage-Bt8e5ROp.js → SkillsPage-jpoYzUBQ.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-CGnhXDpP.js → WidgetsPage-BaEYiZZH.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-FEgpbrfx.js → WrappedPage-BYhKuiTb.js} +1 -1
- package/dashboard/dist/assets/agent-logos-DSQgCNll.js +1 -0
- package/dashboard/dist/assets/{arrow-up-right-Al34G4US.js → arrow-up-right-Brwh94cN.js} +1 -1
- package/dashboard/dist/assets/{download-BorAs8Ai.js → download-kFiot71R.js} +1 -1
- package/dashboard/dist/assets/{info-BjMpOQ6L.js → info-CGx4zWQF.js} +1 -1
- package/dashboard/dist/assets/{main-BZIH6355.js → main-9Ze1SUIZ.js} +18 -18
- package/dashboard/dist/assets/{main-DTwPGswA.css → main-DMJJVAOH.css} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CMcyG3Sf.js → use-limits-display-prefs-Ehri95OP.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-Dda0lUdD.js → use-native-settings-BWqG5RDr.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-DpD2WuDG.js → use-usage-limits-2ZxmPfoP.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-Bar8ZQys.js → useCurrency-DQmyhw3i.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-g4Jj83C_.js → useScrollLock-BcLeWqWK.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/lib/local-api.js +63 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +15 -13
- package/dashboard/dist/assets/DashboardPage-DJLLG7DG.js +0 -19
- package/dashboard/dist/assets/LeaderboardProfilePage-DAVuscsT.js +0 -1
- package/dashboard/dist/assets/SettingsPage-D-44xtnb.js +0 -1
- package/dashboard/dist/assets/agent-logos-2LgC_fmg.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,j as e,M as w,O as N,Q as L,aw as I,L as y,ax as T,A as s,a8 as E}from"./main-BZIH6355.js";import{u as M}from"./useCurrency-Bar8ZQys.js";import{H as _}from"./HeaderGithubStar-OlcZIZs-.js";import{useLeaderboardProfileData as C,ProfileSkeleton as S,ProfileContent as A}from"./LeaderboardProfileModal-Cc3TV4wl.js";import{D as P}from"./download-BorAs8Ai.js";import"./LeaderboardAvatar-B26XN7XT.js";import"./ActivityHeatmap-DAyvtRkn.js";import"./info-BjMpOQ6L.js";import"./arrow-up-right-Al34G4US.js";import"./useScrollLock-g4Jj83C_.js";import"./DialogTitle-BhNOpzk4.js";const l=18;function v(){return e.jsxs("svg",{"aria-hidden":!0,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2v2"}),e.jsx("path",{d:"M12 20v2"}),e.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),e.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),e.jsx("path",{d:"M2 12h2"}),e.jsx("path",{d:"M20 12h2"}),e.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),e.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function j(){return e.jsx("svg",{"aria-hidden":!0,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function D(){return e.jsxs("svg",{"aria-hidden":!0,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8"}),e.jsx("path",{d:"M12 17v4"})]})}const O=[{value:"light",label:"Light",Icon:v},{value:"dark",label:"Dark",Icon:j},{value:"system",label:"System",Icon:D}];function W(a){return a==="dark"?j:v}function z({theme:a,resolvedTheme:g,onSetTheme:m,className:p="",direction:u="down",align:b="right"}){const[o,x]=d.useState(!1),c=d.useRef(null),i=d.useCallback(()=>x(!1),[]);d.useEffect(()=>{if(!o)return;const r=n=>{c.current&&!c.current.contains(n.target)&&i()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[o,i]),d.useEffect(()=>{if(!o)return;const r=n=>{n.key==="Escape"&&i()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[o,i]);const f=W(g);return e.jsxs("div",{ref:c,className:`relative ${p}`,children:[e.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":o,onClick:()=>x(r=>!r),className:"flex items-center justify-center w-9 h-9 rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors",children:e.jsx(f,{})}),o&&e.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${u==="up"?"bottom-full mb-1":"top-full mt-1"} ${b==="left"?"left-0":"right-0"}`,children:O.map(({value:r,label:n,Icon:h})=>{const k=a===r;return e.jsxs("button",{type:"button",onClick:()=>{m(r),i()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${k?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[e.jsx(h,{}),e.jsx("span",{children:n})]},r)})})]})}const R="https://github.com/mm7894215/TokenTracker/releases/latest";function V({auth:a,signedIn:g,sessionSoftExpired:m,userId:p}){const{currency:u,rate:b}=M(),{theme:o,resolvedTheme:x,setTheme:c}=w(),{openLoginModal:i}=N(),{signedIn:f,loading:r}=L(),n=!I(),h=g&&!m,k=d.useMemo(()=>h&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,h]),t=C({userId:p,period:"total",accessToken:k});return e.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[e.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:e.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(y,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),e.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),e.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:e.jsx(_,{})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsxs(y,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-lg border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[e.jsx(T,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),e.jsx("span",{children:s("leaderboard.profile.nav.back")})]}),n&&e.jsxs("a",{href:R,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-lg border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[e.jsx(P,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),e.jsx("span",{className:"hidden sm:inline",children:s("leaderboard.profile.nav.download")})]}),r?e.jsx("div",{className:"h-8 w-16 animate-pulse rounded-lg bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):f?e.jsx(E,{}):e.jsx("button",{type:"button",onClick:i,className:"inline-flex h-8 min-w-[76px] items-center justify-center rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-all duration-200 active:scale-[0.98] select-none text-xs font-bold shadow-sm",children:s("header.auth.sign_in_aria")})]})]})}),e.jsx("main",{className:"flex-1 pt-4 pb-10 sm:pt-6 sm:pb-16",children:e.jsx("div",{className:"mx-auto max-w-2xl px-4 sm:px-6",children:e.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[t.loading&&e.jsx(S,{variant:"page"}),!t.loading&&t.error&&e.jsx("div",{className:"px-6 py-16 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:s("leaderboard.profile_modal.error")})}),!t.loading&&!t.error&&!t.data&&e.jsx("div",{className:"px-6 py-16 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.profile_modal.empty")})}),!t.loading&&!t.error&&t.data&&e.jsx(A,{data:t.data,currency:u,rate:b,variant:"page"})]})})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-2xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:s("landing.v2.footer.line")}),e.jsx(z,{theme:o,resolvedTheme:x,onSetTheme:c,direction:"up",align:"right"})]})})]})}export{V as LeaderboardProfilePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as y,r as l,ah as q,ab as X,aE as L,j as n,m as O,P as ee,N as v,A as s,Q as te,ao as ne,aF as ae,as as ie,at as se,au as P,aG as oe,aH as re,O as le,R as ce,K as ue,M as de,W as ge,aI as he,aJ as pe,aK as me,aL as be,E as fe,aM as xe,aN as ye,aO as ve,aP as je,aQ as Ne,aR as ke,aS as Se,a9 as we}from"./main-BZIH6355.js";import{b as G,l as E,u as Ce,L as A}from"./use-limits-display-prefs-CMcyG3Sf.js";import{S as j,T as N,a as b,b as _,u as D}from"./use-native-settings-Dda0lUdD.js";import{C as Le}from"./useScrollLock-g4Jj83C_.js";import{u as Ge}from"./useCurrency-Bar8ZQys.js";import{S as T}from"./Select-Dn4TdKJu.js";import{I as Ee}from"./info-BjMpOQ6L.js";import{D as Ae}from"./download-BorAs8Ai.js";import"./Card-DByZ3SxT.js";import"./SelectItemText-D2YtMFj0.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 De=[["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"}]],Te=y("grip-vertical",De);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 q(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ke(){const e=Ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>X.postRender(i),[i]),t]}const M=e=>e===!0,We=e=>M(e===!0)||e==="id",Ze=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(ze),[r,c]=Ke(),u=l.useRef(null),g=i.id||o;u.current===null&&(We(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(Ze,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=a[d]!==!1,k=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",k&&"opacity-40"),style:{cursor:k?"grabbing":"grab"},children:[n.jsx(Te,{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:E(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")}: ${E(d)}`})})]},d)})})})}function qe(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 Xe(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(""),[k,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[K,W]=l.useState(null),Z=l.useMemo(()=>qe(e),[e]),Y=l.useMemo(()=>Xe(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:Z,editingGithub:z,editingName:f,email:Y,githubError:K,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:V,setEditingName:x,setGithubError:W,setGithubInput:B,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:k,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(N,{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(N,{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(Nt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(kt,{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(N,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function Nt({checked:e,disabled:t,onChange:a}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(N,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function kt({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:Ne,label:s("settings.appearance.language.japanese")},{value:ke,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(T,{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 Et({currency:e,setCurrency:t}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return n.jsx(T,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function At({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(Ee,{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(At,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(Et,{currency:o,setCurrency:g})})]})}function Ot(){const{available:e,settings:t,setSetting:a,runAction:i}=D();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(N,{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(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Pt(){const{available:e,settings:t,runAction:a}=D(),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:A.USED,label:s("limits.settings.display_mode_used")},{value:A.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{aa as I,ab as S,ac as w,ad as M,ae as h,af as N,r as u,ag as V,ah as G,ai as H,aj as g,j as p,R as F,m as v,K as C,P}from"./main-BZIH6355.js";function D(...e){const t=!Array.isArray(e[0]),n=t?0:-1,o=e[0+n],r=e[1+n],i=e[2+n],a=e[3+n],s=I(r,i,a);return t?s(o):s}function K(e,t,n={}){const o=e.get();let r=null,i=o,a;const s=typeof o=="string"?o.replace(/[\d.-]/g,""):void 0,c=()=>{r&&(r.stop(),r=null),e.animation=void 0},d=()=>{const l=b(e.get()),f=b(i);if(l===f){c();return}const y=r?r.getGeneratorVelocity():e.getVelocity();c(),r=new M({keyframes:[l,f],velocity:y,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:a})},m=()=>{d(),e.animation=r??void 0,e.events.animationStart?.notify(),r?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((l,f)=>{i=l,a=y=>f(x(y,s)),S.postRender(m)},c),w(t)){let l=n.skipInitialAnimation===!0;const f=t.on("change",A=>{l?(l=!1,e.jump(x(A,s),!1)):e.set(x(A,s))}),y=e.on("destroy",f);return()=>{f(),y()}}return c}function x(e,t){return t?e+t:e}function b(e){return typeof e=="number"?e:parseFloat(e)}function k(e){const t=h(()=>N(e)),{isStatic:n}=u.useContext(V);if(n){const[,o]=u.useState(e);u.useEffect(()=>t.on("change",o),[])}return t}function E(e,t){const n=k(t()),o=()=>n.set(t());return o(),G(()=>{const r=()=>S.preRender(o,!1,!0),i=e.map(a=>a.on("change",r));return()=>{i.forEach(a=>a()),H(o)}}),n}function T(e){g.current=[],e();const t=E(g.current,e);return g.current=void 0,t}function L(e,t,n,o){if(typeof e=="function")return T(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!="function")return z(e,t,n,o);const a=typeof t=="function"?t:D(t,n,o),s=Array.isArray(e)?j(e,a):j([e],([d])=>a(d)),c=Array.isArray(e)?void 0:e.accelerate;return c&&!c.isTransformed&&typeof t!="function"&&Array.isArray(n)&&o?.clamp!==!1&&(s.accelerate={...c,times:t,keyframes:n,isTransformed:!0}),s}function j(e,t){const n=h(()=>[]);return E(e,()=>{n.length=0;const o=e.length;for(let r=0;r<o;r++)n[r]=e[r].get();return t(n)})}function z(e,t,n,o){const r=h(()=>Object.keys(n)),i=h(()=>({}));for(const a of r)i[a]=L(e,t,n[a],o);return i}function J(e,t={}){const{isStatic:n}=u.useContext(V),o=()=>w(e)?e.get():e;if(n)return L(o);const r=k(o());return u.useInsertionEffect(()=>K(r,e,t),[r,JSON.stringify(t)]),r}function _(e,t={}){return J(e,{type:"spring",...t})}function U(e){const t=[...e];for(let n=t.length-1;n>0;n--){const o=Math.floor(Math.random()*(n+1));[t[n],t[o]]=[t[o],t[n]]}return t}function $(e,t){const n=U(e),o=Array.from({length:t},()=>[]);n.forEach((i,a)=>{o[a%t].push(i)});const r=Math.max(...o.map(i=>i.length));return o.forEach(i=>{for(;i.length<r;)i.push(n[Math.floor(Math.random()*n.length)])}),o}const B=F.memo(function({logos:t,index:n,currentTime:o,onHoverChange:r}){const[i,a]=u.useState(!1),s=4e3,c=n*400,d=(o+c)%(s*t.length),m=Math.floor(d/s),l=t[m],f=y=>{a(y),r(y)};return p.jsxs("div",{className:"relative flex flex-col items-center",onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[p.jsx(v.div,{className:"relative h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 overflow-hidden",initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{delay:n*.1,duration:.5,ease:"easeOut"},children:p.jsx(C,{mode:"wait",children:p.jsx(v.div,{className:"absolute inset-0 flex items-center justify-center",initial:{y:"18%",opacity:0,filter:"blur(4px)"},animate:{y:"0%",opacity:1,filter:"blur(0px)",transition:{type:"tween",ease:[.22,1,.36,1],duration:.9}},exit:{y:"-18%",opacity:0,filter:"blur(4px)",transition:{type:"tween",ease:[.4,0,1,1],duration:.55}},children:p.jsx(P,{provider:l.provider,size:24,className:"object-contain"})},`${l.id}-${m}`)})}),p.jsx(C,{children:i&&p.jsx(v.span,{className:"pointer-events-none absolute -bottom-7 z-10 whitespace-nowrap rounded bg-oai-gray-800 px-2 py-0.5 text-xs font-medium text-oai-gray-100 shadow-lg ring-1 ring-oai-gray-700",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.name})})]})});function q({logos:e,columnCount:t=2}){const[n,o]=u.useState([]),[r,i]=u.useState(0),[a,s]=u.useState(!1);u.useEffect(()=>{o($(e,t))},[e,t]),u.useEffect(()=>{if(a)return;const d=setInterval(()=>i(m=>m+100),100);return()=>clearInterval(d)},[a]);const c=u.useCallback(d=>{s(d)},[]);return p.jsx("div",{className:"flex gap-2.5 sm:gap-4 text-oai-gray-200",children:n.map((d,m)=>p.jsx(B,{logos:d,index:m,currentTime:r,onHoverChange:c},m))})}const Q=[{id:1,name:"Claude Code",provider:"claude"},{id:2,name:"Codex",provider:"codex"},{id:3,name:"Cursor",provider:"cursor"},{id:4,name:"Gemini",provider:"gemini"},{id:5,name:"OpenCode",provider:"opencode"},{id:6,name:"OpenClaw",provider:"openclaw"},{id:7,name:"Antigravity",provider:"antigravity"},{id:8,name:"Kiro",provider:"kiro"},{id:9,name:"Hermes",provider:"hermes"},{id:10,name:"GitHub Copilot",provider:"copilot"},{id:11,name:"Kimi",provider:"kimi"},{id:12,name:"oh-my-pi",provider:"omp"},{id:13,name:"Pi",provider:"pi"},{id:14,name:"CodeBuddy",provider:"codebuddy"},{id:15,name:"Grok",provider:"grok"},{id:16,name:"Kilo",provider:"kilo-cli"},{id:17,name:"Craft",provider:"craft"},{id:18,name:"Droid",provider:"droid"},{id:19,name:"GitHub",provider:"github"}];export{Q as A,q as L,_ as a,L as b,k as u};
|