tokmon 0.28.8 → 0.29.0
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/README.md +9 -5
- package/dist/{bootstrap-ink-PYYVQAYP.js → bootstrap-ink-MPWICEIJ.js} +136 -58
- package/dist/{chunk-BZFDTIFV.js → chunk-3D6TO5TS.js} +2 -2
- package/dist/{chunk-6E2OJCIQ.js → chunk-5Q5HUOP4.js} +11 -4
- package/dist/{chunk-RY24UHMK.js → chunk-AUUBRLBG.js} +2 -2
- package/dist/{chunk-MIXBF6QU.js → chunk-BLUQGJKM.js} +2 -2
- package/dist/{chunk-UON47FYF.js → chunk-BYLWQ46U.js} +19 -2
- package/dist/{chunk-O7ORALKA.js → chunk-G2A3DVPU.js} +80 -1
- package/dist/{chunk-DESEB73E.js → chunk-WPZTPMBX.js} +1 -1
- package/dist/{chunk-WHOIUSJM.js → chunk-YWDMEU3L.js} +1 -1
- package/dist/{cli-command-XPFM6LUP.js → cli-command-WL2K5WWR.js} +145 -13
- package/dist/cli.js +6 -6
- package/dist/{config-JEDXAKPZ.js → config-B7QJQTU2.js} +7 -1
- package/dist/{daemon-KFMXYG7V.js → daemon-A3WGDRFT.js} +6 -6
- package/dist/daemon-handle-4E7RSSDB.js +11 -0
- package/dist/server-P6BRXBZ5.js +12 -0
- package/dist/web/assets/{Area-BqyvRn2x.js → Area-CEpf7_6d.js} +1 -1
- package/dist/web/assets/{analytics-B6QwqU9g.js → analytics-CdjcYtmK.js} +2 -2
- package/dist/web/assets/{breakdown-DYnVKScr.js → breakdown-DM6g0evr.js} +1 -1
- package/dist/web/assets/{button-CnT5g-Jl.js → button-Cu4co7ZR.js} +1 -1
- package/dist/web/assets/{chart-Duz9D-nH.js → chart-YlnVH1If.js} +1 -1
- package/dist/web/assets/{explore-P2EolJrt.js → explore-kLpZWR-_.js} +1 -1
- package/dist/web/assets/index-Dd37pBKy.js +83 -0
- package/dist/web/assets/index-PpTp4nyP.css +1 -0
- package/dist/web/assets/{models-8B4FBxr7.js → models-XKfoWTDv.js} +2 -2
- package/dist/web/assets/{overview-DXA_HAsw.js → overview-DC-WVKZ6.js} +2 -2
- package/dist/web/assets/{panel-gxLFBb8y.js → panel-B_U9oe1x.js} +1 -1
- package/dist/web/assets/settings-sheet-B7BuJ3j8.js +1 -0
- package/dist/web/assets/{share-sheet-CXdyA1ga.js → share-sheet-BaEXe1m9.js} +1 -1
- package/dist/web/assets/{timeline-CzC85trW.js → timeline-ar9mdhcb.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/daemon-handle-6RYUJPC2.js +0 -11
- package/dist/server-LNFK5MRX.js +0 -12
- package/dist/web/assets/index-9hkGpa7j.js +0 -83
- package/dist/web/assets/index-ZmOS8p9O.css +0 -1
- package/dist/web/assets/settings-sheet-CJJl-3Gw.js +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
attachOrSpawn
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-BLUQGJKM.js";
|
|
5
|
+
import "./chunk-YWDMEU3L.js";
|
|
6
6
|
import "./chunk-UYPDMVW5.js";
|
|
7
7
|
import {
|
|
8
8
|
createDaemonRpcClient
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AUUBRLBG.js";
|
|
10
10
|
import {
|
|
11
11
|
PROVIDERS,
|
|
12
12
|
antigravityStateDb,
|
|
@@ -26,13 +26,14 @@ import {
|
|
|
26
26
|
startOfMonth,
|
|
27
27
|
startOfWeek,
|
|
28
28
|
withTimeout
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-WPZTPMBX.js";
|
|
30
|
+
import "./chunk-BYLWQ46U.js";
|
|
31
31
|
import {
|
|
32
32
|
DESKTOP_GRAPH_RANGES,
|
|
33
33
|
PROVIDER_IDS,
|
|
34
|
-
configLocation
|
|
35
|
-
|
|
34
|
+
configLocation,
|
|
35
|
+
setProviderTrackingEnabled
|
|
36
|
+
} from "./chunk-G2A3DVPU.js";
|
|
36
37
|
|
|
37
38
|
// src/provider-locations.ts
|
|
38
39
|
import { access } from "fs/promises";
|
|
@@ -354,17 +355,26 @@ Usage:
|
|
|
354
355
|
Settings:
|
|
355
356
|
privacy <on|off>
|
|
356
357
|
privacy-key <char>
|
|
357
|
-
menu-bar-
|
|
358
|
-
menu-bar-
|
|
358
|
+
menu-bar-mode <auto|custom>
|
|
359
|
+
menu-bar-elements <list> mark,value,progress; at least one
|
|
360
|
+
menu-bar-density <comfortable|compact|tight>
|
|
361
|
+
menu-bar-edge-padding <points> 0..6 in 0.5pt increments
|
|
362
|
+
menu-bar-mark-value-gap <points> 0..8 in 0.5pt increments
|
|
363
|
+
menu-bar-provider-gap <points> 0..16 in 0.5pt increments
|
|
359
364
|
menu-bar-value <usage|tokens-today>
|
|
360
365
|
summary-mode <smart|tightest>
|
|
361
366
|
expanded-providers <ids|none> Comma-separated provider ids
|
|
362
367
|
active-window <minutes> 1..1440
|
|
363
368
|
graph-range <7|14|30> Desktop spend graph days
|
|
369
|
+
enabled-providers <ids|none> Providers tracked across every surface
|
|
364
370
|
auto-detect <on|off> Automatic account discovery
|
|
365
371
|
auto-detect-providers <ids|none>
|
|
366
372
|
launch-at-login <on|off>
|
|
367
373
|
|
|
374
|
+
Compatibility:
|
|
375
|
+
menu-bar-text <on|off> Deprecated alias for the value element
|
|
376
|
+
menu-bar-pins <ids|none> Deprecated; pin from desktop provider cards
|
|
377
|
+
|
|
368
378
|
Options:
|
|
369
379
|
--json Emit machine-readable JSON
|
|
370
380
|
--compact Emit compact JSON
|
|
@@ -374,7 +384,7 @@ Options:
|
|
|
374
384
|
Examples:
|
|
375
385
|
tokmon config get
|
|
376
386
|
tokmon config set privacy off
|
|
377
|
-
tokmon config set menu-bar-
|
|
387
|
+
tokmon config set menu-bar-elements mark,value,progress
|
|
378
388
|
tokmon config set summary-mode smart --json
|
|
379
389
|
`;
|
|
380
390
|
function valueAfter(args, index, name) {
|
|
@@ -516,10 +526,17 @@ var CONFIG_SETTINGS = [
|
|
|
516
526
|
"menu-bar-pins",
|
|
517
527
|
"menu-bar-text",
|
|
518
528
|
"menu-bar-value",
|
|
529
|
+
"menu-bar-mode",
|
|
530
|
+
"menu-bar-elements",
|
|
531
|
+
"menu-bar-density",
|
|
532
|
+
"menu-bar-edge-padding",
|
|
533
|
+
"menu-bar-mark-value-gap",
|
|
534
|
+
"menu-bar-provider-gap",
|
|
519
535
|
"summary-mode",
|
|
520
536
|
"expanded-providers",
|
|
521
537
|
"active-window",
|
|
522
538
|
"graph-range",
|
|
539
|
+
"enabled-providers",
|
|
523
540
|
"auto-detect",
|
|
524
541
|
"auto-detect-providers",
|
|
525
542
|
"launch-at-login"
|
|
@@ -532,10 +549,21 @@ function configReport(config) {
|
|
|
532
549
|
menuBarPins: [...config.tray.pinnedProviders],
|
|
533
550
|
menuBarText: config.tray.showMenuBarText ? "on" : "off",
|
|
534
551
|
menuBarValue: config.tray.menuBarValue === "todayTokens" ? "tokens-today" : "usage",
|
|
552
|
+
menuBarMode: config.tray.menuBar.mode,
|
|
553
|
+
menuBarElements: [
|
|
554
|
+
...config.tray.menuBar.elements.providerMark ? ["mark"] : [],
|
|
555
|
+
...config.tray.menuBar.elements.value ? ["value"] : [],
|
|
556
|
+
...config.tray.menuBar.elements.progress ? ["progress"] : []
|
|
557
|
+
],
|
|
558
|
+
menuBarDensity: config.tray.menuBar.density,
|
|
559
|
+
menuBarEdgePaddingPt: config.tray.menuBar.customSpacing.edgePaddingPt,
|
|
560
|
+
menuBarMarkValueGapPt: config.tray.menuBar.customSpacing.markValueGapPt,
|
|
561
|
+
menuBarProviderGapPt: config.tray.menuBar.customSpacing.providerGapPt,
|
|
535
562
|
summaryMode: config.tray.displayMetric === "smartHeadroom" ? "smart" : "tightest",
|
|
536
563
|
expandedProviders: [...config.desktop.expandedProviders],
|
|
537
564
|
activeWindowMinutes: config.tray.activeTimeoutMin,
|
|
538
565
|
graphRangeDays: config.desktop.graphRangeDays,
|
|
566
|
+
enabledProviders: PROVIDER_IDS.filter((id) => !config.disabledProviders.includes(id)),
|
|
539
567
|
autoDetect: config.accountDetection.enabled ? "on" : "off",
|
|
540
568
|
autoDetectProviders: PROVIDER_IDS.filter((id) => !config.accountDetection.disabledProviders.includes(id)),
|
|
541
569
|
launchAtLogin: config.tray.launchAtLogin ? "on" : "off"
|
|
@@ -546,13 +574,18 @@ function formatConfigReport(report) {
|
|
|
546
574
|
return [
|
|
547
575
|
`privacy ${report.privacy}`,
|
|
548
576
|
`privacy-key ${report.privacyKey}`,
|
|
549
|
-
`menu-bar-
|
|
550
|
-
`menu-bar-
|
|
577
|
+
`menu-bar-mode ${report.menuBarMode}`,
|
|
578
|
+
`menu-bar-elements ${list(report.menuBarElements)}`,
|
|
579
|
+
`menu-bar-density ${report.menuBarDensity}`,
|
|
580
|
+
`menu-bar-edge-padding ${report.menuBarEdgePaddingPt}pt`,
|
|
581
|
+
`menu-bar-mark-value-gap ${report.menuBarMarkValueGapPt}pt`,
|
|
582
|
+
`menu-bar-provider-gap ${report.menuBarProviderGapPt}pt`,
|
|
551
583
|
`menu-bar-value ${report.menuBarValue}`,
|
|
552
584
|
`summary-mode ${report.summaryMode}`,
|
|
553
585
|
`expanded-providers ${list(report.expandedProviders)}`,
|
|
554
586
|
`active-window ${report.activeWindowMinutes}m`,
|
|
555
587
|
`graph-range ${report.graphRangeDays}d`,
|
|
588
|
+
`enabled-providers ${list(report.enabledProviders)}`,
|
|
556
589
|
`auto-detect ${report.autoDetect}`,
|
|
557
590
|
`auto-detect-providers ${list(report.autoDetectProviders)}`,
|
|
558
591
|
`launch-at-login ${report.launchAtLogin}`
|
|
@@ -576,6 +609,27 @@ function providerList(value, setting, max = PROVIDER_IDS.length) {
|
|
|
576
609
|
if (unique2.length > max) throw new Error(`${setting} accepts at most ${max} providers`);
|
|
577
610
|
return unique2;
|
|
578
611
|
}
|
|
612
|
+
function menuBarElements(value) {
|
|
613
|
+
if (value === "none") throw new Error("menu-bar-elements must include at least one of mark,value,progress");
|
|
614
|
+
const raw = value.split(",").map((item) => item.trim());
|
|
615
|
+
if (raw.length === 0 || raw.some((item) => item.length === 0)) {
|
|
616
|
+
throw new Error("menu-bar-elements must list at least one of mark,value,progress");
|
|
617
|
+
}
|
|
618
|
+
const unique2 = [...new Set(raw)];
|
|
619
|
+
for (const element of unique2) {
|
|
620
|
+
if (element !== "mark" && element !== "value" && element !== "progress") {
|
|
621
|
+
throw new Error(`unknown menu-bar element: ${element}`);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
return unique2;
|
|
625
|
+
}
|
|
626
|
+
function halfPoint(value, setting, max) {
|
|
627
|
+
const points = Number(value);
|
|
628
|
+
if (value.trim() === "" || !Number.isFinite(points) || points < 0 || points > max || !Number.isInteger(points * 2)) {
|
|
629
|
+
throw new Error(`${setting} must be from 0 to ${max} in 0.5pt increments`);
|
|
630
|
+
}
|
|
631
|
+
return points;
|
|
632
|
+
}
|
|
579
633
|
function settingMutation(setting, value) {
|
|
580
634
|
if (setting === "privacy") {
|
|
581
635
|
const enabled2 = onOff(value, setting);
|
|
@@ -597,13 +651,81 @@ function settingMutation(setting, value) {
|
|
|
597
651
|
}
|
|
598
652
|
if (setting === "menu-bar-text") {
|
|
599
653
|
const enabled2 = onOff(value, setting);
|
|
600
|
-
return {
|
|
654
|
+
return {
|
|
655
|
+
mutate: (config) => ({
|
|
656
|
+
...config,
|
|
657
|
+
tray: (() => {
|
|
658
|
+
const elements = { ...config.tray.menuBar.elements, value: enabled2 };
|
|
659
|
+
if (!Object.values(elements).some(Boolean)) throw new Error("menu-bar-text off would hide every menu-bar element");
|
|
660
|
+
return {
|
|
661
|
+
...config.tray,
|
|
662
|
+
showMenuBarText: enabled2,
|
|
663
|
+
menuBar: { ...config.tray.menuBar, elements }
|
|
664
|
+
};
|
|
665
|
+
})()
|
|
666
|
+
}),
|
|
667
|
+
display: value
|
|
668
|
+
};
|
|
601
669
|
}
|
|
602
670
|
if (setting === "menu-bar-value") {
|
|
603
671
|
if (value !== "usage" && value !== "tokens-today") throw new Error("menu-bar-value must be usage or tokens-today");
|
|
604
672
|
const menuBarValue = value === "tokens-today" ? "todayTokens" : "usage";
|
|
605
673
|
return { mutate: (config) => ({ ...config, tray: { ...config.tray, menuBarValue } }), display: value };
|
|
606
674
|
}
|
|
675
|
+
if (setting === "menu-bar-mode") {
|
|
676
|
+
if (value !== "auto" && value !== "custom") throw new Error("menu-bar-mode must be auto or custom");
|
|
677
|
+
return {
|
|
678
|
+
mutate: (config) => ({ ...config, tray: { ...config.tray, menuBar: { ...config.tray.menuBar, mode: value } } }),
|
|
679
|
+
display: value
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
if (setting === "menu-bar-elements") {
|
|
683
|
+
const selected = menuBarElements(value);
|
|
684
|
+
const elements = {
|
|
685
|
+
providerMark: selected.includes("mark"),
|
|
686
|
+
value: selected.includes("value"),
|
|
687
|
+
progress: selected.includes("progress")
|
|
688
|
+
};
|
|
689
|
+
return {
|
|
690
|
+
mutate: (config) => ({
|
|
691
|
+
...config,
|
|
692
|
+
tray: {
|
|
693
|
+
...config.tray,
|
|
694
|
+
showMenuBarText: elements.value,
|
|
695
|
+
menuBar: { ...config.tray.menuBar, elements }
|
|
696
|
+
}
|
|
697
|
+
}),
|
|
698
|
+
display: selected
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
if (setting === "menu-bar-density") {
|
|
702
|
+
if (value !== "comfortable" && value !== "compact" && value !== "tight") {
|
|
703
|
+
throw new Error("menu-bar-density must be comfortable, compact, or tight");
|
|
704
|
+
}
|
|
705
|
+
return {
|
|
706
|
+
mutate: (config) => ({ ...config, tray: { ...config.tray, menuBar: { ...config.tray.menuBar, density: value } } }),
|
|
707
|
+
display: value
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
if (setting === "menu-bar-edge-padding" || setting === "menu-bar-mark-value-gap" || setting === "menu-bar-provider-gap") {
|
|
711
|
+
const max = setting === "menu-bar-edge-padding" ? 6 : setting === "menu-bar-mark-value-gap" ? 8 : 16;
|
|
712
|
+
const points = halfPoint(value, setting, max);
|
|
713
|
+
const field = setting === "menu-bar-edge-padding" ? "edgePaddingPt" : setting === "menu-bar-mark-value-gap" ? "markValueGapPt" : "providerGapPt";
|
|
714
|
+
return {
|
|
715
|
+
mutate: (config) => ({
|
|
716
|
+
...config,
|
|
717
|
+
tray: {
|
|
718
|
+
...config.tray,
|
|
719
|
+
menuBar: {
|
|
720
|
+
...config.tray.menuBar,
|
|
721
|
+
mode: "custom",
|
|
722
|
+
customSpacing: { ...config.tray.menuBar.customSpacing, [field]: points }
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}),
|
|
726
|
+
display: points
|
|
727
|
+
};
|
|
728
|
+
}
|
|
607
729
|
if (setting === "summary-mode") {
|
|
608
730
|
if (value !== "smart" && value !== "tightest") throw new Error("summary-mode must be smart or tightest");
|
|
609
731
|
const displayMetric = value === "smart" ? "smartHeadroom" : "tightestRemaining";
|
|
@@ -636,6 +758,16 @@ function settingMutation(setting, value) {
|
|
|
636
758
|
display: value
|
|
637
759
|
};
|
|
638
760
|
}
|
|
761
|
+
if (setting === "enabled-providers") {
|
|
762
|
+
const enabled2 = providerList(value, setting);
|
|
763
|
+
return {
|
|
764
|
+
mutate: (config) => PROVIDER_IDS.reduce(
|
|
765
|
+
(next, provider) => setProviderTrackingEnabled(next, provider, enabled2.includes(provider)),
|
|
766
|
+
config
|
|
767
|
+
),
|
|
768
|
+
display: enabled2
|
|
769
|
+
};
|
|
770
|
+
}
|
|
639
771
|
if (setting === "auto-detect-providers") {
|
|
640
772
|
const enabled2 = providerList(value, setting);
|
|
641
773
|
return {
|
package/dist/cli.js
CHANGED
|
@@ -41,7 +41,7 @@ function validateServeArgs(serveArgs) {
|
|
|
41
41
|
}
|
|
42
42
|
async function main() {
|
|
43
43
|
if (subcommand && ["usage", "models", "query", "providers", "snapshot", "config"].includes(subcommand)) {
|
|
44
|
-
const { runQueryCommand } = await import("./cli-command-
|
|
44
|
+
const { runQueryCommand } = await import("./cli-command-WL2K5WWR.js");
|
|
45
45
|
try {
|
|
46
46
|
const output = await runQueryCommand(
|
|
47
47
|
subcommand,
|
|
@@ -60,14 +60,14 @@ Run tokmon ${subcommand} --help for usage.
|
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
if (subcommand === "__daemon") {
|
|
63
|
-
const { runDaemon } = await import("./daemon-
|
|
63
|
+
const { runDaemon } = await import("./daemon-A3WGDRFT.js");
|
|
64
64
|
await runDaemon(args.slice(1), { foreground: false });
|
|
65
65
|
process.exitCode ??= 0;
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
if (subcommand === "serve" || subcommand === "web") {
|
|
69
69
|
validateServeArgs(args.slice(1));
|
|
70
|
-
const { runDaemon } = await import("./daemon-
|
|
70
|
+
const { runDaemon } = await import("./daemon-A3WGDRFT.js");
|
|
71
71
|
await runDaemon(args.slice(1), { foreground: true });
|
|
72
72
|
process.exitCode ??= 0;
|
|
73
73
|
return;
|
|
@@ -115,9 +115,9 @@ Run tokmon ${subcommand} --help for usage.
|
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
const { loadConfig } = await import("./config-
|
|
118
|
+
const { loadConfig } = await import("./config-B7QJQTU2.js");
|
|
119
119
|
const { resolveGlyphs, setGlyphs } = await import("./glyphs-NKCSZLGO.js");
|
|
120
|
-
const { attachOrSpawn } = await import("./daemon-handle-
|
|
120
|
+
const { attachOrSpawn } = await import("./daemon-handle-4E7RSSDB.js");
|
|
121
121
|
const config = await loadConfig();
|
|
122
122
|
setGlyphs(resolveGlyphs({
|
|
123
123
|
flag: asciiFlag,
|
|
@@ -128,7 +128,7 @@ Run tokmon ${subcommand} --help for usage.
|
|
|
128
128
|
}));
|
|
129
129
|
const daemon = await attachOrSpawn();
|
|
130
130
|
const mode = daemon.kind === "spawned" ? "connected" : "degraded";
|
|
131
|
-
const { bootstrapInk } = await import("./bootstrap-ink-
|
|
131
|
+
const { bootstrapInk } = await import("./bootstrap-ink-MPWICEIJ.js");
|
|
132
132
|
await bootstrapInk({ interval, config, daemon, mode });
|
|
133
133
|
}
|
|
134
134
|
void main().catch((error) => {
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
COLOR_PALETTE,
|
|
5
5
|
DEFAULTS,
|
|
6
6
|
DEFAULT_ACCOUNT_DETECTION_CONFIG,
|
|
7
|
+
DEFAULT_MENU_BAR_CONFIG,
|
|
7
8
|
DEFAULT_TRAY_CONFIG,
|
|
8
9
|
DESKTOP_GRAPH_RANGES,
|
|
9
10
|
MAX_PINNED_PROVIDERS,
|
|
@@ -28,20 +29,23 @@ import {
|
|
|
28
29
|
providerDetectionEnabled,
|
|
29
30
|
redactEmail,
|
|
30
31
|
repairConfig,
|
|
32
|
+
repairMenuBarConfig,
|
|
31
33
|
sanitizeTyped,
|
|
32
34
|
saveConfig,
|
|
33
35
|
saveConfigSync,
|
|
34
36
|
setDetectedAccountExcluded,
|
|
35
37
|
setProviderDetectionEnabled,
|
|
38
|
+
setProviderTrackingEnabled,
|
|
36
39
|
slugify,
|
|
37
40
|
snapshotCacheFile,
|
|
38
41
|
toggleProviderSelection
|
|
39
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-G2A3DVPU.js";
|
|
40
43
|
export {
|
|
41
44
|
ACCENT_COLORS,
|
|
42
45
|
COLOR_PALETTE,
|
|
43
46
|
DEFAULTS,
|
|
44
47
|
DEFAULT_ACCOUNT_DETECTION_CONFIG,
|
|
48
|
+
DEFAULT_MENU_BAR_CONFIG,
|
|
45
49
|
DEFAULT_TRAY_CONFIG,
|
|
46
50
|
DESKTOP_GRAPH_RANGES,
|
|
47
51
|
MAX_PINNED_PROVIDERS,
|
|
@@ -66,11 +70,13 @@ export {
|
|
|
66
70
|
providerDetectionEnabled,
|
|
67
71
|
redactEmail,
|
|
68
72
|
repairConfig,
|
|
73
|
+
repairMenuBarConfig,
|
|
69
74
|
sanitizeTyped,
|
|
70
75
|
saveConfig,
|
|
71
76
|
saveConfigSync,
|
|
72
77
|
setDetectedAccountExcluded,
|
|
73
78
|
setProviderDetectionEnabled,
|
|
79
|
+
setProviderTrackingEnabled,
|
|
74
80
|
slugify,
|
|
75
81
|
snapshotCacheFile,
|
|
76
82
|
toggleProviderSelection
|
|
@@ -14,25 +14,25 @@ import {
|
|
|
14
14
|
unlinkLock,
|
|
15
15
|
verifyLock,
|
|
16
16
|
writeLock
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YWDMEU3L.js";
|
|
18
18
|
import {
|
|
19
19
|
appVersion,
|
|
20
20
|
startWebServer
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-5Q5HUOP4.js";
|
|
22
22
|
import {
|
|
23
23
|
resolveDaemonChannel
|
|
24
24
|
} from "./chunk-UYPDMVW5.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-3D6TO5TS.js";
|
|
26
26
|
import {
|
|
27
27
|
flushDisk
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-WPZTPMBX.js";
|
|
29
29
|
import {
|
|
30
30
|
TOKMON_CAPABILITIES,
|
|
31
31
|
TOKMON_PROTOCOL_VERSION
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-BYLWQ46U.js";
|
|
33
33
|
import {
|
|
34
34
|
loadConfig
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-G2A3DVPU.js";
|
|
36
36
|
|
|
37
37
|
// src/web/daemon-controller.ts
|
|
38
38
|
import { randomBytes } from "crypto";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
startWebServer
|
|
4
|
+
} from "./chunk-5Q5HUOP4.js";
|
|
5
|
+
import "./chunk-UYPDMVW5.js";
|
|
6
|
+
import "./chunk-3D6TO5TS.js";
|
|
7
|
+
import "./chunk-WPZTPMBX.js";
|
|
8
|
+
import "./chunk-BYLWQ46U.js";
|
|
9
|
+
import "./chunk-G2A3DVPU.js";
|
|
10
|
+
export {
|
|
11
|
+
startWebServer
|
|
12
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{R as v,r as ht}from"./index-
|
|
1
|
+
import{R as v,r as ht}from"./index-Dd37pBKy.js";import{j as J,c as Q,D as vt,J as jt,W as kt,L as F,d as I,q as G,w as dt,y as N,z as nt,t as U,$ as yt,E as mt,v as Z,F as bt,H as gt,_ as tt,a0 as q,B as V,a1 as Lt}from"./chart-YlnVH1If.js";var $t=["type","layout","connectNulls","ref"],Nt=["key"];function K(t){"@babel/helpers - typeof";return K=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},K(t)}function lt(t,r){if(t==null)return{};var n=It(t,r),e,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)e=o[a],!(r.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}function It(t,r){if(t==null)return{};var n={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(r.indexOf(e)>=0)continue;n[e]=t[e]}return n}function Y(){return Y=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t},Y.apply(this,arguments)}function ut(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,e)}return n}function j(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?ut(Object(n),!0).forEach(function(e){$(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function z(t){return Ct(t)||Tt(t)||Rt(t)||Bt()}function Bt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rt(t,r){if(t){if(typeof t=="string")return at(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return at(t,r)}}function Tt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ct(t){if(Array.isArray(t))return at(t)}function at(t,r){(r==null||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}function Wt(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function ct(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,xt(e.key),e)}}function Ft(t,r,n){return r&&ct(t.prototype,r),n&&ct(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Mt(t,r,n){return r=et(r),zt(t,At()?Reflect.construct(r,n||[],et(t).constructor):r.apply(t,n))}function zt(t,r){if(r&&(K(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Vt(t)}function Vt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function At(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(At=function(){return!!t})()}function et(t){return et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},et(t)}function Kt(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&it(t,r)}function it(t,r){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,a){return e.__proto__=a,e},it(t,r)}function $(t,r,n){return r=xt(r),r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function xt(t){var r=Ht(t,"string");return K(r)=="symbol"?r:r+""}function Ht(t,r){if(K(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var e=n.call(t,r);if(K(e)!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var st=(function(t){function r(){var n;Wt(this,r);for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];return n=Mt(this,r,[].concat(a)),$(n,"state",{isAnimationFinished:!0,totalLength:0}),$(n,"generateSimpleStrokeDasharray",function(i,s){return"".concat(s,"px ").concat(i-s,"px")}),$(n,"getStrokeDasharray",function(i,s,l){var u=l.reduce(function(x,A){return x+A});if(!u)return n.generateSimpleStrokeDasharray(s,i);for(var f=Math.floor(i/u),c=i%u,p=s-i,d=[],h=0,y=0;h<l.length;y+=l[h],++h)if(y+l[h]>c){d=[].concat(z(l.slice(0,h)),[c-y]);break}var b=d.length%2===0?[0,p]:[p];return[].concat(z(r.repeat(l,f)),z(d),b).map(function(x){return"".concat(x,"px")}).join(", ")}),$(n,"id",bt("recharts-line-")),$(n,"pathRef",function(i){n.mainCurve=i}),$(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),$(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return Kt(r,t),Ft(r,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:"getTotalLength",value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(e,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.points,s=o.xAxis,l=o.yAxis,u=o.layout,f=o.children,c=jt(f,kt);if(!c)return null;var p=function(y,b){return{x:y.x,y:y.y,value:y.value,errorVal:Z(y.payload,b)}},d={clipPath:e?"url(#clipPath-".concat(a,")"):null};return v.createElement(F,d,c.map(function(h){return v.cloneElement(h,{key:"bar-".concat(h.props.dataKey),data:i,xAxis:s,yAxis:l,layout:u,dataPointFormatter:p})}))}},{key:"renderDots",value:function(e,a,o){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var s=this.props,l=s.dot,u=s.points,f=s.dataKey,c=I(this.props,!1),p=I(l,!0),d=u.map(function(y,b){var x=j(j(j({key:"dot-".concat(b),r:3},c),p),{},{index:b,cx:y.x,cy:y.y,value:y.value,dataKey:f,payload:y.payload,points:u});return r.renderDotItem(l,x)}),h={clipPath:e?"url(#clipPath-".concat(a?"":"dots-").concat(o,")"):null};return v.createElement(F,Y({className:"recharts-line-dots",key:"dots"},h),d)}},{key:"renderCurveStatically",value:function(e,a,o,i){var s=this.props,l=s.type,u=s.layout,f=s.connectNulls;s.ref;var c=lt(s,$t),p=j(j(j({},I(c,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(o,")"):null,points:e},i),{},{type:l,layout:u,connectNulls:f});return v.createElement(G,Y({},p,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(e,a){var o=this,i=this.props,s=i.points,l=i.strokeDasharray,u=i.isAnimationActive,f=i.animationBegin,c=i.animationDuration,p=i.animationEasing,d=i.animationId,h=i.animateNewValues,y=i.width,b=i.height,x=this.state,A=x.prevPoints,_=x.totalLength;return v.createElement(dt,{begin:f,duration:c,isActive:u,easing:p,from:{t:0},to:{t:1},key:"line-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(g){var m=g.t;if(A){var P=A.length/s.length,w=s.map(function(O,R){var T=Math.floor(R*P);if(A[T]){var C=A[T],L=N(C.x,O.x),_t=N(C.y,O.y);return j(j({},O),{},{x:L(m),y:_t(m)})}if(h){var Et=N(y*2,O.x),Dt=N(b/2,O.y);return j(j({},O),{},{x:Et(m),y:Dt(m)})}return j(j({},O),{},{x:O.x,y:O.y})});return o.renderCurveStatically(w,e,a)}var S=N(0,_),k=S(m),E;if(l){var D="".concat(l).split(/[,\s]+/gim).map(function(O){return parseFloat(O)});E=o.getStrokeDasharray(k,_,D)}else E=o.generateSimpleStrokeDasharray(_,k);return o.renderCurveStatically(s,e,a,{strokeDasharray:E})})}},{key:"renderCurve",value:function(e,a){var o=this.props,i=o.points,s=o.isAnimationActive,l=this.state,u=l.prevPoints,f=l.totalLength;return s&&i&&i.length&&(!u&&f>0||!nt(u,i))?this.renderCurveWithAnimation(e,a):this.renderCurveStatically(i,e,a)}},{key:"render",value:function(){var e,a=this.props,o=a.hide,i=a.dot,s=a.points,l=a.className,u=a.xAxis,f=a.yAxis,c=a.top,p=a.left,d=a.width,h=a.height,y=a.isAnimationActive,b=a.id;if(o||!s||!s.length)return null;var x=this.state.isAnimationFinished,A=s.length===1,_=Q("recharts-line",l),g=u&&u.allowDataOverflow,m=f&&f.allowDataOverflow,P=g||m,w=U(b)?this.id:b,S=(e=I(i,!1))!==null&&e!==void 0?e:{r:3,strokeWidth:2},k=S.r,E=k===void 0?3:k,D=S.strokeWidth,O=D===void 0?2:D,R=yt(i)?i:{},T=R.clipDot,C=T===void 0?!0:T,L=E*2+O;return v.createElement(F,{className:_},g||m?v.createElement("defs",null,v.createElement("clipPath",{id:"clipPath-".concat(w)},v.createElement("rect",{x:g?p:p-d/2,y:m?c:c-h/2,width:g?d:d*2,height:m?h:h*2})),!C&&v.createElement("clipPath",{id:"clipPath-dots-".concat(w)},v.createElement("rect",{x:p-L/2,y:c-L/2,width:d+L,height:h+L}))):null,!A&&this.renderCurve(P,w),this.renderErrorBar(P,w),(A||i)&&this.renderDots(P,C,w),(!y||x)&&mt.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(e,a){return e.animationId!==a.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:a.curPoints}:e.points!==a.curPoints?{curPoints:e.points}:null}},{key:"repeat",value:function(e,a){for(var o=e.length%2!==0?[].concat(z(e),[0]):e,i=[],s=0;s<a;++s)i=[].concat(z(i),z(o));return i}},{key:"renderDotItem",value:function(e,a){var o;if(v.isValidElement(e))o=v.cloneElement(e,a);else if(J(e))o=e(a);else{var i=a.key,s=lt(a,Nt),l=Q("recharts-line-dot",typeof e!="boolean"?e.className:"");o=v.createElement(vt,Y({key:i},s,{className:l}))}return o}}])})(ht.PureComponent);$(st,"displayName","Line");$(st,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!gt.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});$(st,"getComposedData",function(t){var r=t.props,n=t.xAxis,e=t.yAxis,a=t.xAxisTicks,o=t.yAxisTicks,i=t.dataKey,s=t.bandSize,l=t.displayedData,u=t.offset,f=r.layout,c=l.map(function(p,d){var h=Z(p,i);return f==="horizontal"?{x:tt({axis:n,ticks:a,bandSize:s,entry:p,index:d}),y:U(h)?null:e.scale(h),value:h,payload:p}:{x:U(h)?null:n.scale(h),y:tt({axis:e,ticks:o,bandSize:s,entry:p,index:d}),value:h,payload:p}});return j({points:c,layout:f},u)});var Xt=["layout","type","stroke","connectNulls","isRange","ref"],Yt=["key"],Pt;function H(t){"@babel/helpers - typeof";return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},H(t)}function Ot(t,r){if(t==null)return{};var n=Ut(t,r),e,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a<o.length;a++)e=o[a],!(r.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}function Ut(t,r){if(t==null)return{};var n={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(r.indexOf(e)>=0)continue;n[e]=t[e]}return n}function M(){return M=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t},M.apply(this,arguments)}function ft(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,e)}return n}function W(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?ft(Object(n),!0).forEach(function(e){B(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ft(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function qt(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function pt(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,St(e.key),e)}}function Gt(t,r,n){return r&&pt(t.prototype,r),n&&pt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Jt(t,r,n){return r=rt(r),Qt(t,wt()?Reflect.construct(r,n||[],rt(t).constructor):r.apply(t,n))}function Qt(t,r){if(r&&(H(r)==="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Zt(t)}function Zt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function wt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wt=function(){return!!t})()}function rt(t){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},rt(t)}function te(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&ot(t,r)}function ot(t,r){return ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,a){return e.__proto__=a,e},ot(t,r)}function B(t,r,n){return r=St(r),r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function St(t){var r=ee(t,"string");return H(r)=="symbol"?r:r+""}function ee(t,r){if(H(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var e=n.call(t,r);if(H(e)!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var X=(function(t){function r(){var n;qt(this,r);for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];return n=Jt(this,r,[].concat(a)),B(n,"state",{isAnimationFinished:!0}),B(n,"id",bt("recharts-area-")),B(n,"handleAnimationEnd",function(){var i=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),J(i)&&i()}),B(n,"handleAnimationStart",function(){var i=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),J(i)&&i()}),n}return te(r,t),Gt(r,[{key:"renderDots",value:function(e,a,o){var i=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(i&&!s)return null;var l=this.props,u=l.dot,f=l.points,c=l.dataKey,p=I(this.props,!1),d=I(u,!0),h=f.map(function(b,x){var A=W(W(W({key:"dot-".concat(x),r:3},p),d),{},{index:x,cx:b.x,cy:b.y,dataKey:c,value:b.value,payload:b.payload,points:f});return r.renderDotItem(u,A)}),y={clipPath:e?"url(#clipPath-".concat(a?"":"dots-").concat(o,")"):null};return v.createElement(F,M({className:"recharts-area-dots"},y),h)}},{key:"renderHorizontalRect",value:function(e){var a=this.props,o=a.baseLine,i=a.points,s=a.strokeWidth,l=i[0].x,u=i[i.length-1].x,f=e*Math.abs(l-u),c=q(i.map(function(p){return p.y||0}));return V(o)&&typeof o=="number"?c=Math.max(o,c):o&&Array.isArray(o)&&o.length&&(c=Math.max(q(o.map(function(p){return p.y||0})),c)),V(c)?v.createElement("rect",{x:l<u?l:l-f,y:0,width:f,height:Math.floor(c+(s?parseInt("".concat(s),10):1))}):null}},{key:"renderVerticalRect",value:function(e){var a=this.props,o=a.baseLine,i=a.points,s=a.strokeWidth,l=i[0].y,u=i[i.length-1].y,f=e*Math.abs(l-u),c=q(i.map(function(p){return p.x||0}));return V(o)&&typeof o=="number"?c=Math.max(o,c):o&&Array.isArray(o)&&o.length&&(c=Math.max(q(o.map(function(p){return p.x||0})),c)),V(c)?v.createElement("rect",{x:0,y:l<u?l:l-f,width:c+(s?parseInt("".concat(s),10):1),height:Math.floor(f)}):null}},{key:"renderClipRect",value:function(e){var a=this.props.layout;return a==="vertical"?this.renderVerticalRect(e):this.renderHorizontalRect(e)}},{key:"renderAreaStatically",value:function(e,a,o,i){var s=this.props,l=s.layout,u=s.type,f=s.stroke,c=s.connectNulls,p=s.isRange;s.ref;var d=Ot(s,Xt);return v.createElement(F,{clipPath:o?"url(#clipPath-".concat(i,")"):null},v.createElement(G,M({},I(d,!0),{points:e,connectNulls:c,type:u,baseLine:a,layout:l,stroke:"none",className:"recharts-area-area"})),f!=="none"&&v.createElement(G,M({},I(this.props,!1),{className:"recharts-area-curve",layout:l,type:u,connectNulls:c,fill:"none",points:e})),f!=="none"&&p&&v.createElement(G,M({},I(this.props,!1),{className:"recharts-area-curve",layout:l,type:u,connectNulls:c,fill:"none",points:a})))}},{key:"renderAreaWithAnimation",value:function(e,a){var o=this,i=this.props,s=i.points,l=i.baseLine,u=i.isAnimationActive,f=i.animationBegin,c=i.animationDuration,p=i.animationEasing,d=i.animationId,h=this.state,y=h.prevPoints,b=h.prevBaseLine;return v.createElement(dt,{begin:f,duration:c,isActive:u,easing:p,from:{t:0},to:{t:1},key:"area-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(x){var A=x.t;if(y){var _=y.length/s.length,g=s.map(function(S,k){var E=Math.floor(k*_);if(y[E]){var D=y[E],O=N(D.x,S.x),R=N(D.y,S.y);return W(W({},S),{},{x:O(A),y:R(A)})}return S}),m;if(V(l)&&typeof l=="number"){var P=N(b,l);m=P(A)}else if(U(l)||Lt(l)){var w=N(b,0);m=w(A)}else m=l.map(function(S,k){var E=Math.floor(k*_);if(b[E]){var D=b[E],O=N(D.x,S.x),R=N(D.y,S.y);return W(W({},S),{},{x:O(A),y:R(A)})}return S});return o.renderAreaStatically(g,m,e,a)}return v.createElement(F,null,v.createElement("defs",null,v.createElement("clipPath",{id:"animationClipPath-".concat(a)},o.renderClipRect(A))),v.createElement(F,{clipPath:"url(#animationClipPath-".concat(a,")")},o.renderAreaStatically(s,l,e,a)))})}},{key:"renderArea",value:function(e,a){var o=this.props,i=o.points,s=o.baseLine,l=o.isAnimationActive,u=this.state,f=u.prevPoints,c=u.prevBaseLine,p=u.totalLength;return l&&i&&i.length&&(!f&&p>0||!nt(f,i)||!nt(c,s))?this.renderAreaWithAnimation(e,a):this.renderAreaStatically(i,s,e,a)}},{key:"render",value:function(){var e,a=this.props,o=a.hide,i=a.dot,s=a.points,l=a.className,u=a.top,f=a.left,c=a.xAxis,p=a.yAxis,d=a.width,h=a.height,y=a.isAnimationActive,b=a.id;if(o||!s||!s.length)return null;var x=this.state.isAnimationFinished,A=s.length===1,_=Q("recharts-area",l),g=c&&c.allowDataOverflow,m=p&&p.allowDataOverflow,P=g||m,w=U(b)?this.id:b,S=(e=I(i,!1))!==null&&e!==void 0?e:{r:3,strokeWidth:2},k=S.r,E=k===void 0?3:k,D=S.strokeWidth,O=D===void 0?2:D,R=yt(i)?i:{},T=R.clipDot,C=T===void 0?!0:T,L=E*2+O;return v.createElement(F,{className:_},g||m?v.createElement("defs",null,v.createElement("clipPath",{id:"clipPath-".concat(w)},v.createElement("rect",{x:g?f:f-d/2,y:m?u:u-h/2,width:g?d:d*2,height:m?h:h*2})),!C&&v.createElement("clipPath",{id:"clipPath-dots-".concat(w)},v.createElement("rect",{x:f-L/2,y:u-L/2,width:d+L,height:h+L}))):null,A?null:this.renderArea(P,w),(i||A)&&this.renderDots(P,C,w),(!y||x)&&mt.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(e,a){return e.animationId!==a.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:a.curPoints,prevBaseLine:a.curBaseLine}:e.points!==a.curPoints||e.baseLine!==a.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null}}])})(ht.PureComponent);Pt=X;B(X,"displayName","Area");B(X,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!gt.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});B(X,"getBaseValue",function(t,r,n,e){var a=t.layout,o=t.baseValue,i=r.props.baseValue,s=i??o;if(V(s)&&typeof s=="number")return s;var l=a==="horizontal"?e:n,u=l.scale.domain();if(l.type==="number"){var f=Math.max(u[0],u[1]),c=Math.min(u[0],u[1]);return s==="dataMin"?c:s==="dataMax"||f<0?f:Math.max(Math.min(u[0],u[1]),0)}return s==="dataMin"?u[0]:s==="dataMax"?u[1]:u[0]});B(X,"getComposedData",function(t){var r=t.props,n=t.item,e=t.xAxis,a=t.yAxis,o=t.xAxisTicks,i=t.yAxisTicks,s=t.bandSize,l=t.dataKey,u=t.stackedData,f=t.dataStartIndex,c=t.displayedData,p=t.offset,d=r.layout,h=u&&u.length,y=Pt.getBaseValue(r,n,e,a),b=d==="horizontal",x=!1,A=c.map(function(g,m){var P;h?P=u[f+m]:(P=Z(g,l),Array.isArray(P)?x=!0:P=[y,P]);var w=P[1]==null||h&&Z(g,l)==null;return b?{x:tt({axis:e,ticks:o,bandSize:s,entry:g,index:m}),y:w?null:a.scale(P[1]),value:P,payload:g}:{x:w?null:e.scale(P[1]),y:tt({axis:a,ticks:i,bandSize:s,entry:g,index:m}),value:P,payload:g}}),_;return h||x?_=A.map(function(g){var m=Array.isArray(g.value)?g.value[0]:null;return b?{x:g.x,y:m!=null&&g.y!=null?a.scale(m):null}:{x:m!=null?e.scale(m):null,y:g.y}}):_=b?a.scale(y):e.scale(y),W({points:A,baseLine:_,layout:d,isRange:x},p)});B(X,"renderDotItem",function(t,r){var n;if(v.isValidElement(t))n=v.cloneElement(t,r);else if(J(t))n=t(r);else{var e=Q("recharts-area-dot",typeof t!="boolean"?t.className:""),a=r.key,o=Ot(r,Yt);n=v.createElement(vt,M({},o,{key:a,className:e}))}return n});export{X as A,st as L};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./breakdown-
|
|
2
|
-
import{o as D,q as j,t as A,D as k,M as F,r as x,j as e,F as I,l as T,v as M,f as C,b as S,c as $,w as z,h as R,_ as w}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./breakdown-DM6g0evr.js","./index-Dd37pBKy.js","./index-PpTp4nyP.css","./chart-YlnVH1If.js","./panel-B_U9oe1x.js","./timeline-ar9mdhcb.js","./Area-CEpf7_6d.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as D,q as j,t as A,D as k,M as F,r as x,j as e,F as I,l as T,v as M,f as C,b as S,c as $,w as z,h as R,_ as w}from"./index-Dd37pBKy.js";import{P as B}from"./panel-B_U9oe1x.js";const O=[0,.32,.55,.78,1],E=t=>t===0?"var(--color-bg-2)":`color-mix(in oklab, var(--color-cost) ${O[t]*100}%, var(--color-bg-2))`,L=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function V(t,n){const i=t,c=i.filter(l=>n(l)>0);if(c.length===0)return null;const h=i.reduce((l,a)=>l+n(a),0),d=c.reduce((l,a)=>n(a)>n(l)?a:l),p=new Array(7).fill(0);for(const l of i)p[D(j(l.date))]+=n(l);const m=p.indexOf(Math.max(...p)),f=new Set(c.map(l=>l.date));let v=0;for(let l=j(c[c.length-1].date);f.has(A(l));l-=k)v++;return{active:c.length,total:h,top:d,avg:h/c.length,busiest:m,streak:v,costed:t.some(l=>l.cost>0)}}function H(t,n,i){const c=new Map(t.map(s=>[s.date,i(s)]));if(t.length===0)return null;const h=t[t.length-1].date,d=t[0].date;let p=j(h),m=j(d);(p-m)/(k*7)>n&&(m=p-n*7*k),m-=D(m)*k;const f=Math.max(...t.map(i),0),v=s=>{if(s<=0||f<=0)return 0;const r=s/f;return r>.66?4:r>.4?3:r>.15?2:1},l=[];let a=new Array(7).fill(null);const u=[];let N=-1,b=0;for(let s=m;s<=p;s+=k){const r=A(s),o=D(s);o===0&&a.some(Boolean)&&(l.push(a),a=new Array(7).fill(null),b++);const g=new Date(s).getUTCMonth();g!==N&&o===0&&(u.push({col:b,text:F[g]}),N=g);const y=s>=j(d);a[o]=y?{date:r,cost:c.get(r)??0,level:v(c.get(r)??0)}:null}return a.some(Boolean)&&l.push(a),{weeks:l,monthLabels:u}}function W({derived:t,maxWeeks:n=26,periodLabel:i}){const[c,h]=x.useState(null),[d,p]=x.useState(null),m=c??d,f=x.useMemo(()=>new Map(t.calendar.map(s=>[s.date,s])),[t.calendar]),v=x.useMemo(()=>t.calendar.some(s=>s.cost>0),[t.calendar]),l=s=>v?s.cost:s.tokens,a=x.useMemo(()=>V(t.calendar,l),[t,v]),u=x.useMemo(()=>H(t.calendar,n,l),[t,n]),N=u?`repeat(${u.weeks.length}, minmax(0,1fr))`:void 0,b=u?u.weeks.length*25:void 0;return e.jsx(e.Fragment,{children:e.jsx(B,{title:"daily spend",titleTag:i,captureName:"calendar",children:!u||!a?e.jsx("div",{className:"py-6 text-center text-xs text-fg-faint",children:"no usage yet"}):e.jsxs("div",{className:"grid gap-x-8 gap-y-5 pt-1 md:grid-cols-[minmax(0,1fr)_210px] md:items-start",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("div",{className:"pl-6",children:e.jsx("div",{className:"grid gap-[3px] text-[9px] text-fg-faint",style:{gridTemplateColumns:N,maxWidth:b},children:u.weeks.map((s,r)=>{const o=u.monthLabels.find(g=>g.col===r);return e.jsx("div",{className:"truncate",children:(o==null?void 0:o.text)??""},r)})})}),e.jsxs("div",{className:"flex gap-[3px]",children:[e.jsx("div",{className:"flex w-5 shrink-0 flex-col gap-[3px] text-[9px] text-fg-faint",children:["M","","W","","F","",""].map((s,r)=>e.jsx("div",{className:"flex flex-1 items-center",children:s},r))}),e.jsx("div",{className:"grid min-w-0 flex-1 gap-[3px]",style:{gridTemplateColumns:N,maxWidth:b},onMouseLeave:()=>h(null),children:u.weeks.map((s,r)=>e.jsx("div",{className:"flex flex-col gap-[3px]",children:s.map((o,g)=>o===null?e.jsx("div",{className:"aspect-square"},g):e.jsx("button",{type:"button","aria-label":`${T(o.date)} — click to pin`,"aria-pressed":(d==null?void 0:d.date)===o.date,className:`aspect-square block rounded-[3px] p-0 transition duration-150 hover:scale-[1.18] hover:ring-1 hover:ring-accent ${I} ${(d==null?void 0:d.date)===o.date?"ring-1 ring-fg-bright":""}`,style:{background:E(o.level)},onMouseEnter:()=>h(f.get(o.date)??null),onFocus:()=>h(f.get(o.date)??null),onClick:()=>p(y=>(y==null?void 0:y.date)===o.date?null:f.get(o.date)??null)},g))},r))})]}),e.jsxs("div",{className:"flex items-center gap-1.5 pl-6 pt-1 text-[9px] text-fg-faint",children:["less",[0,1,2,3,4].map(s=>e.jsx("span",{className:"size-[11px] rounded-[2px]",style:{background:E(s)}},s)),"more"]})]}),e.jsxs("div",{className:"relative border-line-faint md:border-l md:pl-6",children:[e.jsxs("div",{className:`grid grid-cols-2 gap-x-6 gap-y-4 transition-opacity duration-200 md:grid-cols-1 ${m?"opacity-0":"opacity-100"}`,children:[e.jsx(M,{label:"busiest day",value:a.costed?C(a.top.cost):S(a.top.tokens),sub:T(a.top.date),valueClass:"text-cost"}),e.jsx(M,{label:"daily average",value:a.costed?C(a.avg):S(a.avg),sub:`across ${a.active} active days`}),e.jsx(M,{label:"top weekday",value:L[a.busiest],valueClass:"text-fg-bright"}),e.jsx(M,{label:"latest streak",value:`${a.streak}d`,sub:a.streak>0?"in a row":"idle today",valueClass:"text-positive"})]}),m&&e.jsx("div",{className:"dialog-fade absolute inset-0 md:pl-6",children:e.jsx(q,{day:m,pinned:!c&&m===d})})]})]})})})}function q({day:t,pinned:n=!1}){return e.jsxs("div",{className:"font-mono text-[11px]",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3 border-b border-line-faint pb-2",children:[e.jsxs("span",{className:"text-fg-dim",children:[L[D(j(t.date))]," · ",T(t.date),n&&e.jsx("span",{className:"ml-1.5 text-[9px] uppercase tracking-wide text-accent",children:"pinned"})]}),e.jsx("span",{className:"tnum text-cost",children:t.cost>0?C(t.cost):"—"})]}),t.cost>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2 py-2 text-[10px]",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"calls"}),e.jsx("div",{className:"tnum text-fg",children:$(t.calls)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"tokens"}),e.jsx("div",{className:"tnum text-fg",children:S(t.tokens)})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-fg-faint",children:"saved"}),e.jsx("div",{className:"tnum text-positive",children:C(t.cacheSavings)})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 border-t border-line-faint pt-2",children:[t.models.slice(0,5).map(i=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full",style:{background:z(i.name)}}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-fg-dim",children:R(i.name)}),e.jsx("span",{className:"tnum w-16 shrink-0 text-right text-fg",children:C(i.cost)})]},i.name)),t.models.length>5&&e.jsxs("div",{className:"pt-0.5 text-fg-faint",children:["+",t.models.length-5," more"]})]})]}):e.jsx("div",{className:"pt-2 text-fg-faint",children:"no spend this day"})]})}const Y=x.lazy(()=>w(()=>import("./breakdown-DM6g0evr.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.CostByModel}))),G=x.lazy(()=>w(()=>import("./breakdown-DM6g0evr.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.ProviderDonut}))),P=x.lazy(()=>w(()=>import("./breakdown-DM6g0evr.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.TokenComposition}))),U=x.lazy(()=>w(()=>import("./timeline-ar9mdhcb.js"),__vite__mapDeps([5,1,2,3,4,6]),import.meta.url).then(t=>({default:t.CacheSavings}))),K=x.lazy(()=>w(()=>import("./timeline-ar9mdhcb.js"),__vite__mapDeps([5,1,2,3,4,6]),import.meta.url).then(t=>({default:t.CumulativeSpend})));function _({children:t}){return e.jsx(x.Suspense,{fallback:e.jsx("div",{className:"min-h-64",role:"status","aria-label":"Loading chart"}),children:t})}function X({derived:t,scopeLabel:n}){const i=t.byProvider.length>1;return e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[e.jsx("div",{className:"md:col-span-2",children:e.jsx(W,{derived:t,periodLabel:n})}),e.jsx(_,{children:e.jsx(Y,{derived:t,periodLabel:n})}),e.jsx(_,{children:i?e.jsx(G,{derived:t,periodLabel:n}):e.jsx(P,{derived:t,periodLabel:n})}),i?e.jsx(_,{children:e.jsx(P,{derived:t,periodLabel:n})}):null,e.jsx("div",{className:i?void 0:"md:col-span-2",children:e.jsx(_,{children:e.jsx(U,{derived:t,periodLabel:n})})}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(_,{children:e.jsx(K,{derived:t,height:300,periodLabel:n})})})]})}export{X as AnalyticsTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as h,x as Ye,r as J,j as f,E as pe,m as Je,h as ee,f as G,b as q,y as et,u as At,z as kt,d as re,T as ie}from"./index-
|
|
1
|
+
import{R as h,x as Ye,r as J,j as f,E as pe,m as Je,h as ee,f as G,b as q,y as et,u as At,z as kt,d as re,T as ie}from"./index-Dd37pBKy.js";import{c as I,d as k,r as tt,e as Pt,h as nt,i as Ot,j as C,k as Oe,p as S,L as _,l as rt,n as je,o as it,D as jt,q as _t,t as W,v as F,S as wt,w as Tt,x as St,y as Be,z as Et,B as M,E as _e,F as Rt,H as It,I as oe,J as Nt,K as we,M as Lt,N as ae,O as Ke,g as at,X as Te,Y as Se,P as Ee,f as $t,Q as Ct,u as Re,U as ot,C as Ie,R as Ne,a as st,G as ct,A as ce,T as lt,s as Le}from"./chart-YlnVH1If.js";import{P as de}from"./panel-B_U9oe1x.js";var Dt=["points","className","baseLinePoints","connectNulls"];function V(){return V=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n},V.apply(this,arguments)}function Bt(n,e){if(n==null)return{};var r=Kt(n,e),t,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)t=o[i],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(n,t)&&(r[t]=n[t])}return r}function Kt(n,e){if(n==null)return{};var r={};for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t)){if(e.indexOf(t)>=0)continue;r[t]=n[t]}return r}function Fe(n){return zt(n)||Vt(n)||Mt(n)||Ft()}function Ft(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mt(n,e){if(n){if(typeof n=="string")return xe(n,e);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set")return Array.from(n);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xe(n,e)}}function Vt(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function zt(n){if(Array.isArray(n))return xe(n)}function xe(n,e){(e==null||e>n.length)&&(e=n.length);for(var r=0,t=new Array(e);r<e;r++)t[r]=n[r];return t}var Me=function(e){return e&&e.x===+e.x&&e.y===+e.y},qt=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return e.forEach(function(t){Me(t)?r[r.length-1].push(t):r[r.length-1].length>0&&r.push([])}),Me(e[0])&&r[r.length-1].push(e[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Q=function(e,r){var t=qt(e);r&&(t=[t.reduce(function(o,a){return[].concat(Fe(o),Fe(a))},[])]);var i=t.map(function(o){return o.reduce(function(a,c,l){return"".concat(a).concat(l===0?"M":"L").concat(c.x,",").concat(c.y)},"")}).join("");return t.length===1?"".concat(i,"Z"):i},Wt=function(e,r,t){var i=Q(e,t);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(Q(r.reverse(),t).slice(1))},Gt=function(e){var r=e.points,t=e.className,i=e.baseLinePoints,o=e.connectNulls,a=Bt(e,Dt);if(!r||!r.length)return null;var c=I("recharts-polygon",t);if(i&&i.length){var l=a.stroke&&a.stroke!=="none",s=Wt(r,i,o);return h.createElement("g",{className:c},h.createElement("path",V({},k(a,!0),{fill:s.slice(-1)==="Z"?a.fill:"none",stroke:"none",d:s})),l?h.createElement("path",V({},k(a,!0),{fill:"none",d:Q(r,o)})):null,l?h.createElement("path",V({},k(a,!0),{fill:"none",d:Q(i,o)})):null)}var p=Q(r,o);return h.createElement("path",V({},k(a,!0),{fill:p.slice(-1)==="Z"?a.fill:"none",className:c,d:p}))},ge,Ve;function Ht(){if(Ve)return ge;Ve=1;var n=tt(),e=Pt(),r=nt();function t(i,o){return i&&i.length?n(i,r(o,2),e):void 0}return ge=t,ge}var Ut=Ht();const Zt=Ye(Ut);var be,ze;function Xt(){if(ze)return be;ze=1;var n=tt(),e=nt(),r=Ot();function t(i,o){return i&&i.length?n(i,e(o,2),r):void 0}return be=t,be}var Qt=Xt();const Yt=Ye(Qt);var Jt=["cx","cy","angle","ticks","axisLine"],en=["ticks","tick","angle","tickFormatter","stroke"];function H(n){"@babel/helpers - typeof";return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(n)}function Y(){return Y=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n},Y.apply(this,arguments)}function qe(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),r.push.apply(r,t)}return r}function L(n){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qe(Object(r),!0).forEach(function(t){me(n,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):qe(Object(r)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(r,t))})}return n}function We(n,e){if(n==null)return{};var r=tn(n,e),t,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)t=o[i],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(n,t)&&(r[t]=n[t])}return r}function tn(n,e){if(n==null)return{};var r={};for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t)){if(e.indexOf(t)>=0)continue;r[t]=n[t]}return r}function nn(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Ge(n,e){for(var r=0;r<e.length;r++){var t=e[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,ft(t.key),t)}}function rn(n,e,r){return e&&Ge(n.prototype,e),r&&Ge(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n}function an(n,e,r){return e=le(e),on(n,ut()?Reflect.construct(e,r||[],le(n).constructor):e.apply(n,r))}function on(n,e){if(e&&(H(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sn(n)}function sn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function ut(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ut=function(){return!!n})()}function le(n){return le=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},le(n)}function cn(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Ae(n,e)}function Ae(n,e){return Ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},Ae(n,e)}function me(n,e,r){return e=ft(e),e in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function ft(n){var e=ln(n,"string");return H(e)=="symbol"?e:e+""}function ln(n,e){if(H(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var t=r.call(n,e);if(H(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var ve=(function(n){function e(){return nn(this,e),an(this,e,arguments)}return cn(e,n),rn(e,[{key:"getTickValueCoord",value:function(t){var i=t.coordinate,o=this.props,a=o.angle,c=o.cx,l=o.cy;return S(c,l,i,a)}},{key:"getTickTextAnchor",value:function(){var t=this.props.orientation,i;switch(t){case"left":i="end";break;case"right":i="start";break;default:i="middle";break}return i}},{key:"getViewBox",value:function(){var t=this.props,i=t.cx,o=t.cy,a=t.angle,c=t.ticks,l=Zt(c,function(p){return p.coordinate||0}),s=Yt(c,function(p){return p.coordinate||0});return{cx:i,cy:o,startAngle:a,endAngle:a,innerRadius:s.coordinate||0,outerRadius:l.coordinate||0}}},{key:"renderAxisLine",value:function(){var t=this.props,i=t.cx,o=t.cy,a=t.angle,c=t.ticks,l=t.axisLine,s=We(t,Jt),p=c.reduce(function(m,u){return[Math.min(m[0],u.coordinate),Math.max(m[1],u.coordinate)]},[1/0,-1/0]),d=S(i,o,p[0],a),v=S(i,o,p[1],a),A=L(L(L({},k(s,!1)),{},{fill:"none"},k(l,!1)),{},{x1:d.x,y1:d.y,x2:v.x,y2:v.y});return h.createElement("line",Y({className:"recharts-polar-radius-axis-line"},A))}},{key:"renderTicks",value:function(){var t=this,i=this.props,o=i.ticks,a=i.tick,c=i.angle,l=i.tickFormatter,s=i.stroke,p=We(i,en),d=this.getTickTextAnchor(),v=k(p,!1),A=k(a,!1),m=o.map(function(u,g){var b=t.getTickValueCoord(u),x=L(L(L(L({textAnchor:d,transform:"rotate(".concat(90-c,", ").concat(b.x,", ").concat(b.y,")")},v),{},{stroke:"none",fill:s},A),{},{index:g},b),{},{payload:u});return h.createElement(_,Y({className:I("recharts-polar-radius-axis-tick",rt(a)),key:"tick-".concat(u.coordinate)},je(t.props,u,g)),e.renderTickItem(a,x,l?l(u.value,g):u.value))});return h.createElement(_,{className:"recharts-polar-radius-axis-ticks"},m)}},{key:"render",value:function(){var t=this.props,i=t.ticks,o=t.axisLine,a=t.tick;return!i||!i.length?null:h.createElement(_,{className:I("recharts-polar-radius-axis",this.props.className)},o&&this.renderAxisLine(),a&&this.renderTicks(),it.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(t,i,o){var a;return h.isValidElement(t)?a=h.cloneElement(t,i):C(t)?a=t(i):a=h.createElement(Oe,Y({},i,{className:"recharts-polar-radius-axis-tick-value"}),o),a}}])})(J.PureComponent);me(ve,"displayName","PolarRadiusAxis");me(ve,"axisType","radiusAxis");me(ve,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function U(n){"@babel/helpers - typeof";return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U(n)}function D(){return D=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n},D.apply(this,arguments)}function He(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),r.push.apply(r,t)}return r}function $(n){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?He(Object(r),!0).forEach(function(t){he(n,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):He(Object(r)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(r,t))})}return n}function un(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Ue(n,e){for(var r=0;r<e.length;r++){var t=e[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,dt(t.key),t)}}function fn(n,e,r){return e&&Ue(n.prototype,e),r&&Ue(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n}function pn(n,e,r){return e=ue(e),dn(n,pt()?Reflect.construct(e,r||[],ue(n).constructor):e.apply(n,r))}function dn(n,e){if(e&&(U(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mn(n)}function mn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function pt(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pt=function(){return!!n})()}function ue(n){return ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ue(n)}function vn(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&ke(n,e)}function ke(n,e){return ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},ke(n,e)}function he(n,e,r){return e=dt(e),e in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function dt(n){var e=hn(n,"string");return U(e)=="symbol"?e:e+""}function hn(n,e){if(U(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var t=r.call(n,e);if(U(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var yn=Math.PI/180,Ze=1e-5,ye=(function(n){function e(){return un(this,e),pn(this,e,arguments)}return vn(e,n),fn(e,[{key:"getTickLineCoord",value:function(t){var i=this.props,o=i.cx,a=i.cy,c=i.radius,l=i.orientation,s=i.tickSize,p=s||8,d=S(o,a,c,t.coordinate),v=S(o,a,c+(l==="inner"?-1:1)*p,t.coordinate);return{x1:d.x,y1:d.y,x2:v.x,y2:v.y}}},{key:"getTickTextAnchor",value:function(t){var i=this.props.orientation,o=Math.cos(-t.coordinate*yn),a;return o>Ze?a=i==="outer"?"start":"end":o<-Ze?a=i==="outer"?"end":"start":a="middle",a}},{key:"renderAxisLine",value:function(){var t=this.props,i=t.cx,o=t.cy,a=t.radius,c=t.axisLine,l=t.axisLineType,s=$($({},k(this.props,!1)),{},{fill:"none"},k(c,!1));if(l==="circle")return h.createElement(jt,D({className:"recharts-polar-angle-axis-line"},s,{cx:i,cy:o,r:a}));var p=this.props.ticks,d=p.map(function(v){return S(i,o,a,v.coordinate)});return h.createElement(Gt,D({className:"recharts-polar-angle-axis-line"},s,{points:d}))}},{key:"renderTicks",value:function(){var t=this,i=this.props,o=i.ticks,a=i.tick,c=i.tickLine,l=i.tickFormatter,s=i.stroke,p=k(this.props,!1),d=k(a,!1),v=$($({},p),{},{fill:"none"},k(c,!1)),A=o.map(function(m,u){var g=t.getTickLineCoord(m),b=t.getTickTextAnchor(m),x=$($($({textAnchor:b},p),{},{stroke:"none",fill:s},d),{},{index:u,payload:m,x:g.x2,y:g.y2});return h.createElement(_,D({className:I("recharts-polar-angle-axis-tick",rt(a)),key:"tick-".concat(m.coordinate)},je(t.props,m,u)),c&&h.createElement("line",D({className:"recharts-polar-angle-axis-tick-line"},v,g)),a&&e.renderTickItem(a,x,l?l(m.value,u):m.value))});return h.createElement(_,{className:"recharts-polar-angle-axis-ticks"},A)}},{key:"render",value:function(){var t=this.props,i=t.ticks,o=t.radius,a=t.axisLine;return o<=0||!i||!i.length?null:h.createElement(_,{className:I("recharts-polar-angle-axis",this.props.className)},a&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(t,i,o){var a;return h.isValidElement(t)?a=h.cloneElement(t,i):C(t)?a=t(i):a=h.createElement(Oe,D({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),a}}])})(J.PureComponent);he(ye,"displayName","PolarAngleAxis");he(ye,"axisType","angleAxis");he(ye,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var se;function Z(n){"@babel/helpers - typeof";return Z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Z(n)}function z(){return z=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n},z.apply(this,arguments)}function Xe(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),r.push.apply(r,t)}return r}function y(n){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Xe(Object(r),!0).forEach(function(t){O(n,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(r,t))})}return n}function gn(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Qe(n,e){for(var r=0;r<e.length;r++){var t=e[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(n,vt(t.key),t)}}function bn(n,e,r){return e&&Qe(n.prototype,e),r&&Qe(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n}function xn(n,e,r){return e=fe(e),An(n,mt()?Reflect.construct(e,r||[],fe(n).constructor):e.apply(n,r))}function An(n,e){if(e&&(Z(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kn(n)}function kn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function mt(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mt=function(){return!!n})()}function fe(n){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fe(n)}function Pn(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Pe(n,e)}function Pe(n,e){return Pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},Pe(n,e)}function O(n,e,r){return e=vt(e),e in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function vt(n){var e=On(n,"string");return Z(e)=="symbol"?e:e+""}function On(n,e){if(Z(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var t=r.call(n,e);if(Z(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}var E=(function(n){function e(r){var t;return gn(this,e),t=xn(this,e,[r]),O(t,"pieRef",null),O(t,"sectorRefs",[]),O(t,"id",Rt("recharts-pie-")),O(t,"handleAnimationEnd",function(){var i=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),C(i)&&i()}),O(t,"handleAnimationStart",function(){var i=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),C(i)&&i()}),t.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},t}return Pn(e,n),bn(e,[{key:"isActiveIndex",value:function(t){var i=this.props.activeIndex;return Array.isArray(i)?i.indexOf(t)!==-1:t===i}},{key:"hasActiveIndex",value:function(){var t=this.props.activeIndex;return Array.isArray(t)?t.length!==0:t||t===0}},{key:"renderLabels",value:function(t){var i=this.props.isAnimationActive;if(i&&!this.state.isAnimationFinished)return null;var o=this.props,a=o.label,c=o.labelLine,l=o.dataKey,s=o.valueKey,p=k(this.props,!1),d=k(a,!1),v=k(c,!1),A=a&&a.offsetRadius||20,m=t.map(function(u,g){var b=(u.startAngle+u.endAngle)/2,x=S(u.cx,u.cy,u.outerRadius+A,b),j=y(y(y(y({},p),u),{},{stroke:"none"},d),{},{index:g,textAnchor:e.getTextAnchor(x.x,u.cx)},x),B=y(y(y(y({},p),u),{},{fill:"none",stroke:u.fill},v),{},{index:g,points:[S(u.cx,u.cy,u.outerRadius,b),x]}),w=l;return W(l)&&W(s)?w="value":W(l)&&(w=s),h.createElement(_,{key:"label-".concat(u.startAngle,"-").concat(u.endAngle,"-").concat(u.midAngle,"-").concat(g)},c&&e.renderLabelLineItem(c,B,"line"),e.renderLabelItem(a,j,F(u,w)))});return h.createElement(_,{className:"recharts-pie-labels"},m)}},{key:"renderSectorsStatically",value:function(t){var i=this,o=this.props,a=o.activeShape,c=o.blendStroke,l=o.inactiveShape;return t.map(function(s,p){if((s==null?void 0:s.startAngle)===0&&(s==null?void 0:s.endAngle)===0&&t.length!==1)return null;var d=i.isActiveIndex(p),v=l&&i.hasActiveIndex()?l:null,A=d?a:v,m=y(y({},s),{},{stroke:c?s.fill:s.stroke,tabIndex:-1});return h.createElement(_,z({ref:function(g){g&&!i.sectorRefs.includes(g)&&i.sectorRefs.push(g)},tabIndex:-1,className:"recharts-pie-sector"},je(i.props,s,p),{key:"sector-".concat(s==null?void 0:s.startAngle,"-").concat(s==null?void 0:s.endAngle,"-").concat(s.midAngle,"-").concat(p)}),h.createElement(wt,z({option:A,isActive:d,shapeType:"sector"},m)))})}},{key:"renderSectorsWithAnimation",value:function(){var t=this,i=this.props,o=i.sectors,a=i.isAnimationActive,c=i.animationBegin,l=i.animationDuration,s=i.animationEasing,p=i.animationId,d=this.state,v=d.prevSectors,A=d.prevIsAnimationActive;return h.createElement(Tt,{begin:c,duration:l,isActive:a,easing:s,from:{t:0},to:{t:1},key:"pie-".concat(p,"-").concat(A),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(m){var u=m.t,g=[],b=o&&o[0],x=b.startAngle;return o.forEach(function(j,B){var w=v&&v[B],N=B>0?St(j,"paddingAngle",0):0;if(w){var X=Be(w.endAngle-w.startAngle,j.endAngle-j.startAngle),P=y(y({},j),{},{startAngle:x+N,endAngle:x+X(u)+N});g.push(P),x=P.endAngle}else{var K=j.endAngle,T=j.startAngle,te=Be(0,K-T),ne=te(u),R=y(y({},j),{},{startAngle:x+N,endAngle:x+ne+N});g.push(R),x=R.endAngle}}),h.createElement(_,null,t.renderSectorsStatically(g))})}},{key:"attachKeyboardHandlers",value:function(t){var i=this;t.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var a=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[a].focus(),i.setState({sectorToFocus:a});break}case"ArrowRight":{var c=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[c].focus(),i.setState({sectorToFocus:c});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var t=this.props,i=t.sectors,o=t.isAnimationActive,a=this.state.prevSectors;return o&&i&&i.length&&(!a||!Et(a,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var t=this,i=this.props,o=i.hide,a=i.sectors,c=i.className,l=i.label,s=i.cx,p=i.cy,d=i.innerRadius,v=i.outerRadius,A=i.isAnimationActive,m=this.state.isAnimationFinished;if(o||!a||!a.length||!M(s)||!M(p)||!M(d)||!M(v))return null;var u=I("recharts-pie",c);return h.createElement(_,{tabIndex:this.props.rootTabIndex,className:u,ref:function(b){t.pieRef=b}},this.renderSectors(),l&&this.renderLabels(a),it.renderCallByParent(this.props,null,!1),(!A||m)&&_e.renderCallByParent(this.props,a,!1))}}],[{key:"getDerivedStateFromProps",value:function(t,i){return i.prevIsAnimationActive!==t.isAnimationActive?{prevIsAnimationActive:t.isAnimationActive,prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:[],isAnimationFinished:!0}:t.isAnimationActive&&t.animationId!==i.prevAnimationId?{prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:t.sectors!==i.curSectors?{curSectors:t.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(t,i){return t>i?"start":t<i?"end":"middle"}},{key:"renderLabelLineItem",value:function(t,i,o){if(h.isValidElement(t))return h.cloneElement(t,i);if(C(t))return t(i);var a=I("recharts-pie-label-line",typeof t!="boolean"?t.className:"");return h.createElement(_t,z({},i,{key:o,type:"linear",className:a}))}},{key:"renderLabelItem",value:function(t,i,o){if(h.isValidElement(t))return h.cloneElement(t,i);var a=o;if(C(t)&&(a=t(i),h.isValidElement(a)))return a;var c=I("recharts-pie-label-text",typeof t!="boolean"&&!C(t)?t.className:"");return h.createElement(Oe,z({},i,{alignmentBaseline:"middle",className:c}),a)}}])})(J.PureComponent);se=E;O(E,"displayName","Pie");O(E,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!It.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});O(E,"parseDeltaAngle",function(n,e){var r=oe(e-n),t=Math.min(Math.abs(e-n),360);return r*t});O(E,"getRealPieData",function(n){var e=n.data,r=n.children,t=k(n,!1),i=Nt(r,we);return e&&e.length?e.map(function(o,a){return y(y(y({payload:o},t),o),i&&i[a]&&i[a].props)}):i&&i.length?i.map(function(o){return y(y({},t),o.props)}):[]});O(E,"parseCoordinateOfPie",function(n,e){var r=e.top,t=e.left,i=e.width,o=e.height,a=Lt(i,o),c=t+ae(n.cx,i,i/2),l=r+ae(n.cy,o,o/2),s=ae(n.innerRadius,a,0),p=ae(n.outerRadius,a,a*.8),d=n.maxRadius||Math.sqrt(i*i+o*o)/2;return{cx:c,cy:l,innerRadius:s,outerRadius:p,maxRadius:d}});O(E,"getComposedData",function(n){var e=n.item,r=n.offset,t=e.type.defaultProps!==void 0?y(y({},e.type.defaultProps),e.props):e.props,i=se.getRealPieData(t);if(!i||!i.length)return null;var o=t.cornerRadius,a=t.startAngle,c=t.endAngle,l=t.paddingAngle,s=t.dataKey,p=t.nameKey,d=t.valueKey,v=t.tooltipType,A=Math.abs(t.minAngle),m=se.parseCoordinateOfPie(t,r),u=se.parseDeltaAngle(a,c),g=Math.abs(u),b=s;W(s)&&W(d)?(Ke(!1,`Use "dataKey" to specify the value of pie,
|
|
3
3
|
the props "valueKey" will be deprecated in 1.1.0`),b="value"):W(s)&&(Ke(!1,`Use "dataKey" to specify the value of pie,
|
|
4
4
|
the props "valueKey" will be deprecated in 1.1.0`),b=d);var x=i.filter(function(P){return F(P,b,0)!==0}).length,j=(g>=360?x:x-1)*l,B=g-x*A-j,w=i.reduce(function(P,K){var T=F(K,b,0);return P+(M(T)?T:0)},0),N;if(w>0){var X;N=i.map(function(P,K){var T=F(P,b,0),te=F(P,p,K),ne=(M(T)?T:0)/w,R;K?R=X.endAngle+oe(u)*l*(T!==0?1:0):R=a;var $e=R+oe(u)*((T!==0?A:0)+ne*B),Ce=(R+$e)/2,De=(m.innerRadius+m.outerRadius)/2,bt=[{name:te,value:T,payload:P,dataKey:b,type:v}],xt=S(m.cx,m.cy,De,Ce);return X=y(y(y({percent:ne,cornerRadius:o,name:te,tooltipPayload:bt,midAngle:Ce,middleRadius:De,tooltipPosition:xt},P),m),{},{value:F(P,b),startAngle:R,endAngle:$e,payload:P,paddingAngle:oe(u)*l}),X})}return y(y({},m),{},{sectors:N,data:i})});var ht=at({chartName:"BarChart",GraphicalChild:Ee,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Te},{axisType:"yAxis",AxisComp:Se}],formatAxisMap:$t}),jn=at({chartName:"PieChart",GraphicalChild:E,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:ye},{axisType:"radiusAxis",AxisComp:ve}],formatAxisMap:Ct,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const yt={fill:"var(--color-bg-2)"},gt={fill:"var(--color-fg-dim)",fontSize:10,fontFamily:"var(--font-mono)"},_n=Le("cost",G,n=>{var e;return(e=n[0])==null?void 0:e.color},{title:n=>ee(n)}),wn=Le("tokens",q,n=>{var e;return(e=n[0])==null?void 0:e.color},{title:n=>ee(n)}),Tn=Le("saved",G,n=>{var e;return(e=n[0])==null?void 0:e.color},{title:n=>ee(n)});function In({derived:n,height:e=280,limit:r=10,metric:t="cost",periodLabel:i}){const o=Re(),a=ot("(min-width: 768px)"),c=a?124:92,l=a?60:44,s=t==="tokens",p=[...n.byModel].sort((d,v)=>s?v.tokens-d.tokens:v.cost-d.cost).slice(0,r);return f.jsx(de,{title:s?"tokens by model":"cost by model",titleTag:i,captureName:s?"tokens-by-model":"cost-by-model",children:p.length===0?f.jsx(pe,{children:"no models in period"}):f.jsx(Ie,{height:e,children:f.jsx(Ne,{children:f.jsxs(ht,{data:p,layout:"vertical",margin:{top:4,right:l,left:4,bottom:0},children:[f.jsx(st,{...ct,horizontal:!1,vertical:!0}),f.jsx(Te,{type:"number",...ce,tickFormatter:s?q:Je}),f.jsx(Se,{type:"category",dataKey:"model",...ce,width:c,tickFormatter:ee}),f.jsx(lt,{content:s?wn:_n,cursor:yt}),f.jsxs(Ee,{dataKey:s?"tokens":"cost",radius:[0,3,3,0],isAnimationActive:o,animationDuration:350,children:[p.map(d=>f.jsx(we,{fill:d.color},d.model)),f.jsx(_e,{dataKey:s?"tokens":"cost",position:"right",offset:6,...gt,formatter:d=>s?q(d):G(d)})]})]})})})})}function Nn({derived:n,height:e=240,limit:r=12,periodLabel:t}){const i=Re(),o=ot("(min-width: 768px)"),a=o?124:92,c=o?60:44,l=[...n.byModel].filter(s=>s.cacheSavings>0).sort((s,p)=>p.cacheSavings-s.cacheSavings).slice(0,r);return f.jsx(de,{title:"cache savings by model",titleTag:t,captureName:"cache-savings-by-model",children:l.length===0?f.jsx(pe,{children:"no cache savings in period"}):f.jsx(Ie,{height:e,children:f.jsx(Ne,{children:f.jsxs(ht,{data:l,layout:"vertical",margin:{top:4,right:c,left:4,bottom:0},children:[f.jsx(st,{...ct,horizontal:!1,vertical:!0}),f.jsx(Te,{type:"number",...ce,tickFormatter:Je}),f.jsx(Se,{type:"category",dataKey:"model",...ce,width:a,tickFormatter:ee}),f.jsx(lt,{content:Tn,cursor:yt}),f.jsx(Ee,{dataKey:"cacheSavings",radius:[0,3,3,0],fill:"var(--color-positive)",isAnimationActive:i,animationDuration:350,children:f.jsx(_e,{dataKey:"cacheSavings",position:"right",offset:6,...gt,formatter:s=>G(s)})})]})})})})}function Ln({derived:n,height:e=280,periodLabel:r}){const t=Re(),i=n.byProvider,o=n.totals.cost,[a,c]=J.useState(null),[l,s]=J.useState(null),p=l?i.findIndex(m=>m.id===l):-1,d=a??(p>=0?p:null),v=d!=null?i[d]:null,A=v&&o>0?v.cost/o:0;return f.jsx(de,{title:"provider split",titleTag:r,captureName:"provider-split",children:i.length===0?f.jsx(pe,{children:"no spend in period"}):f.jsxs("div",{className:"relative",onMouseLeave:()=>c(null),children:[f.jsx(Ie,{height:e,children:f.jsx(Ne,{children:f.jsx(jn,{children:f.jsx(E,{data:i,dataKey:"cost",nameKey:"name",innerRadius:"60%",outerRadius:"88%",paddingAngle:i.length>1?2:0,stroke:"var(--color-bg-1)",strokeWidth:2,isAnimationActive:t,animationDuration:350,style:{cursor:"pointer"},onMouseEnter:(m,u)=>c(u),onClick:(m,u)=>s(g=>{var b,x;return g===((b=i[u])==null?void 0:b.id)?null:((x=i[u])==null?void 0:x.id)??null}),children:i.map((m,u)=>f.jsx(we,{fill:m.color,"aria-label":`${m.name}: ${G(m.cost)}`,fillOpacity:d==null||d===u?1:.32,style:{transition:"fill-opacity 150ms ease"}},m.id))})})})}),f.jsxs("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center",children:[f.jsx("div",{className:"tnum text-xl",style:{color:v?v.color:"var(--color-fg-bright)"},children:G(v?v.cost:o)}),f.jsxs("div",{className:"font-display text-[10px] uppercase tracking-wide text-fg-faint",children:[v?`${v.name} · ${et(A,A>0&&A<.01?1:0)}`:"total",v&&a==null&&p>=0&&f.jsx("span",{className:"text-accent",children:" · pinned"})]})]})]})})}function $n({derived:n,periodLabel:e}){const r=At(),t=n.tokenComposition,i=kt(t),o=r.appearance.preset,a=[{key:"cacheRead",label:"cache read",value:t.cacheRead,color:re(o,0,ie.cacheRead)},{key:"input",label:"input",value:t.input,color:re(o,1,ie.input)},{key:"output",label:"output",value:t.output,color:re(o,2,ie.output)},{key:"cacheCreate",label:"cache write",value:t.cacheCreate,color:re(o,3,ie.cacheCreate)}];return f.jsx(de,{title:"token composition",titleTag:e,captureName:"token-composition",right:f.jsx("span",{className:"tnum text-xs text-fg-dim",children:q(i)}),children:i===0?f.jsx(pe,{children:"no tokens in period"}):f.jsxs("div",{className:"flex flex-col gap-4 pt-1",children:[f.jsx("div",{className:"flex h-3 w-full overflow-hidden rounded-full bg-bg-3",children:a.map(c=>c.value>0&&f.jsx("div",{style:{width:`${c.value/i*100}%`,minWidth:"2px",background:c.color},title:`${c.label}: ${q(c.value)}`},c.key))}),f.jsx("div",{className:"grid grid-cols-2 gap-x-6 gap-y-2.5",children:a.map(c=>{const l=i>0?c.value/i:0;return f.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[f.jsxs("span",{className:"flex items-center gap-1.5 text-fg-dim",children:[f.jsx("span",{className:"inline-block size-2 rounded-[2px]",style:{background:c.color}}),c.label]}),f.jsxs("span",{className:"text-fg",children:[f.jsx("span",{className:"tnum text-fg-bright",children:q(c.value)}),f.jsx("span",{className:"ml-1.5 text-fg-faint",children:et(l,l>0&&l<.01?1:0)})]})]},c.key)})})]})})}export{Nn as CacheByModel,In as CostByModel,Ln as ProviderDonut,$n as TokenComposition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as b,j as f,F as N,X as S}from"./index-
|
|
1
|
+
import{r as b,j as f,F as N,X as S}from"./index-Dd37pBKy.js";const j='button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])';function k(n,{active:i,onEscape:s,initialFocusRef:r}){const u=b.useRef(s);b.useEffect(()=>{u.current=s},[s]),b.useEffect(()=>{var a,l;if(!i)return;const o=n.current,c=document.activeElement,d=o==null?void 0:o.querySelector(j);(l=(a=(r==null?void 0:r.current)??d??o)==null?void 0:a.focus)==null||l.call(a);let m=document.activeElement;const g=e=>{var p;const t=e.target;t&&((p=n.current)!=null&&p.contains(t))&&(m=t)};document.addEventListener("focusin",g);const x=e=>{const t=n.current;if(!t||t.hasAttribute("inert"))return;if(e.key==="Escape"){e.stopPropagation(),u.current();return}if(e.key!=="Tab")return;const p=t.querySelectorAll(j),v=Array.from(p).filter(E=>E.offsetParent!==null||E===document.activeElement);if(v.length===0)return;const y=v[0],h=v[v.length-1];e.shiftKey&&document.activeElement===y?(e.preventDefault(),h.focus()):!e.shiftKey&&document.activeElement===h&&(e.preventDefault(),y.focus())};return document.addEventListener("keydown",x),()=>{var t;document.removeEventListener("keydown",x),document.removeEventListener("focusin",g);const e=c&&c.isConnected?c:m;(t=e==null?void 0:e.focus)==null||t.call(e)}},[i,r,n])}function I({onClose:n,labelledBy:i,initialFocusRef:s,panelRef:r,className:u="",panelStyle:o,active:c=!0,closeOnBackdrop:d=!0,showClose:m=!0,children:g}){const x=b.useRef(null),a=r??x;return k(a,{active:c,onEscape:n,initialFocusRef:s}),f.jsx("div",{className:"dialog-fade fixed inset-0 z-[60] flex items-start justify-center overflow-y-auto overscroll-contain bg-bg-0/70 p-4 backdrop-blur-sm",onMouseDown:l=>{d&&l.target===l.currentTarget&&n()},role:"dialog","aria-modal":"true","aria-labelledby":i,children:f.jsxs("div",{ref:a,tabIndex:-1,style:o,className:`dialog-pop relative overflow-hidden rounded-md border border-line-2 bg-bg-1 focus:outline-none ${u}`,children:[m&&f.jsx("button",{type:"button",onClick:n,"aria-label":"Close",className:`absolute right-2 top-2 z-10 rounded p-1 text-fg-faint transition hover:text-fg ${N}`,children:f.jsx(S,{className:"size-4"})}),g]})})}const w={primary:"border border-accent/60 bg-bg-1 text-accent hover:bg-bg-2",secondary:"border border-line bg-bg-1 text-fg-dim hover:border-line-2 hover:text-fg",ghost:"text-fg-faint hover:text-fg"},A={sm:"gap-1.5 px-3 py-1.5 text-xs",xs:"gap-1 px-2 py-1 text-[11px]"},$=b.forwardRef(function({variant:i="secondary",size:s="sm",className:r="",type:u="button",children:o,...c},d){return f.jsx("button",{ref:d,type:u,className:`inline-flex items-center rounded transition active:scale-[0.97] disabled:opacity-50 ${A[s]} ${w[i]} ${N} ${r}`,...c,children:o})});export{$ as B,I as D};
|