tokentracker-cli 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.de.md +5 -5
  2. package/README.ja.md +3 -3
  3. package/README.ko.md +3 -3
  4. package/README.md +6 -5
  5. package/README.zh-CN.md +3 -3
  6. package/THIRD_PARTY_NOTICES.md +92 -0
  7. package/dashboard/dist/THIRD_PARTY_NOTICES.txt +92 -0
  8. package/dashboard/dist/assets/AchievementBadge-Dazs3pEa.js +1 -0
  9. package/dashboard/dist/assets/AchievementsPage-LWnxZvmw.js +2 -0
  10. package/dashboard/dist/assets/{AchievementsSection-CDUUEfIi.js → AchievementsSection-BLqczmU9.js} +1 -1
  11. package/dashboard/dist/assets/BadgeDetailModal-B_n4aj2S.js +1 -0
  12. package/dashboard/dist/assets/{BotAnimated-Dx_vvTtC.js → BotAnimated-KDWI_YcZ.js} +1 -1
  13. package/dashboard/dist/assets/Card-BYoxd4OC.js +1 -0
  14. package/dashboard/dist/assets/CloudCheckoutPage-BR2_B03P.js +1 -0
  15. package/dashboard/dist/assets/CloudPage-DL5RkJKK.js +1 -0
  16. package/dashboard/dist/assets/CloudUsageExport-C_DqZKo1.js +4 -0
  17. package/dashboard/dist/assets/CommandPalette-DkCaIQI4.js +1 -0
  18. package/dashboard/dist/assets/CommunityStatsModal-pX9OePi4.js +1 -0
  19. package/dashboard/dist/assets/{ConfirmModal-BQ-xB1S_.js → ConfirmModal-tkgZwz4u.js} +1 -1
  20. package/dashboard/dist/assets/Controls-MTUhGWy8.js +1 -0
  21. package/dashboard/dist/assets/DashboardPage-SOx-A7lH.js +1 -0
  22. package/dashboard/dist/assets/DateRangePopover-B-BMOm3O.js +1 -0
  23. package/dashboard/dist/assets/{DevicePage-Dg6XkIaY.js → DevicePage-DSK9lm7v.js} +1 -1
  24. package/dashboard/dist/assets/DialogClose-uVUNu4rg.js +1 -0
  25. package/dashboard/dist/assets/DialogDescription-DBqGGWNj.js +1 -0
  26. package/dashboard/dist/assets/DialogTitle-B-VifiA3.js +1 -0
  27. package/dashboard/dist/assets/{FadeIn-ChVf45WW.js → FadeIn-B6lrj4uo.js} +1 -1
  28. package/dashboard/dist/assets/{HeaderGithubStar-B740_G7a.js → HeaderGithubStar-Cx5zOhXa.js} +1 -1
  29. package/dashboard/dist/assets/{HoverTooltip-BzP5FudR.js → HoverTooltip-DY1ENf69.js} +1 -1
  30. package/dashboard/dist/assets/{IpCheckPage-BuZH3F14.js → IpCheckPage-D6TEq64d.js} +1 -1
  31. package/dashboard/dist/assets/LandingPage-OdZUfq--.js +2 -0
  32. package/dashboard/dist/assets/LeaderboardPage-DCK5xcAt.js +2 -0
  33. package/dashboard/dist/assets/LeaderboardProBadge-CBXJ1u_m.js +1 -0
  34. package/dashboard/dist/assets/{LeaderboardProfileModal-OUZvO6u-.js → LeaderboardProfileModal-Ccdzb7QK.js} +4 -4
  35. package/dashboard/dist/assets/{LeaderboardProfilePage-bHI1oTEK.js → LeaderboardProfilePage-CFXlZ0fL.js} +2 -2
  36. package/dashboard/dist/assets/LimitsPage-5krjm-g9.js +9 -0
  37. package/dashboard/dist/assets/{LocalOnlyNotice-BaEq6qN7.js → LocalOnlyNotice-Rk1B8PaZ.js} +1 -1
  38. package/dashboard/dist/assets/LoginCard-DTTIm8vk.js +1 -0
  39. package/dashboard/dist/assets/LoginModal-BNcDdjfr.js +1 -0
  40. package/dashboard/dist/assets/LoginPage-CQgXP7Ee.js +1 -0
  41. package/dashboard/dist/assets/{PetPage-BPBsUHyL.js → PetPage-Cw_kAPRs.js} +1 -1
  42. package/dashboard/dist/assets/PopoverPopup-NYiGE8A2.js +1 -0
  43. package/dashboard/dist/assets/{ProviderIcon-BshO2uER.js → ProviderIcon-Bp7iFJ_m.js} +1 -1
  44. package/dashboard/dist/assets/{ResetPasswordPage-RTFTD8Dr.js → ResetPasswordPage-Cf9kAWDW.js} +1 -1
  45. package/dashboard/dist/assets/Select-kIcvQFAo.js +1 -0
  46. package/dashboard/dist/assets/SelectItemText-BpIsAg3b.js +1 -0
  47. package/dashboard/dist/assets/{SelfHostPage-BlwTt8XM.js → SelfHostPage-Ch2vvSwI.js} +1 -1
  48. package/dashboard/dist/assets/{ServiceStatusPage-BkIcJpYK.js → ServiceStatusPage-hoYBvGbu.js} +1 -1
  49. package/dashboard/dist/assets/SessionsPage-BzRB6q-Z.js +3 -0
  50. package/dashboard/dist/assets/SessionsPage-GV2fuNmd.css +1 -0
  51. package/dashboard/dist/assets/SettingsPage-DRl2uX-i.js +2 -0
  52. package/dashboard/dist/assets/SkillsPage-CkqThTZL.js +1 -0
  53. package/dashboard/dist/assets/{TokenGalaxy-DiXUpXKF.js → TokenGalaxy-eLG-UIZY.js} +1 -1
  54. package/dashboard/dist/assets/TooltipPopup-bnMJyilQ.js +1 -0
  55. package/dashboard/dist/assets/TrendMonitor-X7-aGzIv.js +19 -0
  56. package/dashboard/dist/assets/WidgetsPage-CGznIzrW.js +1 -0
  57. package/dashboard/dist/assets/{WrappedPage-ClEo-RmR.js → WrappedPage-p31-uUoF.js} +1 -1
  58. package/dashboard/dist/assets/__vite-browser-external-2g_4s3ot.js +45 -0
  59. package/dashboard/dist/assets/__vite-browser-external-LpFw4zXh.css +1 -0
  60. package/dashboard/dist/assets/agent-logos-2TVT3fIE.js +1 -0
  61. package/dashboard/dist/assets/arrow-left-DL0hAp_7.js +1 -0
  62. package/dashboard/dist/assets/{arrow-right-CwBz5dwb.js → arrow-right-DFCpnV_9.js} +1 -1
  63. package/dashboard/dist/assets/{arrow-up-right-jPmRN562.js → arrow-up-right-DLvfE0Wu.js} +1 -1
  64. package/dashboard/dist/assets/calendar-days-B0aDoKSG.js +1 -0
  65. package/dashboard/dist/assets/{check-CKwHc4Hv.js → check-C_cfrxiz.js} +1 -1
  66. package/dashboard/dist/assets/chevron-down-Ck8ml43e.js +1 -0
  67. package/dashboard/dist/assets/cloud-checkout-PYnwNfdH.js +1 -0
  68. package/dashboard/dist/assets/composite-INW-ELWX.js +1 -0
  69. package/dashboard/dist/assets/download-B7uokeIo.js +1 -0
  70. package/dashboard/dist/assets/{external-link-B5yXxdPy.js → external-link-CI3crg4K.js} +1 -1
  71. package/dashboard/dist/assets/{flame-CKjAluj_.js → flame-DCzvFKV1.js} +1 -1
  72. package/dashboard/dist/assets/{format-tokens-mk49THtv.js → format-tokens-CSTEYK2m.js} +1 -1
  73. package/dashboard/dist/assets/gift-dEHDFMc6.js +1 -0
  74. package/dashboard/dist/assets/{host-mode-efKlSYjX.js → host-mode-r2SW9Mdv.js} +1 -1
  75. package/dashboard/dist/assets/{icons-ZB1ZthjH.js → icons-q-3zvEkh.js} +1 -1
  76. package/dashboard/dist/assets/{index-BImBG3eS.js → index-BV7qwUw4.js} +1 -1
  77. package/dashboard/dist/assets/{index-BgdM7kBl.js → index-BbrsgHf4.js} +1 -1
  78. package/dashboard/dist/assets/{index-DweUMAUD.js → index-CyHYj9XI.js} +1 -1
  79. package/dashboard/dist/assets/info-BBdY9hV4.js +1 -0
  80. package/dashboard/dist/assets/{link-2-Dn2soiyd.js → link-2-CLPePfXs.js} +1 -1
  81. package/dashboard/dist/assets/{loader-circle-CNT630zn.js → loader-circle-ETrjzfmn.js} +1 -1
  82. package/dashboard/dist/assets/{modifiers.esm-WPx0bc2K.js → modifiers.esm-DHqnp2ol.js} +1 -1
  83. package/dashboard/dist/assets/module-BNnaKM__.js +3 -0
  84. package/dashboard/dist/assets/monitor-smartphone-D1kdzrdb.js +1 -0
  85. package/dashboard/dist/assets/play-Cxp-ronD.js +1 -0
  86. package/dashboard/dist/assets/plus-4n94VzDK.js +1 -0
  87. package/dashboard/dist/assets/provider-display-CRlbeO7t.js +42 -0
  88. package/dashboard/dist/assets/{react-B7SkZTgg.js → react-DlHjGQFN.js} +1 -1
  89. package/dashboard/dist/assets/safePolygon-CVZ27a2_.js +1 -0
  90. package/dashboard/dist/assets/{search-Ol3OZBm4.js → search-BDPr56_h.js} +1 -1
  91. package/dashboard/dist/assets/{server-DFCbznC7.js → server-Bm7fHvVa.js} +1 -1
  92. package/dashboard/dist/assets/{shield-check-YcmLwVZ6.js → shield-check-DtT8ACzI.js} +1 -1
  93. package/dashboard/dist/assets/{skills-api-C-9vK884.js → skills-api-Dc1-2qu6.js} +1 -1
  94. package/dashboard/dist/assets/{sortable.esm-CKC9NuR-.js → sortable.esm-B-qN-Xk2.js} +1 -1
  95. package/dashboard/dist/assets/store-gHeBU8dQ.js +1 -0
  96. package/dashboard/dist/assets/{terminal-B3_fCLFs.js → terminal-D4VZbvhg.js} +1 -1
  97. package/dashboard/dist/assets/{trash-CZGfgbFa.js → trash-BZtLAFQy.js} +1 -1
  98. package/dashboard/dist/assets/{use-community-stats-CW-qkYn7.js → use-community-stats-BdqndrbB.js} +1 -1
  99. package/dashboard/dist/assets/{use-latest-request-guard-DHv7vfFE.js → use-latest-request-guard-DhGg1cDS.js} +1 -1
  100. package/dashboard/dist/assets/use-limits-display-prefs-D3HOcRFv.js +1 -0
  101. package/dashboard/dist/assets/{use-native-settings-CWiLqfZh.js → use-native-settings-BniKwA_n.js} +1 -1
  102. package/dashboard/dist/assets/{use-ordered-list-Df8pw-WJ.js → use-ordered-list-b09H7EHq.js} +1 -1
  103. package/dashboard/dist/assets/use-pet-settings-CPZdlq_e.js +2 -0
  104. package/dashboard/dist/assets/use-reduced-motion-D1gcKJUo.js +1 -0
  105. package/dashboard/dist/assets/{use-transform-BHwEAfmO.js → use-transform-CIdxjmI8.js} +1 -1
  106. package/dashboard/dist/assets/use-usage-limits-eJlU65yY.js +1 -0
  107. package/dashboard/dist/assets/{useCurrency-pwClnCZ5.js → useCurrency-CM22CmAq.js} +1 -1
  108. package/dashboard/dist/assets/usePositioner-B3l2ulTw.js +1 -0
  109. package/dashboard/dist/assets/{useTokenFormat-BMvVAe6V.js → useTokenFormat-D7nzgxKw.js} +1 -1
  110. package/dashboard/dist/assets/zap-Daxct1WV.js +1 -0
  111. package/dashboard/dist/index.html +14 -12
  112. package/dashboard/dist/ip-check.html +2 -2
  113. package/dashboard/dist/leaderboard.html +2 -2
  114. package/dashboard/dist/llms.txt +2 -2
  115. package/dashboard/dist/share.html +2 -2
  116. package/package.json +3 -2
  117. package/src/commands/init.js +43 -1
  118. package/src/commands/status.js +27 -0
  119. package/src/commands/sync.js +54 -4
  120. package/src/commands/uninstall.js +19 -0
  121. package/src/lib/claude-config.js +47 -15
  122. package/src/lib/codex-rollout-parser.js +11 -3
  123. package/src/lib/command-runner.js +15 -1
  124. package/src/lib/cursor-config.js +2 -1
  125. package/src/lib/gemini-config.js +3 -2
  126. package/src/lib/local-api.js +13 -3
  127. package/src/lib/notify-command.js +38 -0
  128. package/src/lib/openclaw-session-plugin.js +47 -14
  129. package/src/lib/passive-mode.js +12 -0
  130. package/src/lib/pricing/curated-overrides.json +42 -5
  131. package/src/lib/pricing/matcher.js +14 -5
  132. package/src/lib/pricing/seed-snapshot.json +1 -1
  133. package/src/lib/rollout.js +150 -28
  134. package/src/lib/session-analytics.js +108 -9
  135. package/src/lib/usage-limits.js +183 -20
  136. package/src/lib/zcode-limits.js +218 -18
  137. package/src/lib/zcode-reset-credits.js +66 -0
  138. package/dashboard/dist/assets/AchievementBadge-BaqdyZaV.js +0 -1
  139. package/dashboard/dist/assets/AchievementsPage-B4Ju0guv.js +0 -2
  140. package/dashboard/dist/assets/BadgeDetailModal-B-XMJAvL.js +0 -1
  141. package/dashboard/dist/assets/Card-D-5mABVt.js +0 -1
  142. package/dashboard/dist/assets/CloudCheckoutPage-BELoh56h.js +0 -1
  143. package/dashboard/dist/assets/CloudPage-CfBruNxe.js +0 -1
  144. package/dashboard/dist/assets/CloudUsageExport-BoFU7xCT.js +0 -4
  145. package/dashboard/dist/assets/CommandPalette-BmmKZWn-.js +0 -1
  146. package/dashboard/dist/assets/CommunityStatsModal-BF77zVhN.js +0 -1
  147. package/dashboard/dist/assets/Controls-BnTeX7T4.js +0 -1
  148. package/dashboard/dist/assets/DashboardPage-BWulHa5J.js +0 -1
  149. package/dashboard/dist/assets/DialogClose-DAyilsH-.js +0 -1
  150. package/dashboard/dist/assets/DialogDescription-j4XnRy6y.js +0 -1
  151. package/dashboard/dist/assets/DialogTitle-B1iNGD2S.js +0 -1
  152. package/dashboard/dist/assets/LandingPage-Dtgq_caz.js +0 -2
  153. package/dashboard/dist/assets/LeaderboardPage-Di1kEg2O.js +0 -2
  154. package/dashboard/dist/assets/LeaderboardProBadge-h8FfR0au.js +0 -1
  155. package/dashboard/dist/assets/LimitsPage-DKojB73_.js +0 -8
  156. package/dashboard/dist/assets/LoginCard-Dn5Xy4If.js +0 -1
  157. package/dashboard/dist/assets/LoginModal-C5h-5GOA.js +0 -1
  158. package/dashboard/dist/assets/LoginPage-BpX8Tgjj.js +0 -1
  159. package/dashboard/dist/assets/PopoverPopup-CVTiEVHs.js +0 -1
  160. package/dashboard/dist/assets/Select-CtTceC4T.js +0 -1
  161. package/dashboard/dist/assets/SelectItemText-C7xi8iGp.js +0 -1
  162. package/dashboard/dist/assets/SessionsPage-BngTWN7Q.css +0 -1
  163. package/dashboard/dist/assets/SessionsPage-okHobk_L.js +0 -3
  164. package/dashboard/dist/assets/SettingsPage-C-cc6wcF.js +0 -2
  165. package/dashboard/dist/assets/SkillsPage-D2LlKKJN.js +0 -1
  166. package/dashboard/dist/assets/TrendMonitor-C88S-5aa.js +0 -19
  167. package/dashboard/dist/assets/WidgetsPage-WsEFPNwp.js +0 -1
  168. package/dashboard/dist/assets/__vite-browser-external-DFRX9dp-.css +0 -1
  169. package/dashboard/dist/assets/__vite-browser-external-DUJeOWgd.js +0 -45
  170. package/dashboard/dist/assets/agent-logos-BM9jlReI.js +0 -1
  171. package/dashboard/dist/assets/arrow-left-BEM-HVmC.js +0 -1
  172. package/dashboard/dist/assets/cloud-checkout-nYNHDFoR.js +0 -1
  173. package/dashboard/dist/assets/composite-B4Z3F65o.js +0 -1
  174. package/dashboard/dist/assets/download-CJUnX1Bs.js +0 -1
  175. package/dashboard/dist/assets/info-CyDY7NYM.js +0 -1
  176. package/dashboard/dist/assets/module-WSx8viXK.js +0 -3
  177. package/dashboard/dist/assets/monitor-smartphone-C-qC0RAt.js +0 -1
  178. package/dashboard/dist/assets/plus-Cx82jb7o.js +0 -1
  179. package/dashboard/dist/assets/provider-display-CodMmiRb.js +0 -42
  180. package/dashboard/dist/assets/safePolygon-CKpREa4K.js +0 -1
  181. package/dashboard/dist/assets/store-C9yWYHfg.js +0 -1
  182. package/dashboard/dist/assets/use-limits-display-prefs-NZ-AAYD5.js +0 -1
  183. package/dashboard/dist/assets/use-pet-settings-Bg2CDprr.js +0 -2
  184. package/dashboard/dist/assets/use-reduced-motion-iDZEUyua.js +0 -1
  185. package/dashboard/dist/assets/use-usage-limits-CSxFFn3_.js +0 -1
  186. package/dashboard/dist/assets/usePositioner-B0j1orGj.js +0 -1
  187. package/dashboard/dist/assets/zap-DvX2aYx5.js +0 -1
@@ -1,4 +0,0 @@
1
- import{A as ee,r as o,D as V,af as Z,ao as te,ap as ae,ah as re,ag as ne,ae as oe,a as se,aq as H,j as u,B as $,c as i,ar as ce}from"./__vite-browser-external-DUJeOWgd.js";import{D as ie}from"./download-CJUnX1Bs.js";const X={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};X.node;const xe=ee(X),K="tt.qualityPerDollar.enabled";function B(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(K)==="1"}catch{return!1}}function he(){const[e,a]=o.useState(B);o.useEffect(()=>{if(typeof window>"u")return;const n=r=>{(r.key===null||r.key===K)&&a(B())};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)},[]);const t=o.useCallback(n=>{const r=!!n;a(r);try{window.localStorage.setItem(K,r?"1":"0")}catch{}},[]),s=o.useCallback(()=>t(!B()),[t]);return{enabled:e,setEnabled:t,toggle:s}}const Y="tt.sessionEfficiency.enabled";function J(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Y)==="1"}catch{return!1}}function we(){const[e,a]=o.useState(J);o.useEffect(()=>{if(typeof window>"u")return;const n=r=>{(r.key===null||r.key===Y)&&a(J())};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)},[]);const t=o.useCallback(n=>{const r=!!n;a(r);try{window.localStorage.setItem(Y,r?"1":"0")}catch{}},[]),s=o.useCallback(()=>t(!J()),[t]);return{enabled:e,setEnabled:t,toggle:s}}const q=["total_tokens","billable_total_tokens","input_tokens","output_tokens","cached_input_tokens","cache_creation_input_tokens","reasoning_output_tokens","conversation_count","total_cost_usd"];class c extends Error{constructor(a,t=0){super(a),this.code=a,this.status=t}code;status}function A(e){return typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number.isFinite(Date.parse(e+"T00:00:00Z"))&&new Date(e+"T00:00:00Z").toISOString().slice(0,10)===e}function le(e,a){if(!oe(e))throw new c("export_auth_required",401);try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=JSON.parse(atob(t.padEnd(Math.ceil(t.length/4)*4,"=")));if((s.sub||s.user_id)!==a||s.role!=="authenticated"||!Number.isFinite(s.exp)||s.exp*1e3<=Date.now())throw Error()}catch{throw new c("export_auth_required",401)}}function W(e){if(typeof e?.membership?.can_read_cloud!="boolean")throw new c("export_invalid_data",503);if(!e.membership.can_read_cloud)throw new c("export_access_denied",402);const a=e.membership;return JSON.stringify([e.environment,a.phase,a.status,a.hosting_mode,a.expires_at,a.trial_ends_at,a.transition_ends_at,a.read_only_until])}async function ue({userId:e,auth:a,from:t,to:s,deviceId:n=null,signal:r,assertCurrent:h=()=>{},fetchImpl:R=fetch}){if(!A(t)||!A(s)||t>s)throw new c("export_invalid_dates",400);if(typeof a!="function")throw new c("export_auth_required",401);if(!e||n&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n))throw new c("export_invalid_scope",400);const S=V(),k=Z();if(!S)throw new c("export_instance_changed",409);const d=()=>{if(r?.aborted)throw new c("export_cancelled",409);if(h(),S!==V()||k!==Z())throw new c("export_instance_changed",409)};async function N(f,_){d();const w=await ae(a);d(),le(w||"",e);const p=new URL(re(S,f));for(const[g,b]of Object.entries(_))p.searchParams.set(g,b);const D=new AbortController,I=()=>D.abort();r?.addEventListener("abort",I,{once:!0});const y=setTimeout(I,25e3);try{const g=await ne(p.toString(),{method:"GET",cache:"no-store",redirect:"error",signal:D.signal,headers:{Accept:"application/json",Authorization:"Bearer "+w,...k?{apikey:k}:{}}},R);if(d(),!g.ok)throw new c(g.status===401?"export_auth_required":g.status===402||g.status===403?"export_access_denied":"export_failed",g.status);const b=await g.json();return d(),b}finally{clearTimeout(y),r?.removeEventListener("abort",I)}}const O=W(await N("tokentracker-billing",{action:"account"})),L={from:t,to:s,tz_offset_minutes:"0",...n?{device_id:n}:{}};if(await N("tokentracker-account-daily",L),W(await N("tokentracker-billing",{action:"account"}))!==O)throw new c("export_access_changed",409);const l=await N("tokentracker-account-daily",L);if(!A(l?.from)||!A(l?.to)||l.from<t||l.to>s||l.from>l.to||!Array.isArray(l.data)||l.data.length>1096)throw new c("export_invalid_data",503);const j=new Set,C=l.data.map(f=>{if(!A(f?.day)||f.day<l.from||f.day>l.to||j.has(f.day))throw new c("export_invalid_data",503);j.add(f.day);const _={day:f.day};for(const w of q){const p=f[w];if(typeof p!="number"||!Number.isFinite(p)||p<0||w!=="total_cost_usd"&&!Number.isSafeInteger(p))throw new c("export_invalid_data",503);_[w==="total_cost_usd"?"estimated_cost_usd":w]=p}return _}).sort((f,_)=>f.day.localeCompare(_.day));return d(),{schema:"tokentracker.cloud-usage.v1",metadata:{source:"cloud",backend_origin:new URL(S).origin,exported_at:new Date().toISOString(),timezone:"UTC",requested_range:{from:t,to:s},effective_range:{from:l.from,to:l.to},device_scope:n?"selected":"all",aggregation:"daily_all_providers",cost_currency:"USD",cost_basis:"estimated",row_count:C.length},rows:C}}function de(e){const a=String(e??"");return'"'+(/^[\s]*[=+\-@]/.test(a)?"'"+a:a).replace(/"/g,'""')+'"'}function fe(e,a){if(a==="json")return JSON.stringify(e,null,2)+`
2
- `;const t=e.metadata,s=["row_type","source","backend_origin","exported_at","timezone","cost_currency","cost_basis","requested_from","requested_to","effective_from","effective_to","device_scope","aggregation","row_count","day",...q.map(r=>r==="total_cost_usd"?"estimated_cost_usd":r)],n=[t.source,t.backend_origin,t.exported_at,t.timezone,t.cost_currency,t.cost_basis,t.requested_range.from,t.requested_range.to,t.effective_range.from,t.effective_range.to,t.device_scope,t.aggregation,t.row_count];return[s,["metadata",...n,"",...q.map(()=>"")],...e.rows.map(r=>["usage",...n,r.day,...q.map(h=>r[h==="total_cost_usd"?"estimated_cost_usd":h])])].map(r=>r.map(de).join(",")).join(`\r
3
- `)+`\r
4
- `}async function pe(e,a,{signal:t,assertCurrent:s=()=>{}}={}){const n=fe(e,a),r=`tokentracker-cloud-usage-${e.metadata.effective_range.from}-${e.metadata.effective_range.to}.${a}`,h=()=>{if(t?.aborted)throw new c("export_cancelled",409);s()};h();const R=await te({filename:r,content:n,format:a,signal:t});if(h(),R?.saved===!0)return;if(R!==null)throw new c("export_failed",503);const S=new Blob([n],{type:a==="csv"?"text/csv;charset=utf-8":"application/json;charset=utf-8"}),k=URL.createObjectURL(S);try{const d=document.createElement("a");d.href=k,d.download=r,document.body.appendChild(d);try{d.click()}finally{d.remove()}}finally{setTimeout(()=>URL.revokeObjectURL(k),1e3)}}function ge(e){return e?.status===401?i("cloud.export.error_auth"):e?.status===402||e?.status===403?i("cloud.export.error_access"):e?.code==="export_invalid_dates"?i("cloud.export.error_dates"):e?.status===409?i("cloud.export.error_changed"):i("cloud.export.error_failed")}function ye({from:e,to:a,deviceId:t=null,auth:s}){const n=se(),r=s||n,h=r?.signedIn?r.user?.id:null,R=new Date().toISOString().slice(0,10),S=new Date(Date.now()-29*864e5).toISOString().slice(0,10),[k,d]=o.useState(e||S),[N,O]=o.useState(a||R),[L,l]=o.useState(!1),[j,C]=o.useState(!1),[f,_]=o.useState(null),[w,p]=o.useState(null),D=o.useId(),I=o.useRef(null),y=o.useRef(0),g=o.useRef(null),b=o.useRef(!1),U=o.useRef(!1);if(I.current={userId:h,client:r?.client,start:k,end:N,deviceId:t,from:e,to:a},o.useEffect(()=>{U.current=!0;const m=()=>{++y.current,g.current?.abort(),b.current=!1,C(!1),p(null),_(null)};return window.addEventListener(H,m),()=>{U.current=!1,++y.current,g.current?.abort(),window.removeEventListener(H,m)}},[]),o.useEffect(()=>{++y.current,g.current?.abort(),b.current=!1,C(!1),_(null),p(null),e&&d(e),a&&O(a)},[h,r?.client,e,a,t]),!h||r?.enabled===!1)return null;function G(m,x){++y.current,g.current?.abort(),b.current=!1,C(!1),_(null),p(null),m(x)}async function M(m){if(b.current)return;b.current=!0;const x=I.current,F=++y.current,P=new AbortController;g.current=P,C(!0),_(null),p(null);const T=()=>{const v=I.current;if(!U.current||F!==y.current||!v||Object.keys(x).some(E=>x[E]!==v[E])||x.client&&!ce(x.client))throw new c("export_cancelled",409)};try{const v=await ue({userId:x.userId,auth:r.getAccessToken,from:x.start,to:x.end,deviceId:x.deviceId,signal:P.signal,assertCurrent:T});T(),await pe(v,m,{signal:P.signal,assertCurrent:T}),T();const E=v.metadata.effective_range,Q=v.rows.length?i("cloud.export.success",{count:v.rows.length,from:E.from,to:E.to}):i("cloud.export.empty");p(E.from!==x.start||E.to!==x.end?`${Q} ${i("cloud.export.truncated",{from:E.from,to:E.to})}`:Q)}catch(v){U.current&&F===y.current&&_(ge(v))}finally{F===y.current&&(b.current=!1,U.current&&C(!1))}}const z="hover:!text-oai-black dark:hover:!text-oai-white hover:!bg-oai-gray-100 dark:hover:!bg-oai-gray-800 focus:!ring-oai-gray-500/40";return u.jsxs("section",{className:"tt-cloud-theme","aria-label":i("cloud.export.open"),children:[u.jsxs($,{type:"button",variant:"ghost",size:"sm",className:z,"aria-expanded":L,"aria-controls":D,onClick:()=>l(m=>!m),children:[u.jsx(ie,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),i("cloud.export.open")]}),L?u.jsxs("div",{id:D,className:"mt-2 border-l-2 border-oai-gray-200 pl-3 dark:border-oai-gray-700","aria-busy":j,children:[u.jsx("p",{className:"max-w-prose text-xs leading-5 text-oai-gray-600 dark:text-oai-gray-300",children:i("cloud.export.description")}),u.jsxs("div",{className:"mt-3 flex flex-wrap items-end gap-3",children:[u.jsxs("label",{className:"text-xs text-oai-gray-700 dark:text-oai-gray-200",children:[i("cloud.export.from"),u.jsx("input",{type:"date",value:k,onChange:m=>G(d,m.target.value),className:"mt-1 block rounded-md border border-oai-gray-300 bg-white px-2 py-1.5 text-sm text-oai-black focus:outline-none focus:ring-2 focus:ring-inset focus:ring-oai-gray-500/40 dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:text-oai-white"})]}),u.jsxs("label",{className:"text-xs text-oai-gray-700 dark:text-oai-gray-200",children:[i("cloud.export.to"),u.jsx("input",{type:"date",value:N,onChange:m=>G(O,m.target.value),className:"mt-1 block rounded-md border border-oai-gray-300 bg-white px-2 py-1.5 text-sm text-oai-black focus:outline-none focus:ring-2 focus:ring-inset focus:ring-oai-gray-500/40 dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:text-oai-white"})]}),u.jsx($,{type:"button",variant:"ghost",size:"sm",className:z,disabled:j,onClick:()=>M("csv"),children:i("cloud.export.csv")}),u.jsx($,{type:"button",variant:"ghost",size:"sm",className:z,disabled:j,onClick:()=>M("json"),children:i("cloud.export.json")})]}),j?u.jsx("p",{role:"status",className:"mt-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:i("cloud.export.busy")}):null,f?u.jsx("p",{role:"alert",className:"mt-2 text-xs text-red-700 dark:text-red-300",children:f}):null,w?u.jsx("p",{role:"status",className:"mt-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:w}):null]}):null]})}export{ye as C,xe as P,we as a,he as u};
@@ -1 +0,0 @@
1
- import{A as M,d as E,r,a2 as I,c as i,j as o,J as A}from"./__vite-browser-external-DUJeOWgd.js";import{m as j}from"./react-B7SkZTgg.js";import{P as L}from"./ProviderIcon-BshO2uER.js";import{g as $}from"./skills-api-C-9vK884.js";import{S as R}from"./search-Ol3OZBm4.js";import{u as K}from"./use-reduced-motion-iDZEUyua.js";import{A as q}from"./index-BImBG3eS.js";const N={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};N.node;const O=M(N),T=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function J(){const f=E(),d=K(),[u,g]=r.useState(!1),[x,h]=r.useState(""),[n,l]=r.useState(0),[m,k]=r.useState([]),b=r.useRef(null),w=r.useRef(null);r.useEffect(()=>{const e=t=>{(t.metaKey||t.ctrlKey)&&(t.key==="k"||t.key==="K")&&(t.preventDefault(),g(c=>!c))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),r.useEffect(()=>{if(!u)return;h(""),l(0);const e=requestAnimationFrame(()=>b.current?.focus());return T&&!m.length&&$().then(t=>k(t?.skills||[])).catch(()=>k([])),()=>cancelAnimationFrame(e)},[u,m.length]);const y=r.useMemo(()=>{const e=I().flatMap(a=>a.items.map(c=>({kind:"page",id:`page:${c.id}`,label:c.label,sub:i("cmdk.group.pages"),Icon:c.icon,run:()=>f(c.to)}))),t=(m||[]).map(a=>({kind:"skill",id:`skill:${a.id||a.directory}`,label:a.name||a.directory,sub:a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:i("cmdk.group.skills"),provider:(a.targets||[])[0]||"claude",run:()=>f(`/skills?skill=${encodeURIComponent(a.directory||a.id)}`)}));return[...e,...t]},[f,m]),s=r.useMemo(()=>{const e=x.trim().toLowerCase();return e?y.filter(t=>t.label.toLowerCase().includes(e)||String(t.sub||"").toLowerCase().includes(e)):y},[y,x]);r.useEffect(()=>{n>=s.length&&l(s.length?s.length-1:0)},[n,s.length]),r.useEffect(()=>{if(!u)return;w.current?.querySelector(`[data-cmdk-index="${n}"]`)?.scrollIntoView({block:"nearest"})},[n,u]);const p=r.useCallback(()=>g(!1),[]),v=r.useCallback(e=>{e&&(p(),e.run())},[p]),C=e=>{e.key==="ArrowDown"?(e.preventDefault(),l(t=>Math.min(t+1,Math.max(0,s.length-1)))):e.key==="ArrowUp"?(e.preventDefault(),l(t=>Math.max(t-1,0))):e.key==="Enter"?(e.preventDefault(),v(s[n])):e.key==="Escape"&&(e.preventDefault(),p())},S={duration:d?0:.12},D=d?{duration:0}:{type:"spring",stiffness:460,damping:34,mass:.6};return o.jsx(q,{children:u?o.jsxs(j.div,{className:"fixed inset-0 z-[120] flex items-start justify-center px-4 pt-[16vh]",initial:d?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:S,children:[o.jsx("button",{type:"button","aria-label":i("cmdk.close"),onClick:p,className:"absolute inset-0 cursor-default bg-oai-black/40"}),o.jsxs(j.div,{role:"dialog","aria-modal":"true","aria-label":i("cmdk.open_aria"),initial:d?!1:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:d?{opacity:0}:{opacity:0,y:-8,scale:.985},transition:D,className:"relative w-full max-w-xl overflow-hidden rounded-2xl border border-oai-gray-200 bg-oai-white shadow-2xl dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[o.jsxs("div",{className:"flex items-center gap-2.5 border-b border-oai-gray-200 px-4 dark:border-oai-gray-800",children:[o.jsx(R,{className:"h-4 w-4 shrink-0 text-oai-gray-400","aria-hidden":!0}),o.jsx("input",{ref:b,type:"text",value:x,onChange:e=>{h(e.target.value),l(0)},onKeyDown:C,"aria-label":i("cmdk.placeholder"),"aria-controls":"cmdk-listbox","aria-activedescendant":s[n]?`cmdk-opt-${n}`:void 0,role:"combobox","aria-expanded":"true",placeholder:i("cmdk.placeholder"),className:"h-12 w-full bg-transparent text-sm text-oai-black placeholder:text-oai-gray-400 focus:outline-none dark:text-white"})]}),o.jsx("div",{ref:w,id:"cmdk-listbox",role:"listbox",className:"max-h-[min(56vh,22rem)] overflow-y-auto p-1.5",children:s.length===0?o.jsx("div",{className:"px-3 py-8 text-center text-sm text-oai-gray-500 dark:text-oai-gray-400",children:i("cmdk.empty")}):s.map((e,t)=>{const a=t===n;return o.jsxs("button",{type:"button",role:"option",id:`cmdk-opt-${t}`,"data-cmdk-index":t,"aria-selected":a,onMouseMove:()=>l(t),onClick:()=>v(e),className:A("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors",a?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200"),children:[o.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-400",children:e.kind==="skill"?o.jsx(L,{provider:e.provider,size:16}):o.jsx(e.Icon,{className:"h-4 w-4","aria-hidden":!0})}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:e.label}),o.jsx("span",{className:"shrink-0 truncate text-xs text-oai-gray-400 dark:text-oai-gray-500",children:e.sub}),a?o.jsx(O,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}):null]},e.id)})})]})]}):null})}export{J as CommandPalette};
@@ -1 +0,0 @@
1
- import{A as R,j as e,aj as P,l as z,r as D,c as n,X as S,i as K}from"./__vite-browser-external-DUJeOWgd.js";import{m as M}from"./react-B7SkZTgg.js";import{A as U,W as B}from"./icons-ZB1ZthjH.js";import{u as F}from"./useTokenFormat-BMvVAe6V.js";import{P as G}from"./ProviderIcon-BshO2uER.js";import{T as W}from"./TrendMonitor-C88S-5aa.js";import{T as V}from"./AchievementBadge-BaqdyZaV.js";import{T as X}from"./terminal-B3_fCLFs.js";import{D as Y,a as Z,b as H,c as q,d as J,e as Q}from"./DialogTitle-B1iNGD2S.js";import{D as ee}from"./DialogDescription-j4XnRy6y.js";import{D as ae}from"./DialogClose-DAyilsH-.js";import"./useCurrency-pwClnCZ5.js";import"./use-latest-request-guard-DHv7vfFE.js";import"./PopoverPopup-CVTiEVHs.js";import"./store-C9yWYHfg.js";import"./composite-B4Z3F65o.js";import"./SelectItemText-C7xi8iGp.js";import"./usePositioner-B0j1orGj.js";import"./safePolygon-CKpREa4K.js";import"./use-reduced-motion-iDZEUyua.js";import"./zap-DvX2aYx5.js";import"./flame-CKjAluj_.js";import"./shield-check-YcmLwVZ6.js";const C={name:"trending-down",size:24,node:[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]};C.node;const te=R(C),O=10,_={input:"var(--community-token-input)",cache_read:"var(--community-token-cache-read)",cache_write:"var(--community-token-cache-write)",output:"var(--community-token-output)",reasoning:"var(--community-token-reasoning)"},re={CLAUDE:"var(--community-claude)",CODEX:"var(--community-codex)",GEMINI:"var(--community-gemini)",CURSOR:"var(--community-cursor)",OPENCODE:"var(--community-opencode)",HERMES:"var(--community-hermes)",KIMI:"var(--community-kimi)",MIMO:"var(--community-mimo)",COPILOT:"var(--community-copilot)",KIRO:"var(--community-kiro)",GROK:"var(--community-grok)",DEEPSEEK:"var(--community-deepseek)",ZCODE:"var(--community-zcode)",WORKBUDDY:"var(--community-workbuddy)",MINIMAX:"var(--community-minimax)",DROID:"var(--community-droid)"};function ie(t){return re[String(t||"").toUpperCase()]||"var(--community-muted)"}const se=[[/claude|fable|opus|sonnet|haiku/,"CLAUDE"],[/gpt|codex|o3|o4/,"CODEX"],[/gemini/,"GEMINI"],[/composer|cursor/,"CURSOR"],[/kimi/,"KIMI"],[/mimo/,"MIMO"],[/copilot/,"COPILOT"],[/kiro/,"KIRO"],[/grok/,"GROK"],[/deepseek/,"DEEPSEEK"],[/glm/,"ZCODE"],[/hy3/,"WORKBUDDY"],[/minimax/,"MINIMAX"]],g=["overview","providers","community","models"];function oe(t){const s=String(t||"").toLowerCase(),a=se.find(([i])=>i.test(s));return a?a[1]:""}function u(t){const s=Number(t);return Number.isFinite(s)?`${s.toFixed(1)}%`:"—"}function p(t){return K(Number(t)||0)}function ne(t){return t?new Date(`${t}T00:00:00Z`).toLocaleDateString(void 0,{month:"short",day:"numeric",timeZone:"UTC"}):""}function k(){return e.jsx("div",{className:"flex h-full min-h-40 items-center justify-center text-xs text-oai-gray-400",children:n("leaderboard.community.modal.no_data")})}function b({children:t,detail:s}){return e.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-4",children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:t}),s?e.jsx("span",{className:"text-xs text-oai-gray-400",children:s}):null]})}function A({value:t,label:s}){const a=Number(t);if(!Number.isFinite(a))return null;const i=Math.sign(a)!==-1,r=i?V:te;return e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs font-medium tabular-nums ${i?"text-emerald-600 dark:text-emerald-400":"text-rose-600 dark:text-rose-400"}`,title:s,children:[e.jsx(r,{className:"size-3","aria-hidden":"true"}),i?"+":"",a.toFixed(1),"%"]})}function j({label:t,value:s,title:a,delta:i,deltaLabel:r}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-xs font-medium text-oai-gray-500 dark:text-oai-gray-400",children:t}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"truncate text-xl font-semibold leading-none tracking-tight text-oai-black tabular-nums dark:text-white",title:a,children:s}),e.jsx(A,{value:i,label:r})]})]})}function I({fillWidth:t,share:s,color:a="var(--oai-blue)",ariaLabel:i,dataAttrs:r,children:o}){return e.jsxs("div",{...r,className:"group relative grid min-h-11 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 overflow-hidden px-2.5 transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 opacity-[0.15] transition-opacity group-hover:opacity-[0.22] dark:opacity-[0.24] dark:group-hover:opacity-[0.32]",style:{width:`${t}%`,backgroundColor:a},role:"progressbar","aria-label":i,"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":Number(s)||0}),o]})}function T({rank:t,provider:s,name:a,fillWidth:i,share:r,tokens:o,tokensTitle:l,dataAttrs:c}){return e.jsxs(I,{fillWidth:i,share:r,color:ie(s),ariaLabel:`${a} ${u(r)}`,dataAttrs:c,children:[e.jsxs("div",{className:"relative flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:`w-5 shrink-0 text-xs tabular-nums ${t<=3?"font-semibold text-oai-gray-700 dark:text-oai-gray-200":"text-oai-gray-400"}`,children:t}),e.jsx("span",{className:"grid size-6 shrink-0 place-items-center text-oai-gray-700 dark:text-oai-gray-200",children:e.jsx(G,{provider:s,size:15})}),e.jsx("span",{className:"truncate text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200",title:a,children:a})]}),e.jsxs("div",{className:"relative min-w-[4.5rem] text-right",children:[e.jsx("div",{className:"text-xs font-semibold text-oai-black tabular-nums dark:text-white",title:l,children:o}),e.jsx("div",{className:"text-xs text-oai-gray-500 tabular-nums dark:text-oai-gray-400",children:u(r)})]})]})}function le({rows:t,formatTokensTooltip:s}){return t.length?e.jsxs("div",{className:"mt-7",children:[e.jsx(b,{children:n("leaderboard.community.modal.token_mix")}),e.jsx("div",{className:"flex h-1.5 overflow-hidden bg-oai-gray-100 dark:bg-oai-gray-800",children:t.map(a=>e.jsx("div",{style:{width:`${Math.max(Number(a.share)||0,0)}%`,backgroundColor:_[a.key]||"var(--community-muted)"},title:`${n(`leaderboard.community.modal.token_mix.${a.key}`)} · ${u(a.share)}`},a.key))}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-x-5 gap-y-1.5",children:t.map(a=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",title:s(a.tokens),children:[e.jsx("span",{className:"size-2",style:{backgroundColor:_[a.key]||"var(--community-muted)"}}),n(`leaderboard.community.modal.token_mix.${a.key}`),e.jsx("span",{className:"tabular-nums text-oai-gray-700 dark:text-oai-gray-200",children:u(a.share)})]},a.key))})]}):null}function f({label:t,value:s,title:a,delta:i,deltaLabel:r,className:o=""}){return e.jsxs("div",{className:`min-w-0 ${o}`,children:[e.jsx("div",{className:"truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"truncate text-base font-semibold leading-none tracking-tight tabular-nums text-oai-black dark:text-white",title:a,children:s}),e.jsx(A,{value:i,label:r})]})]})}function de({trendRows:t,activeDevelopers30d:s,developerGrowthPct:a,formatTokens:i,formatTokensTooltip:r}){if(!t.length)return null;const o=t.reduce((m,h)=>m+h.value,0),l=t.reduce((m,h)=>m.value<h.value?h:m,t[0]),c=o/t.length;return e.jsxs("div",{className:"mt-5 grid grid-cols-3 divide-x divide-oai-gray-100 border-y border-oai-gray-100 py-3.5 dark:divide-oai-gray-800/80 dark:border-oai-gray-800/80",children:[e.jsx(f,{className:"pr-4",label:n("leaderboard.community.modal.daily_average"),value:i(c),title:r(c)}),e.jsx(f,{className:"px-4",label:`${n("leaderboard.community.modal.peak_day")} · ${l.day}`,value:i(l.value),title:r(l.value)}),e.jsx(f,{className:"pl-4",label:n("leaderboard.community.modal.active_30d"),value:p(s),title:Number(s).toLocaleString(),delta:a,deltaLabel:n("leaderboard.community.modal.vs_previous_week")})]})}function me({trendRows:t,mix:s,activeDevelopers30d:a,developerGrowthPct:i,formatTokens:r,formatTokensTooltip:o}){return!t.length&&!s.length?e.jsx(k,{}):e.jsxs("div",{children:[e.jsx(b,{detail:n("leaderboard.community.modal.utc_note"),children:n("leaderboard.community.modal.community_activity")}),e.jsx(W,{embedded:!0,rows:t,from:t[0]?.day,to:t.at(-1)?.day,chartHeightClass:"h-44"}),e.jsx(de,{trendRows:t,activeDevelopers30d:a,developerGrowthPct:i,formatTokens:r,formatTokensTooltip:o}),e.jsx(le,{rows:s,formatTokensTooltip:o})]})}function ce({rows:t,maxShare:s,formatTokens:a,formatTokensTooltip:i}){return t.length?e.jsx("div",{className:"space-y-0.5",children:t.map((r,o)=>e.jsx(T,{rank:o+1,dataAttrs:{"data-provider-rank":o+1,"data-provider-name":r.name},provider:String(r.name).toUpperCase(),name:r.name,fillWidth:Math.max((Number(r.share)||0)/s*100,2),share:r.share,tokens:a(r.tokens),tokensTitle:i(r.tokens)},r.name))}):e.jsx(k,{})}function xe({rows:t,maxShare:s,formatTokens:a,formatTokensTooltip:i}){return t.length?e.jsx("div",{className:"space-y-0.5",children:t.map((r,o)=>{const l=Number(r.share)||0;return e.jsx(T,{rank:o+1,dataAttrs:{"data-model-rank":o+1,"data-model-name":r.name},provider:oe(r.name),name:r.name,fillWidth:Math.max(l/s*100,2),share:l,tokens:a(r.tokens),tokensTitle:i(r.tokens)},r.name)})}):e.jsx(k,{})}function ue({name:t}){const s=String(t||"").toLowerCase();return s==="darwin"?e.jsx(U,{className:"size-3.5"}):s==="win32"?e.jsx(B,{className:"size-3.5"}):e.jsx(X,{className:"size-4","aria-hidden":"true"})}const he=.175,ye=.3;function ge({bands:t,formatTokensTooltip:s}){const a=t.reduce((r,o)=>Math.max(r,Number(o.developer_share)||0),0)||1,i=r=>`${n(`leaderboard.community.modal.band.${r.key}`)} · ${n("leaderboard.community.modal.developer_count",{count:p(r.developers)})} (${s(r.tokens)})`;return e.jsxs("div",{children:[e.jsx("div",{className:"flex gap-2 border-b border-oai-gray-200 dark:border-oai-gray-800",children:t.map((r,o)=>{const l=Number(r.developer_share)||0,c=Math.max(l/a*80,2);return e.jsxs("div",{className:"relative h-32 min-w-0 flex-1",title:i(r),children:[e.jsx("div",{role:"progressbar","aria-label":n("leaderboard.community.modal.developer_share_title",{share:u(l)}),"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":l,className:"absolute inset-x-0 bottom-0",style:{height:`${c}%`,backgroundColor:"var(--oai-blue)",opacity:ye+o*he}}),e.jsx("div",{className:"absolute inset-x-0 text-center text-xs font-medium tabular-nums text-oai-gray-700 dark:text-oai-gray-200",style:{bottom:`calc(${c}% + 4px)`},children:u(l)})]},r.key)})}),e.jsx("div",{className:"mt-2 flex gap-2",children:t.map(r=>e.jsxs("div",{className:"min-w-0 flex-1 text-center",title:i(r),children:[e.jsx("div",{className:"truncate text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n(`leaderboard.community.modal.band.${r.key}`)}),e.jsx("div",{className:"truncate text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:p(r.developers)})]},r.key))})]})}function pe({bands:t,platforms:s,formatTokensTooltip:a}){return!t.length&&!s.length?e.jsx(k,{}):e.jsxs("div",{className:"space-y-8",children:[t.length?e.jsxs("div",{children:[e.jsx(b,{children:n("leaderboard.community.modal.usage_distribution")}),e.jsx(ge,{bands:t,formatTokensTooltip:a})]}):null,s.length?e.jsxs("div",{children:[e.jsx(b,{children:n("leaderboard.community.modal.platforms")}),e.jsx("div",{className:"space-y-0.5",children:s.map(i=>e.jsxs(I,{fillWidth:Math.max(Number(i.share)||0,1),share:i.share,ariaLabel:`${n(`leaderboard.community.modal.platform.${i.name}`)} ${u(i.share)}`,children:[e.jsxs("div",{className:"relative flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:"grid size-6 shrink-0 place-items-center text-oai-gray-700 dark:text-oai-gray-200",children:e.jsx(ue,{name:i.name})}),e.jsx("span",{className:"truncate text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n(`leaderboard.community.modal.platform.${i.name}`)})]}),e.jsxs("div",{className:"relative min-w-[4.5rem] text-right",children:[e.jsx("div",{className:"text-xs font-semibold text-oai-black tabular-nums dark:text-white",children:u(i.share)}),e.jsx("div",{className:"text-xs text-oai-gray-500 tabular-nums dark:text-oai-gray-400",title:Number(i.machines||0).toLocaleString(),children:n("leaderboard.community.modal.machine_count",{count:p(i.machines)})})]})]},i.name))})]}):null]})}function ve({isOpen:t,onClose:s,communityStats:a}){const{formatTokens:i,formatTokensTooltip:r}=F(),[o,l]=D.useState("overview"),c=a?.status==="ready",m=D.useMemo(()=>{if(!c)return null;const d=(Array.isArray(a.providers)?a.providers:[]).slice(0,O),x=(Array.isArray(a.topModels)?a.topModels:[]).slice(0,O),y=v=>v.reduce(($,L)=>Math.max($,Number(L.share)||0),0)||1;return{providers:d,models:x,providersMaxShare:y(d),modelsMaxShare:y(x),trendRows:(Array.isArray(a.dailyGrowth)?a.dailyGrowth:[]).map(v=>({day:ne(v.day),value:Number(v.tokens)||0})),mix:Array.isArray(a.tokenMix)?a.tokenMix:[],bands:Array.isArray(a.userDistribution)?a.userDistribution:[],platforms:Array.isArray(a.platforms)?a.platforms:[]}},[c,a]);if(!m)return null;const h=Number(a.tokenFloor)||0,N=Number(a.activeDevelopersTotal)||Number(a.totalEntries)||0,w=Number(a.tokens30d)||0,E=d=>{if(d.key!=="ArrowRight"&&d.key!=="ArrowLeft")return;d.preventDefault();const x=d.key==="ArrowRight"?1:-1,y=g[(g.indexOf(o)+x+g.length)%g.length];l(y),d.currentTarget.querySelector(`[data-tab-id="${y}"]`)?.focus()};return e.jsx(Y,{open:t,onOpenChange:d=>!d&&s(),children:e.jsxs(Z,{children:[e.jsx(H,{className:"fixed inset-0 z-[100] bg-black/50 backdrop-blur-[3px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsx(q,{className:"fixed inset-0 z-[101] flex items-center justify-center p-2 sm:p-5",children:e.jsxs(J,{className:"relative flex h-[min(42rem,92vh)] w-full max-w-xl flex-col overflow-hidden rounded-2xl bg-white shadow-2xl ring-1 ring-black/10 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-3 data-[ending-style]:scale-[0.98] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-3 data-[starting-style]:scale-[0.98] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:ring-white/10",children:[e.jsxs("header",{"data-testid":"community-metrics-header",className:"shrink-0 px-5 pt-5 sm:px-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(Q,{className:"text-lg font-semibold tracking-[-0.02em] text-oai-black dark:text-white",children:n("leaderboard.community.modal.title")}),e.jsx(ee,{className:"sr-only",children:n("leaderboard.community.modal.description")})]}),e.jsx(ae,{className:"-mr-1 -mt-1 grid size-8 place-items-center rounded-full text-oai-gray-400 transition-colors hover:bg-black/5 hover:text-oai-black dark:hover:bg-white/10 dark:hover:text-white","aria-label":n("shared.dialog.close"),children:e.jsx(S,{className:"size-4"})})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-x-5",children:[e.jsx(j,{label:n("leaderboard.community.modal.total_tokens"),value:i(h),title:r(h)}),e.jsx(j,{label:n("leaderboard.community.modal.tokens_30d"),value:i(w),title:r(w),delta:a.tokenGrowthPct,deltaLabel:n("leaderboard.community.modal.vs_previous_week")}),e.jsx(j,{label:n("leaderboard.community.modal.contributors"),value:p(N),title:N.toLocaleString()})]}),e.jsx("div",{className:"mt-4 flex items-end overflow-x-auto border-b border-oai-gray-100 dark:border-oai-gray-900",role:"tablist","aria-label":n("leaderboard.community.modal.views"),onKeyDown:E,children:g.map(d=>{const x=o===d;return e.jsxs("button",{type:"button",role:"tab","data-tab-id":d,"aria-selected":x,tabIndex:x?0:-1,onClick:()=>l(d),className:`relative mr-5 h-10 shrink-0 text-sm font-medium transition-colors last:mr-0 ${x?"text-oai-black dark:text-white":"text-oai-gray-500 hover:text-oai-gray-700 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"}`,children:[n(`leaderboard.community.modal.tab.${d}`),x?e.jsx(M.span,{layoutId:"community-metrics-tab-underline",className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-oai-black dark:bg-white",transition:{type:"spring",stiffness:420,damping:34}}):null]},d)})})]}),e.jsx("div",{"data-testid":"community-metrics-content",className:"min-h-0 flex-1 overflow-y-auto px-5 py-5 sm:px-6",children:e.jsxs(M.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.18,ease:[.16,1,.3,1]},className:"h-full",children:[o==="overview"?e.jsx(me,{trendRows:m.trendRows,mix:m.mix,activeDevelopers30d:Number(a.activeDevelopers30d)||0,developerGrowthPct:a.developerGrowthPct,formatTokens:i,formatTokensTooltip:r}):null,o==="providers"?e.jsx(ce,{rows:m.providers,maxShare:m.providersMaxShare,formatTokens:i,formatTokensTooltip:r}):null,o==="community"?e.jsx(pe,{bands:m.bands,platforms:m.platforms,formatTokensTooltip:r}):null,o==="models"?e.jsx(xe,{rows:m.models,maxShare:m.modelsMaxShare,formatTokens:i,formatTokensTooltip:r}):null]},o)})]})})]})})}function Be(t){return e.jsx(P,{mode:z.COMPACT,children:e.jsx(ve,{...t})})}export{Be as CommunityStatsModal};
@@ -1 +0,0 @@
1
- import{j as e,J as n}from"./__vite-browser-external-DUJeOWgd.js";import{C as c}from"./Card-D-5mABVt.js";function g({checked:a,onChange:s,disabled:i,ariaLabel:r}){return e.jsx("button",{type:"button",role:"switch","aria-checked":a,"aria-label":r,onClick:s,disabled:i,className:n("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",a?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:n("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",a?"translate-x-[18px]":"translate-x-[3px]")})})}function u({label:a,hint:s,control:i}){return e.jsxs("div",{className:"flex flex-col gap-2 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a}),s?e.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s}):null]}),e.jsx("div",{className:"self-end sm:shrink-0 sm:self-auto",children:i})]})}function b({title:a,subtitle:s,action:i,children:r}){return e.jsxs(c,{className:"rounded-lg",children:[e.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:a}),s?e.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s}):null]}),i?e.jsx("div",{className:"shrink-0",children:i}):null]}),e.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:r})]})}function h({options:a,value:s,onChange:i,disabled:r=!1}){return e.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:a.map(({value:t,label:o,Icon:l})=>{const d=s===t;return e.jsxs("button",{type:"button",onClick:()=>i(t),"aria-pressed":d,disabled:r,className:n("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",d?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[l?e.jsx(l,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,e.jsx("span",{children:o})]},t)})})}export{h as S,g as T,b as a,u as b};