@juliantanx/aiusage-widget 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/i18n.js +12 -0
- package/dist/main.js +3 -1
- package/dist/preload.js +4 -0
- package/dist/renderer/assets/{index-iI9Ag7ZK.css → index-BHRV-uj7.css} +1 -1
- package/dist/renderer/assets/index-BQ2IyMyH.js +1 -0
- package/dist/renderer/index.html +2 -2
- package/package.json +1 -1
- package/dist/renderer/assets/index-CM09fccb.js +0 -1
package/dist/i18n.js
CHANGED
|
@@ -32,6 +32,12 @@ const en = {
|
|
|
32
32
|
refresh: 'Refresh',
|
|
33
33
|
quit: 'Quit',
|
|
34
34
|
close: 'Close',
|
|
35
|
+
installTitle: 'Dashboard Setup',
|
|
36
|
+
installPreparing: 'Preparing...',
|
|
37
|
+
installInstalling: 'Installing @juliantanx/aiusage...',
|
|
38
|
+
installLaunching: 'Starting dashboard...',
|
|
39
|
+
installDone: 'Done! Opening...',
|
|
40
|
+
installFailed: 'Installation failed',
|
|
35
41
|
};
|
|
36
42
|
const zh = {
|
|
37
43
|
today: '今日',
|
|
@@ -64,6 +70,12 @@ const zh = {
|
|
|
64
70
|
refresh: '刷新',
|
|
65
71
|
quit: '退出',
|
|
66
72
|
close: '关闭',
|
|
73
|
+
installTitle: '仪表盘配置',
|
|
74
|
+
installPreparing: '准备中...',
|
|
75
|
+
installInstalling: '正在安装 @juliantanx/aiusage...',
|
|
76
|
+
installLaunching: '正在启动仪表盘...',
|
|
77
|
+
installDone: '完成!正在打开...',
|
|
78
|
+
installFailed: '安装失败',
|
|
67
79
|
};
|
|
68
80
|
const translations = { en, zh };
|
|
69
81
|
function t(locale) {
|
package/dist/main.js
CHANGED
|
@@ -178,10 +178,12 @@ async function openDashboardAction() {
|
|
|
178
178
|
const port = getDashboardPort();
|
|
179
179
|
const reachable = await isDashboardReachable(port);
|
|
180
180
|
if (!reachable) {
|
|
181
|
+
// Show widget window so user can see install progress
|
|
182
|
+
showWindow();
|
|
183
|
+
notifyRenderer('install:status', { phase: 'installing' });
|
|
181
184
|
const result = await launchDashboard();
|
|
182
185
|
if (!result.success) {
|
|
183
186
|
// CLI not found; attempt auto-install
|
|
184
|
-
notifyRenderer('install:status', { phase: 'installing' });
|
|
185
187
|
const installResult = await installAiusageCli();
|
|
186
188
|
if (!installResult.success) {
|
|
187
189
|
notifyRenderer('install:status', { phase: 'failed', error: installResult.error });
|
package/dist/preload.js
CHANGED
|
@@ -10,6 +10,10 @@ electron_1.contextBridge.exposeInMainWorld('widget', {
|
|
|
10
10
|
electron_1.ipcRenderer.removeAllListeners('widget:data-update');
|
|
11
11
|
electron_1.ipcRenderer.on('widget:data-update', (_event, data) => callback(data));
|
|
12
12
|
},
|
|
13
|
+
onInstallStatus: (callback) => {
|
|
14
|
+
electron_1.ipcRenderer.removeAllListeners('install:status');
|
|
15
|
+
electron_1.ipcRenderer.on('install:status', (_event, status) => callback(status));
|
|
16
|
+
},
|
|
13
17
|
getSettings: () => electron_1.ipcRenderer.invoke('widget:get-settings'),
|
|
14
18
|
saveSettings: (settings) => electron_1.ipcRenderer.invoke('widget:save-settings', settings),
|
|
15
19
|
getExchangeRate: () => electron_1.ipcRenderer.invoke('widget:get-exchange-rate'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.header.svelte-1c4hcx6{display:flex;align-items:center;justify-content:space-between;padding:9px 14px 8px;-webkit-app-region:drag}.brand.svelte-1c4hcx6{display:flex;align-items:center;gap:6px}.logo.svelte-1c4hcx6{font-size:12px;font-weight:600;color:var(--text-primary)}.status.svelte-1c4hcx6{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:8px;line-height:1;color:var(--text-muted);font-variant-numeric:tabular-nums;margin-left:2px;transform:translateY(1px)}.actions.svelte-1c4hcx6{display:flex;gap:2px;-webkit-app-region:no-drag}.icon-btn.svelte-1c4hcx6{width:24px;height:24px;border:none;border-radius:4px;background:transparent;color:var(--text-muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .1s,color .1s;padding:0}.icon-btn.svelte-1c4hcx6:hover{background:var(--bg-hover);color:var(--text-primary)}.row.svelte-36ktuv{display:flex;align-items:baseline;justify-content:space-between;padding:6px 0}.label.svelte-36ktuv{font-size:11px;font-weight:550;letter-spacing:.04em;text-transform:uppercase;color:var(--text-muted)}.right.svelte-36ktuv{display:flex;align-items:baseline;gap:6px}.value.svelte-36ktuv{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:13px;font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums}.value.accent.svelte-36ktuv{color:var(--accent)}.sub.svelte-36ktuv{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;color:var(--text-muted);font-variant-numeric:tabular-nums}.breakdown.svelte-4y3y1j{padding:0}.bar.svelte-4y3y1j{display:flex;height:6px;border-radius:3px;overflow:hidden;gap:1px;margin-bottom:8px}.segment.svelte-4y3y1j{min-width:3px;border-radius:1px}.legend.svelte-4y3y1j{display:grid;grid-template-columns:1fr 1fr;gap:3px 12px}.legend-item.svelte-4y3y1j{display:flex;align-items:center;gap:4px}.dot.svelte-4y3y1j{width:6px;height:6px;border-radius:50%;flex-shrink:0}.legend-label.svelte-4y3y1j{font-size:10px;color:var(--text-muted);flex:1}.legend-value.svelte-4y3y1j{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:550;color:var(--text-secondary);font-variant-numeric:tabular-nums}.empty.svelte-4y3y1j{font-size:10px;color:var(--text-muted);text-align:center;padding:8px 0}.chart-wrapper.svelte-15p89al.svelte-15p89al{position:relative;-webkit-user-select:none;user-select:none}.chart-svg.svelte-15p89al.svelte-15p89al{display:block;cursor:crosshair;overflow:visible}.chart-svg.svelte-15p89al .line.svelte-15p89al{stroke-dasharray:2000;stroke-dashoffset:2000;transition:stroke-dashoffset .8s cubic-bezier(.16,1,.3,1)}.chart-svg.mounted.svelte-15p89al .line.svelte-15p89al{stroke-dashoffset:0}.chart-svg.svelte-15p89al .cost-line.svelte-15p89al{opacity:.75}.chart-svg.svelte-15p89al .area.svelte-15p89al{opacity:0;transition:opacity .6s cubic-bezier(.16,1,.3,1) .3s}.chart-svg.mounted.svelte-15p89al .area.svelte-15p89al{opacity:1}.tick-label.svelte-15p89al.svelte-15p89al{font-size:8px;fill:var(--text-muted);font-family:Geist Mono,SF Mono,Menlo,monospace;font-variant-numeric:tabular-nums}.y-label.svelte-15p89al.svelte-15p89al{font-size:7px;fill:var(--text-muted);opacity:.72;font-family:Geist Mono,SF Mono,Menlo,monospace;font-variant-numeric:tabular-nums}.y-label-cost.svelte-15p89al.svelte-15p89al{fill:var(--chart-cache-read);opacity:.78}.tooltip-fo.svelte-15p89al.svelte-15p89al{overflow:visible;pointer-events:none}.tooltip.svelte-15p89al.svelte-15p89al{display:flex;align-items:center;justify-content:center;gap:8px;height:24px;padding:0 8px;border:1px solid var(--border);border-radius:4px;background:var(--surface);box-shadow:0 4px 10px #0000001f;color:var(--text-primary);position:relative;box-sizing:border-box;font-family:Inter,-apple-system,sans-serif;pointer-events:none;white-space:nowrap}.tooltip.svelte-15p89al.svelte-15p89al:after{content:"";position:absolute;top:50%;width:6px;height:6px;border-right:1px solid var(--border);border-bottom:1px solid var(--border);background:var(--surface)}.tooltip.pointer-left.svelte-15p89al.svelte-15p89al:after{left:-4px;transform:translateY(-50%) rotate(135deg)}.tooltip.pointer-right.svelte-15p89al.svelte-15p89al:after{right:-4px;transform:translateY(-50%) rotate(-45deg)}.tooltip-date.svelte-15p89al.svelte-15p89al,.tooltip-metric.svelte-15p89al.svelte-15p89al{position:relative;z-index:1}.tooltip-date.svelte-15p89al.svelte-15p89al{font-size:9px;color:var(--text-secondary);line-height:1}.tooltip-metric.svelte-15p89al.svelte-15p89al{display:inline-flex;align-items:center;gap:4px;font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums;line-height:1}.tooltip-metric.svelte-15p89al.svelte-15p89al:before{content:"";width:5px;height:5px;border-radius:50%;background:var(--accent);display:inline-block}.cost-dot.svelte-15p89al.svelte-15p89al{color:var(--chart-cache-read)}.cost-dot.svelte-15p89al.svelte-15p89al:before{background:var(--chart-cache-read)}@media (prefers-reduced-motion: reduce){.chart-svg.svelte-15p89al .line.svelte-15p89al{stroke-dasharray:none;stroke-dashoffset:0;transition:none}.chart-svg.svelte-15p89al .area.svelte-15p89al{opacity:1;transition:none}}.settings.svelte-198qnem.svelte-198qnem{padding:0 14px 14px}.settings-header.svelte-198qnem.svelte-198qnem{display:flex;align-items:center;justify-content:space-between;padding:8px 0 10px}.settings-title.svelte-198qnem.svelte-198qnem{font-size:12px;font-weight:600;color:var(--text-primary)}.back-btn.svelte-198qnem.svelte-198qnem{width:24px;height:24px;border:none;border-radius:4px;background:transparent;color:var(--text-muted);cursor:pointer;display:flex;align-items:center;justify-content:center}.back-btn.svelte-198qnem.svelte-198qnem:hover{background:var(--bg-hover);color:var(--text-primary)}.section.svelte-198qnem.svelte-198qnem{margin-bottom:14px}.section-label.svelte-198qnem.svelte-198qnem{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);margin-bottom:6px}.button-group.svelte-198qnem.svelte-198qnem{display:flex;gap:0;border-radius:6px;overflow:hidden;border:1px solid var(--border)}.rate-info.svelte-198qnem.svelte-198qnem{display:grid;grid-template-columns:auto 1fr;gap:2px 8px;align-items:baseline;margin-top:6px;color:var(--text-muted);font-size:10px}.rate-info.svelte-198qnem strong.svelte-198qnem{justify-self:end;color:var(--text-secondary);font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:600;font-variant-numeric:tabular-nums}.rate-info.svelte-198qnem small.svelte-198qnem{grid-column:1 / -1;justify-self:end;font-size:9px;color:var(--text-muted)}.rate-info.error.svelte-198qnem strong.svelte-198qnem{color:var(--text-muted)}.option-btn.svelte-198qnem.svelte-198qnem{flex:1;padding:6px 0;border:none;background:transparent;color:var(--text-secondary);font-size:11px;font-weight:500;cursor:pointer;transition:background .1s,color .1s}.option-btn.svelte-198qnem.svelte-198qnem:not(:last-child){border-right:1px solid var(--border)}.option-btn.active.svelte-198qnem.svelte-198qnem{background:var(--accent);color:#fff}.option-btn.svelte-198qnem.svelte-198qnem:hover:not(.active){background:var(--bg-hover)}.toggles.svelte-198qnem.svelte-198qnem{display:flex;flex-direction:column;gap:8px}.toggle-row.svelte-198qnem.svelte-198qnem{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--text-secondary);cursor:pointer}.toggle.svelte-198qnem.svelte-198qnem{position:relative;width:32px;height:18px;border-radius:9px;border:none;background:var(--border);cursor:pointer;transition:background .15s;padding:0}.toggle.on.svelte-198qnem.svelte-198qnem{background:var(--accent)}.toggle-thumb.svelte-198qnem.svelte-198qnem{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .15s;display:block}.toggle.on.svelte-198qnem .toggle-thumb.svelte-198qnem{transform:translate(14px)}*{box-sizing:border-box;margin:0;padding:0}html,body{width:100%;height:100%;overflow:hidden}body{background:transparent;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:root{--bg:oklch(.985 .004 175);--surface:oklch(.995 .003 175);--bg-hover:oklch(.955 .008 175);--border:oklch(.92 .008 175);--border-medium:oklch(.87 .01 175);--text-primary:oklch(.18 .012 175);--text-secondary:oklch(.42 .015 175);--text-muted:oklch(.6 .012 175);--accent:oklch(.55 .12 175);--chart-input:oklch(.65 .14 175);--chart-output:oklch(.6 .15 250);--chart-cache-read:oklch(.7 .1 65);--chart-cache-write:oklch(.65 .12 310);--chart-thinking:oklch(.6 .16 300);--shadow:none}@media (prefers-color-scheme: dark){:root{--bg:oklch(.18 .008 175);--surface:oklch(.22 .006 175);--bg-hover:oklch(.26 .01 175);--border:oklch(.3 .01 175);--border-medium:oklch(.35 .012 175);--text-primary:oklch(.94 .006 175);--text-secondary:oklch(.76 .01 175);--text-muted:oklch(.58 .008 175);--accent:oklch(.65 .12 175);--chart-input:oklch(.65 .14 175);--chart-output:oklch(.6 .15 250);--chart-cache-read:oklch(.7 .1 65);--chart-cache-write:oklch(.65 .12 310);--chart-thinking:oklch(.6 .16 300);--shadow:none}}.panel.svelte-1d2i7t8{background:var(--bg);border-radius:10px;border:1px solid var(--border);overflow:hidden;width:100vw;box-shadow:var(--shadow);transition:opacity .15s}.panel.loading.svelte-1d2i7t8{opacity:.7}.content.svelte-1d2i7t8{padding:0 14px 8px}.section.svelte-1d2i7t8{padding:8px 0}.section.svelte-1d2i7t8:not(:last-child):not(.details){border-bottom:1px solid var(--border)}.section-title.svelte-1d2i7t8{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);margin-bottom:8px}.metric-grid.svelte-1d2i7t8{display:grid;grid-template-columns:1fr 1fr;gap:12px}.metric.svelte-1d2i7t8{display:flex;flex-direction:column;gap:2px}.metric-label.svelte-1d2i7t8{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted)}.metric-value.svelte-1d2i7t8{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:20px;font-weight:700;color:var(--text-primary);font-variant-numeric:tabular-nums;line-height:1.2}.metric-cost.svelte-1d2i7t8{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:11px;font-weight:550;color:var(--accent);font-variant-numeric:tabular-nums}.details.svelte-1d2i7t8{padding:4px 0}
|
|
1
|
+
.header.svelte-1c4hcx6{display:flex;align-items:center;justify-content:space-between;padding:9px 14px 8px;-webkit-app-region:drag}.brand.svelte-1c4hcx6{display:flex;align-items:center;gap:6px}.logo.svelte-1c4hcx6{font-size:12px;font-weight:600;color:var(--text-primary)}.status.svelte-1c4hcx6{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:8px;line-height:1;color:var(--text-muted);font-variant-numeric:tabular-nums;margin-left:2px;transform:translateY(1px)}.actions.svelte-1c4hcx6{display:flex;gap:2px;-webkit-app-region:no-drag}.icon-btn.svelte-1c4hcx6{width:24px;height:24px;border:none;border-radius:4px;background:transparent;color:var(--text-muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .1s,color .1s;padding:0}.icon-btn.svelte-1c4hcx6:hover{background:var(--bg-hover);color:var(--text-primary)}.row.svelte-36ktuv{display:flex;align-items:baseline;justify-content:space-between;padding:6px 0}.label.svelte-36ktuv{font-size:11px;font-weight:550;letter-spacing:.04em;text-transform:uppercase;color:var(--text-muted)}.right.svelte-36ktuv{display:flex;align-items:baseline;gap:6px}.value.svelte-36ktuv{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:13px;font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums}.value.accent.svelte-36ktuv{color:var(--accent)}.sub.svelte-36ktuv{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;color:var(--text-muted);font-variant-numeric:tabular-nums}.breakdown.svelte-4y3y1j{padding:0}.bar.svelte-4y3y1j{display:flex;height:6px;border-radius:3px;overflow:hidden;gap:1px;margin-bottom:8px}.segment.svelte-4y3y1j{min-width:3px;border-radius:1px}.legend.svelte-4y3y1j{display:grid;grid-template-columns:1fr 1fr;gap:3px 12px}.legend-item.svelte-4y3y1j{display:flex;align-items:center;gap:4px}.dot.svelte-4y3y1j{width:6px;height:6px;border-radius:50%;flex-shrink:0}.legend-label.svelte-4y3y1j{font-size:10px;color:var(--text-muted);flex:1}.legend-value.svelte-4y3y1j{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:550;color:var(--text-secondary);font-variant-numeric:tabular-nums}.empty.svelte-4y3y1j{font-size:10px;color:var(--text-muted);text-align:center;padding:8px 0}.chart-wrapper.svelte-15p89al.svelte-15p89al{position:relative;-webkit-user-select:none;user-select:none}.chart-svg.svelte-15p89al.svelte-15p89al{display:block;cursor:crosshair;overflow:visible}.chart-svg.svelte-15p89al .line.svelte-15p89al{stroke-dasharray:2000;stroke-dashoffset:2000;transition:stroke-dashoffset .8s cubic-bezier(.16,1,.3,1)}.chart-svg.mounted.svelte-15p89al .line.svelte-15p89al{stroke-dashoffset:0}.chart-svg.svelte-15p89al .cost-line.svelte-15p89al{opacity:.75}.chart-svg.svelte-15p89al .area.svelte-15p89al{opacity:0;transition:opacity .6s cubic-bezier(.16,1,.3,1) .3s}.chart-svg.mounted.svelte-15p89al .area.svelte-15p89al{opacity:1}.tick-label.svelte-15p89al.svelte-15p89al{font-size:8px;fill:var(--text-muted);font-family:Geist Mono,SF Mono,Menlo,monospace;font-variant-numeric:tabular-nums}.y-label.svelte-15p89al.svelte-15p89al{font-size:7px;fill:var(--text-muted);opacity:.72;font-family:Geist Mono,SF Mono,Menlo,monospace;font-variant-numeric:tabular-nums}.y-label-cost.svelte-15p89al.svelte-15p89al{fill:var(--chart-cache-read);opacity:.78}.tooltip-fo.svelte-15p89al.svelte-15p89al{overflow:visible;pointer-events:none}.tooltip.svelte-15p89al.svelte-15p89al{display:flex;align-items:center;justify-content:center;gap:8px;height:24px;padding:0 8px;border:1px solid var(--border);border-radius:4px;background:var(--surface);box-shadow:0 4px 10px #0000001f;color:var(--text-primary);position:relative;box-sizing:border-box;font-family:Inter,-apple-system,sans-serif;pointer-events:none;white-space:nowrap}.tooltip.svelte-15p89al.svelte-15p89al:after{content:"";position:absolute;top:50%;width:6px;height:6px;border-right:1px solid var(--border);border-bottom:1px solid var(--border);background:var(--surface)}.tooltip.pointer-left.svelte-15p89al.svelte-15p89al:after{left:-4px;transform:translateY(-50%) rotate(135deg)}.tooltip.pointer-right.svelte-15p89al.svelte-15p89al:after{right:-4px;transform:translateY(-50%) rotate(-45deg)}.tooltip-date.svelte-15p89al.svelte-15p89al,.tooltip-metric.svelte-15p89al.svelte-15p89al{position:relative;z-index:1}.tooltip-date.svelte-15p89al.svelte-15p89al{font-size:9px;color:var(--text-secondary);line-height:1}.tooltip-metric.svelte-15p89al.svelte-15p89al{display:inline-flex;align-items:center;gap:4px;font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums;line-height:1}.tooltip-metric.svelte-15p89al.svelte-15p89al:before{content:"";width:5px;height:5px;border-radius:50%;background:var(--accent);display:inline-block}.cost-dot.svelte-15p89al.svelte-15p89al{color:var(--chart-cache-read)}.cost-dot.svelte-15p89al.svelte-15p89al:before{background:var(--chart-cache-read)}@media (prefers-reduced-motion: reduce){.chart-svg.svelte-15p89al .line.svelte-15p89al{stroke-dasharray:none;stroke-dashoffset:0;transition:none}.chart-svg.svelte-15p89al .area.svelte-15p89al{opacity:1;transition:none}}.settings.svelte-198qnem.svelte-198qnem{padding:0 14px 14px}.settings-header.svelte-198qnem.svelte-198qnem{display:flex;align-items:center;justify-content:space-between;padding:8px 0 10px}.settings-title.svelte-198qnem.svelte-198qnem{font-size:12px;font-weight:600;color:var(--text-primary)}.back-btn.svelte-198qnem.svelte-198qnem{width:24px;height:24px;border:none;border-radius:4px;background:transparent;color:var(--text-muted);cursor:pointer;display:flex;align-items:center;justify-content:center}.back-btn.svelte-198qnem.svelte-198qnem:hover{background:var(--bg-hover);color:var(--text-primary)}.section.svelte-198qnem.svelte-198qnem{margin-bottom:14px}.section-label.svelte-198qnem.svelte-198qnem{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);margin-bottom:6px}.button-group.svelte-198qnem.svelte-198qnem{display:flex;gap:0;border-radius:6px;overflow:hidden;border:1px solid var(--border)}.rate-info.svelte-198qnem.svelte-198qnem{display:grid;grid-template-columns:auto 1fr;gap:2px 8px;align-items:baseline;margin-top:6px;color:var(--text-muted);font-size:10px}.rate-info.svelte-198qnem strong.svelte-198qnem{justify-self:end;color:var(--text-secondary);font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:10px;font-weight:600;font-variant-numeric:tabular-nums}.rate-info.svelte-198qnem small.svelte-198qnem{grid-column:1 / -1;justify-self:end;font-size:9px;color:var(--text-muted)}.rate-info.error.svelte-198qnem strong.svelte-198qnem{color:var(--text-muted)}.option-btn.svelte-198qnem.svelte-198qnem{flex:1;padding:6px 0;border:none;background:transparent;color:var(--text-secondary);font-size:11px;font-weight:500;cursor:pointer;transition:background .1s,color .1s}.option-btn.svelte-198qnem.svelte-198qnem:not(:last-child){border-right:1px solid var(--border)}.option-btn.active.svelte-198qnem.svelte-198qnem{background:var(--accent);color:#fff}.option-btn.svelte-198qnem.svelte-198qnem:hover:not(.active){background:var(--bg-hover)}.toggles.svelte-198qnem.svelte-198qnem{display:flex;flex-direction:column;gap:8px}.toggle-row.svelte-198qnem.svelte-198qnem{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--text-secondary);cursor:pointer}.toggle.svelte-198qnem.svelte-198qnem{position:relative;width:32px;height:18px;border-radius:9px;border:none;background:var(--border);cursor:pointer;transition:background .15s;padding:0}.toggle.on.svelte-198qnem.svelte-198qnem{background:var(--accent)}.toggle-thumb.svelte-198qnem.svelte-198qnem{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .15s;display:block}.toggle.on.svelte-198qnem .toggle-thumb.svelte-198qnem{transform:translate(14px)}*{box-sizing:border-box;margin:0;padding:0}html,body{width:100%;height:100%;overflow:hidden}body{background:transparent;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:root{--bg:oklch(.985 .004 175);--surface:oklch(.995 .003 175);--bg-hover:oklch(.955 .008 175);--border:oklch(.92 .008 175);--border-medium:oklch(.87 .01 175);--text-primary:oklch(.18 .012 175);--text-secondary:oklch(.42 .015 175);--text-muted:oklch(.6 .012 175);--accent:oklch(.55 .12 175);--chart-input:oklch(.65 .14 175);--chart-output:oklch(.6 .15 250);--chart-cache-read:oklch(.7 .1 65);--chart-cache-write:oklch(.65 .12 310);--chart-thinking:oklch(.6 .16 300);--shadow:none}@media (prefers-color-scheme: dark){:root{--bg:oklch(.18 .008 175);--surface:oklch(.22 .006 175);--bg-hover:oklch(.26 .01 175);--border:oklch(.3 .01 175);--border-medium:oklch(.35 .012 175);--text-primary:oklch(.94 .006 175);--text-secondary:oklch(.76 .01 175);--text-muted:oklch(.58 .008 175);--accent:oklch(.65 .12 175);--chart-input:oklch(.65 .14 175);--chart-output:oklch(.6 .15 250);--chart-cache-read:oklch(.7 .1 65);--chart-cache-write:oklch(.65 .12 310);--chart-thinking:oklch(.6 .16 300);--shadow:none}}.panel.svelte-1sj3khb.svelte-1sj3khb{position:relative;background:var(--bg);border-radius:10px;border:1px solid var(--border);overflow:hidden;width:100vw;box-shadow:var(--shadow);transition:opacity .15s}.panel.loading.svelte-1sj3khb.svelte-1sj3khb{opacity:.7}.content.svelte-1sj3khb.svelte-1sj3khb{padding:0 14px 8px}.section.svelte-1sj3khb.svelte-1sj3khb{padding:8px 0}.section.svelte-1sj3khb.svelte-1sj3khb:not(:last-child):not(.details){border-bottom:1px solid var(--border)}.section-title.svelte-1sj3khb.svelte-1sj3khb{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted);margin-bottom:8px}.metric-grid.svelte-1sj3khb.svelte-1sj3khb{display:grid;grid-template-columns:1fr 1fr;gap:12px}.metric.svelte-1sj3khb.svelte-1sj3khb{display:flex;flex-direction:column;gap:2px}.metric-label.svelte-1sj3khb.svelte-1sj3khb{font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-muted)}.metric-value.svelte-1sj3khb.svelte-1sj3khb{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:20px;font-weight:700;color:var(--text-primary);font-variant-numeric:tabular-nums;line-height:1.2}.metric-cost.svelte-1sj3khb.svelte-1sj3khb{font-family:Geist Mono,SF Mono,Menlo,monospace;font-size:11px;font-weight:550;color:var(--accent);font-variant-numeric:tabular-nums}.details.svelte-1sj3khb.svelte-1sj3khb{padding:4px 0}.install-overlay.svelte-1sj3khb.svelte-1sj3khb{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--bg);display:flex;align-items:center;justify-content:center;z-index:100;border-radius:10px}.install-content.svelte-1sj3khb.svelte-1sj3khb{display:flex;flex-direction:column;align-items:center;gap:10px;padding:24px;text-align:center}.install-title.svelte-1sj3khb.svelte-1sj3khb{font-size:13px;font-weight:600;color:var(--text-primary)}.install-message.svelte-1sj3khb.svelte-1sj3khb{font-size:12px;color:var(--text-secondary)}.install-error.svelte-1sj3khb.svelte-1sj3khb{font-size:11px;color:#e74c3c;max-width:280px;word-break:break-word}.install-overlay.done.svelte-1sj3khb .install-message.svelte-1sj3khb{color:var(--accent)}.install-spinner.svelte-1sj3khb.svelte-1sj3khb{width:24px;height:24px;border:2.5px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:svelte-1sj3khb-spin .8s linear infinite}.install-spinner.hidden.svelte-1sj3khb.svelte-1sj3khb{display:none}@keyframes svelte-1sj3khb-spin{to{transform:rotate(360deg)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var El=Object.defineProperty;var Al=(e,t,l)=>t in e?El(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;var ut=(e,t,l)=>Al(e,typeof t!="symbol"?t+"":t,l);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(o){if(o.ep)return;o.ep=!0;const s=l(o);fetch(o.href,s)}})();function fe(){}function Sl(e){return e()}function qt(){return Object.create(null)}function De(e){e.forEach(Sl)}function Xe(e){return typeof e=="function"}function Ge(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Pl(e){return Object.keys(e).length===0}function r(e,t){e.appendChild(t)}function A(e,t,l){e.insertBefore(t,l||null)}function R(e){e.parentNode&&e.parentNode.removeChild(e)}function ke(e,t){for(let l=0;l<e.length;l+=1)e[l]&&e[l].d(t)}function v(e){return document.createElement(e)}function Y(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function O(e){return document.createTextNode(e)}function L(){return O(" ")}function ve(){return O("")}function de(e,t,l,n){return e.addEventListener(t,l,n),()=>e.removeEventListener(t,l,n)}function i(e,t,l){l==null?e.removeAttribute(t):e.getAttribute(t)!==l&&e.setAttribute(t,l)}function Bl(e){return Array.from(e.childNodes)}function U(e,t){t=""+t,e.data!==t&&(e.data=t)}function Se(e,t,l,n){l==null?e.style.removeProperty(t):e.style.setProperty(t,l,"")}function z(e,t,l){e.classList.toggle(t,!!l)}function Nl(e,t,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(e,{detail:t,bubbles:l,cancelable:n})}let Ze;function Qe(e){Ze=e}function yt(){if(!Ze)throw new Error("Function called outside component initialization");return Ze}function Ml(e){yt().$$.on_mount.push(e)}function Il(e){yt().$$.after_update.push(e)}function Ol(){const e=yt();return(t,l,{cancelable:n=!1}={})=>{const o=e.$$.callbacks[t];if(o){const s=Nl(t,l,{cancelable:n});return o.slice().forEach(a=>{a.call(e,s)}),!s.defaultPrevented}return!0}}const ze=[],_t=[];let Ve=[];const jt=[],Ll=Promise.resolve();let mt=!1;function Dl(){mt||(mt=!0,Ll.then(ql))}function Rt(){return Dl(),Ll}function pt(e){Ve.push(e)}const ht=new Set;let We=0;function ql(){if(We!==0)return;const e=Ze;do{try{for(;We<ze.length;){const t=ze[We];We++,Qe(t),Hl(t.$$)}}catch(t){throw ze.length=0,We=0,t}for(Qe(null),ze.length=0,We=0;_t.length;)_t.pop()();for(let t=0;t<Ve.length;t+=1){const l=Ve[t];ht.has(l)||(ht.add(l),l())}Ve.length=0}while(ze.length);for(;jt.length;)jt.pop()();mt=!1,ht.clear(),Qe(e)}function Hl(e){if(e.fragment!==null){e.update(),De(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(pt)}}function Ul(e){const t=[],l=[];Ve.forEach(n=>e.indexOf(n)===-1?t.push(n):l.push(n)),l.forEach(n=>n()),Ve=t}const tt=new Set;let Fe;function vt(){Fe={r:0,c:[],p:Fe}}function bt(){Fe.r||De(Fe.c),Fe=Fe.p}function ne(e,t){e&&e.i&&(tt.delete(e),e.i(t))}function _e(e,t,l,n){if(e&&e.o){if(tt.has(e))return;tt.add(e),Fe.c.push(()=>{tt.delete(e),n&&(l&&e.d(1),n())}),e.o(t)}else n&&n()}function te(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function Ee(e){e&&e.c()}function Me(e,t,l){const{fragment:n,after_update:o}=e.$$;n&&n.m(t,l),pt(()=>{const s=e.$$.on_mount.map(Sl).filter(Xe);e.$$.on_destroy?e.$$.on_destroy.push(...s):De(s),e.$$.on_mount=[]}),o.forEach(pt)}function Le(e,t){const l=e.$$;l.fragment!==null&&(Ul(l.after_update),De(l.on_destroy),l.fragment&&l.fragment.d(t),l.on_destroy=l.fragment=null,l.ctx=[])}function Wl(e,t){e.$$.dirty[0]===-1&&(ze.push(e),Dl(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Ke(e,t,l,n,o,s,a=null,h=[-1]){const c=Ze;Qe(e);const u=e.$$={fragment:null,ctx:[],props:s,update:fe,not_equal:o,bound:qt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:qt(),dirty:h,skip_bound:!1,root:t.target||c.$$.root};a&&a(u.root);let f=!1;if(u.ctx=l?l(e,t.props||{},(m,d,...g)=>{const y=g.length?g[0]:d;return u.ctx&&o(u.ctx[m],u.ctx[m]=y)&&(!u.skip_bound&&u.bound[m]&&u.bound[m](y),f&&Wl(e,m)),d}):[],u.update(),f=!0,De(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const m=Bl(t.target);u.fragment&&u.fragment.l(m),m.forEach(R)}else u.fragment&&u.fragment.c();t.intro&&ne(e.$$.fragment),Me(e,t.target,t.anchor),ql()}Qe(c)}class Ye{constructor(){ut(this,"$$");ut(this,"$$set")}$destroy(){Le(this,1),this.$destroy=fe}$on(t,l){if(!Xe(l))return fe;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(l),()=>{const o=n.indexOf(l);o!==-1&&n.splice(o,1)}}$set(t){this.$$set&&!Pl(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const zl="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(zl);function Ft(e){let t,l;return{c(){t=v("span"),l=O(e[6]),i(t,"class","status svelte-1c4hcx6")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o&64&&U(l,n[6])},d(n){n&&R(t)}}}function Vl(e){let t,l,n,o,s,a,h,c,u,f,m,d,g,y,I,V,X,C,G,P,F,B,N,E,T,D,K,J,H,_=e[6]&&Ft(e);return{c(){t=v("div"),l=v("div"),n=Y("svg"),o=Y("rect"),s=Y("rect"),a=Y("rect"),h=Y("rect"),c=L(),u=v("span"),u.textContent="AIUsage",f=L(),_&&_.c(),m=L(),d=v("div"),g=v("button"),y=Y("svg"),I=Y("path"),V=Y("path"),X=Y("path"),C=Y("path"),G=L(),P=v("button"),F=Y("svg"),B=Y("circle"),N=Y("path"),E=L(),T=v("button"),D=Y("svg"),K=Y("path"),i(o,"width","64"),i(o,"height","64"),i(o,"rx","14"),i(o,"fill","oklch(0.55 0.12 175)"),i(s,"x","10"),i(s,"y","38"),i(s,"width","12"),i(s,"height","16"),i(s,"rx","3"),i(s,"fill","white"),i(a,"x","26"),i(a,"y","26"),i(a,"width","12"),i(a,"height","28"),i(a,"rx","3"),i(a,"fill","white"),i(h,"x","42"),i(h,"y","14"),i(h,"width","12"),i(h,"height","40"),i(h,"rx","3"),i(h,"fill","white"),i(n,"xmlns","http://www.w3.org/2000/svg"),i(n,"width","14"),i(n,"height","14"),i(n,"viewBox","0 0 64 64"),Se(n,"display","block"),Se(n,"border-radius","3px"),i(u,"class","logo svelte-1c4hcx6"),i(l,"class","brand svelte-1c4hcx6"),i(I,"d","M2.5 8a5.5 5.5 0 0 1 9.36-3.93"),i(V,"d","M13.5 8a5.5 5.5 0 0 1-9.36 3.93"),i(X,"d","M12 1.5v3h-3"),i(C,"d","M4 11.5v3h3"),i(y,"width","13"),i(y,"height","13"),i(y,"viewBox","0 0 16 16"),i(y,"fill","none"),i(y,"stroke","currentColor"),i(y,"stroke-width","1.8"),i(y,"stroke-linecap","round"),i(g,"class","icon-btn svelte-1c4hcx6"),i(g,"title",e[3]),i(g,"aria-label",e[3]),i(B,"cx","12"),i(B,"cy","12"),i(B,"r","3"),i(N,"d","M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"),i(F,"width","13"),i(F,"height","13"),i(F,"viewBox","0 0 24 24"),i(F,"fill","none"),i(F,"stroke","currentColor"),i(F,"stroke-width","2"),i(F,"stroke-linecap","round"),i(F,"stroke-linejoin","round"),i(P,"class","icon-btn svelte-1c4hcx6"),i(P,"title",e[4]),i(P,"aria-label",e[4]),i(K,"d","M2 2l8 8M10 2l-8 8"),i(D,"width","11"),i(D,"height","11"),i(D,"viewBox","0 0 12 12"),i(D,"fill","none"),i(D,"stroke","currentColor"),i(D,"stroke-width","1.8"),i(D,"stroke-linecap","round"),i(T,"class","icon-btn svelte-1c4hcx6"),i(T,"title",e[5]),i(T,"aria-label",e[5]),i(d,"class","actions svelte-1c4hcx6"),i(t,"class","header svelte-1c4hcx6")},m(j,w){A(j,t,w),r(t,l),r(l,n),r(n,o),r(n,s),r(n,a),r(n,h),r(l,c),r(l,u),r(l,f),_&&_.m(l,null),r(t,m),r(t,d),r(d,g),r(g,y),r(y,I),r(y,V),r(y,X),r(y,C),r(d,G),r(d,P),r(P,F),r(F,B),r(F,N),r(d,E),r(d,T),r(T,D),r(D,K),J||(H=[de(g,"click",function(){Xe(e[0])&&e[0].apply(this,arguments)}),de(P,"click",function(){Xe(e[2])&&e[2].apply(this,arguments)}),de(T,"click",function(){Xe(e[1])&&e[1].apply(this,arguments)})],J=!0)},p(j,[w]){e=j,e[6]?_?_.p(e,w):(_=Ft(e),_.c(),_.m(l,null)):_&&(_.d(1),_=null),w&8&&i(g,"title",e[3]),w&8&&i(g,"aria-label",e[3]),w&16&&i(P,"title",e[4]),w&16&&i(P,"aria-label",e[4]),w&32&&i(T,"title",e[5]),w&32&&i(T,"aria-label",e[5])},i:fe,o:fe,d(j){j&&R(t),_&&_.d(),J=!1,De(H)}}}function Gl(e,t,l){let{onRefresh:n}=t,{onClose:o}=t,{onToggleSettings:s}=t,{refreshLabel:a}=t,{settingsLabel:h}=t,{closeLabel:c}=t,{statusText:u=""}=t;return e.$$set=f=>{"onRefresh"in f&&l(0,n=f.onRefresh),"onClose"in f&&l(1,o=f.onClose),"onToggleSettings"in f&&l(2,s=f.onToggleSettings),"refreshLabel"in f&&l(3,a=f.refreshLabel),"settingsLabel"in f&&l(4,h=f.settingsLabel),"closeLabel"in f&&l(5,c=f.closeLabel),"statusText"in f&&l(6,u=f.statusText)},[n,o,s,a,h,c,u]}class Kl extends Ye{constructor(t){super(),Ke(this,t,Gl,Vl,Ge,{onRefresh:0,onClose:1,onToggleSettings:2,refreshLabel:3,settingsLabel:4,closeLabel:5,statusText:6})}}function Et(e){let t,l;return{c(){t=v("span"),l=O(e[2]),i(t,"class","sub svelte-36ktuv")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o&4&&U(l,n[2])},d(n){n&&R(t)}}}function Yl(e){let t,l,n,o,s,a,h,c,u=e[2]&&Et(e);return{c(){t=v("div"),l=v("span"),n=O(e[0]),o=L(),s=v("div"),a=v("span"),h=O(e[1]),c=L(),u&&u.c(),i(l,"class","label svelte-36ktuv"),i(a,"class","value svelte-36ktuv"),z(a,"accent",e[3]),i(s,"class","right svelte-36ktuv"),i(t,"class","row svelte-36ktuv")},m(f,m){A(f,t,m),r(t,l),r(l,n),r(t,o),r(t,s),r(s,a),r(a,h),r(s,c),u&&u.m(s,null)},p(f,[m]){m&1&&U(n,f[0]),m&2&&U(h,f[1]),m&8&&z(a,"accent",f[3]),f[2]?u?u.p(f,m):(u=Et(f),u.c(),u.m(s,null)):u&&(u.d(1),u=null)},i:fe,o:fe,d(f){f&&R(t),u&&u.d()}}}function Xl(e,t,l){let{label:n}=t,{value:o}=t,{sub:s=""}=t,{accent:a=!1}=t;return e.$$set=h=>{"label"in h&&l(0,n=h.label),"value"in h&&l(1,o=h.value),"sub"in h&&l(2,s=h.sub),"accent"in h&&l(3,a=h.accent)},[n,o,s,a]}class dt extends Ye{constructor(t){super(),Ke(this,t,Xl,Yl,Ge,{label:0,value:1,sub:2,accent:3})}}function At(e,t,l){const n=e.slice();return n[7]=t[l],n}function Pt(e,t,l){const n=e.slice();return n[7]=t[l],n}function Ql(e){let t;return{c(){t=v("div"),t.textContent="No token data",i(t,"class","empty svelte-4y3y1j")},m(l,n){A(l,t,n)},p:fe,d(l){l&&R(t)}}}function Zl(e){let t,l,n,o=te(e[0]),s=[];for(let c=0;c<o.length;c+=1)s[c]=Bt(Pt(e,o,c));let a=te(e[0]),h=[];for(let c=0;c<a.length;c+=1)h[c]=Nt(At(e,a,c));return{c(){t=v("div");for(let c=0;c<s.length;c+=1)s[c].c();l=L(),n=v("div");for(let c=0;c<h.length;c+=1)h[c].c();i(t,"class","bar svelte-4y3y1j"),i(n,"class","legend svelte-4y3y1j")},m(c,u){A(c,t,u);for(let f=0;f<s.length;f+=1)s[f]&&s[f].m(t,null);A(c,l,u),A(c,n,u);for(let f=0;f<h.length;f+=1)h[f]&&h[f].m(n,null)},p(c,u){if(u&3){o=te(c[0]);let f;for(f=0;f<o.length;f+=1){const m=Pt(c,o,f);s[f]?s[f].p(m,u):(s[f]=Bt(m),s[f].c(),s[f].m(t,null))}for(;f<s.length;f+=1)s[f].d(1);s.length=o.length}if(u&1){a=te(c[0]);let f;for(f=0;f<a.length;f+=1){const m=At(c,a,f);h[f]?h[f].p(m,u):(h[f]=Nt(m),h[f].c(),h[f].m(n,null))}for(;f<h.length;f+=1)h[f].d(1);h.length=a.length}},d(c){c&&(R(t),R(l),R(n)),ke(s,c),ke(h,c)}}}function Bt(e){let t,l;return{c(){t=v("div"),i(t,"class","segment svelte-4y3y1j"),Se(t,"width",e[7].value/e[1]*100+"%"),Se(t,"background",e[7].color),i(t,"title",l=e[7].label+": "+lt(e[7].value))},m(n,o){A(n,t,o)},p(n,o){o&3&&Se(t,"width",n[7].value/n[1]*100+"%"),o&1&&Se(t,"background",n[7].color),o&1&&l!==(l=n[7].label+": "+lt(n[7].value))&&i(t,"title",l)},d(n){n&&R(t)}}}function Nt(e){let t,l,n,o,s=e[7].label+"",a,h,c,u=lt(e[7].value)+"",f,m;return{c(){t=v("div"),l=v("span"),n=L(),o=v("span"),a=O(s),h=L(),c=v("span"),f=O(u),m=L(),i(l,"class","dot svelte-4y3y1j"),Se(l,"background",e[7].color),i(o,"class","legend-label svelte-4y3y1j"),i(c,"class","legend-value svelte-4y3y1j"),i(t,"class","legend-item svelte-4y3y1j")},m(d,g){A(d,t,g),r(t,l),r(t,n),r(t,o),r(o,a),r(t,h),r(t,c),r(c,f),r(t,m)},p(d,g){g&1&&Se(l,"background",d[7].color),g&1&&s!==(s=d[7].label+"")&&U(a,s),g&1&&u!==(u=lt(d[7].value)+"")&&U(f,u)},d(d){d&&R(t)}}}function Jl(e){let t;function l(s,a){return s[1]>0?Zl:Ql}let n=l(e),o=n(e);return{c(){t=v("div"),o.c(),i(t,"class","breakdown svelte-4y3y1j")},m(s,a){A(s,t,a),o.m(t,null)},p(s,[a]){n===(n=l(s))&&o?o.p(s,a):(o.d(1),o=n(s),o&&(o.c(),o.m(t,null)))},i:fe,o:fe,d(s){s&&R(t),o.d()}}}function lt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function $l(e,t,l){let n,o,{input:s=0}=t,{output:a=0}=t,{cacheRead:h=0}=t,{cacheWrite:c=0}=t,{thinking:u=0}=t;return e.$$set=f=>{"input"in f&&l(2,s=f.input),"output"in f&&l(3,a=f.output),"cacheRead"in f&&l(4,h=f.cacheRead),"cacheWrite"in f&&l(5,c=f.cacheWrite),"thinking"in f&&l(6,u=f.thinking)},e.$$.update=()=>{e.$$.dirty&124&&l(1,n=s+a+h+c+u),e.$$.dirty&124&&l(0,o=[{label:"Input",value:s,color:"var(--chart-input)"},{label:"Output",value:a,color:"var(--chart-output)"},{label:"Cache R",value:h,color:"var(--chart-cache-read)"},{label:"Cache W",value:c,color:"var(--chart-cache-write)"},{label:"Think",value:u,color:"var(--chart-thinking)"}].filter(f=>f.value>0))},[o,n,s,a,h,c,u]}class xl extends Ye{constructor(t){super(),Ke(this,t,$l,Jl,Ge,{input:2,output:3,cacheRead:4,cacheWrite:5,thinking:6})}}const It=[{code:"USD",label:"USD"},{code:"CNY",label:"CNY"}];function jl(e,t,l){return t==="USD"?e:l!=null&&l.rate&&Number.isFinite(l.rate)?e*l.rate:null}function kt(e,t,l,n,o=!1){const s=jl(e,t,n);return s===null?"--":Rl(s,t,l,o)}function Rl(e,t,l,n=!1){const o=n&&Math.abs(e)>=1e3?"compact":"standard",s=e>=100||o==="compact"?0:e>=1?2:e>0?3:0;return new Intl.NumberFormat(l,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",notation:o,minimumFractionDigits:s,maximumFractionDigits:s}).format(e)}function Ot(e,t,l){const n=e.slice();return n[33]=t[l],n}function gt(e){const t=e.slice(),l=t[0][t[6]];t[36]=l;const n=t[21]();t[37]=n;const o=t[23](t[6]);t[38]=o;const s=t[22](t[6]);return t[39]=s,t}function Ht(e,t,l){const n=e.slice();return n[40]=t[l],n}function Ut(e,t,l){const n=e.slice();return n[40]=t[l],n[44]=l,n}function Wt(e){let t,l,n,o,s,a=nl(e[40])+"",h,c;return{c(){t=Y("line"),s=Y("text"),h=O(a),i(t,"x1",pe),i(t,"y1",l=e[15](e[40])),i(t,"x2",n=pe+e[9]),i(t,"y2",o=e[15](e[40])),i(t,"stroke","var(--border)"),i(t,"stroke-width","0.5"),i(t,"stroke-dasharray",e[44]===0?"none":"2,2"),i(s,"x",pe-7),i(s,"y",c=e[15](e[40])+3),i(s,"text-anchor","end"),i(s,"class","y-label svelte-15p89al")},m(u,f){A(u,t,f),A(u,s,f),r(s,h)},p(u,f){f[0]&2048&&l!==(l=u[15](u[40]))&&i(t,"y1",l),f[0]&512&&n!==(n=pe+u[9])&&i(t,"x2",n),f[0]&2048&&o!==(o=u[15](u[40]))&&i(t,"y2",o),f[0]&2048&&a!==(a=nl(u[40])+"")&&U(h,a),f[0]&2048&&c!==(c=u[15](u[40])+3)&&i(s,"y",c)},d(u){u&&(R(t),R(s))}}}function zt(e){let t,l=te(e[10]),n=[];for(let o=0;o<l.length;o+=1)n[o]=Vt(Ht(e,l,o));return{c(){for(let o=0;o<n.length;o+=1)n[o].c();t=ve()},m(o,s){for(let a=0;a<n.length;a+=1)n[a]&&n[a].m(o,s);A(o,t,s)},p(o,s){if(s[0]&198144){l=te(o[10]);let a;for(a=0;a<l.length;a+=1){const h=Ht(o,l,a);n[a]?n[a].p(h,s):(n[a]=Vt(h),n[a].c(),n[a].m(t.parentNode,t))}for(;a<n.length;a+=1)n[a].d(1);n.length=l.length}},d(o){o&&R(t),ke(n,o)}}}function Vt(e){let t,l=e[17](e[40])+"",n,o,s;return{c(){t=Y("text"),n=O(l),i(t,"x",o=pe+e[9]+7),i(t,"y",s=e[16](e[40])+3),i(t,"text-anchor","start"),i(t,"class","y-label y-label-cost svelte-15p89al")},m(a,h){A(a,t,h),r(t,n)},p(a,h){h[0]&1024&&l!==(l=a[17](a[40])+"")&&U(n,l),h[0]&512&&o!==(o=pe+a[9]+7)&&i(t,"x",o),h[0]&1024&&s!==(s=a[16](a[40])+3)&&i(t,"y",s)},d(a){a&&R(t)}}}function Gt(e){let t;return{c(){t=Y("path"),i(t,"d",e[12]),i(t,"fill","url(#areaGrad)"),i(t,"clip-path","url(#chartClip)"),i(t,"class","area svelte-15p89al")},m(l,n){A(l,t,n)},p(l,n){n[0]&4096&&i(t,"d",l[12])},d(l){l&&R(t)}}}function Kt(e){let t;return{c(){t=Y("path"),i(t,"d",e[13]),i(t,"fill","none"),i(t,"stroke","var(--chart-cache-read)"),i(t,"stroke-width","1.3"),i(t,"stroke-linecap","round"),i(t,"stroke-linejoin","round"),i(t,"clip-path","url(#chartClip)"),i(t,"class","line cost-line svelte-15p89al")},m(l,n){A(l,t,n)},p(l,n){n[0]&8192&&i(t,"d",l[13])},d(l){l&&R(t)}}}function Yt(e){let t;return{c(){t=Y("path"),i(t,"d",e[4]),i(t,"fill","none"),i(t,"stroke","var(--accent)"),i(t,"stroke-width","1.8"),i(t,"stroke-linecap","round"),i(t,"stroke-linejoin","round"),i(t,"clip-path","url(#chartClip)"),i(t,"class","line svelte-15p89al")},m(l,n){A(l,t,n)},p(l,n){n[0]&16&&i(t,"d",l[4])},d(l){l&&R(t)}}}function Xt(e){let t,l,n,o;return{c(){t=Y("line"),i(t,"x1",l=e[14](e[6])),i(t,"y1",be),i(t,"x2",n=e[14](e[6])),i(t,"y2",o=be+e[2]),i(t,"stroke","var(--text-muted)"),i(t,"stroke-width","0.5"),i(t,"stroke-dasharray","2,2")},m(s,a){A(s,t,a)},p(s,a){a[0]&64&&l!==(l=s[14](s[6]))&&i(t,"x1",l),a[0]&64&&n!==(n=s[14](s[6]))&&i(t,"x2",n),a[0]&4&&o!==(o=be+s[2])&&i(t,"y2",o)},d(s){s&&R(t)}}}function Qt(e){let t,l,n,o,s=e[1]&&Zt(e);return{c(){t=Y("circle"),s&&s.c(),o=ve(),i(t,"cx",l=e[14](e[6])),i(t,"cy",n=e[15](e[3][e[6]])),i(t,"r","4"),i(t,"fill","var(--bg)"),i(t,"stroke","var(--accent)"),i(t,"stroke-width","2")},m(a,h){A(a,t,h),s&&s.m(a,h),A(a,o,h)},p(a,h){h[0]&64&&l!==(l=a[14](a[6]))&&i(t,"cx",l),h[0]&72&&n!==(n=a[15](a[3][a[6]]))&&i(t,"cy",n),a[1]?s?s.p(a,h):(s=Zt(a),s.c(),s.m(o.parentNode,o)):s&&(s.d(1),s=null)},d(a){a&&(R(t),R(o)),s&&s.d(a)}}}function Zt(e){let t,l,n;return{c(){t=Y("circle"),i(t,"cx",l=e[14](e[6])),i(t,"cy",n=e[16](e[5][e[6]])),i(t,"r","3"),i(t,"fill","var(--bg)"),i(t,"stroke","var(--chart-cache-read)"),i(t,"stroke-width","1.5")},m(o,s){A(o,t,s)},p(o,s){s[0]&64&&l!==(l=o[14](o[6]))&&i(t,"cx",l),s[0]&96&&n!==(n=o[16](o[5][o[6]]))&&i(t,"cy",n)},d(o){o&&R(t)}}}function Jt(e){let t,l,n,o=e[18](e[36].date)+"",s,a,h=ll(e[36].tokens)+"",c,u,f,m=e[1]&&e[36].cost>0&&$t(e);return{c(){t=Y("foreignObject"),l=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n=document.createElementNS("http://www.w3.org/1999/xhtml","span"),s=O(o),a=document.createElementNS("http://www.w3.org/1999/xhtml","span"),c=O(h),m&&m.c(),i(n,"class","tooltip-date svelte-15p89al"),i(a,"class","tooltip-metric token-dot svelte-15p89al"),i(l,"class","tooltip svelte-15p89al"),i(l,"xmlns","http://www.w3.org/1999/xhtml"),z(l,"pointer-left",e[24](e[6])==="left"),z(l,"pointer-right",e[24](e[6])==="right"),i(t,"x",u=e[38]),i(t,"y",f=e[39]),i(t,"width",e[37]),i(t,"height","28"),i(t,"class","tooltip-fo svelte-15p89al")},m(d,g){A(d,t,g),r(t,l),r(l,n),r(n,s),r(l,a),r(a,c),m&&m.m(l,null)},p(d,g){g[0]&65&&o!==(o=d[18](d[36].date)+"")&&U(s,o),g[0]&65&&h!==(h=ll(d[36].tokens)+"")&&U(c,h),d[1]&&d[36].cost>0?m?m.p(d,g):(m=$t(d),m.c(),m.m(l,null)):m&&(m.d(1),m=null),g[0]&16777280&&z(l,"pointer-left",d[24](d[6])==="left"),g[0]&16777280&&z(l,"pointer-right",d[24](d[6])==="right"),g[0]&64&&u!==(u=d[38])&&i(t,"x",u),g[0]&64&&f!==(f=d[39])&&i(t,"y",f)},d(d){d&&R(t),m&&m.d()}}}function $t(e){let t,l=e[20](e[36].cost)+"",n;return{c(){t=document.createElementNS("http://www.w3.org/1999/xhtml","span"),n=O(l),i(t,"class","tooltip-metric cost-dot svelte-15p89al")},m(o,s){A(o,t,s),r(t,n)},p(o,s){s[0]&65&&l!==(l=o[20](o[36].cost)+"")&&U(n,l)},d(o){o&&R(t)}}}function xt(e){let t,l=e[19](e[0][e[33]].date)+"",n,o;return{c(){t=Y("text"),n=O(l),i(t,"x",o=e[14](e[33])),i(t,"y",nt-2),i(t,"text-anchor","middle"),i(t,"class","tick-label svelte-15p89al")},m(s,a){A(s,t,a),r(t,n)},p(s,a){a[0]&257&&l!==(l=s[19](s[0][s[33]].date)+"")&&U(n,l),a[0]&256&&o!==(o=s[14](s[33]))&&i(t,"x",o)},d(s){s&&R(t)}}}function el(e){let t,l=e[0][e[33]]&&xt(e);return{c(){l&&l.c(),t=ve()},m(n,o){l&&l.m(n,o),A(n,t,o)},p(n,o){n[0][n[33]]?l?l.p(n,o):(l=xt(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},d(n){n&&R(t),l&&l.d(n)}}}function en(e){let t,l,n,o,s,a,h,c,u,f,m,d,g,y,I,V,X,C,G=te(e[11]),P=[];for(let _=0;_<G.length;_+=1)P[_]=Wt(Ut(e,G,_));let F=e[1]&&zt(e),B=e[12]&&Gt(e),N=e[13]&&Kt(e),E=e[4]&&Yt(e),T=e[6]!==null&&Xt(e),D=e[6]!==null&&Qt(e),K=e[6]!==null&&e[0][e[6]]&&Jt(gt(e)),J=te(e[8]),H=[];for(let _=0;_<J.length;_+=1)H[_]=el(Ot(e,J,_));return{c(){t=v("div"),l=Y("svg"),n=Y("defs"),o=Y("linearGradient"),s=Y("stop"),a=Y("stop"),h=Y("clipPath"),c=Y("rect");for(let _=0;_<P.length;_+=1)P[_].c();u=ve(),F&&F.c(),f=ve(),B&&B.c(),m=ve(),N&&N.c(),d=ve(),E&&E.c(),g=ve(),T&&T.c(),y=ve(),D&&D.c(),I=ve(),K&&K.c(),V=ve();for(let _=0;_<H.length;_+=1)H[_].c();i(s,"offset","0%"),i(s,"stop-color","var(--accent)"),i(s,"stop-opacity","0.2"),i(a,"offset","100%"),i(a,"stop-color","var(--accent)"),i(a,"stop-opacity","0.02"),i(o,"id","areaGrad"),i(o,"x1","0"),i(o,"y1","0"),i(o,"x2","0"),i(o,"y2","1"),i(c,"x",pe),i(c,"y",be),i(c,"width",e[9]),i(c,"height",e[2]),i(h,"id","chartClip"),i(l,"viewBox","0 0 "+wt+" "+nt),i(l,"width","100%"),i(l,"height",nt),i(l,"class","chart-svg svelte-15p89al"),i(l,"role","img"),i(l,"aria-label","Token usage trend chart"),z(l,"mounted",e[7]),i(t,"class","chart-wrapper svelte-15p89al")},m(_,j){A(_,t,j),r(t,l),r(l,n),r(n,o),r(o,s),r(o,a),r(n,h),r(h,c);for(let w=0;w<P.length;w+=1)P[w]&&P[w].m(l,null);r(l,u),F&&F.m(l,null),r(l,f),B&&B.m(l,null),r(l,m),N&&N.m(l,null),r(l,d),E&&E.m(l,null),r(l,g),T&&T.m(l,null),r(l,y),D&&D.m(l,null),r(l,I),K&&K.m(l,null),r(l,V);for(let w=0;w<H.length;w+=1)H[w]&&H[w].m(l,null);X||(C=[de(l,"mousemove",e[25]),de(l,"mouseleave",e[26])],X=!0)},p(_,j){if(j[0]&512&&i(c,"width",_[9]),j[0]&4&&i(c,"height",_[2]),j[0]&35328){G=te(_[11]);let w;for(w=0;w<G.length;w+=1){const W=Ut(_,G,w);P[w]?P[w].p(W,j):(P[w]=Wt(W),P[w].c(),P[w].m(l,u))}for(;w<P.length;w+=1)P[w].d(1);P.length=G.length}if(_[1]?F?F.p(_,j):(F=zt(_),F.c(),F.m(l,f)):F&&(F.d(1),F=null),_[12]?B?B.p(_,j):(B=Gt(_),B.c(),B.m(l,m)):B&&(B.d(1),B=null),_[13]?N?N.p(_,j):(N=Kt(_),N.c(),N.m(l,d)):N&&(N.d(1),N=null),_[4]?E?E.p(_,j):(E=Yt(_),E.c(),E.m(l,g)):E&&(E.d(1),E=null),_[6]!==null?T?T.p(_,j):(T=Xt(_),T.c(),T.m(l,y)):T&&(T.d(1),T=null),_[6]!==null?D?D.p(_,j):(D=Qt(_),D.c(),D.m(l,I)):D&&(D.d(1),D=null),_[6]!==null&&_[0][_[6]]?K?K.p(gt(_),j):(K=Jt(gt(_)),K.c(),K.m(l,V)):K&&(K.d(1),K=null),j[0]&540929){J=te(_[8]);let w;for(w=0;w<J.length;w+=1){const W=Ot(_,J,w);H[w]?H[w].p(W,j):(H[w]=el(W),H[w].c(),H[w].m(l,null))}for(;w<H.length;w+=1)H[w].d(1);H.length=J.length}j[0]&128&&z(l,"mounted",_[7])},i:fe,o:fe,d(_){_&&R(t),ke(P,_),F&&F.d(),B&&B.d(),N&&N.d(),E&&E.d(),T&&T.d(),D&&D.d(),K&&K.d(),ke(H,_),X=!1,De(C)}}}const wt=352,nt=126,be=14,tn=18,pe=34,ln=36;function tl(e){if(e<=0)return 1;const t=Math.pow(10,Math.floor(Math.log10(e))),l=e/t;return(l<=1?1:l<=2?2:l<=5?5:10)*t}function ll(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function nl(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e5?`${Math.round(e/1e3)}K`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function il(e){return new Date(e+"T00:00:00")}function nn(e,t,l){let n,o,s,a,h,c,u,f,m,d,g,y,{data:I=[]}=t,{showCost:V=!1}=t,{locale:X="en"}=t,{currency:C="USD"}=t,{exchangeRate:G=null}=t,P=null,F=!1;Ml(()=>{requestAnimationFrame(()=>{l(7,F=!0)})});function B(S){return pe+S/Math.max(I.length-1,1)*h}function N(S){return be+c-S/s*c}function E(S){return be+c-S/a*c}function T(S,le){if(S.length<2)return"";const k=S.length,M=S.map((q,ee)=>B(ee)),$=S.map(q=>le(q));if(k===2)return`M${M[0]},${$[0]}L${M[1]},${$[1]}`;const Q=[],x=[];for(let q=0;q<k-1;q++)Q.push(($[q+1]-$[q])/(M[q+1]-M[q]));x.push(Q[0]);for(let q=1;q<k-1;q++)Q[q-1]*Q[q]<=0?x.push(0):x.push((Q[q-1]+Q[q])/2);x.push(Q[k-2]);for(let q=0;q<k-1;q++)if(Math.abs(Q[q])<1e-12)x[q]=0,x[q+1]=0;else{const ee=x[q]/Q[q],ge=x[q+1]/Q[q],ye=ee*ee+ge*ge;if(ye>9){const Te=3/Math.sqrt(ye);x[q]=Te*ee*Q[q],x[q+1]=Te*ge*Q[q]}}let ce=`M${M[0].toFixed(1)},${$[0].toFixed(1)}`;for(let q=0;q<k-1;q++){const ee=(M[q+1]-M[q])/3,ge=M[q]+ee,ye=$[q]+x[q]*ee,Te=M[q+1]-ee,Je=$[q+1]-x[q+1]*ee;ce+=`C${ge.toFixed(1)},${ye.toFixed(1)},${Te.toFixed(1)},${Je.toFixed(1)},${M[q+1].toFixed(1)},${$[q+1].toFixed(1)}`}return ce}function D(S){return Rl(S,C,X,!0)}function K(S){const le=il(S);return new Intl.DateTimeFormat(X,{month:X==="zh"?"numeric":"short",day:"numeric"}).format(le)}function J(S){const le=il(S);return new Intl.DateTimeFormat(X,{month:"numeric",day:"numeric"}).format(le)}function H(S){return kt(S,C,X,G)}function _(){return V?156:116}function j(S){const le=N(n[S]??0)-30;return Math.min(Math.max(le,4),be+c-28)}function w(S){const k=_(),M=B(S),$=W(S)==="right"?M-k-8:M+8;return Math.min(Math.max($,pe),pe+h-k)}function W(S){return B(S)>pe+h/2?"right":"left"}function me(S){const k=S.currentTarget.getBoundingClientRect(),M=(S.clientX-k.left)/k.width*wt;let $=1/0,Q=0;for(let x=0;x<I.length;x++){const ce=Math.abs(B(x)-M);ce<$&&($=ce,Q=x)}l(6,P=Q)}function we(){l(6,P=null)}return e.$$set=S=>{"data"in S&&l(0,I=S.data),"showCost"in S&&l(1,V=S.showCost),"locale"in S&&l(27,X=S.locale),"currency"in S&&l(28,C=S.currency),"exchangeRate"in S&&l(29,G=S.exchangeRate)},e.$$.update=()=>{e.$$.dirty[0]&1&&l(3,n=I.map(S=>S.tokens)),e.$$.dirty[0]&805306369&&l(5,o=I.map(S=>jl(S.cost,C,G)??0)),e.$$.dirty[0]&8&&l(31,s=tl(Math.max(...n,1))),e.$$.dirty[0]&32&&l(30,a=tl(Math.max(...o,1))),e.$$.dirty[0]&8&&l(4,u=T(n,N)),e.$$.dirty[0]&34&&l(13,f=V?T(o,E):""),e.$$.dirty[0]&28&&l(12,m=u?`${u}L${B(n.length-1).toFixed(1)},${(be+c).toFixed(1)}L${B(0).toFixed(1)},${(be+c).toFixed(1)}Z`:""),e.$$.dirty[1]&1&&l(11,d=[0,s/2,s]),e.$$.dirty[0]&1073741824&&l(10,g=[0,a/2,a]),e.$$.dirty[0]&1&&l(8,y=I.length<=5?I.map((S,le)=>le):[0,Math.floor(I.length*.25),Math.floor(I.length*.5),Math.floor(I.length*.75),I.length-1])},l(9,h=wt-pe-ln),l(2,c=nt-be-tn),[I,V,c,n,u,o,P,F,y,h,g,d,m,f,B,N,E,D,K,J,H,_,j,w,W,me,we,X,C,G,a,s]}class on extends Ye{constructor(t){super(),Ke(this,t,nn,en,Ge,{data:0,showCost:1,locale:27,currency:28,exchangeRate:29},null,[-1,-1])}}const sn={today:"Today",lastNDays:e=>`Last ${e} days`,tokenBreakdown:"Token breakdown",tokenBreakdownToday:"Token breakdown (Today)",trend:"Trend",topModel:"Top Model",topTool:"Top Tool",sessions:"Sessions",settings:"Settings",theme:"Theme",timeRange:"Time range",refreshInterval:"Refresh interval",display:"Display",currency:"Currency",exchangeRate:"Exchange rate",exchangeRateUpdated:e=>`Updated ${e}`,exchangeRateUnavailable:"Exchange rate unavailable",language:"Language",showCost:"Show cost",tokenBreakdownToggle:"Token breakdown",activityChart:"Activity chart",syncedAt:e=>`Synced ${e}`,themeSystem:"System",themeLight:"Light",themeDark:"Dark",showPanel:"Show Panel",openDashboard:"Open Dashboard",refresh:"Refresh",quit:"Quit",close:"Close",installTitle:"Dashboard Setup",installPreparing:"Preparing...",installInstalling:"Installing @juliantanx/aiusage...",installLaunching:"Starting dashboard...",installDone:"Done! Opening...",installFailed:"Installation failed"},an={today:"今日",lastNDays:e=>`近 ${e} 天`,tokenBreakdown:"Token 分布",tokenBreakdownToday:"Token 分布 (今日)",trend:"趋势",topModel:"常用模型",topTool:"常用工具",sessions:"会话数",settings:"设置",theme:"主题",timeRange:"时间范围",refreshInterval:"刷新间隔",display:"显示",currency:"币种",exchangeRate:"汇率",exchangeRateUpdated:e=>`更新于 ${e}`,exchangeRateUnavailable:"汇率不可用",language:"语言",showCost:"显示费用",tokenBreakdownToggle:"Token 分布",activityChart:"活动图表",syncedAt:e=>`同步于 ${e}`,themeSystem:"跟随系统",themeLight:"浅色",themeDark:"深色",showPanel:"显示面板",openDashboard:"打开仪表盘",refresh:"刷新",quit:"退出",close:"关闭",installTitle:"仪表盘配置",installPreparing:"准备中...",installInstalling:"正在安装 @juliantanx/aiusage...",installLaunching:"正在启动仪表盘...",installDone:"完成!正在打开...",installFailed:"安装失败"},ol={en:sn,zh:an};function Fl(e){return ol[e]??ol.en}function sl(e,t,l){const n=e.slice();return n[22]=t[l],n}function al(e,t,l){const n=e.slice();return n[25]=t[l],n}function rl(e,t,l){const n=e.slice();return n[28]=t[l],n}function fl(e,t,l){const n=e.slice();return n[31]=t[l],n}function cl(e,t,l){const n=e.slice();return n[34]=t[l],n}function ul(e){let t,l,n;function o(){return e[14](e[34])}return{c(){t=v("button"),t.textContent=`${e[34].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].locale===e[34].value)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&2050&&z(t,"active",e[1].locale===e[34].value)},d(s){s&&R(t),l=!1,n()}}}function hl(e){let t,l,n;function o(){return e[15](e[31])}return{c(){t=v("button"),t.textContent=`${e[31].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].currency===e[31].code)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&2&&z(t,"active",e[1].currency===e[31].code)},d(s){s&&R(t),l=!1,n()}}}function dl(e){var d;let t,l,n=e[2].exchangeRate+"",o,s,a,h,c=e[7](),u,f=c&&rn(e),m=((d=e[0])==null?void 0:d.error)&&gl(e);return{c(){var g;t=v("div"),l=v("span"),o=O(n),s=L(),a=v("strong"),a.textContent=`${e[6]()}`,h=L(),f&&f.c(),u=L(),m&&m.c(),i(a,"class","svelte-198qnem"),i(t,"class","rate-info svelte-198qnem"),z(t,"error",!((g=e[0])!=null&&g.rate))},m(g,y){A(g,t,y),r(t,l),r(l,o),r(t,s),r(t,a),r(t,h),f&&f.m(t,null),r(t,u),m&&m.m(t,null)},p(g,y){var I,V;y[0]&4&&n!==(n=g[2].exchangeRate+"")&&U(o,n),c&&f.p(g,y),(I=g[0])!=null&&I.error?m?m.p(g,y):(m=gl(g),m.c(),m.m(t,null)):m&&(m.d(1),m=null),y[0]&1&&z(t,"error",!((V=g[0])!=null&&V.rate))},d(g){g&&R(t),f&&f.d(),m&&m.d()}}}function rn(e){let t;return{c(){t=v("small"),t.textContent=`${e[7]()}`,i(t,"class","svelte-198qnem")},m(l,n){A(l,t,n)},p:fe,d(l){l&&R(t)}}}function gl(e){let t,l=e[0].error+"",n;return{c(){t=v("small"),n=O(l),i(t,"class","svelte-198qnem")},m(o,s){A(o,t,s),r(t,n)},p(o,s){s[0]&1&&l!==(l=o[0].error+"")&&U(n,l)},d(o){o&&R(t)}}}function _l(e){let t,l=e[28].label+"",n,o,s,a;function h(){return e[16](e[28])}return{c(){t=v("button"),n=O(l),o=L(),i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].theme===e[28].value)},m(c,u){A(c,t,u),r(t,n),r(t,o),s||(a=de(t,"click",h),s=!0)},p(c,u){e=c,u[0]&8&&l!==(l=e[28].label+"")&&U(n,l),u[0]&10&&z(t,"active",e[1].theme===e[28].value)},d(c){c&&R(t),s=!1,a()}}}function ml(e){let t,l,n;function o(){return e[17](e[25])}return{c(){t=v("button"),t.textContent=`${e[25].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].rangeDays===e[25].value)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&1026&&z(t,"active",e[1].rangeDays===e[25].value)},d(s){s&&R(t),l=!1,n()}}}function pl(e){let t,l,n;function o(){return e[18](e[22])}return{c(){t=v("button"),t.textContent=`${e[22].label} `,i(t,"class","option-btn svelte-198qnem"),z(t,"active",e[1].refreshIntervalSec===e[22].value)},m(s,a){A(s,t,a),l||(n=de(t,"click",o),l=!0)},p(s,a){e=s,a[0]&514&&z(t,"active",e[1].refreshIntervalSec===e[22].value)},d(s){s&&R(t),l=!1,n()}}}function fn(e){let t,l,n,o=e[2].settings+"",s,a,h,c,u,f,m=e[2].language+"",d,g,y,I,V,X,C=e[2].currency+"",G,P,F,B,N,E,T,D=e[2].theme+"",K,J,H,_,j,w,W=e[2].timeRange+"",me,we,S,le,k,M,$=e[2].refreshInterval+"",Q,x,ce,q,ee,ge,ye=e[2].display+"",Te,Je,Ce,Ae,it,$e=e[2].showCost+"",ot,Tt,qe,Ct,Pe,st,xe=e[2].tokenBreakdownToggle+"",at,St,je,Mt,Be,rt,et=e[2].activityChart+"",ft,Lt,Re,ct,Dt,Ne=te(e[11]),ie=[];for(let b=0;b<Ne.length;b+=1)ie[b]=ul(cl(e,Ne,b));let Ie=te(It),oe=[];for(let b=0;b<Ie.length;b+=1)oe[b]=hl(fl(e,Ie,b));let ue=e[1].currency==="CNY"&&dl(e),Oe=te(e[3]),se=[];for(let b=0;b<Oe.length;b+=1)se[b]=_l(rl(e,Oe,b));let He=te(e[10]),ae=[];for(let b=0;b<He.length;b+=1)ae[b]=ml(al(e,He,b));let Ue=te(e[9]),re=[];for(let b=0;b<Ue.length;b+=1)re[b]=pl(sl(e,Ue,b));return{c(){t=v("div"),l=v("div"),n=v("span"),s=O(o),a=L(),h=v("button"),h.innerHTML='<svg width="11" height="11" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M2 2l8 8M10 2l-8 8"></path></svg>',c=L(),u=v("div"),f=v("div"),d=O(m),g=L(),y=v("div");for(let b=0;b<ie.length;b+=1)ie[b].c();I=L(),V=v("div"),X=v("div"),G=O(C),P=L(),F=v("div");for(let b=0;b<oe.length;b+=1)oe[b].c();B=L(),ue&&ue.c(),N=L(),E=v("div"),T=v("div"),K=O(D),J=L(),H=v("div");for(let b=0;b<se.length;b+=1)se[b].c();_=L(),j=v("div"),w=v("div"),me=O(W),we=L(),S=v("div");for(let b=0;b<ae.length;b+=1)ae[b].c();le=L(),k=v("div"),M=v("div"),Q=O($),x=L(),ce=v("div");for(let b=0;b<re.length;b+=1)re[b].c();q=L(),ee=v("div"),ge=v("div"),Te=O(ye),Je=L(),Ce=v("div"),Ae=v("label"),it=v("span"),ot=O($e),Tt=L(),qe=v("button"),qe.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',Ct=L(),Pe=v("label"),st=v("span"),at=O(xe),St=L(),je=v("button"),je.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',Mt=L(),Be=v("label"),rt=v("span"),ft=O(et),Lt=L(),Re=v("button"),Re.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',i(n,"class","settings-title svelte-198qnem"),i(h,"class","back-btn svelte-198qnem"),i(l,"class","settings-header svelte-198qnem"),i(f,"class","section-label svelte-198qnem"),i(y,"class","button-group svelte-198qnem"),i(u,"class","section svelte-198qnem"),i(X,"class","section-label svelte-198qnem"),i(F,"class","button-group svelte-198qnem"),i(V,"class","section svelte-198qnem"),i(T,"class","section-label svelte-198qnem"),i(H,"class","button-group svelte-198qnem"),i(E,"class","section svelte-198qnem"),i(w,"class","section-label svelte-198qnem"),i(S,"class","button-group svelte-198qnem"),i(j,"class","section svelte-198qnem"),i(M,"class","section-label svelte-198qnem"),i(ce,"class","button-group svelte-198qnem"),i(k,"class","section svelte-198qnem"),i(ge,"class","section-label svelte-198qnem"),i(qe,"class","toggle svelte-198qnem"),z(qe,"on",e[1].showCost),i(Ae,"class","toggle-row svelte-198qnem"),i(je,"class","toggle svelte-198qnem"),z(je,"on",e[1].showTokenBreakdown),i(Pe,"class","toggle-row svelte-198qnem"),i(Re,"class","toggle svelte-198qnem"),z(Re,"on",e[1].showHeatmap),i(Be,"class","toggle-row svelte-198qnem"),i(Ce,"class","toggles svelte-198qnem"),i(ee,"class","section svelte-198qnem"),i(t,"class","settings svelte-198qnem")},m(b,Z){A(b,t,Z),r(t,l),r(l,n),r(n,s),r(l,a),r(l,h),r(t,c),r(t,u),r(u,f),r(f,d),r(u,g),r(u,y);for(let p=0;p<ie.length;p+=1)ie[p]&&ie[p].m(y,null);r(t,I),r(t,V),r(V,X),r(X,G),r(V,P),r(V,F);for(let p=0;p<oe.length;p+=1)oe[p]&&oe[p].m(F,null);r(V,B),ue&&ue.m(V,null),r(t,N),r(t,E),r(E,T),r(T,K),r(E,J),r(E,H);for(let p=0;p<se.length;p+=1)se[p]&&se[p].m(H,null);r(t,_),r(t,j),r(j,w),r(w,me),r(j,we),r(j,S);for(let p=0;p<ae.length;p+=1)ae[p]&&ae[p].m(S,null);r(t,le),r(t,k),r(k,M),r(M,Q),r(k,x),r(k,ce);for(let p=0;p<re.length;p+=1)re[p]&&re[p].m(ce,null);r(t,q),r(t,ee),r(ee,ge),r(ge,Te),r(ee,Je),r(ee,Ce),r(Ce,Ae),r(Ae,it),r(it,ot),r(Ae,Tt),r(Ae,qe),r(Ce,Ct),r(Ce,Pe),r(Pe,st),r(st,at),r(Pe,St),r(Pe,je),r(Ce,Mt),r(Ce,Be),r(Be,rt),r(rt,ft),r(Be,Lt),r(Be,Re),ct||(Dt=[de(h,"click",e[13]),de(qe,"click",e[19]),de(je,"click",e[20]),de(Re,"click",e[21])],ct=!0)},p(b,Z){if(Z[0]&4&&o!==(o=b[2].settings+"")&&U(s,o),Z[0]&4&&m!==(m=b[2].language+"")&&U(d,m),Z[0]&2082){Ne=te(b[11]);let p;for(p=0;p<Ne.length;p+=1){const he=cl(b,Ne,p);ie[p]?ie[p].p(he,Z):(ie[p]=ul(he),ie[p].c(),ie[p].m(y,null))}for(;p<ie.length;p+=1)ie[p].d(1);ie.length=Ne.length}if(Z[0]&4&&C!==(C=b[2].currency+"")&&U(G,C),Z[0]&34){Ie=te(It);let p;for(p=0;p<Ie.length;p+=1){const he=fl(b,Ie,p);oe[p]?oe[p].p(he,Z):(oe[p]=hl(he),oe[p].c(),oe[p].m(F,null))}for(;p<oe.length;p+=1)oe[p].d(1);oe.length=Ie.length}if(b[1].currency==="CNY"?ue?ue.p(b,Z):(ue=dl(b),ue.c(),ue.m(V,null)):ue&&(ue.d(1),ue=null),Z[0]&4&&D!==(D=b[2].theme+"")&&U(K,D),Z[0]&42){Oe=te(b[3]);let p;for(p=0;p<Oe.length;p+=1){const he=rl(b,Oe,p);se[p]?se[p].p(he,Z):(se[p]=_l(he),se[p].c(),se[p].m(H,null))}for(;p<se.length;p+=1)se[p].d(1);se.length=Oe.length}if(Z[0]&4&&W!==(W=b[2].timeRange+"")&&U(me,W),Z[0]&1058){He=te(b[10]);let p;for(p=0;p<He.length;p+=1){const he=al(b,He,p);ae[p]?ae[p].p(he,Z):(ae[p]=ml(he),ae[p].c(),ae[p].m(S,null))}for(;p<ae.length;p+=1)ae[p].d(1);ae.length=He.length}if(Z[0]&4&&$!==($=b[2].refreshInterval+"")&&U(Q,$),Z[0]&546){Ue=te(b[9]);let p;for(p=0;p<Ue.length;p+=1){const he=sl(b,Ue,p);re[p]?re[p].p(he,Z):(re[p]=pl(he),re[p].c(),re[p].m(ce,null))}for(;p<re.length;p+=1)re[p].d(1);re.length=Ue.length}Z[0]&4&&ye!==(ye=b[2].display+"")&&U(Te,ye),Z[0]&4&&$e!==($e=b[2].showCost+"")&&U(ot,$e),Z[0]&2&&z(qe,"on",b[1].showCost),Z[0]&4&&xe!==(xe=b[2].tokenBreakdownToggle+"")&&U(at,xe),Z[0]&2&&z(je,"on",b[1].showTokenBreakdown),Z[0]&4&&et!==(et=b[2].activityChart+"")&&U(ft,et),Z[0]&2&&z(Re,"on",b[1].showHeatmap)},i:fe,o:fe,d(b){b&&R(t),ke(ie,b),ke(oe,b),ue&&ue.d(),ke(se,b),ke(ae,b),ke(re,b),ct=!1,De(Dt)}}}function cn(e,t,l){let n,o,{settings:s}=t,{exchangeRate:a=null}=t;const h=Ol();let c={...s};function u(){h("save",c)}function f(){return a!=null&&a.rate?`1 USD = ${a.rate.toFixed(4)} CNY`:n.exchangeRateUnavailable}function m(){if(!(a!=null&&a.fetchedAt))return"";const T=new Date(a.fetchedAt),D=String(T.getHours()).padStart(2,"0"),K=String(T.getMinutes()).padStart(2,"0");return n.exchangeRateUpdated(`${D}:${K}`)}function d(T){typeof c[T]=="boolean"&&(l(1,c={...c,[T]:!c[T]}),u())}const g=[{label:"30s",value:30},{label:"1m",value:60},{label:"5m",value:300},{label:"10m",value:600}],y=[{label:"7d",value:7},{label:"14d",value:14},{label:"30d",value:30},{label:"60d",value:60},{label:"90d",value:90}],I=[{label:"English",value:"en"},{label:"中文",value:"zh"}],V=()=>h("close"),X=T=>{l(1,c={...c,locale:T.value}),u()},C=T=>{l(1,c={...c,currency:T.code}),u()},G=T=>{l(1,c={...c,theme:T.value}),u()},P=T=>{l(1,c={...c,rangeDays:T.value}),u()},F=T=>{l(1,c={...c,refreshIntervalSec:T.value}),u()},B=()=>d("showCost"),N=()=>d("showTokenBreakdown"),E=()=>d("showHeatmap");return e.$$set=T=>{"settings"in T&&l(12,s=T.settings),"exchangeRate"in T&&l(0,a=T.exchangeRate)},e.$$.update=()=>{e.$$.dirty[0]&2&&l(2,n=Fl(c.locale??"en")),e.$$.dirty[0]&4&&l(3,o=[{label:n.themeSystem,value:"system"},{label:n.themeLight,value:"light"},{label:n.themeDark,value:"dark"}])},[a,c,n,o,h,u,f,m,d,g,y,I,s,V,X,C,G,P,F,B,N,E]}class un extends Ye{constructor(t){super(),Ke(this,t,cn,fn,Ge,{settings:12,exchangeRate:0},null,[-1,-1])}}function vl(e){let t,l,n,o,s,a=e[4].installTitle+"",h,c,u,f,m,d=e[10]&&bl(e);return{c(){t=v("div"),l=v("div"),n=v("div"),o=L(),s=v("div"),h=O(a),c=L(),u=v("div"),f=O(e[11]),m=L(),d&&d.c(),i(n,"class","install-spinner svelte-1sj3khb"),z(n,"hidden",e[3]==="done"||e[3]==="failed"),i(s,"class","install-title svelte-1sj3khb"),i(u,"class","install-message svelte-1sj3khb"),i(l,"class","install-content svelte-1sj3khb"),i(t,"class","install-overlay svelte-1sj3khb"),z(t,"failed",e[3]==="failed"),z(t,"done",e[3]==="done")},m(g,y){A(g,t,y),r(t,l),r(l,n),r(l,o),r(l,s),r(s,h),r(l,c),r(l,u),r(u,f),r(l,m),d&&d.m(l,null)},p(g,y){y[0]&8&&z(n,"hidden",g[3]==="done"||g[3]==="failed"),y[0]&16&&a!==(a=g[4].installTitle+"")&&U(h,a),y[0]&2048&&U(f,g[11]),g[10]?d?d.p(g,y):(d=bl(g),d.c(),d.m(l,null)):d&&(d.d(1),d=null),y[0]&8&&z(t,"failed",g[3]==="failed"),y[0]&8&&z(t,"done",g[3]==="done")},d(g){g&&R(t),d&&d.d()}}}function bl(e){let t,l;return{c(){t=v("div"),l=O(e[10]),i(t,"class","install-error svelte-1sj3khb")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o[0]&1024&&U(l,n[10])},d(n){n&&R(t)}}}function hn(e){var me,we,S,le;let t,l,n,o,s,a=e[4].today+"",h,c,u,f,m,d,g,y,I,V,X,C,G,P,F,B,N,E,T,D,K,J,H,_=((me=e[1])==null?void 0:me.showCost)&&kl(e),j=((we=e[1])==null?void 0:we.showCost)&&wl(e),w=((S=e[1])==null?void 0:S.showTokenBreakdown)&&e[0]&&yl(e),W=((le=e[1])==null?void 0:le.showHeatmap)&&e[0]&&Tl(e);return E=new dt({props:{label:e[4].topModel,value:e[17],sub:e[16]}}),D=new dt({props:{label:e[4].topTool,value:e[15],sub:e[14]}}),J=new dt({props:{label:e[4].sessions,value:e[13]}}),{c(){t=v("div"),l=v("div"),n=v("div"),o=v("div"),s=v("span"),h=O(a),c=L(),u=v("span"),f=O(e[22]),m=L(),_&&_.c(),d=L(),g=v("div"),y=v("span"),I=O(e[18]),V=L(),X=v("span"),C=O(e[21]),G=L(),j&&j.c(),P=L(),w&&w.c(),F=L(),W&&W.c(),B=L(),N=v("div"),Ee(E.$$.fragment),T=L(),Ee(D.$$.fragment),K=L(),Ee(J.$$.fragment),i(s,"class","metric-label svelte-1sj3khb"),i(u,"class","metric-value svelte-1sj3khb"),i(o,"class","metric svelte-1sj3khb"),i(y,"class","metric-label svelte-1sj3khb"),i(X,"class","metric-value svelte-1sj3khb"),i(g,"class","metric svelte-1sj3khb"),i(n,"class","metric-grid svelte-1sj3khb"),i(l,"class","section svelte-1sj3khb"),i(N,"class","section details svelte-1sj3khb"),i(t,"class","content svelte-1sj3khb")},m(k,M){A(k,t,M),r(t,l),r(l,n),r(n,o),r(o,s),r(s,h),r(o,c),r(o,u),r(u,f),r(o,m),_&&_.m(o,null),r(n,d),r(n,g),r(g,y),r(y,I),r(g,V),r(g,X),r(X,C),r(g,G),j&&j.m(g,null),r(t,P),w&&w.m(t,null),r(t,F),W&&W.m(t,null),r(t,B),r(t,N),Me(E,N,null),r(N,T),Me(D,N,null),r(N,K),Me(J,N,null),H=!0},p(k,M){var ce,q,ee,ge;(!H||M[0]&16)&&a!==(a=k[4].today+"")&&U(h,a),(!H||M[0]&4194304)&&U(f,k[22]),(ce=k[1])!=null&&ce.showCost?_?_.p(k,M):(_=kl(k),_.c(),_.m(o,null)):_&&(_.d(1),_=null),(!H||M[0]&262144)&&U(I,k[18]),(!H||M[0]&2097152)&&U(C,k[21]),(q=k[1])!=null&&q.showCost?j?j.p(k,M):(j=wl(k),j.c(),j.m(g,null)):j&&(j.d(1),j=null),(ee=k[1])!=null&&ee.showTokenBreakdown&&k[0]?w?(w.p(k,M),M[0]&3&&ne(w,1)):(w=yl(k),w.c(),ne(w,1),w.m(t,F)):w&&(vt(),_e(w,1,1,()=>{w=null}),bt()),(ge=k[1])!=null&&ge.showHeatmap&&k[0]?W?(W.p(k,M),M[0]&3&&ne(W,1)):(W=Tl(k),W.c(),ne(W,1),W.m(t,B)):W&&(vt(),_e(W,1,1,()=>{W=null}),bt());const $={};M[0]&16&&($.label=k[4].topModel),M[0]&131072&&($.value=k[17]),M[0]&65536&&($.sub=k[16]),E.$set($);const Q={};M[0]&16&&(Q.label=k[4].topTool),M[0]&32768&&(Q.value=k[15]),M[0]&16384&&(Q.sub=k[14]),D.$set(Q);const x={};M[0]&16&&(x.label=k[4].sessions),M[0]&8192&&(x.value=k[13]),J.$set(x)},i(k){H||(ne(w),ne(W),ne(E.$$.fragment,k),ne(D.$$.fragment,k),ne(J.$$.fragment,k),H=!0)},o(k){_e(w),_e(W),_e(E.$$.fragment,k),_e(D.$$.fragment,k),_e(J.$$.fragment,k),H=!1},d(k){k&&R(t),_&&_.d(),j&&j.d(),w&&w.d(),W&&W.d(),Le(E),Le(D),Le(J)}}}function dn(e){let t,l;return t=new un({props:{settings:e[1],exchangeRate:e[2]}}),t.$on("save",e[24]),t.$on("close",e[26]),{c(){Ee(t.$$.fragment)},m(n,o){Me(t,n,o),l=!0},p(n,o){const s={};o[0]&2&&(s.settings=n[1]),o[0]&4&&(s.exchangeRate=n[2]),t.$set(s)},i(n){l||(ne(t.$$.fragment,n),l=!0)},o(n){_e(t.$$.fragment,n),l=!1},d(n){Le(t,n)}}}function kl(e){let t,l;return{c(){t=v("span"),l=O(e[20]),i(t,"class","metric-cost svelte-1sj3khb")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o[0]&1048576&&U(l,n[20])},d(n){n&&R(t)}}}function wl(e){let t,l;return{c(){t=v("span"),l=O(e[19]),i(t,"class","metric-cost svelte-1sj3khb")},m(n,o){A(n,t,o),r(t,l)},p(n,o){o[0]&524288&&U(l,n[19])},d(n){n&&R(t)}}}function yl(e){let t,l,n=e[4].tokenBreakdownToday+"",o,s,a,h;return a=new xl({props:{input:e[0].todayTokens.input,output:e[0].todayTokens.output,cacheRead:e[0].todayTokens.cacheRead,cacheWrite:e[0].todayTokens.cacheWrite,thinking:e[0].todayTokens.thinking}}),{c(){t=v("div"),l=v("div"),o=O(n),s=L(),Ee(a.$$.fragment),i(l,"class","section-title svelte-1sj3khb"),i(t,"class","section svelte-1sj3khb")},m(c,u){A(c,t,u),r(t,l),r(l,o),r(t,s),Me(a,t,null),h=!0},p(c,u){(!h||u[0]&16)&&n!==(n=c[4].tokenBreakdownToday+"")&&U(o,n);const f={};u[0]&1&&(f.input=c[0].todayTokens.input),u[0]&1&&(f.output=c[0].todayTokens.output),u[0]&1&&(f.cacheRead=c[0].todayTokens.cacheRead),u[0]&1&&(f.cacheWrite=c[0].todayTokens.cacheWrite),u[0]&1&&(f.thinking=c[0].todayTokens.thinking),a.$set(f)},i(c){h||(ne(a.$$.fragment,c),h=!0)},o(c){_e(a.$$.fragment,c),h=!1},d(c){c&&R(t),Le(a)}}}function Tl(e){var c;let t,l,n=e[4].trend+"",o,s,a,h;return a=new on({props:{data:e[0].dailyHistory,showCost:((c=e[1])==null?void 0:c.showCost)??!1,locale:e[5],currency:e[6],exchangeRate:e[2]}}),{c(){t=v("div"),l=v("div"),o=O(n),s=L(),Ee(a.$$.fragment),i(l,"class","section-title svelte-1sj3khb"),i(t,"class","section svelte-1sj3khb")},m(u,f){A(u,t,f),r(t,l),r(l,o),r(t,s),Me(a,t,null),h=!0},p(u,f){var d;(!h||f[0]&16)&&n!==(n=u[4].trend+"")&&U(o,n);const m={};f[0]&1&&(m.data=u[0].dailyHistory),f[0]&2&&(m.showCost=((d=u[1])==null?void 0:d.showCost)??!1),f[0]&32&&(m.locale=u[5]),f[0]&64&&(m.currency=u[6]),f[0]&4&&(m.exchangeRate=u[2]),a.$set(m)},i(u){h||(ne(a.$$.fragment,u),h=!0)},o(u){_e(a.$$.fragment,u),h=!1},d(u){u&&R(t),Le(a)}}}function gn(e){let t,l,n,o,s,a,h,c=e[3]&&vl(e);n=new Kl({props:{onRefresh:e[23],onClose:pn,onToggleSettings:e[25],refreshLabel:e[4].refresh,settingsLabel:e[4].settings,closeLabel:e[4].close,statusText:e[12]}});const u=[dn,hn],f=[];function m(d,g){return d[8]&&d[1]?0:1}return s=m(e),a=f[s]=u[s](e),{c(){t=v("div"),c&&c.c(),l=L(),Ee(n.$$.fragment),o=L(),a.c(),i(t,"class","panel svelte-1sj3khb"),z(t,"loading",e[7])},m(d,g){A(d,t,g),c&&c.m(t,null),r(t,l),Me(n,t,null),r(t,o),f[s].m(t,null),e[27](t),h=!0},p(d,g){d[3]?c?c.p(d,g):(c=vl(d),c.c(),c.m(t,l)):c&&(c.d(1),c=null);const y={};g[0]&256&&(y.onToggleSettings=d[25]),g[0]&16&&(y.refreshLabel=d[4].refresh),g[0]&16&&(y.settingsLabel=d[4].settings),g[0]&16&&(y.closeLabel=d[4].close),g[0]&4096&&(y.statusText=d[12]),n.$set(y);let I=s;s=m(d),s===I?f[s].p(d,g):(vt(),_e(f[I],1,1,()=>{f[I]=null}),bt(),a=f[s],a?a.p(d,g):(a=f[s]=u[s](d),a.c()),ne(a,1),a.m(t,null)),(!h||g[0]&128)&&z(t,"loading",d[7])},i(d){h||(ne(n.$$.fragment,d),ne(a),h=!0)},o(d){_e(n.$$.fragment,d),_e(a),h=!1},d(d){d&&R(t),c&&c.d(),Le(n),f[s].d(),e[27](null)}}}function _n(){return typeof navigator<"u"&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function Cl(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function mn(e){return e.replace(/^(claude-|gpt-|gemini-|deepseek-|qwen-)/i,"").replace(/-\d{8}$/,"")}function pn(){window.widget.hideWindow()}function vn(e,t,l){let n,o,s,a,h,c,u,f,m,d,g,y,I,V,X,C=null,G=null,P=null,F=_n(),B=!0,N=!1,E,T=0,D=null,K=null;function J(k){return o.lastNDays(k)}function H(k){const M=new Date(k),$=String(M.getHours()).padStart(2,"0"),Q=String(M.getMinutes()).padStart(2,"0");return o.syncedAt(`${$}:${Q}`)}async function _(){l(7,B=!0),l(0,C=await window.widget.getData()),l(7,B=!1)}async function j(){l(1,G=await window.widget.getSettings())}async function w(){l(2,P=await window.widget.getExchangeRate())}async function W(k){l(1,G=await window.widget.saveSettings(k.detail)),_()}function me(){if(!E)return;const k=Math.ceil(E.getBoundingClientRect().height);k<=0||Math.abs(k-T)<2||(T=k,window.widget.resizeWindow(k))}Ml(()=>{_(),j(),w(),window.widget.onDataUpdate(M=>{l(0,C=M),l(7,B=!1)}),window.widget.onInstallStatus(M=>{l(3,D=M.phase),l(10,K=M.error??null),(M.phase==="done"||M.phase==="failed")&&setTimeout(()=>{l(3,D=null),l(10,K=null)},3e3)});const k=new ResizeObserver(()=>me());return k.observe(E),Rt().then(me),()=>k.disconnect()}),Il(()=>{Rt().then(me)});const we=()=>{l(8,N=!N)},S=()=>{l(8,N=!1)};function le(k){_t[k?"unshift":"push"](()=>{E=k,l(9,E)})}return e.$$.update=()=>{var k;e.$$.dirty[0]&2&&l(5,n=(G==null?void 0:G.locale)??F),e.$$.dirty[0]&32&&l(4,o=Fl(n)),e.$$.dirty[0]&2&&l(6,s=(G==null?void 0:G.currency)??"USD"),e.$$.dirty[0]&1&&l(22,a=C?Cl(C.todayTokens.total):"--"),e.$$.dirty[0]&1&&l(21,h=C?Cl(C.rangeTokens.total):"--"),e.$$.dirty[0]&101&&l(20,c=C?kt(C.todayCost,s,n,P):"--"),e.$$.dirty[0]&101&&l(19,u=C?kt(C.rangeCost,s,n,P):"--"),e.$$.dirty[0]&17&&l(18,f=C?J(C.rangeDays):o.lastNDays(30)),e.$$.dirty[0]&1&&l(17,m=C!=null&&C.topModel?mn(C.topModel.name):"--"),e.$$.dirty[0]&1&&l(16,d=C!=null&&C.topModel?`${C.topModel.share}%`:""),e.$$.dirty[0]&1&&l(15,g=((k=C==null?void 0:C.topTool)==null?void 0:k.name)??"--"),e.$$.dirty[0]&1&&l(14,y=C!=null&&C.topTool?`${C.topTool.share}%`:""),e.$$.dirty[0]&1&&l(13,I=C?String(C.sessionCountToday):"--"),e.$$.dirty[0]&1&&l(12,V=C?H(C.lastUpdated):""),e.$$.dirty[0]&24&&l(11,X=D==="installing"?o.installInstalling:D==="launching"?o.installLaunching:D==="done"?o.installDone:D==="failed"?o.installFailed:o.installPreparing)},[C,G,P,D,o,n,s,B,N,E,K,X,V,I,y,g,d,m,f,u,c,h,a,_,W,we,S,le]}class bn extends Ye{constructor(t){super(),Ke(this,t,vn,gn,Ge,{},null,[-1,-1])}}new bn({target:document.getElementById("app")});
|
package/dist/renderer/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'" />
|
|
7
7
|
<title>AIUsage Widget</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-BQ2IyMyH.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BHRV-uj7.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Fl=Object.defineProperty;var Al=(e,t,l)=>t in e?Fl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l;var ut=(e,t,l)=>Al(e,typeof t!="symbol"?t+"":t,l);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=l(i);fetch(i.href,s)}})();function fe(){}function Tl(e){return e()}function Rt(){return Object.create(null)}function qe(e){e.forEach(Tl)}function Xe(e){return typeof e=="function"}function Ge(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function El(e){return Object.keys(e).length===0}function r(e,t){e.appendChild(t)}function B(e,t,l){e.insertBefore(t,l||null)}function A(e){e.parentNode&&e.parentNode.removeChild(e)}function we(e,t){for(let l=0;l<e.length;l+=1)e[l]&&e[l].d(t)}function m(e){return document.createElement(e)}function G(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function U(e){return document.createTextNode(e)}function q(){return U(" ")}function ve(){return U("")}function ge(e,t,l,n){return e.addEventListener(t,l,n),()=>e.removeEventListener(t,l,n)}function o(e,t,l){l==null?e.removeAttribute(t):e.getAttribute(t)!==l&&e.setAttribute(t,l)}function Bl(e){return Array.from(e.childNodes)}function K(e,t){t=""+t,e.data!==t&&(e.data=t)}function Se(e,t,l,n){l==null?e.style.removeProperty(t):e.style.setProperty(t,l,"")}function X(e,t,l){e.classList.toggle(t,!!l)}function Nl(e,t,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(e,{detail:t,bubbles:l,cancelable:n})}let Ze;function Qe(e){Ze=e}function yt(){if(!Ze)throw new Error("Function called outside component initialization");return Ze}function Cl(e){yt().$$.on_mount.push(e)}function Pl(e){yt().$$.after_update.push(e)}function Ol(){const e=yt();return(t,l,{cancelable:n=!1}={})=>{const i=e.$$.callbacks[t];if(i){const s=Nl(t,l,{cancelable:n});return i.slice().forEach(a=>{a.call(e,s)}),!s.defaultPrevented}return!0}}const ze=[],_t=[];let Ve=[];const Dt=[],Sl=Promise.resolve();let mt=!1;function Ml(){mt||(mt=!0,Sl.then(Ll))}function Ft(){return Ml(),Sl}function pt(e){Ve.push(e)}const ht=new Set;let We=0;function Ll(){if(We!==0)return;const e=Ze;do{try{for(;We<ze.length;){const t=ze[We];We++,Qe(t),Hl(t.$$)}}catch(t){throw ze.length=0,We=0,t}for(Qe(null),ze.length=0,We=0;_t.length;)_t.pop()();for(let t=0;t<Ve.length;t+=1){const l=Ve[t];ht.has(l)||(ht.add(l),l())}Ve.length=0}while(ze.length);for(;Dt.length;)Dt.pop()();mt=!1,ht.clear(),Qe(e)}function Hl(e){if(e.fragment!==null){e.update(),qe(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(pt)}}function Il(e){const t=[],l=[];Ve.forEach(n=>e.indexOf(n)===-1?t.push(n):l.push(n)),l.forEach(n=>n()),Ve=t}const tt=new Set;let Ae;function vt(){Ae={r:0,c:[],p:Ae}}function bt(){Ae.r||qe(Ae.c),Ae=Ae.p}function oe(e,t){e&&e.i&&(tt.delete(e),e.i(t))}function me(e,t,l,n){if(e&&e.o){if(tt.has(e))return;tt.add(e),Ae.c.push(()=>{tt.delete(e),n&&(l&&e.d(1),n())}),e.o(t)}else n&&n()}function le(e){return(e==null?void 0:e.length)!==void 0?e:Array.from(e)}function Ee(e){e&&e.c()}function Me(e,t,l){const{fragment:n,after_update:i}=e.$$;n&&n.m(t,l),pt(()=>{const s=e.$$.on_mount.map(Tl).filter(Xe);e.$$.on_destroy?e.$$.on_destroy.push(...s):qe(s),e.$$.on_mount=[]}),i.forEach(pt)}function Le(e,t){const l=e.$$;l.fragment!==null&&(Il(l.after_update),qe(l.on_destroy),l.fragment&&l.fragment.d(t),l.on_destroy=l.fragment=null,l.ctx=[])}function Ul(e,t){e.$$.dirty[0]===-1&&(ze.push(e),Ml(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Ke(e,t,l,n,i,s,a=null,h=[-1]){const f=Ze;Qe(e);const u=e.$$={fragment:null,ctx:[],props:s,update:fe,not_equal:i,bound:Rt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(f?f.$$.context:[])),callbacks:Rt(),dirty:h,skip_bound:!1,root:t.target||f.$$.root};a&&a(u.root);let c=!1;if(u.ctx=l?l(e,t.props||{},(d,b,...k)=>{const R=k.length?k[0]:b;return u.ctx&&i(u.ctx[d],u.ctx[d]=R)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](R),c&&Ul(e,d)),b}):[],u.update(),c=!0,qe(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const d=Bl(t.target);u.fragment&&u.fragment.l(d),d.forEach(A)}else u.fragment&&u.fragment.c();t.intro&&oe(e.$$.fragment),Me(e,t.target,t.anchor),Ll()}Qe(f)}class Ye{constructor(){ut(this,"$$");ut(this,"$$set")}$destroy(){Le(this,1),this.$destroy=fe}$on(t,l){if(!Xe(l))return fe;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!El(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const jl="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(jl);function At(e){let t,l;return{c(){t=m("span"),l=U(e[6]),o(t,"class","status svelte-1c4hcx6")},m(n,i){B(n,t,i),r(t,l)},p(n,i){i&64&&K(l,n[6])},d(n){n&&A(t)}}}function Wl(e){let t,l,n,i,s,a,h,f,u,c,d,b,k,R,I,W,w,z,Y,O,L,E,F,P,T,D,V,J,H,g=e[6]&&At(e);return{c(){t=m("div"),l=m("div"),n=G("svg"),i=G("rect"),s=G("rect"),a=G("rect"),h=G("rect"),f=q(),u=m("span"),u.textContent="AIUsage",c=q(),g&&g.c(),d=q(),b=m("div"),k=m("button"),R=G("svg"),I=G("path"),W=G("path"),w=G("path"),z=G("path"),Y=q(),O=m("button"),L=G("svg"),E=G("circle"),F=G("path"),P=q(),T=m("button"),D=G("svg"),V=G("path"),o(i,"width","64"),o(i,"height","64"),o(i,"rx","14"),o(i,"fill","oklch(0.55 0.12 175)"),o(s,"x","10"),o(s,"y","38"),o(s,"width","12"),o(s,"height","16"),o(s,"rx","3"),o(s,"fill","white"),o(a,"x","26"),o(a,"y","26"),o(a,"width","12"),o(a,"height","28"),o(a,"rx","3"),o(a,"fill","white"),o(h,"x","42"),o(h,"y","14"),o(h,"width","12"),o(h,"height","40"),o(h,"rx","3"),o(h,"fill","white"),o(n,"xmlns","http://www.w3.org/2000/svg"),o(n,"width","14"),o(n,"height","14"),o(n,"viewBox","0 0 64 64"),Se(n,"display","block"),Se(n,"border-radius","3px"),o(u,"class","logo svelte-1c4hcx6"),o(l,"class","brand svelte-1c4hcx6"),o(I,"d","M2.5 8a5.5 5.5 0 0 1 9.36-3.93"),o(W,"d","M13.5 8a5.5 5.5 0 0 1-9.36 3.93"),o(w,"d","M12 1.5v3h-3"),o(z,"d","M4 11.5v3h3"),o(R,"width","13"),o(R,"height","13"),o(R,"viewBox","0 0 16 16"),o(R,"fill","none"),o(R,"stroke","currentColor"),o(R,"stroke-width","1.8"),o(R,"stroke-linecap","round"),o(k,"class","icon-btn svelte-1c4hcx6"),o(k,"title",e[3]),o(k,"aria-label",e[3]),o(E,"cx","12"),o(E,"cy","12"),o(E,"r","3"),o(F,"d","M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"),o(L,"width","13"),o(L,"height","13"),o(L,"viewBox","0 0 24 24"),o(L,"fill","none"),o(L,"stroke","currentColor"),o(L,"stroke-width","2"),o(L,"stroke-linecap","round"),o(L,"stroke-linejoin","round"),o(O,"class","icon-btn svelte-1c4hcx6"),o(O,"title",e[4]),o(O,"aria-label",e[4]),o(V,"d","M2 2l8 8M10 2l-8 8"),o(D,"width","11"),o(D,"height","11"),o(D,"viewBox","0 0 12 12"),o(D,"fill","none"),o(D,"stroke","currentColor"),o(D,"stroke-width","1.8"),o(D,"stroke-linecap","round"),o(T,"class","icon-btn svelte-1c4hcx6"),o(T,"title",e[5]),o(T,"aria-label",e[5]),o(b,"class","actions svelte-1c4hcx6"),o(t,"class","header svelte-1c4hcx6")},m(S,v){B(S,t,v),r(t,l),r(l,n),r(n,i),r(n,s),r(n,a),r(n,h),r(l,f),r(l,u),r(l,c),g&&g.m(l,null),r(t,d),r(t,b),r(b,k),r(k,R),r(R,I),r(R,W),r(R,w),r(R,z),r(b,Y),r(b,O),r(O,L),r(L,E),r(L,F),r(b,P),r(b,T),r(T,D),r(D,V),J||(H=[ge(k,"click",function(){Xe(e[0])&&e[0].apply(this,arguments)}),ge(O,"click",function(){Xe(e[2])&&e[2].apply(this,arguments)}),ge(T,"click",function(){Xe(e[1])&&e[1].apply(this,arguments)})],J=!0)},p(S,[v]){e=S,e[6]?g?g.p(e,v):(g=At(e),g.c(),g.m(l,null)):g&&(g.d(1),g=null),v&8&&o(k,"title",e[3]),v&8&&o(k,"aria-label",e[3]),v&16&&o(O,"title",e[4]),v&16&&o(O,"aria-label",e[4]),v&32&&o(T,"title",e[5]),v&32&&o(T,"aria-label",e[5])},i:fe,o:fe,d(S){S&&A(t),g&&g.d(),J=!1,qe(H)}}}function zl(e,t,l){let{onRefresh:n}=t,{onClose:i}=t,{onToggleSettings:s}=t,{refreshLabel:a}=t,{settingsLabel:h}=t,{closeLabel:f}=t,{statusText:u=""}=t;return e.$$set=c=>{"onRefresh"in c&&l(0,n=c.onRefresh),"onClose"in c&&l(1,i=c.onClose),"onToggleSettings"in c&&l(2,s=c.onToggleSettings),"refreshLabel"in c&&l(3,a=c.refreshLabel),"settingsLabel"in c&&l(4,h=c.settingsLabel),"closeLabel"in c&&l(5,f=c.closeLabel),"statusText"in c&&l(6,u=c.statusText)},[n,i,s,a,h,f,u]}class Vl extends Ye{constructor(t){super(),Ke(this,t,zl,Wl,Ge,{onRefresh:0,onClose:1,onToggleSettings:2,refreshLabel:3,settingsLabel:4,closeLabel:5,statusText:6})}}function Et(e){let t,l;return{c(){t=m("span"),l=U(e[2]),o(t,"class","sub svelte-36ktuv")},m(n,i){B(n,t,i),r(t,l)},p(n,i){i&4&&K(l,n[2])},d(n){n&&A(t)}}}function Gl(e){let t,l,n,i,s,a,h,f,u=e[2]&&Et(e);return{c(){t=m("div"),l=m("span"),n=U(e[0]),i=q(),s=m("div"),a=m("span"),h=U(e[1]),f=q(),u&&u.c(),o(l,"class","label svelte-36ktuv"),o(a,"class","value svelte-36ktuv"),X(a,"accent",e[3]),o(s,"class","right svelte-36ktuv"),o(t,"class","row svelte-36ktuv")},m(c,d){B(c,t,d),r(t,l),r(l,n),r(t,i),r(t,s),r(s,a),r(a,h),r(s,f),u&&u.m(s,null)},p(c,[d]){d&1&&K(n,c[0]),d&2&&K(h,c[1]),d&8&&X(a,"accent",c[3]),c[2]?u?u.p(c,d):(u=Et(c),u.c(),u.m(s,null)):u&&(u.d(1),u=null)},i:fe,o:fe,d(c){c&&A(t),u&&u.d()}}}function Kl(e,t,l){let{label:n}=t,{value:i}=t,{sub:s=""}=t,{accent:a=!1}=t;return e.$$set=h=>{"label"in h&&l(0,n=h.label),"value"in h&&l(1,i=h.value),"sub"in h&&l(2,s=h.sub),"accent"in h&&l(3,a=h.accent)},[n,i,s,a]}class dt extends Ye{constructor(t){super(),Ke(this,t,Kl,Gl,Ge,{label:0,value:1,sub:2,accent:3})}}function Bt(e,t,l){const n=e.slice();return n[7]=t[l],n}function Nt(e,t,l){const n=e.slice();return n[7]=t[l],n}function Yl(e){let t;return{c(){t=m("div"),t.textContent="No token data",o(t,"class","empty svelte-4y3y1j")},m(l,n){B(l,t,n)},p:fe,d(l){l&&A(t)}}}function Xl(e){let t,l,n,i=le(e[0]),s=[];for(let f=0;f<i.length;f+=1)s[f]=Pt(Nt(e,i,f));let a=le(e[0]),h=[];for(let f=0;f<a.length;f+=1)h[f]=Ot(Bt(e,a,f));return{c(){t=m("div");for(let f=0;f<s.length;f+=1)s[f].c();l=q(),n=m("div");for(let f=0;f<h.length;f+=1)h[f].c();o(t,"class","bar svelte-4y3y1j"),o(n,"class","legend svelte-4y3y1j")},m(f,u){B(f,t,u);for(let c=0;c<s.length;c+=1)s[c]&&s[c].m(t,null);B(f,l,u),B(f,n,u);for(let c=0;c<h.length;c+=1)h[c]&&h[c].m(n,null)},p(f,u){if(u&3){i=le(f[0]);let c;for(c=0;c<i.length;c+=1){const d=Nt(f,i,c);s[c]?s[c].p(d,u):(s[c]=Pt(d),s[c].c(),s[c].m(t,null))}for(;c<s.length;c+=1)s[c].d(1);s.length=i.length}if(u&1){a=le(f[0]);let c;for(c=0;c<a.length;c+=1){const d=Bt(f,a,c);h[c]?h[c].p(d,u):(h[c]=Ot(d),h[c].c(),h[c].m(n,null))}for(;c<h.length;c+=1)h[c].d(1);h.length=a.length}},d(f){f&&(A(t),A(l),A(n)),we(s,f),we(h,f)}}}function Pt(e){let t,l;return{c(){t=m("div"),o(t,"class","segment svelte-4y3y1j"),Se(t,"width",e[7].value/e[1]*100+"%"),Se(t,"background",e[7].color),o(t,"title",l=e[7].label+": "+lt(e[7].value))},m(n,i){B(n,t,i)},p(n,i){i&3&&Se(t,"width",n[7].value/n[1]*100+"%"),i&1&&Se(t,"background",n[7].color),i&1&&l!==(l=n[7].label+": "+lt(n[7].value))&&o(t,"title",l)},d(n){n&&A(t)}}}function Ot(e){let t,l,n,i,s=e[7].label+"",a,h,f,u=lt(e[7].value)+"",c,d;return{c(){t=m("div"),l=m("span"),n=q(),i=m("span"),a=U(s),h=q(),f=m("span"),c=U(u),d=q(),o(l,"class","dot svelte-4y3y1j"),Se(l,"background",e[7].color),o(i,"class","legend-label svelte-4y3y1j"),o(f,"class","legend-value svelte-4y3y1j"),o(t,"class","legend-item svelte-4y3y1j")},m(b,k){B(b,t,k),r(t,l),r(t,n),r(t,i),r(i,a),r(t,h),r(t,f),r(f,c),r(t,d)},p(b,k){k&1&&Se(l,"background",b[7].color),k&1&&s!==(s=b[7].label+"")&&K(a,s),k&1&&u!==(u=lt(b[7].value)+"")&&K(c,u)},d(b){b&&A(t)}}}function Ql(e){let t;function l(s,a){return s[1]>0?Xl:Yl}let n=l(e),i=n(e);return{c(){t=m("div"),i.c(),o(t,"class","breakdown svelte-4y3y1j")},m(s,a){B(s,t,a),i.m(t,null)},p(s,[a]){n===(n=l(s))&&i?i.p(s,a):(i.d(1),i=n(s),i&&(i.c(),i.m(t,null)))},i:fe,o:fe,d(s){s&&A(t),i.d()}}}function lt(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Zl(e,t,l){let n,i,{input:s=0}=t,{output:a=0}=t,{cacheRead:h=0}=t,{cacheWrite:f=0}=t,{thinking:u=0}=t;return e.$$set=c=>{"input"in c&&l(2,s=c.input),"output"in c&&l(3,a=c.output),"cacheRead"in c&&l(4,h=c.cacheRead),"cacheWrite"in c&&l(5,f=c.cacheWrite),"thinking"in c&&l(6,u=c.thinking)},e.$$.update=()=>{e.$$.dirty&124&&l(1,n=s+a+h+f+u),e.$$.dirty&124&&l(0,i=[{label:"Input",value:s,color:"var(--chart-input)"},{label:"Output",value:a,color:"var(--chart-output)"},{label:"Cache R",value:h,color:"var(--chart-cache-read)"},{label:"Cache W",value:f,color:"var(--chart-cache-write)"},{label:"Think",value:u,color:"var(--chart-thinking)"}].filter(c=>c.value>0))},[i,n,s,a,h,f,u]}class Jl extends Ye{constructor(t){super(),Ke(this,t,Zl,Ql,Ge,{input:2,output:3,cacheRead:4,cacheWrite:5,thinking:6})}}const Ht=[{code:"USD",label:"USD"},{code:"CNY",label:"CNY"}];function ql(e,t,l){return t==="USD"?e:l!=null&&l.rate&&Number.isFinite(l.rate)?e*l.rate:null}function kt(e,t,l,n,i=!1){const s=ql(e,t,n);return s===null?"--":Rl(s,t,l,i)}function Rl(e,t,l,n=!1){const i=n&&Math.abs(e)>=1e3?"compact":"standard",s=e>=100||i==="compact"?0:e>=1?2:e>0?3:0;return new Intl.NumberFormat(l,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",notation:i,minimumFractionDigits:s,maximumFractionDigits:s}).format(e)}function It(e,t,l){const n=e.slice();return n[33]=t[l],n}function gt(e){const t=e.slice(),l=t[0][t[6]];t[36]=l;const n=t[21]();t[37]=n;const i=t[23](t[6]);t[38]=i;const s=t[22](t[6]);return t[39]=s,t}function Ut(e,t,l){const n=e.slice();return n[40]=t[l],n}function jt(e,t,l){const n=e.slice();return n[40]=t[l],n[44]=l,n}function Wt(e){let t,l,n,i,s,a=nl(e[40])+"",h,f;return{c(){t=G("line"),s=G("text"),h=U(a),o(t,"x1",pe),o(t,"y1",l=e[15](e[40])),o(t,"x2",n=pe+e[9]),o(t,"y2",i=e[15](e[40])),o(t,"stroke","var(--border)"),o(t,"stroke-width","0.5"),o(t,"stroke-dasharray",e[44]===0?"none":"2,2"),o(s,"x",pe-7),o(s,"y",f=e[15](e[40])+3),o(s,"text-anchor","end"),o(s,"class","y-label svelte-15p89al")},m(u,c){B(u,t,c),B(u,s,c),r(s,h)},p(u,c){c[0]&2048&&l!==(l=u[15](u[40]))&&o(t,"y1",l),c[0]&512&&n!==(n=pe+u[9])&&o(t,"x2",n),c[0]&2048&&i!==(i=u[15](u[40]))&&o(t,"y2",i),c[0]&2048&&a!==(a=nl(u[40])+"")&&K(h,a),c[0]&2048&&f!==(f=u[15](u[40])+3)&&o(s,"y",f)},d(u){u&&(A(t),A(s))}}}function zt(e){let t,l=le(e[10]),n=[];for(let i=0;i<l.length;i+=1)n[i]=Vt(Ut(e,l,i));return{c(){for(let i=0;i<n.length;i+=1)n[i].c();t=ve()},m(i,s){for(let a=0;a<n.length;a+=1)n[a]&&n[a].m(i,s);B(i,t,s)},p(i,s){if(s[0]&198144){l=le(i[10]);let a;for(a=0;a<l.length;a+=1){const h=Ut(i,l,a);n[a]?n[a].p(h,s):(n[a]=Vt(h),n[a].c(),n[a].m(t.parentNode,t))}for(;a<n.length;a+=1)n[a].d(1);n.length=l.length}},d(i){i&&A(t),we(n,i)}}}function Vt(e){let t,l=e[17](e[40])+"",n,i,s;return{c(){t=G("text"),n=U(l),o(t,"x",i=pe+e[9]+7),o(t,"y",s=e[16](e[40])+3),o(t,"text-anchor","start"),o(t,"class","y-label y-label-cost svelte-15p89al")},m(a,h){B(a,t,h),r(t,n)},p(a,h){h[0]&1024&&l!==(l=a[17](a[40])+"")&&K(n,l),h[0]&512&&i!==(i=pe+a[9]+7)&&o(t,"x",i),h[0]&1024&&s!==(s=a[16](a[40])+3)&&o(t,"y",s)},d(a){a&&A(t)}}}function Gt(e){let t;return{c(){t=G("path"),o(t,"d",e[12]),o(t,"fill","url(#areaGrad)"),o(t,"clip-path","url(#chartClip)"),o(t,"class","area svelte-15p89al")},m(l,n){B(l,t,n)},p(l,n){n[0]&4096&&o(t,"d",l[12])},d(l){l&&A(t)}}}function Kt(e){let t;return{c(){t=G("path"),o(t,"d",e[13]),o(t,"fill","none"),o(t,"stroke","var(--chart-cache-read)"),o(t,"stroke-width","1.3"),o(t,"stroke-linecap","round"),o(t,"stroke-linejoin","round"),o(t,"clip-path","url(#chartClip)"),o(t,"class","line cost-line svelte-15p89al")},m(l,n){B(l,t,n)},p(l,n){n[0]&8192&&o(t,"d",l[13])},d(l){l&&A(t)}}}function Yt(e){let t;return{c(){t=G("path"),o(t,"d",e[4]),o(t,"fill","none"),o(t,"stroke","var(--accent)"),o(t,"stroke-width","1.8"),o(t,"stroke-linecap","round"),o(t,"stroke-linejoin","round"),o(t,"clip-path","url(#chartClip)"),o(t,"class","line svelte-15p89al")},m(l,n){B(l,t,n)},p(l,n){n[0]&16&&o(t,"d",l[4])},d(l){l&&A(t)}}}function Xt(e){let t,l,n,i;return{c(){t=G("line"),o(t,"x1",l=e[14](e[6])),o(t,"y1",ke),o(t,"x2",n=e[14](e[6])),o(t,"y2",i=ke+e[2]),o(t,"stroke","var(--text-muted)"),o(t,"stroke-width","0.5"),o(t,"stroke-dasharray","2,2")},m(s,a){B(s,t,a)},p(s,a){a[0]&64&&l!==(l=s[14](s[6]))&&o(t,"x1",l),a[0]&64&&n!==(n=s[14](s[6]))&&o(t,"x2",n),a[0]&4&&i!==(i=ke+s[2])&&o(t,"y2",i)},d(s){s&&A(t)}}}function Qt(e){let t,l,n,i,s=e[1]&&Zt(e);return{c(){t=G("circle"),s&&s.c(),i=ve(),o(t,"cx",l=e[14](e[6])),o(t,"cy",n=e[15](e[3][e[6]])),o(t,"r","4"),o(t,"fill","var(--bg)"),o(t,"stroke","var(--accent)"),o(t,"stroke-width","2")},m(a,h){B(a,t,h),s&&s.m(a,h),B(a,i,h)},p(a,h){h[0]&64&&l!==(l=a[14](a[6]))&&o(t,"cx",l),h[0]&72&&n!==(n=a[15](a[3][a[6]]))&&o(t,"cy",n),a[1]?s?s.p(a,h):(s=Zt(a),s.c(),s.m(i.parentNode,i)):s&&(s.d(1),s=null)},d(a){a&&(A(t),A(i)),s&&s.d(a)}}}function Zt(e){let t,l,n;return{c(){t=G("circle"),o(t,"cx",l=e[14](e[6])),o(t,"cy",n=e[16](e[5][e[6]])),o(t,"r","3"),o(t,"fill","var(--bg)"),o(t,"stroke","var(--chart-cache-read)"),o(t,"stroke-width","1.5")},m(i,s){B(i,t,s)},p(i,s){s[0]&64&&l!==(l=i[14](i[6]))&&o(t,"cx",l),s[0]&96&&n!==(n=i[16](i[5][i[6]]))&&o(t,"cy",n)},d(i){i&&A(t)}}}function Jt(e){let t,l,n,i=e[18](e[36].date)+"",s,a,h=ll(e[36].tokens)+"",f,u,c,d=e[1]&&e[36].cost>0&&$t(e);return{c(){t=G("foreignObject"),l=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n=document.createElementNS("http://www.w3.org/1999/xhtml","span"),s=U(i),a=document.createElementNS("http://www.w3.org/1999/xhtml","span"),f=U(h),d&&d.c(),o(n,"class","tooltip-date svelte-15p89al"),o(a,"class","tooltip-metric token-dot svelte-15p89al"),o(l,"class","tooltip svelte-15p89al"),o(l,"xmlns","http://www.w3.org/1999/xhtml"),X(l,"pointer-left",e[24](e[6])==="left"),X(l,"pointer-right",e[24](e[6])==="right"),o(t,"x",u=e[38]),o(t,"y",c=e[39]),o(t,"width",e[37]),o(t,"height","28"),o(t,"class","tooltip-fo svelte-15p89al")},m(b,k){B(b,t,k),r(t,l),r(l,n),r(n,s),r(l,a),r(a,f),d&&d.m(l,null)},p(b,k){k[0]&65&&i!==(i=b[18](b[36].date)+"")&&K(s,i),k[0]&65&&h!==(h=ll(b[36].tokens)+"")&&K(f,h),b[1]&&b[36].cost>0?d?d.p(b,k):(d=$t(b),d.c(),d.m(l,null)):d&&(d.d(1),d=null),k[0]&16777280&&X(l,"pointer-left",b[24](b[6])==="left"),k[0]&16777280&&X(l,"pointer-right",b[24](b[6])==="right"),k[0]&64&&u!==(u=b[38])&&o(t,"x",u),k[0]&64&&c!==(c=b[39])&&o(t,"y",c)},d(b){b&&A(t),d&&d.d()}}}function $t(e){let t,l=e[20](e[36].cost)+"",n;return{c(){t=document.createElementNS("http://www.w3.org/1999/xhtml","span"),n=U(l),o(t,"class","tooltip-metric cost-dot svelte-15p89al")},m(i,s){B(i,t,s),r(t,n)},p(i,s){s[0]&65&&l!==(l=i[20](i[36].cost)+"")&&K(n,l)},d(i){i&&A(t)}}}function xt(e){let t,l=e[19](e[0][e[33]].date)+"",n,i;return{c(){t=G("text"),n=U(l),o(t,"x",i=e[14](e[33])),o(t,"y",nt-2),o(t,"text-anchor","middle"),o(t,"class","tick-label svelte-15p89al")},m(s,a){B(s,t,a),r(t,n)},p(s,a){a[0]&257&&l!==(l=s[19](s[0][s[33]].date)+"")&&K(n,l),a[0]&256&&i!==(i=s[14](s[33]))&&o(t,"x",i)},d(s){s&&A(t)}}}function el(e){let t,l=e[0][e[33]]&&xt(e);return{c(){l&&l.c(),t=ve()},m(n,i){l&&l.m(n,i),B(n,t,i)},p(n,i){n[0][n[33]]?l?l.p(n,i):(l=xt(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},d(n){n&&A(t),l&&l.d(n)}}}function $l(e){let t,l,n,i,s,a,h,f,u,c,d,b,k,R,I,W,w,z,Y=le(e[11]),O=[];for(let g=0;g<Y.length;g+=1)O[g]=Wt(jt(e,Y,g));let L=e[1]&&zt(e),E=e[12]&&Gt(e),F=e[13]&&Kt(e),P=e[4]&&Yt(e),T=e[6]!==null&&Xt(e),D=e[6]!==null&&Qt(e),V=e[6]!==null&&e[0][e[6]]&&Jt(gt(e)),J=le(e[8]),H=[];for(let g=0;g<J.length;g+=1)H[g]=el(It(e,J,g));return{c(){t=m("div"),l=G("svg"),n=G("defs"),i=G("linearGradient"),s=G("stop"),a=G("stop"),h=G("clipPath"),f=G("rect");for(let g=0;g<O.length;g+=1)O[g].c();u=ve(),L&&L.c(),c=ve(),E&&E.c(),d=ve(),F&&F.c(),b=ve(),P&&P.c(),k=ve(),T&&T.c(),R=ve(),D&&D.c(),I=ve(),V&&V.c(),W=ve();for(let g=0;g<H.length;g+=1)H[g].c();o(s,"offset","0%"),o(s,"stop-color","var(--accent)"),o(s,"stop-opacity","0.2"),o(a,"offset","100%"),o(a,"stop-color","var(--accent)"),o(a,"stop-opacity","0.02"),o(i,"id","areaGrad"),o(i,"x1","0"),o(i,"y1","0"),o(i,"x2","0"),o(i,"y2","1"),o(f,"x",pe),o(f,"y",ke),o(f,"width",e[9]),o(f,"height",e[2]),o(h,"id","chartClip"),o(l,"viewBox","0 0 "+wt+" "+nt),o(l,"width","100%"),o(l,"height",nt),o(l,"class","chart-svg svelte-15p89al"),o(l,"role","img"),o(l,"aria-label","Token usage trend chart"),X(l,"mounted",e[7]),o(t,"class","chart-wrapper svelte-15p89al")},m(g,S){B(g,t,S),r(t,l),r(l,n),r(n,i),r(i,s),r(i,a),r(n,h),r(h,f);for(let v=0;v<O.length;v+=1)O[v]&&O[v].m(l,null);r(l,u),L&&L.m(l,null),r(l,c),E&&E.m(l,null),r(l,d),F&&F.m(l,null),r(l,b),P&&P.m(l,null),r(l,k),T&&T.m(l,null),r(l,R),D&&D.m(l,null),r(l,I),V&&V.m(l,null),r(l,W);for(let v=0;v<H.length;v+=1)H[v]&&H[v].m(l,null);w||(z=[ge(l,"mousemove",e[25]),ge(l,"mouseleave",e[26])],w=!0)},p(g,S){if(S[0]&512&&o(f,"width",g[9]),S[0]&4&&o(f,"height",g[2]),S[0]&35328){Y=le(g[11]);let v;for(v=0;v<Y.length;v+=1){const j=jt(g,Y,v);O[v]?O[v].p(j,S):(O[v]=Wt(j),O[v].c(),O[v].m(l,u))}for(;v<O.length;v+=1)O[v].d(1);O.length=Y.length}if(g[1]?L?L.p(g,S):(L=zt(g),L.c(),L.m(l,c)):L&&(L.d(1),L=null),g[12]?E?E.p(g,S):(E=Gt(g),E.c(),E.m(l,d)):E&&(E.d(1),E=null),g[13]?F?F.p(g,S):(F=Kt(g),F.c(),F.m(l,b)):F&&(F.d(1),F=null),g[4]?P?P.p(g,S):(P=Yt(g),P.c(),P.m(l,k)):P&&(P.d(1),P=null),g[6]!==null?T?T.p(g,S):(T=Xt(g),T.c(),T.m(l,R)):T&&(T.d(1),T=null),g[6]!==null?D?D.p(g,S):(D=Qt(g),D.c(),D.m(l,I)):D&&(D.d(1),D=null),g[6]!==null&&g[0][g[6]]?V?V.p(gt(g),S):(V=Jt(gt(g)),V.c(),V.m(l,W)):V&&(V.d(1),V=null),S[0]&540929){J=le(g[8]);let v;for(v=0;v<J.length;v+=1){const j=It(g,J,v);H[v]?H[v].p(j,S):(H[v]=el(j),H[v].c(),H[v].m(l,null))}for(;v<H.length;v+=1)H[v].d(1);H.length=J.length}S[0]&128&&X(l,"mounted",g[7])},i:fe,o:fe,d(g){g&&A(t),we(O,g),L&&L.d(),E&&E.d(),F&&F.d(),P&&P.d(),T&&T.d(),D&&D.d(),V&&V.d(),we(H,g),w=!1,qe(z)}}}const wt=352,nt=126,ke=14,xl=18,pe=34,en=36;function tl(e){if(e<=0)return 1;const t=Math.pow(10,Math.floor(Math.log10(e))),l=e/t;return(l<=1?1:l<=2?2:l<=5?5:10)*t}function ll(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function nl(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e5?`${Math.round(e/1e3)}K`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function ol(e){return new Date(e+"T00:00:00")}function tn(e,t,l){let n,i,s,a,h,f,u,c,d,b,k,R,{data:I=[]}=t,{showCost:W=!1}=t,{locale:w="en"}=t,{currency:z="USD"}=t,{exchangeRate:Y=null}=t,O=null,L=!1;Cl(()=>{requestAnimationFrame(()=>{l(7,L=!0)})});function E(C){return pe+C/Math.max(I.length-1,1)*h}function F(C){return ke+f-C/s*f}function P(C){return ke+f-C/a*f}function T(C,ne){if(C.length<2)return"";const y=C.length,N=C.map((M,te)=>E(te)),ee=C.map(M=>ne(M));if(y===2)return`M${N[0]},${ee[0]}L${N[1]},${ee[1]}`;const $=[],x=[];for(let M=0;M<y-1;M++)$.push((ee[M+1]-ee[M])/(N[M+1]-N[M]));x.push($[0]);for(let M=1;M<y-1;M++)$[M-1]*$[M]<=0?x.push(0):x.push(($[M-1]+$[M])/2);x.push($[y-2]);for(let M=0;M<y-1;M++)if(Math.abs($[M])<1e-12)x[M]=0,x[M+1]=0;else{const te=x[M]/$[M],_e=x[M+1]/$[M],ye=te*te+_e*_e;if(ye>9){const Te=3/Math.sqrt(ye);x[M]=Te*te*$[M],x[M+1]=Te*_e*$[M]}}let ue=`M${N[0].toFixed(1)},${ee[0].toFixed(1)}`;for(let M=0;M<y-1;M++){const te=(N[M+1]-N[M])/3,_e=N[M]+te,ye=ee[M]+x[M]*te,Te=N[M+1]-te,Je=ee[M+1]-x[M+1]*te;ue+=`C${_e.toFixed(1)},${ye.toFixed(1)},${Te.toFixed(1)},${Je.toFixed(1)},${N[M+1].toFixed(1)},${ee[M+1].toFixed(1)}`}return ue}function D(C){return Rl(C,z,w,!0)}function V(C){const ne=ol(C);return new Intl.DateTimeFormat(w,{month:w==="zh"?"numeric":"short",day:"numeric"}).format(ne)}function J(C){const ne=ol(C);return new Intl.DateTimeFormat(w,{month:"numeric",day:"numeric"}).format(ne)}function H(C){return kt(C,z,w,Y)}function g(){return W?156:116}function S(C){const ne=F(n[C]??0)-30;return Math.min(Math.max(ne,4),ke+f-28)}function v(C){const y=g(),N=E(C),ee=j(C)==="right"?N-y-8:N+8;return Math.min(Math.max(ee,pe),pe+h-y)}function j(C){return E(C)>pe+h/2?"right":"left"}function be(C){const y=C.currentTarget.getBoundingClientRect(),N=(C.clientX-y.left)/y.width*wt;let ee=1/0,$=0;for(let x=0;x<I.length;x++){const ue=Math.abs(E(x)-N);ue<ee&&(ee=ue,$=x)}l(6,O=$)}function Q(){l(6,O=null)}return e.$$set=C=>{"data"in C&&l(0,I=C.data),"showCost"in C&&l(1,W=C.showCost),"locale"in C&&l(27,w=C.locale),"currency"in C&&l(28,z=C.currency),"exchangeRate"in C&&l(29,Y=C.exchangeRate)},e.$$.update=()=>{e.$$.dirty[0]&1&&l(3,n=I.map(C=>C.tokens)),e.$$.dirty[0]&805306369&&l(5,i=I.map(C=>ql(C.cost,z,Y)??0)),e.$$.dirty[0]&8&&l(31,s=tl(Math.max(...n,1))),e.$$.dirty[0]&32&&l(30,a=tl(Math.max(...i,1))),e.$$.dirty[0]&8&&l(4,u=T(n,F)),e.$$.dirty[0]&34&&l(13,c=W?T(i,P):""),e.$$.dirty[0]&28&&l(12,d=u?`${u}L${E(n.length-1).toFixed(1)},${(ke+f).toFixed(1)}L${E(0).toFixed(1)},${(ke+f).toFixed(1)}Z`:""),e.$$.dirty[1]&1&&l(11,b=[0,s/2,s]),e.$$.dirty[0]&1073741824&&l(10,k=[0,a/2,a]),e.$$.dirty[0]&1&&l(8,R=I.length<=5?I.map((C,ne)=>ne):[0,Math.floor(I.length*.25),Math.floor(I.length*.5),Math.floor(I.length*.75),I.length-1])},l(9,h=wt-pe-en),l(2,f=nt-ke-xl),[I,W,f,n,u,i,O,L,R,h,k,b,d,c,E,F,P,D,V,J,H,g,S,v,j,be,Q,w,z,Y,a,s]}class ln extends Ye{constructor(t){super(),Ke(this,t,tn,$l,Ge,{data:0,showCost:1,locale:27,currency:28,exchangeRate:29},null,[-1,-1])}}const nn={today:"Today",lastNDays:e=>`Last ${e} days`,tokenBreakdown:"Token breakdown",tokenBreakdownToday:"Token breakdown (Today)",trend:"Trend",topModel:"Top Model",topTool:"Top Tool",sessions:"Sessions",settings:"Settings",theme:"Theme",timeRange:"Time range",refreshInterval:"Refresh interval",display:"Display",currency:"Currency",exchangeRate:"Exchange rate",exchangeRateUpdated:e=>`Updated ${e}`,exchangeRateUnavailable:"Exchange rate unavailable",language:"Language",showCost:"Show cost",tokenBreakdownToggle:"Token breakdown",activityChart:"Activity chart",syncedAt:e=>`Synced ${e}`,themeSystem:"System",themeLight:"Light",themeDark:"Dark",showPanel:"Show Panel",openDashboard:"Open Dashboard",refresh:"Refresh",quit:"Quit",close:"Close"},on={today:"今日",lastNDays:e=>`近 ${e} 天`,tokenBreakdown:"Token 分布",tokenBreakdownToday:"Token 分布 (今日)",trend:"趋势",topModel:"常用模型",topTool:"常用工具",sessions:"会话数",settings:"设置",theme:"主题",timeRange:"时间范围",refreshInterval:"刷新间隔",display:"显示",currency:"币种",exchangeRate:"汇率",exchangeRateUpdated:e=>`更新于 ${e}`,exchangeRateUnavailable:"汇率不可用",language:"语言",showCost:"显示费用",tokenBreakdownToggle:"Token 分布",activityChart:"活动图表",syncedAt:e=>`同步于 ${e}`,themeSystem:"跟随系统",themeLight:"浅色",themeDark:"深色",showPanel:"显示面板",openDashboard:"打开仪表盘",refresh:"刷新",quit:"退出",close:"关闭"},il={en:nn,zh:on};function Dl(e){return il[e]??il.en}function sl(e,t,l){const n=e.slice();return n[22]=t[l],n}function al(e,t,l){const n=e.slice();return n[25]=t[l],n}function rl(e,t,l){const n=e.slice();return n[28]=t[l],n}function cl(e,t,l){const n=e.slice();return n[31]=t[l],n}function fl(e,t,l){const n=e.slice();return n[34]=t[l],n}function ul(e){let t,l,n;function i(){return e[14](e[34])}return{c(){t=m("button"),t.textContent=`${e[34].label} `,o(t,"class","option-btn svelte-198qnem"),X(t,"active",e[1].locale===e[34].value)},m(s,a){B(s,t,a),l||(n=ge(t,"click",i),l=!0)},p(s,a){e=s,a[0]&2050&&X(t,"active",e[1].locale===e[34].value)},d(s){s&&A(t),l=!1,n()}}}function hl(e){let t,l,n;function i(){return e[15](e[31])}return{c(){t=m("button"),t.textContent=`${e[31].label} `,o(t,"class","option-btn svelte-198qnem"),X(t,"active",e[1].currency===e[31].code)},m(s,a){B(s,t,a),l||(n=ge(t,"click",i),l=!0)},p(s,a){e=s,a[0]&2&&X(t,"active",e[1].currency===e[31].code)},d(s){s&&A(t),l=!1,n()}}}function dl(e){var b;let t,l,n=e[2].exchangeRate+"",i,s,a,h,f=e[7](),u,c=f&&sn(e),d=((b=e[0])==null?void 0:b.error)&&gl(e);return{c(){var k;t=m("div"),l=m("span"),i=U(n),s=q(),a=m("strong"),a.textContent=`${e[6]()}`,h=q(),c&&c.c(),u=q(),d&&d.c(),o(a,"class","svelte-198qnem"),o(t,"class","rate-info svelte-198qnem"),X(t,"error",!((k=e[0])!=null&&k.rate))},m(k,R){B(k,t,R),r(t,l),r(l,i),r(t,s),r(t,a),r(t,h),c&&c.m(t,null),r(t,u),d&&d.m(t,null)},p(k,R){var I,W;R[0]&4&&n!==(n=k[2].exchangeRate+"")&&K(i,n),f&&c.p(k,R),(I=k[0])!=null&&I.error?d?d.p(k,R):(d=gl(k),d.c(),d.m(t,null)):d&&(d.d(1),d=null),R[0]&1&&X(t,"error",!((W=k[0])!=null&&W.rate))},d(k){k&&A(t),c&&c.d(),d&&d.d()}}}function sn(e){let t;return{c(){t=m("small"),t.textContent=`${e[7]()}`,o(t,"class","svelte-198qnem")},m(l,n){B(l,t,n)},p:fe,d(l){l&&A(t)}}}function gl(e){let t,l=e[0].error+"",n;return{c(){t=m("small"),n=U(l),o(t,"class","svelte-198qnem")},m(i,s){B(i,t,s),r(t,n)},p(i,s){s[0]&1&&l!==(l=i[0].error+"")&&K(n,l)},d(i){i&&A(t)}}}function _l(e){let t,l=e[28].label+"",n,i,s,a;function h(){return e[16](e[28])}return{c(){t=m("button"),n=U(l),i=q(),o(t,"class","option-btn svelte-198qnem"),X(t,"active",e[1].theme===e[28].value)},m(f,u){B(f,t,u),r(t,n),r(t,i),s||(a=ge(t,"click",h),s=!0)},p(f,u){e=f,u[0]&8&&l!==(l=e[28].label+"")&&K(n,l),u[0]&10&&X(t,"active",e[1].theme===e[28].value)},d(f){f&&A(t),s=!1,a()}}}function ml(e){let t,l,n;function i(){return e[17](e[25])}return{c(){t=m("button"),t.textContent=`${e[25].label} `,o(t,"class","option-btn svelte-198qnem"),X(t,"active",e[1].rangeDays===e[25].value)},m(s,a){B(s,t,a),l||(n=ge(t,"click",i),l=!0)},p(s,a){e=s,a[0]&1026&&X(t,"active",e[1].rangeDays===e[25].value)},d(s){s&&A(t),l=!1,n()}}}function pl(e){let t,l,n;function i(){return e[18](e[22])}return{c(){t=m("button"),t.textContent=`${e[22].label} `,o(t,"class","option-btn svelte-198qnem"),X(t,"active",e[1].refreshIntervalSec===e[22].value)},m(s,a){B(s,t,a),l||(n=ge(t,"click",i),l=!0)},p(s,a){e=s,a[0]&514&&X(t,"active",e[1].refreshIntervalSec===e[22].value)},d(s){s&&A(t),l=!1,n()}}}function an(e){let t,l,n,i=e[2].settings+"",s,a,h,f,u,c,d=e[2].language+"",b,k,R,I,W,w,z=e[2].currency+"",Y,O,L,E,F,P,T,D=e[2].theme+"",V,J,H,g,S,v,j=e[2].timeRange+"",be,Q,C,ne,y,N,ee=e[2].refreshInterval+"",$,x,ue,M,te,_e,ye=e[2].display+"",Te,Je,Ce,Be,ot,$e=e[2].showCost+"",it,Tt,Re,Ct,Ne,st,xe=e[2].tokenBreakdownToggle+"",at,St,De,Mt,Pe,rt,et=e[2].activityChart+"",ct,Lt,Fe,ft,qt,Oe=le(e[11]),ie=[];for(let p=0;p<Oe.length;p+=1)ie[p]=ul(fl(e,Oe,p));let He=le(Ht),se=[];for(let p=0;p<He.length;p+=1)se[p]=hl(cl(e,He,p));let he=e[1].currency==="CNY"&&dl(e),Ie=le(e[3]),ae=[];for(let p=0;p<Ie.length;p+=1)ae[p]=_l(rl(e,Ie,p));let Ue=le(e[10]),re=[];for(let p=0;p<Ue.length;p+=1)re[p]=ml(al(e,Ue,p));let je=le(e[9]),ce=[];for(let p=0;p<je.length;p+=1)ce[p]=pl(sl(e,je,p));return{c(){t=m("div"),l=m("div"),n=m("span"),s=U(i),a=q(),h=m("button"),h.innerHTML='<svg width="11" height="11" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M2 2l8 8M10 2l-8 8"></path></svg>',f=q(),u=m("div"),c=m("div"),b=U(d),k=q(),R=m("div");for(let p=0;p<ie.length;p+=1)ie[p].c();I=q(),W=m("div"),w=m("div"),Y=U(z),O=q(),L=m("div");for(let p=0;p<se.length;p+=1)se[p].c();E=q(),he&&he.c(),F=q(),P=m("div"),T=m("div"),V=U(D),J=q(),H=m("div");for(let p=0;p<ae.length;p+=1)ae[p].c();g=q(),S=m("div"),v=m("div"),be=U(j),Q=q(),C=m("div");for(let p=0;p<re.length;p+=1)re[p].c();ne=q(),y=m("div"),N=m("div"),$=U(ee),x=q(),ue=m("div");for(let p=0;p<ce.length;p+=1)ce[p].c();M=q(),te=m("div"),_e=m("div"),Te=U(ye),Je=q(),Ce=m("div"),Be=m("label"),ot=m("span"),it=U($e),Tt=q(),Re=m("button"),Re.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',Ct=q(),Ne=m("label"),st=m("span"),at=U(xe),St=q(),De=m("button"),De.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',Mt=q(),Pe=m("label"),rt=m("span"),ct=U(et),Lt=q(),Fe=m("button"),Fe.innerHTML='<span class="toggle-thumb svelte-198qnem"></span>',o(n,"class","settings-title svelte-198qnem"),o(h,"class","back-btn svelte-198qnem"),o(l,"class","settings-header svelte-198qnem"),o(c,"class","section-label svelte-198qnem"),o(R,"class","button-group svelte-198qnem"),o(u,"class","section svelte-198qnem"),o(w,"class","section-label svelte-198qnem"),o(L,"class","button-group svelte-198qnem"),o(W,"class","section svelte-198qnem"),o(T,"class","section-label svelte-198qnem"),o(H,"class","button-group svelte-198qnem"),o(P,"class","section svelte-198qnem"),o(v,"class","section-label svelte-198qnem"),o(C,"class","button-group svelte-198qnem"),o(S,"class","section svelte-198qnem"),o(N,"class","section-label svelte-198qnem"),o(ue,"class","button-group svelte-198qnem"),o(y,"class","section svelte-198qnem"),o(_e,"class","section-label svelte-198qnem"),o(Re,"class","toggle svelte-198qnem"),X(Re,"on",e[1].showCost),o(Be,"class","toggle-row svelte-198qnem"),o(De,"class","toggle svelte-198qnem"),X(De,"on",e[1].showTokenBreakdown),o(Ne,"class","toggle-row svelte-198qnem"),o(Fe,"class","toggle svelte-198qnem"),X(Fe,"on",e[1].showHeatmap),o(Pe,"class","toggle-row svelte-198qnem"),o(Ce,"class","toggles svelte-198qnem"),o(te,"class","section svelte-198qnem"),o(t,"class","settings svelte-198qnem")},m(p,Z){B(p,t,Z),r(t,l),r(l,n),r(n,s),r(l,a),r(l,h),r(t,f),r(t,u),r(u,c),r(c,b),r(u,k),r(u,R);for(let _=0;_<ie.length;_+=1)ie[_]&&ie[_].m(R,null);r(t,I),r(t,W),r(W,w),r(w,Y),r(W,O),r(W,L);for(let _=0;_<se.length;_+=1)se[_]&&se[_].m(L,null);r(W,E),he&&he.m(W,null),r(t,F),r(t,P),r(P,T),r(T,V),r(P,J),r(P,H);for(let _=0;_<ae.length;_+=1)ae[_]&&ae[_].m(H,null);r(t,g),r(t,S),r(S,v),r(v,be),r(S,Q),r(S,C);for(let _=0;_<re.length;_+=1)re[_]&&re[_].m(C,null);r(t,ne),r(t,y),r(y,N),r(N,$),r(y,x),r(y,ue);for(let _=0;_<ce.length;_+=1)ce[_]&&ce[_].m(ue,null);r(t,M),r(t,te),r(te,_e),r(_e,Te),r(te,Je),r(te,Ce),r(Ce,Be),r(Be,ot),r(ot,it),r(Be,Tt),r(Be,Re),r(Ce,Ct),r(Ce,Ne),r(Ne,st),r(st,at),r(Ne,St),r(Ne,De),r(Ce,Mt),r(Ce,Pe),r(Pe,rt),r(rt,ct),r(Pe,Lt),r(Pe,Fe),ft||(qt=[ge(h,"click",e[13]),ge(Re,"click",e[19]),ge(De,"click",e[20]),ge(Fe,"click",e[21])],ft=!0)},p(p,Z){if(Z[0]&4&&i!==(i=p[2].settings+"")&&K(s,i),Z[0]&4&&d!==(d=p[2].language+"")&&K(b,d),Z[0]&2082){Oe=le(p[11]);let _;for(_=0;_<Oe.length;_+=1){const de=fl(p,Oe,_);ie[_]?ie[_].p(de,Z):(ie[_]=ul(de),ie[_].c(),ie[_].m(R,null))}for(;_<ie.length;_+=1)ie[_].d(1);ie.length=Oe.length}if(Z[0]&4&&z!==(z=p[2].currency+"")&&K(Y,z),Z[0]&34){He=le(Ht);let _;for(_=0;_<He.length;_+=1){const de=cl(p,He,_);se[_]?se[_].p(de,Z):(se[_]=hl(de),se[_].c(),se[_].m(L,null))}for(;_<se.length;_+=1)se[_].d(1);se.length=He.length}if(p[1].currency==="CNY"?he?he.p(p,Z):(he=dl(p),he.c(),he.m(W,null)):he&&(he.d(1),he=null),Z[0]&4&&D!==(D=p[2].theme+"")&&K(V,D),Z[0]&42){Ie=le(p[3]);let _;for(_=0;_<Ie.length;_+=1){const de=rl(p,Ie,_);ae[_]?ae[_].p(de,Z):(ae[_]=_l(de),ae[_].c(),ae[_].m(H,null))}for(;_<ae.length;_+=1)ae[_].d(1);ae.length=Ie.length}if(Z[0]&4&&j!==(j=p[2].timeRange+"")&&K(be,j),Z[0]&1058){Ue=le(p[10]);let _;for(_=0;_<Ue.length;_+=1){const de=al(p,Ue,_);re[_]?re[_].p(de,Z):(re[_]=ml(de),re[_].c(),re[_].m(C,null))}for(;_<re.length;_+=1)re[_].d(1);re.length=Ue.length}if(Z[0]&4&&ee!==(ee=p[2].refreshInterval+"")&&K($,ee),Z[0]&546){je=le(p[9]);let _;for(_=0;_<je.length;_+=1){const de=sl(p,je,_);ce[_]?ce[_].p(de,Z):(ce[_]=pl(de),ce[_].c(),ce[_].m(ue,null))}for(;_<ce.length;_+=1)ce[_].d(1);ce.length=je.length}Z[0]&4&&ye!==(ye=p[2].display+"")&&K(Te,ye),Z[0]&4&&$e!==($e=p[2].showCost+"")&&K(it,$e),Z[0]&2&&X(Re,"on",p[1].showCost),Z[0]&4&&xe!==(xe=p[2].tokenBreakdownToggle+"")&&K(at,xe),Z[0]&2&&X(De,"on",p[1].showTokenBreakdown),Z[0]&4&&et!==(et=p[2].activityChart+"")&&K(ct,et),Z[0]&2&&X(Fe,"on",p[1].showHeatmap)},i:fe,o:fe,d(p){p&&A(t),we(ie,p),we(se,p),he&&he.d(),we(ae,p),we(re,p),we(ce,p),ft=!1,qe(qt)}}}function rn(e,t,l){let n,i,{settings:s}=t,{exchangeRate:a=null}=t;const h=Ol();let f={...s};function u(){h("save",f)}function c(){return a!=null&&a.rate?`1 USD = ${a.rate.toFixed(4)} CNY`:n.exchangeRateUnavailable}function d(){if(!(a!=null&&a.fetchedAt))return"";const T=new Date(a.fetchedAt),D=String(T.getHours()).padStart(2,"0"),V=String(T.getMinutes()).padStart(2,"0");return n.exchangeRateUpdated(`${D}:${V}`)}function b(T){typeof f[T]=="boolean"&&(l(1,f={...f,[T]:!f[T]}),u())}const k=[{label:"30s",value:30},{label:"1m",value:60},{label:"5m",value:300},{label:"10m",value:600}],R=[{label:"7d",value:7},{label:"14d",value:14},{label:"30d",value:30},{label:"60d",value:60},{label:"90d",value:90}],I=[{label:"English",value:"en"},{label:"中文",value:"zh"}],W=()=>h("close"),w=T=>{l(1,f={...f,locale:T.value}),u()},z=T=>{l(1,f={...f,currency:T.code}),u()},Y=T=>{l(1,f={...f,theme:T.value}),u()},O=T=>{l(1,f={...f,rangeDays:T.value}),u()},L=T=>{l(1,f={...f,refreshIntervalSec:T.value}),u()},E=()=>b("showCost"),F=()=>b("showTokenBreakdown"),P=()=>b("showHeatmap");return e.$$set=T=>{"settings"in T&&l(12,s=T.settings),"exchangeRate"in T&&l(0,a=T.exchangeRate)},e.$$.update=()=>{e.$$.dirty[0]&2&&l(2,n=Dl(f.locale??"en")),e.$$.dirty[0]&4&&l(3,i=[{label:n.themeSystem,value:"system"},{label:n.themeLight,value:"light"},{label:n.themeDark,value:"dark"}])},[a,f,n,i,h,u,c,d,b,k,R,I,s,W,w,z,Y,O,L,E,F,P]}class cn extends Ye{constructor(t){super(),Ke(this,t,rn,an,Ge,{settings:12,exchangeRate:0},null,[-1,-1])}}function fn(e){var be,Q,C,ne;let t,l,n,i,s,a=e[3].today+"",h,f,u,c,d,b,k,R,I,W,w,z,Y,O,L,E,F,P,T,D,V,J,H,g=((be=e[1])==null?void 0:be.showCost)&&vl(e),S=((Q=e[1])==null?void 0:Q.showCost)&&bl(e),v=((C=e[1])==null?void 0:C.showTokenBreakdown)&&e[0]&&kl(e),j=((ne=e[1])==null?void 0:ne.showHeatmap)&&e[0]&&wl(e);return P=new dt({props:{label:e[3].topModel,value:e[14],sub:e[13]}}),D=new dt({props:{label:e[3].topTool,value:e[12],sub:e[11]}}),J=new dt({props:{label:e[3].sessions,value:e[10]}}),{c(){t=m("div"),l=m("div"),n=m("div"),i=m("div"),s=m("span"),h=U(a),f=q(),u=m("span"),c=U(e[19]),d=q(),g&&g.c(),b=q(),k=m("div"),R=m("span"),I=U(e[15]),W=q(),w=m("span"),z=U(e[18]),Y=q(),S&&S.c(),O=q(),v&&v.c(),L=q(),j&&j.c(),E=q(),F=m("div"),Ee(P.$$.fragment),T=q(),Ee(D.$$.fragment),V=q(),Ee(J.$$.fragment),o(s,"class","metric-label svelte-1d2i7t8"),o(u,"class","metric-value svelte-1d2i7t8"),o(i,"class","metric svelte-1d2i7t8"),o(R,"class","metric-label svelte-1d2i7t8"),o(w,"class","metric-value svelte-1d2i7t8"),o(k,"class","metric svelte-1d2i7t8"),o(n,"class","metric-grid svelte-1d2i7t8"),o(l,"class","section svelte-1d2i7t8"),o(F,"class","section details svelte-1d2i7t8"),o(t,"class","content svelte-1d2i7t8")},m(y,N){B(y,t,N),r(t,l),r(l,n),r(n,i),r(i,s),r(s,h),r(i,f),r(i,u),r(u,c),r(i,d),g&&g.m(i,null),r(n,b),r(n,k),r(k,R),r(R,I),r(k,W),r(k,w),r(w,z),r(k,Y),S&&S.m(k,null),r(t,O),v&&v.m(t,null),r(t,L),j&&j.m(t,null),r(t,E),r(t,F),Me(P,F,null),r(F,T),Me(D,F,null),r(F,V),Me(J,F,null),H=!0},p(y,N){var ue,M,te,_e;(!H||N[0]&8)&&a!==(a=y[3].today+"")&&K(h,a),(!H||N[0]&524288)&&K(c,y[19]),(ue=y[1])!=null&&ue.showCost?g?g.p(y,N):(g=vl(y),g.c(),g.m(i,null)):g&&(g.d(1),g=null),(!H||N[0]&32768)&&K(I,y[15]),(!H||N[0]&262144)&&K(z,y[18]),(M=y[1])!=null&&M.showCost?S?S.p(y,N):(S=bl(y),S.c(),S.m(k,null)):S&&(S.d(1),S=null),(te=y[1])!=null&&te.showTokenBreakdown&&y[0]?v?(v.p(y,N),N[0]&3&&oe(v,1)):(v=kl(y),v.c(),oe(v,1),v.m(t,L)):v&&(vt(),me(v,1,1,()=>{v=null}),bt()),(_e=y[1])!=null&&_e.showHeatmap&&y[0]?j?(j.p(y,N),N[0]&3&&oe(j,1)):(j=wl(y),j.c(),oe(j,1),j.m(t,E)):j&&(vt(),me(j,1,1,()=>{j=null}),bt());const ee={};N[0]&8&&(ee.label=y[3].topModel),N[0]&16384&&(ee.value=y[14]),N[0]&8192&&(ee.sub=y[13]),P.$set(ee);const $={};N[0]&8&&($.label=y[3].topTool),N[0]&4096&&($.value=y[12]),N[0]&2048&&($.sub=y[11]),D.$set($);const x={};N[0]&8&&(x.label=y[3].sessions),N[0]&1024&&(x.value=y[10]),J.$set(x)},i(y){H||(oe(v),oe(j),oe(P.$$.fragment,y),oe(D.$$.fragment,y),oe(J.$$.fragment,y),H=!0)},o(y){me(v),me(j),me(P.$$.fragment,y),me(D.$$.fragment,y),me(J.$$.fragment,y),H=!1},d(y){y&&A(t),g&&g.d(),S&&S.d(),v&&v.d(),j&&j.d(),Le(P),Le(D),Le(J)}}}function un(e){let t,l;return t=new cn({props:{settings:e[1],exchangeRate:e[2]}}),t.$on("save",e[21]),t.$on("close",e[23]),{c(){Ee(t.$$.fragment)},m(n,i){Me(t,n,i),l=!0},p(n,i){const s={};i[0]&2&&(s.settings=n[1]),i[0]&4&&(s.exchangeRate=n[2]),t.$set(s)},i(n){l||(oe(t.$$.fragment,n),l=!0)},o(n){me(t.$$.fragment,n),l=!1},d(n){Le(t,n)}}}function vl(e){let t,l;return{c(){t=m("span"),l=U(e[17]),o(t,"class","metric-cost svelte-1d2i7t8")},m(n,i){B(n,t,i),r(t,l)},p(n,i){i[0]&131072&&K(l,n[17])},d(n){n&&A(t)}}}function bl(e){let t,l;return{c(){t=m("span"),l=U(e[16]),o(t,"class","metric-cost svelte-1d2i7t8")},m(n,i){B(n,t,i),r(t,l)},p(n,i){i[0]&65536&&K(l,n[16])},d(n){n&&A(t)}}}function kl(e){let t,l,n=e[3].tokenBreakdownToday+"",i,s,a,h;return a=new Jl({props:{input:e[0].todayTokens.input,output:e[0].todayTokens.output,cacheRead:e[0].todayTokens.cacheRead,cacheWrite:e[0].todayTokens.cacheWrite,thinking:e[0].todayTokens.thinking}}),{c(){t=m("div"),l=m("div"),i=U(n),s=q(),Ee(a.$$.fragment),o(l,"class","section-title svelte-1d2i7t8"),o(t,"class","section svelte-1d2i7t8")},m(f,u){B(f,t,u),r(t,l),r(l,i),r(t,s),Me(a,t,null),h=!0},p(f,u){(!h||u[0]&8)&&n!==(n=f[3].tokenBreakdownToday+"")&&K(i,n);const c={};u[0]&1&&(c.input=f[0].todayTokens.input),u[0]&1&&(c.output=f[0].todayTokens.output),u[0]&1&&(c.cacheRead=f[0].todayTokens.cacheRead),u[0]&1&&(c.cacheWrite=f[0].todayTokens.cacheWrite),u[0]&1&&(c.thinking=f[0].todayTokens.thinking),a.$set(c)},i(f){h||(oe(a.$$.fragment,f),h=!0)},o(f){me(a.$$.fragment,f),h=!1},d(f){f&&A(t),Le(a)}}}function wl(e){var f;let t,l,n=e[3].trend+"",i,s,a,h;return a=new ln({props:{data:e[0].dailyHistory,showCost:((f=e[1])==null?void 0:f.showCost)??!1,locale:e[4],currency:e[5],exchangeRate:e[2]}}),{c(){t=m("div"),l=m("div"),i=U(n),s=q(),Ee(a.$$.fragment),o(l,"class","section-title svelte-1d2i7t8"),o(t,"class","section svelte-1d2i7t8")},m(u,c){B(u,t,c),r(t,l),r(l,i),r(t,s),Me(a,t,null),h=!0},p(u,c){var b;(!h||c[0]&8)&&n!==(n=u[3].trend+"")&&K(i,n);const d={};c[0]&1&&(d.data=u[0].dailyHistory),c[0]&2&&(d.showCost=((b=u[1])==null?void 0:b.showCost)??!1),c[0]&16&&(d.locale=u[4]),c[0]&32&&(d.currency=u[5]),c[0]&4&&(d.exchangeRate=u[2]),a.$set(d)},i(u){h||(oe(a.$$.fragment,u),h=!0)},o(u){me(a.$$.fragment,u),h=!1},d(u){u&&A(t),Le(a)}}}function hn(e){let t,l,n,i,s,a;l=new Vl({props:{onRefresh:e[20],onClose:_n,onToggleSettings:e[22],refreshLabel:e[3].refresh,settingsLabel:e[3].settings,closeLabel:e[3].close,statusText:e[9]}});const h=[un,fn],f=[];function u(c,d){return c[7]&&c[1]?0:1}return i=u(e),s=f[i]=h[i](e),{c(){t=m("div"),Ee(l.$$.fragment),n=q(),s.c(),o(t,"class","panel svelte-1d2i7t8"),X(t,"loading",e[6])},m(c,d){B(c,t,d),Me(l,t,null),r(t,n),f[i].m(t,null),e[24](t),a=!0},p(c,d){const b={};d[0]&128&&(b.onToggleSettings=c[22]),d[0]&8&&(b.refreshLabel=c[3].refresh),d[0]&8&&(b.settingsLabel=c[3].settings),d[0]&8&&(b.closeLabel=c[3].close),d[0]&512&&(b.statusText=c[9]),l.$set(b);let k=i;i=u(c),i===k?f[i].p(c,d):(vt(),me(f[k],1,1,()=>{f[k]=null}),bt(),s=f[i],s?s.p(c,d):(s=f[i]=h[i](c),s.c()),oe(s,1),s.m(t,null)),(!a||d[0]&64)&&X(t,"loading",c[6])},i(c){a||(oe(l.$$.fragment,c),oe(s),a=!0)},o(c){me(l.$$.fragment,c),me(s),a=!1},d(c){c&&A(t),Le(l),f[i].d(),e[24](null)}}}function dn(){return typeof navigator<"u"&&navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}function yl(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function gn(e){return e.replace(/^(claude-|gpt-|gemini-|deepseek-|qwen-)/i,"").replace(/-\d{8}$/,"")}function _n(){window.widget.hideWindow()}function mn(e,t,l){let n,i,s,a,h,f,u,c,d,b,k,R,I,W,w=null,z=null,Y=null,O=dn(),L=!0,E=!1,F,P=0;function T(Q){return i.lastNDays(Q)}function D(Q){const C=new Date(Q),ne=String(C.getHours()).padStart(2,"0"),y=String(C.getMinutes()).padStart(2,"0");return i.syncedAt(`${ne}:${y}`)}async function V(){l(6,L=!0),l(0,w=await window.widget.getData()),l(6,L=!1)}async function J(){l(1,z=await window.widget.getSettings())}async function H(){l(2,Y=await window.widget.getExchangeRate())}async function g(Q){l(1,z=await window.widget.saveSettings(Q.detail)),V()}function S(){if(!F)return;const Q=Math.ceil(F.getBoundingClientRect().height);Q<=0||Math.abs(Q-P)<2||(P=Q,window.widget.resizeWindow(Q))}Cl(()=>{V(),J(),H(),window.widget.onDataUpdate(C=>{l(0,w=C),l(6,L=!1)});const Q=new ResizeObserver(()=>S());return Q.observe(F),Ft().then(S),()=>Q.disconnect()}),Pl(()=>{Ft().then(S)});const v=()=>{l(7,E=!E)},j=()=>{l(7,E=!1)};function be(Q){_t[Q?"unshift":"push"](()=>{F=Q,l(8,F)})}return e.$$.update=()=>{var Q;e.$$.dirty[0]&2&&l(4,n=(z==null?void 0:z.locale)??O),e.$$.dirty[0]&16&&l(3,i=Dl(n)),e.$$.dirty[0]&2&&l(5,s=(z==null?void 0:z.currency)??"USD"),e.$$.dirty[0]&1&&l(19,a=w?yl(w.todayTokens.total):"--"),e.$$.dirty[0]&1&&l(18,h=w?yl(w.rangeTokens.total):"--"),e.$$.dirty[0]&53&&l(17,f=w?kt(w.todayCost,s,n,Y):"--"),e.$$.dirty[0]&53&&l(16,u=w?kt(w.rangeCost,s,n,Y):"--"),e.$$.dirty[0]&9&&l(15,c=w?T(w.rangeDays):i.lastNDays(30)),e.$$.dirty[0]&1&&l(14,d=w!=null&&w.topModel?gn(w.topModel.name):"--"),e.$$.dirty[0]&1&&l(13,b=w!=null&&w.topModel?`${w.topModel.share}%`:""),e.$$.dirty[0]&1&&l(12,k=((Q=w==null?void 0:w.topTool)==null?void 0:Q.name)??"--"),e.$$.dirty[0]&1&&l(11,R=w!=null&&w.topTool?`${w.topTool.share}%`:""),e.$$.dirty[0]&1&&l(10,I=w?String(w.sessionCountToday):"--"),e.$$.dirty[0]&1&&l(9,W=w?D(w.lastUpdated):"")},[w,z,Y,i,n,s,L,E,F,W,I,R,k,b,d,c,u,f,h,a,V,g,v,j,be]}class pn extends Ye{constructor(t){super(),Ke(this,t,mn,hn,Ge,{},null,[-1,-1])}}new pn({target:document.getElementById("app")});
|