tokentracker-cli 1.3.5 → 1.3.6

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 (112) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-Dazs3pEa.js → AchievementBadge-CHDt55IP.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-LWnxZvmw.js → AchievementsPage-DpbRHmb8.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-BLqczmU9.js → AchievementsSection-Ck5CiX4P.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-B_n4aj2S.js → BadgeDetailModal-BVPqlh0X.js} +1 -1
  5. package/dashboard/dist/assets/{BotAnimated-KDWI_YcZ.js → BotAnimated-CVsv6kxT.js} +1 -1
  6. package/dashboard/dist/assets/{Card-BYoxd4OC.js → Card-C9FjyAwh.js} +1 -1
  7. package/dashboard/dist/assets/{CloudCheckoutPage-BR2_B03P.js → CloudCheckoutPage-ChkjId9l.js} +1 -1
  8. package/dashboard/dist/assets/{CloudPage-DL5RkJKK.js → CloudPage-D1nrt3MG.js} +1 -1
  9. package/dashboard/dist/assets/{CloudUsageExport-C_DqZKo1.js → CloudUsageExport-jXdoiD0e.js} +1 -1
  10. package/dashboard/dist/assets/{CommandPalette-DkCaIQI4.js → CommandPalette-DFnEeZzc.js} +1 -1
  11. package/dashboard/dist/assets/{CommunityStatsModal-pX9OePi4.js → CommunityStatsModal-CZDS8gPA.js} +1 -1
  12. package/dashboard/dist/assets/{ConfirmModal-tkgZwz4u.js → ConfirmModal-DRhgBoGE.js} +1 -1
  13. package/dashboard/dist/assets/{Controls-MTUhGWy8.js → Controls-BmT6-x_L.js} +1 -1
  14. package/dashboard/dist/assets/{DashboardPage-SOx-A7lH.js → DashboardPage-DfwwXZBo.js} +1 -1
  15. package/dashboard/dist/assets/{DateRangePopover-B-BMOm3O.js → DateRangePopover-DuqNLatr.js} +1 -1
  16. package/dashboard/dist/assets/{DevicePage-DSK9lm7v.js → DevicePage-BtI0bWyg.js} +1 -1
  17. package/dashboard/dist/assets/{DialogClose-uVUNu4rg.js → DialogClose-DjnC3P4V.js} +1 -1
  18. package/dashboard/dist/assets/DialogDescription-yy_QHg7O.js +1 -0
  19. package/dashboard/dist/assets/{DialogTitle-B-VifiA3.js → DialogTitle-B9NNSz5p.js} +1 -1
  20. package/dashboard/dist/assets/{FadeIn-B6lrj4uo.js → FadeIn-fsVQmJGa.js} +1 -1
  21. package/dashboard/dist/assets/{HeaderGithubStar-Cx5zOhXa.js → HeaderGithubStar-Cg-f1iZc.js} +1 -1
  22. package/dashboard/dist/assets/{HoverTooltip-DY1ENf69.js → HoverTooltip-DRIRlzXH.js} +1 -1
  23. package/dashboard/dist/assets/{IpCheckPage-D6TEq64d.js → IpCheckPage-DaAubaJQ.js} +1 -1
  24. package/dashboard/dist/assets/{LandingPage-OdZUfq--.js → LandingPage-DjBGIjHk.js} +2 -2
  25. package/dashboard/dist/assets/{LeaderboardPage-DCK5xcAt.js → LeaderboardPage-BkCXqhz7.js} +2 -2
  26. package/dashboard/dist/assets/{LeaderboardProBadge-CBXJ1u_m.js → LeaderboardProBadge-Ds-wiWcN.js} +1 -1
  27. package/dashboard/dist/assets/{LeaderboardProfileModal-Ccdzb7QK.js → LeaderboardProfileModal-X_rfSQT5.js} +3 -3
  28. package/dashboard/dist/assets/{LeaderboardProfilePage-CFXlZ0fL.js → LeaderboardProfilePage-rpl1Ozwj.js} +1 -1
  29. package/dashboard/dist/assets/{LimitsPage-5krjm-g9.js → LimitsPage-BUvDBmgD.js} +1 -1
  30. package/dashboard/dist/assets/{LocalOnlyNotice-Rk1B8PaZ.js → LocalOnlyNotice-LBH1DBrs.js} +1 -1
  31. package/dashboard/dist/assets/{LoginCard-DTTIm8vk.js → LoginCard-B0vRJEcg.js} +1 -1
  32. package/dashboard/dist/assets/{LoginModal-BNcDdjfr.js → LoginModal-DdzgP43f.js} +1 -1
  33. package/dashboard/dist/assets/{LoginPage-CQgXP7Ee.js → LoginPage-B4VCQxzn.js} +1 -1
  34. package/dashboard/dist/assets/{PetPage-Cw_kAPRs.js → PetPage-Cmf6aXc9.js} +1 -1
  35. package/dashboard/dist/assets/{PopoverPopup-NYiGE8A2.js → PopoverPopup-BzfELnIC.js} +1 -1
  36. package/dashboard/dist/assets/{ProviderIcon-Bp7iFJ_m.js → ProviderIcon-ClHXNkQ0.js} +1 -1
  37. package/dashboard/dist/assets/{ResetPasswordPage-Cf9kAWDW.js → ResetPasswordPage-BeUpNt_6.js} +1 -1
  38. package/dashboard/dist/assets/{Select-kIcvQFAo.js → Select-BHEXdYHu.js} +1 -1
  39. package/dashboard/dist/assets/{SelectItemText-BpIsAg3b.js → SelectItemText-aaQK_QIt.js} +1 -1
  40. package/dashboard/dist/assets/{SelfHostPage-Ch2vvSwI.js → SelfHostPage-ClNhKnlP.js} +1 -1
  41. package/dashboard/dist/assets/{ServiceStatusPage-hoYBvGbu.js → ServiceStatusPage-Byd_s6FS.js} +1 -1
  42. package/dashboard/dist/assets/{SessionsPage-BzRB6q-Z.js → SessionsPage-u3_b4PO7.js} +2 -2
  43. package/dashboard/dist/assets/{SettingsPage-DRl2uX-i.js → SettingsPage-DweCAbsy.js} +2 -2
  44. package/dashboard/dist/assets/{SkillsPage-CkqThTZL.js → SkillsPage-Bb-PVfux.js} +1 -1
  45. package/dashboard/dist/assets/{TokenGalaxy-eLG-UIZY.js → TokenGalaxy-CubA3PXu.js} +1 -1
  46. package/dashboard/dist/assets/{TooltipPopup-bnMJyilQ.js → TooltipPopup-DMliWhoK.js} +1 -1
  47. package/dashboard/dist/assets/{TrendMonitor-X7-aGzIv.js → TrendMonitor-as8idaOy.js} +1 -1
  48. package/dashboard/dist/assets/{WidgetsPage-CGznIzrW.js → WidgetsPage-DDPR4v0R.js} +1 -1
  49. package/dashboard/dist/assets/{WrappedPage-p31-uUoF.js → WrappedPage-zZzgYz6s.js} +1 -1
  50. package/dashboard/dist/assets/{__vite-browser-external-2g_4s3ot.js → __vite-browser-external-DWN9Fb-H.js} +2 -2
  51. package/dashboard/dist/assets/{agent-logos-2TVT3fIE.js → agent-logos-CoNhCm9-.js} +1 -1
  52. package/dashboard/dist/assets/{arrow-left-DL0hAp_7.js → arrow-left-C5hDp7fc.js} +1 -1
  53. package/dashboard/dist/assets/{arrow-right-DFCpnV_9.js → arrow-right-DEvMmSiA.js} +1 -1
  54. package/dashboard/dist/assets/{arrow-up-right-DLvfE0Wu.js → arrow-up-right-DxY0neJ4.js} +1 -1
  55. package/dashboard/dist/assets/{calendar-days-B0aDoKSG.js → calendar-days-bzh7-lab.js} +1 -1
  56. package/dashboard/dist/assets/{check-C_cfrxiz.js → check-CSZvcC3X.js} +1 -1
  57. package/dashboard/dist/assets/{chevron-down-Ck8ml43e.js → chevron-down-CsiGcG0G.js} +1 -1
  58. package/dashboard/dist/assets/{cloud-checkout-PYnwNfdH.js → cloud-checkout-z_eDVwm6.js} +1 -1
  59. package/dashboard/dist/assets/{composite-INW-ELWX.js → composite-Cq0CmNAv.js} +1 -1
  60. package/dashboard/dist/assets/{download-B7uokeIo.js → download-DqLpubIF.js} +1 -1
  61. package/dashboard/dist/assets/{external-link-CI3crg4K.js → external-link-B8E8tbB3.js} +1 -1
  62. package/dashboard/dist/assets/{flame-DCzvFKV1.js → flame-CrJDlnro.js} +1 -1
  63. package/dashboard/dist/assets/{format-tokens-CSTEYK2m.js → format-tokens-DPIGGOlt.js} +1 -1
  64. package/dashboard/dist/assets/{gift-dEHDFMc6.js → gift-CCp4Hh50.js} +1 -1
  65. package/dashboard/dist/assets/{host-mode-r2SW9Mdv.js → host-mode-xzpMLcwP.js} +1 -1
  66. package/dashboard/dist/assets/{icons-q-3zvEkh.js → icons-CbB9Y-eV.js} +1 -1
  67. package/dashboard/dist/assets/{index-CyHYj9XI.js → index-BiK5-tQp.js} +1 -1
  68. package/dashboard/dist/assets/{index-BV7qwUw4.js → index-DX7nYrHb.js} +1 -1
  69. package/dashboard/dist/assets/{index-BbrsgHf4.js → index-zuC7FU-t.js} +1 -1
  70. package/dashboard/dist/assets/{info-BBdY9hV4.js → info-B3NKYwWG.js} +1 -1
  71. package/dashboard/dist/assets/{link-2-CLPePfXs.js → link-2-BRc8d8M9.js} +1 -1
  72. package/dashboard/dist/assets/{loader-circle-ETrjzfmn.js → loader-circle-Cm5Nsgp-.js} +1 -1
  73. package/dashboard/dist/assets/{modifiers.esm-DHqnp2ol.js → modifiers.esm-CYLYBECB.js} +1 -1
  74. package/dashboard/dist/assets/{monitor-smartphone-D1kdzrdb.js → monitor-smartphone--IZ4D84F.js} +1 -1
  75. package/dashboard/dist/assets/{play-Cxp-ronD.js → play-CUrMOLtq.js} +1 -1
  76. package/dashboard/dist/assets/{plus-4n94VzDK.js → plus-0hrCDl4r.js} +1 -1
  77. package/dashboard/dist/assets/{provider-display-CRlbeO7t.js → provider-display-CNK0FN3Q.js} +1 -1
  78. package/dashboard/dist/assets/{react-DlHjGQFN.js → react-CCNSVHEA.js} +1 -1
  79. package/dashboard/dist/assets/{safePolygon-CVZ27a2_.js → safePolygon-DsolkMUX.js} +1 -1
  80. package/dashboard/dist/assets/{search-BDPr56_h.js → search-DYmYb9xY.js} +1 -1
  81. package/dashboard/dist/assets/{server-Bm7fHvVa.js → server-CYcqzdSW.js} +1 -1
  82. package/dashboard/dist/assets/{shield-check-DtT8ACzI.js → shield-check-5zABLIr6.js} +1 -1
  83. package/dashboard/dist/assets/{skills-api-Dc1-2qu6.js → skills-api-CD-ojBGj.js} +1 -1
  84. package/dashboard/dist/assets/{sortable.esm-B-qN-Xk2.js → sortable.esm-BCn2Ms6R.js} +1 -1
  85. package/dashboard/dist/assets/{store-gHeBU8dQ.js → store-B22kwLs0.js} +1 -1
  86. package/dashboard/dist/assets/{terminal-D4VZbvhg.js → terminal-CTv-oTU2.js} +1 -1
  87. package/dashboard/dist/assets/{trash-BZtLAFQy.js → trash-C5MAh3GO.js} +1 -1
  88. package/dashboard/dist/assets/{use-community-stats-BdqndrbB.js → use-community-stats-BrgrxUD2.js} +1 -1
  89. package/dashboard/dist/assets/{use-latest-request-guard-DhGg1cDS.js → use-latest-request-guard-B1_rbvgH.js} +1 -1
  90. package/dashboard/dist/assets/{use-limits-display-prefs-D3HOcRFv.js → use-limits-display-prefs-BOk5f-HM.js} +1 -1
  91. package/dashboard/dist/assets/{use-native-settings-BniKwA_n.js → use-native-settings-B2gc_m9W.js} +1 -1
  92. package/dashboard/dist/assets/{use-ordered-list-b09H7EHq.js → use-ordered-list-N3sGpJ0u.js} +1 -1
  93. package/dashboard/dist/assets/{use-pet-settings-CPZdlq_e.js → use-pet-settings-sWFXgR3m.js} +2 -2
  94. package/dashboard/dist/assets/use-reduced-motion-C3MBYVqm.js +1 -0
  95. package/dashboard/dist/assets/{use-transform-CIdxjmI8.js → use-transform-BsaLmw46.js} +1 -1
  96. package/dashboard/dist/assets/{use-usage-limits-eJlU65yY.js → use-usage-limits-wL7v-S0r.js} +1 -1
  97. package/dashboard/dist/assets/{useCurrency-CM22CmAq.js → useCurrency-CbCnjf-N.js} +1 -1
  98. package/dashboard/dist/assets/{usePositioner-B3l2ulTw.js → usePositioner-MepYlL0A.js} +1 -1
  99. package/dashboard/dist/assets/{useTokenFormat-D7nzgxKw.js → useTokenFormat-Bq-rwuKa.js} +1 -1
  100. package/dashboard/dist/assets/{zap-Daxct1WV.js → zap-1ah5e11g.js} +1 -1
  101. package/dashboard/dist/index.html +1 -1
  102. package/dashboard/dist/ip-check.html +1 -1
  103. package/dashboard/dist/leaderboard.html +1 -1
  104. package/dashboard/dist/share.html +1 -1
  105. package/package.json +1 -1
  106. package/src/cli.js +1 -1
  107. package/src/lib/pricing/seed-snapshot.json +1 -1
  108. package/src/lib/rollout.js +49 -16
  109. package/src/lib/session-analytics.js +546 -52
  110. package/src/lib/session-performance.js +24 -1
  111. package/dashboard/dist/assets/DialogDescription-DBqGGWNj.js +0 -1
  112. package/dashboard/dist/assets/use-reduced-motion-D1gcKJUo.js +0 -1
@@ -1,4 +1,4 @@
1
- import{o as be,bh as we,bi as ye,r as i,M as _e,J as ke,bj as ve,x as ce,ai as le,bk as Ee,aB as je,ak as Se,aj as Ce,ah as Ne,j as r,aM as De,X as Re,c as f,a as Pe,bl as de,B as Z,ax as Te,bm as Ie}from"./__vite-browser-external-2g_4s3ot.js";import{u as Oe,D as ze,a as Le,b as Ae,c as Ue,d as $e,e as Be}from"./DialogTitle-B-VifiA3.js";import{u as Me,d as Fe,t as qe}from"./composite-INW-ELWX.js";import{k as Ge,l as Je}from"./SelectItemText-BpIsAg3b.js";import{u as Ke}from"./safePolygon-CVZ27a2_.js";import{D as Ye}from"./DialogClose-uVUNu4rg.js";import{D as Ve}from"./DateRangePopover-B-BMOm3O.js";import{C as He}from"./calendar-days-B0aDoKSG.js";import{C as ue}from"./chevron-down-Ck8ml43e.js";import{D as fe}from"./download-B7uokeIo.js";import{P as Qe,a as Ze,b as Xe,c as We,d as et}from"./PopoverPopup-NYiGE8A2.js";const pe={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"}]]};pe.node;const yt=be(pe),tt=we(function(a,t){const{render:c,className:s,style:n,disabled:h=!1,nativeButton:_=!0,id:k,payload:o,handle:m,...b}=a,O=Oe(!0),l=Ke(m)??O;if(!l)throw new Error(ye(79));const v=Me(k),T=l.useState("floatingRootContext"),u=l.useState("isOpenedByTrigger",v),E=l.useState("triggerPopupId",v),j=i.useRef(null),{registerTrigger:w,isMountedByThisTrigger:x}=Fe(v,j,l,{payload:o}),{getButtonProps:C,buttonRef:N}=_e({disabled:h,native:_}),y=Ge(T),S=Je(()=>l.select("open"),J=>{l.set("openMethod",J)}),F={disabled:h,open:u},I=l.useState("triggerProps",x);return ke("button",a,{state:F,ref:[N,t,w,j],props:[y.reference,I,S,{[ve]:"",id:v,"aria-haspopup":"dialog","aria-expanded":u,"aria-controls":E},b,C],stateAttributesMapping:qe})}),ee="tt.qualityPerDollar.enabled";function X(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(ee)==="1"}catch{return!1}}function _t(){const[e,a]=i.useState(X);i.useEffect(()=>{if(typeof window>"u")return;const s=n=>{(n.key===null||n.key===ee)&&a(X())};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]);const t=i.useCallback(s=>{const n=!!s;a(n);try{window.localStorage.setItem(ee,n?"1":"0")}catch{}},[]),c=i.useCallback(()=>t(!X()),[t]);return{enabled:e,setEnabled:t,toggle:c}}const te="tt.sessionEfficiency.enabled";function W(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(te)==="1"}catch{return!1}}function kt(){const[e,a]=i.useState(W);i.useEffect(()=>{if(typeof window>"u")return;const s=n=>{(n.key===null||n.key===te)&&a(W())};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]);const t=i.useCallback(s=>{const n=!!s;a(n);try{window.localStorage.setItem(te,n?"1":"0")}catch{}},[]),c=i.useCallback(()=>t(!W()),[t]);return{enabled:e,setEnabled:t,toggle:c}}const G=["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 p extends Error{constructor(a,t=0){super(a),this.code=a,this.status=t}code;status}function M(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 at(e,a){if(!Ne(e))throw new p("export_auth_required",401);try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),c=JSON.parse(atob(t.padEnd(Math.ceil(t.length/4)*4,"=")));if((c.sub||c.user_id)!==a||c.role!=="authenticated"||!Number.isFinite(c.exp)||c.exp*1e3<=Date.now())throw Error()}catch{throw new p("export_auth_required",401)}}function ge(e){if(typeof e?.membership?.can_read_cloud!="boolean")throw new p("export_invalid_data",503);if(!e.membership.can_read_cloud)throw new p("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 rt({userId:e,auth:a,from:t,to:c,deviceId:s=null,signal:n,assertCurrent:h=()=>{},fetchImpl:_=fetch}){if(!M(t)||!M(c)||t>c)throw new p("export_invalid_dates",400);if(typeof a!="function")throw new p("export_auth_required",401);if(!e||s&&!/^[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(s))throw new p("export_invalid_scope",400);const k=ce(),o=le();if(!k)throw new p("export_instance_changed",409);const m=()=>{if(n?.aborted)throw new p("export_cancelled",409);if(h(),k!==ce()||o!==le())throw new p("export_instance_changed",409)};async function b(u,E){m();const j=await je(a);m(),at(j||"",e);const w=new URL(Se(k,u));for(const[y,S]of Object.entries(E))w.searchParams.set(y,S);const x=new AbortController,C=()=>x.abort();n?.addEventListener("abort",C,{once:!0});const N=setTimeout(C,25e3);try{const y=await Ce(w.toString(),{method:"GET",cache:"no-store",redirect:"error",signal:x.signal,headers:{Accept:"application/json",Authorization:"Bearer "+j,...o?{apikey:o}:{}}},_);if(m(),!y.ok)throw new p(y.status===401?"export_auth_required":y.status===402||y.status===403?"export_access_denied":"export_failed",y.status);const S=await y.json();return m(),S}finally{clearTimeout(N),n?.removeEventListener("abort",C)}}const O=ge(await b("tokentracker-billing",{action:"account"})),U={from:t,to:c,tz_offset_minutes:"0",...s?{device_id:s}:{}};if(await b("tokentracker-account-daily",U),ge(await b("tokentracker-billing",{action:"account"}))!==O)throw new p("export_access_changed",409);const l=await b("tokentracker-account-daily",U);if(!M(l?.from)||!M(l?.to)||l.from<t||l.to>c||l.from>l.to||!Array.isArray(l.data)||l.data.length>1096)throw new p("export_invalid_data",503);const v=new Set,T=l.data.map(u=>{if(!M(u?.day)||u.day<l.from||u.day>l.to||v.has(u.day))throw new p("export_invalid_data",503);v.add(u.day);const E={day:u.day};for(const j of G){const w=u[j];if(typeof w!="number"||!Number.isFinite(w)||w<0||j!=="total_cost_usd"&&!Number.isSafeInteger(w))throw new p("export_invalid_data",503);E[j==="total_cost_usd"?"estimated_cost_usd":j]=w}return E}).sort((u,E)=>u.day.localeCompare(E.day));return m(),{schema:"tokentracker.cloud-usage.v1",metadata:{source:"cloud",backend_origin:new URL(k).origin,exported_at:new Date().toISOString(),timezone:"UTC",requested_range:{from:t,to:c},effective_range:{from:l.from,to:l.to},device_scope:s?"selected":"all",aggregation:"daily_all_providers",cost_currency:"USD",cost_basis:"estimated",row_count:T.length},rows:T}}function ot(e){const a=String(e??"");return'"'+(/^[\s]*[=+\-@]/.test(a)?"'"+a:a).replace(/"/g,'""')+'"'}function nt(e,a){if(a==="json")return JSON.stringify(e,null,2)+`
1
+ import{o as be,bh as we,bi as ye,r as i,M as _e,J as ke,bj as ve,x as ce,ai as le,bk as Ee,aB as je,ak as Se,aj as Ce,ah as Ne,j as r,aM as De,X as Re,c as f,a as Pe,bl as de,B as Z,ax as Te,bm as Ie}from"./__vite-browser-external-DWN9Fb-H.js";import{u as Oe,D as ze,a as Le,b as Ae,c as Ue,d as $e,e as Be}from"./DialogTitle-B9NNSz5p.js";import{u as Me,d as Fe,t as qe}from"./composite-Cq0CmNAv.js";import{k as Ge,l as Je}from"./SelectItemText-aaQK_QIt.js";import{u as Ke}from"./safePolygon-DsolkMUX.js";import{D as Ye}from"./DialogClose-DjnC3P4V.js";import{D as Ve}from"./DateRangePopover-DuqNLatr.js";import{C as He}from"./calendar-days-bzh7-lab.js";import{C as ue}from"./chevron-down-CsiGcG0G.js";import{D as fe}from"./download-DqLpubIF.js";import{P as Qe,a as Ze,b as Xe,c as We,d as et}from"./PopoverPopup-BzfELnIC.js";const pe={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"}]]};pe.node;const yt=be(pe),tt=we(function(a,t){const{render:c,className:s,style:n,disabled:h=!1,nativeButton:_=!0,id:k,payload:o,handle:m,...b}=a,O=Oe(!0),l=Ke(m)??O;if(!l)throw new Error(ye(79));const v=Me(k),T=l.useState("floatingRootContext"),u=l.useState("isOpenedByTrigger",v),E=l.useState("triggerPopupId",v),j=i.useRef(null),{registerTrigger:w,isMountedByThisTrigger:x}=Fe(v,j,l,{payload:o}),{getButtonProps:C,buttonRef:N}=_e({disabled:h,native:_}),y=Ge(T),S=Je(()=>l.select("open"),J=>{l.set("openMethod",J)}),F={disabled:h,open:u},I=l.useState("triggerProps",x);return ke("button",a,{state:F,ref:[N,t,w,j],props:[y.reference,I,S,{[ve]:"",id:v,"aria-haspopup":"dialog","aria-expanded":u,"aria-controls":E},b,C],stateAttributesMapping:qe})}),ee="tt.qualityPerDollar.enabled";function X(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(ee)==="1"}catch{return!1}}function _t(){const[e,a]=i.useState(X);i.useEffect(()=>{if(typeof window>"u")return;const s=n=>{(n.key===null||n.key===ee)&&a(X())};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]);const t=i.useCallback(s=>{const n=!!s;a(n);try{window.localStorage.setItem(ee,n?"1":"0")}catch{}},[]),c=i.useCallback(()=>t(!X()),[t]);return{enabled:e,setEnabled:t,toggle:c}}const te="tt.sessionEfficiency.enabled";function W(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(te)==="1"}catch{return!1}}function kt(){const[e,a]=i.useState(W);i.useEffect(()=>{if(typeof window>"u")return;const s=n=>{(n.key===null||n.key===te)&&a(W())};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[]);const t=i.useCallback(s=>{const n=!!s;a(n);try{window.localStorage.setItem(te,n?"1":"0")}catch{}},[]),c=i.useCallback(()=>t(!W()),[t]);return{enabled:e,setEnabled:t,toggle:c}}const G=["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 p extends Error{constructor(a,t=0){super(a),this.code=a,this.status=t}code;status}function M(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 at(e,a){if(!Ne(e))throw new p("export_auth_required",401);try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),c=JSON.parse(atob(t.padEnd(Math.ceil(t.length/4)*4,"=")));if((c.sub||c.user_id)!==a||c.role!=="authenticated"||!Number.isFinite(c.exp)||c.exp*1e3<=Date.now())throw Error()}catch{throw new p("export_auth_required",401)}}function ge(e){if(typeof e?.membership?.can_read_cloud!="boolean")throw new p("export_invalid_data",503);if(!e.membership.can_read_cloud)throw new p("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 rt({userId:e,auth:a,from:t,to:c,deviceId:s=null,signal:n,assertCurrent:h=()=>{},fetchImpl:_=fetch}){if(!M(t)||!M(c)||t>c)throw new p("export_invalid_dates",400);if(typeof a!="function")throw new p("export_auth_required",401);if(!e||s&&!/^[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(s))throw new p("export_invalid_scope",400);const k=ce(),o=le();if(!k)throw new p("export_instance_changed",409);const m=()=>{if(n?.aborted)throw new p("export_cancelled",409);if(h(),k!==ce()||o!==le())throw new p("export_instance_changed",409)};async function b(u,E){m();const j=await je(a);m(),at(j||"",e);const w=new URL(Se(k,u));for(const[y,S]of Object.entries(E))w.searchParams.set(y,S);const x=new AbortController,C=()=>x.abort();n?.addEventListener("abort",C,{once:!0});const N=setTimeout(C,25e3);try{const y=await Ce(w.toString(),{method:"GET",cache:"no-store",redirect:"error",signal:x.signal,headers:{Accept:"application/json",Authorization:"Bearer "+j,...o?{apikey:o}:{}}},_);if(m(),!y.ok)throw new p(y.status===401?"export_auth_required":y.status===402||y.status===403?"export_access_denied":"export_failed",y.status);const S=await y.json();return m(),S}finally{clearTimeout(N),n?.removeEventListener("abort",C)}}const O=ge(await b("tokentracker-billing",{action:"account"})),U={from:t,to:c,tz_offset_minutes:"0",...s?{device_id:s}:{}};if(await b("tokentracker-account-daily",U),ge(await b("tokentracker-billing",{action:"account"}))!==O)throw new p("export_access_changed",409);const l=await b("tokentracker-account-daily",U);if(!M(l?.from)||!M(l?.to)||l.from<t||l.to>c||l.from>l.to||!Array.isArray(l.data)||l.data.length>1096)throw new p("export_invalid_data",503);const v=new Set,T=l.data.map(u=>{if(!M(u?.day)||u.day<l.from||u.day>l.to||v.has(u.day))throw new p("export_invalid_data",503);v.add(u.day);const E={day:u.day};for(const j of G){const w=u[j];if(typeof w!="number"||!Number.isFinite(w)||w<0||j!=="total_cost_usd"&&!Number.isSafeInteger(w))throw new p("export_invalid_data",503);E[j==="total_cost_usd"?"estimated_cost_usd":j]=w}return E}).sort((u,E)=>u.day.localeCompare(E.day));return m(),{schema:"tokentracker.cloud-usage.v1",metadata:{source:"cloud",backend_origin:new URL(k).origin,exported_at:new Date().toISOString(),timezone:"UTC",requested_range:{from:t,to:c},effective_range:{from:l.from,to:l.to},device_scope:s?"selected":"all",aggregation:"daily_all_providers",cost_currency:"USD",cost_basis:"estimated",row_count:T.length},rows:T}}function ot(e){const a=String(e??"");return'"'+(/^[\s]*[=+\-@]/.test(a)?"'"+a:a).replace(/"/g,'""')+'"'}function nt(e,a){if(a==="json")return JSON.stringify(e,null,2)+`
2
2
  `;const t=e.metadata,c=["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",...G.map(n=>n==="total_cost_usd"?"estimated_cost_usd":n)],s=[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[c,["metadata",...s,"",...G.map(()=>"")],...e.rows.map(n=>["usage",...s,n.day,...G.map(h=>n[h==="total_cost_usd"?"estimated_cost_usd":h])])].map(n=>n.map(ot).join(",")).join(`\r
3
3
  `)+`\r
4
4
  `}async function st(e,a,{signal:t,assertCurrent:c=()=>{}}={}){const s=nt(e,a),n=`tokentracker-cloud-usage-${e.metadata.effective_range.from}-${e.metadata.effective_range.to}.${a}`,h=()=>{if(t?.aborted)throw new p("export_cancelled",409);c()};h();const _=await Ee({filename:n,content:s,format:a,signal:t});if(h(),_?.saved===!0)return;if(_!==null)throw new p("export_failed",503);const k=new Blob([s],{type:a==="csv"?"text/csv;charset=utf-8":"application/json;charset=utf-8"}),o=URL.createObjectURL(k);try{const m=document.createElement("a");m.href=o,m.download=n,document.body.appendChild(m);try{m.click()}finally{m.remove()}}finally{setTimeout(()=>URL.revokeObjectURL(o),1e3)}}function it({open:e,onOpenChange:a,title:t,triggerLabel:c=t,icon:s,wide:n=!1,preventClose:h=!1,initialFocus:_,children:k}){return r.jsxs(ze,{open:e,onOpenChange:(o,m)=>{if(!o&&h){m.cancel();return}a(o)},children:[r.jsxs(tt,{className:"inline-flex h-11 w-full items-center gap-3 rounded-md border-0 bg-transparent p-0 text-left text-sm font-medium text-oai-black transition-colors hover:bg-oai-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-oai-gray-500 dark:text-oai-white dark:hover:bg-oai-gray-800",children:[s?r.jsx(s,{size:16,className:"shrink-0","aria-hidden":!0}):null,r.jsx("span",{className:"min-w-0 flex-1",children:c}),r.jsx(De,{size:16,className:"shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),r.jsxs(Le,{children:[r.jsx(Ae,{className:"tt-cloud-action-backdrop fixed inset-0 z-[100] bg-black/40 dark:bg-black/60"}),r.jsx(Ue,{className:"tt-cloud-settings fixed inset-0 z-[101] flex items-center justify-center overflow-y-auto overscroll-contain p-4",children:r.jsxs($e,{initialFocus:_,"aria-modal":"true",className:`tt-cloud-action-popup tt-cloud-theme relative max-h-[calc(100dvh-2rem)] w-full ${n?"max-w-2xl":"max-w-lg"} overflow-y-auto overscroll-contain rounded-xl bg-white p-5 shadow-xl outline-none dark:bg-oai-gray-900`,children:[r.jsxs("div",{className:"mb-3 flex min-h-11 items-center justify-between gap-4",children:[r.jsx(Be,{className:"min-w-0 text-lg font-semibold text-oai-black dark:text-oai-white",children:t}),r.jsx(Ye,{disabled:h,"aria-label":f("shared.dialog.close"),className:"inline-flex size-11 min-h-11 min-w-11 shrink-0 items-center justify-center rounded-md border-0 bg-transparent p-0 text-oai-gray-500 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-oai-gray-500 disabled:cursor-wait disabled:opacity-40 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-oai-white",children:r.jsx(Re,{size:18,"aria-hidden":!0})})]}),r.jsx("div",{"data-settings-panel":"cloud",className:"min-w-0",children:k})]})})]})]})}function ct(e){return e?.status===401?f("cloud.export.error_auth"):e?.status===402||e?.status===403?f("cloud.export.error_access"):e?.code==="export_invalid_dates"?f("cloud.export.error_dates"):e?.status===409?f("cloud.export.error_changed"):f("cloud.export.error_failed")}function vt({from:e,to:a,deviceId:t=null,auth:c,compact:s=!1,panelContainer:n=null,layout:h="default",dialogOpen:_,onDialogOpenChange:k}){const o=h==="settings-row",m=Pe(),b=c||m,O=b?.signedIn?b.user?.id:null,U=new Date().toISOString().slice(0,10),l=new Date(Date.now()-29*864e5).toISOString().slice(0,10),[v,T]=i.useState(e||l),[u,E]=i.useState(a||U),[j,w]=i.useState(!1),x=o&&typeof _=="boolean"?_:j,[C,N]=i.useState(!1),[y,S]=i.useState(null),[F,I]=i.useState(null),[J,L]=i.useState(!1),[me,he]=i.useState(2),ae=i.useId(),K=i.useRef(null),D=i.useRef(0),A=i.useRef(null),z=i.useRef(!1),$=i.useRef(!1),re=i.useRef(x);re.current=x;const oe=i.useRef(x);if(K.current={userId:O,client:b?.client,start:v,end:u,deviceId:t,from:e,to:a},i.useEffect(()=>{$.current=!0;const d=()=>{++D.current,A.current?.abort(),z.current=!1,N(!1),I(null),S(null),L(!1)};return window.addEventListener(de,d),()=>{$.current=!1,++D.current,A.current?.abort(),window.removeEventListener(de,d)}},[]),i.useEffect(()=>{++D.current,A.current?.abort(),z.current=!1,N(!1),S(null),I(null),L(!1),e&&T(e),a&&E(a)},[O,b?.client,e,a,t]),i.useEffect(()=>{o&&oe.current&&!x&&ne(),oe.current=x},[x,o]),i.useEffect(()=>{const d=window.matchMedia?.("(max-width: 639px)");if(!d)return;const g=()=>he(d.matches?1:2);return g(),d.addEventListener("change",g),()=>d.removeEventListener("change",g)},[]),!O||b?.enabled===!1)return null;function ne(){++D.current,A.current?.abort(),z.current=!1,N(!1),S(null),I(null),L(!1)}function xe(d){d||ne(),typeof _!="boolean"&&w(d),k?.(d)}function Y(d,g){++D.current,A.current?.abort(),z.current=!1,N(!1),S(null),I(null),d(g)}async function se(d){if(z.current)return;z.current=!0;const g=K.current,H=++D.current,Q=new AbortController;A.current=Q,N(!0),S(null),I(null);const q=()=>{const R=K.current;if(!$.current||H!==D.current||o&&!re.current||!R||Object.keys(g).some(P=>g[P]!==R[P])||g.client&&!Ie(g.client))throw new p("export_cancelled",409)};try{const R=await rt({userId:g.userId,auth:b.getAccessToken,from:g.start,to:g.end,deviceId:g.deviceId,signal:Q.signal,assertCurrent:q});q(),await st(R,d,{signal:Q.signal,assertCurrent:q}),q();const P=R.metadata.effective_range,ie=R.rows.length?f("cloud.export.success",{count:R.rows.length,from:P.from,to:P.to}):f("cloud.export.empty");I(P.from!==g.start||P.to!==g.end?`${ie} ${f("cloud.export.truncated",{from:P.from,to:P.to})}`:ie)}catch(R){$.current&&H===D.current&&S(ct(R))}finally{H===D.current&&(z.current=!1,$.current&&N(!1))}}const V="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";let B=null;return(o||x)&&(B=r.jsxs("div",{id:ae,className:o?void 0:s?"w-full rounded-lg bg-oai-gray-50 p-4 dark:bg-oai-gray-950/50":"mt-2 border-l-2 border-oai-gray-200 pl-3 dark:border-oai-gray-700","aria-busy":C,children:[o?null:r.jsx("p",{className:"text-xs leading-5 text-oai-gray-600 dark:text-oai-gray-300",children:f("cloud.export.description")}),r.jsxs("div",{className:o?"space-y-4":"mt-3 flex flex-wrap items-end gap-3",children:[o?r.jsxs(Qe,{open:J,onOpenChange:L,children:[r.jsxs(Ze,{disabled:C,"aria-label":f("trend.zoom.pick_range"),className:"inline-flex h-10 min-h-10 w-full items-center gap-2 rounded-md border border-oai-gray-300 bg-transparent px-3 text-sm text-oai-black transition-colors hover:bg-oai-gray-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-oai-gray-500 disabled:opacity-50 dark:border-oai-gray-700 dark:text-oai-white dark:hover:bg-oai-gray-800",children:[r.jsx(He,{size:16,className:"shrink-0 text-oai-gray-500","aria-hidden":!0}),r.jsxs("span",{className:"flex-1 text-left tabular-nums",children:[v," → ",u]}),r.jsx(ue,{size:14,className:"shrink-0 text-oai-gray-500","aria-hidden":!0})]}),r.jsx(Xe,{children:r.jsx(We,{sideOffset:8,side:"bottom",align:"start",className:"z-[110]",children:r.jsx(et,{className:"max-w-[calc(100vw-2rem)] rounded-xl border border-oai-gray-200 bg-white shadow-lg outline-none dark:border-oai-gray-700 dark:bg-oai-gray-900",children:r.jsx(Ve,{from:v,to:u,numberOfMonths:me,onApply:(d,g)=>{Y(T,d),E(g),L(!1)},onCancel:()=>L(!1)})})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"min-w-0 text-xs text-oai-gray-700 dark:text-oai-gray-200",children:[f("cloud.export.from"),r.jsx("input",{type:"date",value:v,onChange:d=>Y(T,d.target.value),className:`${o?"min-h-10 min-w-0 w-full ":""}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`})]}),r.jsxs("label",{className:"min-w-0 text-xs text-oai-gray-700 dark:text-oai-gray-200",children:[f("cloud.export.to"),r.jsx("input",{type:"date",value:u,onChange:d=>Y(E,d.target.value),className:`${o?"min-h-10 min-w-0 w-full ":""}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`})]})]}),r.jsxs("div",{className:o?"flex justify-end gap-2":"flex gap-2",children:[r.jsx(Z,{type:"button",variant:o?"secondary":"ghost",size:"sm",className:`${V} ${o?"!min-h-8 !h-8":""}`,disabled:C,onClick:()=>se("csv"),children:f("cloud.export.csv")}),r.jsx(Z,{type:"button",variant:o?"secondary":"ghost",size:"sm",className:`${V} ${o?"!min-h-8 !h-8":""}`,disabled:C,onClick:()=>se("json"),children:f("cloud.export.json")})]})]}),C?r.jsx("p",{role:"status",className:"mt-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:f("cloud.export.busy")}):null,y?r.jsx("p",{role:"alert",className:"mt-2 text-xs text-red-700 dark:text-red-300",children:y}):null,F?r.jsx("p",{role:"status",className:"mt-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:F}):null]})),o?r.jsx(it,{open:x,onOpenChange:xe,title:f("cloud.export.open"),icon:fe,children:B}):r.jsxs("section",{className:s&&!o?"tt-cloud-theme contents":"tt-cloud-theme","aria-label":f("cloud.export.open"),children:[r.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:`${V} ${o?"!h-11 !w-full !justify-start !px-0 !text-oai-black dark:!text-oai-white active:!scale-100":s?"!h-10 !px-0":""}`,"aria-expanded":x,"aria-controls":ae,onClick:()=>w(d=>!d),children:[r.jsx(fe,{className:`${o?"mr-3":"mr-2"} h-4 w-4 shrink-0`,"aria-hidden":"true"}),f("cloud.export.open"),o?r.jsx(ue,{size:16,className:`ml-auto shrink-0 transition-transform motion-reduce:transition-none ${x?"rotate-180":""}`,"aria-hidden":!0}):null]}),!o&&n&&B?Te.createPortal(B,n):B]})}export{it as C,yt as P,vt as a,kt as b,_t as u};
@@ -1 +1 @@
1
- import{o as M,d as E,r,P as I,c as i,j as o,y as L}from"./__vite-browser-external-2g_4s3ot.js";import{m as j}from"./react-DlHjGQFN.js";import{P as A}from"./ProviderIcon-Bp7iFJ_m.js";import{g as $}from"./skills-api-Dc1-2qu6.js";import{A as R}from"./index-BV7qwUw4.js";import{S as K}from"./search-BDPr56_h.js";import{u as q}from"./use-reduced-motion-D1gcKJUo.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),P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Q(){const f=E(),d=q(),[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 P&&!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(R,{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(K,{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:L("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(A,{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{Q as CommandPalette};
1
+ import{o as M,d as E,r,P as I,c as i,j as o,y as L}from"./__vite-browser-external-DWN9Fb-H.js";import{m as j}from"./react-CCNSVHEA.js";import{P as A}from"./ProviderIcon-ClHXNkQ0.js";import{g as $}from"./skills-api-CD-ojBGj.js";import{A as R}from"./index-DX7nYrHb.js";import{S as K}from"./search-DYmYb9xY.js";import{u as q}from"./use-reduced-motion-C3MBYVqm.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),P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Q(){const f=E(),d=q(),[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 P&&!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(R,{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(K,{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:L("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(A,{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{Q as CommandPalette};
@@ -1 +1 @@
1
- import{o as R,j as e,an as P,l as z,r as D,c as n,X as S,i as K}from"./__vite-browser-external-2g_4s3ot.js";import{m as M}from"./react-DlHjGQFN.js";import{A as U,W as B}from"./icons-q-3zvEkh.js";import{u as F}from"./useTokenFormat-D7nzgxKw.js";import{P as G}from"./ProviderIcon-Bp7iFJ_m.js";import{T as W}from"./TrendMonitor-X7-aGzIv.js";import{T as V}from"./AchievementBadge-Dazs3pEa.js";import{T as X}from"./terminal-D4VZbvhg.js";import{D as Y,a as Z,b as H,c as q,d as J,e as Q}from"./DialogTitle-B-VifiA3.js";import{D as ee}from"./DialogDescription-DBqGGWNj.js";import{D as ae}from"./DialogClose-uVUNu4rg.js";import"./useCurrency-CM22CmAq.js";import"./DateRangePopover-B-BMOm3O.js";import"./use-latest-request-guard-DhGg1cDS.js";import"./PopoverPopup-NYiGE8A2.js";import"./store-gHeBU8dQ.js";import"./composite-INW-ELWX.js";import"./SelectItemText-BpIsAg3b.js";import"./usePositioner-B3l2ulTw.js";import"./safePolygon-CVZ27a2_.js";import"./use-reduced-motion-D1gcKJUo.js";import"./zap-Daxct1WV.js";import"./flame-DCzvFKV1.js";import"./calendar-days-B0aDoKSG.js";import"./shield-check-DtT8ACzI.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 I({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(I,{value:i,label:r})]})]})}function A({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(A,{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(I,{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(A,{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 Ge(t){return e.jsx(P,{mode:z.COMPACT,children:e.jsx(ve,{...t})})}export{Ge as CommunityStatsModal};
1
+ import{o as R,j as e,an as P,l as z,r as D,c as n,X as S,i as K}from"./__vite-browser-external-DWN9Fb-H.js";import{m as M}from"./react-CCNSVHEA.js";import{A as U,W as B}from"./icons-CbB9Y-eV.js";import{u as F}from"./useTokenFormat-Bq-rwuKa.js";import{P as G}from"./ProviderIcon-ClHXNkQ0.js";import{T as W}from"./TrendMonitor-as8idaOy.js";import{T as V}from"./AchievementBadge-CHDt55IP.js";import{T as X}from"./terminal-CTv-oTU2.js";import{D as Y,a as Z,b as H,c as q,d as J,e as Q}from"./DialogTitle-B9NNSz5p.js";import{D as ee}from"./DialogDescription-yy_QHg7O.js";import{D as ae}from"./DialogClose-DjnC3P4V.js";import"./useCurrency-CbCnjf-N.js";import"./DateRangePopover-DuqNLatr.js";import"./use-latest-request-guard-B1_rbvgH.js";import"./PopoverPopup-BzfELnIC.js";import"./store-B22kwLs0.js";import"./composite-Cq0CmNAv.js";import"./SelectItemText-aaQK_QIt.js";import"./usePositioner-MepYlL0A.js";import"./safePolygon-DsolkMUX.js";import"./use-reduced-motion-C3MBYVqm.js";import"./zap-1ah5e11g.js";import"./flame-CrJDlnro.js";import"./calendar-days-bzh7-lab.js";import"./shield-check-5zABLIr6.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 I({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(I,{value:i,label:r})]})]})}function A({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(A,{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(I,{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(A,{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 Ge(t){return e.jsx(P,{mode:z.COMPACT,children:e.jsx(ve,{...t})})}export{Ge as CommunityStatsModal};
@@ -1 +1 @@
1
- import{j as a,B as r,y as p}from"./__vite-browser-external-2g_4s3ot.js";import{D as m,a as y,b,c as u,d as f,e as h}from"./DialogTitle-B-VifiA3.js";import{D as j}from"./DialogDescription-DBqGGWNj.js";function _({open:l,title:n,description:t,error:s=null,confirmLabel:d,cancelLabel:o,destructive:c=!1,busy:e=!1,onConfirm:g,onCancel:i}){return a.jsx(m,{open:l,onOpenChange:x=>{!x&&!e&&i?.()},children:a.jsxs(y,{children:[a.jsx(b,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),a.jsx(u,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:a.jsxs(f,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[a.jsx(h,{className:"text-base font-semibold text-oai-black dark:text-white",children:n}),t?a.jsx(j,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t}):null,s?a.jsx("p",{className:"mt-2 text-sm leading-6 text-red-600 dark:text-red-400",role:"alert",children:s}):null,a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx(r,{type:"button",variant:"secondary",size:"sm",disabled:e,onClick:()=>i?.(),children:o}),a.jsx(r,{type:"button",size:"sm",disabled:e,onClick:()=>g?.(),className:p(c&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:d})]})]})})]})})}export{_ as C};
1
+ import{j as a,B as r,y as p}from"./__vite-browser-external-DWN9Fb-H.js";import{D as m,a as y,b,c as u,d as f,e as h}from"./DialogTitle-B9NNSz5p.js";import{D as j}from"./DialogDescription-yy_QHg7O.js";function _({open:l,title:n,description:t,error:s=null,confirmLabel:d,cancelLabel:o,destructive:c=!1,busy:e=!1,onConfirm:g,onCancel:i}){return a.jsx(m,{open:l,onOpenChange:x=>{!x&&!e&&i?.()},children:a.jsxs(y,{children:[a.jsx(b,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),a.jsx(u,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:a.jsxs(f,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[a.jsx(h,{className:"text-base font-semibold text-oai-black dark:text-white",children:n}),t?a.jsx(j,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t}):null,s?a.jsx("p",{className:"mt-2 text-sm leading-6 text-red-600 dark:text-red-400",role:"alert",children:s}):null,a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx(r,{type:"button",variant:"secondary",size:"sm",disabled:e,onClick:()=>i?.(),children:o}),a.jsx(r,{type:"button",size:"sm",disabled:e,onClick:()=>g?.(),className:p(c&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:d})]})]})})]})})}export{_ as C};
@@ -1 +1 @@
1
- import{j as e,y as n}from"./__vite-browser-external-2g_4s3ot.js";import{C as c}from"./Card-BYoxd4OC.js";function g({checked:a,onChange:s,disabled:i,ariaLabel:r,id:t}){return e.jsx("button",{type:"button",id:t,role:"switch","aria-checked":a,"aria-label":r,onClick:s,disabled:i,className:"relative inline-flex h-11 w-11 min-h-11 min-w-11 shrink-0 items-center justify-center rounded-full bg-transparent p-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:cursor-not-allowed disabled:opacity-50",children:e.jsx("span",{"aria-hidden":"true",className:n("tt-toggle-track relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors",a?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:n("tt-toggle-thumb 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 h({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 b({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{b as S,g as T,u as a,h as b};
1
+ import{j as e,y as n}from"./__vite-browser-external-DWN9Fb-H.js";import{C as c}from"./Card-C9FjyAwh.js";function g({checked:a,onChange:s,disabled:i,ariaLabel:r,id:t}){return e.jsx("button",{type:"button",id:t,role:"switch","aria-checked":a,"aria-label":r,onClick:s,disabled:i,className:"relative inline-flex h-11 w-11 min-h-11 min-w-11 shrink-0 items-center justify-center rounded-full bg-transparent p-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:cursor-not-allowed disabled:opacity-50",children:e.jsx("span",{"aria-hidden":"true",className:n("tt-toggle-track relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors",a?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:n("tt-toggle-thumb 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 h({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 b({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{b as S,g as T,u as a,h as b};