tokmon 0.28.2 → 0.28.4

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 (56) hide show
  1. package/README.md +156 -234
  2. package/THIRD_PARTY_NOTICES.md +62 -0
  3. package/dist/{bootstrap-ink-IMT3S5HU.js → bootstrap-ink-WG4WG3R2.js} +1579 -1136
  4. package/dist/chunk-5B3XCEMC.js +294 -0
  5. package/dist/chunk-7CH6S7BR.js +447 -0
  6. package/dist/{chunk-LCAHTRGP.js → chunk-CFKUZCMB.js} +56 -29
  7. package/dist/{chunk-LKYOWBD4.js → chunk-FLANGRI6.js} +21 -42
  8. package/dist/chunk-HNWEJ6MS.js +1094 -0
  9. package/dist/{chunk-WUK3MQUB.js → chunk-JZSZEHVD.js} +167 -10
  10. package/dist/{chunk-6ZEW2M6P.js → chunk-P57DVFNH.js} +125 -25
  11. package/dist/chunk-TN6V7XSL.js +512 -0
  12. package/dist/chunk-UYPDMVW5.js +21 -0
  13. package/dist/{cli-command-DCENRCO3.js → cli-command-I4GRR3MF.js} +249 -15
  14. package/dist/cli.js +6 -6
  15. package/dist/{config-HXFJTNLM.js → config-3DGZ47F7.js} +23 -3
  16. package/dist/daemon-ZXV3V5CS.js +384 -0
  17. package/dist/daemon-handle-G4OGPFR3.js +11 -0
  18. package/dist/server-EPSH52DR.js +12 -0
  19. package/dist/web/assets/{Area-CMXvOw33.js → Area-stRnp8Km.js} +1 -1
  20. package/dist/web/assets/analytics-moZZt9L_.js +2 -0
  21. package/dist/web/assets/breakdown-km9w7myU.js +4 -0
  22. package/dist/web/assets/button-DrX04Cc2.js +1 -0
  23. package/dist/web/assets/{chart-cZoLgpmG.js → chart-D0CtuL2k.js} +1 -1
  24. package/dist/web/assets/explore-B11uNJV1.js +22 -0
  25. package/dist/web/assets/index-RDhXsCNG.js +83 -0
  26. package/dist/web/assets/index-ZmOS8p9O.css +1 -0
  27. package/dist/web/assets/models-DYbZnY34.js +2 -0
  28. package/dist/web/assets/overview-CruICbfJ.js +2 -0
  29. package/dist/web/assets/panel-xckM3_GC.js +1 -0
  30. package/dist/web/assets/settings-sheet-G-BTSIF6.js +1 -0
  31. package/dist/web/assets/share-sheet-weIdd4DW.js +2 -0
  32. package/dist/web/assets/timeline-BHgniliZ.js +1 -0
  33. package/dist/web/index.html +30 -4
  34. package/package.json +13 -4
  35. package/site/THIRD_PARTY_NOTICES.md +83 -0
  36. package/site/public/fonts/OFL.txt +93 -0
  37. package/dist/chunk-44ZSQEOS.js +0 -299
  38. package/dist/chunk-HP5UZCXP.js +0 -436
  39. package/dist/chunk-J3JW3RFP.js +0 -196
  40. package/dist/chunk-M7XMV36F.js +0 -275
  41. package/dist/daemon-6Y4O7NXS.js +0 -241
  42. package/dist/daemon-handle-GVCYVDPO.js +0 -10
  43. package/dist/server-GXXOWUVZ.js +0 -11
  44. package/dist/web/assets/analytics-DqdZXOJL.js +0 -2
  45. package/dist/web/assets/breakdown-kOSSJ3mI.js +0 -4
  46. package/dist/web/assets/explore-vcsM8K9I.js +0 -22
  47. package/dist/web/assets/index-BErCXT7f.css +0 -1
  48. package/dist/web/assets/index-DH3dOnbg.js +0 -83
  49. package/dist/web/assets/models-B5ikm83_.js +0 -2
  50. package/dist/web/assets/overview-DD1kP8CP.js +0 -2
  51. package/dist/web/assets/panel-DTQBwExW.js +0 -1
  52. package/dist/web/assets/primitives-C36qJlA2.js +0 -1
  53. package/dist/web/assets/settings-sheet-_i2zTQjf.js +0 -1
  54. package/dist/web/assets/share-sheet-BLHmrFbm.js +0 -2
  55. package/dist/web/assets/timeline-B4uG-Emo.js +0 -1
  56. package/dist/web/assets/use-dialog-trap-bfaXEMz9.js +0 -1
@@ -0,0 +1,384 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ acquireLock,
4
+ isAlive,
5
+ lockfilePath,
6
+ readForeignLock,
7
+ readLock,
8
+ reclaimAbandonedLock,
9
+ reclaimDeadLock,
10
+ reclaimUnhealthyLock,
11
+ retireIncompatibleCliOwner,
12
+ unlinkLock,
13
+ verifyLock,
14
+ writeLock
15
+ } from "./chunk-5B3XCEMC.js";
16
+ import {
17
+ appVersion,
18
+ startWebServer
19
+ } from "./chunk-P57DVFNH.js";
20
+ import {
21
+ resolveDaemonChannel
22
+ } from "./chunk-UYPDMVW5.js";
23
+ import "./chunk-TN6V7XSL.js";
24
+ import {
25
+ flushDisk
26
+ } from "./chunk-CFKUZCMB.js";
27
+ import {
28
+ TOKMON_CAPABILITIES,
29
+ TOKMON_PROTOCOL_VERSION
30
+ } from "./chunk-JZSZEHVD.js";
31
+ import {
32
+ loadConfig
33
+ } from "./chunk-HNWEJ6MS.js";
34
+
35
+ // src/web/daemon-controller.ts
36
+ import { randomBytes } from "crypto";
37
+ var OWNER_WAIT_ATTEMPTS = 60;
38
+ var OWNER_WAIT_INTERVAL_MS = 50;
39
+ var OWNER_VERIFY_TIMEOUT_MS = 250;
40
+ var OWNER_TAKEOVER_TIMEOUT_MS = 5e3;
41
+ var localOwners = /* @__PURE__ */ new Map();
42
+ var DaemonOwnerUnavailableError = class extends Error {
43
+ constructor(message) {
44
+ super(message);
45
+ this.name = "DaemonOwnerUnavailableError";
46
+ }
47
+ };
48
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
49
+ function localOwnerFor(opts, protocolVersion) {
50
+ const owner = localOwners.get(lockfilePath(opts));
51
+ if (owner?.stopping) {
52
+ throw new DaemonOwnerUnavailableError("the in-process daemon owner is shutting down");
53
+ }
54
+ return owner && owner.lock.protocolVersion === protocolVersion ? owner.lock : null;
55
+ }
56
+ function attached(lock) {
57
+ return {
58
+ role: "attached",
59
+ baseUrl: lock.url,
60
+ lock,
61
+ config: null,
62
+ stop: async () => {
63
+ }
64
+ };
65
+ }
66
+ async function waitForOwner(opts, protocolVersion) {
67
+ const attempts = opts.ownerWaitAttempts ?? OWNER_WAIT_ATTEMPTS;
68
+ const intervalMs = opts.ownerWaitIntervalMs ?? OWNER_WAIT_INTERVAL_MS;
69
+ const verifyTimeoutMs = opts.ownerVerifyTimeoutMs ?? OWNER_VERIFY_TIMEOUT_MS;
70
+ for (let attempt = 0; attempt < attempts; attempt++) {
71
+ if (intervalMs > 0) await delay(intervalMs);
72
+ const local = localOwnerFor(opts, protocolVersion);
73
+ if (local) return local;
74
+ const current = readLock(opts);
75
+ const winner = await verifyLock(current, protocolVersion, verifyTimeoutMs);
76
+ if (winner) return winner;
77
+ if (!current || !isAlive(current.pid)) return null;
78
+ if (current.protocolVersion !== protocolVersion) return null;
79
+ }
80
+ return null;
81
+ }
82
+ function incompatibleOwnerError(lock) {
83
+ if (!lock) return new DaemonOwnerUnavailableError("another legacy CLI daemon owns the lock and could not be retired safely");
84
+ return new DaemonOwnerUnavailableError(
85
+ `another ${lock.ownerKind} daemon owns the lock but is not compatible with protocol ${lock.protocolVersion}`
86
+ );
87
+ }
88
+ async function discoverOwner(opts, protocolVersion) {
89
+ const local = localOwnerFor(opts, protocolVersion);
90
+ if (local) return local;
91
+ let current = readLock(opts);
92
+ if (!current && reclaimAbandonedLock(opts)) current = readLock(opts);
93
+ const live = await verifyLock(current, protocolVersion);
94
+ if (live) return live;
95
+ if (current?.state === "ready" && current.protocolVersion === protocolVersion && isAlive(current.pid)) {
96
+ const winner = await waitForOwner(opts, protocolVersion);
97
+ if (winner) return winner;
98
+ if (reclaimUnhealthyLock(current, opts)) return null;
99
+ current = readLock(opts);
100
+ }
101
+ if (current?.state === "starting" && current.protocolVersion === protocolVersion && isAlive(current.pid)) {
102
+ const winner = await waitForOwner(opts, protocolVersion);
103
+ if (winner) return winner;
104
+ current = readLock(opts);
105
+ }
106
+ 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);
114
+ }
115
+ if (current) reclaimDeadLock(opts);
116
+ const foreign = readForeignLock(opts);
117
+ 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
+ );
126
+ }
127
+ return null;
128
+ }
129
+ function reservationFor(opts, version, protocolVersion, capabilities) {
130
+ return {
131
+ pid: process.pid,
132
+ port: 0,
133
+ url: "",
134
+ wsToken: randomBytes(32).toString("base64url"),
135
+ version,
136
+ protocolVersion,
137
+ capabilities: [...capabilities],
138
+ ownerKind: opts.ownerKind,
139
+ channel: resolveDaemonChannel(opts.channel),
140
+ startedAt: Date.now(),
141
+ ownerId: randomBytes(32).toString("base64url"),
142
+ state: "starting"
143
+ };
144
+ }
145
+ 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);
157
+ 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
+ );
172
+ }
173
+ if (acquireLock(reservation, opts)) return null;
174
+ const successor = await waitForOwner(opts, reservation.protocolVersion);
175
+ if (successor) return successor;
176
+ throw new DaemonOwnerUnavailableError("daemon startup is already in progress");
177
+ }
178
+ function owned(opts, lock, config, server) {
179
+ let stopPromise = null;
180
+ const owner = { lock, stopping: false };
181
+ const ownerKey = lockfilePath(opts);
182
+ localOwners.set(ownerKey, owner);
183
+ return {
184
+ role: "owner",
185
+ baseUrl: lock.url,
186
+ lock,
187
+ config,
188
+ stop: () => {
189
+ stopPromise ??= (async () => {
190
+ owner.stopping = true;
191
+ try {
192
+ await server.stop();
193
+ } catch {
194
+ }
195
+ await flushDisk().catch(() => {
196
+ });
197
+ unlinkLock(lock.ownerId, opts);
198
+ if (localOwners.get(ownerKey) === owner) localOwners.delete(ownerKey);
199
+ })();
200
+ return stopPromise;
201
+ }
202
+ };
203
+ }
204
+ async function acquireOrAttachDaemon(opts) {
205
+ const protocolVersion = opts.protocolVersion ?? TOKMON_PROTOCOL_VERSION;
206
+ const capabilities = opts.capabilities ?? TOKMON_CAPABILITIES;
207
+ const existing = await discoverOwner(opts, protocolVersion);
208
+ if (existing) return attached(existing);
209
+ const reservation = reservationFor(
210
+ opts,
211
+ opts.version ?? appVersion(),
212
+ protocolVersion,
213
+ capabilities
214
+ );
215
+ const winner = await reserveOwnership(opts, reservation);
216
+ if (winner) return attached(winner);
217
+ let server = null;
218
+ try {
219
+ const config = opts.config ?? await loadConfig();
220
+ server = await startWebServer({
221
+ config,
222
+ port: opts.port,
223
+ log: opts.log,
224
+ webRoot: opts.webRoot,
225
+ version: reservation.version,
226
+ wsToken: reservation.wsToken,
227
+ ownerKind: reservation.ownerKind,
228
+ channel: reservation.channel,
229
+ protocolVersion: reservation.protocolVersion,
230
+ capabilities: reservation.capabilities
231
+ });
232
+ const ready = {
233
+ ...reservation,
234
+ port: server.port,
235
+ url: server.url,
236
+ state: "ready"
237
+ };
238
+ if (!writeLock(ready, opts)) throw new Error("lost daemon lock ownership during startup");
239
+ return owned(opts, ready, config, server);
240
+ } catch (error) {
241
+ try {
242
+ await server?.stop();
243
+ } catch {
244
+ }
245
+ unlinkLock(reservation.ownerId, opts);
246
+ throw error;
247
+ }
248
+ }
249
+
250
+ // src/web/open.ts
251
+ import { spawn } from "child_process";
252
+ import { appendFileSync } from "fs";
253
+ function openBrowser(url) {
254
+ const target = url;
255
+ if (process.env.TOKMON_OPENLOG) {
256
+ try {
257
+ appendFileSync(process.env.TOKMON_OPENLOG, target + "\n");
258
+ } catch {
259
+ }
260
+ return;
261
+ }
262
+ try {
263
+ if (process.platform === "darwin") {
264
+ spawn("open", [target], { stdio: "ignore", detached: true }).unref();
265
+ } else if (process.platform === "win32") {
266
+ spawn("cmd", ["/c", "start", "", target], { stdio: "ignore", detached: true }).unref();
267
+ } else {
268
+ spawn("xdg-open", [target], { stdio: "ignore", detached: true }).unref();
269
+ }
270
+ } catch {
271
+ }
272
+ }
273
+
274
+ // src/web/daemon.ts
275
+ function parseDaemonArgs(args) {
276
+ let port;
277
+ let open = true;
278
+ let help = false;
279
+ for (let i = 0; i < args.length; i++) {
280
+ const arg = args[i];
281
+ if ((arg === "--port" || arg === "-p") && args[i + 1]) port = Number(args[++i]);
282
+ else if (arg.startsWith("--port=")) port = Number(arg.slice("--port=".length));
283
+ else if (arg === "--no-open") open = false;
284
+ else if (arg === "--help" || arg === "-h") help = true;
285
+ }
286
+ if (port !== void 0 && (!Number.isInteger(port) || port < 0 || port > 65535)) port = void 0;
287
+ return { port, open, help };
288
+ }
289
+ var SERVE_HELP = `tokmon serve - Launch the tokmon web dashboard
290
+
291
+ Usage: tokmon serve [options]
292
+
293
+ Options:
294
+ -p, --port <n> Port to listen on (default: 4317, auto-falls back if taken)
295
+ --no-open Don't open the browser automatically
296
+ -h, --help Show this help
297
+ `;
298
+ function handshake(lock) {
299
+ process.stdout.write(JSON.stringify({
300
+ ready: 1,
301
+ url: lock.url,
302
+ port: lock.port,
303
+ wsToken: lock.wsToken,
304
+ version: lock.version,
305
+ protocolVersion: lock.protocolVersion,
306
+ capabilities: lock.capabilities,
307
+ ownerKind: lock.ownerKind,
308
+ channel: lock.channel
309
+ }) + "\n");
310
+ }
311
+ function describeExisting(lock, open) {
312
+ process.stdout.write(`
313
+ \u25C6 tokmon web \u2192 ${lock.url}
314
+ `);
315
+ process.stdout.write(" reusing the live singleton daemon\n\n");
316
+ if (open) {
317
+ openBrowser(lock.url);
318
+ process.stdout.write(" opening browser\u2026\n");
319
+ }
320
+ }
321
+ async function runDaemon(args, opts) {
322
+ const { port, open, help } = parseDaemonArgs(args);
323
+ if (help && opts.foreground) {
324
+ process.stdout.write(SERVE_HELP);
325
+ return;
326
+ }
327
+ let daemon;
328
+ try {
329
+ daemon = await acquireOrAttachDaemon({
330
+ ownerKind: "cli",
331
+ port,
332
+ log: opts.foreground
333
+ });
334
+ } catch (error) {
335
+ const message = `tokmon: failed to start web server: ${error.message}`;
336
+ if (opts.foreground) {
337
+ process.stderr.write(message + "\n");
338
+ process.exitCode = 1;
339
+ }
340
+ return;
341
+ }
342
+ if (daemon.role === "attached") {
343
+ if (opts.foreground) describeExisting(daemon.lock, open);
344
+ else handshake(daemon.lock);
345
+ return;
346
+ }
347
+ let shuttingDown = false;
348
+ const shutdown = async (exitCode = 0) => {
349
+ if (shuttingDown) return;
350
+ shuttingDown = true;
351
+ if (opts.foreground) process.stdout.write("\n stopping tokmon web\u2026\n");
352
+ await daemon.stop();
353
+ process.exit(exitCode);
354
+ };
355
+ process.once("exit", () => {
356
+ unlinkLock(daemon.lock.ownerId);
357
+ });
358
+ process.once("SIGINT", () => {
359
+ void shutdown(0);
360
+ });
361
+ process.once("SIGTERM", () => {
362
+ void shutdown(0);
363
+ });
364
+ if (opts.foreground) {
365
+ process.stdout.write(`
366
+ \u25C6 tokmon web \u2192 ${daemon.baseUrl}
367
+ `);
368
+ process.stdout.write(" live dashboard \xB7 Ctrl-C to stop\n\n");
369
+ if (daemon.config?.allowNetworkAccess) {
370
+ process.stdout.write(" \u26A0 unsafe network access enabled \u2014 dashboard is reachable from your LAN\n\n");
371
+ }
372
+ if (open) {
373
+ openBrowser(daemon.baseUrl);
374
+ process.stdout.write(" opening browser\u2026\n");
375
+ }
376
+ } else {
377
+ handshake(daemon.lock);
378
+ }
379
+ await new Promise(() => {
380
+ });
381
+ }
382
+ export {
383
+ runDaemon
384
+ };
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ attachOrSpawn
4
+ } from "./chunk-FLANGRI6.js";
5
+ import "./chunk-5B3XCEMC.js";
6
+ import "./chunk-UYPDMVW5.js";
7
+ import "./chunk-JZSZEHVD.js";
8
+ import "./chunk-HNWEJ6MS.js";
9
+ export {
10
+ attachOrSpawn
11
+ };
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ startWebServer
4
+ } from "./chunk-P57DVFNH.js";
5
+ import "./chunk-UYPDMVW5.js";
6
+ import "./chunk-TN6V7XSL.js";
7
+ import "./chunk-CFKUZCMB.js";
8
+ import "./chunk-JZSZEHVD.js";
9
+ import "./chunk-HNWEJ6MS.js";
10
+ export {
11
+ startWebServer
12
+ };
@@ -1,2 +1,2 @@
1
- import{R as v,r as ht}from"./index-DH3dOnbg.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-cZoLgpmG.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-RDhXsCNG.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-D0CtuL2k.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};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./breakdown-km9w7myU.js","./index-RDhXsCNG.js","./index-ZmOS8p9O.css","./chart-D0CtuL2k.js","./panel-xckM3_GC.js","./timeline-BHgniliZ.js","./Area-stRnp8Km.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-RDhXsCNG.js";import{P as B}from"./panel-xckM3_GC.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-km9w7myU.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.CostByModel}))),G=x.lazy(()=>w(()=>import("./breakdown-km9w7myU.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.ProviderDonut}))),P=x.lazy(()=>w(()=>import("./breakdown-km9w7myU.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(t=>({default:t.TokenComposition}))),U=x.lazy(()=>w(()=>import("./timeline-BHgniliZ.js"),__vite__mapDeps([5,1,2,3,4,6]),import.meta.url).then(t=>({default:t.CacheSavings}))),K=x.lazy(()=>w(()=>import("./timeline-BHgniliZ.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};
@@ -0,0 +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-RDhXsCNG.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-D0CtuL2k.js";import{P as de}from"./panel-xckM3_GC.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
+ 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
+ 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
+ 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};
@@ -0,0 +1 @@
1
+ import{r as b,j as f,F as N,X as S}from"./index-RDhXsCNG.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,4 +1,4 @@
1
- import{a5 as Kn,l as ue,r as N,R as T,j as ot,e as Zx}from"./index-DH3dOnbg.js";function Lm(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Lm(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function te(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Lm(e))&&(n&&(n+=" "),n+=t);return n}var Na,oh;function Re(){if(oh)return Na;oh=1;var e=Array.isArray;return Na=e,Na}var qa,uh;function Fm(){if(uh)return qa;uh=1;var e=typeof Kn=="object"&&Kn&&Kn.Object===Object&&Kn;return qa=e,qa}var Ba,ch;function it(){if(ch)return Ba;ch=1;var e=Fm(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ba=r,Ba}var La,sh;function Nn(){if(sh)return La;sh=1;var e=it(),t=e.Symbol;return La=t,La}var Fa,lh;function Jx(){if(lh)return Fa;lh=1;var e=Nn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),c=o[i];try{o[i]=void 0;var s=!0}catch{}var f=n.call(o);return s&&(u?o[i]=c:delete o[i]),f}return Fa=a,Fa}var Ua,fh;function Qx(){if(fh)return Ua;fh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Ua=r,Ua}var za,hh;function mt(){if(hh)return za;hh=1;var e=Nn(),t=Jx(),r=Qx(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return za=o,za}var Wa,ph;function bt(){if(ph)return Wa;ph=1;function e(t){return t!=null&&typeof t=="object"}return Wa=e,Wa}var Ha,dh;function $r(){if(dh)return Ha;dh=1;var e=mt(),t=bt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Ha=n,Ha}var Ga,vh;function Ql(){if(vh)return Ga;vh=1;var e=Re(),t=$r(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Ga=i,Ga}var Ka,yh;function Tt(){if(yh)return Ka;yh=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Ka=e,Ka}var Xa,gh;function ef(){if(gh)return Xa;gh=1;var e=mt(),t=Tt(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var c=e(u);return c==n||c==i||c==r||c==a}return Xa=o,Xa}var Va,mh;function ew(){if(mh)return Va;mh=1;var e=it(),t=e["__core-js_shared__"];return Va=t,Va}var Ya,bh;function tw(){if(bh)return Ya;bh=1;var e=ew(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return Ya=r,Ya}var Za,xh;function Um(){if(xh)return Za;xh=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Za=r,Za}var Ja,wh;function rw(){if(wh)return Ja;wh=1;var e=ef(),t=tw(),r=Tt(),n=Um(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,c=o.toString,s=u.hasOwnProperty,f=RegExp("^"+c.call(s).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var d=e(h)?f:a;return d.test(n(h))}return Ja=l,Ja}var Qa,Oh;function nw(){if(Oh)return Qa;Oh=1;function e(t,r){return t==null?void 0:t[r]}return Qa=e,Qa}var eo,_h;function Vt(){if(_h)return eo;_h=1;var e=rw(),t=nw();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return eo=r,eo}var to,Sh;function ia(){if(Sh)return to;Sh=1;var e=Vt(),t=e(Object,"create");return to=t,to}var ro,Ah;function iw(){if(Ah)return ro;Ah=1;var e=ia();function t(){this.__data__=e?e(null):{},this.size=0}return ro=t,ro}var no,Ph;function aw(){if(Ph)return no;Ph=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return no=e,no}var io,Th;function ow(){if(Th)return io;Th=1;var e=ia(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return io=i,io}var ao,Eh;function uw(){if(Eh)return ao;Eh=1;var e=ia(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return ao=n,ao}var oo,jh;function cw(){if(jh)return oo;jh=1;var e=ia(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return oo=r,oo}var uo,Mh;function sw(){if(Mh)return uo;Mh=1;var e=iw(),t=aw(),r=ow(),n=uw(),i=cw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u<c;){var s=o[u];this.set(s[0],s[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,uo=a,uo}var co,Ch;function lw(){if(Ch)return co;Ch=1;function e(){this.__data__=[],this.size=0}return co=e,co}var so,$h;function tf(){if($h)return so;$h=1;function e(t,r){return t===r||t!==t&&r!==r}return so=e,so}var lo,Ih;function aa(){if(Ih)return lo;Ih=1;var e=tf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return lo=t,lo}var fo,Rh;function fw(){if(Rh)return fo;Rh=1;var e=aa(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return fo=n,fo}var ho,kh;function hw(){if(kh)return ho;kh=1;var e=aa();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return ho=t,ho}var po,Dh;function pw(){if(Dh)return po;Dh=1;var e=aa();function t(r){return e(this.__data__,r)>-1}return po=t,po}var vo,Nh;function dw(){if(Nh)return vo;Nh=1;var e=aa();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return vo=t,vo}var yo,qh;function oa(){if(qh)return yo;qh=1;var e=lw(),t=fw(),r=hw(),n=pw(),i=dw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u<c;){var s=o[u];this.set(s[0],s[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,yo=a,yo}var go,Bh;function rf(){if(Bh)return go;Bh=1;var e=Vt(),t=it(),r=e(t,"Map");return go=r,go}var mo,Lh;function vw(){if(Lh)return mo;Lh=1;var e=sw(),t=oa(),r=rf();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return mo=n,mo}var bo,Fh;function yw(){if(Fh)return bo;Fh=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return bo=e,bo}var xo,Uh;function ua(){if(Uh)return xo;Uh=1;var e=yw();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return xo=t,xo}var wo,zh;function gw(){if(zh)return wo;zh=1;var e=ua();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return wo=t,wo}var Oo,Wh;function mw(){if(Wh)return Oo;Wh=1;var e=ua();function t(r){return e(this,r).get(r)}return Oo=t,Oo}var _o,Hh;function bw(){if(Hh)return _o;Hh=1;var e=ua();function t(r){return e(this,r).has(r)}return _o=t,_o}var So,Gh;function xw(){if(Gh)return So;Gh=1;var e=ua();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return So=t,So}var Ao,Kh;function nf(){if(Kh)return Ao;Kh=1;var e=vw(),t=gw(),r=mw(),n=bw(),i=xw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u<c;){var s=o[u];this.set(s[0],s[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Ao=a,Ao}var Po,Xh;function zm(){if(Xh)return Po;Xh=1;var e=nf(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],c=a.cache;if(c.has(u))return c.get(u);var s=n.apply(this,o);return a.cache=c.set(u,s)||c,s};return a.cache=new(r.Cache||e),a}return r.Cache=e,Po=r,Po}var To,Vh;function ww(){if(Vh)return To;Vh=1;var e=zm(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return To=r,To}var Eo,Yh;function Ow(){if(Yh)return Eo;Yh=1;var e=ww(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,u,c,s){a.push(c?s.replace(r,"$1"):u||o)}),a});return Eo=n,Eo}var jo,Zh;function af(){if(Zh)return jo;Zh=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return jo=e,jo}var Mo,Jh;function _w(){if(Jh)return Mo;Jh=1;var e=Nn(),t=af(),r=Re(),n=$r(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var c=u+"";return c=="0"&&1/u==-1/0?"-0":c}return Mo=o,Mo}var Co,Qh;function Wm(){if(Qh)return Co;Qh=1;var e=_w();function t(r){return r==null?"":e(r)}return Co=t,Co}var $o,ep;function Hm(){if(ep)return $o;ep=1;var e=Re(),t=Ql(),r=Ow(),n=Wm();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return $o=i,$o}var Io,tp;function ca(){if(tp)return Io;tp=1;var e=$r();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Io=t,Io}var Ro,rp;function of(){if(rp)return Ro;rp=1;var e=Hm(),t=ca();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return Ro=r,Ro}var ko,np;function Gm(){if(np)return ko;np=1;var e=of();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return ko=t,ko}var Sw=Gm();const ze=ue(Sw);var Do,ip;function Aw(){if(ip)return Do;ip=1;function e(t){return t==null}return Do=e,Do}var Pw=Aw();const Z=ue(Pw);var No,ap;function Tw(){if(ap)return No;ap=1;var e=mt(),t=Re(),r=bt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return No=i,No}var Ew=Tw();const Ht=ue(Ew);var jw=ef();const Y=ue(jw);var Mw=Tt();const Ir=ue(Mw);var qo={exports:{}},re={};/**
1
+ import{aA as Kn,x as ue,r as N,R as T,j as ot,l as Zx}from"./index-RDhXsCNG.js";function Lm(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=Lm(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function te(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=Lm(e))&&(n&&(n+=" "),n+=t);return n}var Na,oh;function Re(){if(oh)return Na;oh=1;var e=Array.isArray;return Na=e,Na}var qa,uh;function Fm(){if(uh)return qa;uh=1;var e=typeof Kn=="object"&&Kn&&Kn.Object===Object&&Kn;return qa=e,qa}var Ba,ch;function it(){if(ch)return Ba;ch=1;var e=Fm(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ba=r,Ba}var La,sh;function Nn(){if(sh)return La;sh=1;var e=it(),t=e.Symbol;return La=t,La}var Fa,lh;function Jx(){if(lh)return Fa;lh=1;var e=Nn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),c=o[i];try{o[i]=void 0;var s=!0}catch{}var f=n.call(o);return s&&(u?o[i]=c:delete o[i]),f}return Fa=a,Fa}var Ua,fh;function Qx(){if(fh)return Ua;fh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Ua=r,Ua}var za,hh;function mt(){if(hh)return za;hh=1;var e=Nn(),t=Jx(),r=Qx(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return za=o,za}var Wa,ph;function bt(){if(ph)return Wa;ph=1;function e(t){return t!=null&&typeof t=="object"}return Wa=e,Wa}var Ha,dh;function $r(){if(dh)return Ha;dh=1;var e=mt(),t=bt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Ha=n,Ha}var Ga,vh;function Ql(){if(vh)return Ga;vh=1;var e=Re(),t=$r(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Ga=i,Ga}var Ka,yh;function Tt(){if(yh)return Ka;yh=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Ka=e,Ka}var Xa,gh;function ef(){if(gh)return Xa;gh=1;var e=mt(),t=Tt(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var c=e(u);return c==n||c==i||c==r||c==a}return Xa=o,Xa}var Va,mh;function ew(){if(mh)return Va;mh=1;var e=it(),t=e["__core-js_shared__"];return Va=t,Va}var Ya,bh;function tw(){if(bh)return Ya;bh=1;var e=ew(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return Ya=r,Ya}var Za,xh;function Um(){if(xh)return Za;xh=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Za=r,Za}var Ja,wh;function rw(){if(wh)return Ja;wh=1;var e=ef(),t=tw(),r=Tt(),n=Um(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,c=o.toString,s=u.hasOwnProperty,f=RegExp("^"+c.call(s).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var d=e(h)?f:a;return d.test(n(h))}return Ja=l,Ja}var Qa,Oh;function nw(){if(Oh)return Qa;Oh=1;function e(t,r){return t==null?void 0:t[r]}return Qa=e,Qa}var eo,_h;function Vt(){if(_h)return eo;_h=1;var e=rw(),t=nw();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return eo=r,eo}var to,Sh;function ia(){if(Sh)return to;Sh=1;var e=Vt(),t=e(Object,"create");return to=t,to}var ro,Ah;function iw(){if(Ah)return ro;Ah=1;var e=ia();function t(){this.__data__=e?e(null):{},this.size=0}return ro=t,ro}var no,Ph;function aw(){if(Ph)return no;Ph=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return no=e,no}var io,Th;function ow(){if(Th)return io;Th=1;var e=ia(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return io=i,io}var ao,Eh;function uw(){if(Eh)return ao;Eh=1;var e=ia(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return ao=n,ao}var oo,jh;function cw(){if(jh)return oo;jh=1;var e=ia(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return oo=r,oo}var uo,Mh;function sw(){if(Mh)return uo;Mh=1;var e=iw(),t=aw(),r=ow(),n=uw(),i=cw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u<c;){var s=o[u];this.set(s[0],s[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,uo=a,uo}var co,Ch;function lw(){if(Ch)return co;Ch=1;function e(){this.__data__=[],this.size=0}return co=e,co}var so,$h;function tf(){if($h)return so;$h=1;function e(t,r){return t===r||t!==t&&r!==r}return so=e,so}var lo,Ih;function aa(){if(Ih)return lo;Ih=1;var e=tf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return lo=t,lo}var fo,Rh;function fw(){if(Rh)return fo;Rh=1;var e=aa(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var u=a.length-1;return o==u?a.pop():r.call(a,o,1),--this.size,!0}return fo=n,fo}var ho,kh;function hw(){if(kh)return ho;kh=1;var e=aa();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return ho=t,ho}var po,Dh;function pw(){if(Dh)return po;Dh=1;var e=aa();function t(r){return e(this.__data__,r)>-1}return po=t,po}var vo,Nh;function dw(){if(Nh)return vo;Nh=1;var e=aa();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return vo=t,vo}var yo,qh;function oa(){if(qh)return yo;qh=1;var e=lw(),t=fw(),r=hw(),n=pw(),i=dw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u<c;){var s=o[u];this.set(s[0],s[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,yo=a,yo}var go,Bh;function rf(){if(Bh)return go;Bh=1;var e=Vt(),t=it(),r=e(t,"Map");return go=r,go}var mo,Lh;function vw(){if(Lh)return mo;Lh=1;var e=sw(),t=oa(),r=rf();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return mo=n,mo}var bo,Fh;function yw(){if(Fh)return bo;Fh=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return bo=e,bo}var xo,Uh;function ua(){if(Uh)return xo;Uh=1;var e=yw();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return xo=t,xo}var wo,zh;function gw(){if(zh)return wo;zh=1;var e=ua();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return wo=t,wo}var Oo,Wh;function mw(){if(Wh)return Oo;Wh=1;var e=ua();function t(r){return e(this,r).get(r)}return Oo=t,Oo}var _o,Hh;function bw(){if(Hh)return _o;Hh=1;var e=ua();function t(r){return e(this,r).has(r)}return _o=t,_o}var So,Gh;function xw(){if(Gh)return So;Gh=1;var e=ua();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return So=t,So}var Ao,Kh;function nf(){if(Kh)return Ao;Kh=1;var e=vw(),t=gw(),r=mw(),n=bw(),i=xw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u<c;){var s=o[u];this.set(s[0],s[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Ao=a,Ao}var Po,Xh;function zm(){if(Xh)return Po;Xh=1;var e=nf(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,u=i?i.apply(this,o):o[0],c=a.cache;if(c.has(u))return c.get(u);var s=n.apply(this,o);return a.cache=c.set(u,s)||c,s};return a.cache=new(r.Cache||e),a}return r.Cache=e,Po=r,Po}var To,Vh;function ww(){if(Vh)return To;Vh=1;var e=zm(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return To=r,To}var Eo,Yh;function Ow(){if(Yh)return Eo;Yh=1;var e=ww(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,u,c,s){a.push(c?s.replace(r,"$1"):u||o)}),a});return Eo=n,Eo}var jo,Zh;function af(){if(Zh)return jo;Zh=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return jo=e,jo}var Mo,Jh;function _w(){if(Jh)return Mo;Jh=1;var e=Nn(),t=af(),r=Re(),n=$r(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(u){if(typeof u=="string")return u;if(r(u))return t(u,o)+"";if(n(u))return a?a.call(u):"";var c=u+"";return c=="0"&&1/u==-1/0?"-0":c}return Mo=o,Mo}var Co,Qh;function Wm(){if(Qh)return Co;Qh=1;var e=_w();function t(r){return r==null?"":e(r)}return Co=t,Co}var $o,ep;function Hm(){if(ep)return $o;ep=1;var e=Re(),t=Ql(),r=Ow(),n=Wm();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return $o=i,$o}var Io,tp;function ca(){if(tp)return Io;tp=1;var e=$r();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Io=t,Io}var Ro,rp;function of(){if(rp)return Ro;rp=1;var e=Hm(),t=ca();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return Ro=r,Ro}var ko,np;function Gm(){if(np)return ko;np=1;var e=of();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return ko=t,ko}var Sw=Gm();const ze=ue(Sw);var Do,ip;function Aw(){if(ip)return Do;ip=1;function e(t){return t==null}return Do=e,Do}var Pw=Aw();const Z=ue(Pw);var No,ap;function Tw(){if(ap)return No;ap=1;var e=mt(),t=Re(),r=bt(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return No=i,No}var Ew=Tw();const Ht=ue(Ew);var jw=ef();const Y=ue(jw);var Mw=Tt();const Ir=ue(Mw);var qo={exports:{}},re={};/**
2
2
  * @license React
3
3
  * react-is.production.min.js
4
4
  *