universal-adaptive-bars 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3863 @@
1
+ import Qn, { useMemo as re, useState as ce, useEffect as Ot } from "react";
2
+ var Fe = { exports: {} }, ke = {};
3
+ var _t;
4
+ function Zn() {
5
+ if (_t) return ke;
6
+ _t = 1;
7
+ var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
8
+ function n(r, a, o) {
9
+ var i = null;
10
+ if (o !== void 0 && (i = "" + o), a.key !== void 0 && (i = "" + a.key), "key" in a) {
11
+ o = {};
12
+ for (var s in a)
13
+ s !== "key" && (o[s] = a[s]);
14
+ } else o = a;
15
+ return a = o.ref, {
16
+ $$typeof: e,
17
+ type: r,
18
+ key: i,
19
+ ref: a !== void 0 ? a : null,
20
+ props: o
21
+ };
22
+ }
23
+ return ke.Fragment = t, ke.jsx = n, ke.jsxs = n, ke;
24
+ }
25
+ var Oe = {};
26
+ var St;
27
+ function er() {
28
+ return St || (St = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ function e(d) {
30
+ if (d == null) return null;
31
+ if (typeof d == "function")
32
+ return d.$$typeof === v ? null : d.displayName || d.name || null;
33
+ if (typeof d == "string") return d;
34
+ switch (d) {
35
+ case b:
36
+ return "Fragment";
37
+ case C:
38
+ return "Profiler";
39
+ case E:
40
+ return "StrictMode";
41
+ case W:
42
+ return "Suspense";
43
+ case he:
44
+ return "SuspenseList";
45
+ case ie:
46
+ return "Activity";
47
+ }
48
+ if (typeof d == "object")
49
+ switch (typeof d.tag == "number" && console.error(
50
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
+ ), d.$$typeof) {
52
+ case p:
53
+ return "Portal";
54
+ case $:
55
+ return d.displayName || "Context";
56
+ case O:
57
+ return (d._context.displayName || "Context") + ".Consumer";
58
+ case S:
59
+ var w = d.render;
60
+ return d = d.displayName, d || (d = w.displayName || w.name || "", d = d !== "" ? "ForwardRef(" + d + ")" : "ForwardRef"), d;
61
+ case Q:
62
+ return w = d.displayName || null, w !== null ? w : e(d.type) || "Memo";
63
+ case Z:
64
+ w = d._payload, d = d._init;
65
+ try {
66
+ return e(d(w));
67
+ } catch {
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ function t(d) {
73
+ return "" + d;
74
+ }
75
+ function n(d) {
76
+ try {
77
+ t(d);
78
+ var w = !1;
79
+ } catch {
80
+ w = !0;
81
+ }
82
+ if (w) {
83
+ w = console;
84
+ var M = w.error, N = typeof Symbol == "function" && Symbol.toStringTag && d[Symbol.toStringTag] || d.constructor.name || "Object";
85
+ return M.call(
86
+ w,
87
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
+ N
89
+ ), t(d);
90
+ }
91
+ }
92
+ function r(d) {
93
+ if (d === b) return "<>";
94
+ if (typeof d == "object" && d !== null && d.$$typeof === Z)
95
+ return "<...>";
96
+ try {
97
+ var w = e(d);
98
+ return w ? "<" + w + ">" : "<...>";
99
+ } catch {
100
+ return "<...>";
101
+ }
102
+ }
103
+ function a() {
104
+ var d = A.A;
105
+ return d === null ? null : d.getOwner();
106
+ }
107
+ function o() {
108
+ return Error("react-stack-top-frame");
109
+ }
110
+ function i(d) {
111
+ if (T.call(d, "key")) {
112
+ var w = Object.getOwnPropertyDescriptor(d, "key").get;
113
+ if (w && w.isReactWarning) return !1;
114
+ }
115
+ return d.key !== void 0;
116
+ }
117
+ function s(d, w) {
118
+ function M() {
119
+ X || (X = !0, console.error(
120
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
121
+ w
122
+ ));
123
+ }
124
+ M.isReactWarning = !0, Object.defineProperty(d, "key", {
125
+ get: M,
126
+ configurable: !0
127
+ });
128
+ }
129
+ function u() {
130
+ var d = e(this.type);
131
+ return J[d] || (J[d] = !0, console.error(
132
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
+ )), d = this.props.ref, d !== void 0 ? d : null;
134
+ }
135
+ function c(d, w, M, N, B, we) {
136
+ var D = M.ref;
137
+ return d = {
138
+ $$typeof: y,
139
+ type: d,
140
+ key: w,
141
+ props: M,
142
+ _owner: N
143
+ }, (D !== void 0 ? D : null) !== null ? Object.defineProperty(d, "ref", {
144
+ enumerable: !1,
145
+ get: u
146
+ }) : Object.defineProperty(d, "ref", { enumerable: !1, value: null }), d._store = {}, Object.defineProperty(d._store, "validated", {
147
+ configurable: !1,
148
+ enumerable: !1,
149
+ writable: !0,
150
+ value: 0
151
+ }), Object.defineProperty(d, "_debugInfo", {
152
+ configurable: !1,
153
+ enumerable: !1,
154
+ writable: !0,
155
+ value: null
156
+ }), Object.defineProperty(d, "_debugStack", {
157
+ configurable: !1,
158
+ enumerable: !1,
159
+ writable: !0,
160
+ value: B
161
+ }), Object.defineProperty(d, "_debugTask", {
162
+ configurable: !1,
163
+ enumerable: !1,
164
+ writable: !0,
165
+ value: we
166
+ }), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d;
167
+ }
168
+ function h(d, w, M, N, B, we) {
169
+ var D = w.children;
170
+ if (D !== void 0)
171
+ if (N)
172
+ if (q(D)) {
173
+ for (N = 0; N < D.length; N++)
174
+ f(D[N]);
175
+ Object.freeze && Object.freeze(D);
176
+ } else
177
+ console.error(
178
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
+ );
180
+ else f(D);
181
+ if (T.call(w, "key")) {
182
+ D = e(d);
183
+ var te = Object.keys(w).filter(function(ve) {
184
+ return ve !== "key";
185
+ });
186
+ N = 0 < te.length ? "{key: someKey, " + te.join(": ..., ") + ": ...}" : "{key: someKey}", K[D + N] || (te = 0 < te.length ? "{" + te.join(": ..., ") + ": ...}" : "{}", console.error(
187
+ `A props object containing a "key" prop is being spread into JSX:
188
+ let props = %s;
189
+ <%s {...props} />
190
+ React keys must be passed directly to JSX without using spread:
191
+ let props = %s;
192
+ <%s key={someKey} {...props} />`,
193
+ N,
194
+ D,
195
+ te,
196
+ D
197
+ ), K[D + N] = !0);
198
+ }
199
+ if (D = null, M !== void 0 && (n(M), D = "" + M), i(w) && (n(w.key), D = "" + w.key), "key" in w) {
200
+ M = {};
201
+ for (var se in w)
202
+ se !== "key" && (M[se] = w[se]);
203
+ } else M = w;
204
+ return D && s(
205
+ M,
206
+ typeof d == "function" ? d.displayName || d.name || "Unknown" : d
207
+ ), c(
208
+ d,
209
+ D,
210
+ M,
211
+ a(),
212
+ B,
213
+ we
214
+ );
215
+ }
216
+ function f(d) {
217
+ l(d) ? d._store && (d._store.validated = 1) : typeof d == "object" && d !== null && d.$$typeof === Z && (d._payload.status === "fulfilled" ? l(d._payload.value) && d._payload.value._store && (d._payload.value._store.validated = 1) : d._store && (d._store.validated = 1));
218
+ }
219
+ function l(d) {
220
+ return typeof d == "object" && d !== null && d.$$typeof === y;
221
+ }
222
+ var g = Qn, y = /* @__PURE__ */ Symbol.for("react.transitional.element"), p = /* @__PURE__ */ Symbol.for("react.portal"), b = /* @__PURE__ */ Symbol.for("react.fragment"), E = /* @__PURE__ */ Symbol.for("react.strict_mode"), C = /* @__PURE__ */ Symbol.for("react.profiler"), O = /* @__PURE__ */ Symbol.for("react.consumer"), $ = /* @__PURE__ */ Symbol.for("react.context"), S = /* @__PURE__ */ Symbol.for("react.forward_ref"), W = /* @__PURE__ */ Symbol.for("react.suspense"), he = /* @__PURE__ */ Symbol.for("react.suspense_list"), Q = /* @__PURE__ */ Symbol.for("react.memo"), Z = /* @__PURE__ */ Symbol.for("react.lazy"), ie = /* @__PURE__ */ Symbol.for("react.activity"), v = /* @__PURE__ */ Symbol.for("react.client.reference"), A = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, T = Object.prototype.hasOwnProperty, q = Array.isArray, ee = console.createTask ? console.createTask : function() {
223
+ return null;
224
+ };
225
+ g = {
226
+ react_stack_bottom_frame: function(d) {
227
+ return d();
228
+ }
229
+ };
230
+ var X, J = {}, L = g.react_stack_bottom_frame.bind(
231
+ g,
232
+ o
233
+ )(), I = ee(r(o)), K = {};
234
+ Oe.Fragment = b, Oe.jsx = function(d, w, M) {
235
+ var N = 1e4 > A.recentlyCreatedOwnerStacks++;
236
+ return h(
237
+ d,
238
+ w,
239
+ M,
240
+ !1,
241
+ N ? Error("react-stack-top-frame") : L,
242
+ N ? ee(r(d)) : I
243
+ );
244
+ }, Oe.jsxs = function(d, w, M) {
245
+ var N = 1e4 > A.recentlyCreatedOwnerStacks++;
246
+ return h(
247
+ d,
248
+ w,
249
+ M,
250
+ !0,
251
+ N ? Error("react-stack-top-frame") : L,
252
+ N ? ee(r(d)) : I
253
+ );
254
+ };
255
+ })()), Oe;
256
+ }
257
+ var Ct;
258
+ function tr() {
259
+ return Ct || (Ct = 1, process.env.NODE_ENV === "production" ? Fe.exports = Zn() : Fe.exports = er()), Fe.exports;
260
+ }
261
+ var x = tr();
262
+ function Ue(e, t) {
263
+ return e == null || t == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
264
+ }
265
+ function nr(e, t) {
266
+ return e == null || t == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
267
+ }
268
+ function wn(e) {
269
+ let t, n, r;
270
+ e.length !== 2 ? (t = Ue, n = (s, u) => Ue(e(s), u), r = (s, u) => e(s) - u) : (t = e === Ue || e === nr ? e : rr, n = e, r = e);
271
+ function a(s, u, c = 0, h = s.length) {
272
+ if (c < h) {
273
+ if (t(u, u) !== 0) return h;
274
+ do {
275
+ const f = c + h >>> 1;
276
+ n(s[f], u) < 0 ? c = f + 1 : h = f;
277
+ } while (c < h);
278
+ }
279
+ return c;
280
+ }
281
+ function o(s, u, c = 0, h = s.length) {
282
+ if (c < h) {
283
+ if (t(u, u) !== 0) return h;
284
+ do {
285
+ const f = c + h >>> 1;
286
+ n(s[f], u) <= 0 ? c = f + 1 : h = f;
287
+ } while (c < h);
288
+ }
289
+ return c;
290
+ }
291
+ function i(s, u, c = 0, h = s.length) {
292
+ const f = a(s, u, c, h - 1);
293
+ return f > c && r(s[f - 1], u) > -r(s[f], u) ? f - 1 : f;
294
+ }
295
+ return { left: a, center: i, right: o };
296
+ }
297
+ function rr() {
298
+ return 0;
299
+ }
300
+ function ar(e) {
301
+ return e === null ? NaN : +e;
302
+ }
303
+ const or = wn(Ue), ir = or.right;
304
+ wn(ar).center;
305
+ class Nt extends Map {
306
+ constructor(t, n = ur) {
307
+ if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: n } }), t != null) for (const [r, a] of t) this.set(r, a);
308
+ }
309
+ get(t) {
310
+ return super.get(Rt(this, t));
311
+ }
312
+ has(t) {
313
+ return super.has(Rt(this, t));
314
+ }
315
+ set(t, n) {
316
+ return super.set(sr(this, t), n);
317
+ }
318
+ delete(t) {
319
+ return super.delete(cr(this, t));
320
+ }
321
+ }
322
+ function Rt({ _intern: e, _key: t }, n) {
323
+ const r = t(n);
324
+ return e.has(r) ? e.get(r) : n;
325
+ }
326
+ function sr({ _intern: e, _key: t }, n) {
327
+ const r = t(n);
328
+ return e.has(r) ? e.get(r) : (e.set(r, n), n);
329
+ }
330
+ function cr({ _intern: e, _key: t }, n) {
331
+ const r = t(n);
332
+ return e.has(r) && (n = e.get(r), e.delete(r)), n;
333
+ }
334
+ function ur(e) {
335
+ return e !== null && typeof e == "object" ? e.valueOf() : e;
336
+ }
337
+ const lr = Math.sqrt(50), fr = Math.sqrt(10), dr = Math.sqrt(2);
338
+ function Be(e, t, n) {
339
+ const r = (t - e) / Math.max(0, n), a = Math.floor(Math.log10(r)), o = r / Math.pow(10, a), i = o >= lr ? 10 : o >= fr ? 5 : o >= dr ? 2 : 1;
340
+ let s, u, c;
341
+ return a < 0 ? (c = Math.pow(10, -a) / i, s = Math.round(e * c), u = Math.round(t * c), s / c < e && ++s, u / c > t && --u, c = -c) : (c = Math.pow(10, a) * i, s = Math.round(e / c), u = Math.round(t / c), s * c < e && ++s, u * c > t && --u), u < s && 0.5 <= n && n < 2 ? Be(e, t, n * 2) : [s, u, c];
342
+ }
343
+ function hr(e, t, n) {
344
+ if (t = +t, e = +e, n = +n, !(n > 0)) return [];
345
+ if (e === t) return [e];
346
+ const r = t < e, [a, o, i] = r ? Be(t, e, n) : Be(e, t, n);
347
+ if (!(o >= a)) return [];
348
+ const s = o - a + 1, u = new Array(s);
349
+ if (r)
350
+ if (i < 0) for (let c = 0; c < s; ++c) u[c] = (o - c) / -i;
351
+ else for (let c = 0; c < s; ++c) u[c] = (o - c) * i;
352
+ else if (i < 0) for (let c = 0; c < s; ++c) u[c] = (a + c) / -i;
353
+ else for (let c = 0; c < s; ++c) u[c] = (a + c) * i;
354
+ return u;
355
+ }
356
+ function at(e, t, n) {
357
+ return t = +t, e = +e, n = +n, Be(e, t, n)[2];
358
+ }
359
+ function gr(e, t, n) {
360
+ t = +t, e = +e, n = +n;
361
+ const r = t < e, a = r ? at(t, e, n) : at(e, t, n);
362
+ return (r ? -1 : 1) * (a < 0 ? 1 / -a : a);
363
+ }
364
+ function mr(e, t, n) {
365
+ e = +e, t = +t, n = (a = arguments.length) < 2 ? (t = e, e = 0, 1) : a < 3 ? 1 : +n;
366
+ for (var r = -1, a = Math.max(0, Math.ceil((t - e) / n)) | 0, o = new Array(a); ++r < a; )
367
+ o[r] = e + r * n;
368
+ return o;
369
+ }
370
+ function ut(e, t) {
371
+ switch (arguments.length) {
372
+ case 0:
373
+ break;
374
+ case 1:
375
+ this.range(e);
376
+ break;
377
+ default:
378
+ this.range(t).domain(e);
379
+ break;
380
+ }
381
+ return this;
382
+ }
383
+ const Tt = /* @__PURE__ */ Symbol("implicit");
384
+ function vn() {
385
+ var e = new Nt(), t = [], n = [], r = Tt;
386
+ function a(o) {
387
+ let i = e.get(o);
388
+ if (i === void 0) {
389
+ if (r !== Tt) return r;
390
+ e.set(o, i = t.push(o) - 1);
391
+ }
392
+ return n[i % n.length];
393
+ }
394
+ return a.domain = function(o) {
395
+ if (!arguments.length) return t.slice();
396
+ t = [], e = new Nt();
397
+ for (const i of o)
398
+ e.has(i) || e.set(i, t.push(i) - 1);
399
+ return a;
400
+ }, a.range = function(o) {
401
+ return arguments.length ? (n = Array.from(o), a) : n.slice();
402
+ }, a.unknown = function(o) {
403
+ return arguments.length ? (r = o, a) : r;
404
+ }, a.copy = function() {
405
+ return vn(t, n).unknown(r);
406
+ }, ut.apply(a, arguments), a;
407
+ }
408
+ function En() {
409
+ var e = vn().unknown(void 0), t = e.domain, n = e.range, r = 0, a = 1, o, i, s = !1, u = 0, c = 0, h = 0.5;
410
+ delete e.unknown;
411
+ function f() {
412
+ var l = t().length, g = a < r, y = g ? a : r, p = g ? r : a;
413
+ o = (p - y) / Math.max(1, l - u + c * 2), s && (o = Math.floor(o)), y += (p - y - o * (l - u)) * h, i = o * (1 - u), s && (y = Math.round(y), i = Math.round(i));
414
+ var b = mr(l).map(function(E) {
415
+ return y + o * E;
416
+ });
417
+ return n(g ? b.reverse() : b);
418
+ }
419
+ return e.domain = function(l) {
420
+ return arguments.length ? (t(l), f()) : t();
421
+ }, e.range = function(l) {
422
+ return arguments.length ? ([r, a] = l, r = +r, a = +a, f()) : [r, a];
423
+ }, e.rangeRound = function(l) {
424
+ return [r, a] = l, r = +r, a = +a, s = !0, f();
425
+ }, e.bandwidth = function() {
426
+ return i;
427
+ }, e.step = function() {
428
+ return o;
429
+ }, e.round = function(l) {
430
+ return arguments.length ? (s = !!l, f()) : s;
431
+ }, e.padding = function(l) {
432
+ return arguments.length ? (u = Math.min(1, c = +l), f()) : u;
433
+ }, e.paddingInner = function(l) {
434
+ return arguments.length ? (u = Math.min(1, l), f()) : u;
435
+ }, e.paddingOuter = function(l) {
436
+ return arguments.length ? (c = +l, f()) : c;
437
+ }, e.align = function(l) {
438
+ return arguments.length ? (h = Math.max(0, Math.min(1, l)), f()) : h;
439
+ }, e.copy = function() {
440
+ return En(t(), [r, a]).round(s).paddingInner(u).paddingOuter(c).align(h);
441
+ }, ut.apply(f(), arguments);
442
+ }
443
+ function lt(e, t, n) {
444
+ e.prototype = t.prototype = n, n.constructor = e;
445
+ }
446
+ function Mn(e, t) {
447
+ var n = Object.create(e.prototype);
448
+ for (var r in t) n[r] = t[r];
449
+ return n;
450
+ }
451
+ function Pe() {
452
+ }
453
+ var Re = 0.7, Ve = 1 / Re, be = "\\s*([+-]?\\d+)\\s*", Te = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", z = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", yr = /^#([0-9a-f]{3,8})$/, pr = new RegExp(`^rgb\\(${be},${be},${be}\\)$`), br = new RegExp(`^rgb\\(${z},${z},${z}\\)$`), xr = new RegExp(`^rgba\\(${be},${be},${be},${Te}\\)$`), wr = new RegExp(`^rgba\\(${z},${z},${z},${Te}\\)$`), vr = new RegExp(`^hsl\\(${Te},${z},${z}\\)$`), Er = new RegExp(`^hsla\\(${Te},${z},${z},${Te}\\)$`), Dt = {
454
+ aliceblue: 15792383,
455
+ antiquewhite: 16444375,
456
+ aqua: 65535,
457
+ aquamarine: 8388564,
458
+ azure: 15794175,
459
+ beige: 16119260,
460
+ bisque: 16770244,
461
+ black: 0,
462
+ blanchedalmond: 16772045,
463
+ blue: 255,
464
+ blueviolet: 9055202,
465
+ brown: 10824234,
466
+ burlywood: 14596231,
467
+ cadetblue: 6266528,
468
+ chartreuse: 8388352,
469
+ chocolate: 13789470,
470
+ coral: 16744272,
471
+ cornflowerblue: 6591981,
472
+ cornsilk: 16775388,
473
+ crimson: 14423100,
474
+ cyan: 65535,
475
+ darkblue: 139,
476
+ darkcyan: 35723,
477
+ darkgoldenrod: 12092939,
478
+ darkgray: 11119017,
479
+ darkgreen: 25600,
480
+ darkgrey: 11119017,
481
+ darkkhaki: 12433259,
482
+ darkmagenta: 9109643,
483
+ darkolivegreen: 5597999,
484
+ darkorange: 16747520,
485
+ darkorchid: 10040012,
486
+ darkred: 9109504,
487
+ darksalmon: 15308410,
488
+ darkseagreen: 9419919,
489
+ darkslateblue: 4734347,
490
+ darkslategray: 3100495,
491
+ darkslategrey: 3100495,
492
+ darkturquoise: 52945,
493
+ darkviolet: 9699539,
494
+ deeppink: 16716947,
495
+ deepskyblue: 49151,
496
+ dimgray: 6908265,
497
+ dimgrey: 6908265,
498
+ dodgerblue: 2003199,
499
+ firebrick: 11674146,
500
+ floralwhite: 16775920,
501
+ forestgreen: 2263842,
502
+ fuchsia: 16711935,
503
+ gainsboro: 14474460,
504
+ ghostwhite: 16316671,
505
+ gold: 16766720,
506
+ goldenrod: 14329120,
507
+ gray: 8421504,
508
+ green: 32768,
509
+ greenyellow: 11403055,
510
+ grey: 8421504,
511
+ honeydew: 15794160,
512
+ hotpink: 16738740,
513
+ indianred: 13458524,
514
+ indigo: 4915330,
515
+ ivory: 16777200,
516
+ khaki: 15787660,
517
+ lavender: 15132410,
518
+ lavenderblush: 16773365,
519
+ lawngreen: 8190976,
520
+ lemonchiffon: 16775885,
521
+ lightblue: 11393254,
522
+ lightcoral: 15761536,
523
+ lightcyan: 14745599,
524
+ lightgoldenrodyellow: 16448210,
525
+ lightgray: 13882323,
526
+ lightgreen: 9498256,
527
+ lightgrey: 13882323,
528
+ lightpink: 16758465,
529
+ lightsalmon: 16752762,
530
+ lightseagreen: 2142890,
531
+ lightskyblue: 8900346,
532
+ lightslategray: 7833753,
533
+ lightslategrey: 7833753,
534
+ lightsteelblue: 11584734,
535
+ lightyellow: 16777184,
536
+ lime: 65280,
537
+ limegreen: 3329330,
538
+ linen: 16445670,
539
+ magenta: 16711935,
540
+ maroon: 8388608,
541
+ mediumaquamarine: 6737322,
542
+ mediumblue: 205,
543
+ mediumorchid: 12211667,
544
+ mediumpurple: 9662683,
545
+ mediumseagreen: 3978097,
546
+ mediumslateblue: 8087790,
547
+ mediumspringgreen: 64154,
548
+ mediumturquoise: 4772300,
549
+ mediumvioletred: 13047173,
550
+ midnightblue: 1644912,
551
+ mintcream: 16121850,
552
+ mistyrose: 16770273,
553
+ moccasin: 16770229,
554
+ navajowhite: 16768685,
555
+ navy: 128,
556
+ oldlace: 16643558,
557
+ olive: 8421376,
558
+ olivedrab: 7048739,
559
+ orange: 16753920,
560
+ orangered: 16729344,
561
+ orchid: 14315734,
562
+ palegoldenrod: 15657130,
563
+ palegreen: 10025880,
564
+ paleturquoise: 11529966,
565
+ palevioletred: 14381203,
566
+ papayawhip: 16773077,
567
+ peachpuff: 16767673,
568
+ peru: 13468991,
569
+ pink: 16761035,
570
+ plum: 14524637,
571
+ powderblue: 11591910,
572
+ purple: 8388736,
573
+ rebeccapurple: 6697881,
574
+ red: 16711680,
575
+ rosybrown: 12357519,
576
+ royalblue: 4286945,
577
+ saddlebrown: 9127187,
578
+ salmon: 16416882,
579
+ sandybrown: 16032864,
580
+ seagreen: 3050327,
581
+ seashell: 16774638,
582
+ sienna: 10506797,
583
+ silver: 12632256,
584
+ skyblue: 8900331,
585
+ slateblue: 6970061,
586
+ slategray: 7372944,
587
+ slategrey: 7372944,
588
+ snow: 16775930,
589
+ springgreen: 65407,
590
+ steelblue: 4620980,
591
+ tan: 13808780,
592
+ teal: 32896,
593
+ thistle: 14204888,
594
+ tomato: 16737095,
595
+ turquoise: 4251856,
596
+ violet: 15631086,
597
+ wheat: 16113331,
598
+ white: 16777215,
599
+ whitesmoke: 16119285,
600
+ yellow: 16776960,
601
+ yellowgreen: 10145074
602
+ };
603
+ lt(Pe, De, {
604
+ copy(e) {
605
+ return Object.assign(new this.constructor(), this, e);
606
+ },
607
+ displayable() {
608
+ return this.rgb().displayable();
609
+ },
610
+ hex: At,
611
+ // Deprecated! Use color.formatHex.
612
+ formatHex: At,
613
+ formatHex8: Mr,
614
+ formatHsl: kr,
615
+ formatRgb: It,
616
+ toString: It
617
+ });
618
+ function At() {
619
+ return this.rgb().formatHex();
620
+ }
621
+ function Mr() {
622
+ return this.rgb().formatHex8();
623
+ }
624
+ function kr() {
625
+ return kn(this).formatHsl();
626
+ }
627
+ function It() {
628
+ return this.rgb().formatRgb();
629
+ }
630
+ function De(e) {
631
+ var t, n;
632
+ return e = (e + "").trim().toLowerCase(), (t = yr.exec(e)) ? (n = t[1].length, t = parseInt(t[1], 16), n === 6 ? Pt(t) : n === 3 ? new F(t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, (t & 15) << 4 | t & 15, 1) : n === 8 ? We(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, (t & 255) / 255) : n === 4 ? We(t >> 12 & 15 | t >> 8 & 240, t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, ((t & 15) << 4 | t & 15) / 255) : null) : (t = pr.exec(e)) ? new F(t[1], t[2], t[3], 1) : (t = br.exec(e)) ? new F(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, 1) : (t = xr.exec(e)) ? We(t[1], t[2], t[3], t[4]) : (t = wr.exec(e)) ? We(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, t[4]) : (t = vr.exec(e)) ? Yt(t[1], t[2] / 100, t[3] / 100, 1) : (t = Er.exec(e)) ? Yt(t[1], t[2] / 100, t[3] / 100, t[4]) : Dt.hasOwnProperty(e) ? Pt(Dt[e]) : e === "transparent" ? new F(NaN, NaN, NaN, 0) : null;
633
+ }
634
+ function Pt(e) {
635
+ return new F(e >> 16 & 255, e >> 8 & 255, e & 255, 1);
636
+ }
637
+ function We(e, t, n, r) {
638
+ return r <= 0 && (e = t = n = NaN), new F(e, t, n, r);
639
+ }
640
+ function Or(e) {
641
+ return e instanceof Pe || (e = De(e)), e ? (e = e.rgb(), new F(e.r, e.g, e.b, e.opacity)) : new F();
642
+ }
643
+ function ot(e, t, n, r) {
644
+ return arguments.length === 1 ? Or(e) : new F(e, t, n, r ?? 1);
645
+ }
646
+ function F(e, t, n, r) {
647
+ this.r = +e, this.g = +t, this.b = +n, this.opacity = +r;
648
+ }
649
+ lt(F, ot, Mn(Pe, {
650
+ brighter(e) {
651
+ return e = e == null ? Ve : Math.pow(Ve, e), new F(this.r * e, this.g * e, this.b * e, this.opacity);
652
+ },
653
+ darker(e) {
654
+ return e = e == null ? Re : Math.pow(Re, e), new F(this.r * e, this.g * e, this.b * e, this.opacity);
655
+ },
656
+ rgb() {
657
+ return this;
658
+ },
659
+ clamp() {
660
+ return new F(fe(this.r), fe(this.g), fe(this.b), ze(this.opacity));
661
+ },
662
+ displayable() {
663
+ return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
664
+ },
665
+ hex: jt,
666
+ // Deprecated! Use color.formatHex.
667
+ formatHex: jt,
668
+ formatHex8: _r,
669
+ formatRgb: $t,
670
+ toString: $t
671
+ }));
672
+ function jt() {
673
+ return `#${le(this.r)}${le(this.g)}${le(this.b)}`;
674
+ }
675
+ function _r() {
676
+ return `#${le(this.r)}${le(this.g)}${le(this.b)}${le((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
677
+ }
678
+ function $t() {
679
+ const e = ze(this.opacity);
680
+ return `${e === 1 ? "rgb(" : "rgba("}${fe(this.r)}, ${fe(this.g)}, ${fe(this.b)}${e === 1 ? ")" : `, ${e})`}`;
681
+ }
682
+ function ze(e) {
683
+ return isNaN(e) ? 1 : Math.max(0, Math.min(1, e));
684
+ }
685
+ function fe(e) {
686
+ return Math.max(0, Math.min(255, Math.round(e) || 0));
687
+ }
688
+ function le(e) {
689
+ return e = fe(e), (e < 16 ? "0" : "") + e.toString(16);
690
+ }
691
+ function Yt(e, t, n, r) {
692
+ return r <= 0 ? e = t = n = NaN : n <= 0 || n >= 1 ? e = t = NaN : t <= 0 && (e = NaN), new G(e, t, n, r);
693
+ }
694
+ function kn(e) {
695
+ if (e instanceof G) return new G(e.h, e.s, e.l, e.opacity);
696
+ if (e instanceof Pe || (e = De(e)), !e) return new G();
697
+ if (e instanceof G) return e;
698
+ e = e.rgb();
699
+ var t = e.r / 255, n = e.g / 255, r = e.b / 255, a = Math.min(t, n, r), o = Math.max(t, n, r), i = NaN, s = o - a, u = (o + a) / 2;
700
+ return s ? (t === o ? i = (n - r) / s + (n < r) * 6 : n === o ? i = (r - t) / s + 2 : i = (t - n) / s + 4, s /= u < 0.5 ? o + a : 2 - o - a, i *= 60) : s = u > 0 && u < 1 ? 0 : i, new G(i, s, u, e.opacity);
701
+ }
702
+ function Sr(e, t, n, r) {
703
+ return arguments.length === 1 ? kn(e) : new G(e, t, n, r ?? 1);
704
+ }
705
+ function G(e, t, n, r) {
706
+ this.h = +e, this.s = +t, this.l = +n, this.opacity = +r;
707
+ }
708
+ lt(G, Sr, Mn(Pe, {
709
+ brighter(e) {
710
+ return e = e == null ? Ve : Math.pow(Ve, e), new G(this.h, this.s, this.l * e, this.opacity);
711
+ },
712
+ darker(e) {
713
+ return e = e == null ? Re : Math.pow(Re, e), new G(this.h, this.s, this.l * e, this.opacity);
714
+ },
715
+ rgb() {
716
+ var e = this.h % 360 + (this.h < 0) * 360, t = isNaN(e) || isNaN(this.s) ? 0 : this.s, n = this.l, r = n + (n < 0.5 ? n : 1 - n) * t, a = 2 * n - r;
717
+ return new F(
718
+ et(e >= 240 ? e - 240 : e + 120, a, r),
719
+ et(e, a, r),
720
+ et(e < 120 ? e + 240 : e - 120, a, r),
721
+ this.opacity
722
+ );
723
+ },
724
+ clamp() {
725
+ return new G(Ft(this.h), Le(this.s), Le(this.l), ze(this.opacity));
726
+ },
727
+ displayable() {
728
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
729
+ },
730
+ formatHsl() {
731
+ const e = ze(this.opacity);
732
+ return `${e === 1 ? "hsl(" : "hsla("}${Ft(this.h)}, ${Le(this.s) * 100}%, ${Le(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
733
+ }
734
+ }));
735
+ function Ft(e) {
736
+ return e = (e || 0) % 360, e < 0 ? e + 360 : e;
737
+ }
738
+ function Le(e) {
739
+ return Math.max(0, Math.min(1, e || 0));
740
+ }
741
+ function et(e, t, n) {
742
+ return (e < 60 ? t + (n - t) * e / 60 : e < 180 ? n : e < 240 ? t + (n - t) * (240 - e) / 60 : t) * 255;
743
+ }
744
+ const ft = (e) => () => e;
745
+ function Cr(e, t) {
746
+ return function(n) {
747
+ return e + n * t;
748
+ };
749
+ }
750
+ function Nr(e, t, n) {
751
+ return e = Math.pow(e, n), t = Math.pow(t, n) - e, n = 1 / n, function(r) {
752
+ return Math.pow(e + r * t, n);
753
+ };
754
+ }
755
+ function Rr(e) {
756
+ return (e = +e) == 1 ? On : function(t, n) {
757
+ return n - t ? Nr(t, n, e) : ft(isNaN(t) ? n : t);
758
+ };
759
+ }
760
+ function On(e, t) {
761
+ var n = t - e;
762
+ return n ? Cr(e, n) : ft(isNaN(e) ? t : e);
763
+ }
764
+ const Wt = (function e(t) {
765
+ var n = Rr(t);
766
+ function r(a, o) {
767
+ var i = n((a = ot(a)).r, (o = ot(o)).r), s = n(a.g, o.g), u = n(a.b, o.b), c = On(a.opacity, o.opacity);
768
+ return function(h) {
769
+ return a.r = i(h), a.g = s(h), a.b = u(h), a.opacity = c(h), a + "";
770
+ };
771
+ }
772
+ return r.gamma = e, r;
773
+ })(1);
774
+ function Tr(e, t) {
775
+ t || (t = []);
776
+ var n = e ? Math.min(t.length, e.length) : 0, r = t.slice(), a;
777
+ return function(o) {
778
+ for (a = 0; a < n; ++a) r[a] = e[a] * (1 - o) + t[a] * o;
779
+ return r;
780
+ };
781
+ }
782
+ function Dr(e) {
783
+ return ArrayBuffer.isView(e) && !(e instanceof DataView);
784
+ }
785
+ function Ar(e, t) {
786
+ var n = t ? t.length : 0, r = e ? Math.min(n, e.length) : 0, a = new Array(r), o = new Array(n), i;
787
+ for (i = 0; i < r; ++i) a[i] = dt(e[i], t[i]);
788
+ for (; i < n; ++i) o[i] = t[i];
789
+ return function(s) {
790
+ for (i = 0; i < r; ++i) o[i] = a[i](s);
791
+ return o;
792
+ };
793
+ }
794
+ function Ir(e, t) {
795
+ var n = /* @__PURE__ */ new Date();
796
+ return e = +e, t = +t, function(r) {
797
+ return n.setTime(e * (1 - r) + t * r), n;
798
+ };
799
+ }
800
+ function Xe(e, t) {
801
+ return e = +e, t = +t, function(n) {
802
+ return e * (1 - n) + t * n;
803
+ };
804
+ }
805
+ function Pr(e, t) {
806
+ var n = {}, r = {}, a;
807
+ (e === null || typeof e != "object") && (e = {}), (t === null || typeof t != "object") && (t = {});
808
+ for (a in t)
809
+ a in e ? n[a] = dt(e[a], t[a]) : r[a] = t[a];
810
+ return function(o) {
811
+ for (a in n) r[a] = n[a](o);
812
+ return r;
813
+ };
814
+ }
815
+ var it = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, tt = new RegExp(it.source, "g");
816
+ function jr(e) {
817
+ return function() {
818
+ return e;
819
+ };
820
+ }
821
+ function $r(e) {
822
+ return function(t) {
823
+ return e(t) + "";
824
+ };
825
+ }
826
+ function Yr(e, t) {
827
+ var n = it.lastIndex = tt.lastIndex = 0, r, a, o, i = -1, s = [], u = [];
828
+ for (e = e + "", t = t + ""; (r = it.exec(e)) && (a = tt.exec(t)); )
829
+ (o = a.index) > n && (o = t.slice(n, o), s[i] ? s[i] += o : s[++i] = o), (r = r[0]) === (a = a[0]) ? s[i] ? s[i] += a : s[++i] = a : (s[++i] = null, u.push({ i, x: Xe(r, a) })), n = tt.lastIndex;
830
+ return n < t.length && (o = t.slice(n), s[i] ? s[i] += o : s[++i] = o), s.length < 2 ? u[0] ? $r(u[0].x) : jr(t) : (t = u.length, function(c) {
831
+ for (var h = 0, f; h < t; ++h) s[(f = u[h]).i] = f.x(c);
832
+ return s.join("");
833
+ });
834
+ }
835
+ function dt(e, t) {
836
+ var n = typeof t, r;
837
+ return t == null || n === "boolean" ? ft(t) : (n === "number" ? Xe : n === "string" ? (r = De(t)) ? (t = r, Wt) : Yr : t instanceof De ? Wt : t instanceof Date ? Ir : Dr(t) ? Tr : Array.isArray(t) ? Ar : typeof t.valueOf != "function" && typeof t.toString != "function" || isNaN(t) ? Pr : Xe)(e, t);
838
+ }
839
+ function Fr(e, t) {
840
+ return e = +e, t = +t, function(n) {
841
+ return Math.round(e * (1 - n) + t * n);
842
+ };
843
+ }
844
+ function Wr(e) {
845
+ return function() {
846
+ return e;
847
+ };
848
+ }
849
+ function Lr(e) {
850
+ return +e;
851
+ }
852
+ var Lt = [0, 1];
853
+ function pe(e) {
854
+ return e;
855
+ }
856
+ function st(e, t) {
857
+ return (t -= e = +e) ? function(n) {
858
+ return (n - e) / t;
859
+ } : Wr(isNaN(t) ? NaN : 0.5);
860
+ }
861
+ function Hr(e, t) {
862
+ var n;
863
+ return e > t && (n = e, e = t, t = n), function(r) {
864
+ return Math.max(e, Math.min(t, r));
865
+ };
866
+ }
867
+ function Gr(e, t, n) {
868
+ var r = e[0], a = e[1], o = t[0], i = t[1];
869
+ return a < r ? (r = st(a, r), o = n(i, o)) : (r = st(r, a), o = n(o, i)), function(s) {
870
+ return o(r(s));
871
+ };
872
+ }
873
+ function Ur(e, t, n) {
874
+ var r = Math.min(e.length, t.length) - 1, a = new Array(r), o = new Array(r), i = -1;
875
+ for (e[r] < e[0] && (e = e.slice().reverse(), t = t.slice().reverse()); ++i < r; )
876
+ a[i] = st(e[i], e[i + 1]), o[i] = n(t[i], t[i + 1]);
877
+ return function(s) {
878
+ var u = ir(e, s, 1, r) - 1;
879
+ return o[u](a[u](s));
880
+ };
881
+ }
882
+ function qr(e, t) {
883
+ return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());
884
+ }
885
+ function Br() {
886
+ var e = Lt, t = Lt, n = dt, r, a, o, i = pe, s, u, c;
887
+ function h() {
888
+ var l = Math.min(e.length, t.length);
889
+ return i !== pe && (i = Hr(e[0], e[l - 1])), s = l > 2 ? Ur : Gr, u = c = null, f;
890
+ }
891
+ function f(l) {
892
+ return l == null || isNaN(l = +l) ? o : (u || (u = s(e.map(r), t, n)))(r(i(l)));
893
+ }
894
+ return f.invert = function(l) {
895
+ return i(a((c || (c = s(t, e.map(r), Xe)))(l)));
896
+ }, f.domain = function(l) {
897
+ return arguments.length ? (e = Array.from(l, Lr), h()) : e.slice();
898
+ }, f.range = function(l) {
899
+ return arguments.length ? (t = Array.from(l), h()) : t.slice();
900
+ }, f.rangeRound = function(l) {
901
+ return t = Array.from(l), n = Fr, h();
902
+ }, f.clamp = function(l) {
903
+ return arguments.length ? (i = l ? !0 : pe, h()) : i !== pe;
904
+ }, f.interpolate = function(l) {
905
+ return arguments.length ? (n = l, h()) : n;
906
+ }, f.unknown = function(l) {
907
+ return arguments.length ? (o = l, f) : o;
908
+ }, function(l, g) {
909
+ return r = l, a = g, h();
910
+ };
911
+ }
912
+ function Vr() {
913
+ return Br()(pe, pe);
914
+ }
915
+ function zr(e) {
916
+ return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
917
+ }
918
+ function Je(e, t) {
919
+ if ((n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e")) < 0) return null;
920
+ var n, r = e.slice(0, n);
921
+ return [
922
+ r.length > 1 ? r[0] + r.slice(2) : r,
923
+ +e.slice(n + 1)
924
+ ];
925
+ }
926
+ function xe(e) {
927
+ return e = Je(Math.abs(e)), e ? e[1] : NaN;
928
+ }
929
+ function Xr(e, t) {
930
+ return function(n, r) {
931
+ for (var a = n.length, o = [], i = 0, s = e[0], u = 0; a > 0 && s > 0 && (u + s + 1 > r && (s = Math.max(1, r - u)), o.push(n.substring(a -= s, a + s)), !((u += s + 1) > r)); )
932
+ s = e[i = (i + 1) % e.length];
933
+ return o.reverse().join(t);
934
+ };
935
+ }
936
+ function Jr(e) {
937
+ return function(t) {
938
+ return t.replace(/[0-9]/g, function(n) {
939
+ return e[+n];
940
+ });
941
+ };
942
+ }
943
+ var Kr = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
944
+ function Ke(e) {
945
+ if (!(t = Kr.exec(e))) throw new Error("invalid format: " + e);
946
+ var t;
947
+ return new ht({
948
+ fill: t[1],
949
+ align: t[2],
950
+ sign: t[3],
951
+ symbol: t[4],
952
+ zero: t[5],
953
+ width: t[6],
954
+ comma: t[7],
955
+ precision: t[8] && t[8].slice(1),
956
+ trim: t[9],
957
+ type: t[10]
958
+ });
959
+ }
960
+ Ke.prototype = ht.prototype;
961
+ function ht(e) {
962
+ this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
963
+ }
964
+ ht.prototype.toString = function() {
965
+ return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
966
+ };
967
+ function Qr(e) {
968
+ e: for (var t = e.length, n = 1, r = -1, a; n < t; ++n)
969
+ switch (e[n]) {
970
+ case ".":
971
+ r = a = n;
972
+ break;
973
+ case "0":
974
+ r === 0 && (r = n), a = n;
975
+ break;
976
+ default:
977
+ if (!+e[n]) break e;
978
+ r > 0 && (r = 0);
979
+ break;
980
+ }
981
+ return r > 0 ? e.slice(0, r) + e.slice(a + 1) : e;
982
+ }
983
+ var _n;
984
+ function Zr(e, t) {
985
+ var n = Je(e, t);
986
+ if (!n) return e + "";
987
+ var r = n[0], a = n[1], o = a - (_n = Math.max(-8, Math.min(8, Math.floor(a / 3))) * 3) + 1, i = r.length;
988
+ return o === i ? r : o > i ? r + new Array(o - i + 1).join("0") : o > 0 ? r.slice(0, o) + "." + r.slice(o) : "0." + new Array(1 - o).join("0") + Je(e, Math.max(0, t + o - 1))[0];
989
+ }
990
+ function Ht(e, t) {
991
+ var n = Je(e, t);
992
+ if (!n) return e + "";
993
+ var r = n[0], a = n[1];
994
+ return a < 0 ? "0." + new Array(-a).join("0") + r : r.length > a + 1 ? r.slice(0, a + 1) + "." + r.slice(a + 1) : r + new Array(a - r.length + 2).join("0");
995
+ }
996
+ const Gt = {
997
+ "%": (e, t) => (e * 100).toFixed(t),
998
+ b: (e) => Math.round(e).toString(2),
999
+ c: (e) => e + "",
1000
+ d: zr,
1001
+ e: (e, t) => e.toExponential(t),
1002
+ f: (e, t) => e.toFixed(t),
1003
+ g: (e, t) => e.toPrecision(t),
1004
+ o: (e) => Math.round(e).toString(8),
1005
+ p: (e, t) => Ht(e * 100, t),
1006
+ r: Ht,
1007
+ s: Zr,
1008
+ X: (e) => Math.round(e).toString(16).toUpperCase(),
1009
+ x: (e) => Math.round(e).toString(16)
1010
+ };
1011
+ function Ut(e) {
1012
+ return e;
1013
+ }
1014
+ var qt = Array.prototype.map, Bt = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
1015
+ function ea(e) {
1016
+ var t = e.grouping === void 0 || e.thousands === void 0 ? Ut : Xr(qt.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", r = e.currency === void 0 ? "" : e.currency[1] + "", a = e.decimal === void 0 ? "." : e.decimal + "", o = e.numerals === void 0 ? Ut : Jr(qt.call(e.numerals, String)), i = e.percent === void 0 ? "%" : e.percent + "", s = e.minus === void 0 ? "−" : e.minus + "", u = e.nan === void 0 ? "NaN" : e.nan + "";
1017
+ function c(f) {
1018
+ f = Ke(f);
1019
+ var l = f.fill, g = f.align, y = f.sign, p = f.symbol, b = f.zero, E = f.width, C = f.comma, O = f.precision, $ = f.trim, S = f.type;
1020
+ S === "n" ? (C = !0, S = "g") : Gt[S] || (O === void 0 && (O = 12), $ = !0, S = "g"), (b || l === "0" && g === "=") && (b = !0, l = "0", g = "=");
1021
+ var W = p === "$" ? n : p === "#" && /[boxX]/.test(S) ? "0" + S.toLowerCase() : "", he = p === "$" ? r : /[%p]/.test(S) ? i : "", Q = Gt[S], Z = /[defgprs%]/.test(S);
1022
+ O = O === void 0 ? 6 : /[gprs]/.test(S) ? Math.max(1, Math.min(21, O)) : Math.max(0, Math.min(20, O));
1023
+ function ie(v) {
1024
+ var A = W, T = he, q, ee, X;
1025
+ if (S === "c")
1026
+ T = Q(v) + T, v = "";
1027
+ else {
1028
+ v = +v;
1029
+ var J = v < 0 || 1 / v < 0;
1030
+ if (v = isNaN(v) ? u : Q(Math.abs(v), O), $ && (v = Qr(v)), J && +v == 0 && y !== "+" && (J = !1), A = (J ? y === "(" ? y : s : y === "-" || y === "(" ? "" : y) + A, T = (S === "s" ? Bt[8 + _n / 3] : "") + T + (J && y === "(" ? ")" : ""), Z) {
1031
+ for (q = -1, ee = v.length; ++q < ee; )
1032
+ if (X = v.charCodeAt(q), 48 > X || X > 57) {
1033
+ T = (X === 46 ? a + v.slice(q + 1) : v.slice(q)) + T, v = v.slice(0, q);
1034
+ break;
1035
+ }
1036
+ }
1037
+ }
1038
+ C && !b && (v = t(v, 1 / 0));
1039
+ var L = A.length + v.length + T.length, I = L < E ? new Array(E - L + 1).join(l) : "";
1040
+ switch (C && b && (v = t(I + v, I.length ? E - T.length : 1 / 0), I = ""), g) {
1041
+ case "<":
1042
+ v = A + v + T + I;
1043
+ break;
1044
+ case "=":
1045
+ v = A + I + v + T;
1046
+ break;
1047
+ case "^":
1048
+ v = I.slice(0, L = I.length >> 1) + A + v + T + I.slice(L);
1049
+ break;
1050
+ default:
1051
+ v = I + A + v + T;
1052
+ break;
1053
+ }
1054
+ return o(v);
1055
+ }
1056
+ return ie.toString = function() {
1057
+ return f + "";
1058
+ }, ie;
1059
+ }
1060
+ function h(f, l) {
1061
+ var g = c((f = Ke(f), f.type = "f", f)), y = Math.max(-8, Math.min(8, Math.floor(xe(l) / 3))) * 3, p = Math.pow(10, -y), b = Bt[8 + y / 3];
1062
+ return function(E) {
1063
+ return g(p * E) + b;
1064
+ };
1065
+ }
1066
+ return {
1067
+ format: c,
1068
+ formatPrefix: h
1069
+ };
1070
+ }
1071
+ var He, Sn, Cn;
1072
+ ta({
1073
+ thousands: ",",
1074
+ grouping: [3],
1075
+ currency: ["$", ""]
1076
+ });
1077
+ function ta(e) {
1078
+ return He = ea(e), Sn = He.format, Cn = He.formatPrefix, He;
1079
+ }
1080
+ function na(e) {
1081
+ return Math.max(0, -xe(Math.abs(e)));
1082
+ }
1083
+ function ra(e, t) {
1084
+ return Math.max(0, Math.max(-8, Math.min(8, Math.floor(xe(t) / 3))) * 3 - xe(Math.abs(e)));
1085
+ }
1086
+ function aa(e, t) {
1087
+ return e = Math.abs(e), t = Math.abs(t) - e, Math.max(0, xe(t) - xe(e)) + 1;
1088
+ }
1089
+ function oa(e, t, n, r) {
1090
+ var a = gr(e, t, n), o;
1091
+ switch (r = Ke(r ?? ",f"), r.type) {
1092
+ case "s": {
1093
+ var i = Math.max(Math.abs(e), Math.abs(t));
1094
+ return r.precision == null && !isNaN(o = ra(a, i)) && (r.precision = o), Cn(r, i);
1095
+ }
1096
+ case "":
1097
+ case "e":
1098
+ case "g":
1099
+ case "p":
1100
+ case "r": {
1101
+ r.precision == null && !isNaN(o = aa(a, Math.max(Math.abs(e), Math.abs(t)))) && (r.precision = o - (r.type === "e"));
1102
+ break;
1103
+ }
1104
+ case "f":
1105
+ case "%": {
1106
+ r.precision == null && !isNaN(o = na(a)) && (r.precision = o - (r.type === "%") * 2);
1107
+ break;
1108
+ }
1109
+ }
1110
+ return Sn(r);
1111
+ }
1112
+ function ia(e) {
1113
+ var t = e.domain;
1114
+ return e.ticks = function(n) {
1115
+ var r = t();
1116
+ return hr(r[0], r[r.length - 1], n ?? 10);
1117
+ }, e.tickFormat = function(n, r) {
1118
+ var a = t();
1119
+ return oa(a[0], a[a.length - 1], n ?? 10, r);
1120
+ }, e.nice = function(n) {
1121
+ n == null && (n = 10);
1122
+ var r = t(), a = 0, o = r.length - 1, i = r[a], s = r[o], u, c, h = 10;
1123
+ for (s < i && (c = i, i = s, s = c, c = a, a = o, o = c); h-- > 0; ) {
1124
+ if (c = at(i, s, n), c === u)
1125
+ return r[a] = i, r[o] = s, t(r);
1126
+ if (c > 0)
1127
+ i = Math.floor(i / c) * c, s = Math.ceil(s / c) * c;
1128
+ else if (c < 0)
1129
+ i = Math.ceil(i * c) / c, s = Math.floor(s * c) / c;
1130
+ else
1131
+ break;
1132
+ u = c;
1133
+ }
1134
+ return e;
1135
+ }, e;
1136
+ }
1137
+ function Nn() {
1138
+ var e = Vr();
1139
+ return e.copy = function() {
1140
+ return qr(e, Nn());
1141
+ }, ut.apply(e, arguments), ia(e);
1142
+ }
1143
+ const Rn = 6048e5, sa = 864e5, Tn = 6e4, Dn = 36e5, Vt = /* @__PURE__ */ Symbol.for("constructDateFrom");
1144
+ function H(e, t) {
1145
+ return typeof e == "function" ? e(t) : e && typeof e == "object" && Vt in e ? e[Vt](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
1146
+ }
1147
+ function R(e, t) {
1148
+ return H(t || e, e);
1149
+ }
1150
+ function An(e, t, n) {
1151
+ const r = R(e, n?.in);
1152
+ return isNaN(t) ? H(e, NaN) : (t && r.setDate(r.getDate() + t), r);
1153
+ }
1154
+ function ca(e, t, n) {
1155
+ const r = R(e, n?.in);
1156
+ if (isNaN(t)) return H(e, NaN);
1157
+ if (!t)
1158
+ return r;
1159
+ const a = r.getDate(), o = H(e, r.getTime());
1160
+ o.setMonth(r.getMonth() + t + 1, 0);
1161
+ const i = o.getDate();
1162
+ return a >= i ? o : (r.setFullYear(
1163
+ o.getFullYear(),
1164
+ o.getMonth(),
1165
+ a
1166
+ ), r);
1167
+ }
1168
+ let ua = {};
1169
+ function je() {
1170
+ return ua;
1171
+ }
1172
+ function U(e, t) {
1173
+ const n = je(), r = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, a = R(e, t?.in), o = a.getDay(), i = (o < r ? 7 : 0) + o - r;
1174
+ return a.setDate(a.getDate() - i), a.setHours(0, 0, 0, 0), a;
1175
+ }
1176
+ function Qe(e, t) {
1177
+ return U(e, { ...t, weekStartsOn: 1 });
1178
+ }
1179
+ function In(e, t) {
1180
+ const n = R(e, t?.in), r = n.getFullYear(), a = H(n, 0);
1181
+ a.setFullYear(r + 1, 0, 4), a.setHours(0, 0, 0, 0);
1182
+ const o = Qe(a), i = H(n, 0);
1183
+ i.setFullYear(r, 0, 4), i.setHours(0, 0, 0, 0);
1184
+ const s = Qe(i);
1185
+ return n.getTime() >= o.getTime() ? r + 1 : n.getTime() >= s.getTime() ? r : r - 1;
1186
+ }
1187
+ function zt(e) {
1188
+ const t = R(e), n = new Date(
1189
+ Date.UTC(
1190
+ t.getFullYear(),
1191
+ t.getMonth(),
1192
+ t.getDate(),
1193
+ t.getHours(),
1194
+ t.getMinutes(),
1195
+ t.getSeconds(),
1196
+ t.getMilliseconds()
1197
+ )
1198
+ );
1199
+ return n.setUTCFullYear(t.getFullYear()), +e - +n;
1200
+ }
1201
+ function Pn(e, ...t) {
1202
+ const n = H.bind(
1203
+ null,
1204
+ t.find((r) => typeof r == "object")
1205
+ );
1206
+ return t.map(n);
1207
+ }
1208
+ function Xt(e, t) {
1209
+ const n = R(e, t?.in);
1210
+ return n.setHours(0, 0, 0, 0), n;
1211
+ }
1212
+ function la(e, t, n) {
1213
+ const [r, a] = Pn(
1214
+ n?.in,
1215
+ e,
1216
+ t
1217
+ ), o = Xt(r), i = Xt(a), s = +o - zt(o), u = +i - zt(i);
1218
+ return Math.round((s - u) / sa);
1219
+ }
1220
+ function fa(e, t) {
1221
+ const n = In(e, t), r = H(e, 0);
1222
+ return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), Qe(r);
1223
+ }
1224
+ function jn(e, t, n) {
1225
+ return An(e, t * 7, n);
1226
+ }
1227
+ function da(e) {
1228
+ return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
1229
+ }
1230
+ function $n(e) {
1231
+ return !(!da(e) && typeof e != "number" || isNaN(+R(e)));
1232
+ }
1233
+ function ha(e, t) {
1234
+ const n = R(e, t?.in), r = n.getMonth();
1235
+ return n.setFullYear(n.getFullYear(), r + 1, 0), n.setHours(23, 59, 59, 999), n;
1236
+ }
1237
+ function ga(e, t) {
1238
+ const [n, r] = Pn(e, t.start, t.end);
1239
+ return { start: n, end: r };
1240
+ }
1241
+ function ma(e, t) {
1242
+ const { start: n, end: r } = ga(t?.in, e);
1243
+ let a = +n > +r;
1244
+ const o = U(a ? r : n, t), i = U(a ? n : r, t);
1245
+ o.setHours(15), i.setHours(15);
1246
+ const s = +i.getTime();
1247
+ let u = o, c = 1;
1248
+ const h = [];
1249
+ for (; +u <= s; )
1250
+ u.setHours(0), h.push(H(n, u)), u = jn(u, c), u.setHours(15);
1251
+ return a ? h.reverse() : h;
1252
+ }
1253
+ function ya(e, t) {
1254
+ const n = R(e, t?.in);
1255
+ return n.setDate(1), n.setHours(0, 0, 0, 0), n;
1256
+ }
1257
+ function pa(e, t) {
1258
+ const n = R(e, t?.in);
1259
+ return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
1260
+ }
1261
+ function ct(e, t) {
1262
+ const n = je(), r = n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, a = R(e, t?.in), o = a.getDay(), i = (o < r ? -7 : 0) + 6 - (o - r);
1263
+ return a.setDate(a.getDate() + i), a.setHours(23, 59, 59, 999), a;
1264
+ }
1265
+ const ba = {
1266
+ lessThanXSeconds: {
1267
+ one: "less than a second",
1268
+ other: "less than {{count}} seconds"
1269
+ },
1270
+ xSeconds: {
1271
+ one: "1 second",
1272
+ other: "{{count}} seconds"
1273
+ },
1274
+ halfAMinute: "half a minute",
1275
+ lessThanXMinutes: {
1276
+ one: "less than a minute",
1277
+ other: "less than {{count}} minutes"
1278
+ },
1279
+ xMinutes: {
1280
+ one: "1 minute",
1281
+ other: "{{count}} minutes"
1282
+ },
1283
+ aboutXHours: {
1284
+ one: "about 1 hour",
1285
+ other: "about {{count}} hours"
1286
+ },
1287
+ xHours: {
1288
+ one: "1 hour",
1289
+ other: "{{count}} hours"
1290
+ },
1291
+ xDays: {
1292
+ one: "1 day",
1293
+ other: "{{count}} days"
1294
+ },
1295
+ aboutXWeeks: {
1296
+ one: "about 1 week",
1297
+ other: "about {{count}} weeks"
1298
+ },
1299
+ xWeeks: {
1300
+ one: "1 week",
1301
+ other: "{{count}} weeks"
1302
+ },
1303
+ aboutXMonths: {
1304
+ one: "about 1 month",
1305
+ other: "about {{count}} months"
1306
+ },
1307
+ xMonths: {
1308
+ one: "1 month",
1309
+ other: "{{count}} months"
1310
+ },
1311
+ aboutXYears: {
1312
+ one: "about 1 year",
1313
+ other: "about {{count}} years"
1314
+ },
1315
+ xYears: {
1316
+ one: "1 year",
1317
+ other: "{{count}} years"
1318
+ },
1319
+ overXYears: {
1320
+ one: "over 1 year",
1321
+ other: "over {{count}} years"
1322
+ },
1323
+ almostXYears: {
1324
+ one: "almost 1 year",
1325
+ other: "almost {{count}} years"
1326
+ }
1327
+ }, xa = (e, t, n) => {
1328
+ let r;
1329
+ const a = ba[e];
1330
+ return typeof a == "string" ? r = a : t === 1 ? r = a.one : r = a.other.replace("{{count}}", t.toString()), n?.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
1331
+ };
1332
+ function nt(e) {
1333
+ return (t = {}) => {
1334
+ const n = t.width ? String(t.width) : e.defaultWidth;
1335
+ return e.formats[n] || e.formats[e.defaultWidth];
1336
+ };
1337
+ }
1338
+ const wa = {
1339
+ full: "EEEE, MMMM do, y",
1340
+ long: "MMMM do, y",
1341
+ medium: "MMM d, y",
1342
+ short: "MM/dd/yyyy"
1343
+ }, va = {
1344
+ full: "h:mm:ss a zzzz",
1345
+ long: "h:mm:ss a z",
1346
+ medium: "h:mm:ss a",
1347
+ short: "h:mm a"
1348
+ }, Ea = {
1349
+ full: "{{date}} 'at' {{time}}",
1350
+ long: "{{date}} 'at' {{time}}",
1351
+ medium: "{{date}}, {{time}}",
1352
+ short: "{{date}}, {{time}}"
1353
+ }, Ma = {
1354
+ date: nt({
1355
+ formats: wa,
1356
+ defaultWidth: "full"
1357
+ }),
1358
+ time: nt({
1359
+ formats: va,
1360
+ defaultWidth: "full"
1361
+ }),
1362
+ dateTime: nt({
1363
+ formats: Ea,
1364
+ defaultWidth: "full"
1365
+ })
1366
+ }, ka = {
1367
+ lastWeek: "'last' eeee 'at' p",
1368
+ yesterday: "'yesterday at' p",
1369
+ today: "'today at' p",
1370
+ tomorrow: "'tomorrow at' p",
1371
+ nextWeek: "eeee 'at' p",
1372
+ other: "P"
1373
+ }, Oa = (e, t, n, r) => ka[e];
1374
+ function _e(e) {
1375
+ return (t, n) => {
1376
+ const r = n?.context ? String(n.context) : "standalone";
1377
+ let a;
1378
+ if (r === "formatting" && e.formattingValues) {
1379
+ const i = e.defaultFormattingWidth || e.defaultWidth, s = n?.width ? String(n.width) : i;
1380
+ a = e.formattingValues[s] || e.formattingValues[i];
1381
+ } else {
1382
+ const i = e.defaultWidth, s = n?.width ? String(n.width) : e.defaultWidth;
1383
+ a = e.values[s] || e.values[i];
1384
+ }
1385
+ const o = e.argumentCallback ? e.argumentCallback(t) : t;
1386
+ return a[o];
1387
+ };
1388
+ }
1389
+ const _a = {
1390
+ narrow: ["B", "A"],
1391
+ abbreviated: ["BC", "AD"],
1392
+ wide: ["Before Christ", "Anno Domini"]
1393
+ }, Sa = {
1394
+ narrow: ["1", "2", "3", "4"],
1395
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
1396
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
1397
+ }, Ca = {
1398
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
1399
+ abbreviated: [
1400
+ "Jan",
1401
+ "Feb",
1402
+ "Mar",
1403
+ "Apr",
1404
+ "May",
1405
+ "Jun",
1406
+ "Jul",
1407
+ "Aug",
1408
+ "Sep",
1409
+ "Oct",
1410
+ "Nov",
1411
+ "Dec"
1412
+ ],
1413
+ wide: [
1414
+ "January",
1415
+ "February",
1416
+ "March",
1417
+ "April",
1418
+ "May",
1419
+ "June",
1420
+ "July",
1421
+ "August",
1422
+ "September",
1423
+ "October",
1424
+ "November",
1425
+ "December"
1426
+ ]
1427
+ }, Na = {
1428
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
1429
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1430
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1431
+ wide: [
1432
+ "Sunday",
1433
+ "Monday",
1434
+ "Tuesday",
1435
+ "Wednesday",
1436
+ "Thursday",
1437
+ "Friday",
1438
+ "Saturday"
1439
+ ]
1440
+ }, Ra = {
1441
+ narrow: {
1442
+ am: "a",
1443
+ pm: "p",
1444
+ midnight: "mi",
1445
+ noon: "n",
1446
+ morning: "morning",
1447
+ afternoon: "afternoon",
1448
+ evening: "evening",
1449
+ night: "night"
1450
+ },
1451
+ abbreviated: {
1452
+ am: "AM",
1453
+ pm: "PM",
1454
+ midnight: "midnight",
1455
+ noon: "noon",
1456
+ morning: "morning",
1457
+ afternoon: "afternoon",
1458
+ evening: "evening",
1459
+ night: "night"
1460
+ },
1461
+ wide: {
1462
+ am: "a.m.",
1463
+ pm: "p.m.",
1464
+ midnight: "midnight",
1465
+ noon: "noon",
1466
+ morning: "morning",
1467
+ afternoon: "afternoon",
1468
+ evening: "evening",
1469
+ night: "night"
1470
+ }
1471
+ }, Ta = {
1472
+ narrow: {
1473
+ am: "a",
1474
+ pm: "p",
1475
+ midnight: "mi",
1476
+ noon: "n",
1477
+ morning: "in the morning",
1478
+ afternoon: "in the afternoon",
1479
+ evening: "in the evening",
1480
+ night: "at night"
1481
+ },
1482
+ abbreviated: {
1483
+ am: "AM",
1484
+ pm: "PM",
1485
+ midnight: "midnight",
1486
+ noon: "noon",
1487
+ morning: "in the morning",
1488
+ afternoon: "in the afternoon",
1489
+ evening: "in the evening",
1490
+ night: "at night"
1491
+ },
1492
+ wide: {
1493
+ am: "a.m.",
1494
+ pm: "p.m.",
1495
+ midnight: "midnight",
1496
+ noon: "noon",
1497
+ morning: "in the morning",
1498
+ afternoon: "in the afternoon",
1499
+ evening: "in the evening",
1500
+ night: "at night"
1501
+ }
1502
+ }, Da = (e, t) => {
1503
+ const n = Number(e), r = n % 100;
1504
+ if (r > 20 || r < 10)
1505
+ switch (r % 10) {
1506
+ case 1:
1507
+ return n + "st";
1508
+ case 2:
1509
+ return n + "nd";
1510
+ case 3:
1511
+ return n + "rd";
1512
+ }
1513
+ return n + "th";
1514
+ }, Aa = {
1515
+ ordinalNumber: Da,
1516
+ era: _e({
1517
+ values: _a,
1518
+ defaultWidth: "wide"
1519
+ }),
1520
+ quarter: _e({
1521
+ values: Sa,
1522
+ defaultWidth: "wide",
1523
+ argumentCallback: (e) => e - 1
1524
+ }),
1525
+ month: _e({
1526
+ values: Ca,
1527
+ defaultWidth: "wide"
1528
+ }),
1529
+ day: _e({
1530
+ values: Na,
1531
+ defaultWidth: "wide"
1532
+ }),
1533
+ dayPeriod: _e({
1534
+ values: Ra,
1535
+ defaultWidth: "wide",
1536
+ formattingValues: Ta,
1537
+ defaultFormattingWidth: "wide"
1538
+ })
1539
+ };
1540
+ function Se(e) {
1541
+ return (t, n = {}) => {
1542
+ const r = n.width, a = r && e.matchPatterns[r] || e.matchPatterns[e.defaultMatchWidth], o = t.match(a);
1543
+ if (!o)
1544
+ return null;
1545
+ const i = o[0], s = r && e.parsePatterns[r] || e.parsePatterns[e.defaultParseWidth], u = Array.isArray(s) ? Pa(s, (f) => f.test(i)) : (
1546
+ // [TODO] -- I challenge you to fix the type
1547
+ Ia(s, (f) => f.test(i))
1548
+ );
1549
+ let c;
1550
+ c = e.valueCallback ? e.valueCallback(u) : u, c = n.valueCallback ? (
1551
+ // [TODO] -- I challenge you to fix the type
1552
+ n.valueCallback(c)
1553
+ ) : c;
1554
+ const h = t.slice(i.length);
1555
+ return { value: c, rest: h };
1556
+ };
1557
+ }
1558
+ function Ia(e, t) {
1559
+ for (const n in e)
1560
+ if (Object.prototype.hasOwnProperty.call(e, n) && t(e[n]))
1561
+ return n;
1562
+ }
1563
+ function Pa(e, t) {
1564
+ for (let n = 0; n < e.length; n++)
1565
+ if (t(e[n]))
1566
+ return n;
1567
+ }
1568
+ function ja(e) {
1569
+ return (t, n = {}) => {
1570
+ const r = t.match(e.matchPattern);
1571
+ if (!r) return null;
1572
+ const a = r[0], o = t.match(e.parsePattern);
1573
+ if (!o) return null;
1574
+ let i = e.valueCallback ? e.valueCallback(o[0]) : o[0];
1575
+ i = n.valueCallback ? n.valueCallback(i) : i;
1576
+ const s = t.slice(a.length);
1577
+ return { value: i, rest: s };
1578
+ };
1579
+ }
1580
+ const $a = /^(\d+)(th|st|nd|rd)?/i, Ya = /\d+/i, Fa = {
1581
+ narrow: /^(b|a)/i,
1582
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1583
+ wide: /^(before christ|before common era|anno domini|common era)/i
1584
+ }, Wa = {
1585
+ any: [/^b/i, /^(a|c)/i]
1586
+ }, La = {
1587
+ narrow: /^[1234]/i,
1588
+ abbreviated: /^q[1234]/i,
1589
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1590
+ }, Ha = {
1591
+ any: [/1/i, /2/i, /3/i, /4/i]
1592
+ }, Ga = {
1593
+ narrow: /^[jfmasond]/i,
1594
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1595
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1596
+ }, Ua = {
1597
+ narrow: [
1598
+ /^j/i,
1599
+ /^f/i,
1600
+ /^m/i,
1601
+ /^a/i,
1602
+ /^m/i,
1603
+ /^j/i,
1604
+ /^j/i,
1605
+ /^a/i,
1606
+ /^s/i,
1607
+ /^o/i,
1608
+ /^n/i,
1609
+ /^d/i
1610
+ ],
1611
+ any: [
1612
+ /^ja/i,
1613
+ /^f/i,
1614
+ /^mar/i,
1615
+ /^ap/i,
1616
+ /^may/i,
1617
+ /^jun/i,
1618
+ /^jul/i,
1619
+ /^au/i,
1620
+ /^s/i,
1621
+ /^o/i,
1622
+ /^n/i,
1623
+ /^d/i
1624
+ ]
1625
+ }, qa = {
1626
+ narrow: /^[smtwf]/i,
1627
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1628
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1629
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1630
+ }, Ba = {
1631
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1632
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1633
+ }, Va = {
1634
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1635
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1636
+ }, za = {
1637
+ any: {
1638
+ am: /^a/i,
1639
+ pm: /^p/i,
1640
+ midnight: /^mi/i,
1641
+ noon: /^no/i,
1642
+ morning: /morning/i,
1643
+ afternoon: /afternoon/i,
1644
+ evening: /evening/i,
1645
+ night: /night/i
1646
+ }
1647
+ }, Xa = {
1648
+ ordinalNumber: ja({
1649
+ matchPattern: $a,
1650
+ parsePattern: Ya,
1651
+ valueCallback: (e) => parseInt(e, 10)
1652
+ }),
1653
+ era: Se({
1654
+ matchPatterns: Fa,
1655
+ defaultMatchWidth: "wide",
1656
+ parsePatterns: Wa,
1657
+ defaultParseWidth: "any"
1658
+ }),
1659
+ quarter: Se({
1660
+ matchPatterns: La,
1661
+ defaultMatchWidth: "wide",
1662
+ parsePatterns: Ha,
1663
+ defaultParseWidth: "any",
1664
+ valueCallback: (e) => e + 1
1665
+ }),
1666
+ month: Se({
1667
+ matchPatterns: Ga,
1668
+ defaultMatchWidth: "wide",
1669
+ parsePatterns: Ua,
1670
+ defaultParseWidth: "any"
1671
+ }),
1672
+ day: Se({
1673
+ matchPatterns: qa,
1674
+ defaultMatchWidth: "wide",
1675
+ parsePatterns: Ba,
1676
+ defaultParseWidth: "any"
1677
+ }),
1678
+ dayPeriod: Se({
1679
+ matchPatterns: Va,
1680
+ defaultMatchWidth: "any",
1681
+ parsePatterns: za,
1682
+ defaultParseWidth: "any"
1683
+ })
1684
+ }, Ja = {
1685
+ code: "en-US",
1686
+ formatDistance: xa,
1687
+ formatLong: Ma,
1688
+ formatRelative: Oa,
1689
+ localize: Aa,
1690
+ match: Xa,
1691
+ options: {
1692
+ weekStartsOn: 0,
1693
+ firstWeekContainsDate: 1
1694
+ }
1695
+ };
1696
+ function Ka(e, t) {
1697
+ const n = R(e, t?.in);
1698
+ return la(n, pa(n)) + 1;
1699
+ }
1700
+ function Qa(e, t) {
1701
+ const n = R(e, t?.in), r = +Qe(n) - +fa(n);
1702
+ return Math.round(r / Rn) + 1;
1703
+ }
1704
+ function Yn(e, t) {
1705
+ const n = R(e, t?.in), r = n.getFullYear(), a = je(), o = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? a.firstWeekContainsDate ?? a.locale?.options?.firstWeekContainsDate ?? 1, i = H(t?.in || e, 0);
1706
+ i.setFullYear(r + 1, 0, o), i.setHours(0, 0, 0, 0);
1707
+ const s = U(i, t), u = H(t?.in || e, 0);
1708
+ u.setFullYear(r, 0, o), u.setHours(0, 0, 0, 0);
1709
+ const c = U(u, t);
1710
+ return +n >= +s ? r + 1 : +n >= +c ? r : r - 1;
1711
+ }
1712
+ function Za(e, t) {
1713
+ const n = je(), r = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, a = Yn(e, t), o = H(t?.in || e, 0);
1714
+ return o.setFullYear(a, 0, r), o.setHours(0, 0, 0, 0), U(o, t);
1715
+ }
1716
+ function eo(e, t) {
1717
+ const n = R(e, t?.in), r = +U(n, t) - +Za(n, t);
1718
+ return Math.round(r / Rn) + 1;
1719
+ }
1720
+ function _(e, t) {
1721
+ const n = e < 0 ? "-" : "", r = Math.abs(e).toString().padStart(t, "0");
1722
+ return n + r;
1723
+ }
1724
+ const ne = {
1725
+ // Year
1726
+ y(e, t) {
1727
+ const n = e.getFullYear(), r = n > 0 ? n : 1 - n;
1728
+ return _(t === "yy" ? r % 100 : r, t.length);
1729
+ },
1730
+ // Month
1731
+ M(e, t) {
1732
+ const n = e.getMonth();
1733
+ return t === "M" ? String(n + 1) : _(n + 1, 2);
1734
+ },
1735
+ // Day of the month
1736
+ d(e, t) {
1737
+ return _(e.getDate(), t.length);
1738
+ },
1739
+ // AM or PM
1740
+ a(e, t) {
1741
+ const n = e.getHours() / 12 >= 1 ? "pm" : "am";
1742
+ switch (t) {
1743
+ case "a":
1744
+ case "aa":
1745
+ return n.toUpperCase();
1746
+ case "aaa":
1747
+ return n;
1748
+ case "aaaaa":
1749
+ return n[0];
1750
+ default:
1751
+ return n === "am" ? "a.m." : "p.m.";
1752
+ }
1753
+ },
1754
+ // Hour [1-12]
1755
+ h(e, t) {
1756
+ return _(e.getHours() % 12 || 12, t.length);
1757
+ },
1758
+ // Hour [0-23]
1759
+ H(e, t) {
1760
+ return _(e.getHours(), t.length);
1761
+ },
1762
+ // Minute
1763
+ m(e, t) {
1764
+ return _(e.getMinutes(), t.length);
1765
+ },
1766
+ // Second
1767
+ s(e, t) {
1768
+ return _(e.getSeconds(), t.length);
1769
+ },
1770
+ // Fraction of second
1771
+ S(e, t) {
1772
+ const n = t.length, r = e.getMilliseconds(), a = Math.trunc(
1773
+ r * Math.pow(10, n - 3)
1774
+ );
1775
+ return _(a, t.length);
1776
+ }
1777
+ }, me = {
1778
+ midnight: "midnight",
1779
+ noon: "noon",
1780
+ morning: "morning",
1781
+ afternoon: "afternoon",
1782
+ evening: "evening",
1783
+ night: "night"
1784
+ }, Jt = {
1785
+ // Era
1786
+ G: function(e, t, n) {
1787
+ const r = e.getFullYear() > 0 ? 1 : 0;
1788
+ switch (t) {
1789
+ // AD, BC
1790
+ case "G":
1791
+ case "GG":
1792
+ case "GGG":
1793
+ return n.era(r, { width: "abbreviated" });
1794
+ // A, B
1795
+ case "GGGGG":
1796
+ return n.era(r, { width: "narrow" });
1797
+ default:
1798
+ return n.era(r, { width: "wide" });
1799
+ }
1800
+ },
1801
+ // Year
1802
+ y: function(e, t, n) {
1803
+ if (t === "yo") {
1804
+ const r = e.getFullYear(), a = r > 0 ? r : 1 - r;
1805
+ return n.ordinalNumber(a, { unit: "year" });
1806
+ }
1807
+ return ne.y(e, t);
1808
+ },
1809
+ // Local week-numbering year
1810
+ Y: function(e, t, n, r) {
1811
+ const a = Yn(e, r), o = a > 0 ? a : 1 - a;
1812
+ if (t === "YY") {
1813
+ const i = o % 100;
1814
+ return _(i, 2);
1815
+ }
1816
+ return t === "Yo" ? n.ordinalNumber(o, { unit: "year" }) : _(o, t.length);
1817
+ },
1818
+ // ISO week-numbering year
1819
+ R: function(e, t) {
1820
+ const n = In(e);
1821
+ return _(n, t.length);
1822
+ },
1823
+ // Extended year. This is a single number designating the year of this calendar system.
1824
+ // The main difference between `y` and `u` localizers are B.C. years:
1825
+ // | Year | `y` | `u` |
1826
+ // |------|-----|-----|
1827
+ // | AC 1 | 1 | 1 |
1828
+ // | BC 1 | 1 | 0 |
1829
+ // | BC 2 | 2 | -1 |
1830
+ // Also `yy` always returns the last two digits of a year,
1831
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1832
+ u: function(e, t) {
1833
+ const n = e.getFullYear();
1834
+ return _(n, t.length);
1835
+ },
1836
+ // Quarter
1837
+ Q: function(e, t, n) {
1838
+ const r = Math.ceil((e.getMonth() + 1) / 3);
1839
+ switch (t) {
1840
+ // 1, 2, 3, 4
1841
+ case "Q":
1842
+ return String(r);
1843
+ // 01, 02, 03, 04
1844
+ case "QQ":
1845
+ return _(r, 2);
1846
+ // 1st, 2nd, 3rd, 4th
1847
+ case "Qo":
1848
+ return n.ordinalNumber(r, { unit: "quarter" });
1849
+ // Q1, Q2, Q3, Q4
1850
+ case "QQQ":
1851
+ return n.quarter(r, {
1852
+ width: "abbreviated",
1853
+ context: "formatting"
1854
+ });
1855
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1856
+ case "QQQQQ":
1857
+ return n.quarter(r, {
1858
+ width: "narrow",
1859
+ context: "formatting"
1860
+ });
1861
+ default:
1862
+ return n.quarter(r, {
1863
+ width: "wide",
1864
+ context: "formatting"
1865
+ });
1866
+ }
1867
+ },
1868
+ // Stand-alone quarter
1869
+ q: function(e, t, n) {
1870
+ const r = Math.ceil((e.getMonth() + 1) / 3);
1871
+ switch (t) {
1872
+ // 1, 2, 3, 4
1873
+ case "q":
1874
+ return String(r);
1875
+ // 01, 02, 03, 04
1876
+ case "qq":
1877
+ return _(r, 2);
1878
+ // 1st, 2nd, 3rd, 4th
1879
+ case "qo":
1880
+ return n.ordinalNumber(r, { unit: "quarter" });
1881
+ // Q1, Q2, Q3, Q4
1882
+ case "qqq":
1883
+ return n.quarter(r, {
1884
+ width: "abbreviated",
1885
+ context: "standalone"
1886
+ });
1887
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1888
+ case "qqqqq":
1889
+ return n.quarter(r, {
1890
+ width: "narrow",
1891
+ context: "standalone"
1892
+ });
1893
+ default:
1894
+ return n.quarter(r, {
1895
+ width: "wide",
1896
+ context: "standalone"
1897
+ });
1898
+ }
1899
+ },
1900
+ // Month
1901
+ M: function(e, t, n) {
1902
+ const r = e.getMonth();
1903
+ switch (t) {
1904
+ case "M":
1905
+ case "MM":
1906
+ return ne.M(e, t);
1907
+ // 1st, 2nd, ..., 12th
1908
+ case "Mo":
1909
+ return n.ordinalNumber(r + 1, { unit: "month" });
1910
+ // Jan, Feb, ..., Dec
1911
+ case "MMM":
1912
+ return n.month(r, {
1913
+ width: "abbreviated",
1914
+ context: "formatting"
1915
+ });
1916
+ // J, F, ..., D
1917
+ case "MMMMM":
1918
+ return n.month(r, {
1919
+ width: "narrow",
1920
+ context: "formatting"
1921
+ });
1922
+ default:
1923
+ return n.month(r, { width: "wide", context: "formatting" });
1924
+ }
1925
+ },
1926
+ // Stand-alone month
1927
+ L: function(e, t, n) {
1928
+ const r = e.getMonth();
1929
+ switch (t) {
1930
+ // 1, 2, ..., 12
1931
+ case "L":
1932
+ return String(r + 1);
1933
+ // 01, 02, ..., 12
1934
+ case "LL":
1935
+ return _(r + 1, 2);
1936
+ // 1st, 2nd, ..., 12th
1937
+ case "Lo":
1938
+ return n.ordinalNumber(r + 1, { unit: "month" });
1939
+ // Jan, Feb, ..., Dec
1940
+ case "LLL":
1941
+ return n.month(r, {
1942
+ width: "abbreviated",
1943
+ context: "standalone"
1944
+ });
1945
+ // J, F, ..., D
1946
+ case "LLLLL":
1947
+ return n.month(r, {
1948
+ width: "narrow",
1949
+ context: "standalone"
1950
+ });
1951
+ default:
1952
+ return n.month(r, { width: "wide", context: "standalone" });
1953
+ }
1954
+ },
1955
+ // Local week of year
1956
+ w: function(e, t, n, r) {
1957
+ const a = eo(e, r);
1958
+ return t === "wo" ? n.ordinalNumber(a, { unit: "week" }) : _(a, t.length);
1959
+ },
1960
+ // ISO week of year
1961
+ I: function(e, t, n) {
1962
+ const r = Qa(e);
1963
+ return t === "Io" ? n.ordinalNumber(r, { unit: "week" }) : _(r, t.length);
1964
+ },
1965
+ // Day of the month
1966
+ d: function(e, t, n) {
1967
+ return t === "do" ? n.ordinalNumber(e.getDate(), { unit: "date" }) : ne.d(e, t);
1968
+ },
1969
+ // Day of year
1970
+ D: function(e, t, n) {
1971
+ const r = Ka(e);
1972
+ return t === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : _(r, t.length);
1973
+ },
1974
+ // Day of week
1975
+ E: function(e, t, n) {
1976
+ const r = e.getDay();
1977
+ switch (t) {
1978
+ // Tue
1979
+ case "E":
1980
+ case "EE":
1981
+ case "EEE":
1982
+ return n.day(r, {
1983
+ width: "abbreviated",
1984
+ context: "formatting"
1985
+ });
1986
+ // T
1987
+ case "EEEEE":
1988
+ return n.day(r, {
1989
+ width: "narrow",
1990
+ context: "formatting"
1991
+ });
1992
+ // Tu
1993
+ case "EEEEEE":
1994
+ return n.day(r, {
1995
+ width: "short",
1996
+ context: "formatting"
1997
+ });
1998
+ default:
1999
+ return n.day(r, {
2000
+ width: "wide",
2001
+ context: "formatting"
2002
+ });
2003
+ }
2004
+ },
2005
+ // Local day of week
2006
+ e: function(e, t, n, r) {
2007
+ const a = e.getDay(), o = (a - r.weekStartsOn + 8) % 7 || 7;
2008
+ switch (t) {
2009
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
2010
+ case "e":
2011
+ return String(o);
2012
+ // Padded numerical value
2013
+ case "ee":
2014
+ return _(o, 2);
2015
+ // 1st, 2nd, ..., 7th
2016
+ case "eo":
2017
+ return n.ordinalNumber(o, { unit: "day" });
2018
+ case "eee":
2019
+ return n.day(a, {
2020
+ width: "abbreviated",
2021
+ context: "formatting"
2022
+ });
2023
+ // T
2024
+ case "eeeee":
2025
+ return n.day(a, {
2026
+ width: "narrow",
2027
+ context: "formatting"
2028
+ });
2029
+ // Tu
2030
+ case "eeeeee":
2031
+ return n.day(a, {
2032
+ width: "short",
2033
+ context: "formatting"
2034
+ });
2035
+ default:
2036
+ return n.day(a, {
2037
+ width: "wide",
2038
+ context: "formatting"
2039
+ });
2040
+ }
2041
+ },
2042
+ // Stand-alone local day of week
2043
+ c: function(e, t, n, r) {
2044
+ const a = e.getDay(), o = (a - r.weekStartsOn + 8) % 7 || 7;
2045
+ switch (t) {
2046
+ // Numerical value (same as in `e`)
2047
+ case "c":
2048
+ return String(o);
2049
+ // Padded numerical value
2050
+ case "cc":
2051
+ return _(o, t.length);
2052
+ // 1st, 2nd, ..., 7th
2053
+ case "co":
2054
+ return n.ordinalNumber(o, { unit: "day" });
2055
+ case "ccc":
2056
+ return n.day(a, {
2057
+ width: "abbreviated",
2058
+ context: "standalone"
2059
+ });
2060
+ // T
2061
+ case "ccccc":
2062
+ return n.day(a, {
2063
+ width: "narrow",
2064
+ context: "standalone"
2065
+ });
2066
+ // Tu
2067
+ case "cccccc":
2068
+ return n.day(a, {
2069
+ width: "short",
2070
+ context: "standalone"
2071
+ });
2072
+ default:
2073
+ return n.day(a, {
2074
+ width: "wide",
2075
+ context: "standalone"
2076
+ });
2077
+ }
2078
+ },
2079
+ // ISO day of week
2080
+ i: function(e, t, n) {
2081
+ const r = e.getDay(), a = r === 0 ? 7 : r;
2082
+ switch (t) {
2083
+ // 2
2084
+ case "i":
2085
+ return String(a);
2086
+ // 02
2087
+ case "ii":
2088
+ return _(a, t.length);
2089
+ // 2nd
2090
+ case "io":
2091
+ return n.ordinalNumber(a, { unit: "day" });
2092
+ // Tue
2093
+ case "iii":
2094
+ return n.day(r, {
2095
+ width: "abbreviated",
2096
+ context: "formatting"
2097
+ });
2098
+ // T
2099
+ case "iiiii":
2100
+ return n.day(r, {
2101
+ width: "narrow",
2102
+ context: "formatting"
2103
+ });
2104
+ // Tu
2105
+ case "iiiiii":
2106
+ return n.day(r, {
2107
+ width: "short",
2108
+ context: "formatting"
2109
+ });
2110
+ default:
2111
+ return n.day(r, {
2112
+ width: "wide",
2113
+ context: "formatting"
2114
+ });
2115
+ }
2116
+ },
2117
+ // AM or PM
2118
+ a: function(e, t, n) {
2119
+ const a = e.getHours() / 12 >= 1 ? "pm" : "am";
2120
+ switch (t) {
2121
+ case "a":
2122
+ case "aa":
2123
+ return n.dayPeriod(a, {
2124
+ width: "abbreviated",
2125
+ context: "formatting"
2126
+ });
2127
+ case "aaa":
2128
+ return n.dayPeriod(a, {
2129
+ width: "abbreviated",
2130
+ context: "formatting"
2131
+ }).toLowerCase();
2132
+ case "aaaaa":
2133
+ return n.dayPeriod(a, {
2134
+ width: "narrow",
2135
+ context: "formatting"
2136
+ });
2137
+ default:
2138
+ return n.dayPeriod(a, {
2139
+ width: "wide",
2140
+ context: "formatting"
2141
+ });
2142
+ }
2143
+ },
2144
+ // AM, PM, midnight, noon
2145
+ b: function(e, t, n) {
2146
+ const r = e.getHours();
2147
+ let a;
2148
+ switch (r === 12 ? a = me.noon : r === 0 ? a = me.midnight : a = r / 12 >= 1 ? "pm" : "am", t) {
2149
+ case "b":
2150
+ case "bb":
2151
+ return n.dayPeriod(a, {
2152
+ width: "abbreviated",
2153
+ context: "formatting"
2154
+ });
2155
+ case "bbb":
2156
+ return n.dayPeriod(a, {
2157
+ width: "abbreviated",
2158
+ context: "formatting"
2159
+ }).toLowerCase();
2160
+ case "bbbbb":
2161
+ return n.dayPeriod(a, {
2162
+ width: "narrow",
2163
+ context: "formatting"
2164
+ });
2165
+ default:
2166
+ return n.dayPeriod(a, {
2167
+ width: "wide",
2168
+ context: "formatting"
2169
+ });
2170
+ }
2171
+ },
2172
+ // in the morning, in the afternoon, in the evening, at night
2173
+ B: function(e, t, n) {
2174
+ const r = e.getHours();
2175
+ let a;
2176
+ switch (r >= 17 ? a = me.evening : r >= 12 ? a = me.afternoon : r >= 4 ? a = me.morning : a = me.night, t) {
2177
+ case "B":
2178
+ case "BB":
2179
+ case "BBB":
2180
+ return n.dayPeriod(a, {
2181
+ width: "abbreviated",
2182
+ context: "formatting"
2183
+ });
2184
+ case "BBBBB":
2185
+ return n.dayPeriod(a, {
2186
+ width: "narrow",
2187
+ context: "formatting"
2188
+ });
2189
+ default:
2190
+ return n.dayPeriod(a, {
2191
+ width: "wide",
2192
+ context: "formatting"
2193
+ });
2194
+ }
2195
+ },
2196
+ // Hour [1-12]
2197
+ h: function(e, t, n) {
2198
+ if (t === "ho") {
2199
+ let r = e.getHours() % 12;
2200
+ return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
2201
+ }
2202
+ return ne.h(e, t);
2203
+ },
2204
+ // Hour [0-23]
2205
+ H: function(e, t, n) {
2206
+ return t === "Ho" ? n.ordinalNumber(e.getHours(), { unit: "hour" }) : ne.H(e, t);
2207
+ },
2208
+ // Hour [0-11]
2209
+ K: function(e, t, n) {
2210
+ const r = e.getHours() % 12;
2211
+ return t === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : _(r, t.length);
2212
+ },
2213
+ // Hour [1-24]
2214
+ k: function(e, t, n) {
2215
+ let r = e.getHours();
2216
+ return r === 0 && (r = 24), t === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : _(r, t.length);
2217
+ },
2218
+ // Minute
2219
+ m: function(e, t, n) {
2220
+ return t === "mo" ? n.ordinalNumber(e.getMinutes(), { unit: "minute" }) : ne.m(e, t);
2221
+ },
2222
+ // Second
2223
+ s: function(e, t, n) {
2224
+ return t === "so" ? n.ordinalNumber(e.getSeconds(), { unit: "second" }) : ne.s(e, t);
2225
+ },
2226
+ // Fraction of second
2227
+ S: function(e, t) {
2228
+ return ne.S(e, t);
2229
+ },
2230
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
2231
+ X: function(e, t, n) {
2232
+ const r = e.getTimezoneOffset();
2233
+ if (r === 0)
2234
+ return "Z";
2235
+ switch (t) {
2236
+ // Hours and optional minutes
2237
+ case "X":
2238
+ return Qt(r);
2239
+ // Hours, minutes and optional seconds without `:` delimiter
2240
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2241
+ // so this token always has the same output as `XX`
2242
+ case "XXXX":
2243
+ case "XX":
2244
+ return ue(r);
2245
+ // Hours and minutes with `:` delimiter
2246
+ default:
2247
+ return ue(r, ":");
2248
+ }
2249
+ },
2250
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
2251
+ x: function(e, t, n) {
2252
+ const r = e.getTimezoneOffset();
2253
+ switch (t) {
2254
+ // Hours and optional minutes
2255
+ case "x":
2256
+ return Qt(r);
2257
+ // Hours, minutes and optional seconds without `:` delimiter
2258
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2259
+ // so this token always has the same output as `xx`
2260
+ case "xxxx":
2261
+ case "xx":
2262
+ return ue(r);
2263
+ // Hours and minutes with `:` delimiter
2264
+ default:
2265
+ return ue(r, ":");
2266
+ }
2267
+ },
2268
+ // Timezone (GMT)
2269
+ O: function(e, t, n) {
2270
+ const r = e.getTimezoneOffset();
2271
+ switch (t) {
2272
+ // Short
2273
+ case "O":
2274
+ case "OO":
2275
+ case "OOO":
2276
+ return "GMT" + Kt(r, ":");
2277
+ default:
2278
+ return "GMT" + ue(r, ":");
2279
+ }
2280
+ },
2281
+ // Timezone (specific non-location)
2282
+ z: function(e, t, n) {
2283
+ const r = e.getTimezoneOffset();
2284
+ switch (t) {
2285
+ // Short
2286
+ case "z":
2287
+ case "zz":
2288
+ case "zzz":
2289
+ return "GMT" + Kt(r, ":");
2290
+ default:
2291
+ return "GMT" + ue(r, ":");
2292
+ }
2293
+ },
2294
+ // Seconds timestamp
2295
+ t: function(e, t, n) {
2296
+ const r = Math.trunc(+e / 1e3);
2297
+ return _(r, t.length);
2298
+ },
2299
+ // Milliseconds timestamp
2300
+ T: function(e, t, n) {
2301
+ return _(+e, t.length);
2302
+ }
2303
+ };
2304
+ function Kt(e, t = "") {
2305
+ const n = e > 0 ? "-" : "+", r = Math.abs(e), a = Math.trunc(r / 60), o = r % 60;
2306
+ return o === 0 ? n + String(a) : n + String(a) + t + _(o, 2);
2307
+ }
2308
+ function Qt(e, t) {
2309
+ return e % 60 === 0 ? (e > 0 ? "-" : "+") + _(Math.abs(e) / 60, 2) : ue(e, t);
2310
+ }
2311
+ function ue(e, t = "") {
2312
+ const n = e > 0 ? "-" : "+", r = Math.abs(e), a = _(Math.trunc(r / 60), 2), o = _(r % 60, 2);
2313
+ return n + a + t + o;
2314
+ }
2315
+ const Zt = (e, t) => {
2316
+ switch (e) {
2317
+ case "P":
2318
+ return t.date({ width: "short" });
2319
+ case "PP":
2320
+ return t.date({ width: "medium" });
2321
+ case "PPP":
2322
+ return t.date({ width: "long" });
2323
+ default:
2324
+ return t.date({ width: "full" });
2325
+ }
2326
+ }, Fn = (e, t) => {
2327
+ switch (e) {
2328
+ case "p":
2329
+ return t.time({ width: "short" });
2330
+ case "pp":
2331
+ return t.time({ width: "medium" });
2332
+ case "ppp":
2333
+ return t.time({ width: "long" });
2334
+ default:
2335
+ return t.time({ width: "full" });
2336
+ }
2337
+ }, to = (e, t) => {
2338
+ const n = e.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
2339
+ if (!a)
2340
+ return Zt(e, t);
2341
+ let o;
2342
+ switch (r) {
2343
+ case "P":
2344
+ o = t.dateTime({ width: "short" });
2345
+ break;
2346
+ case "PP":
2347
+ o = t.dateTime({ width: "medium" });
2348
+ break;
2349
+ case "PPP":
2350
+ o = t.dateTime({ width: "long" });
2351
+ break;
2352
+ default:
2353
+ o = t.dateTime({ width: "full" });
2354
+ break;
2355
+ }
2356
+ return o.replace("{{date}}", Zt(r, t)).replace("{{time}}", Fn(a, t));
2357
+ }, no = {
2358
+ p: Fn,
2359
+ P: to
2360
+ }, ro = /^D+$/, ao = /^Y+$/, oo = ["D", "DD", "YY", "YYYY"];
2361
+ function io(e) {
2362
+ return ro.test(e);
2363
+ }
2364
+ function so(e) {
2365
+ return ao.test(e);
2366
+ }
2367
+ function co(e, t, n) {
2368
+ const r = uo(e, t, n);
2369
+ if (console.warn(r), oo.includes(e)) throw new RangeError(r);
2370
+ }
2371
+ function uo(e, t, n) {
2372
+ const r = e[0] === "Y" ? "years" : "days of the month";
2373
+ return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
2374
+ }
2375
+ const lo = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, fo = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, ho = /^'([^]*?)'?$/, go = /''/g, mo = /[a-zA-Z]/;
2376
+ function j(e, t, n) {
2377
+ const r = je(), a = r.locale ?? Ja, o = r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, i = r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, s = R(e, n?.in);
2378
+ if (!$n(s))
2379
+ throw new RangeError("Invalid time value");
2380
+ let u = t.match(fo).map((h) => {
2381
+ const f = h[0];
2382
+ if (f === "p" || f === "P") {
2383
+ const l = no[f];
2384
+ return l(h, a.formatLong);
2385
+ }
2386
+ return h;
2387
+ }).join("").match(lo).map((h) => {
2388
+ if (h === "''")
2389
+ return { isToken: !1, value: "'" };
2390
+ const f = h[0];
2391
+ if (f === "'")
2392
+ return { isToken: !1, value: yo(h) };
2393
+ if (Jt[f])
2394
+ return { isToken: !0, value: h };
2395
+ if (f.match(mo))
2396
+ throw new RangeError(
2397
+ "Format string contains an unescaped latin alphabet character `" + f + "`"
2398
+ );
2399
+ return { isToken: !1, value: h };
2400
+ });
2401
+ a.localize.preprocessor && (u = a.localize.preprocessor(s, u));
2402
+ const c = {
2403
+ firstWeekContainsDate: o,
2404
+ weekStartsOn: i,
2405
+ locale: a
2406
+ };
2407
+ return u.map((h) => {
2408
+ if (!h.isToken) return h.value;
2409
+ const f = h.value;
2410
+ (so(f) || io(f)) && co(f, t, String(e));
2411
+ const l = Jt[f[0]];
2412
+ return l(s, f, a.localize, c);
2413
+ }).join("");
2414
+ }
2415
+ function yo(e) {
2416
+ const t = e.match(ho);
2417
+ return t ? t[1].replace(go, "'") : e;
2418
+ }
2419
+ function po(e, t) {
2420
+ return R(e, t?.in).getMonth();
2421
+ }
2422
+ function en(e, t) {
2423
+ return R(e, t?.in).getFullYear();
2424
+ }
2425
+ function bo(e, t, n) {
2426
+ const r = +R(e, n?.in), [a, o] = [
2427
+ +R(t.start, n?.in),
2428
+ +R(t.end, n?.in)
2429
+ ].sort((i, s) => i - s);
2430
+ return r >= a && r <= o;
2431
+ }
2432
+ function xo(e, t) {
2433
+ const n = () => H(t?.in, NaN), a = Mo(e);
2434
+ let o;
2435
+ if (a.date) {
2436
+ const c = ko(a.date, 2);
2437
+ o = Oo(c.restDateString, c.year);
2438
+ }
2439
+ if (!o || isNaN(+o)) return n();
2440
+ const i = +o;
2441
+ let s = 0, u;
2442
+ if (a.time && (s = _o(a.time), isNaN(s)))
2443
+ return n();
2444
+ if (a.timezone) {
2445
+ if (u = So(a.timezone), isNaN(u)) return n();
2446
+ } else {
2447
+ const c = new Date(i + s), h = R(0, t?.in);
2448
+ return h.setFullYear(
2449
+ c.getUTCFullYear(),
2450
+ c.getUTCMonth(),
2451
+ c.getUTCDate()
2452
+ ), h.setHours(
2453
+ c.getUTCHours(),
2454
+ c.getUTCMinutes(),
2455
+ c.getUTCSeconds(),
2456
+ c.getUTCMilliseconds()
2457
+ ), h;
2458
+ }
2459
+ return R(i + s + u, t?.in);
2460
+ }
2461
+ const Ge = {
2462
+ dateTimeDelimiter: /[T ]/,
2463
+ timeZoneDelimiter: /[Z ]/i,
2464
+ timezone: /([Z+-].*)$/
2465
+ }, wo = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, vo = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, Eo = /^([+-])(\d{2})(?::?(\d{2}))?$/;
2466
+ function Mo(e) {
2467
+ const t = {}, n = e.split(Ge.dateTimeDelimiter);
2468
+ let r;
2469
+ if (n.length > 2)
2470
+ return t;
2471
+ if (/:/.test(n[0]) ? r = n[0] : (t.date = n[0], r = n[1], Ge.timeZoneDelimiter.test(t.date) && (t.date = e.split(Ge.timeZoneDelimiter)[0], r = e.substr(
2472
+ t.date.length,
2473
+ e.length
2474
+ ))), r) {
2475
+ const a = Ge.timezone.exec(r);
2476
+ a ? (t.time = r.replace(a[1], ""), t.timezone = a[1]) : t.time = r;
2477
+ }
2478
+ return t;
2479
+ }
2480
+ function ko(e, t) {
2481
+ const n = new RegExp(
2482
+ "^(?:(\\d{4}|[+-]\\d{" + (4 + t) + "})|(\\d{2}|[+-]\\d{" + (2 + t) + "})$)"
2483
+ ), r = e.match(n);
2484
+ if (!r) return { year: NaN, restDateString: "" };
2485
+ const a = r[1] ? parseInt(r[1]) : null, o = r[2] ? parseInt(r[2]) : null;
2486
+ return {
2487
+ year: o === null ? a : o * 100,
2488
+ restDateString: e.slice((r[1] || r[2]).length)
2489
+ };
2490
+ }
2491
+ function Oo(e, t) {
2492
+ if (t === null) return /* @__PURE__ */ new Date(NaN);
2493
+ const n = e.match(wo);
2494
+ if (!n) return /* @__PURE__ */ new Date(NaN);
2495
+ const r = !!n[4], a = Ce(n[1]), o = Ce(n[2]) - 1, i = Ce(n[3]), s = Ce(n[4]), u = Ce(n[5]) - 1;
2496
+ if (r)
2497
+ return Do(t, s, u) ? Co(t, s, u) : /* @__PURE__ */ new Date(NaN);
2498
+ {
2499
+ const c = /* @__PURE__ */ new Date(0);
2500
+ return !Ro(t, o, i) || !To(t, a) ? /* @__PURE__ */ new Date(NaN) : (c.setUTCFullYear(t, o, Math.max(a, i)), c);
2501
+ }
2502
+ }
2503
+ function Ce(e) {
2504
+ return e ? parseInt(e) : 1;
2505
+ }
2506
+ function _o(e) {
2507
+ const t = e.match(vo);
2508
+ if (!t) return NaN;
2509
+ const n = rt(t[1]), r = rt(t[2]), a = rt(t[3]);
2510
+ return Ao(n, r, a) ? n * Dn + r * Tn + a * 1e3 : NaN;
2511
+ }
2512
+ function rt(e) {
2513
+ return e && parseFloat(e.replace(",", ".")) || 0;
2514
+ }
2515
+ function So(e) {
2516
+ if (e === "Z") return 0;
2517
+ const t = e.match(Eo);
2518
+ if (!t) return 0;
2519
+ const n = t[1] === "+" ? -1 : 1, r = parseInt(t[2]), a = t[3] && parseInt(t[3]) || 0;
2520
+ return Io(r, a) ? n * (r * Dn + a * Tn) : NaN;
2521
+ }
2522
+ function Co(e, t, n) {
2523
+ const r = /* @__PURE__ */ new Date(0);
2524
+ r.setUTCFullYear(e, 0, 4);
2525
+ const a = r.getUTCDay() || 7, o = (t - 1) * 7 + n + 1 - a;
2526
+ return r.setUTCDate(r.getUTCDate() + o), r;
2527
+ }
2528
+ const No = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2529
+ function Wn(e) {
2530
+ return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
2531
+ }
2532
+ function Ro(e, t, n) {
2533
+ return t >= 0 && t <= 11 && n >= 1 && n <= (No[t] || (Wn(e) ? 29 : 28));
2534
+ }
2535
+ function To(e, t) {
2536
+ return t >= 1 && t <= (Wn(e) ? 366 : 365);
2537
+ }
2538
+ function Do(e, t, n) {
2539
+ return t >= 1 && t <= 53 && n >= 0 && n <= 6;
2540
+ }
2541
+ function Ao(e, t, n) {
2542
+ return e === 24 ? t === 0 && n === 0 : n >= 0 && n < 60 && t >= 0 && t < 60 && e >= 0 && e < 25;
2543
+ }
2544
+ function Io(e, t) {
2545
+ return t >= 0 && t <= 59;
2546
+ }
2547
+ const Po = ["#6366f1", "#8b5cf6", "#ec4899", "#10b981", "#f59e0b", "#3b82f6", "#ef4444"], jo = ({ data: e, view: t, dataKeys: n, colors: r = Po }) => re(() => {
2548
+ if (!e || e.length === 0) return [];
2549
+ const i = e.map((c, h) => {
2550
+ const f = c[n.date], l = f instanceof Date ? f : xo(f);
2551
+ let g = 0, y = [];
2552
+ return Array.isArray(n.value) ? n.value.forEach((p, b) => {
2553
+ const E = Number(c[p]) || 0;
2554
+ g += E, y.push({
2555
+ key: p,
2556
+ value: E,
2557
+ color: r[b % r.length]
2558
+ });
2559
+ }) : g = Number(c[n.value]) || 0, {
2560
+ id: c.id || `item-${h}`,
2561
+ label: c[n.label] || "",
2562
+ value: g,
2563
+ stackedValues: y.length > 0 ? y : void 0,
2564
+ date: $n(l) ? l : /* @__PURE__ */ new Date(),
2565
+ color: y.length === 0 ? r[0] : void 0
2566
+ // Default color for single bar
2567
+ };
2568
+ }).sort((c, h) => c.date.getTime() - h.date.getTime()), s = (c, h) => c.reduce((f, l) => {
2569
+ const g = h(l);
2570
+ return (f[g] = f[g] || []).push(l), f;
2571
+ }, {});
2572
+ let u = [];
2573
+ if (t === "day") {
2574
+ const c = s(i, (h) => j(h.date, "yyyy-MM-dd"));
2575
+ u = Object.entries(c).map(([h, f]) => {
2576
+ const l = f, g = l[0], y = l.reduce((b, E) => b + E.value, 0);
2577
+ let p = [];
2578
+ if (g.stackedValues) {
2579
+ const b = /* @__PURE__ */ new Map();
2580
+ l.forEach((E) => {
2581
+ E.stackedValues?.forEach((C) => {
2582
+ const O = b.get(C.key) || 0;
2583
+ b.set(C.key, O + C.value);
2584
+ });
2585
+ }), p = Array.from(b.entries()).map(([E, C], O) => ({
2586
+ key: E,
2587
+ value: C,
2588
+ color: r[O % r.length]
2589
+ }));
2590
+ }
2591
+ return {
2592
+ ...g,
2593
+ id: h,
2594
+ label: j(g.date, "E dd"),
2595
+ value: y,
2596
+ stackedValues: p.length > 0 ? p : void 0
2597
+ };
2598
+ });
2599
+ } else if (t === "week") {
2600
+ const c = s(i, (h) => j(U(h.date), "yyyy-MM-dd"));
2601
+ u = Object.entries(c).map(([h, f]) => {
2602
+ const l = f, g = l[0], y = l.reduce((O, $) => O + $.value, 0);
2603
+ let p = [];
2604
+ if (g.stackedValues) {
2605
+ const O = /* @__PURE__ */ new Map();
2606
+ l.forEach(($) => {
2607
+ $.stackedValues?.forEach((S) => {
2608
+ const W = O.get(S.key) || 0;
2609
+ O.set(S.key, W + S.value);
2610
+ });
2611
+ }), p = Array.from(O.entries()).map(([$, S], W) => ({
2612
+ key: $,
2613
+ value: S,
2614
+ color: r[W % r.length]
2615
+ }));
2616
+ }
2617
+ const b = U(g.date), E = ct(g.date), C = `${j(b, "MMM dd")}-${j(E, "MMM dd")}`;
2618
+ return {
2619
+ ...g,
2620
+ id: h,
2621
+ label: C,
2622
+ value: y,
2623
+ stackedValues: p.length > 0 ? p : void 0
2624
+ };
2625
+ });
2626
+ } else if (t === "month") {
2627
+ const c = s(i, (h) => j(ya(h.date), "yyyy-MM"));
2628
+ u = Object.entries(c).map(([h, f]) => {
2629
+ const l = f, g = l[0], y = l.reduce((b, E) => b + E.value, 0);
2630
+ let p = [];
2631
+ if (g.stackedValues) {
2632
+ const b = /* @__PURE__ */ new Map();
2633
+ l.forEach((E) => {
2634
+ E.stackedValues?.forEach((C) => {
2635
+ const O = b.get(C.key) || 0;
2636
+ b.set(C.key, O + C.value);
2637
+ });
2638
+ }), p = Array.from(b.entries()).map(([E, C], O) => ({
2639
+ key: E,
2640
+ value: C,
2641
+ color: r[O % r.length]
2642
+ }));
2643
+ }
2644
+ return {
2645
+ ...g,
2646
+ id: h,
2647
+ label: j(g.date, "MMM yy"),
2648
+ value: y,
2649
+ stackedValues: p.length > 0 ? p : void 0
2650
+ };
2651
+ });
2652
+ } else if (t === "year") {
2653
+ const c = s(i, (h) => j(h.date, "yyyy"));
2654
+ u = Object.entries(c).map(([h, f]) => {
2655
+ const l = f, g = l[0], y = l.reduce((b, E) => b + E.value, 0);
2656
+ let p = [];
2657
+ if (g.stackedValues) {
2658
+ const b = /* @__PURE__ */ new Map();
2659
+ l.forEach((E) => {
2660
+ E.stackedValues?.forEach((C) => {
2661
+ const O = b.get(C.key) || 0;
2662
+ b.set(C.key, O + C.value);
2663
+ });
2664
+ }), p = Array.from(b.entries()).map(([E, C], O) => ({
2665
+ key: E,
2666
+ value: C,
2667
+ color: r[O % r.length]
2668
+ }));
2669
+ }
2670
+ return {
2671
+ ...g,
2672
+ id: h,
2673
+ label: h,
2674
+ // '2023'
2675
+ value: y,
2676
+ stackedValues: p.length > 0 ? p : void 0
2677
+ };
2678
+ });
2679
+ } else
2680
+ u = i;
2681
+ return u;
2682
+ }, [e, t, n, r]), $o = ({
2683
+ x: e,
2684
+ y: t,
2685
+ width: n,
2686
+ height: r,
2687
+ data: a,
2688
+ onClick: o,
2689
+ onHover: i,
2690
+ isActive: s,
2691
+ isDimmed: u,
2692
+ style: c,
2693
+ ...h
2694
+ }) => {
2695
+ const f = re(() => a.isPrediction ? "#8e44ad" : s ? "#e74c3c" : a.color || "#3498db", [a, s]);
2696
+ return /* @__PURE__ */ x.jsx(
2697
+ "rect",
2698
+ {
2699
+ x: e,
2700
+ y: t,
2701
+ width: n,
2702
+ height: r,
2703
+ fill: f,
2704
+ rx: 4,
2705
+ ry: 4,
2706
+ className: "transition-all duration-300 cursor-pointer hover:opacity-80",
2707
+ onClick: () => o?.(a),
2708
+ onMouseEnter: () => i?.(a),
2709
+ onMouseLeave: () => i?.(null),
2710
+ style: {
2711
+ opacity: u ? 0.3 : a.isPrediction ? 0.7 : 1,
2712
+ stroke: s ? "#c0392b" : "none",
2713
+ strokeWidth: s ? 2 : 0,
2714
+ transition: "all 0.3s ease",
2715
+ ...c
2716
+ },
2717
+ ...h
2718
+ }
2719
+ );
2720
+ };
2721
+ var tn;
2722
+ (function(e) {
2723
+ e.STRING = "string", e.NUMBER = "number", e.INTEGER = "integer", e.BOOLEAN = "boolean", e.ARRAY = "array", e.OBJECT = "object";
2724
+ })(tn || (tn = {}));
2725
+ var nn;
2726
+ (function(e) {
2727
+ e.LANGUAGE_UNSPECIFIED = "language_unspecified", e.PYTHON = "python";
2728
+ })(nn || (nn = {}));
2729
+ var rn;
2730
+ (function(e) {
2731
+ e.OUTCOME_UNSPECIFIED = "outcome_unspecified", e.OUTCOME_OK = "outcome_ok", e.OUTCOME_FAILED = "outcome_failed", e.OUTCOME_DEADLINE_EXCEEDED = "outcome_deadline_exceeded";
2732
+ })(rn || (rn = {}));
2733
+ const an = ["user", "model", "function", "system"];
2734
+ var on;
2735
+ (function(e) {
2736
+ e.HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED", e.HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH", e.HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT", e.HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT", e.HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT", e.HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY";
2737
+ })(on || (on = {}));
2738
+ var sn;
2739
+ (function(e) {
2740
+ e.HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED", e.BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE", e.BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE", e.BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH", e.BLOCK_NONE = "BLOCK_NONE";
2741
+ })(sn || (sn = {}));
2742
+ var cn;
2743
+ (function(e) {
2744
+ e.HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED", e.NEGLIGIBLE = "NEGLIGIBLE", e.LOW = "LOW", e.MEDIUM = "MEDIUM", e.HIGH = "HIGH";
2745
+ })(cn || (cn = {}));
2746
+ var un;
2747
+ (function(e) {
2748
+ e.BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED", e.SAFETY = "SAFETY", e.OTHER = "OTHER";
2749
+ })(un || (un = {}));
2750
+ var Ne;
2751
+ (function(e) {
2752
+ e.FINISH_REASON_UNSPECIFIED = "FINISH_REASON_UNSPECIFIED", e.STOP = "STOP", e.MAX_TOKENS = "MAX_TOKENS", e.SAFETY = "SAFETY", e.RECITATION = "RECITATION", e.LANGUAGE = "LANGUAGE", e.BLOCKLIST = "BLOCKLIST", e.PROHIBITED_CONTENT = "PROHIBITED_CONTENT", e.SPII = "SPII", e.MALFORMED_FUNCTION_CALL = "MALFORMED_FUNCTION_CALL", e.OTHER = "OTHER";
2753
+ })(Ne || (Ne = {}));
2754
+ var ln;
2755
+ (function(e) {
2756
+ e.TASK_TYPE_UNSPECIFIED = "TASK_TYPE_UNSPECIFIED", e.RETRIEVAL_QUERY = "RETRIEVAL_QUERY", e.RETRIEVAL_DOCUMENT = "RETRIEVAL_DOCUMENT", e.SEMANTIC_SIMILARITY = "SEMANTIC_SIMILARITY", e.CLASSIFICATION = "CLASSIFICATION", e.CLUSTERING = "CLUSTERING";
2757
+ })(ln || (ln = {}));
2758
+ var fn;
2759
+ (function(e) {
2760
+ e.MODE_UNSPECIFIED = "MODE_UNSPECIFIED", e.AUTO = "AUTO", e.ANY = "ANY", e.NONE = "NONE";
2761
+ })(fn || (fn = {}));
2762
+ var dn;
2763
+ (function(e) {
2764
+ e.MODE_UNSPECIFIED = "MODE_UNSPECIFIED", e.MODE_DYNAMIC = "MODE_DYNAMIC";
2765
+ })(dn || (dn = {}));
2766
+ class P extends Error {
2767
+ constructor(t) {
2768
+ super(`[GoogleGenerativeAI Error]: ${t}`);
2769
+ }
2770
+ }
2771
+ class ye extends P {
2772
+ constructor(t, n) {
2773
+ super(t), this.response = n;
2774
+ }
2775
+ }
2776
+ class Ln extends P {
2777
+ constructor(t, n, r, a) {
2778
+ super(t), this.status = n, this.statusText = r, this.errorDetails = a;
2779
+ }
2780
+ }
2781
+ class oe extends P {
2782
+ }
2783
+ class Hn extends P {
2784
+ }
2785
+ const Yo = "https://generativelanguage.googleapis.com", Fo = "v1beta", Wo = "0.24.1", Lo = "genai-js";
2786
+ var de;
2787
+ (function(e) {
2788
+ e.GENERATE_CONTENT = "generateContent", e.STREAM_GENERATE_CONTENT = "streamGenerateContent", e.COUNT_TOKENS = "countTokens", e.EMBED_CONTENT = "embedContent", e.BATCH_EMBED_CONTENTS = "batchEmbedContents";
2789
+ })(de || (de = {}));
2790
+ class Ho {
2791
+ constructor(t, n, r, a, o) {
2792
+ this.model = t, this.task = n, this.apiKey = r, this.stream = a, this.requestOptions = o;
2793
+ }
2794
+ toString() {
2795
+ var t, n;
2796
+ const r = ((t = this.requestOptions) === null || t === void 0 ? void 0 : t.apiVersion) || Fo;
2797
+ let o = `${((n = this.requestOptions) === null || n === void 0 ? void 0 : n.baseUrl) || Yo}/${r}/${this.model}:${this.task}`;
2798
+ return this.stream && (o += "?alt=sse"), o;
2799
+ }
2800
+ }
2801
+ function Go(e) {
2802
+ const t = [];
2803
+ return e?.apiClient && t.push(e.apiClient), t.push(`${Lo}/${Wo}`), t.join(" ");
2804
+ }
2805
+ async function Uo(e) {
2806
+ var t;
2807
+ const n = new Headers();
2808
+ n.append("Content-Type", "application/json"), n.append("x-goog-api-client", Go(e.requestOptions)), n.append("x-goog-api-key", e.apiKey);
2809
+ let r = (t = e.requestOptions) === null || t === void 0 ? void 0 : t.customHeaders;
2810
+ if (r) {
2811
+ if (!(r instanceof Headers))
2812
+ try {
2813
+ r = new Headers(r);
2814
+ } catch (a) {
2815
+ throw new oe(`unable to convert customHeaders value ${JSON.stringify(r)} to Headers: ${a.message}`);
2816
+ }
2817
+ for (const [a, o] of r.entries()) {
2818
+ if (a === "x-goog-api-key")
2819
+ throw new oe(`Cannot set reserved header name ${a}`);
2820
+ if (a === "x-goog-api-client")
2821
+ throw new oe(`Header name ${a} can only be set using the apiClient field`);
2822
+ n.append(a, o);
2823
+ }
2824
+ }
2825
+ return n;
2826
+ }
2827
+ async function qo(e, t, n, r, a, o) {
2828
+ const i = new Ho(e, t, n, r, o);
2829
+ return {
2830
+ url: i.toString(),
2831
+ fetchOptions: Object.assign(Object.assign({}, Xo(o)), { method: "POST", headers: await Uo(i), body: a })
2832
+ };
2833
+ }
2834
+ async function $e(e, t, n, r, a, o = {}, i = fetch) {
2835
+ const { url: s, fetchOptions: u } = await qo(e, t, n, r, a, o);
2836
+ return Bo(s, u, i);
2837
+ }
2838
+ async function Bo(e, t, n = fetch) {
2839
+ let r;
2840
+ try {
2841
+ r = await n(e, t);
2842
+ } catch (a) {
2843
+ Vo(a, e);
2844
+ }
2845
+ return r.ok || await zo(r, e), r;
2846
+ }
2847
+ function Vo(e, t) {
2848
+ let n = e;
2849
+ throw n.name === "AbortError" ? (n = new Hn(`Request aborted when fetching ${t.toString()}: ${e.message}`), n.stack = e.stack) : e instanceof Ln || e instanceof oe || (n = new P(`Error fetching from ${t.toString()}: ${e.message}`), n.stack = e.stack), n;
2850
+ }
2851
+ async function zo(e, t) {
2852
+ let n = "", r;
2853
+ try {
2854
+ const a = await e.json();
2855
+ n = a.error.message, a.error.details && (n += ` ${JSON.stringify(a.error.details)}`, r = a.error.details);
2856
+ } catch {
2857
+ }
2858
+ throw new Ln(`Error fetching from ${t.toString()}: [${e.status} ${e.statusText}] ${n}`, e.status, e.statusText, r);
2859
+ }
2860
+ function Xo(e) {
2861
+ const t = {};
2862
+ if (e?.signal !== void 0 || e?.timeout >= 0) {
2863
+ const n = new AbortController();
2864
+ e?.timeout >= 0 && setTimeout(() => n.abort(), e.timeout), e?.signal && e.signal.addEventListener("abort", () => {
2865
+ n.abort();
2866
+ }), t.signal = n.signal;
2867
+ }
2868
+ return t;
2869
+ }
2870
+ function gt(e) {
2871
+ return e.text = () => {
2872
+ if (e.candidates && e.candidates.length > 0) {
2873
+ if (e.candidates.length > 1 && console.warn(`This response had ${e.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`), qe(e.candidates[0]))
2874
+ throw new ye(`${ae(e)}`, e);
2875
+ return Jo(e);
2876
+ } else if (e.promptFeedback)
2877
+ throw new ye(`Text not available. ${ae(e)}`, e);
2878
+ return "";
2879
+ }, e.functionCall = () => {
2880
+ if (e.candidates && e.candidates.length > 0) {
2881
+ if (e.candidates.length > 1 && console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`), qe(e.candidates[0]))
2882
+ throw new ye(`${ae(e)}`, e);
2883
+ return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."), hn(e)[0];
2884
+ } else if (e.promptFeedback)
2885
+ throw new ye(`Function call not available. ${ae(e)}`, e);
2886
+ }, e.functionCalls = () => {
2887
+ if (e.candidates && e.candidates.length > 0) {
2888
+ if (e.candidates.length > 1 && console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`), qe(e.candidates[0]))
2889
+ throw new ye(`${ae(e)}`, e);
2890
+ return hn(e);
2891
+ } else if (e.promptFeedback)
2892
+ throw new ye(`Function call not available. ${ae(e)}`, e);
2893
+ }, e;
2894
+ }
2895
+ function Jo(e) {
2896
+ var t, n, r, a;
2897
+ const o = [];
2898
+ if (!((n = (t = e.candidates) === null || t === void 0 ? void 0 : t[0].content) === null || n === void 0) && n.parts)
2899
+ for (const i of (a = (r = e.candidates) === null || r === void 0 ? void 0 : r[0].content) === null || a === void 0 ? void 0 : a.parts)
2900
+ i.text && o.push(i.text), i.executableCode && o.push("\n```" + i.executableCode.language + `
2901
+ ` + i.executableCode.code + "\n```\n"), i.codeExecutionResult && o.push("\n```\n" + i.codeExecutionResult.output + "\n```\n");
2902
+ return o.length > 0 ? o.join("") : "";
2903
+ }
2904
+ function hn(e) {
2905
+ var t, n, r, a;
2906
+ const o = [];
2907
+ if (!((n = (t = e.candidates) === null || t === void 0 ? void 0 : t[0].content) === null || n === void 0) && n.parts)
2908
+ for (const i of (a = (r = e.candidates) === null || r === void 0 ? void 0 : r[0].content) === null || a === void 0 ? void 0 : a.parts)
2909
+ i.functionCall && o.push(i.functionCall);
2910
+ if (o.length > 0)
2911
+ return o;
2912
+ }
2913
+ const Ko = [
2914
+ Ne.RECITATION,
2915
+ Ne.SAFETY,
2916
+ Ne.LANGUAGE
2917
+ ];
2918
+ function qe(e) {
2919
+ return !!e.finishReason && Ko.includes(e.finishReason);
2920
+ }
2921
+ function ae(e) {
2922
+ var t, n, r;
2923
+ let a = "";
2924
+ if ((!e.candidates || e.candidates.length === 0) && e.promptFeedback)
2925
+ a += "Response was blocked", !((t = e.promptFeedback) === null || t === void 0) && t.blockReason && (a += ` due to ${e.promptFeedback.blockReason}`), !((n = e.promptFeedback) === null || n === void 0) && n.blockReasonMessage && (a += `: ${e.promptFeedback.blockReasonMessage}`);
2926
+ else if (!((r = e.candidates) === null || r === void 0) && r[0]) {
2927
+ const o = e.candidates[0];
2928
+ qe(o) && (a += `Candidate was blocked due to ${o.finishReason}`, o.finishMessage && (a += `: ${o.finishMessage}`));
2929
+ }
2930
+ return a;
2931
+ }
2932
+ function Ae(e) {
2933
+ return this instanceof Ae ? (this.v = e, this) : new Ae(e);
2934
+ }
2935
+ function Qo(e, t, n) {
2936
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
2937
+ var r = n.apply(e, t || []), a, o = [];
2938
+ return a = {}, i("next"), i("throw"), i("return"), a[Symbol.asyncIterator] = function() {
2939
+ return this;
2940
+ }, a;
2941
+ function i(l) {
2942
+ r[l] && (a[l] = function(g) {
2943
+ return new Promise(function(y, p) {
2944
+ o.push([l, g, y, p]) > 1 || s(l, g);
2945
+ });
2946
+ });
2947
+ }
2948
+ function s(l, g) {
2949
+ try {
2950
+ u(r[l](g));
2951
+ } catch (y) {
2952
+ f(o[0][3], y);
2953
+ }
2954
+ }
2955
+ function u(l) {
2956
+ l.value instanceof Ae ? Promise.resolve(l.value.v).then(c, h) : f(o[0][2], l);
2957
+ }
2958
+ function c(l) {
2959
+ s("next", l);
2960
+ }
2961
+ function h(l) {
2962
+ s("throw", l);
2963
+ }
2964
+ function f(l, g) {
2965
+ l(g), o.shift(), o.length && s(o[0][0], o[0][1]);
2966
+ }
2967
+ }
2968
+ const gn = /^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;
2969
+ function Zo(e) {
2970
+ const t = e.body.pipeThrough(new TextDecoderStream("utf8", { fatal: !0 })), n = ni(t), [r, a] = n.tee();
2971
+ return {
2972
+ stream: ti(r),
2973
+ response: ei(a)
2974
+ };
2975
+ }
2976
+ async function ei(e) {
2977
+ const t = [], n = e.getReader();
2978
+ for (; ; ) {
2979
+ const { done: r, value: a } = await n.read();
2980
+ if (r)
2981
+ return gt(ri(t));
2982
+ t.push(a);
2983
+ }
2984
+ }
2985
+ function ti(e) {
2986
+ return Qo(this, arguments, function* () {
2987
+ const n = e.getReader();
2988
+ for (; ; ) {
2989
+ const { value: r, done: a } = yield Ae(n.read());
2990
+ if (a)
2991
+ break;
2992
+ yield yield Ae(gt(r));
2993
+ }
2994
+ });
2995
+ }
2996
+ function ni(e) {
2997
+ const t = e.getReader();
2998
+ return new ReadableStream({
2999
+ start(r) {
3000
+ let a = "";
3001
+ return o();
3002
+ function o() {
3003
+ return t.read().then(({ value: i, done: s }) => {
3004
+ if (s) {
3005
+ if (a.trim()) {
3006
+ r.error(new P("Failed to parse stream"));
3007
+ return;
3008
+ }
3009
+ r.close();
3010
+ return;
3011
+ }
3012
+ a += i;
3013
+ let u = a.match(gn), c;
3014
+ for (; u; ) {
3015
+ try {
3016
+ c = JSON.parse(u[1]);
3017
+ } catch {
3018
+ r.error(new P(`Error parsing JSON response: "${u[1]}"`));
3019
+ return;
3020
+ }
3021
+ r.enqueue(c), a = a.substring(u[0].length), u = a.match(gn);
3022
+ }
3023
+ return o();
3024
+ }).catch((i) => {
3025
+ let s = i;
3026
+ throw s.stack = i.stack, s.name === "AbortError" ? s = new Hn("Request aborted when reading from the stream") : s = new P("Error reading from the stream"), s;
3027
+ });
3028
+ }
3029
+ }
3030
+ });
3031
+ }
3032
+ function ri(e) {
3033
+ const t = e[e.length - 1], n = {
3034
+ promptFeedback: t?.promptFeedback
3035
+ };
3036
+ for (const r of e) {
3037
+ if (r.candidates) {
3038
+ let a = 0;
3039
+ for (const o of r.candidates)
3040
+ if (n.candidates || (n.candidates = []), n.candidates[a] || (n.candidates[a] = {
3041
+ index: a
3042
+ }), n.candidates[a].citationMetadata = o.citationMetadata, n.candidates[a].groundingMetadata = o.groundingMetadata, n.candidates[a].finishReason = o.finishReason, n.candidates[a].finishMessage = o.finishMessage, n.candidates[a].safetyRatings = o.safetyRatings, o.content && o.content.parts) {
3043
+ n.candidates[a].content || (n.candidates[a].content = {
3044
+ role: o.content.role || "user",
3045
+ parts: []
3046
+ });
3047
+ const i = {};
3048
+ for (const s of o.content.parts)
3049
+ s.text && (i.text = s.text), s.functionCall && (i.functionCall = s.functionCall), s.executableCode && (i.executableCode = s.executableCode), s.codeExecutionResult && (i.codeExecutionResult = s.codeExecutionResult), Object.keys(i).length === 0 && (i.text = ""), n.candidates[a].content.parts.push(i);
3050
+ }
3051
+ a++;
3052
+ }
3053
+ r.usageMetadata && (n.usageMetadata = r.usageMetadata);
3054
+ }
3055
+ return n;
3056
+ }
3057
+ async function Gn(e, t, n, r) {
3058
+ const a = await $e(
3059
+ t,
3060
+ de.STREAM_GENERATE_CONTENT,
3061
+ e,
3062
+ /* stream */
3063
+ !0,
3064
+ JSON.stringify(n),
3065
+ r
3066
+ );
3067
+ return Zo(a);
3068
+ }
3069
+ async function Un(e, t, n, r) {
3070
+ const o = await (await $e(
3071
+ t,
3072
+ de.GENERATE_CONTENT,
3073
+ e,
3074
+ /* stream */
3075
+ !1,
3076
+ JSON.stringify(n),
3077
+ r
3078
+ )).json();
3079
+ return {
3080
+ response: gt(o)
3081
+ };
3082
+ }
3083
+ function qn(e) {
3084
+ if (e != null) {
3085
+ if (typeof e == "string")
3086
+ return { role: "system", parts: [{ text: e }] };
3087
+ if (e.text)
3088
+ return { role: "system", parts: [e] };
3089
+ if (e.parts)
3090
+ return e.role ? e : { role: "system", parts: e.parts };
3091
+ }
3092
+ }
3093
+ function Ie(e) {
3094
+ let t = [];
3095
+ if (typeof e == "string")
3096
+ t = [{ text: e }];
3097
+ else
3098
+ for (const n of e)
3099
+ typeof n == "string" ? t.push({ text: n }) : t.push(n);
3100
+ return ai(t);
3101
+ }
3102
+ function ai(e) {
3103
+ const t = { role: "user", parts: [] }, n = { role: "function", parts: [] };
3104
+ let r = !1, a = !1;
3105
+ for (const o of e)
3106
+ "functionResponse" in o ? (n.parts.push(o), a = !0) : (t.parts.push(o), r = !0);
3107
+ if (r && a)
3108
+ throw new P("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");
3109
+ if (!r && !a)
3110
+ throw new P("No content is provided for sending chat message.");
3111
+ return r ? t : n;
3112
+ }
3113
+ function oi(e, t) {
3114
+ var n;
3115
+ let r = {
3116
+ model: t?.model,
3117
+ generationConfig: t?.generationConfig,
3118
+ safetySettings: t?.safetySettings,
3119
+ tools: t?.tools,
3120
+ toolConfig: t?.toolConfig,
3121
+ systemInstruction: t?.systemInstruction,
3122
+ cachedContent: (n = t?.cachedContent) === null || n === void 0 ? void 0 : n.name,
3123
+ contents: []
3124
+ };
3125
+ const a = e.generateContentRequest != null;
3126
+ if (e.contents) {
3127
+ if (a)
3128
+ throw new oe("CountTokensRequest must have one of contents or generateContentRequest, not both.");
3129
+ r.contents = e.contents;
3130
+ } else if (a)
3131
+ r = Object.assign(Object.assign({}, r), e.generateContentRequest);
3132
+ else {
3133
+ const o = Ie(e);
3134
+ r.contents = [o];
3135
+ }
3136
+ return { generateContentRequest: r };
3137
+ }
3138
+ function mn(e) {
3139
+ let t;
3140
+ return e.contents ? t = e : t = { contents: [Ie(e)] }, e.systemInstruction && (t.systemInstruction = qn(e.systemInstruction)), t;
3141
+ }
3142
+ function ii(e) {
3143
+ return typeof e == "string" || Array.isArray(e) ? { content: Ie(e) } : e;
3144
+ }
3145
+ const yn = [
3146
+ "text",
3147
+ "inlineData",
3148
+ "functionCall",
3149
+ "functionResponse",
3150
+ "executableCode",
3151
+ "codeExecutionResult"
3152
+ ], si = {
3153
+ user: ["text", "inlineData"],
3154
+ function: ["functionResponse"],
3155
+ model: ["text", "functionCall", "executableCode", "codeExecutionResult"],
3156
+ // System instructions shouldn't be in history anyway.
3157
+ system: ["text"]
3158
+ };
3159
+ function ci(e) {
3160
+ let t = !1;
3161
+ for (const n of e) {
3162
+ const { role: r, parts: a } = n;
3163
+ if (!t && r !== "user")
3164
+ throw new P(`First content should be with role 'user', got ${r}`);
3165
+ if (!an.includes(r))
3166
+ throw new P(`Each item should include role field. Got ${r} but valid roles are: ${JSON.stringify(an)}`);
3167
+ if (!Array.isArray(a))
3168
+ throw new P("Content should have 'parts' property with an array of Parts");
3169
+ if (a.length === 0)
3170
+ throw new P("Each Content should have at least one part");
3171
+ const o = {
3172
+ text: 0,
3173
+ inlineData: 0,
3174
+ functionCall: 0,
3175
+ functionResponse: 0,
3176
+ fileData: 0,
3177
+ executableCode: 0,
3178
+ codeExecutionResult: 0
3179
+ };
3180
+ for (const s of a)
3181
+ for (const u of yn)
3182
+ u in s && (o[u] += 1);
3183
+ const i = si[r];
3184
+ for (const s of yn)
3185
+ if (!i.includes(s) && o[s] > 0)
3186
+ throw new P(`Content with role '${r}' can't contain '${s}' part`);
3187
+ t = !0;
3188
+ }
3189
+ }
3190
+ function pn(e) {
3191
+ var t;
3192
+ if (e.candidates === void 0 || e.candidates.length === 0)
3193
+ return !1;
3194
+ const n = (t = e.candidates[0]) === null || t === void 0 ? void 0 : t.content;
3195
+ if (n === void 0 || n.parts === void 0 || n.parts.length === 0)
3196
+ return !1;
3197
+ for (const r of n.parts)
3198
+ if (r === void 0 || Object.keys(r).length === 0 || r.text !== void 0 && r.text === "")
3199
+ return !1;
3200
+ return !0;
3201
+ }
3202
+ const bn = "SILENT_ERROR";
3203
+ class ui {
3204
+ constructor(t, n, r, a = {}) {
3205
+ this.model = n, this.params = r, this._requestOptions = a, this._history = [], this._sendPromise = Promise.resolve(), this._apiKey = t, r?.history && (ci(r.history), this._history = r.history);
3206
+ }
3207
+ /**
3208
+ * Gets the chat history so far. Blocked prompts are not added to history.
3209
+ * Blocked candidates are not added to history, nor are the prompts that
3210
+ * generated them.
3211
+ */
3212
+ async getHistory() {
3213
+ return await this._sendPromise, this._history;
3214
+ }
3215
+ /**
3216
+ * Sends a chat message and receives a non-streaming
3217
+ * {@link GenerateContentResult}.
3218
+ *
3219
+ * Fields set in the optional {@link SingleRequestOptions} parameter will
3220
+ * take precedence over the {@link RequestOptions} values provided to
3221
+ * {@link GoogleGenerativeAI.getGenerativeModel }.
3222
+ */
3223
+ async sendMessage(t, n = {}) {
3224
+ var r, a, o, i, s, u;
3225
+ await this._sendPromise;
3226
+ const c = Ie(t), h = {
3227
+ safetySettings: (r = this.params) === null || r === void 0 ? void 0 : r.safetySettings,
3228
+ generationConfig: (a = this.params) === null || a === void 0 ? void 0 : a.generationConfig,
3229
+ tools: (o = this.params) === null || o === void 0 ? void 0 : o.tools,
3230
+ toolConfig: (i = this.params) === null || i === void 0 ? void 0 : i.toolConfig,
3231
+ systemInstruction: (s = this.params) === null || s === void 0 ? void 0 : s.systemInstruction,
3232
+ cachedContent: (u = this.params) === null || u === void 0 ? void 0 : u.cachedContent,
3233
+ contents: [...this._history, c]
3234
+ }, f = Object.assign(Object.assign({}, this._requestOptions), n);
3235
+ let l;
3236
+ return this._sendPromise = this._sendPromise.then(() => Un(this._apiKey, this.model, h, f)).then((g) => {
3237
+ var y;
3238
+ if (pn(g.response)) {
3239
+ this._history.push(c);
3240
+ const p = Object.assign({
3241
+ parts: [],
3242
+ // Response seems to come back without a role set.
3243
+ role: "model"
3244
+ }, (y = g.response.candidates) === null || y === void 0 ? void 0 : y[0].content);
3245
+ this._history.push(p);
3246
+ } else {
3247
+ const p = ae(g.response);
3248
+ p && console.warn(`sendMessage() was unsuccessful. ${p}. Inspect response object for details.`);
3249
+ }
3250
+ l = g;
3251
+ }).catch((g) => {
3252
+ throw this._sendPromise = Promise.resolve(), g;
3253
+ }), await this._sendPromise, l;
3254
+ }
3255
+ /**
3256
+ * Sends a chat message and receives the response as a
3257
+ * {@link GenerateContentStreamResult} containing an iterable stream
3258
+ * and a response promise.
3259
+ *
3260
+ * Fields set in the optional {@link SingleRequestOptions} parameter will
3261
+ * take precedence over the {@link RequestOptions} values provided to
3262
+ * {@link GoogleGenerativeAI.getGenerativeModel }.
3263
+ */
3264
+ async sendMessageStream(t, n = {}) {
3265
+ var r, a, o, i, s, u;
3266
+ await this._sendPromise;
3267
+ const c = Ie(t), h = {
3268
+ safetySettings: (r = this.params) === null || r === void 0 ? void 0 : r.safetySettings,
3269
+ generationConfig: (a = this.params) === null || a === void 0 ? void 0 : a.generationConfig,
3270
+ tools: (o = this.params) === null || o === void 0 ? void 0 : o.tools,
3271
+ toolConfig: (i = this.params) === null || i === void 0 ? void 0 : i.toolConfig,
3272
+ systemInstruction: (s = this.params) === null || s === void 0 ? void 0 : s.systemInstruction,
3273
+ cachedContent: (u = this.params) === null || u === void 0 ? void 0 : u.cachedContent,
3274
+ contents: [...this._history, c]
3275
+ }, f = Object.assign(Object.assign({}, this._requestOptions), n), l = Gn(this._apiKey, this.model, h, f);
3276
+ return this._sendPromise = this._sendPromise.then(() => l).catch((g) => {
3277
+ throw new Error(bn);
3278
+ }).then((g) => g.response).then((g) => {
3279
+ if (pn(g)) {
3280
+ this._history.push(c);
3281
+ const y = Object.assign({}, g.candidates[0].content);
3282
+ y.role || (y.role = "model"), this._history.push(y);
3283
+ } else {
3284
+ const y = ae(g);
3285
+ y && console.warn(`sendMessageStream() was unsuccessful. ${y}. Inspect response object for details.`);
3286
+ }
3287
+ }).catch((g) => {
3288
+ g.message !== bn && console.error(g);
3289
+ }), l;
3290
+ }
3291
+ }
3292
+ async function li(e, t, n, r) {
3293
+ return (await $e(t, de.COUNT_TOKENS, e, !1, JSON.stringify(n), r)).json();
3294
+ }
3295
+ async function fi(e, t, n, r) {
3296
+ return (await $e(t, de.EMBED_CONTENT, e, !1, JSON.stringify(n), r)).json();
3297
+ }
3298
+ async function di(e, t, n, r) {
3299
+ const a = n.requests.map((i) => Object.assign(Object.assign({}, i), { model: t }));
3300
+ return (await $e(t, de.BATCH_EMBED_CONTENTS, e, !1, JSON.stringify({ requests: a }), r)).json();
3301
+ }
3302
+ class xn {
3303
+ constructor(t, n, r = {}) {
3304
+ this.apiKey = t, this._requestOptions = r, n.model.includes("/") ? this.model = n.model : this.model = `models/${n.model}`, this.generationConfig = n.generationConfig || {}, this.safetySettings = n.safetySettings || [], this.tools = n.tools, this.toolConfig = n.toolConfig, this.systemInstruction = qn(n.systemInstruction), this.cachedContent = n.cachedContent;
3305
+ }
3306
+ /**
3307
+ * Makes a single non-streaming call to the model
3308
+ * and returns an object containing a single {@link GenerateContentResponse}.
3309
+ *
3310
+ * Fields set in the optional {@link SingleRequestOptions} parameter will
3311
+ * take precedence over the {@link RequestOptions} values provided to
3312
+ * {@link GoogleGenerativeAI.getGenerativeModel }.
3313
+ */
3314
+ async generateContent(t, n = {}) {
3315
+ var r;
3316
+ const a = mn(t), o = Object.assign(Object.assign({}, this._requestOptions), n);
3317
+ return Un(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction, cachedContent: (r = this.cachedContent) === null || r === void 0 ? void 0 : r.name }, a), o);
3318
+ }
3319
+ /**
3320
+ * Makes a single streaming call to the model and returns an object
3321
+ * containing an iterable stream that iterates over all chunks in the
3322
+ * streaming response as well as a promise that returns the final
3323
+ * aggregated response.
3324
+ *
3325
+ * Fields set in the optional {@link SingleRequestOptions} parameter will
3326
+ * take precedence over the {@link RequestOptions} values provided to
3327
+ * {@link GoogleGenerativeAI.getGenerativeModel }.
3328
+ */
3329
+ async generateContentStream(t, n = {}) {
3330
+ var r;
3331
+ const a = mn(t), o = Object.assign(Object.assign({}, this._requestOptions), n);
3332
+ return Gn(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction, cachedContent: (r = this.cachedContent) === null || r === void 0 ? void 0 : r.name }, a), o);
3333
+ }
3334
+ /**
3335
+ * Gets a new {@link ChatSession} instance which can be used for
3336
+ * multi-turn chats.
3337
+ */
3338
+ startChat(t) {
3339
+ var n;
3340
+ return new ui(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction, cachedContent: (n = this.cachedContent) === null || n === void 0 ? void 0 : n.name }, t), this._requestOptions);
3341
+ }
3342
+ /**
3343
+ * Counts the tokens in the provided request.
3344
+ *
3345
+ * Fields set in the optional {@link SingleRequestOptions} parameter will
3346
+ * take precedence over the {@link RequestOptions} values provided to
3347
+ * {@link GoogleGenerativeAI.getGenerativeModel }.
3348
+ */
3349
+ async countTokens(t, n = {}) {
3350
+ const r = oi(t, {
3351
+ model: this.model,
3352
+ generationConfig: this.generationConfig,
3353
+ safetySettings: this.safetySettings,
3354
+ tools: this.tools,
3355
+ toolConfig: this.toolConfig,
3356
+ systemInstruction: this.systemInstruction,
3357
+ cachedContent: this.cachedContent
3358
+ }), a = Object.assign(Object.assign({}, this._requestOptions), n);
3359
+ return li(this.apiKey, this.model, r, a);
3360
+ }
3361
+ /**
3362
+ * Embeds the provided content.
3363
+ *
3364
+ * Fields set in the optional {@link SingleRequestOptions} parameter will
3365
+ * take precedence over the {@link RequestOptions} values provided to
3366
+ * {@link GoogleGenerativeAI.getGenerativeModel }.
3367
+ */
3368
+ async embedContent(t, n = {}) {
3369
+ const r = ii(t), a = Object.assign(Object.assign({}, this._requestOptions), n);
3370
+ return fi(this.apiKey, this.model, r, a);
3371
+ }
3372
+ /**
3373
+ * Embeds an array of {@link EmbedContentRequest}s.
3374
+ *
3375
+ * Fields set in the optional {@link SingleRequestOptions} parameter will
3376
+ * take precedence over the {@link RequestOptions} values provided to
3377
+ * {@link GoogleGenerativeAI.getGenerativeModel }.
3378
+ */
3379
+ async batchEmbedContents(t, n = {}) {
3380
+ const r = Object.assign(Object.assign({}, this._requestOptions), n);
3381
+ return di(this.apiKey, this.model, t, r);
3382
+ }
3383
+ }
3384
+ class hi {
3385
+ constructor(t) {
3386
+ this.apiKey = t;
3387
+ }
3388
+ /**
3389
+ * Gets a {@link GenerativeModel} instance for the provided model name.
3390
+ */
3391
+ getGenerativeModel(t, n) {
3392
+ if (!t.model)
3393
+ throw new P("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");
3394
+ return new xn(this.apiKey, t, n);
3395
+ }
3396
+ /**
3397
+ * Creates a {@link GenerativeModel} instance from provided content cache.
3398
+ */
3399
+ getGenerativeModelFromCachedContent(t, n, r) {
3400
+ if (!t.name)
3401
+ throw new oe("Cached content must contain a `name` field.");
3402
+ if (!t.model)
3403
+ throw new oe("Cached content must contain a `model` field.");
3404
+ const a = ["model", "systemInstruction"];
3405
+ for (const i of a)
3406
+ if (n?.[i] && t[i] && n?.[i] !== t[i]) {
3407
+ if (i === "model") {
3408
+ const s = n.model.startsWith("models/") ? n.model.replace("models/", "") : n.model, u = t.model.startsWith("models/") ? t.model.replace("models/", "") : t.model;
3409
+ if (s === u)
3410
+ continue;
3411
+ }
3412
+ throw new oe(`Different value for "${i}" specified in modelParams (${n[i]}) and cachedContent (${t[i]})`);
3413
+ }
3414
+ const o = Object.assign(Object.assign({}, n), { model: t.model, tools: t.tools, toolConfig: t.toolConfig, systemInstruction: t.systemInstruction, cachedContent: t });
3415
+ return new xn(this.apiKey, o, r);
3416
+ }
3417
+ }
3418
+ class gi {
3419
+ genAI;
3420
+ model;
3421
+ constructor(t, n = "gemini-1.5-flash") {
3422
+ this.genAI = new hi(t), this.model = this.genAI.getGenerativeModel({ model: n });
3423
+ }
3424
+ async predictNext(t, n = 3, r = "month") {
3425
+ if (t.length === 0) return [];
3426
+ const a = `
3427
+ I have a time series data:
3428
+ ${t.map((o) => `${o.label}: ${o.value}`).join(`
3429
+ `)}
3430
+
3431
+ Predict the next ${n} values based on the trend.
3432
+ Return ONLY a JSON array of numbers. Example: [10, 12, 15].
3433
+ Do not include any explanation or markdown formatting.
3434
+ `;
3435
+ try {
3436
+ const u = (await (await this.model.generateContent(a)).response).text().replace(/```json/g, "").replace(/```/g, "").trim(), c = JSON.parse(u), f = t[t.length - 1].date;
3437
+ return c.map((l, g) => {
3438
+ let y = f;
3439
+ r === "day" ? y = An(f, g + 1) : r === "week" ? y = jn(f, g + 1) : r === "month" && (y = ca(f, g + 1));
3440
+ let p = "";
3441
+ return r === "day" ? p = j(y, "eee dd") : r === "week" ? p = `W${g + 1}` : r === "month" ? p = j(y, "MMM") : p = j(y, "yyyy"), {
3442
+ id: `prediction-${g}`,
3443
+ label: p,
3444
+ value: l,
3445
+ date: y,
3446
+ isPrediction: !0,
3447
+ color: "#8e44ad"
3448
+ };
3449
+ });
3450
+ } catch (o) {
3451
+ return console.error("Gemini Prediction Failed", o), [];
3452
+ }
3453
+ }
3454
+ async analyze(t) {
3455
+ const n = `
3456
+ Analyze the following data trend:
3457
+ ${t.map((r) => `${r.label}: ${r.value}`).join(", ")}
3458
+
3459
+ Provide a short, insightful summary (max 2 sentences).
3460
+ `;
3461
+ try {
3462
+ return (await this.model.generateContent(n)).response.text();
3463
+ } catch (r) {
3464
+ return console.error("Gemini Analysis Failed", r), "Analysis unavailable.";
3465
+ }
3466
+ }
3467
+ }
3468
+ const yi = ({
3469
+ data: e,
3470
+ view: t = "month",
3471
+ variant: n = "default",
3472
+ dataKeys: r,
3473
+ geminiConfig: a,
3474
+ colors: o,
3475
+ axisLabels: i,
3476
+ onViewChange: s,
3477
+ height: u = 400,
3478
+ width: c = "100%",
3479
+ className: h = "",
3480
+ theme: f
3481
+ }) => {
3482
+ const [l, g] = ce({ year: null, month: null, weekStartDate: null }), [y, p] = ce(!1), [b, E] = ce("year"), C = re(() => l.year ? e.filter((m) => {
3483
+ const k = m[r.date], Y = new Date(k);
3484
+ if (en(Y) !== l.year || l.month !== null && po(Y) !== l.month) return !1;
3485
+ if (l.weekStartDate) {
3486
+ const V = l.weekStartDate, ge = ct(V);
3487
+ return bo(Y, { start: V, end: ge });
3488
+ }
3489
+ return !0;
3490
+ }) : e, [e, l, r.date]), O = re(() => {
3491
+ const m = new Set(e.map((k) => en(new Date(k[r.date]))));
3492
+ return Array.from(m).sort((k, Y) => Y - k);
3493
+ }, [e, r.date]), $ = jo({ data: C, view: t, dataKeys: r, colors: o }), [S, W] = ce(null), [he, Q] = ce([]), [Z, ie] = ce(!1), v = t === "month" ? 12 : 7, [A, T] = ce(0);
3494
+ Ot(() => {
3495
+ T(0), Q([]), t === "month" ? (g((m) => m.month !== null || m.weekStartDate !== null ? { ...m, month: null, weekStartDate: null } : m), E("year")) : t === "week" && (g((m) => m.weekStartDate !== null ? { ...m, weekStartDate: null } : m), E("month"));
3496
+ }, [t]), Ot(() => {
3497
+ T(0), Q([]);
3498
+ }, [l]);
3499
+ const q = (m) => {
3500
+ g({ year: m, month: null, weekStartDate: null }), E("month"), s?.("month");
3501
+ }, ee = (m) => {
3502
+ g((k) => ({ ...k, month: m, weekStartDate: null })), E("week"), s?.("week");
3503
+ }, X = (m) => {
3504
+ g((k) => ({ ...k, weekStartDate: m })), p(!1), s?.("day");
3505
+ }, J = () => {
3506
+ g({ year: null, month: null, weekStartDate: null }), E("year"), p(!1), s?.("month");
3507
+ }, L = re(() => [...$, ...he], [$, he]), I = re(() => {
3508
+ const m = L.length, k = Math.max(0, m - v - A), Y = Math.min(m, m - A);
3509
+ return L.slice(k, Y);
3510
+ }, [L, A, v]), K = { top: 40, right: 20, bottom: 40, left: 40 }, d = 800, w = d - K.left - K.right, M = (typeof u == "number" ? u : 400) - K.top - K.bottom, N = re(() => En().domain(I.map((m) => m.id)).range([0, w]).padding(0.3), [I, w]), B = re(() => {
3511
+ const m = Math.max(...I.map((k) => k.value), 0);
3512
+ return Nn().domain([0, m * 1.1]).range([M, 0]);
3513
+ }, [I, M]), we = async () => {
3514
+ if (a?.apiKey) {
3515
+ ie(!0);
3516
+ try {
3517
+ const m = new gi(a.apiKey, a.model), k = $.slice(-v), Y = await m.predictNext(k, 3, t);
3518
+ Q(Y), T(0);
3519
+ } catch (m) {
3520
+ console.error(m);
3521
+ } finally {
3522
+ ie(!1);
3523
+ }
3524
+ }
3525
+ }, D = () => {
3526
+ A > 0 && T((m) => Math.max(0, m - 1));
3527
+ }, te = () => {
3528
+ L.length > v + A && T((m) => m + 1);
3529
+ }, se = L.length > v + A, ve = A > 0, Bn = f?.background || "#fff", mt = f?.bar?.radius ?? 4, yt = f?.bar?.opacity ?? 1, Vn = f?.bar?.maxWidth ?? 60, Ze = f?.grid?.stroke || "#eee", zn = f?.grid?.strokeDasharray || "4 4", Xn = f?.grid?.visible !== !1, pt = f?.axis?.labelColor || "#9ca3af", bt = f?.axis?.tickColor || "#9ca3af", xt = f?.axis?.fontSize || 10;
3530
+ return /* @__PURE__ */ x.jsxs("div", { className: `smart-bar-chart-wrapper ${h}`, style: { width: c, display: "flex", flexDirection: "column", gap: 10, fontFamily: "sans-serif", background: Bn, padding: 16, borderRadius: 12 }, children: [
3531
+ /* @__PURE__ */ x.jsxs("div", { style: { display: "flex", justifyContent: "flex-end", alignItems: "center", height: 40 }, children: [
3532
+ /* @__PURE__ */ x.jsx("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-end", marginRight: 10 }, children: S ? /* @__PURE__ */ x.jsxs(x.Fragment, { children: [
3533
+ /* @__PURE__ */ x.jsx("div", { style: { fontSize: 14, fontWeight: "bold" }, children: S.label }),
3534
+ /* @__PURE__ */ x.jsxs("div", { style: { fontSize: 12, color: "#666" }, children: [
3535
+ "Total: ",
3536
+ S.value
3537
+ ] })
3538
+ ] }) : /* @__PURE__ */ x.jsx("div", { style: { fontSize: 12, color: "#999" }, children: "Detailed Info Area" }) }),
3539
+ a && /* @__PURE__ */ x.jsx(
3540
+ "button",
3541
+ {
3542
+ onClick: we,
3543
+ disabled: Z,
3544
+ style: { fontSize: 10, padding: "6px 12px", cursor: "pointer", background: "#6366f1", color: "white", border: "none", borderRadius: 4, fontWeight: "bold" },
3545
+ children: Z ? "Running..." : "Predict AI"
3546
+ }
3547
+ ),
3548
+ /* @__PURE__ */ x.jsx(
3549
+ "button",
3550
+ {
3551
+ onClick: () => p(!y),
3552
+ style: {
3553
+ marginLeft: 10,
3554
+ padding: 6,
3555
+ cursor: "pointer",
3556
+ background: "#fff",
3557
+ border: "1px solid #ddd",
3558
+ borderRadius: 4,
3559
+ display: "flex",
3560
+ alignItems: "center",
3561
+ justifyContent: "center"
3562
+ },
3563
+ children: /* @__PURE__ */ x.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "#666", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3564
+ /* @__PURE__ */ x.jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
3565
+ /* @__PURE__ */ x.jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
3566
+ /* @__PURE__ */ x.jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
3567
+ /* @__PURE__ */ x.jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
3568
+ ] })
3569
+ }
3570
+ ),
3571
+ y && /* @__PURE__ */ x.jsxs("div", { style: {
3572
+ position: "absolute",
3573
+ top: 50,
3574
+ right: 0,
3575
+ width: 240,
3576
+ background: "#fff",
3577
+ border: "1px solid #e0e0e0",
3578
+ borderRadius: 12,
3579
+ boxShadow: "0 10px 25px rgba(0,0,0,0.1)",
3580
+ zIndex: 30,
3581
+ padding: 16,
3582
+ fontFamily: "sans-serif"
3583
+ }, children: [
3584
+ /* @__PURE__ */ x.jsxs("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: 16, alignItems: "center" }, children: [
3585
+ b !== "year" && /* @__PURE__ */ x.jsx(
3586
+ "button",
3587
+ {
3588
+ onClick: () => E(b === "week" ? "month" : "year"),
3589
+ style: { background: "none", border: "none", cursor: "pointer", fontSize: 13, color: "#6366f1", fontWeight: 600 },
3590
+ children: "< Back"
3591
+ }
3592
+ ),
3593
+ /* @__PURE__ */ x.jsx("div", { style: { fontSize: 14, fontWeight: "bold", color: "#1f2937", flex: 1, textAlign: b !== "year" ? "center" : "left" }, children: b === "year" ? "Select Year" : b === "month" ? `${l.year}` : `${j(new Date(l.year, l.month, 1), "MMM yyyy")}` }),
3594
+ /* @__PURE__ */ x.jsx(
3595
+ "button",
3596
+ {
3597
+ onClick: () => {
3598
+ J();
3599
+ },
3600
+ style: { background: "none", border: "none", cursor: "pointer", fontSize: 12, color: "#ef4444" },
3601
+ children: "Reset"
3602
+ }
3603
+ )
3604
+ ] }),
3605
+ /* @__PURE__ */ x.jsxs("div", { style: { display: "grid", gridTemplateColumns: b === "week" ? "1fr" : "repeat(3, 1fr)", gap: 8 }, children: [
3606
+ b === "year" && O.map((m) => /* @__PURE__ */ x.jsx(
3607
+ "button",
3608
+ {
3609
+ onClick: () => q(m),
3610
+ style: {
3611
+ padding: "8px 4px",
3612
+ fontSize: 13,
3613
+ border: "1px solid",
3614
+ borderColor: l.year === m ? "#6366f1" : "#eee",
3615
+ borderRadius: 6,
3616
+ background: l.year === m ? "#e0e7ff" : "#fff",
3617
+ color: l.year === m ? "#4338ca" : "#374151",
3618
+ cursor: "pointer",
3619
+ transition: "all 0.2s"
3620
+ },
3621
+ children: m
3622
+ },
3623
+ m
3624
+ )),
3625
+ b === "month" && Array.from({ length: 12 }).map((m, k) => /* @__PURE__ */ x.jsx(
3626
+ "button",
3627
+ {
3628
+ onClick: () => ee(k),
3629
+ style: {
3630
+ padding: "8px 4px",
3631
+ fontSize: 13,
3632
+ border: "1px solid",
3633
+ borderColor: l.month === k ? "#6366f1" : "#eee",
3634
+ borderRadius: 6,
3635
+ background: l.month === k ? "#e0e7ff" : "#fff",
3636
+ color: l.month === k ? "#4338ca" : "#374151",
3637
+ cursor: "pointer",
3638
+ transition: "all 0.2s"
3639
+ },
3640
+ children: j(new Date(2e3, k, 1), "MMM")
3641
+ },
3642
+ k
3643
+ )),
3644
+ b === "week" && l.year && l.month !== null && ma({
3645
+ start: new Date(l.year, l.month, 1),
3646
+ end: ha(new Date(l.year, l.month, 1))
3647
+ }).map((m, k) => {
3648
+ const Y = ct(m), V = `${j(m, "d")} - ${j(Y, "d MMM")}`;
3649
+ return /* @__PURE__ */ x.jsxs(
3650
+ "button",
3651
+ {
3652
+ onClick: () => X(m),
3653
+ style: {
3654
+ padding: "8px 12px",
3655
+ fontSize: 13,
3656
+ border: "1px solid",
3657
+ borderColor: "#eee",
3658
+ borderRadius: 6,
3659
+ background: "#fff",
3660
+ color: "#374151",
3661
+ cursor: "pointer",
3662
+ transition: "all 0.2s",
3663
+ textAlign: "left"
3664
+ },
3665
+ children: [
3666
+ "Week ",
3667
+ k + 1,
3668
+ ": ",
3669
+ V
3670
+ ]
3671
+ },
3672
+ m.toISOString()
3673
+ );
3674
+ })
3675
+ ] })
3676
+ ] })
3677
+ ] }),
3678
+ /* @__PURE__ */ x.jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
3679
+ /* @__PURE__ */ x.jsx(
3680
+ "button",
3681
+ {
3682
+ onClick: te,
3683
+ disabled: !se,
3684
+ style: {
3685
+ flexShrink: 0,
3686
+ width: 40,
3687
+ height: 40,
3688
+ borderRadius: "50%",
3689
+ border: "1px solid #ddd",
3690
+ background: "#fff",
3691
+ cursor: se ? "pointer" : "default",
3692
+ opacity: se ? 1 : 0.3,
3693
+ display: "flex",
3694
+ alignItems: "center",
3695
+ justifyContent: "center",
3696
+ fontSize: 18,
3697
+ color: "#333",
3698
+ marginRight: 10
3699
+ },
3700
+ children: "<"
3701
+ }
3702
+ ),
3703
+ /* @__PURE__ */ x.jsx("div", { style: { flexGrow: 1, height: typeof u == "number" ? u : 400, position: "relative" }, children: /* @__PURE__ */ x.jsx(
3704
+ "svg",
3705
+ {
3706
+ width: "100%",
3707
+ height: "100%",
3708
+ viewBox: `0 0 ${d} ${typeof u == "number" ? u : 400}`,
3709
+ preserveAspectRatio: "none",
3710
+ style: { overflow: "visible" },
3711
+ role: "img",
3712
+ "aria-label": "Bar chart showing data over time",
3713
+ children: /* @__PURE__ */ x.jsxs("g", { transform: `translate(${K.left},${K.top})`, children: [
3714
+ Xn && B.ticks(5).map((m) => /* @__PURE__ */ x.jsxs("g", { transform: `translate(0, ${B(m)})`, children: [
3715
+ /* @__PURE__ */ x.jsx("line", { x1: 0, x2: w, stroke: Ze, strokeDasharray: zn }),
3716
+ /* @__PURE__ */ x.jsx("text", { x: -10, y: 4, textAnchor: "end", fontSize: xt, fill: bt, children: m })
3717
+ ] }, `y-tick-${m}`)),
3718
+ /* @__PURE__ */ x.jsx("line", { x1: 0, y1: M, x2: w, y2: M, stroke: Ze }),
3719
+ /* @__PURE__ */ x.jsx("line", { x1: 0, y1: 0, x2: 0, y2: M, stroke: Ze }),
3720
+ i?.y && /* @__PURE__ */ x.jsx(
3721
+ "text",
3722
+ {
3723
+ x: -30,
3724
+ y: M / 2,
3725
+ transform: `rotate(-90, -30, ${M / 2})`,
3726
+ textAnchor: "middle",
3727
+ fill: pt,
3728
+ fontSize: 12,
3729
+ children: i.y
3730
+ }
3731
+ ),
3732
+ i?.x && /* @__PURE__ */ x.jsx(
3733
+ "text",
3734
+ {
3735
+ x: w / 2,
3736
+ y: M + 35,
3737
+ textAnchor: "middle",
3738
+ fill: pt,
3739
+ fontSize: 12,
3740
+ children: i.x
3741
+ }
3742
+ ),
3743
+ I.map((m) => {
3744
+ const k = N(m.id), Y = N.bandwidth(), V = Math.min(Y, Vn), ge = k + (Y - V) / 2, Ye = B(m.value), wt = M - Ye;
3745
+ if (k === void 0) return null;
3746
+ const Ee = S?.id === m.id, vt = S !== null && !Ee;
3747
+ if (n === "stacked" && m.stackedValues) {
3748
+ let Me = M;
3749
+ return /* @__PURE__ */ x.jsxs(
3750
+ "g",
3751
+ {
3752
+ onMouseEnter: () => W(m),
3753
+ onMouseLeave: () => W(null),
3754
+ onClick: () => W(S === m ? null : m),
3755
+ style: { opacity: vt ? 0.3 : 1, transition: "opacity 0.3s" },
3756
+ children: [
3757
+ m.stackedValues.map((Et, Jn) => {
3758
+ const Mt = Math.abs(B(Et.value) - B(0)), kt = Me - Mt, Kn = /* @__PURE__ */ x.jsx(
3759
+ "rect",
3760
+ {
3761
+ x: ge,
3762
+ y: kt,
3763
+ width: V,
3764
+ height: Mt,
3765
+ fill: Et.color,
3766
+ rx: mt,
3767
+ opacity: yt,
3768
+ stroke: Ee ? "#fff" : "none",
3769
+ strokeWidth: Ee ? 1 : 0
3770
+ },
3771
+ `${m.id}-${Jn}`
3772
+ );
3773
+ return Me = kt, Kn;
3774
+ }),
3775
+ /* @__PURE__ */ x.jsx("rect", { x: ge, y: Ye, width: V, height: wt, fill: "transparent" })
3776
+ ]
3777
+ },
3778
+ m.id
3779
+ );
3780
+ }
3781
+ return /* @__PURE__ */ x.jsxs("g", { children: [
3782
+ /* @__PURE__ */ x.jsx(
3783
+ $o,
3784
+ {
3785
+ x: ge,
3786
+ y: Ye,
3787
+ width: V,
3788
+ height: wt,
3789
+ data: m,
3790
+ isActive: Ee,
3791
+ isDimmed: vt,
3792
+ onHover: W,
3793
+ onClick: (Me) => {
3794
+ W(Me === S ? null : Me);
3795
+ },
3796
+ style: { rx: mt, fillOpacity: yt },
3797
+ "aria-label": `${m.label}: ${m.value}`,
3798
+ role: "graphics-symbol"
3799
+ }
3800
+ ),
3801
+ Ee && /* @__PURE__ */ x.jsx(
3802
+ "text",
3803
+ {
3804
+ x: ge + V / 2,
3805
+ y: Ye - 5,
3806
+ textAnchor: "middle",
3807
+ fill: "#333",
3808
+ fontSize: 12,
3809
+ fontWeight: "bold",
3810
+ pointerEvents: "none",
3811
+ children: m.value
3812
+ }
3813
+ )
3814
+ ] }, m.id);
3815
+ }),
3816
+ I.map((m) => {
3817
+ const k = N(m.id);
3818
+ return k === void 0 ? null : /* @__PURE__ */ x.jsx(
3819
+ "text",
3820
+ {
3821
+ x: k + N.bandwidth() / 2,
3822
+ y: M + 15,
3823
+ textAnchor: "middle",
3824
+ fill: bt,
3825
+ fontSize: xt,
3826
+ children: m.label
3827
+ },
3828
+ `label-${m.id}`
3829
+ );
3830
+ })
3831
+ ] })
3832
+ }
3833
+ ) }),
3834
+ /* @__PURE__ */ x.jsx(
3835
+ "button",
3836
+ {
3837
+ onClick: D,
3838
+ disabled: !ve,
3839
+ style: {
3840
+ flexShrink: 0,
3841
+ width: 40,
3842
+ height: 40,
3843
+ borderRadius: "50%",
3844
+ border: "1px solid #ddd",
3845
+ background: "#fff",
3846
+ cursor: ve ? "pointer" : "default",
3847
+ opacity: ve ? 1 : 0.3,
3848
+ display: "flex",
3849
+ alignItems: "center",
3850
+ justifyContent: "center",
3851
+ fontSize: 18,
3852
+ color: "#333",
3853
+ marginLeft: 10
3854
+ },
3855
+ children: ">"
3856
+ }
3857
+ )
3858
+ ] })
3859
+ ] });
3860
+ };
3861
+ export {
3862
+ yi as SmartBarChart
3863
+ };