tokmon 0.28.5 → 0.28.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/{bootstrap-ink-RXSGXK7H.js → bootstrap-ink-PYYVQAYP.js} +25 -9
  2. package/dist/{chunk-KLRDULRC.js → chunk-6E2OJCIQ.js} +4 -4
  3. package/dist/{chunk-TN6V7XSL.js → chunk-BZFDTIFV.js} +32 -10
  4. package/dist/{chunk-CFKUZCMB.js → chunk-DESEB73E.js} +7 -6
  5. package/dist/{chunk-NNQGZNX4.js → chunk-MIXBF6QU.js} +96 -12
  6. package/dist/{chunk-HNWEJ6MS.js → chunk-O7ORALKA.js} +2 -0
  7. package/dist/{chunk-6YJ5H3JT.js → chunk-RY24UHMK.js} +2 -2
  8. package/dist/{chunk-EEMD2PXA.js → chunk-UON47FYF.js} +11 -3
  9. package/dist/{chunk-5B3XCEMC.js → chunk-WHOIUSJM.js} +53 -4
  10. package/dist/{cli-command-4XXKT32M.js → cli-command-XPFM6LUP.js} +17 -8
  11. package/dist/cli.js +6 -6
  12. package/dist/{config-3DGZ47F7.js → config-JEDXAKPZ.js} +1 -1
  13. package/dist/{daemon-D42FZQC5.js → daemon-KFMXYG7V.js} +55 -53
  14. package/dist/daemon-handle-6RYUJPC2.js +11 -0
  15. package/dist/server-LNFK5MRX.js +12 -0
  16. package/dist/web/assets/{Area-DSOnmPHW.js → Area-BqyvRn2x.js} +1 -1
  17. package/dist/web/assets/{analytics-CQcXEq3U.js → analytics-B6QwqU9g.js} +2 -2
  18. package/dist/web/assets/{breakdown-DLwDPWvA.js → breakdown-DYnVKScr.js} +1 -1
  19. package/dist/web/assets/{button-D767RAip.js → button-CnT5g-Jl.js} +1 -1
  20. package/dist/web/assets/{chart-CylR-9UK.js → chart-Duz9D-nH.js} +1 -1
  21. package/dist/web/assets/{explore-jBA0FMUo.js → explore-P2EolJrt.js} +1 -1
  22. package/dist/web/assets/{index-DMNfKjk7.js → index-9hkGpa7j.js} +12 -12
  23. package/dist/web/assets/{models-B4X_VrrZ.js → models-8B4FBxr7.js} +2 -2
  24. package/dist/web/assets/{overview-E1xtkiJT.js → overview-DXA_HAsw.js} +2 -2
  25. package/dist/web/assets/{panel-Cna_MX7C.js → panel-gxLFBb8y.js} +1 -1
  26. package/dist/web/assets/settings-sheet-CJJl-3Gw.js +1 -0
  27. package/dist/web/assets/{share-sheet-BBs3U9QV.js → share-sheet-CXdyA1ga.js} +1 -1
  28. package/dist/web/assets/{timeline-DAOfy1yc.js → timeline-CzC85trW.js} +1 -1
  29. package/dist/web/index.html +1 -1
  30. package/package.json +1 -1
  31. package/dist/daemon-handle-RHIX5OYY.js +0 -11
  32. package/dist/server-BNZCKS2A.js +0 -12
  33. package/dist/web/assets/settings-sheet-Uba9f8CS.js +0 -1
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  attachOrSpawn
4
- } from "./chunk-NNQGZNX4.js";
5
- import "./chunk-5B3XCEMC.js";
4
+ } from "./chunk-MIXBF6QU.js";
5
+ import "./chunk-WHOIUSJM.js";
6
6
  import "./chunk-UYPDMVW5.js";
7
7
  import {
8
8
  createDaemonRpcClient
9
- } from "./chunk-6YJ5H3JT.js";
9
+ } from "./chunk-RY24UHMK.js";
10
10
  import {
11
11
  PROVIDERS,
12
12
  antigravityStateDb,
@@ -26,13 +26,13 @@ import {
26
26
  startOfMonth,
27
27
  startOfWeek,
28
28
  withTimeout
29
- } from "./chunk-CFKUZCMB.js";
30
- import "./chunk-EEMD2PXA.js";
29
+ } from "./chunk-DESEB73E.js";
30
+ import "./chunk-UON47FYF.js";
31
31
  import {
32
32
  DESKTOP_GRAPH_RANGES,
33
33
  PROVIDER_IDS,
34
34
  configLocation
35
- } from "./chunk-HNWEJ6MS.js";
35
+ } from "./chunk-O7ORALKA.js";
36
36
 
37
37
  // src/provider-locations.ts
38
38
  import { access } from "fs/promises";
@@ -356,6 +356,7 @@ Settings:
356
356
  privacy-key <char>
357
357
  menu-bar-pins <ids|none> Comma-separated provider ids; at most 2
358
358
  menu-bar-text <on|off>
359
+ menu-bar-value <usage|tokens-today>
359
360
  summary-mode <smart|tightest>
360
361
  expanded-providers <ids|none> Comma-separated provider ids
361
362
  active-window <minutes> 1..1440
@@ -457,7 +458,7 @@ var delay = (ms) => new Promise((resolve) => {
457
458
  });
458
459
  async function connectDaemonConfig(timeoutMs) {
459
460
  const handle = await attachOrSpawn({ timeoutMs });
460
- if (handle.kind !== "spawned" || !handle.baseUrl) throw new Error("tokmon daemon is unavailable");
461
+ if (handle.kind !== "spawned" || !handle.baseUrl) throw new Error(handle.issue?.message ?? "tokmon daemon is unavailable");
461
462
  return createDaemonRpcClient(handle.baseUrl, {
462
463
  transport: "node",
463
464
  reconnectAttempts: 2,
@@ -466,7 +467,7 @@ async function connectDaemonConfig(timeoutMs) {
466
467
  }
467
468
  async function fetchDaemonSnapshot(timeoutMs, refresh) {
468
469
  const handle = await attachOrSpawn({ timeoutMs });
469
- if (handle.kind !== "spawned" || !handle.baseUrl) throw new Error("tokmon daemon is unavailable");
470
+ if (handle.kind !== "spawned" || !handle.baseUrl) throw new Error(handle.issue?.message ?? "tokmon daemon is unavailable");
470
471
  const deadline = Date.now() + timeoutMs;
471
472
  if (refresh) {
472
473
  const client = createDaemonRpcClient(handle.baseUrl, {
@@ -514,6 +515,7 @@ var CONFIG_SETTINGS = [
514
515
  "privacy-key",
515
516
  "menu-bar-pins",
516
517
  "menu-bar-text",
518
+ "menu-bar-value",
517
519
  "summary-mode",
518
520
  "expanded-providers",
519
521
  "active-window",
@@ -529,6 +531,7 @@ function configReport(config) {
529
531
  privacyKey: config.privacyToggleKey,
530
532
  menuBarPins: [...config.tray.pinnedProviders],
531
533
  menuBarText: config.tray.showMenuBarText ? "on" : "off",
534
+ menuBarValue: config.tray.menuBarValue === "todayTokens" ? "tokens-today" : "usage",
532
535
  summaryMode: config.tray.displayMetric === "smartHeadroom" ? "smart" : "tightest",
533
536
  expandedProviders: [...config.desktop.expandedProviders],
534
537
  activeWindowMinutes: config.tray.activeTimeoutMin,
@@ -545,6 +548,7 @@ function formatConfigReport(report) {
545
548
  `privacy-key ${report.privacyKey}`,
546
549
  `menu-bar-pins ${list(report.menuBarPins)}`,
547
550
  `menu-bar-text ${report.menuBarText}`,
551
+ `menu-bar-value ${report.menuBarValue}`,
548
552
  `summary-mode ${report.summaryMode}`,
549
553
  `expanded-providers ${list(report.expandedProviders)}`,
550
554
  `active-window ${report.activeWindowMinutes}m`,
@@ -595,6 +599,11 @@ function settingMutation(setting, value) {
595
599
  const enabled2 = onOff(value, setting);
596
600
  return { mutate: (config) => ({ ...config, tray: { ...config.tray, showMenuBarText: enabled2 } }), display: value };
597
601
  }
602
+ if (setting === "menu-bar-value") {
603
+ if (value !== "usage" && value !== "tokens-today") throw new Error("menu-bar-value must be usage or tokens-today");
604
+ const menuBarValue = value === "tokens-today" ? "todayTokens" : "usage";
605
+ return { mutate: (config) => ({ ...config, tray: { ...config.tray, menuBarValue } }), display: value };
606
+ }
598
607
  if (setting === "summary-mode") {
599
608
  if (value !== "smart" && value !== "tightest") throw new Error("summary-mode must be smart or tightest");
600
609
  const displayMetric = value === "smart" ? "smartHeadroom" : "tightestRemaining";
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-4XXKT32M.js");
44
+ const { runQueryCommand } = await import("./cli-command-XPFM6LUP.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-D42FZQC5.js");
63
+ const { runDaemon } = await import("./daemon-KFMXYG7V.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-D42FZQC5.js");
70
+ const { runDaemon } = await import("./daemon-KFMXYG7V.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-3DGZ47F7.js");
118
+ const { loadConfig } = await import("./config-JEDXAKPZ.js");
119
119
  const { resolveGlyphs, setGlyphs } = await import("./glyphs-NKCSZLGO.js");
120
- const { attachOrSpawn } = await import("./daemon-handle-RHIX5OYY.js");
120
+ const { attachOrSpawn } = await import("./daemon-handle-6RYUJPC2.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-RXSGXK7H.js");
131
+ const { bootstrapInk } = await import("./bootstrap-ink-PYYVQAYP.js");
132
132
  await bootstrapInk({ interval, config, daemon, mode });
133
133
  }
134
134
  void main().catch((error) => {
@@ -36,7 +36,7 @@ import {
36
36
  slugify,
37
37
  snapshotCacheFile,
38
38
  toggleProviderSelection
39
- } from "./chunk-HNWEJ6MS.js";
39
+ } from "./chunk-O7ORALKA.js";
40
40
  export {
41
41
  ACCENT_COLORS,
42
42
  COLOR_PALETTE,
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  acquireLock,
4
+ classifyDaemonCompatibility,
5
+ daemonConflictMessage,
4
6
  isAlive,
5
7
  lockfilePath,
6
8
  readForeignLock,
@@ -12,25 +14,25 @@ import {
12
14
  unlinkLock,
13
15
  verifyLock,
14
16
  writeLock
15
- } from "./chunk-5B3XCEMC.js";
17
+ } from "./chunk-WHOIUSJM.js";
16
18
  import {
17
19
  appVersion,
18
20
  startWebServer
19
- } from "./chunk-KLRDULRC.js";
21
+ } from "./chunk-6E2OJCIQ.js";
20
22
  import {
21
23
  resolveDaemonChannel
22
24
  } from "./chunk-UYPDMVW5.js";
23
- import "./chunk-TN6V7XSL.js";
25
+ import "./chunk-BZFDTIFV.js";
24
26
  import {
25
27
  flushDisk
26
- } from "./chunk-CFKUZCMB.js";
28
+ } from "./chunk-DESEB73E.js";
27
29
  import {
28
30
  TOKMON_CAPABILITIES,
29
31
  TOKMON_PROTOCOL_VERSION
30
- } from "./chunk-EEMD2PXA.js";
32
+ } from "./chunk-UON47FYF.js";
31
33
  import {
32
34
  loadConfig
33
- } from "./chunk-HNWEJ6MS.js";
35
+ } from "./chunk-O7ORALKA.js";
34
36
 
35
37
  // src/web/daemon-controller.ts
36
38
  import { randomBytes } from "crypto";
@@ -40,9 +42,13 @@ var OWNER_VERIFY_TIMEOUT_MS = 250;
40
42
  var OWNER_TAKEOVER_TIMEOUT_MS = 5e3;
41
43
  var localOwners = /* @__PURE__ */ new Map();
42
44
  var DaemonOwnerUnavailableError = class extends Error {
43
- constructor(message) {
45
+ owner;
46
+ clientProtocolVersion;
47
+ constructor(message, owner = null, clientProtocolVersion = null) {
44
48
  super(message);
45
49
  this.name = "DaemonOwnerUnavailableError";
50
+ this.owner = owner;
51
+ this.clientProtocolVersion = clientProtocolVersion;
46
52
  }
47
53
  };
48
54
  var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -79,12 +85,31 @@ async function waitForOwner(opts, protocolVersion) {
79
85
  }
80
86
  return null;
81
87
  }
82
- function incompatibleOwnerError(lock) {
83
- if (!lock) return new DaemonOwnerUnavailableError("another legacy CLI daemon owns the lock and could not be retired safely");
88
+ function incompatibleOwnerError(owner, opts, protocolVersion, retirementFailed = false) {
84
89
  return new DaemonOwnerUnavailableError(
85
- `another ${lock.ownerKind} daemon owns the lock but is not compatible with protocol ${lock.protocolVersion}`
90
+ daemonConflictMessage(owner, {
91
+ clientKind: opts.ownerKind,
92
+ clientProtocolVersion: protocolVersion,
93
+ retirementFailed
94
+ }),
95
+ owner,
96
+ protocolVersion
86
97
  );
87
98
  }
99
+ async function retireOrRefuseOwner(owner, opts, protocolVersion) {
100
+ const decision = classifyDaemonCompatibility(owner, protocolVersion);
101
+ if (decision.action !== "retire") {
102
+ throw incompatibleOwnerError(owner, opts, protocolVersion);
103
+ }
104
+ const retired = await retireIncompatibleCliOwner(
105
+ opts,
106
+ protocolVersion,
107
+ opts.ownerTakeoverTimeoutMs ?? OWNER_TAKEOVER_TIMEOUT_MS
108
+ );
109
+ if (!retired) {
110
+ throw incompatibleOwnerError(owner, opts, protocolVersion, true);
111
+ }
112
+ }
88
113
  async function discoverOwner(opts, protocolVersion) {
89
114
  const local = localOwnerFor(opts, protocolVersion);
90
115
  if (local) return local;
@@ -104,25 +129,14 @@ async function discoverOwner(opts, protocolVersion) {
104
129
  current = readLock(opts);
105
130
  }
106
131
  if (current && isAlive(current.pid)) {
107
- const retired = await retireIncompatibleCliOwner(
108
- opts,
109
- protocolVersion,
110
- opts.ownerTakeoverTimeoutMs ?? OWNER_TAKEOVER_TIMEOUT_MS
111
- );
112
- if (retired) return null;
113
- throw incompatibleOwnerError(current);
132
+ await retireOrRefuseOwner(current, opts, protocolVersion);
133
+ return null;
114
134
  }
115
135
  if (current) reclaimDeadLock(opts);
116
136
  const foreign = readForeignLock(opts);
117
137
  if (foreign && isAlive(foreign.pid)) {
118
- if (await retireIncompatibleCliOwner(
119
- opts,
120
- protocolVersion,
121
- opts.ownerTakeoverTimeoutMs ?? OWNER_TAKEOVER_TIMEOUT_MS
122
- )) return null;
123
- throw incompatibleOwnerError(
124
- foreign.ownerKind && foreign.protocolVersion ? { ownerKind: foreign.ownerKind, protocolVersion: foreign.protocolVersion } : null
125
- );
138
+ await retireOrRefuseOwner(foreign, opts, protocolVersion);
139
+ return null;
126
140
  }
127
141
  return null;
128
142
  }
@@ -143,36 +157,23 @@ function reservationFor(opts, version, protocolVersion, capabilities) {
143
157
  };
144
158
  }
145
159
  async function reserveOwnership(opts, reservation) {
146
- if (acquireLock(reservation, opts)) return null;
147
- const winner = await waitForOwner(opts, reservation.protocolVersion);
148
- if (winner) return winner;
149
- const current = readLock(opts);
150
- if (current && isAlive(current.pid)) {
151
- const retired = await retireIncompatibleCliOwner(
152
- opts,
153
- reservation.protocolVersion,
154
- opts.ownerTakeoverTimeoutMs ?? OWNER_TAKEOVER_TIMEOUT_MS
155
- );
156
- if (!retired) throw incompatibleOwnerError(current);
160
+ for (let attempt = 0; attempt < 3; attempt++) {
157
161
  if (acquireLock(reservation, opts)) return null;
158
- const successor2 = await waitForOwner(opts, reservation.protocolVersion);
159
- if (successor2) return successor2;
160
- }
161
- if (current) reclaimDeadLock(opts);
162
- const foreign = readForeignLock(opts);
163
- if (foreign && isAlive(foreign.pid)) {
164
- const retired = await retireIncompatibleCliOwner(
165
- opts,
166
- reservation.protocolVersion,
167
- opts.ownerTakeoverTimeoutMs ?? OWNER_TAKEOVER_TIMEOUT_MS
168
- );
169
- if (!retired) throw incompatibleOwnerError(
170
- foreign.ownerKind && foreign.protocolVersion ? { ownerKind: foreign.ownerKind, protocolVersion: foreign.protocolVersion } : null
171
- );
162
+ const winner = await waitForOwner(opts, reservation.protocolVersion);
163
+ if (winner) return winner;
164
+ const current = readLock(opts);
165
+ if (current && isAlive(current.pid)) {
166
+ await retireOrRefuseOwner(current, opts, reservation.protocolVersion);
167
+ continue;
168
+ }
169
+ if (current) reclaimDeadLock(opts);
170
+ const foreign = readForeignLock(opts);
171
+ if (foreign && isAlive(foreign.pid)) {
172
+ await retireOrRefuseOwner(foreign, opts, reservation.protocolVersion);
173
+ continue;
174
+ }
175
+ reclaimAbandonedLock(opts, 0);
172
176
  }
173
- if (acquireLock(reservation, opts)) return null;
174
- const successor = await waitForOwner(opts, reservation.protocolVersion);
175
- if (successor) return successor;
176
177
  throw new DaemonOwnerUnavailableError("daemon startup is already in progress");
177
178
  }
178
179
  function owned(opts, lock, config, server) {
@@ -212,6 +213,7 @@ async function acquireOrAttachDaemon(opts) {
212
213
  protocolVersion,
213
214
  capabilities
214
215
  );
216
+ await opts.beforeReserve?.();
215
217
  const winner = await reserveOwnership(opts, reservation);
216
218
  if (winner) return attached(winner);
217
219
  let server = null;
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ attachOrSpawn
4
+ } from "./chunk-MIXBF6QU.js";
5
+ import "./chunk-WHOIUSJM.js";
6
+ import "./chunk-UYPDMVW5.js";
7
+ import "./chunk-UON47FYF.js";
8
+ import "./chunk-O7ORALKA.js";
9
+ export {
10
+ attachOrSpawn
11
+ };
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ startWebServer
4
+ } from "./chunk-6E2OJCIQ.js";
5
+ import "./chunk-UYPDMVW5.js";
6
+ import "./chunk-BZFDTIFV.js";
7
+ import "./chunk-DESEB73E.js";
8
+ import "./chunk-UON47FYF.js";
9
+ import "./chunk-O7ORALKA.js";
10
+ export {
11
+ startWebServer
12
+ };
@@ -1,2 +1,2 @@
1
- import{R as v,r as ht}from"./index-DMNfKjk7.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-CylR-9UK.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.
1
+ import{R as v,r as ht}from"./index-9hkGpa7j.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-Duz9D-nH.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-DLwDPWvA.js","./index-DMNfKjk7.js","./index-ZmOS8p9O.css","./chart-CylR-9UK.js","./panel-Cna_MX7C.js","./timeline-DAOfy1yc.js","./Area-DSOnmPHW.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-DMNfKjk7.js";import{P as B}from"./panel-Cna_MX7C.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-DLwDPWvA.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.CostByModel}))),G=x.lazy(()=>w(()=>import("./breakdown-DLwDPWvA.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.ProviderDonut}))),P=x.lazy(()=>w(()=>import("./breakdown-DLwDPWvA.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.TokenComposition}))),U=x.lazy(()=>w(()=>import("./timeline-DAOfy1yc.js"),__vite__mapDeps([5,1,2,3,4,6]),import.meta.url).then(t=>({default:t.CacheSavings}))),K=x.lazy(()=>w(()=>import("./timeline-DAOfy1yc.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
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./breakdown-DYnVKScr.js","./index-9hkGpa7j.js","./index-ZmOS8p9O.css","./chart-Duz9D-nH.js","./panel-gxLFBb8y.js","./timeline-CzC85trW.js","./Area-BqyvRn2x.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-9hkGpa7j.js";import{P as B}from"./panel-gxLFBb8y.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-DYnVKScr.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.CostByModel}))),G=x.lazy(()=>w(()=>import("./breakdown-DYnVKScr.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.ProviderDonut}))),P=x.lazy(()=>w(()=>import("./breakdown-DYnVKScr.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.TokenComposition}))),U=x.lazy(()=>w(()=>import("./timeline-CzC85trW.js"),__vite__mapDeps([5,1,2,3,4,6]),import.meta.url).then(t=>({default:t.CacheSavings}))),K=x.lazy(()=>w(()=>import("./timeline-CzC85trW.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-DMNfKjk7.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-CylR-9UK.js";import{P as de}from"./panel-Cna_MX7C.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.
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-9hkGpa7j.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-Duz9D-nH.js";import{P as de}from"./panel-gxLFBb8y.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-DMNfKjk7.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};
1
+ import{r as b,j as f,F as N,X as S}from"./index-9hkGpa7j.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};