tokentracker-cli 0.81.1 → 0.81.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/AchievementBadge-DiSoAalB.js +1 -0
- package/dashboard/dist/assets/AchievementsPage-DI_cvzqy.js +2 -0
- package/dashboard/dist/assets/AchievementsSection-ClWZZNvc.js +1 -0
- package/dashboard/dist/assets/BadgeDetailModal-DpQeG_6H.js +1 -0
- package/dashboard/dist/assets/Card-B0hyofoy.js +1 -0
- package/dashboard/dist/assets/ClawdAnimated-DZJGQ3-9.js +1 -0
- package/dashboard/dist/assets/CommunityStatsModal-Dcikt0kT.js +1 -0
- package/dashboard/dist/assets/ConfirmModal-DCfRP4oI.js +1 -0
- package/dashboard/dist/assets/DashboardPage-DBajsWEp.js +1 -0
- package/dashboard/dist/assets/DevicePage-De6KuFaJ.js +1 -0
- package/dashboard/dist/assets/DialogDescription-uQ4gVIv9.js +1 -0
- package/dashboard/dist/assets/DialogTitle-BvElfi0r.js +1 -0
- package/dashboard/dist/assets/FadeIn-DZoN7vbQ.js +1 -0
- package/dashboard/dist/assets/HeaderGithubStar-C9HQnEsI.js +1 -0
- package/dashboard/dist/assets/{IpCheckPage-D8U_ErpB.js → IpCheckPage-82zniXwO.js} +3 -3
- package/dashboard/dist/assets/{LandingPage-DvMlMt0Y.js → LandingPage-Df9fdR0n.js} +168 -168
- package/dashboard/dist/assets/LeaderboardAvatar-CjfEgoR8.js +1 -0
- package/dashboard/dist/assets/LeaderboardPage-BdbE6Nhj.js +2 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-D7wJoq6T.js → LeaderboardProfileModal-CDTK21dp.js} +4 -4
- package/dashboard/dist/assets/{LeaderboardProfilePage-CaoRbm0R.js → LeaderboardProfilePage-B6QWnwB1.js} +3 -3
- package/dashboard/dist/assets/{LimitsPage-CISoKV5U.js → LimitsPage-f0L0d15j.js} +4 -4
- package/dashboard/dist/assets/LocalOnlyNotice-DOcSDrOy.js +1 -0
- package/dashboard/dist/assets/LoginPage-WY_sRA7I.js +1 -0
- package/dashboard/dist/assets/PetPage-CNbgNE6f.js +1 -0
- package/dashboard/dist/assets/PopoverPopup-Cv525-dF.js +1 -0
- package/dashboard/dist/assets/ResetPasswordPage-vrcj6bBP.js +1 -0
- package/dashboard/dist/assets/Select-3HkgkO8y.js +1 -0
- package/dashboard/dist/assets/SelectItemText-Bz8FAKEv.js +1 -0
- package/dashboard/dist/assets/SettingsPage-CVldAt69.js +1 -0
- package/dashboard/dist/assets/SkillsPage-Dnz3eGcE.js +1 -0
- package/dashboard/dist/assets/TrendMonitor-OopQ06B8.js +19 -0
- package/dashboard/dist/assets/WidgetsPage-4dWjZkc9.js +1 -0
- package/dashboard/dist/assets/WrappedPage-Dbd-8EKD.js +1 -0
- package/dashboard/dist/assets/__vite-browser-external-CQxW1DuO.css +1 -0
- package/dashboard/dist/assets/__vite-browser-external-CxN2E6q5.js +1312 -0
- package/dashboard/dist/assets/agent-logos-CT9fumzx.js +1 -0
- package/dashboard/dist/assets/arrow-up-right-CGnVz9Km.js +1 -0
- package/dashboard/dist/assets/check-CkI3WNti.js +1 -0
- package/dashboard/dist/assets/copy-Bh3g2_O-.js +1 -0
- package/dashboard/dist/assets/download-BITw7nKX.js +1 -0
- package/dashboard/dist/assets/flame-ByAsnNar.js +1 -0
- package/dashboard/dist/assets/format-tokens-Cu8JtuN4.js +1 -0
- package/dashboard/dist/assets/icons-D9OB0N43.js +1 -0
- package/dashboard/dist/assets/index-lKnLA6Pd.js +1 -0
- package/dashboard/dist/assets/info-Mu2CLf-A.js +1 -0
- package/dashboard/dist/assets/link-2-CSlVaUw9.js +1 -0
- package/dashboard/dist/assets/loader-circle-CYck0YaS.js +1 -0
- package/dashboard/dist/assets/provider-display-BB925tPa.js +42 -0
- package/dashboard/dist/assets/terminal-4YysOnTe.js +1 -0
- package/dashboard/dist/assets/trash-2-C8-ZfrZG.js +1 -0
- package/dashboard/dist/assets/use-community-stats-Cxt-otko.js +1 -0
- package/dashboard/dist/assets/use-limits-display-prefs-BUFZh6fe.js +1 -0
- package/dashboard/dist/assets/use-native-settings-DbdPXxGf.js +1 -0
- package/dashboard/dist/assets/{use-ordered-list-tsAK5WdF.js → use-ordered-list-BZMM-iIj.js} +2 -2
- package/dashboard/dist/assets/use-quality-per-dollar-pref-DXoW5A0_.js +1 -0
- package/dashboard/dist/assets/use-transform-CuAoUb8H.js +1 -0
- package/dashboard/dist/assets/use-usage-limits-BEc3QMzR.js +1 -0
- package/dashboard/dist/assets/useCurrency-CpDnFC0N.js +1 -0
- package/dashboard/dist/assets/useScrollLock-Vyaif-7C.js +1 -0
- package/dashboard/dist/assets/useTokenFormat-B8FrUarf.js +1 -0
- package/dashboard/dist/assets/zap-CdeKJ6HL.js +1 -0
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/commands/serve.js +8 -6
- package/src/commands/status.js +2 -1
- package/src/commands/sync.js +164 -36
- package/src/lib/codex-context-breakdown.js +330 -13
- package/src/lib/codex-rollout-parser.js +323 -42
- package/src/lib/cursor-store.js +1289 -0
- package/src/lib/diagnostics.js +8 -5
- package/src/lib/fs.js +254 -16
- package/src/lib/local-api.js +106 -17
- package/src/lib/pricing/index.js +8 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +101 -9
- package/dashboard/dist/assets/AchievementBadge-BG8jz7kf.js +0 -1
- package/dashboard/dist/assets/AchievementsPage-5eZoZuBP.js +0 -2
- package/dashboard/dist/assets/AchievementsSection-D1L0n5dW.js +0 -1
- package/dashboard/dist/assets/BadgeDetailModal-DnWynqkQ.js +0 -1
- package/dashboard/dist/assets/Card-D3wpfjPY.js +0 -1
- package/dashboard/dist/assets/ClawdAnimated-DM4Zk0dj.js +0 -1
- package/dashboard/dist/assets/CommunityStatsModal-SNuY04My.js +0 -1
- package/dashboard/dist/assets/ConfirmModal-vtQ703he.js +0 -1
- package/dashboard/dist/assets/DashboardPage-n9xIhbao.js +0 -19
- package/dashboard/dist/assets/DevicePage-SbHY_IZQ.js +0 -1
- package/dashboard/dist/assets/DialogClose-jLP6FGOS.js +0 -1
- package/dashboard/dist/assets/DialogDescription-CBAD9mhU.js +0 -1
- package/dashboard/dist/assets/DialogTitle-CncrNfWQ.js +0 -1
- package/dashboard/dist/assets/FadeIn-CeyJeLgE.js +0 -1
- package/dashboard/dist/assets/HeaderGithubStar-C0Ko2C_q.js +0 -1
- package/dashboard/dist/assets/LeaderboardAvatar-YS5yUtNB.js +0 -1
- package/dashboard/dist/assets/LeaderboardPage-CXOdPhKR.js +0 -2
- package/dashboard/dist/assets/LocalOnlyNotice-BGb5nxvI.js +0 -1
- package/dashboard/dist/assets/LoginPage-BC24Q2H5.js +0 -1
- package/dashboard/dist/assets/PetPage-CjUo8DTR.js +0 -1
- package/dashboard/dist/assets/PopoverPopup-DRjJKPA5.js +0 -1
- package/dashboard/dist/assets/ResetPasswordPage-Dtz8OVyw.js +0 -1
- package/dashboard/dist/assets/Select-B9zwYuLX.js +0 -1
- package/dashboard/dist/assets/SelectItemText-b_JzEY98.js +0 -1
- package/dashboard/dist/assets/SettingsPage-CrakXNc8.js +0 -1
- package/dashboard/dist/assets/SkillsPage-BlIif4NA.js +0 -1
- package/dashboard/dist/assets/WidgetsPage-Dysme53E.js +0 -1
- package/dashboard/dist/assets/WrappedPage-JBmT-LaQ.js +0 -1
- package/dashboard/dist/assets/agent-logos-BNKW2MIE.js +0 -1
- package/dashboard/dist/assets/arrow-up-right-PH4NSP3s.js +0 -1
- package/dashboard/dist/assets/check-L6Ri7Jhy.js +0 -1
- package/dashboard/dist/assets/copy-CueV0l4l.js +0 -1
- package/dashboard/dist/assets/download-lSXlJCSJ.js +0 -1
- package/dashboard/dist/assets/flame-CcBMYrp5.js +0 -1
- package/dashboard/dist/assets/format-tokens-DRMtC4-0.js +0 -1
- package/dashboard/dist/assets/info-BqxFxUbz.js +0 -1
- package/dashboard/dist/assets/link-2-C4zuILQf.js +0 -1
- package/dashboard/dist/assets/loader-circle-Dpo0YDUR.js +0 -1
- package/dashboard/dist/assets/main-BWZerfnA.js +0 -1259
- package/dashboard/dist/assets/main-DAc77vwF.css +0 -1
- package/dashboard/dist/assets/provider-display-BjS_adaL.js +0 -42
- package/dashboard/dist/assets/trash-2-CZnYyUQP.js +0 -1
- package/dashboard/dist/assets/use-community-stats-wwvoR12y.js +0 -1
- package/dashboard/dist/assets/use-limits-display-prefs-DApaGdPK.js +0 -1
- package/dashboard/dist/assets/use-native-settings-CkVFIVP7.js +0 -1
- package/dashboard/dist/assets/use-quality-per-dollar-pref-DIfKElOT.js +0 -1
- package/dashboard/dist/assets/use-transform-DJ-MPoVW.js +0 -1
- package/dashboard/dist/assets/use-usage-limits-BSPE34_r.js +0 -1
- package/dashboard/dist/assets/useCurrency-Bki92NFg.js +0 -1
- package/dashboard/dist/assets/useScrollLock-COzT3wAx.js +0 -1
- package/dashboard/dist/assets/useTokenFormat-CenqWIl3.js +0 -1
- package/dashboard/dist/assets/zap-Bik_NmJq.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as ka,a6 as ko,bW as jn,cK as wo,r as c,a3 as _o,j as e,L as vo,t as Nn,v as _e,cL as jo,A as lt,ar as Bt,cM as Ie,cN as No,cO as So,ad as Ir,cP as ca,cQ as Sn,cR as Cn,cS as mr,cT as Co,cU as To,cV as Ao,cW as hr,cX as zt,cY as Do,cZ as Lo,c_ as re,c as d,R as kt,X as gr,aw as wa,ae as _a,k as Ye,q as Tn,c$ as Mo,bb as pa,P as jt,b as _t,d0 as Eo,z as An,x as Dn,F as fr,V as Ro,B as Io,ag as Fo,W as $o,f as Ln,ca as Po,d1 as zo,h as Fr,d2 as Bo,M as $r,_ as Oo,d3 as Pr,g as Uo,aQ as Ho,cJ as Vo,d4 as Wo,d5 as Ko,d6 as Go,d7 as qo,d8 as Yo,d9 as Zo,da as Jo,p as Qo,db as Xo,dc as zr,m as Va,af as Br,dd as ei}from"./__vite-browser-external-CxN2E6q5.js";import{a as Or,u as ti,C as ai,b as ri,c as Ur,D as ni,S as si,v as oi,s as ii,K as li,P as ci}from"./use-ordered-list-BZMM-iIj.js";import{u as Ot,D as di,T as Mn,g as ui,f as Hr,a as mi,b as hi,c as gi}from"./TrendMonitor-OopQ06B8.js";import{u as fi}from"./use-usage-limits-BEc3QMzR.js";import{u as va}from"./useCurrency-CpDnFC0N.js";import{u as ze}from"./useTokenFormat-B8FrUarf.js";import{f as wt,A as xi}from"./provider-display-BB925tPa.js";import{D as pi,a as yi,b as bi,c as ki,d as wi,e as _i}from"./DialogTitle-BvElfi0r.js";import{C as Re}from"./Card-B0hyofoy.js";import{S as En}from"./Select-3HkgkO8y.js";import{a as Rn,u as In}from"./use-transform-CuAoUb8H.js";import{I as Fn}from"./info-Mu2CLf-A.js";import{C as vi,P as ji,a as Ni,b as Si,c as Ci,d as Ti}from"./PopoverPopup-Cv525-dF.js";import{L as Ai}from"./loader-circle-CYck0YaS.js";import{F as at}from"./FadeIn-DZoN7vbQ.js";import{C as Di}from"./ClawdAnimated-DZJGQ3-9.js";import{u as Li,P as Mi}from"./use-quality-per-dollar-pref-DXoW5A0_.js";import{L as Ei,A as Ri}from"./agent-logos-CT9fumzx.js";import{C as Ii}from"./check-CkI3WNti.js";import"./terminal-4YysOnTe.js";import"./useScrollLock-Vyaif-7C.js";import"./SelectItemText-Bz8FAKEv.js";const Fi=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],$i=ka("git-branch",Fi);const Pi=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],zi=ka("laptop",Pi);const Bi=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],$n=ka("monitor-smartphone",Bi);const Oi=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],Ui=ka("square-arrow-out-up-right",Oi);function Hi(t,a,r={}){const n=t.get();let s=null,o=n,i;const u=typeof n=="string"?n.replace(/[\d.-]/g,""):void 0,l=()=>{s&&(s.stop(),s=null),t.animation=void 0},g=()=>{const f=Vr(t.get()),m=Vr(o);if(f===m){l();return}const x=s?s.getGeneratorVelocity():t.getVelocity();l(),s=new wo({keyframes:[f,m],velocity:x,type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:i})},h=()=>{g(),t.animation=s??void 0,t.events.animationStart?.notify(),s?.then(()=>{t.animation=void 0,t.events.animationComplete?.notify()})};if(t.attach((f,m)=>{o=f,i=x=>m(Wa(x,u)),ko.postRender(h)},l),jn(a)){let f=r.skipInitialAnimation===!0;const m=a.on("change",p=>{f?(f=!1,t.jump(Wa(p,u),!1)):t.set(Wa(p,u))}),x=t.on("destroy",m);return()=>{m(),x()}}return l}function Wa(t,a){return a?t+a:t}function Vr(t){return typeof t=="number"?t:parseFloat(t)}function Vi(t,a={}){const{isStatic:r}=c.useContext(_o),n=()=>jn(t)?t.get():t;if(r)return Rn(n);const s=In(n());return c.useInsertionEffect(()=>Hi(s,t,a),[s,JSON.stringify(a)]),s}function Wi(t,a={}){return Vi(t,{type:"spring",...a})}function Ki(){return e.jsxs(vo,{to:"/landing",className:"flex items-center gap-2.5 no-underline hover:opacity-80 transition-opacity",children:[e.jsx("img",{src:"/app-icon.png",alt:"Token Tracker",width:28,height:28,className:"rounded-md"}),e.jsx("span",{className:"text-base font-semibold text-oai-black dark:text-oai-white leading-tight",children:"Token Tracker"})]})}function Gi({children:t,header:a,footer:r,className:n="",hideHeader:s=!1,hideFooter:o=!1,bare:i=!1}){return i?e.jsxs("div",{className:`flex flex-col flex-1 min-h-0 ${n}`,children:[e.jsx("main",{className:"flex-1 px-6 py-6",children:t}),!o&&r&&e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:r})]}):e.jsxs("div",{className:`min-h-screen bg-oai-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-sans flex flex-col transition-colors duration-200 ${n}`,children:[!s&&e.jsxs("header",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 flex items-center justify-between transition-colors duration-200",children:[e.jsx(Ki,{}),e.jsx("div",{className:"flex-1 flex justify-center",children:a})]}),e.jsx("main",{className:"flex-1 px-6 py-6",children:t}),!o&&r&&e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:r})]})}function qi({children:t,variant:a="info",size:r="md",className:n=""}){const s="inline-flex items-center font-medium",o={success:"bg-oai-brand-100 dark:bg-oai-brand-900/30 text-oai-brand-700 dark:text-oai-brand-400 rounded-full",warning:"bg-oai-amber-50 dark:bg-oai-amber-900/30 text-oai-amber-dark dark:text-oai-amber-400 rounded-full",error:"bg-red-50 dark:bg-red-900/30 text-red-600 dark:text-red-400 rounded-full",info:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 rounded-full",secondary:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-500 dark:text-oai-gray-300 rounded-md"},i={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm"},u=`${s} ${o[a]} ${i[r]} ${n}`.trim();return e.jsx("span",{className:u,children:t})}var Yi={};function Zi(t,a){return t==="."?{width:"0.34ch",justifyContent:"center",marginInline:"-0.04ch"}:t===","?{width:"0.08ch",justifyContent:"center",marginInline:"-0.30ch"}:{width:"0.72ch",justifyContent:"flex-start",paddingLeft:"0.04ch",height:a}}function Ji({mv:t,digit:a,height:r}){const n=Rn(t,s=>{const o=(s%10+10)%10,i=(10+a-o)%10;let u=i*r;return i>5&&(u-=10*r),u});return e.jsx(_e.span,{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",y:n},children:a})}function Qi(t){const a=Math.round(t),r=1e-9*Math.max(1,Math.abs(t));return Math.abs(t-a)<r?a:t}function Xi(t,a){const r=t/a;return Math.floor(Qi(r))}function el(t){const a=String(t??""),r=Array.from(a),n=r.indexOf(".");let s=r.filter((u,l)=>/\d/.test(u)&&(n===-1||l<n)).length,o=0,i=!1;return r.map(u=>{if(!/\d/.test(u))return u==="."&&(i=!0),u;if(!i){const l=10**Math.max(s-1,0);return s-=1,l}return o+=1,10**-o})}function tl({place:t,value:a,height:r,digitStyle:n,shouldReduceMotion:s}){if(typeof t!="number"){const l=Zi(t,r),g=t!=="."&&t!==",",h=t===".";return e.jsx("span",{"data-counter-token":"static",className:"relative inline-flex items-center justify-center",style:{height:r,...l,...n,...g?{width:"auto",paddingInline:"0.06ch",justifyContent:"center"}:null,...h?{width:l.width}:null},children:t})}const o=Xi(a,t),i=In(0),u=Wi(i,{stiffness:220,damping:26,mass:.8});return c.useEffect(()=>{i.set(o)},[i,o]),s?e.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex items-center justify-center overflow-hidden",style:{height:r,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...n},children:Math.abs(o)%10}):e.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex overflow-hidden",style:{height:r,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...n},children:Array.from({length:10},(l,g)=>e.jsx(Ji,{mv:u,digit:g,height:r},g))})}function al({value:t,displayValue:a,fontSize:r=72,padding:n=0,places:s,gap:o=6,borderRadius:i=4,horizontalPadding:u=0,textColor:l="inherit",fontWeight:g="inherit",containerStyle:h,counterStyle:f,digitStyle:m,gradientHeight:x=14,gradientFrom:p="rgba(255,255,255,0.95)",gradientTo:w="rgba(255,255,255,0)",topGradientStyle:b,bottomGradientStyle:v}){const _=String(a??t??""),D=c.useMemo(()=>Array.isArray(s)&&s.length?s:el(_),[s,_]),T=typeof navigator<"u"&&/jsdom/i.test(navigator.userAgent||"")||typeof process<"u"&&Yi?.VITEST==="true",M=Nn()||T,L=Number.isFinite(Number(t))?Math.abs(Number(t)):0,O=r+n;return M?e.jsx("span",{"data-counter-root":"true",style:{display:"inline-flex",alignItems:"center",color:l,fontSize:r,fontWeight:g,lineHeight:1,...h,...f},children:_}):e.jsxs("span",{"data-counter-root":"true",style:{position:"relative",display:"inline-block",...h},children:[e.jsx("span",{style:{fontSize:r,display:"flex",gap:o,overflow:"hidden",borderRadius:i,paddingLeft:u,paddingRight:u,lineHeight:1,color:l,fontWeight:g,...f},children:D.map((k,j)=>e.jsx(tl,{place:k,value:L,height:O,digitStyle:m,shouldReduceMotion:M},`${String(k)}-${j}`))}),e.jsxs("span",{style:{pointerEvents:"none",position:"absolute",inset:0,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[e.jsx("span",{style:b??{height:x,background:`linear-gradient(to bottom, ${p}, ${w})`}}),e.jsx("span",{style:v??{height:x,background:`linear-gradient(to top, ${p}, ${w})`}})]})]})}function rl({baseUrl:t,accessToken:a,guestAllowed:r=!1,weeks:n=52,weekStartsOn:s="sun",cacheKey:o,timeZone:i,tzOffsetMinutes:u,now:l,accountView:g=!1,accountAccessToken:h=null,accountRevision:f=0,accountViewResolving:m=!1,deviceId:x=null}={}){const p=!!(g&&h),w=p?"cloud":"local",b=c.useMemo(()=>jo({weeks:n,weekStartsOn:s,now:l}),[l,n,s]),[v,_]=c.useState([]),[D,T]=c.useState(null),[M,L]=c.useState("edge"),[O,k]=c.useState(!1),[j,A]=c.useState(null),P=lt(),U=Bt(a),W=!r,E=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),R=c.useMemo(()=>{if(!o)return null;const J=mr({timeZone:i,offsetMinutes:u});return`tokentracker.heatmap.${o}.${w}.${n}.${s}.${J}.${x||"all"}`},[o,x,w,i,u,n,s]),q=c.useCallback(()=>{if(!R||typeof window>"u")return null;try{const J=window.localStorage.getItem(R);if(!J)return null;const ce=JSON.parse(J);return!ce||!ce.heatmap?null:ce}catch{return null}},[R]),N=c.useCallback(J=>{if(!(!R||typeof window>"u"))try{window.localStorage.setItem(R,JSON.stringify(J))}catch{}},[R]),S=c.useCallback(()=>{if(!(!R||typeof window>"u"))try{window.localStorage.removeItem(R)}catch{}},[R]),Y=c.useRef(w);c.useEffect(()=>{Y.current!==w&&(Y.current=w,_([]),T(null),L("edge"),A(null),k(!0))},[w]);const H=c.useCallback(async()=>{const J=await Ie(a),ce=p?await Ie(h):null;if(!J&&!P&&!E&&!p)return;if(p&&!ce){A("Your session expired. Please sign in again to view account data."),k(!1);return}const oe=p?ce:J,he=p?No:So,ye=p?Sn:Cn;k(!0),A(null);try{try{const z=await he({baseUrl:t,accessToken:oe,weeks:n,to:b.to,weekStartsOn:s,device:x,timeZone:i,tzOffsetMinutes:u}),X=Array.isArray(z?.weeks)?z.weeks:[];if(!X.length&&W){const V=q();if(V?.heatmap){T(V.heatmap),_(V.daily||[]),L("cache");return}}if(!X.some(V=>(Array.isArray(V)?V:[]).some(C=>C&&Number.isFinite(Number(C.level))))&&X.length){const V=[];for(const B of X)for(const F of Array.isArray(B)?B:[])F?.day&&V.push({day:F.day,total_tokens:F.total_tokens??F.value??0,billable_total_tokens:F.billable_total_tokens??F.value??F.total_tokens??0});const C=Ir({dailyRows:V,weeks:n,to:z?.to||b.to,weekStartsOn:s});_(V),T({...C,week_starts_on:s,active_days:V.filter(B=>Number(B?.billable_total_tokens??B?.total_tokens)>0).length,streak_days:ca({dailyRows:V,to:z?.to||b.to})}),L("client"),W?N({heatmap:{...C,week_starts_on:s,active_days:V.filter(B=>Number(B?.billable_total_tokens??B?.total_tokens)>0).length,streak_days:ca({dailyRows:V,to:z?.to||b.to})},daily:V,fetchedAt:new Date().toISOString()}):S();return}T(z||null),_([]),L("edge"),z&&W?N({heatmap:z,daily:[],fetchedAt:new Date().toISOString()}):W||S();return}catch(z){const X=z,ge=X?.status??X?.statusCode;if(ge===401||ge===403)throw z}const de=await ye({baseUrl:t,accessToken:oe,from:b.from,to:b.to,device:x,timeZone:i,tzOffsetMinutes:u}),ee=Array.isArray(de?.data)?de.data:[];_(ee);const Q=Ir({dailyRows:ee,weeks:n,to:b.to,weekStartsOn:s});T({...Q,week_starts_on:s,active_days:ee.filter(z=>Number(z?.billable_total_tokens??z?.total_tokens)>0).length,streak_days:ca({dailyRows:ee,to:b.to})}),L("client"),W?N({heatmap:{...Q,week_starts_on:s,active_days:ee.filter(z=>Number(z?.billable_total_tokens??z?.total_tokens)>0).length,streak_days:ca({dailyRows:ee,to:b.to})},daily:ee,fetchedAt:new Date().toISOString()}):S()}catch(de){if(W){const ee=q();if(ee?.heatmap)T(ee.heatmap),_(ee.daily||[]),L("cache"),A(null);else{const Q=de;A(Q?.message||String(Q)),_([]),T(null),L("edge")}}else{const ee=de;A(ee?.message||String(ee)),_([]),T(null),L("edge")}}finally{k(!1)}},[a,t,P,r,W,b.from,b.to,q,U,i,u,s,n,S,N,E,p,h,f,x]);return c.useEffect(()=>{if(m){k(!0);return}if(!U&&!r&&!P&&!E&&!p){_([]),k(!1),A(null),T(null),L("edge");return}if(!W)S(),_([]),A(null),T(null),L("edge");else{const J=q();J?.heatmap&&(T(J.heatmap),_(J.daily||[]),L("cache"))}H()},[a,P,q,H,U,r,W,S,E,m]),{range:b,daily:v,heatmap:D,source:P?"mock":M==="client"?"edge":M,loading:O,error:j,refresh:H}}const nl="tokentracker.dashboard.leftCardOrder.v1",sl="tokentracker.dashboard.rightCardOrder.v1";function ol(t,a){const r=Or(nl,t),n=Or(sl,a),s=r.order.join("|")!==t.join("|")||n.order.join("|")!==a.join("|"),o=c.useCallback(()=>{r.reset(),n.reset()},[r,n]);return{left:r,right:n,isCustomized:s,resetAll:o}}const il=10;function ll({baseUrl:t,accessToken:a,from:r,to:n,source:s,timeZone:o,tzOffsetMinutes:i}={}){const[u,l]=c.useState([]),[g,h]=c.useState(!1),[f,m]=c.useState(null),x=lt(),p=Bt(a),w=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),b=Ot([t,a,r,n,s,o,i]),v=c.useCallback(async()=>{const _=b(),D=await Ie(a);if(_()){if(!D&&!x&&!w){l([]),m(null),h(!1);return}h(!0),m(null);try{const T=await Co({baseUrl:t,accessToken:D,limit:il,from:r,to:n,source:s,timeZone:o,tzOffsetMinutes:i});if(!_())return;l(Array.isArray(T?.entries)?T.entries:[])}catch(T){if(!_())return;const M=T?.message||String(T);m(M),l([])}finally{_()&&h(!1)}}},[a,t,r,x,s,o,n,i,w,b]);return c.useEffect(()=>{if(!p&&!x&&!w){l([]),m(null),h(!1);return}l([]),m(null),h(!0),v()},[x,v,p,w]),{entries:u,loading:g,error:f,refresh:v}}function Wr({baseUrl:t,accessToken:a,guestAllowed:r=!1,from:n,to:s,includeDaily:o=!0,includeSummary:i=!0,cacheKey:u,timeZone:l,tzOffsetMinutes:g,now:h,accountView:f=!1,accountAccessToken:m=null,accountRevision:x=0,accountViewResolving:p=!1,deviceId:w=null}={}){const b=!!(f&&m),v=b?"cloud":"local",[_,D]=c.useState([]),[T,M]=c.useState(null),[L,O]=c.useState(null),[k,j]=c.useState("edge"),[A,P]=c.useState(null),[U,W]=c.useState(!1),[E,R]=c.useState(null),q=lt(),N=Bt(a),S=!r&&!q,Y=w||"all",H=(()=>{if(!u)return null;const Q=cl(t)||"default",z=o?i?"daily-summary":"daily-only":"summary",X=mr({timeZone:l,offsetMinutes:g});return`tokentracker.usage.${u}.${v}.${Q}.${n}.${s}.${z}.${X}.${Y}`})(),le=c.useRef(v);c.useEffect(()=>{le.current!==v&&(le.current=v,D([]),M(null),O(null),j("edge"),P(null),R(null),W(!0))},[v]);const J=c.useCallback(()=>{if(!H||typeof window>"u")return null;try{const Q=window.localStorage.getItem(H);if(!Q)return null;const z=JSON.parse(Q),X=i?!!z?.summary:Array.isArray(z?.daily);return!z||!X?null:z}catch{return null}},[i,H]),ce=c.useCallback(Q=>{if(!(!H||typeof window>"u"))try{window.localStorage.setItem(H,JSON.stringify(Q))}catch{}},[H]),oe=c.useCallback(()=>{if(!(!H||typeof window>"u"))try{window.localStorage.removeItem(H)}catch{}},[H]),he=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),ye=Ot([t,n,s,o,i,v,a,m,x,w,l,g]),de=c.useCallback(async()=>{const Q=ye(),z=await Ie(a),X=b?await Ie(m):null;if(!Q()||!z&&!q&&!he&&!b)return;if(b&&!X){R("Your session expired. Please sign in again to view account data."),W(!1);return}const ge=b?Sn:Cn,V=b?To:Ao,C=b?X:z;W(!0),R(null);try{let B=null,F=null;if(o)if(i){const[De,Ne]=await Promise.allSettled([ge({baseUrl:t,accessToken:C,from:n,to:s,device:w,timeZone:l,tzOffsetMinutes:g}),V({baseUrl:t,accessToken:C,from:n,to:s,device:w,timeZone:l,tzOffsetMinutes:g,rolling:!0})]);if(De.status==="rejected")throw De.reason;B=De.value,F=Ne.status==="fulfilled"?Ne.value:null}else B=await ge({baseUrl:t,accessToken:C,from:n,to:s,device:w,timeZone:l,tzOffsetMinutes:g});else i&&(F=await V({baseUrl:t,accessToken:C,from:n,to:s,device:w,timeZone:l,tzOffsetMinutes:g,rolling:!0}));let K=o&&Array.isArray(B?.data)?B.data:[];o&&(K=Ga(K,n,s,{timeZone:l,offsetMinutes:g,now:h}));let ne=i&&(F?.totals||B?.summary?.totals)||null,we=i&&(F?.rolling||B?.summary?.rolling)||null;if(i&&o&&!ne&&!F)try{const De=await V({baseUrl:t,accessToken:C,from:n,to:s,device:w,timeZone:l,tzOffsetMinutes:g,rolling:!0});ne=De?.totals||null,we=De?.rolling||we}catch{}const ve=new Date().toISOString();if(!Q())return;D(K),M(ne),O(we),j("edge"),P(ve),(ne||!i&&o)&&S?ce({summary:ne,rolling:we,daily:K,from:n,to:s,includeDaily:o,includeSummary:i,fetchedAt:ve}):S||oe()}catch(B){if(!Q())return;if(S){const F=J();if(F?.summary||!i&&Array.isArray(F?.daily)){M(F.summary),O(F.rolling||null);const K=Array.isArray(F.daily)?F.daily:[],ne=o?Ga(K,F.from||n,F.to||s,{timeZone:l,offsetMinutes:g,now:h}):K;D(ne),j("cache"),P(F.fetchedAt||null),R(null)}else{const K=B;R(K?.message||String(K)),D([]),M(null),O(null),j("edge"),P(null)}}else{const F=B;R(F?.message||String(F)),D([]),M(null),O(null),j("edge"),P(null)}}finally{Q()&&W(!1)}},[a,t,n,o,i,q,r,S,h,J,N,l,s,g,oe,ce,he,b,m,x,w,ye]);return c.useEffect(()=>{if(p){W(!0);return}const Q=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!N&&!r&&!q&&!Q&&!b){D([]),M(null),O(null),R(null),W(!1),j("edge"),P(null);return}if(!S)oe(),D([]),M(null),O(null),R(null),j("edge"),P(null);else{const z=J();if(z?.summary||!i&&Array.isArray(z?.daily)){M(z.summary),O(z.rolling||null);const X=Array.isArray(z.daily)?z.daily:[],ge=o?Ga(X,z.from||n,z.to||s,{timeZone:l,offsetMinutes:g,now:h}):X;D(ge),j("cache"),P(z.fetchedAt||null),R(null)}else D([]),M(null),O(null),j("edge"),P(null),R(null)}W(!0),de()},[a,q,J,de,N,r,S,oe,he,p,i]),c.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const Q=15e3;let z=Date.now();const X=()=>{if(document.visibilityState!=="visible")return;const ge=Date.now();ge-z<Q||(z=ge,de())};return window.addEventListener("focus",X),document.addEventListener("visibilitychange",X),()=>{window.removeEventListener("focus",X),document.removeEventListener("visibilitychange",X)}},[de]),{daily:_,summary:T,rolling:L,source:q?"mock":k,fetchedAt:A,loading:U,error:E,refresh:de}}function cl(t){try{return new URL(t).host}catch{return null}}function Ka(t){if(!t)return null;const a=String(t).trim(),r=a.split("-");if(r.length!==3)return null;const n=Number(r[0]),s=Number(r[1])-1,o=Number(r[2]);if(!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(n,s,o));return Number.isFinite(i.getTime())&&zt(i)===a?i:null}function dl(t,a){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+a))}function Ga(t,a,r,{timeZone:n,offsetMinutes:s,now:o}={}){const i=Ka(a),u=Ka(r);if(!i||!u||u<i)return Array.isArray(t)?t:[];const l=o instanceof Date&&Number.isFinite(o.getTime())?o:new Date,g=hr({timeZone:n,offsetMinutes:s,date:l}),h=Ka(g),f=h?h.getTime():l.getTime(),m=new Map;for(const p of t||[])p?.day&&m.set(p.day,p);const x=[];for(let p=i;p<=u;p=dl(p,1)){const w=zt(p),b=m.get(w),v=p.getTime()>f;if(b){x.push({...b,missing:!1,future:v});continue}x.push({day:w,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!v,future:v})}return x}function ul({baseUrl:t,accessToken:a,guestAllowed:r=!1,from:n,to:s,cacheKey:o,timeZone:i,tzOffsetMinutes:u,accountView:l=!1,accountAccessToken:g=null,accountRevision:h=0,accountViewResolving:f=!1,deviceId:m=null}={}){const x=!!(l&&g),p=x?"cloud":"local",[w,b]=c.useState(null),[v,_]=c.useState("edge"),[D,T]=c.useState(!1),[M,L]=c.useState(null),O=lt(),k=Bt(a),j=!r,A=c.useMemo(()=>{if(!o)return null;const Y=ml(t)||"default",H=mr({timeZone:i,offsetMinutes:u});return`tokentracker.modelBreakdown.${o}.${p}.${Y}.${n}.${s}.${H}.${m||"all"}`},[t,o,m,n,p,i,s,u]),P=c.useCallback(()=>{if(!A||typeof window>"u")return null;try{const Y=window.localStorage.getItem(A);if(!Y)return null;const H=JSON.parse(Y);return!H||!H.breakdown?null:H}catch{return null}},[A]),U=c.useCallback(Y=>{if(!(!A||typeof window>"u"))try{window.localStorage.setItem(A,JSON.stringify(Y))}catch{}},[A]),W=c.useCallback(()=>{if(!(!A||typeof window>"u"))try{window.localStorage.removeItem(A)}catch{}},[A]),E=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),R=Ot([t,n,s,p,a,g,h,m,i,u]),q=c.useRef(p);c.useEffect(()=>{q.current!==p&&(q.current=p,b(null),_("edge"),L(null),T(!0))},[p]);const N=c.useCallback(async()=>{const Y=R(),H=await Ie(a),le=x?await Ie(g):null;if(!Y()||!H&&!O&&!E&&!x)return;if(x&&!le){L("Your session expired. Please sign in again to view account data."),T(!1);return}const J=x?le:H,ce=x?Do:Lo;T(!0),L(null);try{const oe=await ce({baseUrl:t,accessToken:J,from:n,to:s,device:m,timeZone:i,tzOffsetMinutes:u});if(!Y())return;b(oe||null),_("edge"),oe&&j?U({breakdown:oe,fetchedAt:new Date().toISOString()}):j||W()}catch(oe){if(!Y())return;if(j){const he=P();if(he?.breakdown)b(he.breakdown),_("cache"),L(null);else{b(null),_("edge");const ye=oe;L(ye?.message||String(ye))}}else{b(null),_("edge");const he=oe;L(he?.message||String(he))}}finally{Y()&&T(!1)}},[a,t,n,O,r,j,P,i,s,k,u,W,U,E,x,g,h,m,R]);return c.useEffect(()=>{if(f){T(!0);return}if(!k&&!r&&!O&&!E&&!x){b(null),_("edge"),L(null),T(!1);return}if(!j)W(),b(null),_("edge"),L(null);else{const Y=P();Y?.breakdown?(b(Y.breakdown),_("cache"),L(null)):(b(null),_("edge"),L(null))}T(!0),N()},[a,O,P,N,k,r,j,W,E,f]),{breakdown:w,source:O?"mock":v,loading:D,error:M,refresh:N}}function ml(t){try{return new URL(t).host}catch{return null}}const Pn=new Set(["day","hour","month"]);function hl(t){return Pn.has(t)}function Kr(t){if(t==null)return null;const a=String(t).trim();if(!/^[0-9]+$/.test(a))return null;const r=a.replace(/^0+/,"");return r.length===0?"0":r}function gl(t,a){const r=Kr(t),n=Kr(a);if(r&&n)return r.length!==n.length?r.length<n.length?-1:1:r===n?0:r<n?-1:1;const s=re(t),o=re(a);return s==null&&o==null?0:s==null?1:o==null?-1:s===o?0:s<o?-1:1}function fl(t,a){const r=typeof t=="string"?t:String(t||""),n=typeof a=="string"?a:String(a||"");return r===n?0:r<n?-1:1}function xl(t){if(!t)return null;const r=String(t).trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!r)return null;const n=Number(r[1]),s=Number(r[2]),o=Number(r[3]);if(!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(n,s-1,o));return!Number.isFinite(i.getTime())||i.getUTCFullYear()!==n||i.getUTCMonth()+1!==s||i.getUTCDate()!==o?null:i.getTime()}function pl(t){if(!t)return null;const r=String(t).trim().match(/^(\d{4})-(\d{2})$/);if(!r)return null;const n=Number(r[1]),s=Number(r[2]);if(!Number.isFinite(n)||!Number.isFinite(s)||s<1||s>12)return null;const o=new Date(Date.UTC(n,s-1,1));return Number.isFinite(o.getTime())?o.getTime():null}function yl(t){if(!t)return null;const r=String(t).trim().match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?Z?$/);if(!r)return null;const n=Number(r[1]),s=Number(r[2]),o=Number(r[3]),i=Number(r[4]),u=Number(r[5]),l=Number(r[6]||0);if(!Number.isFinite(n)||!Number.isFinite(s)||!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(u)||!Number.isFinite(l)||s<1||s>12||o<1||o>31||i<0||i>23||u<0||u>59||l<0||l>59)return null;const g=new Date(Date.UTC(n,s-1,o,i,u,l));return Number.isFinite(g.getTime())?g.getTime():null}function bl(t,a,r){const n=r==="hour"?yl:r==="month"?pl:xl,s=n(t),o=n(a);return s!=null&&o!=null?s===o?0:s<o?-1:1:fl(t,a)}function zn(t,{key:a,dir:r}){const n=r==="asc"?1:-1,s=Array.isArray(t)?t:[],o=Pn.has(a)?(u,l)=>bl(u,l,a):gl,i=u=>a==="total_tokens"&&u?.billable_total_tokens!=null?u.billable_total_tokens:u?.[a];return s.map((u,l)=>({row:u,index:l})).sort((u,l)=>{const g=i(u.row),h=i(l.row),f=g==null,m=h==null;if(f&&m)return u.index-l.index;if(f)return 1;if(m)return-1;const x=o(g,h);return x!==0?x*n:u.index-l.index}).map(u=>u.row)}function kl(){return[{key:"day",label:d("daily.sort.date.label"),title:d("daily.sort.date.title")},{key:"total_tokens",label:d("daily.sort.total.label"),title:d("daily.sort.total.title")},{key:"input_tokens",label:d("daily.sort.input.label"),title:d("daily.sort.input.title")},{key:"output_tokens",label:d("daily.sort.output.label"),title:d("daily.sort.output.title")},{key:"cached_input_tokens",label:d("daily.sort.cached.label"),title:d("daily.sort.cached.title")},{key:"reasoning_output_tokens",label:d("daily.sort.reasoning.label"),title:d("daily.sort.reasoning.title")},{key:"conversation_count",label:d("daily.sort.conversations.label"),title:d("daily.sort.conversations.title")}]}function Gr(t){const a=hl(t)?t:"day";return kl().map((r,n)=>n===0?{...r,key:a}:r)}function qr(t,{key:a,dir:r}){return zn(t,{key:a,dir:r})}const ya=12,wl=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens"];function _l(t){if(typeof t=="bigint")return t!==0n;if(typeof t=="number")return Number.isFinite(t)&&t!==0;if(t==null)return!1;const a=String(t).trim();if(!a||!/^-?\d+$/.test(a))return!1;const r=a.startsWith("-")?a.slice(1):a;return/[1-9]/.test(r)}function vl(t){return wl.some(a=>_l(t?.[a]))}function jl(t){const a=Array.isArray(t)?t:[];if(!a.length)return[];const r=zn(a,{key:"month",dir:"asc"}),n=r.findIndex(s=>s?.month&&vl(s));return n===-1?a:r.slice(n)}function Nl(t,a,r=ya){const n=Array.isArray(t)?t:[],s=Number.isFinite(r)&&r>0?r:ya,i=(Number.isFinite(a)&&a>=0?Math.floor(a):0)*s;return n.slice(i,i+s)}function Sl({publicMode:t,screenshotMode:a,forceInstall:r,accessEnabled:n,heatmapLoading:s,activeDays:o,hasActiveDeviceToken:i}={}){return t||a?!1:r?!0:n&&!s&&o===0&&!i}const Cl=3e4;function Tl({refresh:t,intervalMs:a=Cl,windowRef:r=window,documentRef:n=document,onError:s=()=>{}}){let o=!1,i=null;const u=()=>{if(o||n.visibilityState!=="visible"||i)return i;const h=Promise.resolve().then(()=>t()).catch(f=>s(f)).then(()=>{}).finally(()=>{i===h&&(i=null)});return i=h,h},l=r.setInterval(()=>{u()},a),g=()=>{n.visibilityState==="visible"&&u()};return r.addEventListener("focus",g),n.addEventListener("visibilitychange",g),{run:u,stop(){o=!0,r.clearInterval(l),r.removeEventListener("focus",g),n.removeEventListener("visibilitychange",g)}}}function Al(t){if(!t)return null;const a=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(!a)return null;const r=new Date(Date.UTC(Number(a[1]),Number(a[2])-1,Number(a[3])));return zt(r)===t?r:null}function Dl({period:t,selectedFrom:a,selectedTo:r,todayKey:n}={}){if(t==="total"&&a&&r)return{from:a,to:r};const s=Al(n)||new Date,o=new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()-29));return{from:zt(o),to:zt(s)}}function Ll(t,{period:a}={}){const r=(Array.isArray(t)?t:[]).filter(s=>!s?.future&&s?.day);return(a==="total"?r.filter(s=>!s?.missing):r).slice(-30)}function Bn(t){if(typeof t!="string")return null;const a=t.trim();return a?a.toLowerCase():null}function Ml(t){const a=Bn(t?.model_id);return a||null}function On(t,a){return t?.model?String(t.model):a}function vt(t,a=0){const r=re(t?.billable_total_tokens),n=re(t?.total_tokens);return r!=null&&r>0?r:n!=null&&n>0?n:r??n??a}function El(t,{copyFn:a}={}){const r=typeof a=="function"?a:i=>i,s=(Array.isArray(t?.sources)?t.sources:[]).map(i=>{const u=vt(i?.totals),l=re(i?.totals?.total_cost_usd)??0;return{source:i?.source,totalTokens:Number.isFinite(u)?u:0,totalCost:Number.isFinite(l)?l:0,inputTokens:Math.max(0,re(i?.totals?.input_tokens)??0),cacheRead:Math.max(0,re(i?.totals?.cached_input_tokens)??0),cacheCreate:Math.max(0,re(i?.totals?.cache_creation_input_tokens)??0),models:Array.isArray(i?.models)?i.models:[]}}).filter(i=>i.totalTokens>0);if(!s.length)return[];const o=s.reduce((i,u)=>i+u.totalTokens,0);return typeof t?.pricing?.pricing_mode=="string"&&t.pricing.pricing_mode.toUpperCase(),s.slice().sort((i,u)=>u.totalTokens-i.totalTokens).map(i=>{const u=i.source?String(i.source).toUpperCase():r("shared.placeholder.short"),l=o>0?i.totalTokens/o*100:0,g=Number.isFinite(l)?l.toFixed(2):"0.00",h=i.models.map(p=>{const w=vt(p?.totals);if(!Number.isFinite(w)||w<=0)return null;const b=i.totalTokens>0?Math.round(w/i.totalTokens*1e3)/10:0,v=On(p,r("shared.placeholder.short")),_=Ml(p),D=re(p?.totals?.total_cost_usd),T=D??(i.totalCost>0&&i.totalTokens>0?w/i.totalTokens*i.totalCost:null);return{id:_,name:v,share:b,usage:w,cost:T}}).filter(Boolean),f=i.inputTokens+i.cacheRead+i.cacheCreate,x=i.cacheRead+i.cacheCreate>0&&f>0?Math.round(i.cacheRead/f*100):null;return{source:i.source,label:u,totalPercent:String(g),totalPercentValue:l,usd:i.totalCost,usage:i.totalTokens,cacheHitRate:x,cacheReusedTokens:i.cacheRead,cacheInputTokens:f,models:h}})}function Rl(t,{limit:a=3,copyFn:r}={}){const n=typeof r=="function"?r:m=>m,s=Array.isArray(t?.sources)?t.sources:[];if(!s.length)return[];const o=new Map,i=new Map,u=new Map;let l=0;for(const m of s){const x=Array.isArray(m?.models)?m.models:[];for(const p of x){const w=vt(p?.totals);if(!Number.isFinite(w)||w<=0)continue;l+=w;const b=On(p,n("shared.placeholder.short")),v=Bn(b);if(!v)continue;o.set(v,(o.get(v)||0)+w);const _=u.get(v)||0;w>=_&&(u.set(v,w),i.set(v,b))}}if(!o.size)return[];const g=Array.from(o.values()).reduce((m,x)=>m+x,0),h=l>0?l:g,f=Number.isFinite(a)?Math.max(0,Math.floor(a)):3;return Array.from(o.entries()).map(([m,x])=>{const p=h>0?(x/h*100).toFixed(1):"0.0";return{id:m,name:i.get(m)||n("shared.placeholder.short"),tokens:x,percent:String(p)}}).sort((m,x)=>x.tokens!==m.tokens?x.tokens-m.tokens:String(m.name).localeCompare(String(x.name))).slice(0,f)}function Il(t,a,r){if(!Number.isFinite(t))return d("shared.placeholder.short");const n=_a(t,{decimals:2,currency:a,rate:r});return n==="-"?d("shared.placeholder.short"):n}function Yr(t,a,r){if(!Number.isFinite(t)||t<=0)return null;const n=wa(a);return(a===Tn?t:t*r)<.01?`<${n}0.01`:_a(t,{decimals:2,currency:a,rate:r})}function Zr(t){const a=Number(t);return!Number.isFinite(a)||a<=0?null:Ye(a,{decimals:1})}const Fl=kt.memo(function({isOpen:a,onClose:r,fleetData:n=[]}){const{currency:s,rate:o}=va(),i=c.useMemo(()=>(Array.isArray(n)?n:[]).map(l=>{const g=re(l?.usd)??0,h=re(l?.usage)??0,f=Array.isArray(l?.models)?l.models:[];return{label:l?.label?String(l.label):"",usdValue:g,costLabel:Yr(g,s,o),tokensLabel:Zr(h),models:f.map(m=>{const x=re(m?.usage)??0,p=re(m?.cost)??0;return{id:m?.id?String(m.id):"",name:m?.name?String(m.name):"",tokensLabel:Zr(x),costLabel:Yr(p,s,o),sortCost:p}}).filter(m=>m.costLabel||m.tokensLabel).sort((m,x)=>x.sortCost-m.sortCost)}}).filter(l=>l.usdValue>0||l.models.length>0).sort((l,g)=>g.usdValue-l.usdValue),[n,s,o]),u=c.useMemo(()=>{const l=i.reduce((g,h)=>g+h.usdValue,0);return Il(l,s,o)},[i,s,o]);return e.jsx(pi,{open:a,onOpenChange:l=>{l||r?.()},children:e.jsxs(yi,{children:[e.jsx(bi,{className:"cost-modal-backdrop","data-cost-analysis-backdrop":"true"}),e.jsx(ki,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(wi,{className:"cost-modal-popup relative w-full max-w-[460px] max-h-[calc(100vh-2rem)] flex flex-col rounded-2xl bg-white dark:bg-oai-gray-950 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden",children:[e.jsx(_i,{render:e.jsx("h2",{className:"sr-only"}),children:d("dashboard.cost_breakdown.title")}),e.jsx(di,{type:"button",className:"absolute top-3 right-3 flex h-9 w-9 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-100 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors z-10","aria-label":d("dashboard.cost_breakdown.close"),children:e.jsx(gr,{size:16,strokeWidth:2,"aria-hidden":!0})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto oai-scrollbar",children:e.jsxs("div",{className:"px-3 py-6",children:[e.jsx("p",{className:"text-label uppercase tracking-[0.12em] text-oai-gray-500 dark:text-oai-gray-400 mb-2",children:d("dashboard.cost_breakdown.total_label")}),e.jsx("p",{className:"font-bold text-oai-brand tabular-nums tracking-tight leading-none mb-6",style:{fontSize:"clamp(24px, 6.5vw, 32px)"},children:u}),i.length===0?e.jsx("p",{className:"text-body-sm text-oai-gray-500 dark:text-oai-gray-400",children:"No spend recorded."}):e.jsxs("div",{role:"table","aria-label":d("dashboard.cost_breakdown.title"),children:[e.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-2 mb-2 border-b border-oai-gray-200 dark:border-oai-gray-800 text-label uppercase text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{role:"columnheader",children:"Model"}),e.jsx("span",{role:"columnheader",children:"Cost"})]}),i.map((l,g)=>{const h=`fleet-${g}`;return e.jsxs("div",{role:"rowgroup","aria-labelledby":h,className:g>0?"mt-5":"mt-2",children:[e.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-2",children:[e.jsx("span",{id:h,role:"rowheader",className:"flex-1 min-w-0 text-body-sm font-semibold text-oai-black dark:text-oai-white truncate leading-none",children:l.label}),e.jsx("span",{role:"cell",className:"shrink-0 text-body-sm font-semibold text-oai-black dark:text-oai-white tabular-nums leading-none",children:l.costLabel||"—"})]}),l.models.map((f,m)=>e.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-[5px]",children:[e.jsx("span",{role:"cell",className:"flex-1 min-w-0 text-caption text-oai-gray-500 dark:text-oai-gray-400 truncate leading-none",title:f.name,children:f.name}),e.jsx("span",{role:"cell",className:"shrink-0 text-caption text-oai-gray-700 dark:text-oai-gray-300 tabular-nums leading-none",children:f.costLabel||""})]},f.id||`${f.name}-${m}`))]},`${l.label}-${g}`)})]})]})})]})})]})})});function $l({projectKey:t,from:a,to:r,timeZone:n,tzOffsetMinutes:s}={}){const[o,i]=c.useState(null),[u,l]=c.useState(!1),[g,h]=c.useState(null),f=lt();return c.useEffect(()=>{if(!t){i(null),h(null),l(!1);return}let m=!0;return l(!0),h(null),Mo({projectKey:t,from:a,to:r,timeZone:n,tzOffsetMinutes:s}).then(x=>{m&&i(x||null)}).catch(x=>{m&&(h(x?.message||String(x)),i(null))}).finally(()=>{m&&l(!1)}),()=>{m=!1}},[t,a,r,n,s,f]),{data:o,loading:u,error:g}}function Un(t){if(typeof t!="string"||!t)return{owner:"",repo:""};const a=t.indexOf("/");return a<0?{owner:"",repo:t}:{owner:t.slice(0,a),repo:t.slice(a+1)}}function Hn(t){try{return new URL(t).hostname.toLowerCase()}catch{return""}}function Vn(t){return t?t==="github.com"||t.endsWith(".github.com")?"github":t.includes("gitlab")||t.startsWith("git.")?"gitlab":"generic":""}function Wn(t,a){return a&&Vn(Hn(t))==="github"?a:""}function Kn({githubOwner:t,letter:a,size:r="w-8 h-8"}){const[n,s]=c.useState(!1);return t&&!n?e.jsx("img",{src:`https://github.com/${t}.png?size=80`,alt:"",loading:"lazy",onError:()=>s(!0),className:`${r} rounded-md object-cover bg-oai-gray-100 dark:bg-oai-gray-800 flex-shrink-0`}):e.jsx("div",{className:`${r} rounded-md oai-bg-elevated flex items-center justify-center oai-text-caption font-medium text-oai-gray-500 dark:text-oai-gray-300 flex-shrink-0`,children:a})}const Jr="#10b981",qa=[{key:"input_tokens",labelKey:"dashboard.projects.detail.comp_input",color:"#38bdf8"},{key:"cached_input_tokens",labelKey:"dashboard.projects.detail.comp_cached",color:"#14b8a6"},{key:"cache_creation_input_tokens",labelKey:"dashboard.projects.detail.comp_cache_write",color:"#f59e0b"},{key:"output_tokens",labelKey:"dashboard.projects.detail.comp_output",color:"#a78bfa"},{key:"reasoning_output_tokens",labelKey:"dashboard.projects.detail.comp_reasoning",color:"#fb7185"}],Ya=60;function Pl(t,a,r,n){if(!Array.isArray(t)||t.length===0)return[];const s=new Map(t.map(m=>[m.day,m]));let o=a||t[0].day,i=r||t[t.length-1].day;o>i&&([o,i]=[i,o]),n&&i>n&&(i=n);const u=t[t.length-1].day;i<u&&(i=u);const l=new Date(`${o}T00:00:00Z`),g=new Date(`${i}T00:00:00Z`);if(!Number.isFinite(l.getTime())||!Number.isFinite(g.getTime()))return t;const h=Math.round((g.getTime()-l.getTime())/864e5)+1;h>Ya&&l.setUTCDate(l.getUTCDate()+(h-Ya));const f=[];for(;l.getTime()<=g.getTime()&&f.length<Ya;){const m=l.toISOString().slice(0,10);f.push(s.get(m)||{day:m,total_tokens:0,billable_total_tokens:0}),l.setUTCDate(l.getUTCDate()+1)}return f}function Za(t){if(!Number.isFinite(t))return"—";const a=t*100;return`${a>=10?Math.round(a):a.toFixed(1)}%`}function bt({label:t,value:a,title:r}){return e.jsxs("div",{className:"flex flex-col gap-1.5 group min-w-0",children:[e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:t}),e.jsx("span",{className:"text-xl font-black font-mono text-zinc-900 dark:text-zinc-50 tracking-tight leading-none tabular-nums truncate transition-transform duration-200 group-hover:-translate-y-[1px]",title:r,children:a})]})}function zl({host:t}){if(!t)return null;let a;const r=Vn(t);return r==="github"||r==="gitlab"?a=e.jsx(jt,{provider:r,size:12,className:"fill-current"}):a=e.jsx($i,{size:12}),e.jsx("span",{title:t,"aria-label":t,className:"inline-flex flex-shrink-0 items-center",children:a})}function Ja({children:t}){return e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500 select-none",children:t})}function Bl({entry:t,query:a={},onClose:r}){const[n,s]=kt.useState(!1),o=typeof t?.project_key=="string"?t.project_key:"",{owner:i,repo:u}=Un(o),l=typeof t?.project_ref=="string"?t.project_ref:"",g=Hn(l),{data:h,loading:f,error:m}=$l({projectKey:o,from:a.from,to:a.to,timeZone:a.timeZone,tzOffsetMinutes:a.tzOffsetMinutes}),{formatTokens:x,formatTokensTooltip:p}=ze(),w=kt.useCallback(()=>s(!0),[]),b=E=>{E.target===E.currentTarget&&n&&r()};kt.useEffect(()=>{const E=R=>{R.key==="Escape"&&w()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[w]);const v=h?.totals||null,_=re(v?.billable_total_tokens)??0,D=Number(h?.days_active||0),T=re(v?.input_tokens)??0,M=re(v?.cached_input_tokens)??0,L=T+M>0?M/(T+M):null,O=re(h?.range_total_tokens)??0,k=re(v?.total_tokens)??0,j=O>0?k/O:null,A=kt.useMemo(()=>Pl(h?.daily,h?.from,h?.to,hr({timeZone:a.timeZone,offsetMinutes:a.tzOffsetMinutes})),[h,a.timeZone,a.tzOffsetMinutes]),P=qa.reduce((E,R)=>E+(re(v?.[R.key])??0),0),U=Array.isArray(h?.sources)?h.sources:[],W=!f&&!m&&v&&k>0;return e.jsx("div",{onAnimationEnd:b,onClick:E=>{E.target===E.currentTarget&&w()},className:_t("fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6 backdrop-blur-md bg-black/15 dark:bg-black/40",n?"animate-tt-fade-out":"animate-tt-fade-in"),children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":o,className:_t("relative w-full max-w-4xl max-h-[88vh] backdrop-blur-2xl bg-white/90 dark:bg-oai-gray-900/90 border border-oai-gray-200/50 dark:border-white/10 shadow-2xl rounded-2xl flex flex-col md:flex-row overflow-hidden",n?"animate-tt-modal-exit":"animate-tt-modal"),children:[e.jsx("button",{type:"button",onClick:w,"aria-label":d("dashboard.projects.detail.close_aria"),className:"absolute top-4 right-4 z-50 p-2 rounded-full border border-oai-gray-200/60 dark:border-oai-gray-800/60 bg-white/50 dark:bg-oai-gray-900/50 text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:rotate-90 hover:scale-105 active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60 transition-all duration-300",children:e.jsx(gr,{size:16})}),e.jsxs("div",{className:"w-full md:w-[300px] shrink-0 border-b md:border-b-0 md:border-r border-zinc-200/50 dark:border-zinc-800/40 p-5 md:p-6 flex flex-col gap-5 overflow-y-auto backdrop-blur-md bg-zinc-50/50 dark:bg-zinc-950/50",children:[e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:Jr}}),e.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5",style:{backgroundColor:Jr}})]}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:d("dashboard.projects.detail.badge")})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-3 min-w-0",children:[e.jsx(Kn,{githubOwner:Wn(l,i),letter:(u?.[0]||o?.[0]||"?").toUpperCase(),size:"w-10 h-10"}),e.jsxs("div",{className:"min-w-0",children:[i?e.jsxs("p",{className:"text-[10px] font-mono text-zinc-400 dark:text-zinc-500 truncate leading-tight",children:[i,"/"]}):null,e.jsx("h4",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight leading-tight truncate",children:u||o||"—"})]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[10px] font-mono text-zinc-400 dark:text-zinc-500 leading-relaxed",children:[e.jsx(zl,{host:g}),g&&h?.from&&h?.to?e.jsx("span",{children:"·"}):null,h?.from&&h?.to?e.jsxs("span",{className:"tabular-nums",children:[h.from," – ",h.to]}):null]})]}),W?e.jsxs("div",{className:"grid grid-cols-2 gap-x-5 gap-y-5 border-t border-zinc-200/50 dark:border-zinc-800/50 pt-5 select-none",children:[e.jsx(bt,{label:d("dashboard.projects.detail.stat_total"),value:x(_),title:p(_)}),e.jsx(bt,{label:d("dashboard.projects.detail.stat_share"),value:j==null?"—":Za(j)}),e.jsx(bt,{label:d("dashboard.projects.detail.stat_cache_hit"),value:L==null?"—":Za(L)}),e.jsx(bt,{label:d("dashboard.projects.detail.stat_conversations"),value:pa(v.conversation_count)}),e.jsx(bt,{label:d("dashboard.projects.detail.stat_active_days"),value:pa(D)}),e.jsx(bt,{label:d("dashboard.projects.detail.stat_avg_day"),value:D>0?x(Math.round(_/D)):"—"})]}):null]}),e.jsxs("div",{className:"flex-1 min-w-0 overflow-y-auto",children:[f&&e.jsxs("div",{className:"space-y-4 p-5 md:p-6",children:[e.jsx("div",{className:"h-32 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-800 animate-pulse"}),e.jsx("div",{className:"h-16 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-800 animate-pulse"}),e.jsx("div",{className:"h-24 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-800 animate-pulse"})]}),!f&&m&&e.jsx("p",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 p-5 md:p-6",children:d("dashboard.projects.detail.error")}),!f&&!m&&!W&&e.jsx("p",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 p-5 md:p-6",children:d("dashboard.projects.detail.empty_range")}),W&&e.jsxs("div",{className:"divide-y divide-zinc-200/50 dark:divide-zinc-800/40",children:[A.length>1&&e.jsxs("section",{className:"px-5 py-5 md:px-6 first:md:pt-6",children:[e.jsx(Ja,{children:d("dashboard.projects.detail.section_trend")}),e.jsx("div",{className:"mt-3",children:e.jsx(Mn,{embedded:!0,rows:A,from:A[0]?.day,to:A[A.length-1]?.day,period:"month",showTimeZoneLabel:!1,chartHeightClass:"h-36"})})]}),P>0&&e.jsxs("section",{className:"px-5 py-5 md:px-6 first:md:pt-6",children:[e.jsx(Ja,{children:d("dashboard.projects.detail.section_composition")}),e.jsx("div",{className:"mt-3 flex h-1.5 w-full overflow-hidden rounded-full",children:qa.map(E=>{const R=re(v[E.key])??0;return R<=0?null:e.jsx("div",{style:{width:`${R/P*100}%`,backgroundColor:E.color,minWidth:"2px"}},E.key)})}),e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-x-4 gap-y-1.5",children:qa.map(E=>{const R=re(v[E.key])??0;return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 flex-shrink-0 rounded-full",style:{backgroundColor:E.color}}),e.jsx("span",{className:"text-[11px] text-zinc-500 dark:text-zinc-400",children:d(E.labelKey)}),e.jsx("span",{className:"text-[11px] font-bold font-mono text-zinc-900 dark:text-zinc-50 tabular-nums",title:p(R),children:x(R)})]},E.key)})})]}),U.length>0&&e.jsxs("section",{className:"px-5 py-5 md:px-6 first:md:pt-6",children:[e.jsx(Ja,{children:d("dashboard.projects.detail.section_sources")}),e.jsx("div",{className:"mt-3 space-y-3.5",children:U.map(E=>{const R=Number(E.total_tokens||0),q=k>0?R/k:0,N=q*100,S=Number(E.conversation_count||0),Y=ui(E.source||"unknown");return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(jt,{provider:E.source,size:13,className:"flex-shrink-0"}),e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wide text-zinc-900 dark:text-zinc-50 truncate",children:wt(E.source)}),e.jsxs("span",{className:"hidden text-[10px] font-mono text-zinc-400 dark:text-zinc-500 tabular-nums whitespace-nowrap sm:inline",children:[d("dashboard.projects.detail.source_days",{n:Number(E.days_active||0)}),S>0?e.jsxs(e.Fragment,{children:[" · ",d("dashboard.projects.detail.source_conv",{n:S})]}):null]}),e.jsx("span",{className:"ml-auto text-[12px] font-bold font-mono text-zinc-900 dark:text-zinc-50 tabular-nums",title:p(R),children:x(R)}),e.jsx("span",{className:"w-9 text-right text-[10px] font-mono text-zinc-400 dark:text-zinc-500 tabular-nums",children:Za(q)})]}),e.jsx("div",{className:"mt-1.5 h-1 w-full overflow-hidden rounded-full bg-zinc-100 dark:bg-zinc-800/60",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(100,Math.max(N,R>0?1:0))}%`,minWidth:R>0?"3px":0,backgroundColor:Y}})})]},E.source)})})]})]})]})]})})}const Ol=5;function Ul({entry:t,maxTokens:a,copy:r,formatTokens:n,formatTokensTooltip:s,onSelect:o}){const i=typeof t?.project_key=="string"?t.project_key:"",u=typeof t?.project_ref=="string"?t.project_ref:"",{owner:l,repo:g}=Un(i),h=Wn(u,l),f=re(t?.billable_total_tokens??t?.total_tokens)??0,m=a>0?Math.min(100,Math.max(2,f/a*100)):0,x=Array.isArray(t?.sources)?t.sources:[],p=x.slice(0,Ol),w=x.length-p.length;return e.jsxs("button",{type:"button",onClick:()=>o?.(t),className:"flex w-full items-center gap-3 p-2 rounded-lg text-left hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50 active:bg-oai-gray-100 dark:active:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60 transition-colors",children:[e.jsx(Kn,{githubOwner:h,letter:(g?.[0]||i?.[0]||"?").toUpperCase()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline min-w-0",children:[l?e.jsxs("span",{className:"oai-text-caption text-oai-gray-400 dark:text-oai-gray-500 truncate flex-shrink-[2]",children:[l,"/"]}):null,e.jsx("span",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white truncate",children:g||i||"—"})]}),p.length>0&&e.jsxs("div",{className:"mt-0.5 flex items-center gap-1",children:[p.map(b=>e.jsx(jt,{provider:b.source,size:12,className:"text-oai-gray-400 dark:text-oai-gray-500"},b.source)),w>0&&e.jsx("span",{className:"oai-text-caption text-oai-gray-400 dark:text-oai-gray-500",children:r("dashboard.projects.sources_more",{n:w})})]})]}),e.jsxs("div",{className:"flex w-24 flex-shrink-0 flex-col items-end gap-1",children:[e.jsx("span",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",title:s(f),children:n(f)}),e.jsx("div",{className:"h-1 w-full overflow-hidden rounded-full bg-oai-gray-100 dark:bg-oai-gray-800",children:e.jsx("div",{className:"h-full rounded-full bg-emerald-500",style:{width:`${m}%`,minWidth:f>0?"3px":0}})})]})]})}function Hl({projectEntries:t=[],projectLimit:a=3,onProjectLimitChange:r,projectDetailQuery:n={},copy:s,hasDetailsActual:o,dailyEmptyPrefix:i,installSyncCmd:u,dailyEmptySuffix:l,detailsColumns:g,ariaSortFor:h,toggleSort:f,sortIconFor:m,pagedDetails:x,dailyBreakdownRows:p=[],dailyBreakdownColumns:w=[],dailyBreakdownAriaSortFor:b,dailyBreakdownSortIconFor:v,dailyBreakdownDateKey:_="day",detailsDateKey:D,renderDetailDate:T,renderDailyBreakdownDate:M,renderDetailCell:L,DETAILS_PAGED_PERIODS:O,period:k,detailsPageCount:j,detailsPage:A,setDetailsPage:P}){const[U,W]=c.useState("daily"),[E,R]=c.useState(null),{formatTokens:q,formatTokensTooltip:N}=ze();return e.jsxs(Re,{children:[e.jsxs("div",{className:`flex items-center justify-between gap-3 ${U==="projects"?"mb-4":"mb-0"}`,children:[e.jsxs("div",{role:"tablist","aria-label":"Data view",className:"flex gap-1",children:[e.jsx("button",{role:"tab","aria-selected":U==="daily",type:"button",onClick:()=>W("daily"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${U==="daily"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:s("dashboard.daily.title")}),e.jsx("button",{role:"tab","aria-selected":U==="projects",type:"button",onClick:()=>W("projects"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${U==="projects"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:s("dashboard.projects.title")})]}),U==="projects"&&e.jsx(En,{ariaLabel:s("dashboard.projects.limit_aria"),value:a,onValueChange:S=>r?.(Number(S)),options:[{value:3,label:s("dashboard.projects.limit_top_3")},{value:6,label:s("dashboard.projects.limit_top_6")},{value:10,label:s("dashboard.projects.limit_top_10")}],align:"end",className:"px-2 py-1 text-xs text-oai-gray-600 dark:text-oai-gray-300"})]}),U==="projects"&&(()=>{const S=t.slice(0,a);if(S.length===0)return e.jsx("div",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300",children:s("dashboard.projects.empty")});const Y=S.reduce((H,le)=>{const J=re(le?.billable_total_tokens??le?.total_tokens)??0;return J>H?J:H},0);return e.jsx("div",{className:"space-y-1",children:S.map((H,le)=>e.jsx(Ul,{entry:H,maxTokens:Y,copy:s,formatTokens:q,formatTokensTooltip:N,onSelect:R},H?.project_key||H?.project_ref||`entry-${le}`))})})(),E&&e.jsx(Bl,{entry:E,query:n,onClose:()=>R(null)}),U==="daily"&&e.jsxs("div",{children:[p?.length===0?e.jsxs("div",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 mb-4",children:[i,e.jsx("code",{className:"mx-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 oai-bg-elevated px-1.5 py-0.5 font-mono oai-text-caption",children:u}),l]}):e.jsx("div",{className:"overflow-auto max-h-[384px] -mx-4 oai-scrollbar",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{className:"sticky top-0 z-10",children:e.jsx("tr",{className:"border-b border-oai-gray-200 dark:border-oai-gray-700",children:w.map(S=>e.jsx("th",{"aria-sort":b?.(S.key)||"none",className:"text-left p-0 bg-white dark:bg-oai-gray-900",children:e.jsx("button",{type:"button",onClick:()=>f(S.key),className:"flex w-full items-center justify-start px-2.5 sm:px-4 py-2 text-left oai-text-caption font-semibold text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white transition-colors",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{children:S.label}),e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-400",children:v?.(S.key)||""})]})})},S.key))})}),e.jsx("tbody",{children:p.map(S=>e.jsxs("tr",{className:`border-b border-oai-gray-100 dark:border-oai-gray-800 last:border-b-0 hover:bg-oai-gray-50/50 dark:hover:bg-oai-gray-800/50 transition-colors ${S.missing?"text-oai-gray-400 dark:text-oai-gray-400":S.future?"text-oai-gray-300 dark:text-oai-gray-600":"text-oai-black dark:text-oai-white"}`,children:[e.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 whitespace-nowrap",children:M?M(S):T(S)}),e.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:L(S,"total_tokens")}),e.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:L(S,"input_tokens")}),e.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:L(S,"output_tokens")}),e.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:L(S,"cached_input_tokens")}),e.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:L(S,"reasoning_output_tokens")}),e.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:L(S,"conversation_count")})]},String(S?.[_]||S?.day||S?.hour||S?.month||"")))})]})}),U!=="daily"&&O.has(k)&&j>1?e.jsxs("div",{className:"mt-3 flex items-center justify-between oai-text-caption",children:[e.jsx("button",{type:"button",onClick:()=>P(S=>Math.max(0,S-1)),disabled:A===0,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:s("details.pagination.prev")}),e.jsxs("span",{className:"oai-text-muted",children:[A+1," / ",j]}),e.jsx("button",{type:"button",onClick:()=>P(S=>Math.min(j-1,S+1)),disabled:A+1>=j,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:s("details.pagination.next")})]}):null]})]})}function fa(t){return typeof t!="string"?"":t.trim()}function Qr(t){const a=fa(t);return a?a.split(/[_\-\s]+/).filter(Boolean).map(r=>r.slice(0,1).toUpperCase()+r.slice(1).toLowerCase()).join(" "):""}function Vl(t){if(!Array.isArray(t))return[];const a=new Map;for(const r of t){if(!r||typeof r!="object")continue;const n=fa(r.tool),s=fa(r.planType)||fa(r.plan_type);if(!n||!s)continue;const o=Qr(n)||n,i=Qr(s)||s;a.set(`${n.toLowerCase()}::${s.toLowerCase()}`,{tool:o,plan:i})}return Array.from(a.values())}function Wl({startDate:t,streakDays:a,subscriptions:r=[],periodConversations:n,rolling:s,topModels:o=[],className:i=""}){const{formatTokensTooltip:u}=ze(),l=d("shared.placeholder.short"),g=d("shared.unit.percent"),h=t??d("identity_card.rank_placeholder"),f=Number.isFinite(Number(a))?Number(a):0,m=f?d("identity_card.streak_value",{days:f}):d("identity_card.rank_placeholder"),x=Vl(r),p={thousandSuffix:d("shared.unit.thousand_abbrev"),millionSuffix:d("shared.unit.million_abbrev"),billionSuffix:d("shared.unit.billion_abbrev")},w=_=>{if(_==null)return l;const D=Ye(_,p);return D==="-"?l:D},b={last7d:d("stats.period.last_7d"),last30d:d("stats.period.last_30d"),avg:d("stats.period.avg"),convs:d("stats.period.convs")},v=o.slice(0,3);return e.jsxs(Re,{className:`h-full ${i}`,children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[e.jsx("span",{title:u(s?.last_7d?.totals?.billable_total_tokens),className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(s?.last_7d?.totals?.billable_total_tokens)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:b.last7d})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[e.jsx("span",{title:u(s?.last_30d?.totals?.billable_total_tokens),className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(s?.last_30d?.totals?.billable_total_tokens)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:b.last30d})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[e.jsx("span",{title:u(s?.last_30d?.avg_per_active_day),className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(s?.last_30d?.avg_per_active_day)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:b.avg})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[e.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(n)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:b.convs})]})]}),v.length>0&&e.jsx("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800",children:v.map((_,D)=>{const T=_?.name?String(_.name):l,M=_?.percent?String(_.percent):"",L=D===v.length-1,O=D+1;return e.jsxs("div",{className:`flex items-center py-2 ${L?"":"border-b border-oai-gray-50 dark:border-oai-gray-800"}`,children:[e.jsx("span",{className:"w-5 h-5 flex items-center justify-center rounded-full bg-oai-gray-100 dark:bg-oai-gray-800 text-[10px] font-semibold text-oai-gray-500 dark:text-oai-gray-300 flex-shrink-0",children:O}),e.jsx("span",{className:"flex-1 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate px-2.5",title:T,children:T}),e.jsxs("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums flex-shrink-0",children:[M,g]})]},_.id||T)})}),x.length>0&&e.jsx("div",{className:"mt-3 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex flex-wrap gap-1.5",children:x.map((_,D)=>e.jsxs(qi,{variant:"secondary",size:"sm",children:[_.tool," ",_.plan]},`${_.tool}:${_.plan}:${D}`))}),e.jsxs("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between text-xs text-oai-gray-400 dark:text-oai-gray-400",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:d("identity_card.rank_label")}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:h})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{children:d("identity_card.streak_label")}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:m})]})]})]})}let da=null;function Kl(){if(da===null)try{da=typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("color","oklch(0 0 0)")}catch{da=!1}return da}function Gl(t,a,r){const n=r*Math.PI/180,s=a*Math.cos(n),o=a*Math.sin(n),i=t+.3963377774*s+.2158037573*o,u=t-.1055613458*s-.0638541728*o,l=t-.0894841775*s-1.291485548*o,g=i*i*i,h=u*u*u,f=l*l*l;return[4.0767416621*g-3.3077115913*h+.2309699292*f,-1.2684380046*g+2.6097574011*h-.3413193965*f,-.0041960863*g-.7034186147*h+1.707614701*f].map(x=>{const p=Math.min(1,Math.max(0,x)),w=p<=.0031308?12.92*p:1.055*Math.pow(p,1/2.4)-.055;return Math.round(w*255)})}function Gn(t,a,r,n){if(Kl())return n==null?`oklch(${t} ${a} ${r})`:`oklch(${t} ${a} ${r} / ${n})`;const[s,o,i]=Gl(t,a,r);return n==null?`rgb(${s} ${o} ${i})`:`rgb(${s} ${o} ${i} / ${n})`}function Nt(t){const a=/^oklch\(\s*([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\s*\)$/.exec(t);return a?Gn(Number(a[1]),Number(a[2]),Number(a[3])):t}const Xr={claude:35,codex:250},en={system_prompt:{l:.55,c:.05},messages:{l:.65,c:.18},tool_calls:{l:.6,c:.14},custom_agents:{l:.55,c:.1},reasoning:{l:.7,c:.08}};function ql(t,a){const r=Xr[a]??Xr.claude,n=en[t]||en.system_prompt;return Gn(n.l,n.c,r)}const Yl=[{key:"system_prompt",from:["system_prefix"]},{key:"messages",from:["user_input","conversation_history","assistant_response"]},{key:"tool_calls",from:["tool_calls"]},{key:"custom_agents",from:["subagents"]},{key:"reasoning",from:["reasoning"]}],Zl=[["by_type","dashboard.context_breakdown.exec_details.group_by_type"],["by_executable","dashboard.context_breakdown.exec_details.group_by_executable"],["by_command","dashboard.context_breakdown.exec_details.group_by_command"],["by_duration","dashboard.context_breakdown.exec_details.group_by_duration"],["by_output","dashboard.context_breakdown.exec_details.group_by_output"],["by_exit","dashboard.context_breakdown.exec_details.group_by_exit"]],Jl={duration:.18,ease:[.4,0,.2,1]},Ql={height:0,opacity:0},Xl={height:"auto",opacity:1},ec={height:0,opacity:0};function tc(t){const a=Number(t||0);return Number.isFinite(a)&&a>0?a:0}function ac(t,a){const r={};for(const n of["input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens","total_tokens"])r[n]=Math.round(Number(t?.[n]||0)*a);return r}function qn(t,a=null){const r=t.reduce((i,u)=>i+Number(u.totals.total_tokens||0),0),n=tc(a),s=n||r,o=n&&r>0?n/r:1;return t.map(i=>{const u=o===1?i.totals:ac(i.totals,o);return{...i,totals:u,percent:s>0?Number((u.total_tokens/s*100).toFixed(2)):0}}).sort((i,u)=>u.totals.total_tokens-i.totals.total_tokens)}function rc(t,a=null){const r=new Map;for(const s of t||[])r.set(s.key,s);const n=Yl.map(s=>{const o={input_tokens:0,cached_input_tokens:0,cache_creation_input_tokens:0,output_tokens:0,reasoning_output_tokens:0,total_tokens:0};for(const i of s.from){const u=r.get(i);if(!u)continue;const l=u.totals||{};o.input_tokens+=l.input_tokens||0,o.cached_input_tokens+=l.cached_input_tokens||0,o.cache_creation_input_tokens+=l.cache_creation_input_tokens||0,o.output_tokens+=l.output_tokens||0,o.reasoning_output_tokens+=l.reasoning_output_tokens||0,o.total_tokens+=l.total_tokens||0}return{key:s.key,totals:o}});return qn(n,a)}function nc(t,a=null){const r=t?.totals||{},n=Number(r.reasoning_output_tokens||0),s=(t?.tool_calls_breakdown?.categories||[]).reduce((g,h)=>h?.name==="Text Response"?g:g+Number(h?.totals?.total_tokens||0),0),o=Number(r.total_tokens||0),i=Math.min(Math.max(0,s),Math.max(0,o-n)),l=[{key:"messages",totals:{total_tokens:Math.max(0,o-n-i)}},{key:"tool_calls",totals:{total_tokens:i}},{key:"reasoning",totals:{total_tokens:n}}];return qn(l,a)}const tn="MCP: ";function sc(t){if(!t?.categories?.length)return{mcpSet:null,residualSet:t,mcpTotalTokens:0};const a=[],r=[];let n=0;for(const s of t.categories){const o=String(s?.name||"");o.startsWith(tn)?(a.push({...s,name:o.slice(tn.length)}),n+=Number(s?.totals?.total_tokens||0)):r.push(s)}return a.length===0?{mcpSet:null,residualSet:t,mcpTotalTokens:0}:(a.sort((s,o)=>(o.totals?.total_tokens||0)-(s.totals?.total_tokens||0)),{mcpSet:{...t,categories:a},residualSet:{...t,categories:r},mcpTotalTokens:n})}function an(t){return d(`dashboard.context_breakdown.category.${t}`)}function oc(t){return typeof t!="string"?"":t.startsWith("mcp__")?t.split("__").slice(2).join("__")||t:t.includes("/")&&t.split("/").pop()||t}function ic(t){return(Array.isArray(t)?t:[]).map(a=>{const r=a?.totals||null,n=Number(r?r.input_tokens||0:a?.input_tokens||0),s=Number(r?r.output_tokens||0:a?.output_tokens||0),o=Number(r?r.cached_input_tokens||0:a?.cache_read||0),i=Number(r?r.cache_creation_input_tokens||0:a?.cache_creation||0),u=Number(r?r.total_tokens||n+s:a?.total_tokens||s);return{name:oc(a?.name?String(a.name):""),calls:Number(a?.calls||0),input_tokens:n,output_tokens:s,cache_read:o,cache_creation:i,total_tokens:Number(u||0)}}).filter(a=>a.name).sort((a,r)=>(r.total_tokens||0)-(a.total_tokens||0))}function lc(t){return(Array.isArray(t)?t:[]).map(a=>{const r=a?.totals||{},n=Array.isArray(a?.tools)?a.tools:[],s=Number(r.input_tokens||0),o=Number(r.output_tokens||0),i=Number(r.cached_input_tokens||0),u=Number(r.cache_creation_input_tokens||0);return{name:a?.name?String(a.name):"",calls:Number(a?.calls||0),totals:{input_tokens:s,output_tokens:o,cached_input_tokens:i,cache_creation_input_tokens:u,total_tokens:Number(r.total_tokens||s+o)},tools:ic(n),toolCount:n.length}}).filter(a=>a.name).sort((a,r)=>(r.totals.total_tokens||0)-(a.totals.total_tokens||0))}function cc(t){return(Array.isArray(t)?t:[]).map(a=>{const r=a?.totals||{},n=Number(r.input_tokens||0),s=Number(r.output_tokens||0),o=Number(r.cached_input_tokens||0),i=Number(r.cache_creation_input_tokens||0);return{key:a?.key?String(a.key):"",name:a?.name?String(a.name):"",totals:{input_tokens:n,output_tokens:s,cached_input_tokens:o,cache_creation_input_tokens:i,total_tokens:Number(r.total_tokens||n+s+o+i)}}}).filter(a=>a.key||a.name).sort((a,r)=>(r.totals.total_tokens||0)-(a.totals.total_tokens||0))}function dc(t){return(Array.isArray(t)?t:[]).map(a=>{const r=a?.totals||{};return{name:a?.name?String(a.name):"",calls:Number(a?.calls||0),total_tokens:Number(r.total_tokens||0)}}).filter(a=>a.name).sort((a,r)=>Number(r.total_tokens||0)-Number(a.total_tokens||0))}function uc(t){if(t?.key){const a=d(`dashboard.context_breakdown.message_details.${t.key}`);if(a&&!a.includes("dashboard.context_breakdown"))return a}return t?.name||""}function mc(t){return(Array.isArray(t)?t:[]).map(a=>{const r=a?.totals||{},n=Number(r.input_tokens||0),s=Number(r.output_tokens||0),o=Number(r.cached_input_tokens||0),i=Number(r.cache_creation_input_tokens||0);return{name:a?.name?String(a.name):"",calls:Number(a?.calls||0),failures:Number(a?.failures||0),duration_ms:Number(a?.duration_ms||0),max_duration_ms:Number(a?.max_duration_ms||0),output_chars:Number(a?.output_chars||0),output_lines:Number(a?.output_lines||0),totals:{input_tokens:n,output_tokens:s,cached_input_tokens:o,cache_creation_input_tokens:i,total_tokens:Number(r.total_tokens||n+s)}}}).filter(a=>a.name).sort((a,r)=>Number(r.totals.total_tokens||0)-Number(a.totals.total_tokens||0))}function rn(t){const a=Number(t||0);return!Number.isFinite(a)||a<=0?"0ms":a<1e3?`${Math.round(a)}ms`:a<6e4?`${(a/1e3).toFixed(1)}s`:`${Math.round(a/1e3)}s`}function hc(t,a){return t?a==="by_executable"?t.by_executable||[]:a==="by_command"?t.by_command||[]:a==="by_duration"?t.by_duration||[]:a==="by_output"?t.by_output||[]:a==="by_exit"?t.by_exit||[]:t.by_type||[]:[]}function nn(t){return t==="exec_command"||t==="Bash"}function Yn(t){return t==="codex"?"dashboard.context_breakdown.empty_codex":"dashboard.context_breakdown.empty"}function gc(t){return t==="codex"?"dashboard.context_breakdown.error_codex":"dashboard.context_breakdown.error"}function fc(t){return t==="codex"?"dashboard.context_breakdown.footnote_codex":"dashboard.context_breakdown.footnote"}const xc=10;function qe({level:t=0,colorSquare:a=null,label:r,labelSuffix:n=null,labelTone:s="default",hasChevron:o=!1,open:i=!1,onToggle:u,tokens:l,percent:g=null,children:h,share:f=null,fillColor:m=null}){const x=s==="accent"?"text-oai-brand truncate":s==="muted"?"text-oai-gray-500 dark:text-oai-gray-400 truncate":s==="strong"?"font-medium text-oai-black dark:text-oai-white truncate":"text-oai-gray-700 dark:text-oai-gray-300 truncate",p=e.jsx("span",{className:"shrink-0 flex items-center justify-start",style:{width:xc},"aria-hidden":!a,children:a}),w=e.jsxs(e.Fragment,{children:[p,e.jsx("span",{className:x,children:r}),n,o&&e.jsx(_e.span,{animate:{rotate:i?90:0},transition:{duration:.15},className:"shrink-0 text-oai-gray-400 dark:text-oai-gray-500 flex items-center","aria-hidden":"true",children:e.jsx(vi,{size:11})})]}),b=m&&f!=null&&f>0,v=b?Math.max(0,Math.min(100,f)):0;return e.jsxs("li",{className:"min-w-0 group/row",children:[e.jsxs("div",{className:"relative grid grid-cols-[minmax(0,1fr)_minmax(9rem,max-content)_4rem] items-center gap-x-3 text-xs py-1 px-1 rounded-sm transition-colors duration-150",style:b?{backgroundImage:`linear-gradient(to right, ${m.replace(/\)\s*$/," / 0.10)")} 0%, ${m.replace(/\)\s*$/," / 0.10)")} ${v}%, transparent ${v}%)`}:void 0,children:[o?e.jsx("button",{type:"button",onClick:u,"aria-expanded":i,className:"relative col-start-1 row-start-1 flex items-center gap-1.5 min-w-0 text-left cursor-pointer focus-visible:outline-none focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-oai-brand/40 rounded-sm",children:w}):e.jsx("div",{className:"relative col-start-1 row-start-1 flex items-center gap-1.5 min-w-0",children:w}),e.jsx("span",{className:"relative col-start-2 row-start-1 text-right whitespace-nowrap tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:l||""}),e.jsx("span",{className:"relative col-start-3 row-start-1 text-right whitespace-nowrap tabular-nums text-[10px] text-oai-gray-400 dark:text-oai-gray-500 font-normal",children:g||""})]}),o&&h?e.jsx(fr,{initial:!1,children:i&&e.jsx(_e.div,{initial:Ql,animate:Xl,exit:ec,transition:Jl,style:{overflow:"hidden"},children:h},"content")}):null]})}function sn({execDetails:t,source:a="claude"}){const{formatTokens:r}=ze(),[n,s]=c.useState("by_type"),o=mc(hc(t,n)),i=a==="codex",u=i?"grid-cols-[minmax(0,1fr)_48px_48px_72px_72px_60px_60px]":"grid-cols-[minmax(0,1fr)_56px_60px]";return e.jsxs("div",{className:"mt-2 ml-4",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1 rounded-md bg-oai-gray-100 dark:bg-oai-gray-900 p-1 w-fit max-w-full",children:Zl.map(([l,g])=>e.jsx("button",{type:"button",onClick:()=>s(l),className:"h-7 px-2 rounded-md text-[10px] font-medium transition-colors "+(n===l?"bg-oai-white dark:bg-oai-gray-800 text-oai-black dark:text-oai-white shadow-sm":"text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-white/70 dark:hover:bg-oai-gray-800/70"),children:d(g)},l))}),o.length===0?e.jsx("p",{className:"mt-2 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:"—"}):e.jsx("div",{className:"mt-2 overflow-x-auto",children:e.jsxs("div",{role:"table","aria-label":d("dashboard.context_breakdown.exec_details.title"),className:i?"min-w-[420px]":"min-w-[260px]",children:[e.jsxs("div",{role:"row",className:`grid ${u} gap-2 py-1.5 mb-1 border-b border-oai-gray-200 dark:border-oai-gray-800 text-label uppercase text-oai-gray-500 dark:text-oai-gray-400`,children:[e.jsx("span",{role:"columnheader",children:d("dashboard.context_breakdown.exec_details.kind_column")}),e.jsx("span",{role:"columnheader",className:"text-right",children:d("dashboard.context_breakdown.exec_details.calls_column")}),i&&e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"columnheader",className:"text-right",children:d("dashboard.context_breakdown.exec_details.failures_column")}),e.jsx("span",{role:"columnheader",className:"text-right",children:d("dashboard.context_breakdown.exec_details.duration_column")}),e.jsx("span",{role:"columnheader",className:"text-right",children:d("dashboard.context_breakdown.exec_details.max_duration_column")})]}),e.jsx("span",{role:"columnheader",className:"text-right",children:d("dashboard.context_breakdown.tool_details.total_column")}),i&&e.jsx("span",{role:"columnheader",className:"text-right",children:d("dashboard.context_breakdown.exec_details.output_column")})]}),o.map((l,g)=>e.jsxs(_e.div,{role:"row",className:`grid ${u} gap-2 py-1.5`,title:l.name,initial:{opacity:0},animate:{opacity:1},transition:{duration:.18,delay:g*.02},children:[e.jsx("span",{role:"cell",className:"min-w-0 text-body-sm font-medium text-oai-black dark:text-oai-white truncate",children:l.name}),e.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:Ye(l.calls||0)}),i&&e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:Ye(l.failures||0)}),e.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:rn(l.duration_ms||0)}),e.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:rn(l.max_duration_ms||0)})]}),e.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:r(l.totals.total_tokens||0)}),i&&e.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:Ye(l.output_lines||0)})]},l.name))]})})]})}function $t({toolSet:t,execDetails:a,source:r,codexQueueFallback:n}){const{formatTokens:s}=ze(),[o,i]=c.useState({}),[u,l]=c.useState(!1),g=lc(t?.categories||[]);function h(f){i(m=>({...m,[f]:!m[f]}))}return g.length===0?e.jsx("p",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500 py-0.5",children:r==="codex"&&n?d("dashboard.context_breakdown.tool_details.unavailable_codex"):d(Yn(r))}):e.jsx("ul",{className:"mt-0.5 mb-0.5 space-y-0.5",children:g.map(f=>{const m=f.toolCount>0,x=f.name==="Execution"&&a,p=x&&f.tools.some(b=>nn(b.name)),w=!!o[f.name];return e.jsxs(qe,{level:1,label:f.name,labelTone:"strong",hasChevron:m||x&&!p,open:w||x&&!p&&u,onToggle:()=>{m?h(f.name):x&&!p&&l(b=>!b)},tokens:s(f.totals.total_tokens||0),percent:null,children:[m&&e.jsx("ul",{className:"space-y-0.5",children:f.tools.map(b=>{const v=x&&nn(b.name);return e.jsx(qe,{level:2,label:b.name,labelTone:v?"accent":"default",hasChevron:v,open:u,onToggle:()=>l(_=>!_),tokens:s(b.total_tokens||0),percent:null,children:v&&e.jsx(sn,{execDetails:a,source:r})},b.name)})}),x&&!p&&e.jsx(sn,{execDetails:a,source:r})]},f.name)})})}function pc({from:t,to:a,source:r="claude",referenceTotalTokens:n=null,onLoadingChange:s=null}){const{formatTokens:o}=ze(),[i,u]=c.useState(null),[l,g]=c.useState(!1),[h,f]=c.useState(null),[m,x]=c.useState({});function p(N){x(S=>({...S,[N]:!S[N]}))}if(c.useEffect(()=>{let N=!1;return g(!0),s?.(!0),f(null),Eo({from:t,to:a,source:r,timeZone:Dn(),tzOffsetMinutes:An()}).then(S=>{N||u(S)}).catch(S=>{N||f(S?.message||String(S))}).finally(()=>{N||(g(!1),s?.(!1))}),()=>{N=!0}},[t,a,r]),l&&!i)return e.jsxs("div",{children:[e.jsx("div",{className:"h-1 w-full bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden animate-pulse"}),e.jsx("div",{className:"mt-3 grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-2",children:[0,1,2,3,4].map(N=>e.jsx("div",{className:"h-3 rounded bg-oai-gray-100 dark:bg-oai-gray-800 animate-pulse",style:{animationDelay:`${N*80}ms`}},N))}),e.jsx("p",{className:"mt-3 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:d("dashboard.context_breakdown.loading_hint")})]});if(h)return e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:d(gc(r))});if(!i||i.scope!=="supported"||!i.totals?.total_tokens)return e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:d(Yn(r))});const w=r==="claude"?rc(i.categories||[],n):nc(i,n),b=i.tool_calls_breakdown||null,v=i.skills_breakdown||null,_=i.message_breakdown||null,D=i.configured_resources||null,T=i.exec_command_breakdown||null,M=dc(v?.skills||[]),L=cc(_?.categories||[]),O=r==="codex"&&(i?.breakdown_status==="queue_fallback"||i?.fallback==="queue_totals"),k=r==="claude"?b?.tool_calls||null:b||null,{mcpSet:j,residualSet:A,mcpTotalTokens:P}=sc(k),U=r==="claude"&&b?.subagents||null,W=U?.categories?.length>0||(D?.custom_agents_count||0)>0,E=r==="claude"?(A?.categories||[]).reduce((N,S)=>N+Number(S?.totals?.total_tokens||0),0):0,R=r==="claude"?(U?.categories||[]).reduce((N,S)=>N+Number(S?.totals?.total_tokens||0),0):0,q=[...w].sort((N,S)=>(S.totals?.total_tokens||0)-(N.totals?.total_tokens||0));return e.jsxs("div",{role:"region","aria-label":d("dashboard.context_breakdown.bar_aria",{summary:w.filter(N=>N.percent>0).filter(N=>!(r==="claude"&&(N.key==="tool_calls"||N.key==="custom_agents"))).map(N=>`${an(N.key)} ${N.percent}%`).join(",")}),children:[e.jsxs("ul",{className:"space-y-0.5",children:[q.map(N=>{const S=N.key==="system_prompt",Y=N.key==="messages",H=N.key==="tool_calls",le=N.key==="custom_agents";if(N.key,r==="claude"&&(H||le))return null;const J=Y&&L.length>0||H&&(A?.categories?.length>0||O)||le&&W&&U,ce=!!m[N.key],oe=ql(N.key,r),he=e.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0",style:{backgroundColor:oe},"aria-hidden":"true"}),ye=S?e.jsxs("span",{className:"relative inline-flex shrink-0 group",children:[e.jsx(Fn,{size:11,className:"text-oai-gray-400 dark:text-oai-gray-500 cursor-help","aria-hidden":"true"}),e.jsx("span",{role:"tooltip",className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-1.5 -translate-x-1/2 w-64 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-white dark:bg-oai-gray-900 px-2.5 py-1.5 text-[11px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-md opacity-0 group-hover:opacity-100 transition-opacity",children:d("dashboard.context_breakdown.system_prefix_tooltip")})]}):null,de=N.percent>0?`${N.percent.toFixed(N.percent<.1&&N.percent>0?2:1)}%`:"0.0%";return e.jsxs(qe,{level:0,colorSquare:he,label:an(N.key),labelSuffix:ye,tokens:o(N.totals?.total_tokens||0),percent:de,hasChevron:J,open:ce,onToggle:()=>p(N.key),share:N.percent,fillColor:oe,children:[Y&&e.jsx("ul",{className:"space-y-0.5",children:L.map(ee=>e.jsx(qe,{level:1,label:uc(ee),tokens:o(ee.totals.total_tokens||0),percent:null},ee.key||ee.name))}),H&&A&&e.jsx($t,{toolSet:A,execDetails:T,source:r,codexQueueFallback:O}),H&&O&&!A&&e.jsx("p",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500 py-0.5",children:d("dashboard.context_breakdown.tool_details.unavailable_codex")}),le&&U&&e.jsx($t,{toolSet:U,execDetails:null,source:r,codexQueueFallback:!1})]},N.key)}),r==="claude"&&A?.categories?.length>0&&e.jsx(qe,{level:0,colorSquare:e.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0 bg-oai-gray-300 dark:bg-oai-gray-600","aria-hidden":"true"}),label:d("dashboard.context_breakdown.category.tool_calls"),tokens:o(E),percent:null,hasChevron:!0,open:!!m.tool_calls_aux,onToggle:()=>p("tool_calls_aux"),children:e.jsx($t,{toolSet:A,execDetails:T,source:r,codexQueueFallback:!1})}),r==="claude"&&U?.categories?.length>0&&e.jsx(qe,{level:0,colorSquare:e.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0 bg-oai-gray-300 dark:bg-oai-gray-600","aria-hidden":"true"}),label:d("dashboard.context_breakdown.category.custom_agents"),tokens:o(R),percent:null,hasChevron:!0,open:!!m.custom_agents_aux,onToggle:()=>p("custom_agents_aux"),children:e.jsx($t,{toolSet:U,execDetails:null,source:r,codexQueueFallback:!1})}),j?.categories?.length>0&&e.jsx(qe,{level:0,colorSquare:e.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0 bg-oai-gray-300 dark:bg-oai-gray-600","aria-hidden":"true"}),label:d("dashboard.context_breakdown.category.mcp_servers"),tokens:o(P),percent:null,hasChevron:!0,open:!!m.mcp_servers,onToggle:()=>p("mcp_servers"),children:e.jsx($t,{toolSet:j,execDetails:null,source:r,codexQueueFallback:!1})}),M.length>0&&e.jsx(qe,{level:0,colorSquare:e.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0 bg-oai-gray-300 dark:bg-oai-gray-600","aria-hidden":"true"}),label:d("dashboard.context_breakdown.category.skills"),tokens:o(M.reduce((N,S)=>N+(S.total_tokens||0),0)),percent:null,hasChevron:!0,open:!!m.skills,onToggle:()=>p("skills"),children:e.jsx("ul",{className:"space-y-0.5",children:M.slice(0,12).map(N=>e.jsx(qe,{level:1,label:N.name,tokens:o(N.total_tokens),percent:null},N.name))})})]}),e.jsx("p",{className:"mt-2 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:d(fc(r))}),O?e.jsx("p",{className:"mt-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:d("dashboard.context_breakdown.tool_details.unavailable_codex")}):null,D?e.jsxs("p",{className:"mt-2 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:[Ye(D.skills_count||0)," skills ·"," ",Ye(D.mcp_servers_count||0)," MCP servers ·"," ",Ye(D.custom_agents_count||0)," agents ·"," ",Ye(D.memory_files_count||0)," memory files"]}):null]})}function xa(t,a){const r=Number(a);return Number.isFinite(r)&&r>0?t(r):null}function Zn(t,a,r){const n=Number(t);if(!Number.isFinite(n)||n<=0)return null;const s=wa(a);return(a===Tn?n:n*r)<.01?`<${s}0.01`:_a(n,{decimals:2,currency:a,rate:r})}function yc(t){return Array.isArray(t)?t.map(a=>typeof a=="string"?{key:a,label:on(a)}:{key:a.key,label:a.label||on(a.key)}):[]}function bc(t){if(typeof t!="string")return null;const a=t.replace(/,/g,"").match(/-?\d+(?:\.\d+)?/);if(!a)return null;const r=Number(a[0]);return Number.isFinite(r)?r:null}const kc={CODEX:"#3b82f6",CLAUDE:"#d97757",OPENCODE:"#f59e0b",GEMINI:"#2196f3",KIMI:"#a78bfa","KILO-CLI":"#facc15","KILO-CODE":"#facc15",MIMO:"#ff6900",DROID:"#ef4444",ZCODE:"#14b8a6",ANYTHINGLLM:"var(--provider-anythingllm)"};function Qa(t,a){const r=t?.toUpperCase?.()||"";return kc[r]||`hsl(${150+a*40}, 60%, 45%)`}function wc(t){const a=String(t?.source||"").trim().toLowerCase(),r=String(t?.label||"").trim().toLowerCase();return a==="claude"||r==="claude"?"claude":a==="codex"||r==="codex"?"codex":null}function _c(t){return!!t?.models?.length}function Jn(t){const a=Number(t?.totalPercentValue??t?.totalPercent);return Number.isFinite(a)?Math.max(0,a):0}function Xa(t){const a=Jn(t);return a>0&&!(a>=.01)?d("usage.overview.percent_below_threshold"):a.toFixed(2)}const vc={day:"usage.period.day",week:"usage.period.week",month:"usage.period.month",total:"usage.period.total",custom:"usage.period.custom"};function on(t){const a=vc[t];return a?d(a):String(t).toUpperCase()}function jc({loading:t,onClick:a}){const r=Nn();return e.jsx(Io,{variant:"secondary",size:"sm",disabled:t,onClick:a,"aria-label":d("usage.button.refresh"),className:"w-8 p-0",children:e.jsx(_e.span,{"aria-hidden":"true",animate:t?{rotate:360}:{rotate:0},transition:t&&!r?{duration:1,repeat:1/0,ease:"linear"}:{duration:.3},style:{display:"inline-block"},children:"↻"})})}function Nc(){return e.jsx("div",{"data-testid":"usage-summary-skeleton","aria-hidden":"true",className:"mx-auto h-[58px] sm:h-[72px] w-[min(72vw,18rem)] rounded-2xl bg-oai-gray-100 dark:bg-oai-gray-800 animate-pulse motion-reduce:animate-none"})}function Sc(){return e.jsxs("div",{"data-testid":"usage-provider-skeleton","aria-hidden":"true",className:"space-y-6",children:[e.jsx("div",{className:"h-1.5 w-full rounded-full bg-oai-gray-100 dark:bg-oai-gray-800 animate-pulse motion-reduce:animate-none"}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-3",children:[0,1,2,3].map(t=>e.jsx("div",{className:"h-[92px] rounded-xl border border-oai-gray-100 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-800/60 animate-pulse motion-reduce:animate-none",style:{animationDelay:`${t*70}ms`}},t))})]})}function Cc({period:t,periods:a,onPeriodChange:r,summaryValue:n,summaryFullValue:s,onToggleSummaryFormat:o,summaryLabel:i,summaryCostValue:u,onCostInfo:l,fleetData:g=[],onRefresh:h,loading:f,announceLoading:m=!1,summaryLoading:x=!1,providersLoading:p=!1,hasSummary:w=!0,className:b="",customFrom:v,customTo:_,onCustomRangeApply:D,customRangeOpen:T,onCustomRangeOpenChange:M,onOpenShare:L,from:O,to:k,deviceOptions:j=[],selectedDevice:A="",onDeviceChange:P}){const U=yc(a),W=hi(Fo()),E=bc(String(n??"")),R=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches,[q,N]=c.useState(R);c.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const C=window.matchMedia("(max-width: 639px)"),B=F=>N(F.matches);return C.addEventListener("change",B),()=>C.removeEventListener("change",B)},[]);const S=E!=null&&!q,Y=c.useRef(null);c.useEffect(()=>{const C=Y.current?.querySelector('[aria-selected="true"]');C&&typeof C.scrollIntoView=="function"&&C.scrollIntoView({block:"nearest",inline:"center"})},[t]);const[H,le]=c.useState(null),{resolvedTheme:J}=Ro(),{currency:ce,rate:oe}=va(),{formatTokens:he}=ze(),ye=J==="dark",de=ye?"rgba(10,10,10,0.98)":"rgba(255,255,255,0.96)",ee=ye?"rgba(10,10,10,0)":"rgba(255,255,255,0)",Q=x&&!w,z=p&&!g.some(_c),X=C=>{if(!["ArrowLeft","ArrowRight","Home","End"].includes(C.key))return;const B=Array.from(C.currentTarget.querySelectorAll('[role="tab"]')).filter(ne=>!ne.disabled),F=B.indexOf(C.target.closest('[role="tab"]'));if(F===-1||B.length===0)return;C.preventDefault();let K=F;C.key==="Home"?K=0:C.key==="End"?K=B.length-1:C.key==="ArrowRight"?K=(F+1)%B.length:K=(F-1+B.length)%B.length,B[K].focus(),B[K].click()},ge=S?e.jsx(al,{value:E,displayValue:n,fontSize:72,padding:6,gap:1,textColor:"var(--oai-black, #111827)",fontWeight:700,gradientHeight:ye?0:8,gradientFrom:de,gradientTo:ee,counterStyle:{paddingLeft:0,paddingRight:0,gap:0},digitStyle:{width:"0.88ch"}}):n,V=g.filter(C=>C.models?.length>0);return e.jsx(Re,{className:b,children:e.jsxs("div",{"aria-busy":f||Q||z,children:[m?e.jsx("span",{className:"sr-only",role:"status",children:d("qpd.card.updating")}):null,e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsx("div",{ref:Y,role:"tablist","aria-label":d("usage.overview.tablist_aria"),onKeyDown:X,className:"flex flex-1 min-w-0 gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:U.map(C=>{const B=t===C.key,F=`shrink-0 whitespace-nowrap text-xs font-medium px-3 py-1.5 rounded-md transition-colors ${B?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800"}`;if(C.key==="custom"){const K=B&&v&&_?`${Hr(v,W)} — ${Hr(_,W)}`:C.label;return e.jsxs(ji,{open:T,onOpenChange:ne=>{ne?r?.("custom"):M?.(ne)},children:[e.jsx(Ni,{render:e.jsx("button",{role:"tab","aria-selected":B,tabIndex:B?0:-1,type:"button",className:F}),children:K}),e.jsx(Si,{children:e.jsx(Ci,{sideOffset:8,side:"bottom",align:"start",className:"!z-[9999]",children:e.jsx(Ti,{className:"bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded-xl shadow-lg",children:e.jsx(mi,{from:v,to:_,onApply:D,onCancel:()=>M?.(!1)})})})})]},"custom")}return e.jsx("button",{role:"tab","aria-selected":B,tabIndex:B?0:-1,type:"button",className:F,onClick:()=>r?.(C.key),children:C.label},C.key)})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[j.length>1?e.jsx(En,{value:A,onValueChange:P,options:j,ariaLabel:d("dashboard.device_filter.aria"),matchTriggerWidth:!0,className:"h-8 px-3 text-xs font-medium rounded-md border-oai-gray-300 dark:border-oai-gray-700 bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-brand hover:text-oai-brand hover:[&_svg]:text-oai-brand transition-colors duration-200"}):null,L?e.jsxs("button",{type:"button",onClick:L,"aria-label":d("share.button.aria"),className:"inline-flex items-center justify-center gap-1.5 h-8 px-3 text-xs font-medium rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-brand hover:text-oai-brand transition-colors duration-200",children:[e.jsx(Ui,{className:"h-3.5 w-3.5",strokeWidth:2}),d("share.button.label")]}):null,h&&e.jsx(jc,{loading:f,onClick:h})]})]}),e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wider mb-3",children:i}),e.jsxs("div",{className:"relative text-5xl sm:text-6xl md:text-7xl font-bold text-oai-black dark:text-oai-white tracking-tight tabular-nums",children:[e.jsx("div",{className:Q?"invisible":void 0,children:o?e.jsx("button",{type:"button",onClick:o,title:s||void 0,"aria-label":d("usage.summary.toggle_aria"),className:"cursor-pointer rounded-lg leading-none transition-opacity hover:opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand",children:ge}):e.jsx("span",{title:s||void 0,children:ge})}),e.jsx("div",{className:`absolute inset-0 flex items-center justify-center ${Q?"":"hidden"}`,children:e.jsx(Nc,{})})]}),u&&e.jsx("div",{className:"flex items-center justify-center gap-2 mt-4",children:l?e.jsxs("button",{type:"button",onClick:l,className:"inline-flex items-center gap-1.5 text-xl font-bold text-oai-brand hover:text-oai-brand-dark dark:hover:text-oai-brand-light transition-colors cursor-pointer","aria-label":d("usage.overview.cost_breakdown_aria"),children:[u,e.jsx(Fn,{size:16,strokeWidth:2,className:"opacity-80"})]}):e.jsx("span",{className:"text-xl font-bold text-oai-brand",children:u})})]}),e.jsx("div",{className:z?void 0:"hidden",children:e.jsx(Sc,{})}),V.length>0&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{role:"img","aria-label":d("usage.overview.distribution_aria",{items:V.map(C=>d("usage.overview.distribution_item",{label:wt(C.label),percent:Xa(C)})).join(",")}),className:"h-1.5 w-full bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden flex",children:V.map((C,B)=>{const F=Qa(C.label,B),K=wt(C.label),ne=Xa(C);return e.jsx(_e.div,{initial:{width:0},animate:{width:`${Jn(C)}%`},transition:{duration:.5,delay:.45+B*.04,ease:[.16,1,.3,1]},className:"h-full",style:{backgroundColor:F},title:`${K}: ${ne}%`},C.label)})}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-3",children:V.map((C,B)=>{const F=Qa(C.label,B),K=H===C.label,ne=wt(C.label),we=Xa(C);return e.jsxs("button",{"aria-expanded":K,"aria-controls":`provider-details-${C.label}`,"aria-label":d("usage.overview.provider_card_aria",{provider:ne,percent:we,tokens:xa(he,C.usage)||String(0),cost:Zn(C.usd,ce,oe)||`${wa(ce)}0`,action:d(K?"usage.overview.collapse":"usage.overview.expand")}),onClick:()=>le(K?null:C.label),className:`min-w-0 text-left p-3 rounded-lg border transition-colors duration-200 ${K?"border-oai-gray-300 dark:border-oai-gray-600 bg-oai-gray-50 dark:bg-oai-gray-800":"border-oai-gray-200 dark:border-oai-gray-700 hover:border-oai-gray-300 dark:hover:border-oai-gray-600"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1 min-w-0",children:[e.jsx(jt,{provider:C.label,size:15,color:F,className:"text-oai-gray-700 dark:text-oai-gray-300 shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white truncate",title:ne,children:ne})]}),e.jsxs("div",{className:"text-lg font-semibold text-oai-black dark:text-oai-white tabular-nums",children:[we,"%"]}),e.jsx("div",{className:"mt-0.5 text-[11px] text-oai-gray-400 dark:text-oai-gray-400 tabular-nums",children:d("usage.overview.model_count",{count:C.models.length})})]},C.label)})}),H&&e.jsx("div",{id:`provider-details-${H}`,role:"region","aria-label":d("usage.overview.model_details_aria",{provider:H}),className:"mt-2",children:V.filter(C=>C.label===H).map(C=>{const B=Qa(C.label,0),F=wc(C),K=[...C.models].sort((we,ve)=>(ve.share||0)-(we.share||0)),ne=F?`${F==="claude"?"Claude":"Codex"} Context Breakdown`:wt(C.label);return e.jsx(Tc,{provider:C,color:B,providerHeading:ne,contextSource:F,from:O,to:k,sortedModels:K},C.label)})})]})]})})}function Tc({provider:t,color:a,providerHeading:r,contextSource:n,from:s,to:o,sortedModels:i}){const{currency:u,rate:l}=va(),{formatTokens:g,formatTokensTooltip:h}=ze(),[f,m]=c.useState(!1),x=String(t?.source||t?.label||"").trim().toLowerCase()==="antigravity";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[e.jsx(jt,{provider:t.label,size:14,color:a,className:"shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:r}),n&&f&&e.jsx(Ai,{size:12,className:"text-oai-gray-400 dark:text-oai-gray-500 animate-spin shrink-0","aria-label":d("dashboard.context_breakdown.loading_aria")})]}),t.cacheHitRate!=null&&e.jsxs("p",{className:"mb-3 text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:[e.jsx("span",{className:"font-medium text-oai-gray-600 dark:text-oai-gray-300",children:d("usage.overview.cache_hit_rate_label")})," ",e.jsxs("span",{className:"text-oai-black dark:text-oai-white",children:[t.cacheHitRate,"%"]})," · ",d("usage.overview.cache_hit_rate_detail",{reused:xa(g,t.cacheReusedTokens)||String(0),input:xa(g,t.cacheInputTokens)||String(0)})]}),x&&e.jsxs("p",{className:"mb-3 text-[10px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsxs("span",{className:"font-medium text-oai-gray-500 dark:text-oai-gray-400",children:[d("usage.overview.antigravity_notice_title"),"."]})," ",d("usage.overview.antigravity_notice_body")]}),n?e.jsx("div",{className:"mb-4 pb-4 border-b border-oai-gray-200 dark:border-oai-gray-700",children:e.jsx(pc,{from:s,to:o,source:n,referenceTotalTokens:t.usage,onLoadingChange:m})}):null,e.jsx("div",{className:"space-y-3",children:i.map(p=>{const w=xa(g,p.usage),b=Zn(p.cost,u,l),v=Math.max(0,Math.min(100,Number(p.share)||0));return e.jsxs("div",{children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(8rem,max-content)_minmax(5.5rem,max-content)_4rem] items-baseline gap-x-3 mb-1.5",children:[e.jsx("span",{className:"col-start-1 row-start-1 min-w-0 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate",title:p.name,children:p.name}),e.jsx("span",{title:h(p.usage),className:"col-start-2 row-start-1 text-right whitespace-nowrap text-sm text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:w}),e.jsx("span",{className:"col-start-3 row-start-1 text-right whitespace-nowrap text-sm text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:b}),e.jsxs("span",{className:"col-start-4 row-start-1 text-right whitespace-nowrap text-sm text-oai-black dark:text-oai-white tabular-nums",children:[p.share,"%"]})]}),e.jsx("div",{className:"h-[3px] bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden",role:"progressbar","aria-valuenow":v,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:"h-full transition-[width] duration-500 ease-out",style:{width:`${v}%`,backgroundColor:a,opacity:.45}})})]},p.id||p.name)})})]})}function Ac({id:t,children:a,onEmptyChange:r}){const{attributes:n,listeners:s,setNodeRef:o,transform:i,transition:u,isDragging:l}=ti({id:t}),g=c.useRef(null),h=c.useRef(null);c.useLayoutEffect(()=>{if(!r)return;const m=g.current?g.current.childNodes.length===0:!0;h.current!==m&&(h.current=m,r(t,m))});const f={transform:ai.Transform.toString(i)||void 0,transition:u,zIndex:l?20:void 0};return e.jsxs("div",{ref:o,style:f,className:_t("group/sortable relative has-[[data-sortable-body]:empty]:hidden",l&&"opacity-90"),children:[e.jsx("button",{type:"button","aria-label":d("dashboard.overview.layout.drag_handle"),className:_t("peer absolute left-1/2 top-1 z-10 flex h-5 w-6 -translate-x-1/2 items-center justify-center rounded-md","cursor-grab active:cursor-grabbing touch-none select-none","text-oai-gray-400 dark:text-oai-gray-600 opacity-0 transition-colors duration-150","hover:text-oai-gray-600 dark:hover:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800","group-hover/sortable:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50",l&&"opacity-100 bg-oai-gray-100 dark:bg-oai-gray-800"),...n,...s,children:e.jsxs("svg",{viewBox:"0 0 14 8",width:"14",height:"8",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"6",r:"1"}),e.jsx("circle",{cx:"7",cy:"2",r:"1"}),e.jsx("circle",{cx:"7",cy:"6",r:"1"}),e.jsx("circle",{cx:"12",cy:"2",r:"1"}),e.jsx("circle",{cx:"12",cy:"6",r:"1"})]})}),e.jsx("div",{ref:g,"data-sortable-body":!0,className:_t("rounded-xl transition-shadow duration-200 ease-out","peer-hover:shadow-[0_12px_28px_-14px_rgba(15,23,42,0.22)] dark:peer-hover:shadow-[0_12px_28px_-12px_rgba(0,0,0,0.6)]","peer-focus-visible:shadow-[0_12px_28px_-14px_rgba(15,23,42,0.22)] dark:peer-focus-visible:shadow-[0_12px_28px_-12px_rgba(0,0,0,0.6)]",l&&"shadow-[0_12px_28px_-14px_rgba(15,23,42,0.22)] dark:shadow-[0_12px_28px_-12px_rgba(0,0,0,0.6)]"),children:a})]})}function Dc({todayTokens:t=0,isSyncing:a=!1,hasError:r=!1,isDisconnected:n=!1}={}){return c.useMemo(()=>r?"error":n?"disconnected":a?"working-typing":t===0?"sleeping":t<5e4?"idle-living":t<2e5?"idle-look":t<5e5?"working-ultrathink":t<2e6?"working-typing":"working-ultrathink",[t,a,r,n])}const ln="macAppBannerDismissed",Lc="leaderboardBannerDismissed",Mc="https://github.com/mm7894215/TokenTracker/releases/latest",cn="tokentracker_native_app",ua=(()=>{try{return new URLSearchParams(window.location.search).get("app")==="1"?(localStorage.setItem(cn,"1"),!0):localStorage.getItem(cn)==="1"}catch{return!1}})();function Ec({todayTokens:t=0,isSyncing:a=!1,enterDelay:r=0}){const{openLoginModal:n}=$o(),{signedIn:s}=Ln(),o=Dc({todayTokens:t,isSyncing:a}),i=ua?Lc:ln,[u,l]=c.useState(()=>{try{return localStorage.getItem(i)==="1"?!0:!ua&&new URLSearchParams(window.location.search).get("from")==="menubar"?(localStorage.setItem(ln,"1"),!0):!1}catch{return!1}}),g=c.useCallback(()=>{l(!0);try{localStorage.setItem(i,"1")}catch{}},[i]);if(u)return null;let h,f,m,x,p,w;ua&&s?(h="View the Leaderboard",f="Compare your usage globally",m="Leaderboard",x=e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:e.jsx("path",{d:"M2 8.5V10h8V8.5M6 1.5v6m0 0L3.5 5M6 7.5l2.5-2.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(180 6 6)"})}),p=()=>{window.location.pathname="/leaderboard"}):ua?(h="Join the Leaderboard",f="Log in to compare your usage with others",m="Log In",x=e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:e.jsx("path",{d:"M6.5 1.5h3a1 1 0 011 1v7a1 1 0 01-1 1h-3M5 8.5L7.5 6 5 3.5M7.5 6H1.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),p=n):(h="Try the Menu Bar App",f="Always-on stats with Clawd companion",m="Download",x=e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:e.jsx("path",{d:"M6 2v6m0 0L3.5 5.5M6 8l2.5-2.5M2 10h8",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),w=Mc);const b=w?_e.a:_e.button,v=w?{href:w,target:"_blank",rel:"noopener noreferrer"}:{onClick:p};return e.jsx(_e.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35,delay:r,ease:[.16,1,.3,1]},className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(Di,{state:o,size:56})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-oai-gray-900 dark:text-oai-white",children:h}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-0.5",children:f})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(b,{...v,whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-oai-gray-900 dark:bg-oai-white dark:text-oai-gray-900 rounded-md hover:opacity-90 transition-opacity",children:[m,x]}),e.jsx("button",{onClick:g,className:"p-1 text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-300 transition-colors","aria-label":"Dismiss",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:e.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})})]})]})})}const dn="widgetOnboardingDismissed",un="tokentracker_native_app",Rc=(()=>{try{return new URLSearchParams(window.location.search).get("app")==="1"?(localStorage.setItem(un,"1"),!0):localStorage.getItem(un)==="1"}catch{return!1}})();function Ic({enterDelay:t=0}){const[a,r]=c.useState(()=>{try{return localStorage.getItem(dn)==="1"}catch{return!1}}),n=c.useCallback(()=>{r(!0);try{localStorage.setItem(dn,"1")}catch{}},[]);return!Rc||Po()?null:e.jsx(fr,{initial:!1,children:!a&&e.jsxs(_e.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-8,transition:{duration:.2,ease:[.4,0,.2,1]}},transition:{duration:.35,delay:t,ease:[.16,1,.3,1]},className:"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:[e.jsx("button",{type:"button",onClick:n,"aria-label":d("dashboard.widgets.dismiss_aria"),className:"absolute top-2.5 right-2.5 z-10 inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-300 dark:focus-visible:ring-oai-gray-600 transition-colors",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}),e.jsx("div",{className:"rounded-lg overflow-hidden ring-1 ring-black/5 dark:ring-white/10 shadow-sm",children:e.jsx("img",{src:"/widgets-overview.png",alt:d("dashboard.widgets.title"),width:734,height:552,className:"w-full h-auto block",loading:"lazy",decoding:"async"})}),e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"text-sm font-medium tracking-tight text-oai-gray-900 dark:text-oai-white",children:d("dashboard.widgets.title")}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1 leading-snug",children:d("dashboard.widgets.hint")})]})]},"widget-onboarding-card")})}function Fc({enabled:t=!1,from:a,to:r,accessToken:n,deviceId:s=null}={}){const[o,i]=c.useState(null),[u,l]=c.useState(!1),[g,h]=c.useState(null),f=Ot([t,a,r,n,s]),m=c.useCallback(async()=>{if(!t)return;const x=f();l(!0),h(null);try{const p=await Ie(n);if(!x())return;const w=await zo({from:a,to:r,device:s,accessToken:p});if(!x())return;i(w||null)}catch(p){if(!x())return;h(p?.message||String(p)),i(null)}finally{x()&&l(!1)}},[t,a,r,n,s,f]);return c.useEffect(()=>{if(!t){i(null),h(null),l(!1);return}i(null),h(null),l(!0),m()},[t,m]),{data:o,loading:u,error:g,refresh:m}}function Qn(t){return t==null?"—":t===0?"$0":t<1?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`}function Xn(t){return t==null?"—":`${Math.round(t*100)}%`}function $c(t,a){if(a==null||a===0||t==null||t===0)return"—";const r=t/a;return r<1?`$${r.toFixed(4)}`:`$${r.toFixed(2)}`}function Pc({row:t}){return e.jsxs("tr",{className:"border-t border-oai-gray-100 dark:border-oai-gray-800/60 hover:bg-oai-gray-50/40 dark:hover:bg-oai-gray-800/10 transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-2 font-mono text-[11px] text-oai-gray-700 dark:text-oai-gray-300 truncate max-w-[80px] xs:max-w-[110px] sm:max-w-[140px]",title:t.key,children:t.key}),e.jsx("td",{className:"py-2.5 px-1.5 text-right tabular-nums text-oai-gray-600 dark:text-oai-gray-400",children:Qn(t.cost_usd)}),e.jsxs("td",{className:"py-2.5 px-1.5 text-right tabular-nums text-oai-gray-600 dark:text-oai-gray-400",children:[t.accepted,"/",t.outcomes]}),e.jsx("td",{className:"py-2.5 px-1.5 text-right tabular-nums text-oai-gray-600 dark:text-oai-gray-400",children:Xn(t.acceptance_rate)}),e.jsx("td",{className:"py-2.5 pl-2 pr-2 text-right tabular-nums font-semibold text-oai-black dark:text-oai-white",children:$c(t.cost_usd,t.accepted)})]})}function zc({from:t,to:a,deviceId:r=null}){const{formatTokens:n,formatTokensTooltip:s}=ze(),{enabled:o}=Li(),{data:i,loading:u}=Fc({enabled:o,from:t,to:a,deviceId:r});if(!o)return null;const l=(i&&i.available&&Array.isArray(i.by_model)?i.by_model:[]).filter(m=>m.outcomes>0&&m.key!=="unknown");if(!l.length)return null;const g=l.slice(0,6),h=i.totals||{},f=`${d("qpd.card.subtitle")}${u?` ${d("qpd.card.updating")}`:""}`;return e.jsxs(Re,{children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:d("qpd.card.title")}),e.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase",children:d("qpd.card.badge")})]}),e.jsx("p",{className:"mb-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:f}),e.jsx("div",{className:"w-full overflow-x-auto oai-scrollbar",children:e.jsxs("table",{className:"w-full text-xs min-w-[340px] sm:min-w-0",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("th",{className:"pb-1.5 pr-2 text-left font-medium",children:d("qpd.card.col_model")}),e.jsx("th",{className:"pb-1.5 px-1.5 text-right font-medium",children:d("qpd.card.col_cost")}),e.jsx("th",{className:"pb-1.5 px-1.5 text-right font-medium",children:d("qpd.card.col_accepted")}),e.jsx("th",{className:"pb-1.5 px-1.5 text-right font-medium",children:d("qpd.card.col_rate")}),e.jsx("th",{className:"pb-1.5 pl-2 pr-2 text-right font-medium",title:d("qpd.card.qpd_tooltip"),children:d("qpd.card.col_qpd")})]})}),e.jsx("tbody",{children:g.map(m=>e.jsx(Pc,{row:m},m.key))})]})}),e.jsxs("div",{className:"mt-3 flex items-center justify-between border-t border-oai-gray-200 dark:border-oai-gray-800 pt-2.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:d("qpd.card.totals",{accepted:h.accepted??0,outcomes:h.outcomes??0,cost:Qn(h.cost_usd)})}),e.jsx("span",{title:`${d("qpd.card.et_tooltip")} · ${s(h.effective_tokens)}`,children:d("qpd.card.et",{tokens:n(h.effective_tokens),rate:Xn(h.acceptance_rate)})})]}),h.outcomes<15&&e.jsxs("p",{className:"mt-3 text-[10px] text-oai-gray-400 dark:text-oai-gray-500 italic border-t border-oai-gray-100 dark:border-oai-gray-800/40 pt-2",children:["* ",d("qpd.card.sparse_notice","Tip: Spark outcomes dataset might skew Quality/$ ratios. For precise metrics, select a narrower time window.")]})]})}function te({className:t}){return e.jsx("div",{className:_t("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function Bc(){return e.jsx("div",{className:"flex gap-1 overflow-hidden",children:Array.from({length:20},(t,a)=>e.jsx("div",{className:"flex flex-col gap-1",children:Array.from({length:7},(r,n)=>e.jsx(te,{className:"h-2.5 w-2.5 rounded-[2px]"},n))},a))})}function Oc(){return e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[e.jsxs("div",{className:"lg:col-span-4 flex flex-col gap-4 min-w-0 order-2 lg:order-1",children:[e.jsx(Re,{children:e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx(te,{className:"h-4 w-32"}),e.jsx(te,{className:"h-6 w-24"})]})}),e.jsx(Re,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(te,{className:"h-3.5 w-24"}),Array.from({length:4},(t,a)=>e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(te,{className:"h-3 w-20"}),e.jsx(te,{className:"h-3 w-12"})]},a))]})}),e.jsx(Re,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(te,{className:"h-3.5 w-20"}),e.jsx(Bc,{})]})}),e.jsx(Re,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(te,{className:"h-3.5 w-28"}),e.jsx(te,{className:"h-32 w-full"})]})})]}),e.jsxs("div",{className:"lg:col-span-8 flex flex-col gap-4 min-w-0 order-1 lg:order-2",children:[e.jsxs(Re,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[e.jsx("div",{className:"flex flex-1 min-w-0 gap-1",children:Array.from({length:5},(t,a)=>e.jsx(te,{className:"h-7 w-14 rounded-md shrink-0"},a))}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(te,{className:"h-8 w-20 rounded-md"}),e.jsx(te,{className:"h-8 w-8 rounded-md"})]})]}),e.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[e.jsx(te,{className:"h-3 w-28"}),e.jsx(te,{className:"h-14 w-3/5 max-w-xs"}),e.jsx(te,{className:"h-6 w-24"})]}),e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(te,{className:"h-1.5 w-full rounded-full"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-5 gap-3",children:Array.from({length:5},(t,a)=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(te,{className:"h-[15px] w-[15px] rounded-sm shrink-0"}),e.jsx(te,{className:"h-3 w-12"})]}),e.jsx(te,{className:"h-5 w-10"}),e.jsx(te,{className:"h-2.5 w-14"})]},a))})]})]}),e.jsxs(Re,{children:[e.jsxs("div",{className:"flex items-center gap-1 mb-4",children:[e.jsx(te,{className:"h-7 w-16 rounded"}),e.jsx(te,{className:"h-7 w-20 rounded"})]}),e.jsxs("div",{className:"flex items-center gap-3 border-b border-oai-gray-200 dark:border-oai-gray-700 pb-2",children:[e.jsx(te,{className:"h-3 w-20 shrink-0"}),Array.from({length:5},(t,a)=>e.jsx(te,{className:"h-3 flex-1"},a))]}),e.jsx("div",{className:"flex flex-col",children:Array.from({length:8},(t,a)=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-oai-gray-100 dark:border-oai-gray-800 py-2.5 last:border-b-0",children:[e.jsx(te,{className:"h-3.5 w-20 shrink-0"}),Array.from({length:5},(r,n)=>e.jsx(te,{className:"h-3.5 flex-1"},n))]},a))})]})]})]})}const Uc=Ri.slice(0,10),mn=.06,Hc=.11,Vc=.05,Wc=new Set(["macAppBanner","widgetOnboarding"]);function hn({title:t,subtitle:a,desc:r,loginCard:n,copy:s}){return e.jsxs("div",{className:"min-h-[85vh] w-full flex items-center justify-center text-oai-black dark:text-white relative overflow-hidden px-4 md:px-8 py-8 md:py-16 transition-colors duration-200 bg-[linear-gradient(to_right,#80808007_1px,transparent_1px),linear-gradient(to_bottom,#80808007_1px,transparent_1px)] bg-[size:40px_40px]",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_50%_0%,rgba(59,130,246,0.03),transparent_50%)] dark:bg-[radial-gradient(circle_at_50%_0%,rgba(99,102,241,0.05),transparent_50%)] pointer-events-none"}),e.jsxs("div",{className:"w-full max-w-5xl grid grid-cols-1 lg:grid-cols-12 gap-8 lg:gap-16 items-start relative z-10",children:[e.jsxs("div",{className:"lg:col-span-7 flex flex-col justify-center space-y-8 text-left pr-0 lg:pr-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:32,height:32,className:"rounded-md shadow-md border border-oai-gray-200/50 dark:border-oai-gray-800 shadow-black/10 dark:shadow-black/30"}),e.jsx("span",{className:"text-xl font-bold tracking-tight bg-gradient-to-r from-oai-black to-oai-gray-600 dark:from-white dark:to-oai-gray-400 bg-clip-text text-transparent font-oai",children:s("shared.app_name")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h1",{className:"text-3xl md:text-4xl lg:text-4.5xl font-black tracking-tight leading-[1.15] text-oai-black dark:text-white",children:t}),e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm md:text-base max-w-xl leading-relaxed",children:r})]}),e.jsx("div",{className:"w-full max-w-[280px] sm:max-w-md opacity-85 hover:opacity-100 transition-opacity duration-200",children:e.jsx("div",{className:"flex justify-start",children:e.jsx(Ei,{logos:Uc,columnCount:6})})})]})]}),e.jsx("div",{className:"lg:col-span-5 flex justify-center",children:e.jsxs(_e.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3},className:"w-full max-w-[400px] rounded-2xl border border-oai-gray-200/80 dark:border-oai-gray-800 bg-white/70 dark:bg-oai-gray-950/40 backdrop-blur-md shadow-2xl p-1 relative overflow-hidden",children:[e.jsx("div",{className:"absolute -inset-px bg-gradient-to-b from-white/10 dark:from-white/5 to-transparent pointer-events-none rounded-2xl"}),n]})})]})]})}function Kc(t){const{copy:a,onOpenShare:r,screenshotMode:n,showExpiredGate:s,showAuthGate:o,identityDisplayName:i,identityStartDate:u,activeDays:l,identitySubscriptions:g,identityScrambleDurationMs:h,projectUsageEntries:f,projectUsageLimit:m,setProjectUsageLimit:x,projectDetailQuery:p,topModels:w,signedIn:b,publicMode:v,isLocalMode:_,shouldShowInstall:D,installPrompt:T,handleCopyInstall:M,installCopied:L,installInitCmdDisplay:O,trendRowsForDisplay:k,trendFromForDisplay:j,trendToForDisplay:A,trendZoomConfig:P,usageFrom:U,usageTo:W,period:E,trendTimeZoneLabel:R,activityHeatmapBlock:q,periodsForDisplay:N,setSelectedPeriod:S,customFrom:Y,customTo:H,onCustomRangeApply:le,customRangeOpen:J,onCustomRangeOpenChange:ce,summaryLabel:oe,summaryValue:he,summaryFullValue:ye,hasSummary:de,summaryLoading:ee,providersLoading:Q,onToggleSummaryFormat:z,summaryTotalTokensRaw:X,summaryCostValue:ge,summaryConversationsValue:V,rollingUsage:C,costInfoEnabled:B,openCostModal:F,costModalOpen:K,closeCostModal:ne,allowBreakdownToggle:we,refreshAll:ve,usageLoadingState:De,announceUsageLoading:Ne,initialDashboardLoading:Ut,fleetData:ue,hasDetailsActual:Fe,dailyEmptyPrefix:Be,installSyncCmd:je,dailyEmptySuffix:St,detailsColumns:fe,ariaSortFor:xe,toggleSort:Le,sortIconFor:Oe,pagedDetails:Ct,dailyBreakdownRows:ct,dailyBreakdownColumns:Ue,dailyBreakdownAriaSortFor:ja,dailyBreakdownSortIconFor:Ze,dailyBreakdownDateKey:Na,detailsDateKey:Sa,renderDetailDate:dt,renderDailyBreakdownDate:Z,renderDetailCell:Ht,DETAILS_PAGED_PERIODS:be,detailsPageCount:ke,detailsPage:Me,setDetailsPage:ut,deviceOptions:Vt,selectedDevice:Tt,onDeviceChange:Ca,deviceUsageBlock:He,leftCardOrder:Wt,onLeftReorder:et,rightCardOrder:At,onRightReorder:Kt}=t,Ta=null,Gt=null,[mt,Aa]=c.useState(()=>new Set),Dt=c.useCallback((se,ae)=>{Wc.has(se)&&Aa(ie=>{if(ie.has(se)===ae)return ie;const Je=new Set(ie);return ae?Je.add(se):Je.delete(se),Je})},[]),Lt={macAppBanner:_,statsPanel:!0,widgetOnboarding:_,installCopy:D,activityHeatmap:!!q,deviceUsage:!!He,trendMonitor:!n,qualityPerDollar:!n},Da=(Wt||[]).filter(se=>Lt[se]&&!mt.has(se)),tt={usageOverview:!0,dataDetails:!n},qt=(At||[]).filter(se=>tt[se]&&!mt.has(se));function Ve(se,ae){switch(se){case"macAppBanner":return e.jsx(Ec,{todayTokens:X,isSyncing:De,enterDelay:ae});case"statsPanel":return e.jsx(at,{delay:ae,children:e.jsx(Wl,{title:a("dashboard.identity.title"),subtitle:a("dashboard.identity.subtitle"),period:E,startDate:u??a("identity_card.rank_placeholder"),streakDays:l,subscriptions:g,periodConversations:V,rolling:C,topModels:w})});case"widgetOnboarding":return e.jsx(Ic,{enterDelay:ae});case"installCopy":return e.jsx(at,{delay:ae,children:e.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-3",children:[e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 mb-1.5",children:T}),e.jsxs(_e.button,{onClick:M,whileHover:{scale:1.01},whileTap:{scale:.99},className:"w-full flex items-center justify-between px-3 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 rounded-lg transition-colors",children:[e.jsx("code",{className:"text-xs font-mono text-oai-gray-700 dark:text-oai-gray-300",children:O}),e.jsx(_e.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-brand",children:L?"Copied ✓":"Copy"},L?"copied":"copy")]})]})});case"activityHeatmap":return e.jsx(at,{delay:ae,children:q});case"deviceUsage":return e.jsx(at,{delay:ae,children:He});case"trendMonitor":return e.jsx(at,{delay:ae,children:e.jsx(Mn,{rows:k,from:j,to:A,period:E,timeZoneLabel:R,showTimeZoneLabel:!1,zoomConfig:P})});case"qualityPerDollar":return e.jsx(zc,{from:U,to:W,deviceId:Tt});default:return null}}function me(se,ae){switch(se){case"usageOverview":return e.jsx(at,{delay:ae,children:e.jsx(Cc,{period:E,periods:N,onPeriodChange:S,summaryLabel:oe,summaryValue:he,summaryFullValue:ye,hasSummary:de,summaryLoading:ee,providersLoading:Q,onToggleSummaryFormat:de?z:null,summaryCostValue:ge,onCostInfo:B?F:null,fleetData:ue,onRefresh:n?null:ve,loading:De,announceLoading:Ne,onOpenShare:n?null:r,customFrom:Y,customTo:H,onCustomRangeApply:le,customRangeOpen:J,onCustomRangeOpenChange:ce,from:U,to:W,deviceOptions:Vt,selectedDevice:Tt,onDeviceChange:Ca})});case"dataDetails":return e.jsx(at,{delay:ae,children:e.jsx(Hl,{projectEntries:f,projectLimit:m,onProjectLimitChange:x,projectDetailQuery:p,copy:a,hasDetailsActual:Fe,dailyEmptyPrefix:Be,installSyncCmd:je,dailyEmptySuffix:St,detailsColumns:fe,ariaSortFor:xe,toggleSort:Le,sortIconFor:Oe,pagedDetails:Ct,dailyBreakdownRows:ct,dailyBreakdownColumns:Ue,dailyBreakdownAriaSortFor:ja,dailyBreakdownSortIconFor:Ze,dailyBreakdownDateKey:Na,detailsDateKey:Sa,renderDetailDate:dt,renderDailyBreakdownDate:Z,renderDetailCell:Ht,DETAILS_PAGED_PERIODS:be,period:E,detailsPageCount:ke,detailsPage:Me,setDetailsPage:ut})});default:return null}}const La=ri(Ur(ci,{activationConstraint:{distance:6}}),Ur(li,{coordinateGetter:ii})),Yt=c.useCallback(se=>{const{active:ae,over:ie}=se;!ie||ae.id===ie.id||et?.(String(ae.id),String(ie.id))},[et]),Zt=c.useCallback(se=>{const{active:ae,over:ie}=se;!ie||ae.id===ie.id||Kt?.(String(ae.id),String(ie.id))},[Kt]);function Jt(se,ae,ie,Je){return n?e.jsx(e.Fragment,{children:se.map((Ke,Mt)=>e.jsx(kt.Fragment,{children:ae(Ke,ie+mn*Mt)},Ke))}):e.jsx(ni,{sensors:La,onDragEnd:Je,children:e.jsx(si,{items:se,strategy:oi,children:se.map((Ke,Mt)=>e.jsx(Ac,{id:Ke,onEmptyChange:Dt,children:ae(Ke,ie+mn*Mt)},Ke))})})}const Qt=Jt(Da,Ve,Hc,Yt),Xt=Jt(qt,me,Vc,Zt);return e.jsxs(e.Fragment,{children:[e.jsxs(Gi,{bare:!n,hideHeader:n,header:Ta,footer:n?null:Gt,className:n?"screenshot-mode":"",children:[o&&e.jsx(hn,{title:a("dashboard.auth_gate.hero_title"),desc:a("dashboard.auth_gate.desc"),copy:a,loginCard:e.jsx(Fr,{title:a("dashboard.auth_gate.title"),subtitle:a("dashboard.auth_gate.subtitle"),hideLogo:!0,className:"bg-transparent rounded-xl"})}),s&&e.jsx(hn,{title:a("dashboard.expired_gate.hero_title"),desc:a("dashboard.expired_gate.desc"),copy:a,loginCard:e.jsx(Fr,{title:a("dashboard.expired_gate.title"),subtitle:a("dashboard.expired_gate.subtitle"),hideLogo:!0,className:"bg-transparent rounded-xl"})}),!o&&!s&&Ut&&e.jsx(Oc,{}),!o&&!s&&!Ut&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[e.jsx("div",{className:"lg:col-span-4 flex flex-col gap-4 min-w-0 order-2 lg:order-1",children:Qt}),e.jsx("div",{className:"lg:col-span-8 flex flex-col gap-4 min-w-0 order-1 lg:order-2",children:Xt})]})})]}),e.jsx(Fl,{isOpen:K,onClose:ne,fleetData:ue})]})}function Gc({from:t,to:a,timeZone:r,tzOffsetMinutes:n,accountView:s=!1,accountAccessToken:o=null,accountRevision:i=0}={}){const u=!!(s&&o),[l,g]=c.useState([]),[h,f]=c.useState([]),[m,x]=c.useState(!1),[p,w]=c.useState(null),b=Ot([u,t,a,r,n,o,i]),v=c.useCallback(async()=>{const _=b();if(!u){g([]),f([]),x(!1),w(null);return}x(!0),w(null);try{const D=await Ie(o);if(!_())return;const T=await Bo({from:t,to:a,timeZone:r,tzOffsetMinutes:n,accessToken:D});if(!_())return;g(Array.isArray(T?.devices)?T.devices:[]),f(Array.isArray(T?.account_sources)?T.account_sources:[])}catch(D){if(!_())return;w(D?.message||String(D)),g([]),f([])}finally{_()&&x(!1)}},[u,o,t,a,r,n,i,b]);return c.useEffect(()=>{g([]),f([]),w(null),u&&x(!0),v()},[u,v]),{devices:l,accountSources:h,loading:m,error:p,refresh:v}}const qc=/^Token Tracker \(dashboard\)(?: #([0-9a-fA-F]+))?$/;function gn(t){const a=String(t||"").toLowerCase();return/iphone|ipad|ios/.test(a)?"iOS":/android/.test(a)?"Android":/mac|darwin/.test(a)?"Mac":/win/.test(a)?"Windows":/linux/.test(a)?"Linux":"Web"}function ir(t){if(!t)return null;const a=typeof t.device_name=="string"?t.device_name.trim():"",r=a.match(qc);if(!r)return a||null;const n=(r[1]||String(t.id||"")).slice(0,8).toLowerCase();return n?`${gn(t.platform)} · ${n}`:gn(t.platform)}const fn=" · ",xn="%";function pn({platform:t,className:a}){const r=String(t||"").toLowerCase();return r.includes("darwin")||r.includes("mac")?e.jsx(zi,{className:a,"aria-hidden":!0}):r.includes("win")?e.jsx($r,{className:a,"aria-hidden":!0}):r.includes("linux")?e.jsx($r,{className:a,"aria-hidden":!0}):e.jsx($n,{className:a,"aria-hidden":!0})}function Yc({devices:t=[],accountSources:a=[],selectedDeviceId:r="",onSelectDevice:n,onRenameDevice:s}){const{formatTokens:o,formatTokensTooltip:i}=ze(),[u,l]=c.useState(""),[g,h]=c.useState(""),[f,m]=c.useState(!1),[x,p]=c.useState(""),w=typeof s=="function",b=typeof n=="function",v=!!r,_=t.reduce((k,j)=>k+(Number(j.total_tokens)||0),0)+a.reduce((k,j)=>k+(Number(j.total_tokens)||0),0),D=c.useMemo(()=>t.filter(k=>(Number(k.total_tokens)||0)>0).sort((k,j)=>(Number(j.total_tokens)||0)-(Number(k.total_tokens)||0)),[t]);function T(k){p(""),l(k.id);const j=typeof k.device_name=="string"?k.device_name:"";h(ir(k)===j?j:"")}function M(){l(""),h(""),p("")}async function L(k){const j=g.trim();if(!(!j||f)){m(!0),p("");try{await s(k.id,j),l(""),h("")}catch{p(k.id)}finally{m(!1)}}}const O=a.filter(k=>(Number(k.total_tokens)||0)>0);return D.length===0&&O.length===0?e.jsxs(Re,{bodyClassName:"!px-3 !py-3.5",children:[e.jsx("div",{className:"flex items-center justify-between gap-2 mb-2 px-2",children:e.jsx("div",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide px-2",children:d("dashboard.device_card.title")})}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-6 text-center",children:[e.jsx($n,{className:"h-7 w-7 text-oai-gray-300 dark:text-oai-gray-600 mb-2 stroke-[1.5]"}),e.jsx("p",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 font-medium",children:d("dashboard.device_card.empty")})]})]}):e.jsxs(Re,{bodyClassName:"!px-3 !py-3.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2 px-2",children:[e.jsx("div",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:d("dashboard.device_card.title")}),b&&v&&e.jsx("button",{type:"button",onClick:()=>n(""),className:"text-xs text-oai-gray-400 hover:text-oai-brand focus:outline-none transition-colors",children:d("dashboard.device_card.clear")})]}),e.jsxs("div",{className:"space-y-[2px]",children:[D.map(k=>{const j=Number(k.total_tokens)||0,A=_>0?(j/_*100).toFixed(1):"0.0",P=r===k.id,U=ir(k)||d("dashboard.device_card.unnamed"),W=u===k.id,E=P?"bg-oai-brand":v?"bg-oai-gray-300 dark:bg-oai-gray-600":"bg-oai-brand/50",R=v&&!P?"opacity-40 hover:opacity-80":"opacity-100";return e.jsxs("div",{className:"group relative",children:[W?e.jsxs("div",{className:"w-full rounded-md px-2 py-1.5 bg-oai-gray-50/50 dark:bg-oai-gray-900/40",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(pn,{platform:k.platform,className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400"}),e.jsx("input",{autoFocus:!0,value:g,disabled:f,maxLength:60,placeholder:d("dashboard.device_card.rename_placeholder"),onChange:q=>h(q.target.value),onKeyDown:q=>{q.key==="Enter"?L(k):q.key==="Escape"&&M()},className:"flex-1 min-w-0 bg-transparent text-xs font-medium text-oai-black dark:text-oai-white border-b border-oai-gray-300 dark:border-oai-gray-700 focus:outline-none focus:border-oai-brand py-0"})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-0.5",children:[e.jsx("button",{type:"button","aria-label":d("dashboard.device_card.rename_save"),disabled:f||!g.trim(),onClick:()=>L(k),className:"text-oai-gray-400 hover:text-oai-brand dark:hover:text-white disabled:opacity-30 transition-colors p-0.5",children:e.jsx(Ii,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button","aria-label":d("dashboard.device_card.rename_cancel"),disabled:f,onClick:M,className:"text-oai-gray-400 hover:text-oai-black dark:hover:text-white disabled:opacity-30 transition-colors p-0.5",children:e.jsx(gr,{className:"h-3.5 w-3.5"})})]})]}),e.jsx("div",{className:"mt-1.5 h-[2px] bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden opacity-40 select-none",children:e.jsx("div",{className:`h-full rounded-full transition-[width,background-color] duration-700 ease-out ${E}`,style:{width:`${A}%`}})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button","aria-pressed":P,"aria-label":`${d("dashboard.device_filter.aria")}: ${U}`,onClick:()=>n?.(P?"":k.id),className:`w-full text-left rounded-md px-2 py-1.5 transition-all duration-200 focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-oai-brand/50 ${R} ${P?"bg-oai-gray-100/70 dark:bg-oai-gray-800/80 text-oai-black dark:text-oai-white":"bg-transparent hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 text-oai-black dark:text-oai-white"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(pn,{platform:k.platform,className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400"}),e.jsx("span",{className:"block truncate text-[13px] font-medium text-oai-black dark:text-oai-white",title:U,children:U})]}),e.jsxs("span",{title:i(j),className:`shrink-0 text-[13px] font-semibold tabular-nums text-oai-black dark:text-oai-white transition-opacity duration-150 ${w?"group-hover:opacity-0":""}`,children:[o(j),e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500 font-normal",children:[fn,A,xn]})]})]}),e.jsx("div",{className:"mt-1.5 h-[2px] bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-[width,background-color] duration-700 ease-out ${E}`,style:{width:`${A}%`}})})]}),w&&e.jsx("button",{type:"button","aria-label":d("dashboard.device_card.rename_aria"),onClick:()=>T(k),className:"absolute right-2 top-1.5 flex h-4 items-center text-oai-gray-400 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 hover:text-oai-brand focus:outline-none transition-opacity duration-150",children:e.jsx(Mi,{className:"h-3 w-3"})})]}),x===k.id&&e.jsx("div",{className:"px-2 mt-1 text-xs text-red-500 font-medium",children:d("dashboard.device_card.rename_error")})]},k.id)}),O.map(k=>{const j=Number(k.total_tokens)||0,A=_>0?(j/_*100).toFixed(1):"0.0",P=v?"opacity-40":"opacity-100";return e.jsxs("div",{className:`rounded-md px-2 py-1.5 transition-all duration-200 ${P}`,title:d("dashboard.device_card.account_scope_tip"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx("span",{className:"h-3.5 w-3.5 shrink-0 flex items-center justify-center",children:e.jsx(jt,{provider:k.source,size:14})}),e.jsx("span",{className:"block truncate text-[13px] font-medium text-oai-black dark:text-oai-white",children:wt(k.source)}),e.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:d("dashboard.device_card.account_scope")})]}),e.jsxs("span",{title:i(j),className:"shrink-0 text-[13px] font-semibold tabular-nums text-oai-black dark:text-oai-white",children:[o(j),e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500 font-normal",children:[fn,A,xn]})]})]}),e.jsx("div",{className:"mt-1.5 h-[2px] bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-[width,background-color] duration-700 ease-out ${v?"bg-oai-gray-300 dark:bg-oai-gray-600":"bg-oai-brand/50"}`,style:{width:`${A}%`}})})]},`account-${k.source}`)})]})]})}function es(){return typeof window>"u"?!1:!!window?.webkit?.messageHandlers?.nativeBridge}const ot=new Map,it=new Map;function ts(){typeof window>"u"||window.__tokentrackerNativeSaveListener||(window.__tokentrackerNativeSaveListener=!0,window.addEventListener("native:saveImageResult",t=>{const a=t?.detail||{},r=typeof a.requestId=="string"?a.requestId:null;if(!r||!ot.has(r))return;const n=ot.get(r);ot.delete(r),n({ok:!!a.ok,path:typeof a.path=="string"?a.path:void 0,error:typeof a.error=="string"?a.error:void 0})}),window.addEventListener("native:copyImageResult",t=>{const a=t?.detail||{},r=typeof a.requestId=="string"?a.requestId:null;if(!r||!it.has(r))return;const n=it.get(r);it.delete(r),n({ok:!!a.ok,error:typeof a.error=="string"?a.error:void 0})}))}async function Zc(t){if(!es()||typeof window>"u")return{ok:!1,error:"native bridge unavailable"};const a=window?.webkit?.messageHandlers?.nativeBridge;if(!a)return{ok:!1,error:"native bridge unavailable"};ts();const r=`copy_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return new Promise(n=>{const s=window.setTimeout(()=>{it.has(r)&&(it.delete(r),n({ok:!1,error:"timeout"}))},8e3);it.set(r,o=>{window.clearTimeout(s),n(o)});try{a.postMessage({type:"action",name:"copyImageToClipboard",requestId:r,dataUrl:t})}catch(o){it.delete(r),window.clearTimeout(s),n({ok:!1,error:o?.message||String(o)})}})}async function yn(t,a){if(!es()||typeof window>"u")return{ok:!1,error:"native bridge unavailable"};const r=window?.webkit?.messageHandlers?.nativeBridge;if(!r)return{ok:!1,error:"native bridge unavailable"};ts();const n=`save_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return new Promise(s=>{const o=window.setTimeout(()=>{ot.has(n)&&(ot.delete(n),s({ok:!1,error:"timeout"}))},8e3);ot.set(n,i=>{window.clearTimeout(o),s(i)});try{r.postMessage({type:"action",name:"saveImageToDownloads",requestId:n,filename:a,dataUrl:t})}catch(i){ot.delete(n),window.clearTimeout(o),s({ok:!1,error:i?.message||String(i)})}})}const as=1200,rs=1630,ns={broadsheet:{width:1200,height:1630},"annual-report":{width:1080,height:1865}},Jc="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter+Tight:wght@400;500;600;700&family=IBM+Plex+Serif:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@500;600;700&display=swap";let er=!1;function Qc(){if(typeof document>"u"||er)return;if(document.querySelector('link[data-share-card-fonts="true"]')){er=!0;return}const a=document.createElement("link");a.rel="stylesheet",a.href=Jc,a.dataset.shareCardFonts="true",a.crossOrigin="anonymous",document.head.appendChild(a),er=!0}async function Xc(){if(typeof document>"u")return;const t=document.fonts;if(!(!t||typeof t.ready?.then!="function"))try{await t.ready}catch{}}async function ed(t,a={}){if(typeof window>"u"||!t)return null;Qc(),await Xc(),await new Promise(l=>requestAnimationFrame(()=>l(null)));const{toBlob:r,toPng:n}=await Oo(async()=>{const{toBlob:l,toPng:g}=await import("./index-BFIcLxb4.js");return{toBlob:l,toPng:g}},[]),s=a.pixelRatio??2,o=t.offsetWidth||as,i=t.offsetHeight||rs,u={pixelRatio:s,cacheBust:!0,width:o,height:i,style:{width:`${o}px`,height:`${i}px`},skipFonts:!1,filter:l=>!(l instanceof HTMLElement)||l.dataset?.screenshotExclude!=="true"};try{const l=await r(t,u);if(l)return l}catch{}try{const l=await n(t,u);return l?await(await fetch(l)).blob():null}catch{return null}}async function tr(t){return new Promise(a=>{const r=new FileReader;r.onload=()=>{const n=typeof r.result=="string"?r.result:null;a(n)},r.onerror=()=>a(null),r.readAsDataURL(t)})}function bn(t,a){if(typeof window>"u"||!t)return!1;try{const r=URL.createObjectURL(t),n=document.createElement("a");return n.href=r,n.download=a,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3),!0}catch{return!1}}function lr(t){const a=re(t);return Number.isFinite(a)?a:0}function td(t){return t?lr(t.billable_total_tokens??t.total_tokens):0}function ad(t){const a=Array.isArray(t?.weeks)?t.weeks:[];if(!a.length)return{weeks:[],totalDays:0,activeDays:0};let r=0,n=0;return{weeks:a.map(o=>(Array.isArray(o)?o:[]).slice(0,7).map(u=>{const l=!!u?.future,g=Number.isFinite(u?.level)?Math.max(0,Math.min(4,Math.round(u.level))):0;u?.day&&!l&&(r+=1,g>0&&(n+=1));const h=u?.billable_total_tokens??u?.total_tokens??u?.value??0,f=Number.isFinite(h)?Math.max(0,h):0;return{day:typeof u?.day=="string"?u.day:"",level:g,value:f,future:l}})),totalDays:r,activeDays:n}}function rd(t){const{handle:a,startDate:r,activeDays:n,summary:s,topModels:o,rank:i,period:u,periodFrom:l,periodTo:g,heatmap:h,capturedAt:f,currency:m,exchangeRate:x}=t,p=td(s),w=lr(s?.total_cost_usd),b=Array.isArray(o)?o.slice(0,3).map(_=>({id:_?.id??null,name:typeof _?.name=="string"&&_.name?_.name:"—",tokens:lr(_?.tokens),percent:typeof _?.percent=="string"&&_.percent?_.percent:"0.0"})):[],v=ad(h);return{handle:a||"—",startDate:r||null,activeDays:Number.isFinite(n)&&n>0?Math.floor(n):0,totalTokens:p,totalCost:w,period:u,periodFrom:l,periodTo:g,topModels:b,rank:typeof i=="number"&&Number.isFinite(i)&&i>0?Math.floor(i):null,heatmapWeeks:v.weeks,heatmapTotalDays:v.totalDays,heatmapActiveDays:v.activeDays,capturedAt:f||new Date().toISOString(),currency:typeof m=="string"&&m.length>0?m.toUpperCase():"USD",exchangeRate:Number.isFinite(x)&&x>0?x:1}}const nd=["share.month_short.jan","share.month_short.feb","share.month_short.mar","share.month_short.apr","share.month_short.may","share.month_short.jun","share.month_short.jul","share.month_short.aug","share.month_short.sep","share.month_short.oct","share.month_short.nov","share.month_short.dec"];function sd(t){const a=nd[t];return a?d(a):"—"}function ss(t,a){return d("share.date.month_year",{month:sd(t),year:a})}function od(t){if(!t)return"—";const a=t.split("-");if(a.length!==3)return t;const[r,n]=a,s=Number(n)-1;return s<0||s>11?t:ss(s,r)}function id(t){if(t.period==="total")return d("share.issue.all_time");if(t.period==="day"&&t.periodTo)return t.periodTo.replace(/-/g,".");if(t.period==="custom"&&t.periodFrom&&t.periodTo)return`${t.periodFrom.replace(/-/g,".")} — ${t.periodTo.replace(/-/g,".")}`;if(t.periodTo){const a=new Date(`${t.periodTo}T00:00:00Z`);if(!Number.isNaN(a.getTime()))return ss(a.getUTCMonth(),a.getUTCFullYear())}return d(`usage.period.${t.period}`)}function cr(t){return Number.isFinite(t)?Math.round(t).toLocaleString("en-US"):"—"}function os(t,a={}){const{currency:r="USD",rate:n=1}=a,s=wa(r);if(!Number.isFinite(t)||t<=0)return`${s}0.00`;const o=r!=="USD"&&Number.isFinite(n)&&n>0?t*n:t;return o>=1e3?`${s}${Math.round(o).toLocaleString("en-US")}`:`${s}${o.toFixed(2)}`}function ld(t){const a=t.topModels[0];if(a){const r=parseFloat(a.percent);return Number.isFinite(r)&&r>=60?d("share.hook.top_loyal",{percent:Math.round(r),name:a.name}):t.activeDays>=60?d("share.hook.days_record",{days:t.activeDays}):Number.isFinite(r)&&r>=30?d("share.hook.top_led",{name:a.name,percent:Math.round(r)}):t.topModels.length>1?d("share.hook.multi_models",{count:t.topModels.length,days:t.activeDays}):d("share.hook.days_with_model",{days:t.activeDays,name:a.name})}return t.activeDays>0?d("share.hook.days_record",{days:t.activeDays}):d("share.hook.new_chapter")}function cd(t,a){const r=(t||"").length;if(r<=a.baseChars)return a.baseSize;const n=a.baseSize-(r-a.baseChars)*a.shrinkPerChar;return Math.max(a.minSize,n)}function dd(t){if(!t||t.future)return null;const a=typeof t.level=="number"?t.level:0;return a<0?0:a>4?4:Math.round(a)}function ud({weeks:t,palette:a,width:r,gap:n=3,radius:s=2,emptyColor:o}){if(!Array.isArray(t)||t.length===0||!r||r<=0)return null;const i=a||["#eee","#ccc","#999","#666","#333"],u=o||i[0],l=t.length,g=(l-1)*n,h=Math.max(4,(r-g)/l),f=7*h+6*n;return e.jsx("svg",{width:r,height:f,viewBox:`0 0 ${r} ${f}`,xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,style:{display:"block"},children:t.map((m,x)=>(Array.isArray(m)?m:[]).map((w,b)=>{if(b>=7)return null;const v=dd(w),_=x*(h+n),D=b*(h+n),T=v===null?u:i[v];return e.jsx("rect",{x:_,y:D,width:h,height:h,rx:s,ry:s,fill:T},`${x}-${b}`)}))})}const md=Nt("oklch(0.97 0.01 85)"),Ae=Nt("oklch(0.18 0.02 85)"),Qe=Nt("oklch(0.38 0.015 85)"),kn=Nt("oklch(0.55 0.012 85)"),rt=Nt("oklch(0.55 0.22 25)"),nt='"Instrument Serif", "Times New Roman", Georgia, serif',hd='"Inter Tight", "Helvetica Neue", Arial, sans-serif',gd=["oklch(0.93 0.013 80)","oklch(0.87 0.04 55)","oklch(0.78 0.09 45)","oklch(0.67 0.16 35)","oklch(0.55 0.22 25)"].map(Nt);function is({data:t}){const a=id(t),r=cr(t.totalTokens),n=os(t.totalCost,{currency:t.currency,rate:t.exchangeRate}),s=od(t.startDate),o=cd(r,{baseSize:188,baseChars:9,shrinkPerChar:14,minSize:104}),i=ld(t),u=Array.isArray(t.heatmapWeeks)&&t.heatmapWeeks.length>0;return e.jsxs("div",{style:{width:"100%",height:"100%",background:md,color:Ae,fontFamily:hd,padding:"80px 88px 68px 88px",boxSizing:"border-box",display:"flex",flexDirection:"column",position:"relative"},children:[e.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,paddingBottom:14,borderBottom:`1px solid ${kn}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,fontSize:14,fontWeight:500,letterSpacing:"0.22em",textTransform:"uppercase",color:Ae},children:[e.jsx("div",{style:{width:10,height:10,borderRadius:"50%",background:rt}}),"The Token Tracker"]}),e.jsxs("div",{style:{fontSize:12,letterSpacing:"0.22em",textTransform:"uppercase",color:Qe,textAlign:"right"},children:[d("share.card.broadsheet.issue")," № ",a]})]}),e.jsxs("div",{style:{marginTop:24,display:"flex",justifyContent:"space-between",alignItems:"flex-end",gap:24},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase",color:Qe,marginBottom:6},children:d("share.card.broadsheet.by")}),e.jsx("div",{style:{fontFamily:nt,fontSize:52,fontStyle:"italic",lineHeight:1,color:Ae,letterSpacing:"-0.01em"},children:t.handle})]}),e.jsxs("div",{style:{fontSize:12,letterSpacing:"0.18em",textTransform:"uppercase",color:Qe,textAlign:"right",lineHeight:1.6},children:[d("share.card.broadsheet.tracked_since"),e.jsx("br",{}),e.jsx("span",{style:{color:Ae},children:s})]})]}),e.jsxs("div",{style:{marginTop:40,display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{fontSize:13,letterSpacing:"0.3em",textTransform:"uppercase",color:rt,marginBottom:10},children:d("share.card.broadsheet.total_tokens")}),e.jsx("div",{style:{fontFamily:nt,fontSize:o,fontWeight:400,lineHeight:.86,letterSpacing:"-0.032em",color:Ae,fontFeatureSettings:'"lnum" 1, "tnum" 1',whiteSpace:"nowrap",overflow:"hidden"},children:r}),e.jsxs("div",{style:{marginTop:14,fontFamily:nt,fontStyle:"italic",fontSize:34,lineHeight:1.15,color:Ae,letterSpacing:"-0.005em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:["“",i,"”"]}),e.jsx("div",{style:{marginTop:14,height:1,background:rt,width:"100%"}}),e.jsxs("div",{style:{marginTop:10,display:"flex",justifyContent:"space-between",fontSize:13,letterSpacing:"0.16em",textTransform:"uppercase",color:Qe},children:[e.jsxs("span",{children:[d("share.card.broadsheet.estimated_spend")," · ",n]}),e.jsx("span",{children:d("share.card.broadsheet.billable_days",{days:t.activeDays})})]})]}),u?e.jsxs("section",{style:{marginTop:40},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:12},children:[e.jsx("div",{style:{fontSize:12,letterSpacing:"0.3em",textTransform:"uppercase",color:Ae,fontWeight:600},children:d("share.card.broadsheet.heatmap_title")}),e.jsx("div",{style:{fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",color:Qe},children:d("share.card.broadsheet.heatmap_days_on_record",{active:t.heatmapActiveDays,total:t.heatmapTotalDays})})]}),e.jsx(ud,{weeks:t.heatmapWeeks,palette:gd,width:1024,gap:3,radius:2})]}):null,e.jsxs("section",{style:{marginTop:30,flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",borderBottom:`1px solid ${Ae}`,paddingBottom:10,marginBottom:6},children:[e.jsx("div",{style:{fontSize:12,letterSpacing:"0.3em",textTransform:"uppercase",color:Ae,fontWeight:600},children:d("share.card.broadsheet.roster_title")}),e.jsx("div",{style:{fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",color:Qe},children:d("share.card.broadsheet.roster_subtitle")})]}),t.topModels.length===0?e.jsx("div",{style:{fontFamily:nt,fontStyle:"italic",fontSize:26,color:Qe,paddingTop:14},children:d("share.card.broadsheet.empty")}):t.topModels.map((l,g)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"52px 1fr auto 68px",alignItems:"baseline",gap:16,padding:"13px 0",borderBottom:`1px solid ${kn}`},children:[e.jsx("div",{style:{fontFamily:nt,fontSize:34,fontStyle:"italic",color:rt,lineHeight:1},children:String(g+1).padStart(2,"0")}),e.jsx("div",{style:{fontFamily:nt,fontSize:32,color:Ae,lineHeight:1.1,letterSpacing:"-0.01em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.name}),e.jsx("div",{style:{fontFamily:nt,fontSize:28,color:Ae,fontFeatureSettings:'"lnum" 1, "tnum" 1',whiteSpace:"nowrap"},children:cr(l.tokens)}),e.jsxs("div",{style:{fontSize:13,letterSpacing:"0.1em",color:Qe,textAlign:"right",fontFeatureSettings:'"tnum" 1'},children:[l.percent,"%"]})]},l.id||l.name))]}),e.jsxs("footer",{style:{marginTop:18,paddingTop:12,borderTop:`1px solid ${Ae}`,display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:12,letterSpacing:"0.22em",textTransform:"uppercase",color:Ae},children:[e.jsxs("div",{style:{display:"flex",gap:28},children:[e.jsxs("span",{children:[d("share.card.broadsheet.global_rank")," ",e.jsxs("span",{style:{color:rt},children:["№ ",t.rank!=null?t.rank:"—"]})]}),e.jsxs("span",{children:[d("share.card.broadsheet.active_days")," ",e.jsx("span",{style:{color:rt},children:d("share.card.broadsheet.days_count",{days:t.activeDays})})]})]}),e.jsxs("div",{children:[d("share.card.broadsheet.track_yours")," ",e.jsx("span",{style:{color:rt},children:"→ tokentracker.cc"})]})]})]})}const fd=ns["annual-report"].width,xd="#0a0820",Xe="#ffffffee",st="rgba(255,255,255,0.45)",ar="#a78bfa",pd={background:"rgba(20,15,50,0.38)",backdropFilter:"blur(40px)",WebkitBackdropFilter:"blur(40px)",border:"1px solid rgba(255,255,255,0.05)",boxShadow:["0 39px 56px -36px rgba(255,255,255,0.10) inset","0 7px 11px -4px rgba(255,255,255,0.06) inset","0 -82px 68px -64px rgba(101,67,149,0.08) inset","0 98px 100px -48px rgba(208,171,255,0.06) inset","0 4px 18px 0 rgba(156,146,215,0.06) inset","0 1px 40px 0 rgba(228,222,255,0.04) inset"].join(", ")},ma={background:"rgba(20,15,50,0.38)",backdropFilter:"blur(32px)",WebkitBackdropFilter:"blur(32px)",border:"1px solid rgba(255,255,255,0.06)",boxShadow:"0 1px 8px 0 rgba(228,222,255,0.06) inset"},dr='"Space Grotesk", "Inter Tight", sans-serif',rr='"Inter Tight", sans-serif',yd="rgba(255,255,255,0.06)",ls=[yd,"#4a3d8f","#6b5cbe","#9060e0","#d946ef"],cs=48,ds=28,ba=4,us=20,bd=fd-cs*2-ds*2,kd=(bd-us*2)/3,ur=Math.min(Math.floor((kd-ba*6)/7),40),wd=ur*7+ba*6;function _d(t){if(!Array.isArray(t))return t;const a=[];for(const u of t)if(Array.isArray(u))for(const l of u)l?.day&&!l.future&&l.value>0&&a.push(l.value);if(!a.length)return t;a.sort((u,l)=>u-l);const r=u=>{const l=a.length,g=(l-1)*u,h=Math.floor(g);return Math.round((a[h]??0)+((a[Math.min(l-1,h+1)]??0)-(a[h]??0))*(g-h))},n=r(.5),s=r(.75),o=r(.9),i=u=>!u||u<=0?0:u<=n?1:u<=s?2:u<=o?3:4;return t.map(u=>Array.isArray(u)?u.map(l=>l?.day&&!l.future&&typeof l.value=="number"?{...l,level:i(l.value)}:l):u)}function vd(t){if(!Array.isArray(t))return[];const a={},r=_d(t);for(const n of r)if(Array.isArray(n))for(const s of n){if(!s?.day||s.future)continue;const o=s.day.split("-");if(o.length<2)continue;const i=`${o[0]}-${o[1]}`;(a[i]??=[]).push(s)}return Object.entries(a).sort(([n],[s])=>n.localeCompare(s)).slice(-12).map(([n,s])=>({month:parseInt(n.split("-")[1],10),cells:s}))}function jd(t){if(!t.length)return[];const a=[...t].sort((i,u)=>i.day.localeCompare(u.day));let r=new Date(`${a[0].day}T00:00:00Z`).getUTCDay();const n=Array(r).fill(null).concat(a),s=[];for(let i=0;i<n.length;i+=7)s.push(n.slice(i,i+7));const o=s[s.length-1];for(;o&&o.length<7;)o.push(null);return s.slice(0,6)}const Nd=["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Sd(t){if(!Array.isArray(t))return 0;const a=[];for(const s of t)if(Array.isArray(s))for(const o of s)o?.day&&!o.future&&a.push(o);a.sort((s,o)=>s.day.localeCompare(o.day));let r=0,n=0;for(const s of a)(s.level||0)>0?(n++,n>r&&(r=n)):n=0;return r}function wn(t){const[a,r]=c.useState(null);return c.useEffect(()=>{if(!t){r(null);return}let n=!1;const s=new Image;return s.crossOrigin="anonymous",s.onload=()=>{if(!n)try{const o=document.createElement("canvas");o.width=s.naturalWidth,o.height=s.naturalHeight,o.getContext("2d").drawImage(s,0,0),r(o.toDataURL("image/png"))}catch{r(null)}},s.onerror=()=>{n||r(null)},s.src=t,()=>{n=!0}},[t]),a}function Cd({data:t}){const a=jd(t.cells);return e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:600,color:st,fontFamily:dr,marginBottom:4},children:Nd[t.month]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:ba},children:a.map((r,n)=>e.jsx("div",{style:{display:"flex",gap:ba},children:r.map((s,o)=>{const i=s?Math.min(4,Math.max(0,s.level||0)):-1;return e.jsx("div",{style:{width:ur,height:ur,borderRadius:4,background:i<0?"transparent":ls[i]}},o)})},n))})]})}function Td({data:t}){const a=vd(t.heatmapWeeks),r=Sd(t.heatmapWeeks),n=t.topModels[0],s=t.avatarUrl||null,o=wn(s),i=wn("/neon_bg.png"),u=(t.handle||"?")[0].toUpperCase(),l=16;return e.jsxs("div",{style:{width:"100%",height:"100%",background:xd,fontFamily:dr,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[e.jsx("img",{src:i||"/neon_bg.png",alt:"",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",pointerEvents:"none"}}),e.jsxs("div",{style:{position:"relative",zIndex:1,display:"flex",flexDirection:"column",height:"100%",padding:cs,boxSizing:"border-box"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:l*3},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:64,height:64,style:{width:64,height:64,borderRadius:16,display:"block"}}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:20,fontWeight:500,color:st,lineHeight:1.2},children:"Token Tracker"}),e.jsx("div",{style:{fontSize:36,fontWeight:700,lineHeight:1.15,color:Xe},children:d("share.card.annual.report_title")})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"linear-gradient(135deg,#4c1d95,#7c3aed)",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid rgba(255,255,255,0.15)",overflow:"hidden",flexShrink:0},children:o?e.jsx("img",{src:o,alt:"",width:48,height:48,style:{width:48,height:48,objectFit:"cover",display:"block"},crossOrigin:"anonymous",referrerPolicy:"no-referrer"}):e.jsx("span",{style:{fontSize:20,fontWeight:700,color:Xe},children:u})}),e.jsx("div",{style:{fontSize:32,fontWeight:700,color:Xe},children:t.handle})]})]}),e.jsxs("div",{style:{...pd,borderRadius:22,padding:ds,marginBottom:l},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:14,color:st},children:[e.jsx("span",{children:d("share.card.annual.less")}),ls.map((g,h)=>e.jsx("div",{style:{width:16,height:16,borderRadius:3,background:g}},h)),e.jsx("span",{children:d("share.card.annual.more")})]}),e.jsx("div",{style:{fontSize:16,fontWeight:700,letterSpacing:"0.14em",color:"rgba(255,255,255,0.22)",textTransform:"uppercase"},children:d("share.card.annual.heatmap_title")})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(3,${wd}px)`,gap:`8px ${us}px`,justifyContent:"center"},children:a.map(g=>e.jsx(Cd,{data:g},g.month))})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:l,marginBottom:l},children:[e.jsxs("div",{style:{...ma,borderRadius:22,padding:"28px 16px",textAlign:"center"},children:[e.jsx("div",{style:{fontFamily:rr,fontSize:52,fontWeight:700,color:Xe,letterSpacing:"-0.02em",lineHeight:1},children:cr(t.totalTokens)}),e.jsx("div",{style:{fontSize:22,color:st,marginTop:12},children:d("share.card.annual.total_tokens")})]}),e.jsxs("div",{style:{...ma,borderRadius:22,padding:"28px 16px",textAlign:"center"},children:[e.jsx("div",{style:{fontFamily:rr,fontSize:52,fontWeight:700,color:Xe,letterSpacing:"-0.02em",lineHeight:1},children:os(t.totalCost,{currency:t.currency,rate:t.exchangeRate})}),e.jsx("div",{style:{fontSize:22,color:st,marginTop:12},children:d("share.card.annual.estimated_cost")})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:l},children:[e.jsxs("div",{style:{...ma,borderRadius:22,padding:"18px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:ar,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48 2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48 2.83-2.83"}),e.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),e.jsx("span",{style:{fontSize:20,color:st},children:d("share.card.annual.longest_streak")})]}),e.jsx("span",{style:{fontFamily:rr,fontSize:28,fontWeight:700,color:Xe},children:d("share.card.annual.days_count",{days:r})})]}),e.jsxs("div",{style:{...ma,borderRadius:22,padding:"18px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:ar,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),e.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),e.jsx("span",{style:{fontSize:20,color:st},children:d("share.card.annual.top_model")})]}),e.jsx("span",{style:{fontFamily:dr,fontSize:28,fontWeight:700,color:Xe},children:n?n.name:"—"})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:44,height:44,style:{width:44,height:44,borderRadius:8,display:"block"}}),e.jsx("span",{style:{fontSize:22,fontWeight:600,color:Xe},children:"Token Tracker"})]}),e.jsx("span",{style:{fontSize:22,fontWeight:600,color:ar},children:"tokentracker.cc"})]})]})]})}const ms=[{id:"annual-report",labelKey:"share.variant.neon"},{id:"broadsheet",labelKey:"share.variant.broadsheet"}],Ad={broadsheet:is,"annual-report":Td};function hs(t){return ns[t]||{width:as,height:rs}}function Dd(t){const a=ms.find(r=>r.id===t);return a?.labelKey?d(a.labelKey):t}const _n=c.forwardRef(function({data:a,variant:r},n){const s=Ad[r]||is,{width:o,height:i}=hs(r);return e.jsx("div",{ref:n,"data-share-card":"true",style:{width:o,height:i,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:e.jsx(s,{data:a})})});function ha(){return typeof window>"u"?!1:!!window?.webkit?.messageHandlers?.nativeBridge}const Ld=440;function Md(){const[t,a]=c.useState(null),r=c.useRef(null),n=c.useCallback((s,o="info")=>{r.current&&window.clearTimeout(r.current),a({id:Date.now(),kind:o,text:s}),r.current=window.setTimeout(()=>a(null),2800)},[]);return c.useEffect(()=>()=>{r.current&&window.clearTimeout(r.current)},[]),{toast:t,push:n}}function nr({onClick:t,disabled:a,children:r,emphasis:n,ariaLabel:s}){return e.jsx("button",{type:"button",onClick:t,disabled:a,"aria-label":s,className:["group relative flex items-center justify-between gap-3 w-full px-4 py-3 text-left","rounded-lg border transition-colors",n?"border-oai-black dark:border-oai-white bg-oai-black dark:bg-oai-white text-oai-white dark:text-oai-black hover:opacity-90":"border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600",a?"opacity-60 cursor-not-allowed":"cursor-pointer"].join(" "),children:r})}function Ed({open:t,onClose:a,data:r,twitterText:n}){const[s,o]=c.useState(null),[i,u]=c.useState(""),[l,g]=c.useState("annual-report"),h=c.useRef(null),{toast:f,push:m}=Md(),x=Ln(),p=c.useMemo(()=>{const k=x?.user;if(!k||typeof k!="object")return null;const j=k.user_metadata||{},A=k.profile||{},P=j.avatar_url||j.picture||A.avatar_url||k.avatar_url;return typeof P=="string"&&P.trim()?P.trim():null},[x?.user]);c.useEffect(()=>{t&&(o(null),u(r?.handle||""))},[t,r?.handle]);const w=r&&{...r,handle:i||r.handle,avatarUrl:p},{width:b,height:v}=hs(l),_=Ld/b;c.useEffect(()=>{if(!t)return;const k=j=>{j.key==="Escape"&&a?.()};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[t,a]);const D=c.useCallback(async()=>{const k=h.current;if(!k)return null;try{return await ed(k)}catch(j){return console.warn("[share] capture failed",j),null}},[]),T=c.useCallback(async()=>{if(s)return;o("copy");const k=await D();if(!k){m(d("share.toast.failed"),"error"),o(null);return}let j=!1;if(ha()){const A=await tr(k);A&&(j=(await Zc(A)).ok)}else j=await Pr(k);m(j?d("share.toast.copied"):d("share.toast.failed"),j?"success":"error"),o(null)},[s,D,m]),M=c.useCallback(()=>`tokentracker-share-${Date.now()}.png`,[]),L=c.useCallback(async()=>{if(s)return;o("download");const k=await D();if(!k){m(d("share.toast.failed"),"error"),o(null);return}if(ha()){const A=await tr(k);if(A&&(await yn(A,M())).ok){m(d("share.toast.downloaded"),"success"),o(null);return}}const j=bn(k,M());m(j?d("share.toast.downloaded"):d("share.toast.failed"),j?"success":"error"),o(null)},[s,D,M,m]),O=c.useCallback(async()=>{if(s)return;o("x");const k=await D();if(!k){m(d("share.toast.failed"),"error"),o(null);return}if(ha()){const U=await tr(k);U&&(await yn(U,M()),m(d("share.toast.downloaded"),"success"))}else await Pr(k)?m(d("share.toast.copied"),"success"):bn(k,M());const j=new URL("https://twitter.com/intent/tweet");n&&j.searchParams.set("text",n);const A=x?.user?.id,P=typeof A=="string"&&A?`/u/${A}`:"/";if(j.searchParams.set("url",`https://www.tokentracker.cc${P}?ref=share`),ha())try{window.webkit?.messageHandlers?.nativeBridge?.postMessage({type:"action",name:"openURL",value:j.toString()})}catch{window.open(j.toString(),"_blank","noopener,noreferrer")}else window.open(j.toString(),"_blank","noopener,noreferrer");o(null)},[s,D,m,n,M,x]);return t?e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":d("share.modal.title"),"data-screenshot-exclude":"true",className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 sm:p-6",style:{background:"rgba(10,10,10,0.72)"},onClick:k=>{k.target===k.currentTarget&&a?.()},children:[e.jsx("div",{"aria-hidden":!0,style:{position:"fixed",left:0,top:0,width:b,height:v,pointerEvents:"none",opacity:0,zIndex:-1,clip:"rect(0,0,0,0)",overflow:"hidden"},children:e.jsx(_n,{ref:h,data:w,variant:l})}),e.jsxs(_e.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.18,ease:[.2,.8,.2,1]},className:"relative w-full max-w-[1040px] max-h-[92vh] overflow-hidden rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-black shadow-oai-lg",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row max-h-[92vh]",children:[e.jsx("div",{className:"flex-1 min-w-0 p-4 sm:p-7 bg-oai-gray-50 dark:bg-oai-gray-950 flex items-center justify-center overflow-auto",children:e.jsxs("div",{style:{width:b*_,height:v*_,flexShrink:0,position:"relative"},className:"rounded-xl overflow-hidden shadow-oai-md ring-1 ring-black/5",children:[s?e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-white/70 dark:bg-black/50",children:e.jsxs("svg",{className:"animate-spin h-6 w-6 text-oai-gray-500",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}):null,e.jsx("div",{style:{width:b,height:v,transform:`scale(${_})`,transformOrigin:"top left"},children:e.jsx(_n,{data:w,variant:l})})]})}),e.jsxs("div",{className:"w-full lg:w-[340px] flex-shrink-0 border-t lg:border-t-0 lg:border-l border-oai-gray-200 dark:border-oai-gray-800 p-5 sm:p-6 flex flex-col gap-5 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-oai-white",children:d("share.modal.title")}),e.jsx("p",{className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:d("share.modal.subtitle")})]}),e.jsx("button",{type:"button",onClick:a,"aria-label":d("share.modal.close"),className:"p-1.5 -mt-1 -mr-1 rounded-md text-oai-gray-500 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"share-handle",className:"text-[11px] tracking-[0.18em] uppercase text-oai-gray-500 dark:text-oai-gray-400 mb-1.5 block",children:d("share.modal.name_label")}),e.jsx("input",{id:"share-handle",type:"text",value:i,onChange:k=>u(k.target.value),placeholder:d("share.modal.name_placeholder"),className:"w-full px-3 py-2 text-sm rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white placeholder:text-oai-gray-400 dark:placeholder:text-oai-gray-600 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-oai-brand transition-colors"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] tracking-[0.18em] uppercase text-oai-gray-500 dark:text-oai-gray-400 mb-1.5 block",children:d("share.modal.style_label")}),e.jsx("div",{className:"flex gap-2",children:ms.map(k=>e.jsx("button",{type:"button",onClick:()=>g(k.id),className:["flex-1 px-3 py-2 text-sm rounded-lg border transition-colors",l===k.id?"border-oai-black dark:border-oai-white bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white font-medium":"border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-gray-500 dark:text-oai-gray-400 hover:border-oai-gray-400 dark:hover:border-oai-gray-600"].join(" "),children:Dd(k.id)},k.id))})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[e.jsxs(nr,{onClick:O,disabled:!!s,emphasis:!0,children:[e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),e.jsx("span",{className:"font-medium text-sm",children:d("share.modal.action.x")})]}),e.jsx("span",{className:"text-[11px] opacity-70",children:s==="x"?d("share.toast.working"):d("share.modal.hint.x")})]}),e.jsxs(nr,{onClick:L,disabled:!!s,children:[e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"7 10 12 15 17 10"}),e.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),e.jsx("span",{className:"font-medium text-sm",children:d("share.modal.action.download")})]}),e.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:"PNG"})]}),e.jsxs(nr,{onClick:T,disabled:!!s,children:[e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),e.jsx("span",{className:"font-medium text-sm",children:d("share.modal.action.copy")})]}),e.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:d("share.modal.hint.copy")})]})]}),e.jsx("div",{className:"mt-auto pt-4 border-t border-oai-gray-200 dark:border-oai-gray-800",children:e.jsx("p",{className:"text-[11px] leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:d("share.modal.footer")})})]})]}),e.jsx(fr,{children:f?e.jsx(_e.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},className:"pointer-events-none absolute left-1/2 bottom-4 -translate-x-1/2",children:e.jsx("div",{className:["px-4 py-2 rounded-full text-xs font-medium shadow-oai-md",f.kind==="error"?"bg-red-600 text-white":f.kind==="success"?"bg-oai-black dark:bg-oai-white text-oai-white dark:text-oai-black":"bg-oai-gray-800 text-white"].join(" "),children:f.text})},f.id):null})]})]}):null}function Rd(t){const{enabled:a,handle:r,startDate:n,activeDays:s,summary:o,topModels:i,period:u,periodFrom:l,periodTo:g,heatmap:h,accessToken:f,userId:m,currency:x,exchangeRate:p}=t,[w,b]=c.useState(null),v=p;return c.useEffect(()=>{if(!a||!m&&!lt())return;let _=!1;return(async()=>{try{const T=await Uo({accessToken:f,userId:m,period:u==="day"||u==="custom"?"week":u,metric:"all",limit:100,offset:0});if(_)return;const L=(Array.isArray(T?.entries)?T.entries:Array.isArray(T)?T:[]).find(k=>k?.is_me===!0),O=typeof L?.rank=="number"?L.rank:null;b(O)}catch{_||b(null)}})(),()=>{_=!0}},[a,f,m,u]),c.useMemo(()=>rd({handle:r,startDate:n,activeDays:s,summary:o,topModels:i,rank:w,period:u,periodFrom:l,periodTo:g,heatmap:h,currency:x,exchangeRate:typeof v=="number"?v:void 0}),[r,n,s,o,i,w,u,l,g,h,x,v])}const Id=["day","week","month","total","custom"],sr=new Set(["day","hour","month"]),Pt=new Set(["day","total","custom"]),Fd=["macAppBanner","statsPanel","widgetOnboarding","installCopy","activityHeatmap","deviceUsage","trendMonitor","qualityPerDollar"],$d=["usageOverview","dataDetails"];function or(t,a){if(typeof a=="number"&&a>0)return!0;if(typeof t=="bigint")return t>0n;if(typeof t=="number")return Number.isFinite(t)&&t>0;if(typeof t=="string"){const r=t.trim();if(!r)return!1;if(/^[0-9]+$/.test(r))try{return BigInt(r)>0n}catch{return!1}const n=Number(r);return Number.isFinite(n)&&n>0}return!1}function ga(t){return t?vt(t,null):null}function vn(t){return t?t?.billable_total_tokens??t?.value??t?.total_tokens:null}function Pd(t){return t?t==="www.tokentracker.cc"||t==="tokentracker.cc":!1}function zd(){if(typeof window>"u")return!1;const t=new URLSearchParams(window.location.search),a=String(t.get("force_install")||"").toLowerCase();return a!=="1"&&a!=="true"?!1:!Pd(window.location.hostname)}function du({baseUrl:t,auth:a,signedIn:r,sessionSoftExpired:n,signOut:s,publicMode:o=!1,publicToken:i=null,signInUrl:u="/sign-in",signUpUrl:l="/sign-up",onMainContentVisible:g}){const{resolvedLocale:h}=Ho(),{currency:f,rate:m}=va(),{mode:x,setMode:p,formatTokens:w,formatTokensTooltip:b}=ze(),[v,_]=c.useState(!1),[D,T]=c.useState(null),[M,L]=c.useState(null),[O,k]=c.useState(!1),[j,A]=c.useState(null),[P,U]=c.useState(0),[W,E]=c.useState(0),[R,q]=c.useState(null),N=c.useMemo(()=>typeof window>"u"?!1:Vo(window.location.search),[]),S=c.useMemo(()=>zd(),[]),[Y,H]=c.useState(!1),le=2200,[J,ce]=c.useState(!0),[oe,he]=c.useState(!1),[ye,de]=c.useState(!1),[ee,Q]=c.useState(!1),[z,X]=c.useState(!1),ge=c.useRef(!1),V=lt(),C=r&&!n,B=c.useMemo(()=>C&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,C]),F=C?B:null,K=o?Wo(i):F,ne=r||V||o,we=C&&Bt(F),ve=r&&n&&!o,{accountView:De,revision:Ne,resolving:Ut}=Ko(),ue=De&&!o,Fe=ue?F:null,Be=Ut&&!o;c.useEffect(()=>{if(!r||V){T(null),L(null),k(!1),A(null);return}if(o)return;if(!we){T(null),L(null),k(!1),A(null);return}let y=!0;const $=()=>{T(null),L(null),k(!1),A(null)};return k(!0),A(null),(async()=>{let I=null;try{I=await Ie(F)}catch{I=null}if(y){if(!I){$();return}try{const G={link_code:null,expires_at:null};if(!y)return;T(typeof G?.link_code=="string"?G.link_code:null),L(typeof G?.expires_at=="string"?G.expires_at:null)}catch(G){if(!y)return;T(null),L(null),A(G?.message||"Failed to load link code")}finally{if(!y)return;k(!1)}}})(),()=>{y=!1}},[t,V,r,o,we,F,W]);const je=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");c.useEffect(()=>{if(!je&&(!r||V||o)){q(null);return}if(!je&&!we){q(null);return}let y=!0;return(async()=>{let $=null;try{$=await Ie(F)}catch{$=null}if(y){if(!$&&!je){q(null);return}try{const I=await Go({baseUrl:t,accessToken:$});if(!y)return;q(I&&typeof I=="object"?I:null)}catch{if(!y)return;q(null)}}})(),()=>{y=!1}},[we,t,F,V,o,r]);const St=c.useMemo(()=>{if(!M)return!1;const y=Date.parse(M);if(!Number.isFinite(y))return!1;const $=P||Date.now();return y<=$},[M,P]);c.useEffect(()=>{!r||V||o||!M||!St||O||(T(null),L(null),A(null),E(y=>y+1))},[St,M,O,V,r]),c.useEffect(()=>{if(!M||o)return;const y=Date.parse(M);if(!Number.isFinite(y))return;const $=Date.now();if(U($),y<=$)return;const I=window.setTimeout(()=>U(Date.now()),y-$),G=()=>{typeof document>"u"||document.visibilityState==="visible"&&U(Date.now())};return typeof document<"u"&&document.addEventListener("visibilitychange",G),window.addEventListener("focus",G),()=>{window.clearTimeout(I),typeof document<"u"&&document.removeEventListener("visibilitychange",G),window.removeEventListener("focus",G)}},[M]);const fe=c.useMemo(()=>Dn(),[]),xe=c.useMemo(()=>An(),[]),Le=c.useMemo(()=>qo(),[]),Oe=o?null:a?.userId||a?.email||"default",[Ct,ct]=c.useState("month"),[Ue,ja]=c.useState(null),[Ze,Na]=c.useState(null),[Sa,dt]=c.useState(!1),Z=N?"total":Ct,Ht=c.useMemo(()=>Z==="custom"&&Ue&&Ze?{from:Ue,to:Ze}:Yo(Z,{timeZone:fe,offsetMinutes:xe,now:Le}),[Le,Z,fe,xe,Ue,Ze]),be=Ht.from,ke=Ht.to,[Me,ut]=c.useState(null),{devices:Vt,accountSources:Tt,refresh:Ca}=Gc({from:be,to:ke,timeZone:fe,tzOffsetMinutes:xe,accountView:ue,accountAccessToken:Fe,accountRevision:Ne}),He=c.useMemo(()=>Vt.filter(y=>(Number(y.total_tokens)||0)>0),[Vt]),Wt=c.useMemo(()=>Tt.filter(y=>(Number(y.total_tokens)||0)>0),[Tt]),et=ue&&He.length>=2,At=ue&&He.length+Wt.length>=2;c.useEffect(()=>{if(!et&&!At){Me!==null&&ut(null);return}Me&&!He.some(y=>y.id===Me)&&ut(null)},[et,At,He,Me]);const Kt=c.useMemo(()=>et?[{value:"",label:d("dashboard.device_filter.all")},...He.map(y=>({value:y.id,label:ir(y)||d("dashboard.device_card.unnamed")}))]:[],[et,He,h]),Ta=At?e.jsx(Yc,{devices:He,accountSources:Wt,selectedDeviceId:Me||"",onSelectDevice:y=>ut(y||null),onRenameDevice:async(y,$)=>{const I=await Ie(Fe);await ei({deviceId:y,name:$,accessToken:I}),await Ca()}}):null,Gt=c.useMemo(()=>Zo({timeZone:fe,offsetMinutes:xe}),[fe,xe]),mt=c.useMemo(()=>Jo({timeZone:fe,offsetMinutes:xe}),[fe,xe]),Aa=c.useMemo(()=>`Local time (${mt})`,[mt]),Dt=fe,Lt=xe,Da=Gt,tt=c.useMemo(()=>hr({timeZone:fe,offsetMinutes:xe,date:Le||new Date}),[Le,fe,xe]),qt=c.useMemo(()=>Dl({period:Z,selectedFrom:be,selectedTo:ke,todayKey:tt}),[be,Z,ke,tt]),{daily:Ve,summary:me,rolling:La,source:Yt,loading:Zt,error:Jt,refresh:Qt}=Wr({baseUrl:t,accessToken:K,guestAllowed:ve,from:be,to:ke,includeDaily:Z!=="total",cacheKey:Oe,timeZone:fe,tzOffsetMinutes:xe,now:Le,accountView:ue,accountAccessToken:Fe,accountRevision:Ne,accountViewResolving:Be,deviceId:Me}),{daily:Xt,loading:se,refresh:ae}=Wr({baseUrl:t,accessToken:K,guestAllowed:ve,from:qt.from,to:qt.to,includeDaily:!0,includeSummary:!1,cacheKey:Oe?`${Oe}.daily-breakdown`:"daily-breakdown",timeZone:fe,tzOffsetMinutes:xe,now:Le,accountView:ue,accountAccessToken:Fe,accountRevision:Ne,accountViewResolving:Be}),{breakdown:ie,loading:Je,refresh:Ke}=ul({baseUrl:t,accessToken:K,guestAllowed:ve,from:be,to:ke,cacheKey:Oe,timeZone:fe,tzOffsetMinutes:xe,accountView:ue,accountAccessToken:Fe,accountRevision:Ne,accountViewResolving:Be,deviceId:Me}),[Mt,gs]=c.useState(3),{entries:fs,loading:xs,refresh:xr}=ll({baseUrl:t,accessToken:K,from:be,to:ke,timeZone:fe,tzOffsetMinutes:xe}),pr=Z==="week"||Z==="month",ea=Z==="week"||Z==="month",yr=c.useMemo(()=>Ve.filter(y=>y?.future?!1:!y?.day||!tt?!0:String(y.day)<=String(tt)),[Ve,tt]),{rows:Ge,from:ps,to:ys,loading:bs,refresh:br}=gi({baseUrl:t,accessToken:K,guestAllowed:ve,period:Z,from:be,to:ke,months:24,cacheKey:Oe,timeZone:Dt,tzOffsetMinutes:Lt,now:Le,sharedRows:pr?Ve:null,sharedRange:pr?{from:be,to:ke}:null,accountView:ue,accountAccessToken:Fe,accountRevision:Ne,accountViewResolving:Be,deviceId:Me}),ks=c.useMemo(()=>({baseUrl:t,accessToken:K,guestAllowed:ve,cacheKey:Oe,timeZone:Dt,tzOffsetMinutes:Lt,now:Le,accountView:ue,accountAccessToken:Fe,accountRevision:Ne,accountViewResolving:Be}),[t,K,ve,Oe,Dt,Lt,Le,ue,Fe,Ne,Be]),{daily:ht,heatmap:We,loading:kr,refresh:wr}=rl({baseUrl:t,accessToken:K,guestAllowed:ve,weeks:52,cacheKey:Oe,timeZone:fe,tzOffsetMinutes:xe,now:Le,accountView:ue,accountAccessToken:Fe,accountRevision:Ne,accountViewResolving:Be,deviceId:Me}),{data:ta,refresh:_r}=fi();c.useEffect(()=>{ta&&typeof ta=="object"&&Qo(ta)},[ta]);const $e=c.useMemo(()=>Z==="day"?"hour":Z==="total"?"month":"day",[Z]),ws=c.useMemo(()=>Gr($e),[$e]),aa="day",_s=c.useMemo(()=>Gr(aa),[]),[Pe,vr]=c.useState(()=>({key:"day",dir:"desc"}));c.useEffect(()=>{vr(y=>!sr.has(y.key)||y.key===$e?y:{key:$e,dir:y.dir})},[$e]);const gt=c.useMemo(()=>sr.has(Pe.key)&&Pe.key!==$e?{...Pe,key:$e}:Pe,[$e,Pe]),ra=c.useMemo(()=>{if(Z==="day")return Array.isArray(Ge)?Ge.filter(I=>I?.hour&&!I?.future):[];if(Z==="total"){const I=Array.isArray(Ge)?Ge.filter(G=>G?.month&&!G?.future):[];return jl(I)}const y=yr;return!y.some(I=>!I?.missing&&!I?.future)&&Ve.length>0?Ve.filter(I=>!I?.future).slice(-30).filter(I=>I?.day):y},[Z,Ge,yr,Ve]),Et=c.useMemo(()=>qr(ra,gt),[ra,gt]),jr=c.useMemo(()=>ra.some(y=>!y?.missing&&!y?.future),[ra]),Ma=c.useMemo(()=>{if(!Pt.has(Z))return 1;const y=Math.ceil(Et.length/ya);return y>0?y:1},[Z,Et.length]),[Ea,na]=c.useState(0);c.useEffect(()=>{if(!Pt.has(Z)){na(0);return}na(y=>Math.min(y,Ma-1))},[Ma,Z]),c.useEffect(()=>{Pt.has(Z)&&na(0)},[Z,Pe.dir,Pe.key]);const vs=c.useMemo(()=>Pt.has(Z)?Nl(Et,Ea,ya):Et,[Ea,Z,Et]),Nr=c.useMemo(()=>Ll(Xt,{period:Z}),[Xt,Z]),ft=c.useMemo(()=>sr.has(Pe.key)?{...Pe,key:aa}:Pe,[Pe]),js=c.useMemo(()=>qr(Nr,ft),[Nr,ft]),Ns=c.useMemo(()=>ea?Ve:Z==="day"?Array.isArray(Ge)?Ge.filter(y=>y?.hour):[]:Ge,[Ve,Z,Ge,ea]),Ss=ea?be:ps,Cs=ea?ke:ys;function Ts(y,$){if(y?.future)return"—";if(y?.missing)return d("shared.status.unsynced");if($.endsWith("_tokens")){const I=$==="total_tokens"?ga(y):y?.[$];return e.jsx("span",{title:b(I),children:w(I)})}return pa(y?.[$])}function As(y){const $=y?.[$e];if($==null)return"";const I=String($);if($e==="hour"){const[G,Ce]=I.split("T");if(G&&Ce)return`${G} ${Ce.slice(0,5)}`}return I}function Ds(y){const $=y?.[aa];return $==null?"":String($)}function Ls(y){vr($=>$.key===y?{key:y,dir:$.dir==="asc"?"desc":"asc"}:{key:y,dir:"desc"})}function Ms(y){return gt.key!==y?"none":gt.dir==="asc"?"ascending":"descending"}function Es(y){return gt.key!==y?"":gt.dir==="asc"?"▲":"▼"}function Rs(y){return ft.key!==y?"none":ft.dir==="asc"?"ascending":"descending"}function Is(y){return ft.key!==y?"":ft.dir==="asc"?"▲":"▼"}const Ra=c.useMemo(()=>{if(!r&&!V&&!o&&!je)return 0;const y=Number(We?.active_days);if(Number.isFinite(y))return y;let $=0;const I=new Set,G=(pe,Ee,Te)=>{typeof pe!="string"||!pe||I.has(pe)||or(Ee,Te)&&(I.add(pe),$+=1)};if(Array.isArray(ht))for(const pe of ht)G(pe?.day,ga(pe));const Ce=Array.isArray(We?.weeks)?We.weeks:[];for(const pe of Ce)for(const Ee of Array.isArray(pe)?pe:[]){const Te=vn(Ee);G(Ee?.day,Te,Ee?.level)}return $},[r,V,We?.active_days,We?.weeks,ht]),[Sr,Cr]=c.useState("month"),Fs=c.useCallback(y=>{y==="custom"?(Cr($=>$==="custom"?"month":$),ct($=>Ue&&Ze?"custom":$),dt(!0)):(ct(y),Cr(y),dt(!1))},[Ue,Ze]),$s=c.useCallback((y,$)=>{ja(y),Na($),ct("custom"),dt(!1)},[]),Ps=c.useCallback(y=>{dt(y),!y&&Ct==="custom"&&!Ue&&ct(Sr)},[Ct,Ue,Sr]),xt=c.useCallback(async()=>{ue&&Xo(),await Promise.all([Qt(),wr(),br(),Ke(),xr(),ae()])},[ue,ae,wr,Ke,xr,br,Qt]),Tr=c.useCallback(async()=>{await Promise.all([xt(),_r()])},[xt,_r]),Ia=c.useRef(null);c.useEffect(()=>{if(!je||V||ue)return;Ia.current||(Ia.current=zr({auto:!0,background:!0,allLocalSources:!0}));let y=!0;return Ia.current.then(()=>{if(y)return xt()}).catch($=>{y&&console.warn("[DashboardPage] Reload sync failed:",$)}),()=>{y=!1}},[je,V,ue,xt]),c.useEffect(()=>{if(!je||V||ue)return;const y=Tl({refresh:xt,onError:$=>console.warn("[DashboardPage] Automatic usage refresh failed:",$)});return()=>y.stop()},[je,V,ue,xt]);const zs=c.useCallback(async()=>{Q(!0);try{je&&await zr(),await Tr()}catch(y){console.error("[DashboardPage] Refresh failed:",y)}finally{Q(!1)}},[je,Tr]),sa=ee||Zt||se||kr||bs||Je||xs,Fa=!z&&(Be||ue&&sa&&!jr),Bs=c.useMemo(()=>d("shared.data_source",{source:String(Yt||"edge").toUpperCase()}),[Yt,h]),oa=c.useMemo(()=>typeof a?.name!="string"?"":a.name.trim(),[a?.name]),Os="",Ar=c.useMemo(()=>!oa||oa.includes("@")?d("dashboard.identity.fallback"):oa,[oa]),Dr=c.useMemo(()=>Ar.replace(/[^a-zA-Z0-9._-]/g,"_"),[Ar]),Lr=c.useMemo(()=>o?d("dashboard.identity.fallback"):Dr,[Dr,Os,o]),Mr=c.useMemo(()=>{let y=null;const $=G=>{typeof G!="string"||!G||(!y||G<y)&&(y=G)};if(Array.isArray(ht))for(const G of ht)G?.day&&or(ga(G))&&$(G.day);const I=Array.isArray(We?.weeks)?We.weeks:[];for(const G of I)for(const Ce of Array.isArray(G)?G:[]){if(!Ce?.day)continue;const pe=vn(Ce),Ee=Ce?.level;or(pe,Ee)&&$(Ce.day)}return y},[We?.weeks,ht]),Us=c.useMemo(()=>o?[]:(Array.isArray(R?.subscriptions?.items)?R.subscriptions.items:[]).map(I=>{const G=typeof I?.tool=="string"?I.tool.trim():"",pe=(typeof I?.plan_type=="string"?I.plan_type:typeof I?.planType=="string"?I.planType:"").trim();return!G||!pe?null:{tool:G,planType:pe,provider:typeof I?.provider=="string"?I.provider.trim():"",product:typeof I?.product=="string"?I.product.trim():"",rateLimitTier:typeof I?.rate_limit_tier=="string"?I.rate_limit_tier.trim():typeof I?.rateLimitTier=="string"?I.rateLimitTier.trim():""}}).filter(Boolean).slice(0,6),[o,R]),Hs=e.jsx(xi,{heatmap:We,timeZoneLabel:Gt,timeZoneShortLabel:mt,hideLegend:N,defaultToLatestMonth:N}),Vs=c.useMemo(()=>`${be}..${ke}`,[be,Z,ke]),Ws=d("usage.summary.total"),Se=me!=null,pt=Se?ga(me):0,Ks=w(pt),Gs=c.useCallback(()=>{p(x===Va.COMPACT?Va.FULL:Va.COMPACT)},[p,x]),qs=d("dashboard.core_index.collapse_label"),Ys=d("dashboard.core_index.expand_label"),Zs=d("dashboard.core_index.collapse_aria"),Js=d("dashboard.core_index.expand_aria"),Qs=!N,yt=d("shared.placeholder.short"),$a=c.useMemo(()=>{const y=Array.isArray(ie?.sources)?ie.sources:[];let $=null,I=0;for(const Ee of y){const Te=vt(Ee?.totals);!Number.isFinite(Te)||Te<=0||Te>I&&(I=Te,$=Ee)}let G=yt,Ce=yt,pe="0.0";if($&&I>0){G=$?.source?String($.source).toUpperCase():yt;const Ee=Array.isArray($?.models)?$.models:[];let Te=0;for(const Ha of Ee){const la=vt(Ha?.totals);!Number.isFinite(la)||la<=0||la>Te&&(Te=la,Ce=Ha?.model?String(Ha.model):yt)}Te>0&&(pe=(Te/I*100).toFixed(1))}return{agentName:G,modelName:Ce,modelPercent:pe}},[ie,yt]),Pa=pa(pt),Xs=d("dashboard.screenshot.twitter_text",{total_tokens:Pa==="-"?yt:Pa,agent_name:$a.agentName,model_name:$a.modelName,model_percent:$a.modelPercent}),eo=c.useMemo(()=>N?[]:Id,[N]),to=c.useMemo(()=>[{label:d("usage.metric.total"),value:Se?w(pt):"—",title:Se?b(pt):void 0,valueClassName:"text-white"},{label:d("usage.metric.input"),value:Se?w(me?.input_tokens):"—",title:Se?b(me?.input_tokens):void 0},{label:d("usage.metric.output"),value:Se?w(me?.output_tokens):"—",title:Se?b(me?.output_tokens):void 0},{label:d("usage.metric.cached_input"),value:Se?w(me?.cached_input_tokens):"—",title:Se?b(me?.cached_input_tokens):void 0},{label:d("usage.metric.reasoning_output"),value:Se?w(me?.reasoning_output_tokens):"—",title:Se?b(me?.reasoning_output_tokens):void 0}],[me?.cached_input_tokens,me?.input_tokens,me?.output_tokens,me?.reasoning_output_tokens,pt,Se,w,b]),za=c.useMemo(()=>_a(me?.total_cost_usd,{currency:f,rate:m}),[me?.total_cost_usd,f,m]),ao=c.useMemo(()=>me?.conversation_count??null,[me?.conversation_count]),Er=c.useMemo(()=>El(ie,{copyFn:d}),[ie]),Rr=c.useMemo(()=>Rl(ie,{limit:3,copyFn:d}),[ie]),ro=Rd({enabled:Y,handle:Lr,startDate:Mr,activeDays:Ra,summary:me,topModels:Rr,period:Z,periodFrom:be,periodTo:ke,heatmap:We,accessToken:typeof K=="string"?K:null,userId:a?.userId||null,currency:f,exchangeRate:m}),no=c.useCallback(()=>H(!0),[]),so=c.useCallback(()=>H(!1),[]),oo=c.useCallback(()=>_(!0),[]),io=c.useCallback(()=>_(!1),[]),lo=za&&za!=="-"&&Er.length>0,Rt=d("dashboard.install.cmd.init"),Ba=St?null:D,Oa=Ba?d("dashboard.install.cmd.init_link_code",{link_code:Ba}):Rt,co=Rt,uo=d("dashboard.install.cmd.sync"),mo=Ba?d("dashboard.install.copy"):d("dashboard.install.copy_base"),ho=d("dashboard.install.copied");d("dashboard.session_expired.copy_label"),d("dashboard.session_expired.copied");const go=!!(R?.install?.has_active_device_token??R?.install?.hasActiveDeviceToken),fo=Sl({publicMode:o,screenshotMode:N,forceInstall:S,accessEnabled:ne,heatmapLoading:kr,activeDays:Ra,hasActiveDeviceToken:go}),xo=d("dashboard.install.prompt"),po=c.useCallback(async()=>{!Oa||!await Br(Oa)||(he(!0),window.setTimeout(()=>he(!1),2e3))},[Oa]);c.useCallback(async()=>{!Rt||!await Br(Rt)||(de(!0),window.setTimeout(()=>de(!1),2e3))},[Rt]);const Ua=c.useMemo(()=>d("dashboard.daily.empty",{cmd:"{{cmd}}"}),[h]),[yo,bo]=c.useMemo(()=>{const y=Ua.split("{{cmd}}");return y.length===1?[Ua,""]:[y[0],y.slice(1).join("{{cmd}}")]},[Ua]),It=n&&!o,Ft=!r&&!V&&!n&&!je&&!o;c.useEffect(()=>{It||Ft||Fa||X(!0)},[Fa,Ft,It]);const ia=ol(Fd,$d);return c.useEffect(()=>{ge.current||It||Ft||sa||(ge.current=!0,g?.())},[g,Ft,It,sa]),e.jsxs(e.Fragment,{children:[e.jsx(Kc,{copy:d,onOpenShare:no,screenshotMode:N,showExpiredGate:It,showAuthGate:Ft,identityDisplayName:Lr,identityStartDate:Mr,activeDays:Ra,identitySubscriptions:Us,identityScrambleDurationMs:le,projectUsageEntries:fs,projectUsageLimit:Mt,setProjectUsageLimit:gs,projectDetailQuery:{from:be,to:ke,timeZone:fe,tzOffsetMinutes:xe},topModels:Rr,signedIn:r,publicMode:o,isLocalMode:je,shouldShowInstall:fo,installPrompt:xo,handleCopyInstall:po,installCopied:oe,installCopiedLabel:ho,installCopyLabel:mo,installInitCmdDisplay:co,linkCodeLoading:O,linkCodeError:j,trendRowsForDisplay:Ns,trendFromForDisplay:Ss,trendToForDisplay:Cs,trendZoomConfig:ks,usageFrom:be,usageTo:ke,period:Z,trendTimeZoneLabel:Da,activityHeatmapBlock:Hs,periodsForDisplay:eo,setSelectedPeriod:Fs,customFrom:Ue,customTo:Ze,onCustomRangeApply:$s,customRangeOpen:Sa,onCustomRangeOpenChange:Ps,metricsRows:to,summaryLabel:Ws,summaryValue:Ks,hasSummary:Se,summaryLoading:Zt,providersLoading:Je,summaryFullValue:Pa,onToggleSummaryFormat:Gs,summaryTotalTokensRaw:re(pt)||0,summaryCostValue:za,summaryConversationsValue:ao,rollingUsage:La,costInfoEnabled:lo,openCostModal:oo,allowBreakdownToggle:Qs,coreIndexCollapsed:J,setCoreIndexCollapsed:ce,coreIndexCollapseLabel:qs,coreIndexExpandLabel:Ys,coreIndexCollapseAria:Zs,coreIndexExpandAria:Js,refreshAll:zs,usageLoadingState:sa,announceUsageLoading:ee,initialDashboardLoading:Fa,usageError:Jt,rangeLabel:Vs,timeZoneRangeLabel:Aa,usageSourceLabel:Bs,fleetData:Er,hasDetailsActual:jr,dailyEmptyPrefix:yo,installSyncCmd:uo,dailyEmptySuffix:bo,detailsColumns:ws,ariaSortFor:Ms,toggleSort:Ls,sortIconFor:Es,pagedDetails:vs,dailyBreakdownRows:js,dailyBreakdownColumns:_s,dailyBreakdownAriaSortFor:Rs,dailyBreakdownSortIconFor:Is,dailyBreakdownDateKey:aa,detailsDateKey:$e,renderDetailDate:As,renderDailyBreakdownDate:Ds,renderDetailCell:Ts,DETAILS_PAGED_PERIODS:Pt,detailsPageCount:Ma,detailsPage:Ea,setDetailsPage:na,costModalOpen:v,closeCostModal:io,deviceOptions:Kt,selectedDevice:Me||"",onDeviceChange:y=>ut(y||null),deviceUsageBlock:Ta,leftCardOrder:ia.left.order,onLeftReorder:ia.left.reorder,rightCardOrder:ia.right.order,onRightReorder:ia.right.reorder}),e.jsx(Ed,{open:Y,onClose:so,data:ro,twitterText:Xs})]})}export{du as DashboardPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as p,r as c,j as e,i as b}from"./__vite-browser-external-CxN2E6q5.js";const f={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"0.81.3",VITE_INSFORGE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function x(){return b(),`${(f&&"https://srctyff5.us-east.insforge.app"||"https://srctyff5.us-east.insforge.app").replace(/\/$/,"")}/functions/tokentracker-device-flow-grant`}function l(a){return(a||"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9-]/g,"")}function k(){const a=p(),[m,u]=c.useState(""),[t,r]=c.useState({kind:"idle",message:""});c.useEffect(()=>{try{const i=new URLSearchParams(window.location.search).get("user_code");i&&u(l(i))}catch{}},[]);async function g(d){if(d?.preventDefault?.(),!a?.signedIn){r({kind:"error",message:"Please sign in first."});return}const i=l(m);if(!/^[A-HJKMNP-Z2-9]{4}-[A-HJKMNP-Z2-9]{4}$/.test(i)){r({kind:"error",message:"Invalid code format. Expected XXXX-XXXX."});return}r({kind:"working",message:"Approving…"});try{const n=await a.getAccessToken?.();if(!n){r({kind:"error",message:"No access token — please sign in again."});return}const s=await fetch(x(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({user_code:i})}),o=await s.json().catch(()=>({}));s.ok?r({kind:"success",message:o.status==="already_approved"?`Already approved earlier${o.client_info?" ("+o.client_info+")":""}.`:`Approved${o.client_info?" for "+o.client_info:""}. You can close this tab — your CLI will pick it up within a few seconds.`}):s.status===404?r({kind:"error",message:"Code not found. Double-check what your CLI printed."}):s.status===410?r({kind:"error",message:"Code expired. Re-run `tracker device-login` and try again."}):s.status===401?r({kind:"error",message:"Session expired. Sign out, sign in, and try again."}):r({kind:"error",message:o?.error||`Server error (HTTP ${s.status}).`})}catch(n){r({kind:"error",message:`Network error: ${n?.message||n}`})}}return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-oai-gray-950 px-6 py-12",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-8",children:[e.jsx("h1",{className:"text-2xl font-semibold text-oai-gray-900 dark:text-white mb-2",children:"Approve your CLI"}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mb-6",children:"Type the code your CLI showed you. We'll link it to your account so token usage from that machine flows into your leaderboard profile."}),a?.signedIn?null:e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 dark:bg-amber-900/20 dark:border-amber-800 p-4 mb-4",children:e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"Sign in first, then return to this page."})}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400 mb-1",children:"CLI code"}),e.jsx("input",{type:"text",value:m,onChange:d=>u(l(d.target.value)),placeholder:"XXXX-XXXX",spellCheck:!1,autoCapitalize:"characters",maxLength:9,className:"w-full font-mono text-xl tracking-widest text-center rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-900 dark:text-white px-4 py-3 focus:outline-none focus:ring-inset focus:ring-2 focus:ring-emerald-600"})]}),e.jsx("button",{type:"submit",disabled:t.kind==="working"||!a?.signedIn,className:"w-full rounded-md bg-emerald-600 hover:bg-emerald-500 disabled:bg-oai-gray-300 disabled:cursor-not-allowed text-white font-medium py-3 transition-colors",children:t.kind==="working"?"Approving…":"Approve"})]}),t.kind==="success"&&e.jsx("div",{className:"mt-4 rounded-md border border-emerald-200 bg-emerald-50 dark:bg-emerald-900/20 dark:border-emerald-800 p-4",children:e.jsx("p",{className:"text-sm text-emerald-700 dark:text-emerald-300",children:t.message})}),t.kind==="error"&&e.jsx("div",{className:"mt-4 rounded-md border border-red-200 bg-red-50 dark:bg-red-900/20 dark:border-red-800 p-4",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:t.message})})]})})}export{k as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,w as a}from"./__vite-browser-external-CxN2E6q5.js";import{u as p}from"./DialogTitle-BvElfi0r.js";import{u as c}from"./useScrollLock-Vyaif-7C.js";const x=n.forwardRef(function(e,r){const{render:l,className:u,style:m,id:s,...t}=e,{store:i}=p(),o=c(s);return i.useSyncedValueWithCleanup("descriptionElementId",o),a("p",e,{ref:r,props:[{id:o},t]})});export{x as D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aA as s,aB as v,r as l,aC as W,w,aD as B,aE as V,j as I,aF as A,aG as ee,aH as te,aI as ne,aJ as oe,aK as se,aL as re}from"./__vite-browser-external-CxN2E6q5.js";import{F as Y,P as $,p as j,C as E,c as ae,a as ie,b as le,d as de,I as ue,e as pe,f as ce,g as ge,h as fe,i as me,j as Se,s as Ce,k as Pe,l as Oe,u as Re}from"./useScrollLock-Vyaif-7C.js";function Ee(){return new Y({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new $,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function he(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ee(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:v,inactiveTriggerProps:v,popupProps:v}}function Ie(e,t,o=!1){return new Y({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:o,onOpenChange:void 0})}const D=s(e=>e.triggerIdProp??e.activeTriggerId),U=s(e=>e.openProp??e.open),H=s(e=>(e.popupElement?.id??e.floatingId)||void 0);function G(e,t){return t!==void 0&&U(e)&&D(e)===t}function xe(e,t){return G(e,t)?!0:t!==void 0&&U(e)&&D(e)==null&&e.triggerCount===1}const ye={open:U,mounted:s(e=>e.mounted),transitionStatus:s(e=>e.transitionStatus),floatingRootContext:s(e=>e.floatingRootContext),triggerCount:s(e=>e.triggerCount),preventUnmountingOnClose:s(e=>e.preventUnmountingOnClose),payload:s(e=>e.payload),activeTriggerId:D,activeTriggerElement:s(e=>e.mounted?e.activeTriggerElement:null),popupId:H,isTriggerActive:s((e,t)=>t!==void 0&&D(e)===t),isOpenedByTrigger:s((e,t)=>G(e,t)),isMountedByTrigger:s((e,t)=>t!==void 0&&D(e)===t&&e.mounted),triggerProps:s((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:s((e,t)=>xe(e,t)?H(e):void 0),popupProps:s(e=>e.popupProps),popupElement:s(e=>e.popupElement),positionerElement:s(e=>e.positionerElement)},q=l.createContext(!1),z=l.createContext(void 0);function T(e){const t=l.useContext(z);if(e===!1&&t===void 0)throw new Error(W(27));return t}const ve={...j,...B},Le=l.forwardRef(function(t,o){const{render:r,className:d,style:a,forceRender:p=!1,...c}=t,{store:i}=T(),n=i.useState("open"),m=i.useState("nested"),C=i.useState("mounted"),S=i.useState("transitionStatus");return w("div",t,{state:{open:n,transitionStatus:S},ref:[i.context.backdropRef,o],stateAttributesMapping:ve,props:[{role:"presentation",hidden:!C,style:{userSelect:"none",WebkitUserSelect:"none"}},c],enabled:p||!m})});let Te=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),De=(function(e){return e[e.open=E.open]="open",e[e.closed=E.closed]="closed",e[e.startingStyle=E.startingStyle]="startingStyle",e[e.endingStyle=E.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Q=l.createContext(void 0);function X(){const e=l.useContext(Q);if(e===void 0)throw new Error(W(26));return e}const we={...j,...B,nestedDialogOpen(e){return e?{[De.nestedDialogOpen]:""}:null}},_e=l.forwardRef(function(t,o){const{render:r,className:d,style:a,finalFocus:p,initialFocus:c,...i}=t,{store:n}=T(),m=n.useState("descriptionElementId"),C=n.useState("disablePointerDismissal"),S=n.useState("floatingRootContext"),O=n.useState("popupProps"),P=n.useState("modal"),R=n.useState("mounted"),h=n.useState("nested"),f=n.useState("nestedOpenDialogCount"),g=n.useState("open"),L=n.useState("openMethod"),x=n.useState("titleElementId"),u=n.useState("transitionStatus"),b=n.useState("role"),k=S.useState("floatingId"),M=i.id??k;X(),V({open:g,ref:n.context.popupRef,onComplete(){g&&n.context.onOpenChangeComplete?.(!0)}});const F=c===void 0?ae(n.context.popupRef):c,N=f>0,y=n.useStateSetter("popupElement"),Z=w("div",t,{state:{open:g,nested:h,transitionStatus:u,nestedDialogOpen:N},props:[O,{id:M,"aria-labelledby":x??void 0,"aria-describedby":m??void 0,role:b,...ie,hidden:!R,onKeyDown(_){le.has(_.key)&&_.stopPropagation()},style:{[Te.nestedDialogs]:f}},i],ref:[o,n.context.popupRef,y],stateAttributesMapping:we});return I.jsx(de,{context:S,openInteractionType:L,disabled:!R,closeOnFocusOut:!C,initialFocus:F,returnFocus:p,modal:P!==!1,restoreFocus:"popup",children:Z})}),He=l.forwardRef(function(t,o){const{keepMounted:r=!1,...d}=t,{store:a}=T(),p=a.useState("mounted"),c=a.useState("modal"),i=a.useState("open");return p||r?I.jsx(Q.Provider,{value:r,children:I.jsxs(A,{ref:o,...d,children:[p&&c===!0&&I.jsx(ue,{ref:a.context.internalBackdropRef,inert:ee(!i)}),t.children]})}):null});function be(e){const{store:t,actionsRef:o}=e,r=t.useState("open");pe(t,r),ce(t);const{forceUnmount:d}=ge(r,t),a=l.useCallback(()=>{t.setOpen(!1,te(ne))},[t]);l.useImperativeHandle(o,()=>({unmount:d,close:a}),[d,a])}function ke({store:e,parentContext:t,isDrawer:o}){const r=e.useState("open"),d=e.useState("disablePointerDismissal"),a=e.useState("modal"),p=e.useState("popupElement"),c=e.useState("floatingRootContext"),[i,n]=l.useState(0),[m,C]=l.useState(0),S=i===0,O=fe(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(f){if(!e.context.outsidePressEnabledRef.current||"button"in f&&f.button!==0||"touches"in f&&f.touches.length!==1)return!1;const g=oe(f);return S&&!d?a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===g||e.context.backdropRef.current===g||se(g,p)&&!g?.hasAttribute("data-base-ui-portal"):!0:!1},escapeKey:S});me(r&&a===!0,p),e.useContextCallback("onNestedDialogOpen",(f,g)=>{n(f),C(g)}),e.useContextCallback("onNestedDialogClose",()=>{n(0),C(0)}),l.useEffect(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(i+1,m+(o?1:0)),t?.onNestedDialogClose&&!r&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&r&&t.onNestedDialogClose()}),[o,r,i,m,t]);const P=O.reference??v,R=O.trigger??v,h=O.floating??v;return Se(e,{activeTriggerProps:P,inactiveTriggerProps:R,popupProps:h,nestedOpenDialogCount:i,nestedOpenDrawerCount:m}),null}const Me={...ye,modal:s(e=>e.modal),nested:s(e=>e.nested),nestedOpenDialogCount:s(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:s(e=>e.nestedOpenDrawerCount),disablePointerDismissal:s(e=>e.disablePointerDismissal),openMethod:s(e=>e.openMethod),descriptionElementId:s(e=>e.descriptionElementId),titleElementId:s(e=>e.titleElementId),viewportElement:s(e=>e.viewportElement),role:s(e=>e.role)};class K extends re{constructor(t,o,r=!1){const d=new $,a=Fe(t);a.floatingRootContext=Ie(d,o,r),super(a,{popupRef:l.createRef(),backdropRef:l.createRef(),internalBackdropRef:l.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:d,onOpenChange:void 0,onOpenChangeComplete:void 0},Me)}setOpen=(t,o)=>{if(o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,o);const r={open:t};Ce(r,t,o.trigger),this.update(r)};static useStore(t,o){return Pe(t,(d,a)=>new K(o,d,a),!0).store}}function Fe(e={}){return{...he(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function Ne(e,t="dialog"){const{children:o,open:r,defaultOpen:d=!1,onOpenChange:a,onOpenChangeComplete:p,disablePointerDismissal:c=!1,modal:i=!0,actionsRef:n,handle:m,triggerId:C,defaultTriggerId:S=null}=e,O=t==="drawer",P=t==="alert-dialog",R=P?!0:i,h=P||c,f=P?"alertdialog":"dialog",g=T(!0),x={modal:R,disablePointerDismissal:h,nested:!!g,role:f},u=K.useStore(m?.store,{open:d,openProp:r,activeTriggerId:S,triggerIdProp:C,...x});Oe(()=>{const y=r===void 0&&u.state.open===!1&&d===!0?{open:!0,activeTriggerId:S}:null;P?u.update(y?{...x,...y}:x):y&&u.update(y)}),u.useControlledProp("openProp",r),u.useControlledProp("triggerIdProp",C),u.useSyncedValues(x),u.useContextCallback("onOpenChange",a),u.useContextCallback("onOpenChangeComplete",p);const b=u.useState("open"),k=u.useState("mounted"),M=u.useState("payload");be({store:u,actionsRef:n});const F=b||k,N=l.useMemo(()=>({store:u}),[u]);return I.jsx(q.Provider,{value:!1,children:I.jsxs(z.Provider,{value:N,children:[F&&I.jsx(ke,{store:u,parentContext:g?.store.context,isDrawer:O}),typeof o=="function"?o({payload:M}):o]})})}function Je(e){const t=l.useContext(q)?"drawer":"dialog";return Ne(e,t)}let J=(function(e){return e[e.open=E.open]="open",e[e.closed=E.closed]="closed",e[e.startingStyle=E.startingStyle]="startingStyle",e[e.endingStyle=E.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Be={...j,...B,nested(e){return e?{[J.nested]:""}:null},nestedDialogOpen(e){return e?{[J.nestedDialogOpen]:""}:null}},We=l.forwardRef(function(t,o){const{render:r,className:d,style:a,children:p,...c}=t,i=X(),{store:n}=T(),m=n.useState("open"),C=n.useState("nested"),S=n.useState("transitionStatus"),O=n.useState("nestedOpenDialogCount"),P=n.useState("mounted"),R=n.useStateSetter("viewportElement"),h=O>0;return w("div",t,{enabled:i||P,state:{open:m,nested:C,transitionStatus:S,nestedDialogOpen:h},ref:[o,R],stateAttributesMapping:Be,props:[{role:"presentation",hidden:!P,style:{pointerEvents:m?void 0:"none"},children:p},c]})}),Ye=l.forwardRef(function(t,o){const{render:r,className:d,style:a,id:p,...c}=t,{store:i}=T(),n=Re(p);return i.useSyncedValueWithCleanup("titleElementId",n),w("h2",t,{ref:o,props:[{id:n},c]})});export{Je as D,He as a,Le as b,We as c,_e as d,Ye as e,Ie as f,he as g,ye as p,T as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as d,j as n,v as a}from"./__vite-browser-external-CxN2E6q5.js";function v({children:i,delay:t=0,duration:o=.35,y:e=12,className:s="",once:r=!0}){return d()?n.jsx("div",{className:s,children:i}):n.jsx(a.div,{initial:{opacity:0,y:e},animate:{opacity:1,y:0},transition:{duration:o,delay:t,ease:[.16,1,.3,1]},className:s,children:i})}function x({children:i,staggerDelay:t=.1,initialDelay:o=0,className:e=""}){return d()?n.jsx("div",{className:e,children:i}):n.jsx(a.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:t,delayChildren:o}}},className:e,children:i})}function h({children:i,className:t="",y:o=12}){return d()?n.jsx("div",{className:t,children:i}):n.jsx(a.div,{variants:{hidden:{opacity:0,y:o},visible:{opacity:1,y:0,transition:{duration:.35,ease:[.16,1,.3,1]}}},className:t,children:i})}export{v as F,x as S,h as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,s as c,j as t}from"./__vite-browser-external-CxN2E6q5.js";function u({repo:r="mm7894215/TokenTracker"}){const[a,o]=s.useState(null);return s.useEffect(()=>{if(typeof window>"u")return;const n=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,i=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));c({prefersReducedMotion:n,screenshotCapture:i})&&fetch(`https://api.github.com/repos/${r}`).then(e=>e.json()).then(e=>{e&&typeof e.stargazers_count=="number"&&o(e.stargazers_count)}).catch(()=>{})},[r]),t.jsxs("a",{href:`https://github.com/${r}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[t.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"shrink-0 fill-oai-gray-700 dark:fill-oai-gray-300",children:t.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),t.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap",children:"Star"}),a!==null&&t.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums whitespace-nowrap",children:a})]})}export{u as H};
|