tokentracker-cli 1.3.9 → 1.3.11

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 (126) hide show
  1. package/README.de.md +7 -6
  2. package/README.ja.md +6 -5
  3. package/README.ko.md +6 -5
  4. package/README.md +7 -6
  5. package/README.zh-CN.md +6 -5
  6. package/dashboard/dist/assets/{AchievementBadge-C6ZoXGzv.js → AchievementBadge-CjXQPC-W.js} +1 -1
  7. package/dashboard/dist/assets/{AchievementsPage-BkHoOrUq.js → AchievementsPage-xb-g6Jws.js} +2 -2
  8. package/dashboard/dist/assets/{AchievementsSection-BmK0_LQF.js → AchievementsSection-DI4NOt9D.js} +1 -1
  9. package/dashboard/dist/assets/{BadgeDetailModal-DwoD1Nsr.js → BadgeDetailModal-Cn2rV5Bk.js} +1 -1
  10. package/dashboard/dist/assets/{BotAnimated-m4GXCXTJ.js → BotAnimated-CFb-gvO7.js} +1 -1
  11. package/dashboard/dist/assets/{Card-D_SqQIBC.js → Card-CB2-QAqP.js} +1 -1
  12. package/dashboard/dist/assets/{CloudCheckoutPage-BSYvxA_x.js → CloudCheckoutPage-beBzOiJA.js} +1 -1
  13. package/dashboard/dist/assets/{CloudPage-Bwnj7Ocg.js → CloudPage-COYm4wdR.js} +2 -2
  14. package/dashboard/dist/assets/{CommandPalette-CBMCbek2.js → CommandPalette-kCa9Mfpj.js} +1 -1
  15. package/dashboard/dist/assets/CommunityStatsModal-BeUZhxxn.js +1 -0
  16. package/dashboard/dist/assets/{ConfirmModal-DAt5opxx.js → ConfirmModal-DiCm2JXX.js} +1 -1
  17. package/dashboard/dist/assets/{Controls-DsJLsMpr.js → Controls-BkRVScXl.js} +1 -1
  18. package/dashboard/dist/assets/{DashboardPage-B4hR6Jr1.js → DashboardPage-DiV0ynQc.js} +1 -1
  19. package/dashboard/dist/assets/{DateRangePopover-CyAT0F7i.js → DateRangePopover-DdmjfdFj.js} +1 -1
  20. package/dashboard/dist/assets/DevicePage-D7E9uy4l.js +1 -0
  21. package/dashboard/dist/assets/{DialogClose-Dg8Rrcbc.js → DialogClose-VDWLqY0o.js} +1 -1
  22. package/dashboard/dist/assets/DialogDescription-BQ5VSHQi.js +1 -0
  23. package/dashboard/dist/assets/{DialogTitle-CgQTzYDB.js → DialogTitle-DfBUUBYN.js} +1 -1
  24. package/dashboard/dist/assets/{ElectricLogo-PbWNE6Jw.js → ElectricLogo-Cr-WDplA.js} +1 -1
  25. package/dashboard/dist/assets/{FadeIn-CgGVCeA7.js → FadeIn-DPdMW40K.js} +1 -1
  26. package/dashboard/dist/assets/{HeaderGithubStar-D8I6O4H1.js → HeaderGithubStar-Ulqd6uC1.js} +1 -1
  27. package/dashboard/dist/assets/{HoverTooltip-BQ0w0NcA.js → HoverTooltip-By6YzN89.js} +1 -1
  28. package/dashboard/dist/assets/{IpCheckPage-D9vVoMNk.js → IpCheckPage-BLvWuVmL.js} +1 -1
  29. package/dashboard/dist/assets/{LandingPage-DNV9PcRZ.js → LandingPage-BfgBmSGV.js} +2 -2
  30. package/dashboard/dist/assets/{LeaderboardPage-BVfC39jk.js → LeaderboardPage-D7C91BEb.js} +2 -2
  31. package/dashboard/dist/assets/{LeaderboardProBadge-g6XLqOpA.js → LeaderboardProBadge-Mj_-HH8L.js} +1 -1
  32. package/dashboard/dist/assets/{LeaderboardProfileModal-Dxwperqt.js → LeaderboardProfileModal-BfHTrqHf.js} +3 -3
  33. package/dashboard/dist/assets/{LeaderboardProfilePage-C9552VgQ.js → LeaderboardProfilePage-CggAvx-w.js} +1 -1
  34. package/dashboard/dist/assets/{LimitsPage-CWaM8Ubc.js → LimitsPage-BR8hlK7t.js} +1 -1
  35. package/dashboard/dist/assets/{LocalOnlyNotice-DJ8t4CkI.js → LocalOnlyNotice-yW1orlU8.js} +1 -1
  36. package/dashboard/dist/assets/{LoginCard-5cDUjlaP.js → LoginCard-B_7mpZ6Y.js} +1 -1
  37. package/dashboard/dist/assets/{LoginModal-CaEskXOR.js → LoginModal-D1ZtIkRD.js} +1 -1
  38. package/dashboard/dist/assets/{LoginPage--buWhwDc.js → LoginPage-DRThDeqD.js} +1 -1
  39. package/dashboard/dist/assets/{PetPage-DZlGXdiW.js → PetPage-CsIkqyiR.js} +2 -2
  40. package/dashboard/dist/assets/{PopoverPopup-IQrgeWzz.js → PopoverPopup-dySzR9xR.js} +1 -1
  41. package/dashboard/dist/assets/{ProviderIcon-CSKhjDnT.js → ProviderIcon-oBKAZ-WS.js} +1 -1
  42. package/dashboard/dist/assets/{ResetPasswordPage-ClzIMLjQ.js → ResetPasswordPage-Bf0-zIl2.js} +1 -1
  43. package/dashboard/dist/assets/{Select-KHVnbrwD.js → Select-xyNGq71G.js} +1 -1
  44. package/dashboard/dist/assets/{SelectItemText-BqAFvX8b.js → SelectItemText-C8ZB19C7.js} +1 -1
  45. package/dashboard/dist/assets/{SelfHostPage-DHA9hDnA.js → SelfHostPage-Cf7pLoVz.js} +1 -1
  46. package/dashboard/dist/assets/{ServiceStatusPage-A4WcSrnG.js → ServiceStatusPage-BH3W_Wxq.js} +1 -1
  47. package/dashboard/dist/assets/{SessionsPage-CWu0gXwO.js → SessionsPage-u8RIKjx9.js} +3 -3
  48. package/dashboard/dist/assets/{SettingsPage-DzurIV6u.js → SettingsPage-Bnh-AxM9.js} +3 -3
  49. package/dashboard/dist/assets/{SkillsPage-CfM8w0xf.js → SkillsPage-CIP3Av7z.js} +1 -1
  50. package/dashboard/dist/assets/{TokenGalaxy-BiCXCnEH.js → TokenGalaxy-DnNhsfa-.js} +1 -1
  51. package/dashboard/dist/assets/{TooltipPopup-BcnMVc6a.js → TooltipPopup-BstAYPIH.js} +1 -1
  52. package/dashboard/dist/assets/{TrendMonitor-PFSJn43N.js → TrendMonitor-D4CVzczb.js} +1 -1
  53. package/dashboard/dist/assets/{WidgetsPage-CnH4zkP8.js → WidgetsPage-A_gMzap_.js} +1 -1
  54. package/dashboard/dist/assets/{WrappedPage-BpsnuM4e.js → WrappedPage-Bmm_WjA5.js} +1 -1
  55. package/dashboard/dist/assets/{__vite-browser-external-CbhiyufG.js → __vite-browser-external-DS-dnBDP.js} +3 -3
  56. package/dashboard/dist/assets/{__vite-browser-external-CbUj3l39.css → __vite-browser-external-kAUz3kFs.css} +1 -1
  57. package/dashboard/dist/assets/{agent-logos-DFupeEJz.js → agent-logos-BdU0GjQq.js} +1 -1
  58. package/dashboard/dist/assets/{arrow-left-Cu0jOgzo.js → arrow-left-Cl8AYaOh.js} +1 -1
  59. package/dashboard/dist/assets/{arrow-right-DgFuyz9F.js → arrow-right-Cfi2pR1p.js} +1 -1
  60. package/dashboard/dist/assets/{arrow-up-right-COoZfksW.js → arrow-up-right-DH7vnAf4.js} +1 -1
  61. package/dashboard/dist/assets/{calendar-days-B_QPPq3a.js → calendar-days-BJjjx5Vu.js} +1 -1
  62. package/dashboard/dist/assets/{check-D_enaDhp.js → check-DGTejNYt.js} +1 -1
  63. package/dashboard/dist/assets/{chevron-down-Di_xdF9P.js → chevron-down-Brz4a22U.js} +1 -1
  64. package/dashboard/dist/assets/{cloud-checkout-DNFMqoiZ.js → cloud-checkout-DZbiSnVr.js} +1 -1
  65. package/dashboard/dist/assets/{composite-CUbvhoGL.js → composite-rfjkpEna.js} +1 -1
  66. package/dashboard/dist/assets/{download-CrDgjohg.js → download-axaJjbTW.js} +1 -1
  67. package/dashboard/dist/assets/{external-link-DgnNV6zS.js → external-link-D9dvv4DN.js} +1 -1
  68. package/dashboard/dist/assets/{flame-Lsd5DkgX.js → flame-DuivUwnP.js} +1 -1
  69. package/dashboard/dist/assets/{format-tokens-DSxX2imE.js → format-tokens-Dg_-K3cD.js} +1 -1
  70. package/dashboard/dist/assets/{gift-BA3WiW1-.js → gift-CgE1uDg4.js} +1 -1
  71. package/dashboard/dist/assets/{host-mode-BiJLkMdX.js → host-mode-C2QCLKjw.js} +1 -1
  72. package/dashboard/dist/assets/{icons-BxxxA-aw.js → icons-PNlyYW8C.js} +1 -1
  73. package/dashboard/dist/assets/{index-V-WILWJ0.js → index-BbroxaKr.js} +1 -1
  74. package/dashboard/dist/assets/{index-BTC0A20d.js → index-DFWE1vbu.js} +1 -1
  75. package/dashboard/dist/assets/{index-BlvkImKO.js → index-PiRGMAPd.js} +1 -1
  76. package/dashboard/dist/assets/{info-CluBWyTe.js → info-BjRBvuNu.js} +1 -1
  77. package/dashboard/dist/assets/{link-2-M880npIj.js → link-2-CCqYoK3V.js} +1 -1
  78. package/dashboard/dist/assets/{loader-circle-BEowiVYF.js → loader-circle-IiB0vjDJ.js} +1 -1
  79. package/dashboard/dist/assets/{modifiers.esm-pR4sKZep.js → modifiers.esm-DbjjBgLM.js} +1 -1
  80. package/dashboard/dist/assets/{monitor-smartphone-GOnwL7NC.js → monitor-smartphone-BUSQ3-U3.js} +1 -1
  81. package/dashboard/dist/assets/{play-C2Yih72t.js → play-CDU4bWoE.js} +1 -1
  82. package/dashboard/dist/assets/{plus-KF6U4UP_.js → plus-BY7jwS0R.js} +1 -1
  83. package/dashboard/dist/assets/{provider-display-Bio3tJX4.js → provider-display-endIONDM.js} +1 -1
  84. package/dashboard/dist/assets/{react-Dt52_FiQ.js → react-C0JpiKb9.js} +1 -1
  85. package/dashboard/dist/assets/{safePolygon-D7wQNKcm.js → safePolygon-B5pqmyki.js} +1 -1
  86. package/dashboard/dist/assets/{search-CW0YCdKx.js → search-BWQCqCrK.js} +1 -1
  87. package/dashboard/dist/assets/{server-DKLG1DuM.js → server-DkDn4DQU.js} +1 -1
  88. package/dashboard/dist/assets/{shield-check-DkJ3sCHH.js → shield-check-BPOMBy-3.js} +1 -1
  89. package/dashboard/dist/assets/{skills-api-yS1uW-mw.js → skills-api-Btor2iNW.js} +1 -1
  90. package/dashboard/dist/assets/{sortable.esm-DZo9A4kG.js → sortable.esm-qA98E6si.js} +1 -1
  91. package/dashboard/dist/assets/{store-BbYtf4Vy.js → store-DRcycxJw.js} +1 -1
  92. package/dashboard/dist/assets/{terminal-FK6txO2c.js → terminal-BWOI_yxH.js} +1 -1
  93. package/dashboard/dist/assets/{trash-QX4FHz_p.js → trash-DgWVzyKs.js} +1 -1
  94. package/dashboard/dist/assets/{use-community-stats-DaURJ5sU.js → use-community-stats-odyPsCDi.js} +1 -1
  95. package/dashboard/dist/assets/{use-latest-request-guard-BZnnoQct.js → use-latest-request-guard-CBocPZjh.js} +1 -1
  96. package/dashboard/dist/assets/{use-limits-display-prefs-C77UTTya.js → use-limits-display-prefs-uKB639iI.js} +1 -1
  97. package/dashboard/dist/assets/{use-native-settings-DHS101SR.js → use-native-settings-EoDW6Dgk.js} +1 -1
  98. package/dashboard/dist/assets/{use-ordered-list-h5iXqXbU.js → use-ordered-list-B4Gychu4.js} +1 -1
  99. package/dashboard/dist/assets/use-reduced-motion-B-JhzSwL.js +1 -0
  100. package/dashboard/dist/assets/{use-session-efficiency-pref-DZVvvmoq.js → use-session-efficiency-pref-C0goPBNl.js} +1 -1
  101. package/dashboard/dist/assets/{use-transform-dcPyhMQK.js → use-transform-hwE19i1Y.js} +1 -1
  102. package/dashboard/dist/assets/{use-usage-limits-BBAi4Wvb.js → use-usage-limits-DnsGayPX.js} +1 -1
  103. package/dashboard/dist/assets/{useCurrency-CW5GHWIB.js → useCurrency-DiN1Jj_t.js} +1 -1
  104. package/dashboard/dist/assets/{usePositioner-BQgBHX5s.js → usePositioner-CM1Isf5e.js} +1 -1
  105. package/dashboard/dist/assets/{useTokenFormat-DntK8yNR.js → useTokenFormat-CGhMrRps.js} +1 -1
  106. package/dashboard/dist/assets/{zap-Brp6hC7u.js → zap-Bc2wd9eQ.js} +1 -1
  107. package/dashboard/dist/index.html +14 -12
  108. package/dashboard/dist/ip-check.html +2 -2
  109. package/dashboard/dist/leaderboard.html +2 -2
  110. package/dashboard/dist/llms.txt +3 -2
  111. package/dashboard/dist/share.html +2 -2
  112. package/package.json +2 -2
  113. package/src/commands/init.js +9 -0
  114. package/src/commands/status.js +11 -0
  115. package/src/commands/sync.js +197 -122
  116. package/src/lib/dumate.js +95 -0
  117. package/src/lib/pricing/seed-snapshot.json +1 -1
  118. package/src/lib/qoder-cn-cli-limits.js +117 -0
  119. package/src/lib/qoder-limits.js +24 -11
  120. package/src/lib/rollout.js +12 -9
  121. package/src/lib/session-analytics.js +210 -19
  122. package/src/lib/upload-queue.js +134 -0
  123. package/dashboard/dist/assets/CommunityStatsModal-DkMCREYc.js +0 -1
  124. package/dashboard/dist/assets/DevicePage-CaZzXt8j.js +0 -1
  125. package/dashboard/dist/assets/DialogDescription-gdxwXQBG.js +0 -1
  126. package/dashboard/dist/assets/use-reduced-motion-Bpc6LGag.js +0 -1
@@ -0,0 +1,134 @@
1
+ const fs = require("node:fs/promises");
2
+ const crypto = require("node:crypto");
3
+ const { isUtf8 } = require("node:buffer");
4
+
5
+ const BACKLOG_BYTES = 1_000_000;
6
+ const CHUNK_BYTES = 64 * 1024;
7
+ const { TOKEN_COLUMNS } = require("./account-usage-dedup");
8
+
9
+ function sessionSnapshotMs(row) {
10
+ const verifiedMs = Date.parse(row?.snapshot_verified_at);
11
+ if (typeof row?.source !== "string" || row.source.trim().toLowerCase() !== "trae-cn" ||
12
+ typeof row.session_id !== "string" || !row.session_id.trim() || row.session_id.trim().length > 256 ||
13
+ typeof row.model !== "string" || !row.model.trim() || row.model.trim().length > 200 ||
14
+ !Number.isFinite(Date.parse(row.bucket_start)) || !Number.isFinite(verifiedMs) ||
15
+ TOKEN_COLUMNS.some((column) => !Number.isSafeInteger(Number(row[column])) || Number(row[column]) < 0) ||
16
+ Number(row.total_tokens) !== Number(row.input_tokens) + Number(row.output_tokens) + Number(row.cached_input_tokens) + Number(row.cache_creation_input_tokens)) return null;
17
+ return verifiedMs;
18
+ }
19
+
20
+ // Keep raw bytes, including CRLF and incomplete tails. Upload offsets are
21
+ // byte positions, not JavaScript string lengths.
22
+ async function* iterateQueueLines(handle, start, end) {
23
+ let position = start;
24
+ let lineStart = start;
25
+ let carry = Buffer.alloc(0);
26
+ while (position < end) {
27
+ const chunk = Buffer.allocUnsafe(Math.min(CHUNK_BYTES, end - position));
28
+ const { bytesRead } = await handle.read(chunk, 0, chunk.length, position);
29
+ if (!bytesRead) throw new Error("Queue changed while reading");
30
+ position += bytesRead;
31
+ const data = carry.length ? Buffer.concat([carry, chunk.subarray(0, bytesRead)]) : chunk.subarray(0, bytesRead);
32
+ let consumed = 0;
33
+ let newline;
34
+ while ((newline = data.indexOf(10, consumed)) !== -1) {
35
+ const bytes = data.subarray(consumed, newline + 1);
36
+ yield { bytes, start: lineStart, complete: true };
37
+ lineStart += bytes.length;
38
+ consumed = newline + 1;
39
+ }
40
+ carry = Buffer.from(data.subarray(consumed));
41
+ }
42
+ if (carry.length) yield { bytes: carry, start: lineStart, complete: false };
43
+ }
44
+
45
+ function snapshotKey(bytes) {
46
+ if (!isUtf8(bytes)) return null;
47
+ let row;
48
+ try { row = JSON.parse(bytes.toString("utf8")); } catch { return null; }
49
+ if (!row || typeof row !== "object" || Array.isArray(row)) return null;
50
+ if (row.kind === "account_session_state") {
51
+ const verifiedMs = sessionSnapshotMs(row);
52
+ if (verifiedMs === null) return null;
53
+ return { key: JSON.stringify(["session", row.source.trim().toLowerCase(), row.session_id.trim()]), verifiedMs };
54
+ }
55
+ // Preserve unknown control records even when they happen to carry a bucket.
56
+ if (Object.hasOwn(row, "kind") || typeof row.hour_start !== "string" || !Number.isFinite(Date.parse(row.hour_start))) return null;
57
+ const source = (typeof row.source === "string" ? row.source.trim().toLowerCase() : "") || "codex";
58
+ const model = (typeof row.model === "string" ? row.model.trim() : "") || "unknown";
59
+ return { key: JSON.stringify(["hourly", source, model, row.hour_start]), verifiedMs: null };
60
+ }
61
+
62
+ // Caller holds sync.lock. Only rewrite pending snapshots; uploaded history and
63
+ // queue.state.json stay byte-for-byte unchanged across an atomic replacement.
64
+ async function compactPendingQueue({ queuePath, offset = 0, minPendingBytes = BACKLOG_BYTES }) {
65
+ let input;
66
+ let output;
67
+ let temporary;
68
+ try {
69
+ input = await fs.open(queuePath, "r");
70
+ const before = await input.stat();
71
+ const pendingBytesBefore = Math.max(0, before.size - offset);
72
+ const unchanged = { compacted: false, removedRecords: 0, pendingBytesBefore, pendingBytesAfter: pendingBytesBefore };
73
+ if (!before.isFile() || !Number.isSafeInteger(offset) || offset < 0 || offset >= before.size || pendingBytesBefore < minPendingBytes) return unchanged;
74
+ if (offset > 0) {
75
+ const boundary = Buffer.alloc(1);
76
+ await input.read(boundary, 0, 1, offset - 1);
77
+ if (boundary[0] !== 10) return unchanged;
78
+ }
79
+ const latest = new Map();
80
+ let removedRecords = 0;
81
+ for await (const line of iterateQueueLines(input, offset, before.size)) {
82
+ const snapshot = line.complete ? snapshotKey(line.bytes) : null;
83
+ if (snapshot == null) continue;
84
+ const previous = latest.get(snapshot.key);
85
+ if (previous) removedRecords += 1;
86
+ // Account truth uses a strictly newer fetch stamp; equal stamps retain
87
+ // the first observation, even after a replay or local clock rollback.
88
+ if (!previous || snapshot.verifiedMs === null || snapshot.verifiedMs > previous.verifiedMs) {
89
+ latest.set(snapshot.key, { start: line.start, verifiedMs: snapshot.verifiedMs });
90
+ }
91
+ }
92
+ if (!removedRecords) return unchanged;
93
+
94
+ temporary = `${queuePath}.compact.${crypto.randomUUID()}`;
95
+ output = await fs.open(temporary, "wx", before.mode & 0o777);
96
+ await output.chmod(before.mode & 0o777);
97
+ for (let position = 0; position < offset;) {
98
+ const chunk = Buffer.allocUnsafe(Math.min(CHUNK_BYTES, offset - position));
99
+ const { bytesRead } = await input.read(chunk, 0, chunk.length, position);
100
+ if (!bytesRead) throw new Error("Queue changed while copying uploaded history");
101
+ await output.writeFile(chunk.subarray(0, bytesRead));
102
+ position += bytesRead;
103
+ }
104
+ let pendingBytesAfter = 0;
105
+ for await (const line of iterateQueueLines(input, offset, before.size)) {
106
+ const snapshot = line.complete ? snapshotKey(line.bytes) : null;
107
+ if (snapshot != null && latest.get(snapshot.key).start !== line.start) continue;
108
+ await output.writeFile(line.bytes);
109
+ pendingBytesAfter += line.bytes.length;
110
+ }
111
+ await output.sync();
112
+ await output.close();
113
+ output = null;
114
+ // Windows cannot replace the destination while our read handle is open.
115
+ await input.close();
116
+ input = null;
117
+ const current = await fs.stat(queuePath);
118
+ if (current.ino !== before.ino || current.size !== before.size || current.mtimeMs !== before.mtimeMs) {
119
+ throw new Error("Queue changed during pending compaction");
120
+ }
121
+ await fs.rename(temporary, queuePath);
122
+ temporary = null;
123
+ return { compacted: true, removedRecords, pendingBytesBefore, pendingBytesAfter };
124
+ } catch (error) {
125
+ if (error.code === "ENOENT" && !input) return { compacted: false, removedRecords: 0, pendingBytesBefore: 0, pendingBytesAfter: 0 };
126
+ throw error;
127
+ } finally {
128
+ await input?.close();
129
+ await output?.close();
130
+ if (temporary) await fs.unlink(temporary).catch(() => {});
131
+ }
132
+ }
133
+
134
+ module.exports = { BACKLOG_BYTES, compactPendingQueue, iterateQueueLines, sessionSnapshotMs };
@@ -1 +0,0 @@
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-CbhiyufG.js";import{m as M}from"./react-Dt52_FiQ.js";import{A as U,W as B}from"./icons-BxxxA-aw.js";import{u as F}from"./useTokenFormat-DntK8yNR.js";import{P as G}from"./ProviderIcon-CSKhjDnT.js";import{T as W}from"./TrendMonitor-PFSJn43N.js";import{T as V}from"./AchievementBadge-C6ZoXGzv.js";import{T as X}from"./terminal-FK6txO2c.js";import{D as Y,a as Z,b as H,c as q,d as J,e as Q}from"./DialogTitle-CgQTzYDB.js";import{D as ee}from"./DialogDescription-gdxwXQBG.js";import{D as ae}from"./DialogClose-Dg8Rrcbc.js";import"./useCurrency-CW5GHWIB.js";import"./DateRangePopover-CyAT0F7i.js";import"./use-latest-request-guard-BZnnoQct.js";import"./PopoverPopup-IQrgeWzz.js";import"./store-BbYtf4Vy.js";import"./composite-CUbvhoGL.js";import"./SelectItemText-BqAFvX8b.js";import"./usePositioner-BQgBHX5s.js";import"./safePolygon-D7wQNKcm.js";import"./use-reduced-motion-Bpc6LGag.js";import"./zap-Brp6hC7u.js";import"./flame-Lsd5DkgX.js";import"./calendar-days-B_QPPq3a.js";import"./shield-check-DkJ3sCHH.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 +0,0 @@
1
- import{a as b,r as l,j as r,c as e,f as v}from"./__vite-browser-external-CbhiyufG.js";const x={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"1.3.9",VITE_INSFORGE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function f(){return v(),`${(x&&"https://srctyff5.us-east.insforge.app"||"https://srctyff5.us-east.insforge.app").replace(/\/$/,"")}/functions/tokentracker-device-flow-grant`}function p(s){return(s||"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9-]/g,"")}function h(){const s=b(),[m,g]=l.useState(""),[i,a]=l.useState({kind:"idle",message:""});l.useEffect(()=>{try{const d=new URLSearchParams(window.location.search).get("user_code");d&&g(p(d))}catch{}},[]);async function u(c){if(c?.preventDefault?.(),!s?.signedIn){a({kind:"error",message:e("device.approval.error.sign_in")});return}const d=p(m);if(!/^[A-HJKMNP-Z2-9]{4}-[A-HJKMNP-Z2-9]{4}$/.test(d)){a({kind:"error",message:e("device.approval.error.invalid_code")});return}a({kind:"working",message:e("device.approval.action.approving")});try{const n=await s.getAccessToken?.();if(!n){a({kind:"error",message:e("device.approval.error.no_token")});return}const o=await fetch(f(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({user_code:d})}),t=await o.json().catch(()=>({}));o.ok?a({kind:"success",message:t.status==="already_approved"?t.client_info?e("device.approval.success.already_client",{client:t.client_info}):e("device.approval.success.already"):t.client_info?e("device.approval.success.approved_client",{client:t.client_info}):e("device.approval.success.approved")}):o.status===404?a({kind:"error",message:e("device.approval.error.not_found")}):o.status===410?a({kind:"error",message:e("device.approval.error.expired")}):o.status===401?a({kind:"error",message:e("device.approval.error.session_expired")}):a({kind:"error",message:t?.error?e("device.approval.error.server_detail",{message:t.error}):e("device.approval.error.server",{status:o.status})})}catch(n){a({kind:"error",message:e("device.approval.error.network",{message:n?.message||n})})}}return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-oai-gray-950 px-6 py-12",children:r.jsxs("div",{className:"w-full max-w-md rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-8",children:[r.jsx("h1",{className:"text-2xl font-semibold text-oai-gray-900 dark:text-white mb-2",children:e("device.approval.title")}),r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mb-6",children:e("device.approval.description")}),s?.signedIn?null:r.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 dark:bg-amber-900/20 dark:border-amber-800 p-4 mb-4",children:r.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:e("device.approval.sign_in_banner")})}),r.jsxs("form",{onSubmit:u,className:"space-y-4",children:[r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"block text-xs font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400 mb-1",children:e("device.approval.code_label")}),r.jsx("input",{type:"text",value:m,onChange:c=>g(p(c.target.value)),placeholder:"XXXX-XXXX",spellCheck:!1,autoCapitalize:"characters",maxLength:9,className:"w-full font-mono text-xl tracking-widest text-center rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-900 dark:text-white px-4 py-3 focus:outline-none focus:ring-inset focus:ring-2 focus:ring-emerald-600"})]}),r.jsx("button",{type:"submit",disabled:i.kind==="working"||!s?.signedIn,className:"w-full rounded-md bg-emerald-600 hover:bg-emerald-500 disabled:bg-oai-gray-300 disabled:cursor-not-allowed text-white font-medium py-3 transition-colors",children:i.kind==="working"?e("device.approval.action.approving"):e("device.approval.action.approve")})]}),i.kind==="success"&&r.jsx("div",{className:"mt-4 rounded-md border border-emerald-200 bg-emerald-50 dark:bg-emerald-900/20 dark:border-emerald-800 p-4",children:r.jsx("p",{className:"text-sm text-emerald-700 dark:text-emerald-300",children:i.message})}),i.kind==="error"&&r.jsx("div",{className:"mt-4 rounded-md border border-red-200 bg-red-50 dark:bg-red-900/20 dark:border-red-800 p-4",children:r.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:i.message})})]})})}export{h as default};
@@ -1 +0,0 @@
1
- import{r as n,K as a}from"./__vite-browser-external-CbhiyufG.js";import{u as p}from"./DialogTitle-CgQTzYDB.js";import{u as c}from"./composite-CUbvhoGL.js";const x=n.forwardRef(function(e,r){const{render:l,className:u,style:m,id:s,...t}=e,i=p(),o=c(s);return i.useSyncedValueWithCleanup("descriptionElementId",o),a("p",e,{ref:r,props:[{id:o},t]})});export{x as D};
@@ -1 +0,0 @@
1
- import{r as o}from"./__vite-browser-external-CbhiyufG.js";import{h as r,i as t,p as s}from"./react-Dt52_FiQ.js";function i(){!r.current&&t();const[e]=o.useState(s.current);return e}export{i as u};