@cfasim-ui/charts 0.3.11 → 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, normalizeClass as u, normalizeProps as d, normalizeStyle as f, onMounted as p, onUnmounted as ee, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, toRaw as y, unref as b, useId as x, watch as te, withCtx as S, withModifiers as C } from "vue";
2
- import { DropdownMenuContent as w, DropdownMenuItem as T, DropdownMenuPortal as E, DropdownMenuRoot as D, DropdownMenuTrigger as O, PopoverAnchor as k, PopoverContent as A, PopoverPortal as j, PopoverRoot as M } from "reka-ui";
3
- import { geoAlbersUsa as N, geoPath as P } from "d3-geo";
4
- import { zoom as F } from "d3-zoom";
5
- import { select as ne } from "d3-selection";
6
- import { feature as re, merge as ie, mesh as ae } from "topojson-client";
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, normalizeClass as u, normalizeProps as ee, normalizeStyle as d, onMounted as te, onUnmounted as ne, openBlock as f, ref as p, renderList as m, renderSlot as h, toDisplayString as g, toRaw as _, unref as v, useId as y, watch as re, withCtx as b, withModifiers as x } from "vue";
2
+ import { DropdownMenuContent as S, DropdownMenuItem as C, DropdownMenuPortal as ie, DropdownMenuRoot as w, DropdownMenuTrigger as T, PopoverAnchor as E, PopoverContent as D, PopoverPortal as O, PopoverRoot as ae } from "reka-ui";
3
+ import { geoAlbersUsa as oe, geoPath as k } from "d3-geo";
4
+ import { zoom as A } from "d3-zoom";
5
+ import { select as se } from "d3-selection";
6
+ import { feature as j, merge as M, mesh as N } from "topojson-client";
7
7
  //#region src/ChartMenu/ChartMenu.vue?vue&type=script&setup=true&lang.ts
8
- var I = { class: "chart-menu-trigger-area" }, L = ["aria-label"], oe = /* @__PURE__ */ c({
8
+ var P = { class: "chart-menu-trigger-area" }, ce = ["aria-label"], F = /* @__PURE__ */ c({
9
9
  __name: "ChartMenu",
10
10
  props: { items: {} },
11
11
  setup(t) {
12
- return (r, c) => (m(), i("div", I, [t.items.length === 1 ? (m(), i("button", {
12
+ return (r, c) => (f(), i("div", P, [t.items.length === 1 ? (f(), i("button", {
13
13
  key: 0,
14
14
  class: "chart-menu-button chart-menu-single",
15
15
  "aria-label": t.items[0].label,
@@ -24,15 +24,15 @@ var I = { class: "chart-menu-trigger-area" }, L = ["aria-label"], oe = /* @__PUR
24
24
  "stroke-linecap": "round",
25
25
  "stroke-linejoin": "round",
26
26
  "aria-hidden": "true"
27
- }, [a("path", { d: "M7 1v8M3 6l4 4 4-4M2 13h10" })], -1)]], 8, L)) : (m(), n(b(D), {
27
+ }, [a("path", { d: "M7 1v8M3 6l4 4 4-4M2 13h10" })], -1)]], 8, ce)) : (f(), n(v(w), {
28
28
  key: 1,
29
29
  modal: !1
30
30
  }, {
31
- default: S(() => [s(b(O), {
31
+ default: b(() => [s(v(T), {
32
32
  class: "chart-menu-button",
33
33
  "aria-label": "Chart options"
34
34
  }, {
35
- default: S(() => [...c[2] ||= [a("svg", {
35
+ default: b(() => [...c[2] ||= [a("svg", {
36
36
  width: "16",
37
37
  height: "16",
38
38
  viewBox: "0 0 16 16",
@@ -56,18 +56,18 @@ var I = { class: "chart-menu-trigger-area" }, L = ["aria-label"], oe = /* @__PUR
56
56
  })
57
57
  ], -1)]]),
58
58
  _: 1
59
- }), s(b(E), null, {
60
- default: S(() => [s(b(w), {
59
+ }), s(v(ie), null, {
60
+ default: b(() => [s(v(S), {
61
61
  class: "chart-menu-content",
62
62
  "side-offset": 4,
63
63
  align: "end"
64
64
  }, {
65
- default: S(() => [(m(!0), i(e, null, g(t.items, (e) => (m(), n(b(T), {
65
+ default: b(() => [(f(!0), i(e, null, m(t.items, (e) => (f(), n(v(C), {
66
66
  key: e.label,
67
67
  class: "chart-menu-item",
68
68
  onSelect: e.action
69
69
  }, {
70
- default: S(() => [o(v(e.label), 1)]),
70
+ default: b(() => [o(g(e.label), 1)]),
71
71
  _: 2
72
72
  }, 1032, ["onSelect"]))), 128))]),
73
73
  _: 1
@@ -77,24 +77,24 @@ var I = { class: "chart-menu-trigger-area" }, L = ["aria-label"], oe = /* @__PUR
77
77
  _: 1
78
78
  }))]));
79
79
  }
80
- }), R = (e, t) => {
80
+ }), I = (e, t) => {
81
81
  let n = e.__vccOpts || e;
82
82
  for (let [e, r] of t) n[e] = r;
83
83
  return n;
84
- }, se = /* @__PURE__ */ R(oe, [["__scopeId", "data-v-fe2f6904"]]);
84
+ }, le = /* @__PURE__ */ I(F, [["__scopeId", "data-v-fe2f6904"]]);
85
85
  //#endregion
86
86
  //#region src/ChartMenu/download.ts
87
- function z(e, t) {
87
+ function L(e, t) {
88
88
  let n = URL.createObjectURL(e), r = document.createElement("a");
89
89
  r.href = n, r.download = t, r.click(), URL.revokeObjectURL(n);
90
90
  }
91
- function ce(e, t) {
91
+ function ue(e, t) {
92
92
  let n = e.cloneNode(!0);
93
93
  n.setAttribute("xmlns", "http://www.w3.org/2000/svg");
94
94
  let r = new XMLSerializer().serializeToString(n);
95
- z(new Blob([r], { type: "image/svg+xml" }), `${t}.svg`);
95
+ L(new Blob([r], { type: "image/svg+xml" }), `${t}.svg`);
96
96
  }
97
- function le(e, t) {
97
+ function de(e, t) {
98
98
  let n = e.cloneNode(!0);
99
99
  n.setAttribute("xmlns", "http://www.w3.org/2000/svg");
100
100
  let r = new XMLSerializer().serializeToString(n), i = new Blob([r], { type: "image/svg+xml;charset=utf-8" }), a = URL.createObjectURL(i), o = new Image(), s = e.width.baseVal.value || e.clientWidth, c = e.height.baseVal.value || e.clientHeight;
@@ -103,19 +103,19 @@ function le(e, t) {
103
103
  e.width = s * 2, e.height = c * 2;
104
104
  let n = e.getContext("2d");
105
105
  n.scale(2, 2), n.drawImage(o, 0, 0, s, c), e.toBlob((e) => {
106
- e && z(e, `${t}.png`);
106
+ e && L(e, `${t}.png`);
107
107
  }), URL.revokeObjectURL(a);
108
108
  }, o.src = a;
109
109
  }
110
- function ue(e, t) {
111
- z(new Blob([e], { type: "text/csv" }), `${t}.csv`);
110
+ function fe(e, t) {
111
+ L(new Blob([e], { type: "text/csv" }), `${t}.csv`);
112
112
  }
113
113
  //#endregion
114
114
  //#region src/tooltip-position.ts
115
- var B = 16, V = 8;
116
- function de(e, t, n, r, i, a) {
115
+ var R = 16, z = 8;
116
+ function pe(e, t, n, r, i, a) {
117
117
  if (i === "none") return {
118
- left: e + B,
118
+ left: e + R,
119
119
  top: t
120
120
  };
121
121
  let o = i === "chart" && a ? {
@@ -128,78 +128,78 @@ function de(e, t, n, r, i, a) {
128
128
  right: window.innerWidth,
129
129
  top: 0,
130
130
  bottom: window.innerHeight
131
- }, s = e + B + n > o.right - V ? e - B - n : e + B, c = r / 2;
131
+ }, s = e + R + n > o.right - z ? e - R - n : e + R, c = r / 2;
132
132
  return {
133
133
  left: s,
134
- top: Math.min(Math.max(t, o.top + V + c), o.bottom - V - c)
134
+ top: Math.min(Math.max(t, o.top + z + c), o.bottom - z - c)
135
135
  };
136
136
  }
137
137
  //#endregion
138
138
  //#region src/LineChart/LineChart.vue?vue&type=script&setup=true&lang.ts
139
- var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
139
+ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
140
140
  "x1",
141
141
  "y1",
142
142
  "x2",
143
143
  "y2",
144
144
  "stroke",
145
145
  "stroke-dasharray"
146
- ], W = [
146
+ ], H = [
147
147
  "cx",
148
148
  "cy",
149
149
  "fill",
150
150
  "fill-opacity",
151
151
  "stroke"
152
- ], me = ["x", "y"], he = [
152
+ ], ge = ["x", "y"], _e = [
153
153
  "x1",
154
154
  "y1",
155
155
  "x2",
156
156
  "y2"
157
- ], ge = [
157
+ ], ve = [
158
158
  "x1",
159
159
  "y1",
160
160
  "x2",
161
161
  "y2"
162
- ], _e = [
162
+ ], ye = [
163
163
  "x1",
164
164
  "y1",
165
165
  "x2",
166
166
  "y2"
167
- ], ve = [
167
+ ], be = [
168
168
  "x1",
169
169
  "y1",
170
170
  "x2",
171
171
  "y2"
172
- ], ye = ["x", "y"], be = ["transform"], G = [
172
+ ], xe = ["x", "y"], Se = ["transform"], U = [
173
173
  "x",
174
174
  "y",
175
175
  "text-anchor"
176
- ], K = ["x", "y"], xe = [
176
+ ], W = ["x", "y"], Ce = [
177
177
  "d",
178
178
  "fill",
179
179
  "fill-opacity"
180
- ], Se = [
180
+ ], we = [
181
181
  "d",
182
182
  "stroke",
183
183
  "stroke-width",
184
184
  "stroke-opacity",
185
185
  "stroke-dasharray"
186
- ], Ce = [
186
+ ], Te = [
187
187
  "cx",
188
188
  "cy",
189
189
  "r",
190
190
  "fill",
191
191
  "fill-opacity",
192
192
  "stroke"
193
- ], we = [
193
+ ], Ee = [
194
194
  "d",
195
195
  "fill",
196
196
  "fill-opacity"
197
- ], Te = [
197
+ ], De = [
198
198
  "d",
199
199
  "stroke",
200
200
  "stroke-width",
201
201
  "stroke-dasharray"
202
- ], Ee = [
202
+ ], Oe = [
203
203
  "x1",
204
204
  "y1",
205
205
  "x2",
@@ -207,7 +207,7 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
207
207
  "stroke",
208
208
  "stroke-width",
209
209
  "stroke-dasharray"
210
- ], q = [
210
+ ], G = [
211
211
  "x1",
212
212
  "y1",
213
213
  "x2",
@@ -215,47 +215,49 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
215
215
  "stroke",
216
216
  "stroke-width",
217
217
  "stroke-dasharray"
218
- ], De = [
218
+ ], ke = [
219
219
  "x1",
220
220
  "y1",
221
221
  "x2",
222
222
  "y2"
223
- ], Oe = [
223
+ ], Ae = [
224
224
  "x1",
225
225
  "y1",
226
226
  "x2",
227
227
  "y2"
228
- ], ke = [
228
+ ], je = [
229
229
  "x1",
230
230
  "y1",
231
231
  "x2",
232
232
  "y2"
233
- ], Ae = [
233
+ ], Me = [
234
234
  "cx",
235
235
  "cy",
236
236
  "fill"
237
- ], je = [
237
+ ], Ne = [
238
238
  "x",
239
239
  "y",
240
240
  "width",
241
241
  "height"
242
- ], Me = [
242
+ ], Pe = [
243
243
  "cx",
244
244
  "cy",
245
245
  "fill",
246
246
  "fill-opacity",
247
247
  "stroke"
248
- ], Ne = [
248
+ ], Fe = [
249
249
  "x",
250
250
  "y",
251
251
  "fill"
252
- ], Pe = ["x", "y"], Fe = { class: "line-chart-tooltip" }, Ie = {
252
+ ], Ie = ["x", "y"], Le = { class: "line-chart-tooltip" }, Re = {
253
253
  key: 0,
254
254
  class: "line-chart-tooltip-label"
255
- }, Le = ["href", "download"], J = 20, Y = 36, Re = 12, ze = 7, Be = 16, Ve = 50, He = /* @__PURE__ */ R(/* @__PURE__ */ c({
255
+ }, ze = ["href", "download"], K = 20, q = 36, Be = 12, Ve = 7, He = 16, Ue = 50, J = /* @__PURE__ */ I(/* @__PURE__ */ c({
256
256
  __name: "LineChart",
257
257
  props: {
258
+ y: {},
258
259
  data: {},
260
+ x: {},
259
261
  series: {},
260
262
  areas: {},
261
263
  areaSections: {},
@@ -288,31 +290,77 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
288
290
  },
289
291
  emits: ["hover"],
290
292
  setup(s, { emit: c }) {
291
- let u = s, y = c, b = h(null), x = h(null), S = h(0), w = null, T = null;
292
- p(() => {
293
- b.value && (S.value = b.value.clientWidth, w = new ResizeObserver((e) => {
293
+ let u = s, _ = c, v = p(null), y = p(null), b = p(0), S = null, C = null;
294
+ te(() => {
295
+ v.value && (b.value = v.value.clientWidth, S = new ResizeObserver((e) => {
294
296
  let t = e[0];
295
- t && (u.debounce ? (T && clearTimeout(T), T = setTimeout(() => {
296
- S.value = t.contentRect.width;
297
- }, u.debounce)) : S.value = t.contentRect.width);
298
- }), w.observe(b.value));
299
- }), ee(() => {
300
- w?.disconnect(), T && clearTimeout(T);
297
+ t && (u.debounce ? (C && clearTimeout(C), C = setTimeout(() => {
298
+ b.value = t.contentRect.width;
299
+ }, u.debounce)) : b.value = t.contentRect.width);
300
+ }), S.observe(v.value));
301
+ }), ne(() => {
302
+ S?.disconnect(), C && clearTimeout(C);
301
303
  });
302
- let E = t(() => u.width ?? (S.value || 400)), D = t(() => u.height ?? 200), O = t(() => M.value.some((e) => e.legend) || u.areaSections?.some((e) => e.legend === "inline" && (e.label || e.description))), k = t(() => ({
303
- top: (u.title ? 30 : 10) + (O.value ? J : 0),
304
+ let ie = t(() => u.width ?? (b.value || 400)), w = t(() => u.height ?? 200), T = t(() => k.value.some((e) => e.legend) || u.areaSections?.some((e) => e.legend === "inline" && (e.label || e.description))), E = t(() => ({
305
+ top: (u.title ? 30 : 10) + (T.value ? K : 0),
304
306
  right: 10,
305
307
  bottom: u.xLabel ? 46 : 30,
306
308
  left: u.yLabel ? 66 : 50
307
- })), A = t(() => E.value - k.value.left - k.value.right), j = t(() => D.value - k.value.top - k.value.bottom), M = t(() => u.series && u.series.length > 0 ? u.series : u.data ? [{ data: u.data }] : []), N = t(() => u.areas ?? []), P = t(() => {
309
+ })), D = t(() => ie.value - E.value.left - E.value.right), O = t(() => w.value - E.value.top - E.value.bottom), ae = [];
310
+ function oe(e) {
311
+ return {
312
+ ...e,
313
+ data: e.y ?? e.data ?? ae
314
+ };
315
+ }
316
+ let k = t(() => {
317
+ if (u.series && u.series.length > 0) return u.series.map(oe);
318
+ let e = u.y ?? u.data;
319
+ return e ? [{
320
+ data: e,
321
+ x: u.x
322
+ }] : [];
323
+ }), A = t(() => u.areas ?? []), se = t(() => {
308
324
  let e = 0;
309
- for (let t of M.value) t.data.length > e && (e = t.data.length);
310
- for (let t of N.value) t.upper.length > e && (e = t.upper.length), t.lower.length > e && (e = t.lower.length);
325
+ for (let t of k.value) t.data.length > e && (e = t.data.length);
326
+ for (let t of A.value) t.upper.length > e && (e = t.upper.length), t.lower.length > e && (e = t.lower.length);
311
327
  return e;
312
- }), F = t(() => {
328
+ }), j = t(() => k.value.some((e) => e.x != null) || A.value.some((e) => e.x != null));
329
+ function M(e, t) {
330
+ return e.x ? Number(e.x[t]) : t;
331
+ }
332
+ function N(e, t) {
333
+ return e.x ? Number(e.x[t]) : t;
334
+ }
335
+ let P = t(() => j.value ? 0 : u.xMin ?? 0), ce = t(() => {
336
+ let e = Infinity, t = -Infinity;
337
+ for (let n of k.value) for (let r = 0; r < n.data.length; r++) {
338
+ let i = M(n, r);
339
+ isFinite(i) && (i < e && (e = i), i > t && (t = i));
340
+ }
341
+ for (let n of A.value) {
342
+ let r = Math.max(n.upper.length, n.lower.length);
343
+ for (let i = 0; i < r; i++) {
344
+ let r = N(n, i);
345
+ isFinite(r) && (r < e && (e = r), r > t && (t = r));
346
+ }
347
+ }
348
+ return isFinite(e) ? {
349
+ min: e,
350
+ max: t
351
+ } : {
352
+ min: 0,
353
+ max: 0
354
+ };
355
+ });
356
+ function F(e) {
357
+ let { min: t, max: n } = ce.value, r = n - t || 1;
358
+ return E.value.left + (e - t) / r * D.value;
359
+ }
360
+ let I = t(() => {
313
361
  let e = Infinity, t = -Infinity;
314
- for (let n of M.value) for (let r of n.data) isFinite(r) && (r < e && (e = r), r > t && (t = r));
315
- for (let n of N.value) {
362
+ for (let n of k.value) for (let r of n.data) isFinite(r) && (r < e && (e = r), r > t && (t = r));
363
+ for (let n of A.value) {
316
364
  for (let r of n.upper) isFinite(r) && (r < e && (e = r), r > t && (t = r));
317
365
  for (let r of n.lower) isFinite(r) && (r < e && (e = r), r > t && (t = r));
318
366
  }
@@ -326,95 +374,104 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
326
374
  range: 1
327
375
  };
328
376
  });
329
- function ne(e) {
330
- if (e.length === 0) return "";
331
- let { min: t, range: n } = F.value, r = P.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = "", c = !1;
332
- for (let n = 0; n < e.length; n++) {
333
- if (!isFinite(e[n])) {
334
- c = !1;
377
+ function L(e) {
378
+ let t = e.data;
379
+ if (t.length === 0) return "";
380
+ let { min: n, range: r } = I.value, i = O.value / r, a = E.value.top + O.value, o = "", s = !1;
381
+ for (let r = 0; r < t.length; r++) {
382
+ let c = M(e, r);
383
+ if (!isFinite(t[r]) || !isFinite(c)) {
384
+ s = !1;
335
385
  continue;
336
386
  }
337
- let r = k.value.left + n * i, l = o - (e[n] - t) * a;
338
- s += c ? `L${r},${l}` : `M${r},${l}`, c = !0;
387
+ let l = F(c), u = a - (t[r] - n) * i;
388
+ o += s ? `L${l},${u}` : `M${l},${u}`, s = !0;
339
389
  }
340
- return s;
390
+ return o;
341
391
  }
342
- function re(e) {
343
- let { min: t, range: n } = F.value, r = P.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = [];
344
- for (let n = 0; n < e.length; n++) isFinite(e[n]) && s.push({
345
- x: k.value.left + n * i,
346
- y: o - (e[n] - t) * a
347
- });
348
- return s;
392
+ function R(e) {
393
+ let t = e.data, { min: n, range: r } = I.value, i = O.value / r, a = E.value.top + O.value, o = [];
394
+ for (let r = 0; r < t.length; r++) {
395
+ let s = M(e, r);
396
+ !isFinite(t[r]) || !isFinite(s) || o.push({
397
+ x: F(s),
398
+ y: a - (t[r] - n) * i
399
+ });
400
+ }
401
+ return o;
349
402
  }
350
- function ie(e, t) {
351
- let n = Math.min(e.length, t.length);
352
- if (n === 0) return "";
353
- let { min: r, range: i } = F.value, a = P.value, o = A.value / (a - 1 || 1), s = j.value / i, c = k.value.top + j.value, l = (e) => k.value.left + e * o, u = (e) => c - (e - r) * s, d = [], f = [];
354
- for (let r = 0; r < n; r++) isFinite(e[r]) && isFinite(t[r]) ? f.push(r) : f.length && (d.push(f), f = []);
355
- f.length && d.push(f);
356
- let p = "";
357
- for (let n of d) {
358
- p += `M${l(n[0])},${u(e[n[0]])}`;
359
- for (let t = 1; t < n.length; t++) p += `L${l(n[t])},${u(e[n[t]])}`;
360
- for (let e = n.length - 1; e >= 0; e--) p += `L${l(n[e])},${u(t[n[e]])}`;
361
- p += "Z";
403
+ function z(e) {
404
+ let t = Math.min(e.upper.length, e.lower.length);
405
+ if (t === 0) return "";
406
+ let { min: n, range: r } = I.value, i = O.value / r, a = E.value.top + O.value, o = (e) => a - (e - n) * i, s = [], c = [];
407
+ for (let n = 0; n < t; n++) isFinite(e.upper[n]) && isFinite(e.lower[n]) && isFinite(N(e, n)) ? c.push(n) : c.length && (s.push(c), c = []);
408
+ c.length && s.push(c);
409
+ let l = "";
410
+ for (let t of s) {
411
+ l += `M${F(N(e, t[0]))},${o(e.upper[t[0]])}`;
412
+ for (let n = 1; n < t.length; n++) l += `L${F(N(e, t[n]))},${o(e.upper[t[n]])}`;
413
+ for (let n = t.length - 1; n >= 0; n--) l += `L${F(N(e, t[n]))},${o(e.lower[t[n]])}`;
414
+ l += "Z";
362
415
  }
363
- return p;
416
+ return l;
364
417
  }
365
- function ae(e, t = !0) {
366
- let n = P.value, r = A.value / (n - 1 || 1), i = k.value.top + j.value, a = (e) => k.value.left + e * r;
418
+ function J(e, t) {
419
+ let n = t === "start" ? e.startIndex : e.endIndex, r = e.seriesIndex != null && k.value[e.seriesIndex] || k.value[0];
420
+ return F(r ? M(r, n) : n);
421
+ }
422
+ function We(e, t = !0) {
423
+ let n = E.value.top + O.value;
367
424
  if (e.seriesIndex == null) {
368
- let t = Math.max(0, e.startIndex), r = Math.min(n - 1, e.endIndex);
369
- return t > r ? "" : `M${a(t)},${k.value.top}L${a(r)},${k.value.top}L${a(r)},${i}L${a(t)},${i}Z`;
425
+ let t = J(e, "start"), r = J(e, "end");
426
+ return t > r ? "" : `M${t},${E.value.top}L${r},${E.value.top}L${r},${n}L${t},${n}Z`;
370
427
  }
371
- let o = M.value[e.seriesIndex];
372
- if (!o) return "";
373
- let { min: s, range: c } = F.value, l = j.value / c, u = (e) => i - (e - s) * l, d = Math.max(0, e.startIndex), f = Math.min(o.data.length - 1, e.endIndex);
374
- if (d > f) return "";
375
- let p = `M${a(d)},${u(o.data[d])}`;
376
- for (let e = d + 1; e <= f; e++) isFinite(o.data[e]) && (p += `L${a(e)},${u(o.data[e])}`);
377
- return t && (p += `L${a(f)},${i}`, p += `L${a(d)},${i}`, p += "Z"), p;
428
+ let r = k.value[e.seriesIndex];
429
+ if (!r) return "";
430
+ let { min: i, range: a } = I.value, o = O.value / a, s = (e) => n - (e - i) * o, c = Math.max(0, e.startIndex), l = Math.min(r.data.length - 1, e.endIndex);
431
+ if (c > l) return "";
432
+ let u = `M${F(M(r, c))},${s(r.data[c])}`;
433
+ for (let e = c + 1; e <= l; e++) isFinite(r.data[e]) && (u += `L${F(M(r, e))},${s(r.data[e])}`);
434
+ return t && (u += `L${F(M(r, l))},${n}`, u += `L${F(M(r, c))},${n}`, u += "Z"), u;
378
435
  }
379
- let I = t(() => {
436
+ let Ge = t(() => {
380
437
  let e = u.areaSections;
381
438
  if (!e?.length) return {
382
439
  labels: [],
383
440
  extraHeight: 0
384
441
  };
385
- let t = P.value, n = A.value / (t - 1 || 1), r = [];
386
- for (let t of e) {
387
- if (!t.label && !t.description || t.legend === "inline" || t.legend === !1) continue;
388
- let e = k.value.left + (t.startIndex + t.endIndex) / 2 * n, i = t.label ?? "", a = t.description ?? "", o = Math.max(i.length, a.length) * ze, s = t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor");
389
- r.push({
390
- cx: e,
391
- labelText: i,
392
- descText: a,
393
- textWidth: o,
442
+ let t = [], n = E.value.left + D.value;
443
+ for (let r of e) {
444
+ if (!r.label && !r.description || r.legend === "inline" || r.legend === !1) continue;
445
+ let e = r.label ?? "", i = r.description ?? "", a = Math.max(e.length, i.length) * Ve, o = J(r, "start") + a / 2 + 2, s = n - a / 2 - 8, c = Math.min(o, s), l = r.color ?? (r.seriesIndex == null ? "#999" : k.value[r.seriesIndex]?.color ?? "currentColor");
446
+ t.push({
447
+ cx: c,
448
+ labelText: e,
449
+ descText: i,
450
+ textWidth: a,
394
451
  row: 0,
395
- color: s,
396
- fillOpacity: t.opacity ?? .15
452
+ color: l,
453
+ fillOpacity: r.opacity ?? .15
397
454
  });
398
455
  }
399
- r.sort((e, t) => e.cx - t.cx);
400
- let i = [];
401
- for (let e of r) {
456
+ t.sort((e, t) => e.cx - t.cx);
457
+ let r = [];
458
+ for (let e of t) {
402
459
  let t = e.cx - e.textWidth / 2, n = 0;
403
- for (; n < i.length && !(t >= i[n] + Be);) n++;
460
+ for (; n < r.length && !(t >= r[n] + He);) n++;
404
461
  e.row = n;
405
- let r = e.cx + e.textWidth / 2;
406
- i[n] = Math.max(i[n] ?? -Infinity, r);
462
+ let i = e.cx + e.textWidth / 2;
463
+ r[n] = Math.max(r[n] ?? -Infinity, i);
407
464
  }
408
- return r.length === 0 ? {
465
+ return t.length === 0 ? {
409
466
  labels: [],
410
467
  extraHeight: 0
411
468
  } : {
412
- labels: r,
413
- extraHeight: (Math.max(...r.map((e) => e.row)) + 1) * Y + Re
469
+ labels: t,
470
+ extraHeight: (Math.max(...t.map((e) => e.row)) + 1) * q + Be
414
471
  };
415
- }), L = t(() => {
472
+ }), Ke = t(() => {
416
473
  let e = [];
417
- for (let t of M.value) t.legend && e.push({
474
+ for (let t of k.value) t.legend && e.push({
418
475
  label: t.legend,
419
476
  color: t.color ?? "currentColor",
420
477
  type: "series",
@@ -423,7 +480,7 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
423
480
  let t = u.areaSections;
424
481
  if (t) for (let n of t) {
425
482
  if (n.legend !== "inline" || !n.label && !n.description) continue;
426
- let t = [n.label, n.description].filter(Boolean).join(" "), r = n.color ?? (n.seriesIndex == null ? "#999" : M.value[n.seriesIndex]?.color ?? "currentColor");
483
+ let t = [n.label, n.description].filter(Boolean).join(" "), r = n.color ?? (n.seriesIndex == null ? "#999" : k.value[n.seriesIndex]?.color ?? "currentColor");
427
484
  e.push({
428
485
  label: t,
429
486
  color: r,
@@ -432,327 +489,346 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
432
489
  });
433
490
  }
434
491
  return e;
435
- }), oe = t(() => D.value + I.value.extraHeight), R = t(() => k.value.top + j.value + k.value.bottom + Re);
436
- function z(e, t) {
492
+ }), qe = t(() => w.value + Ge.value.extraHeight), Je = t(() => E.value.top + O.value + E.value.bottom + Be);
493
+ function Ye(e, t) {
437
494
  let n = e / t, r = 10 ** Math.floor(Math.log10(n)), i = n / r, a;
438
495
  return a = i <= 1.5 ? 1 : i <= 3 ? 2 : i <= 7 ? 5 : 10, a * r;
439
496
  }
440
- function B(e) {
497
+ function Y(e) {
441
498
  return Math.round(e) + .5;
442
499
  }
443
- let V = new Intl.NumberFormat();
444
- function He(e) {
445
- return Math.abs(e) >= 1e3 ? V.format(e) : Number.isInteger(e) ? e.toString() : e.toFixed(1);
500
+ let Xe = new Intl.NumberFormat();
501
+ function X(e) {
502
+ return Math.abs(e) >= 1e3 ? Xe.format(e) : Number.isInteger(e) ? e.toString() : e.toFixed(1);
446
503
  }
447
- function Ue(e, t, n) {
504
+ function Ze(e, t, n) {
448
505
  if (!(n > 0) || !isFinite(n)) return [];
449
506
  let r = [], i = Math.ceil(e / n) * n;
450
507
  for (let e = 0, a = i; a <= t + 1e-9 && e < 1e3; e++, a = i + e * n) r.push(a);
451
508
  return r;
452
509
  }
453
- let We = t(() => {
454
- let { min: e, max: t } = F.value, n = (t) => B(k.value.top + j.value - (t - e) / F.value.range * j.value), r = (e) => u.yTickFormat ? u.yTickFormat(e) : He(e);
510
+ let Qe = t(() => {
511
+ let { min: e, max: t } = I.value, n = (t) => Y(E.value.top + O.value - (t - e) / I.value.range * O.value), r = (e) => u.yTickFormat ? u.yTickFormat(e) : X(e);
455
512
  if (e === t) return [{
456
513
  value: r(e),
457
- y: B(k.value.top + j.value / 2)
514
+ y: Y(E.value.top + O.value / 2)
458
515
  }];
459
516
  let i;
460
517
  if (Array.isArray(u.yTicks)) i = u.yTicks.filter((n) => n >= e && n <= t);
461
- else if (typeof u.yTicks == "number") i = Ue(e, t, u.yTicks);
518
+ else if (typeof u.yTicks == "number") i = Ze(e, t, u.yTicks);
462
519
  else {
463
- let n = Math.max(3, Math.floor(j.value / 50));
464
- i = Ue(e, t, z(t - e, n));
520
+ let n = Math.max(3, Math.floor(O.value / 50));
521
+ i = Ze(e, t, Ye(t - e, n));
465
522
  }
466
523
  return i.map((e) => ({
467
524
  value: r(e),
468
525
  y: n(e)
469
526
  }));
470
- }), Ge = t(() => {
471
- let e = P.value;
472
- if (e <= 1) return [];
473
- let t = u.xMin ?? 0, n = t, r = t + (e - 1), i = (n) => B(k.value.left + (n - t) / (e - 1) * A.value), a = (e, n) => {
474
- if (u.xTickFormat) return u.xTickFormat(e, n);
475
- let r = u.xLabels, i = e - t;
476
- return r && Number.isInteger(i) && i >= 0 && i < r.length ? r[i] : He(e);
477
- }, o;
478
- if (Array.isArray(u.xTicks)) o = u.xTicks.filter((e) => e >= n && e <= r);
479
- else if (typeof u.xTicks == "number") o = Ue(n, r, u.xTicks);
480
- else if (u.xLabels && u.xLabels.length === e) {
481
- let n = Math.max(3, Math.floor(A.value / 80)), r = Math.max(1, Math.round((e - 1) / n));
482
- o = [];
483
- for (let n = 0; n < e; n += r) o.push(t + n);
527
+ }), $e = t(() => {
528
+ let { min: e, max: t } = ce.value;
529
+ if (e === t) return [];
530
+ let n = P.value, r = se.value, i = (e, t) => {
531
+ let r = e + n;
532
+ return u.xTickFormat ? u.xTickFormat(r, t) : !j.value && u.xLabels && Number.isInteger(e) && e >= 0 && e < u.xLabels.length ? u.xLabels[e] : X(r);
533
+ }, a;
534
+ if (Array.isArray(u.xTicks)) a = u.xTicks.map((e) => e - n).filter((n) => n >= e && n <= t);
535
+ else if (typeof u.xTicks == "number") a = Ze(e + n, t + n, u.xTicks).map((e) => e - n);
536
+ else if (!j.value && u.xLabels && u.xLabels.length === r) {
537
+ let e = Math.max(3, Math.floor(D.value / 80)), t = Math.max(1, Math.round((r - 1) / e));
538
+ a = [];
539
+ for (let e = 0; e < r; e += t) a.push(e);
484
540
  } else {
485
- let n = Math.max(3, Math.floor(A.value / 80)), r = z(e - 1, n);
486
- o = [];
487
- for (let n = 0; n <= e - 1; n += r) o.push(Math.round(n) + t);
541
+ let r = Math.max(3, Math.floor(D.value / 80)), i = Ye(t - e, r);
542
+ a = Ze(e + n, t + n, i).map((e) => e - n);
488
543
  }
489
- let s = k.value.left, c = k.value.left + A.value;
490
- return o.map((e, t) => {
491
- let n = i(e), r = "middle";
492
- return n - s <= 1 ? r = "start" : c - n <= 1 && (r = "end"), {
493
- value: a(e, t),
544
+ let o = E.value.left, s = E.value.left + D.value;
545
+ return a.map((e, t) => {
546
+ let n = Y(F(e)), r = "middle";
547
+ return n - o <= 1 ? r = "start" : s - n <= 1 && (r = "end"), {
548
+ value: i(e, t),
494
549
  x: n,
495
550
  anchor: r
496
551
  };
497
552
  });
498
553
  });
499
- function Ke() {
554
+ function et() {
500
555
  return u.filename ? u.filename : typeof u.menu == "string" ? u.menu : "chart";
501
556
  }
502
- function qe() {
503
- return x.value;
557
+ function tt() {
558
+ return y.value;
504
559
  }
505
- function Je() {
560
+ function nt() {
506
561
  if (typeof u.csv == "function") return u.csv();
507
562
  if (typeof u.csv == "string") return u.csv;
508
- let e = M.value;
563
+ let e = k.value;
509
564
  if (e.length === 0) return "";
510
- let t = P.value, n = [(e.length === 1 ? ["index", "value"] : ["index", ...e.map((e, t) => `series_${t}`)]).join(",")];
565
+ let t = se.value, n = e.every((t) => t.x === e[0].x) ? e[0].x : void 0, r = n ? "x" : "index", i = [(e.length === 1 ? [r, "value"] : [r, ...e.map((e, t) => `series_${t}`)]).join(",")];
511
566
  for (let r = 0; r < t; r++) {
512
- let t = [r.toString()];
567
+ let t = [n ? String(n[r]) : r.toString()];
513
568
  for (let n of e) t.push(r < n.data.length ? String(n.data[r]) : "");
514
- n.push(t.join(","));
569
+ i.push(t.join(","));
515
570
  }
516
- return n.join("\n");
571
+ return i.join("\n");
517
572
  }
518
- let X = h(null), Ye = h(!1), Xe = h(null), Z = h(null), Q = h(null), Ze = t(() => !!u.tooltipData || !!u.tooltipTrigger), Qe = t(() => {
519
- if (X.value === null) return 0;
520
- let e = P.value, t = A.value / (e - 1 || 1);
521
- return k.value.left + X.value * t;
522
- }), $e = t(() => {
523
- let e = X.value;
573
+ let Z = p(null), rt = p(!1), it = p(null), Q = p(null), $ = p(null), at = t(() => !!u.tooltipData || !!u.tooltipTrigger), ot = t(() => {
574
+ let e = Z.value, t = k.value[0];
575
+ return e === null || !t ? null : M(t, e);
576
+ }), st = t(() => ot.value === null ? 0 : F(ot.value));
577
+ function ct(e, t) {
578
+ let n = e.data.length;
579
+ if (n === 0) return null;
580
+ let r = 0, i = Infinity;
581
+ for (let a = 0; a < n; a++) {
582
+ let n = M(e, a);
583
+ if (!isFinite(n)) continue;
584
+ let o = Math.abs(n - t);
585
+ o < i && (i = o, r = a);
586
+ }
587
+ return i === Infinity ? null : r;
588
+ }
589
+ let lt = t(() => {
590
+ let e = ot.value;
524
591
  if (e === null) return [];
525
- let { min: t, range: n } = F.value, r = j.value / n, i = k.value.top + j.value;
526
- return M.value.filter((t) => e < t.data.length && isFinite(t.data[e])).map((n) => ({
527
- x: Qe.value,
528
- y: i - (n.data[e] - t) * r,
529
- color: n.color ?? "currentColor"
530
- }));
531
- }), $ = t(() => {
532
- let e = X.value;
533
- if (e === null) return null;
534
- let t = u.xMin ?? 0;
535
- return {
592
+ let { min: t, range: n } = I.value, r = O.value / n, i = E.value.top + O.value, a = [];
593
+ for (let n of k.value) {
594
+ let o = ct(n, e);
595
+ if (o === null) continue;
596
+ let s = n.data[o];
597
+ isFinite(s) && a.push({
598
+ x: F(M(n, o)),
599
+ y: i - (s - t) * r,
600
+ color: n.color ?? "currentColor"
601
+ });
602
+ }
603
+ return a;
604
+ }), ut = t(() => {
605
+ let e = Z.value, t = ot.value;
606
+ if (e === null || t === null) return null;
607
+ let n = t + P.value, r;
608
+ return r = u.xTickFormat ? u.xTickFormat(n, e) : j.value ? X(n) : u.xLabels?.[e], {
536
609
  index: e,
537
- xLabel: u.xTickFormat ? u.xTickFormat(e + t, e) : u.xLabels?.[e],
538
- values: M.value.map((t, n) => ({
539
- value: t.data[e],
540
- color: t.color ?? "currentColor",
541
- seriesIndex: n
542
- })),
610
+ xLabel: r,
611
+ values: k.value.map((e, n) => {
612
+ let r = ct(e, t);
613
+ return {
614
+ value: r === null ? NaN : Number(e.data[r]),
615
+ color: e.color ?? "currentColor",
616
+ seriesIndex: n
617
+ };
618
+ }),
543
619
  data: u.tooltipData?.[e] ?? null
544
620
  };
545
621
  });
546
- function et(e) {
622
+ function dt(e) {
547
623
  return "touches" in e ? e.touches[0] ?? null : e;
548
624
  }
549
- function tt(e) {
550
- let t = b.value?.getBoundingClientRect();
625
+ function ft(e) {
626
+ let t = v.value?.getBoundingClientRect();
551
627
  if (!t) return null;
552
- let n = P.value;
553
- if (n <= 1) return null;
554
- let r = e - t.left, i = A.value / (n - 1 || 1), a = (r - k.value.left) / i;
555
- return Math.round(Math.max(0, Math.min(n - 1, a)));
628
+ let n = k.value[0];
629
+ if (!n || n.data.length === 0) return null;
630
+ let { min: r, max: i } = ce.value, a = i - r || 1;
631
+ return ct(n, r + (e - t.left - E.value.left) / D.value * a);
556
632
  }
557
- function nt(e) {
558
- let t = et(e);
633
+ function pt(e) {
634
+ let t = dt(e);
559
635
  if (!t) return;
560
- let n = tt(t.clientX);
561
- n !== null && (X.value = n, Z.value = {
636
+ let n = ft(t.clientX);
637
+ n !== null && (Z.value = n, Q.value = {
562
638
  clientX: t.clientX,
563
639
  clientY: t.clientY
564
- }, y("hover", { index: n }));
640
+ }, _("hover", { index: n }));
565
641
  }
566
- te([Z, X], () => {
567
- if (X.value === null || !Z.value) {
568
- Q.value = null;
642
+ re([Q, Z], () => {
643
+ if (Z.value === null || !Q.value) {
644
+ $.value = null;
569
645
  return;
570
646
  }
571
- let e = Xe.value, t = b.value;
647
+ let e = it.value, t = v.value;
572
648
  if (!e || !t) return;
573
- let n = t.getBoundingClientRect(), r = Ye.value ? Ve : 0, { left: i, top: a } = de(Z.value.clientX, Z.value.clientY - r, e.offsetWidth, e.offsetHeight, u.tooltipClamp, n);
574
- Q.value = {
649
+ let n = t.getBoundingClientRect(), r = rt.value ? Ue : 0, { left: i, top: a } = pe(Q.value.clientX, Q.value.clientY - r, e.offsetWidth, e.offsetHeight, u.tooltipClamp, n);
650
+ $.value = {
575
651
  left: i - n.left,
576
652
  top: a - n.top
577
653
  };
578
654
  }, { flush: "post" });
579
- function rt(e) {
580
- nt(e);
655
+ function mt(e) {
656
+ pt(e);
581
657
  }
582
- function it() {
583
- u.tooltipTrigger !== "click" && (X.value = null, y("hover", null));
658
+ function ht() {
659
+ u.tooltipTrigger !== "click" && (Z.value = null, _("hover", null));
584
660
  }
585
- function at(e) {
661
+ function gt(e) {
586
662
  if (u.tooltipTrigger !== "click") return;
587
- let t = et(e);
663
+ let t = dt(e);
588
664
  if (!t) return;
589
- let n = tt(t.clientX);
590
- n !== null && (X.value = X.value === n ? null : n, y("hover", X.value === null ? null : { index: n }));
665
+ let n = ft(t.clientX);
666
+ n !== null && (Z.value = Z.value === n ? null : n, _("hover", Z.value === null ? null : { index: n }));
591
667
  }
592
- function ot(e) {
593
- Ye.value = !0, nt(e);
668
+ function _t(e) {
669
+ rt.value = !0, pt(e);
594
670
  }
595
- function st(e) {
596
- nt(e);
671
+ function vt(e) {
672
+ pt(e);
597
673
  }
598
- function ct() {
599
- Ye.value = !1, X.value = null, y("hover", null);
674
+ function yt() {
675
+ rt.value = !1, Z.value = null, _("hover", null);
600
676
  }
601
- let lt = t(() => u.downloadLink ? typeof u.downloadLink == "string" ? u.downloadLink : "Download data (CSV)" : null), ut = t(() => u.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(Je())}` : null), dt = t(() => {
602
- let e = Ke(), t = [{
677
+ let bt = t(() => u.downloadLink ? typeof u.downloadLink == "string" ? u.downloadLink : "Download data (CSV)" : null), xt = t(() => u.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(nt())}` : null), St = t(() => {
678
+ let e = et(), t = [{
603
679
  label: "Save as SVG",
604
680
  action: () => {
605
- let t = qe();
606
- t && ce(t, e);
681
+ let t = tt();
682
+ t && ue(t, e);
607
683
  }
608
684
  }, {
609
685
  label: "Save as PNG",
610
686
  action: () => {
611
- let t = qe();
612
- t && le(t, e);
687
+ let t = tt();
688
+ t && de(t, e);
613
689
  }
614
690
  }];
615
691
  return u.downloadLink || t.push({
616
692
  label: "Download CSV",
617
- action: () => ue(Je(), e)
693
+ action: () => fe(nt(), e)
618
694
  }), t;
619
695
  });
620
- return (t, c) => (m(), i("div", {
696
+ return (t, c) => (f(), i("div", {
621
697
  ref_key: "containerRef",
622
- ref: b,
698
+ ref: v,
623
699
  class: "line-chart-wrapper"
624
700
  }, [
625
- s.menu ? (m(), n(se, {
701
+ s.menu ? (f(), n(le, {
626
702
  key: 0,
627
- items: dt.value
703
+ items: St.value
628
704
  }, null, 8, ["items"])) : r("", !0),
629
- (m(), i("svg", {
705
+ (f(), i("svg", {
630
706
  ref_key: "svgRef",
631
- ref: x,
632
- width: E.value,
633
- height: oe.value
707
+ ref: y,
708
+ width: ie.value,
709
+ height: qe.value
634
710
  }, [
635
- s.title ? (m(), i("text", {
711
+ s.title ? (f(), i("text", {
636
712
  key: 0,
637
- x: E.value / 2,
713
+ x: ie.value / 2,
638
714
  y: 18,
639
715
  "text-anchor": "middle",
640
716
  "font-size": "14",
641
717
  "font-weight": "600",
642
718
  fill: "currentColor"
643
- }, v(s.title), 9, fe)) : r("", !0),
644
- L.value.length > 0 ? (m(), i("g", pe, [(m(!0), i(e, null, g(L.value, (t, n) => (m(), i(e, { key: "ileg" + n }, [t.type === "series" ? (m(), i("line", {
719
+ }, g(s.title), 9, me)) : r("", !0),
720
+ Ke.value.length > 0 ? (f(), i("g", he, [(f(!0), i(e, null, m(Ke.value, (t, n) => (f(), i(e, { key: "ileg" + n }, [t.type === "series" ? (f(), i("line", {
645
721
  key: 0,
646
- x1: k.value.left + n * 120,
647
- y1: k.value.top - J / 2,
648
- x2: k.value.left + n * 120 + 12,
649
- y2: k.value.top - J / 2,
722
+ x1: E.value.left + n * 120,
723
+ y1: E.value.top - K / 2,
724
+ x2: E.value.left + n * 120 + 12,
725
+ y2: E.value.top - K / 2,
650
726
  stroke: t.color,
651
727
  "stroke-width": "2",
652
728
  "stroke-dasharray": t.dashed ? "4 2" : void 0
653
- }, null, 8, U)) : (m(), i("circle", {
729
+ }, null, 8, V)) : (f(), i("circle", {
654
730
  key: 1,
655
- cx: k.value.left + n * 120 + 4,
656
- cy: k.value.top - J / 2,
731
+ cx: E.value.left + n * 120 + 4,
732
+ cy: E.value.top - K / 2,
657
733
  r: "4",
658
734
  fill: t.color,
659
735
  "fill-opacity": t.fillOpacity,
660
736
  stroke: t.color,
661
737
  "stroke-width": "1.5"
662
- }, null, 8, W)), a("text", {
663
- x: k.value.left + n * 120 + 18,
664
- y: k.value.top - J / 2 + 4,
738
+ }, null, 8, H)), a("text", {
739
+ x: E.value.left + n * 120 + 18,
740
+ y: E.value.top - K / 2 + 4,
665
741
  "font-size": "11",
666
742
  fill: "currentColor"
667
- }, v(t.label), 9, me)], 64))), 128))])) : r("", !0),
743
+ }, g(t.label), 9, ge)], 64))), 128))])) : r("", !0),
668
744
  a("line", {
669
- x1: B(k.value.left),
670
- y1: B(k.value.top),
671
- x2: B(k.value.left),
672
- y2: B(k.value.top + j.value),
745
+ x1: Y(E.value.left),
746
+ y1: Y(E.value.top),
747
+ x2: Y(E.value.left),
748
+ y2: Y(E.value.top + O.value),
673
749
  stroke: "currentColor",
674
750
  "stroke-opacity": "0.3"
675
- }, null, 8, he),
751
+ }, null, 8, _e),
676
752
  a("line", {
677
- x1: B(k.value.left),
678
- y1: B(k.value.top + j.value),
679
- x2: B(k.value.left + A.value),
680
- y2: B(k.value.top + j.value),
753
+ x1: Y(E.value.left),
754
+ y1: Y(E.value.top + O.value),
755
+ x2: Y(E.value.left + D.value),
756
+ y2: Y(E.value.top + O.value),
681
757
  stroke: "currentColor",
682
758
  "stroke-opacity": "0.3"
683
- }, null, 8, ge),
684
- s.yGrid ? (m(!0), i(e, { key: 2 }, g(We.value, (e, t) => (m(), i("line", {
759
+ }, null, 8, ve),
760
+ s.yGrid ? (f(!0), i(e, { key: 2 }, m(Qe.value, (e, t) => (f(), i("line", {
685
761
  key: "yg" + t,
686
- x1: k.value.left,
762
+ x1: E.value.left,
687
763
  y1: e.y,
688
- x2: k.value.left + A.value,
764
+ x2: E.value.left + D.value,
689
765
  y2: e.y,
690
766
  stroke: "currentColor",
691
767
  "stroke-opacity": "0.1"
692
- }, null, 8, _e))), 128)) : r("", !0),
693
- s.xGrid ? (m(!0), i(e, { key: 3 }, g(Ge.value, (e, t) => (m(), i("line", {
768
+ }, null, 8, ye))), 128)) : r("", !0),
769
+ s.xGrid ? (f(!0), i(e, { key: 3 }, m($e.value, (e, t) => (f(), i("line", {
694
770
  key: "xg" + t,
695
771
  x1: e.x,
696
- y1: k.value.top,
772
+ y1: E.value.top,
697
773
  x2: e.x,
698
- y2: k.value.top + j.value,
774
+ y2: E.value.top + O.value,
699
775
  stroke: "currentColor",
700
776
  "stroke-opacity": "0.1"
701
- }, null, 8, ve))), 128)) : r("", !0),
702
- (m(!0), i(e, null, g(We.value, (e, t) => (m(), i("text", {
777
+ }, null, 8, be))), 128)) : r("", !0),
778
+ (f(!0), i(e, null, m(Qe.value, (e, t) => (f(), i("text", {
703
779
  key: "y" + t,
704
780
  "data-testid": "y-tick",
705
- x: k.value.left - 6,
781
+ x: E.value.left - 6,
706
782
  y: e.y,
707
783
  "text-anchor": "end",
708
784
  "dominant-baseline": "middle",
709
785
  "font-size": "10",
710
786
  fill: "currentColor",
711
787
  "fill-opacity": "0.6"
712
- }, v(e.value), 9, ye))), 128)),
713
- s.yLabel ? (m(), i("text", {
788
+ }, g(e.value), 9, xe))), 128)),
789
+ s.yLabel ? (f(), i("text", {
714
790
  key: 4,
715
791
  x: 0,
716
792
  y: 0,
717
- transform: `translate(14, ${k.value.top + j.value / 2}) rotate(-90)`,
793
+ transform: `translate(14, ${E.value.top + O.value / 2}) rotate(-90)`,
718
794
  "text-anchor": "middle",
719
795
  "font-size": "13",
720
796
  fill: "currentColor"
721
- }, v(s.yLabel), 9, be)) : r("", !0),
722
- (m(!0), i(e, null, g(Ge.value, (e, t) => (m(), i("text", {
797
+ }, g(s.yLabel), 9, Se)) : r("", !0),
798
+ (f(!0), i(e, null, m($e.value, (e, t) => (f(), i("text", {
723
799
  key: "x" + t,
724
800
  "data-testid": "x-tick",
725
801
  x: e.x,
726
- y: k.value.top + j.value + 16,
802
+ y: E.value.top + O.value + 16,
727
803
  "text-anchor": e.anchor,
728
804
  "font-size": "10",
729
805
  fill: "currentColor",
730
806
  "fill-opacity": "0.6"
731
- }, v(e.value), 9, G))), 128)),
732
- s.xLabel ? (m(), i("text", {
807
+ }, g(e.value), 9, U))), 128)),
808
+ s.xLabel ? (f(), i("text", {
733
809
  key: 5,
734
- x: k.value.left + A.value / 2,
735
- y: D.value - 4,
810
+ x: E.value.left + D.value / 2,
811
+ y: w.value - 4,
736
812
  "text-anchor": "middle",
737
813
  "font-size": "13",
738
814
  fill: "currentColor"
739
- }, v(s.xLabel), 9, K)) : r("", !0),
740
- (m(!0), i(e, null, g(N.value, (e, t) => (m(), i("path", {
815
+ }, g(s.xLabel), 9, W)) : r("", !0),
816
+ (f(!0), i(e, null, m(A.value, (e, t) => (f(), i("path", {
741
817
  key: "area" + t,
742
- d: ie(e.upper, e.lower),
818
+ d: z(e),
743
819
  fill: e.color ?? "currentColor",
744
820
  "fill-opacity": e.opacity ?? .2,
745
821
  stroke: "none"
746
- }, null, 8, xe))), 128)),
747
- (m(!0), i(e, null, g(M.value, (t, n) => (m(), i(e, { key: n }, [t.line === !1 ? r("", !0) : (m(), i("path", {
822
+ }, null, 8, Ce))), 128)),
823
+ (f(!0), i(e, null, m(k.value, (t, n) => (f(), i(e, { key: n }, [t.line === !1 ? r("", !0) : (f(), i("path", {
748
824
  key: 0,
749
- d: ne(t.data),
825
+ d: L(t),
750
826
  fill: "none",
751
827
  stroke: t.color ?? "currentColor",
752
828
  "stroke-width": t.strokeWidth ?? 1.5,
753
829
  "stroke-opacity": t.lineOpacity ?? t.opacity ?? s.lineOpacity,
754
830
  "stroke-dasharray": t.dashed ? "6 3" : void 0
755
- }, null, 8, Se)), t.dots ? (m(!0), i(e, { key: 1 }, g(re(t.data), (e, n) => (m(), i("circle", {
831
+ }, null, 8, we)), t.dots ? (f(!0), i(e, { key: 1 }, m(R(t), (e, n) => (f(), i("circle", {
756
832
  key: n,
757
833
  cx: e.x,
758
834
  cy: e.y,
@@ -760,68 +836,68 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
760
836
  fill: t.dotFill ?? t.color ?? "currentColor",
761
837
  "fill-opacity": t.dotOpacity ?? t.opacity ?? s.lineOpacity,
762
838
  stroke: t.dotStroke ?? "none"
763
- }, null, 8, Ce))), 128)) : r("", !0)], 64))), 128)),
764
- (m(!0), i(e, null, g(s.areaSections ?? [], (t, n) => (m(), i(e, { key: "areasec" + n }, [
839
+ }, null, 8, Te))), 128)) : r("", !0)], 64))), 128)),
840
+ (f(!0), i(e, null, m(s.areaSections ?? [], (t, n) => (f(), i(e, { key: "areasec" + n }, [
765
841
  a("path", {
766
- d: ae(t),
767
- fill: t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor"),
842
+ d: We(t),
843
+ fill: t.color ?? (t.seriesIndex == null ? "#999" : k.value[t.seriesIndex]?.color ?? "currentColor"),
768
844
  "fill-opacity": t.opacity ?? .15,
769
845
  stroke: "none"
770
- }, null, 8, we),
771
- t.seriesIndex == null ? r("", !0) : (m(), i("path", {
846
+ }, null, 8, Ee),
847
+ t.seriesIndex == null ? r("", !0) : (f(), i("path", {
772
848
  key: 0,
773
- d: ae(t, !1),
849
+ d: We(t, !1),
774
850
  fill: "none",
775
- stroke: t.color ?? M.value[t.seriesIndex]?.color ?? "currentColor",
851
+ stroke: t.color ?? k.value[t.seriesIndex]?.color ?? "currentColor",
776
852
  "stroke-width": t.strokeWidth ?? 2,
777
853
  "stroke-dasharray": t.dashed ? "6 3" : void 0
778
- }, null, 8, Te)),
779
- t.seriesIndex == null ? (m(), i(e, { key: 1 }, [a("line", {
780
- x1: B(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
781
- y1: k.value.top,
782
- x2: B(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
783
- y2: k.value.top + j.value,
854
+ }, null, 8, De)),
855
+ t.seriesIndex == null ? (f(), i(e, { key: 1 }, [a("line", {
856
+ x1: Y(J(t, "start")),
857
+ y1: E.value.top,
858
+ x2: Y(J(t, "start")),
859
+ y2: E.value.top + O.value,
784
860
  stroke: t.color ?? "#999",
785
861
  "stroke-width": t.strokeWidth ?? 2,
786
862
  "stroke-dasharray": t.dashed ? "6 3" : void 0
787
- }, null, 8, Ee), a("line", {
788
- x1: B(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
789
- y1: k.value.top,
790
- x2: B(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
791
- y2: k.value.top + j.value,
863
+ }, null, 8, Oe), a("line", {
864
+ x1: Y(J(t, "end")),
865
+ y1: E.value.top,
866
+ x2: Y(J(t, "end")),
867
+ y2: E.value.top + O.value,
792
868
  stroke: t.color ?? "#999",
793
869
  "stroke-width": t.strokeWidth ?? 2,
794
870
  "stroke-dasharray": t.dashed ? "6 3" : void 0
795
- }, null, 8, q)], 64)) : r("", !0),
871
+ }, null, 8, G)], 64)) : r("", !0),
796
872
  a("line", {
797
- x1: B(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
798
- y1: k.value.top + j.value - 4,
799
- x2: B(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
800
- y2: k.value.top + j.value + 4,
873
+ x1: Y(J(t, "start")),
874
+ y1: E.value.top + O.value - 4,
875
+ x2: Y(J(t, "start")),
876
+ y2: E.value.top + O.value + 4,
801
877
  stroke: "currentColor",
802
878
  "stroke-opacity": "0.4"
803
- }, null, 8, De),
879
+ }, null, 8, ke),
804
880
  a("line", {
805
- x1: B(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
806
- y1: k.value.top + j.value - 4,
807
- x2: B(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
808
- y2: k.value.top + j.value + 4,
881
+ x1: Y(J(t, "end")),
882
+ y1: E.value.top + O.value - 4,
883
+ x2: Y(J(t, "end")),
884
+ y2: E.value.top + O.value + 4,
809
885
  stroke: "currentColor",
810
886
  "stroke-opacity": "0.4"
811
- }, null, 8, Oe)
887
+ }, null, 8, Ae)
812
888
  ], 64))), 128)),
813
- Ze.value && X.value !== null ? (m(), i("line", {
889
+ at.value && Z.value !== null ? (f(), i("line", {
814
890
  key: 6,
815
- x1: B(Qe.value),
816
- y1: k.value.top,
817
- x2: B(Qe.value),
818
- y2: k.value.top + j.value,
891
+ x1: Y(st.value),
892
+ y1: E.value.top,
893
+ x2: Y(st.value),
894
+ y2: E.value.top + O.value,
819
895
  stroke: "currentColor",
820
896
  "stroke-opacity": "0.3",
821
897
  "stroke-dasharray": "4 2",
822
898
  "pointer-events": "none"
823
- }, null, 8, ke)) : r("", !0),
824
- (m(!0), i(e, null, g($e.value, (e, t) => (m(), i("circle", {
899
+ }, null, 8, je)) : r("", !0),
900
+ (f(!0), i(e, null, m(lt.value, (e, t) => (f(), i("circle", {
825
901
  key: "hd" + t,
826
902
  cx: e.x,
827
903
  cy: e.y,
@@ -830,82 +906,82 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
830
906
  stroke: "var(--color-bg-0, #fff)",
831
907
  "stroke-width": "2",
832
908
  "pointer-events": "none"
833
- }, null, 8, Ae))), 128)),
834
- Ze.value ? (m(), i("rect", {
909
+ }, null, 8, Me))), 128)),
910
+ at.value ? (f(), i("rect", {
835
911
  key: 7,
836
- x: k.value.left,
837
- y: k.value.top,
838
- width: A.value,
839
- height: j.value,
912
+ x: E.value.left,
913
+ y: E.value.top,
914
+ width: D.value,
915
+ height: O.value,
840
916
  fill: "transparent",
841
917
  style: {
842
918
  cursor: "crosshair",
843
919
  "touch-action": "none"
844
920
  },
845
- onMousemove: rt,
846
- onMouseleave: it,
847
- onClick: at,
848
- onTouchstart: C(ot, ["prevent"]),
849
- onTouchmove: C(st, ["prevent"]),
850
- onTouchend: ct
851
- }, null, 40, je)) : r("", !0),
852
- (m(!0), i(e, null, g(I.value.labels, (e, t) => (m(), i("g", { key: "seclab" + t }, [
921
+ onMousemove: mt,
922
+ onMouseleave: ht,
923
+ onClick: gt,
924
+ onTouchstart: x(_t, ["prevent"]),
925
+ onTouchmove: x(vt, ["prevent"]),
926
+ onTouchend: yt
927
+ }, null, 40, Ne)) : r("", !0),
928
+ (f(!0), i(e, null, m(Ge.value.labels, (e, t) => (f(), i("g", { key: "seclab" + t }, [
853
929
  a("circle", {
854
930
  cx: e.cx - e.textWidth / 2 - 2,
855
- cy: R.value + e.row * Y + 4,
931
+ cy: Je.value + e.row * q + 4,
856
932
  r: "4",
857
933
  fill: e.color,
858
934
  "fill-opacity": e.fillOpacity,
859
935
  stroke: e.color,
860
936
  "stroke-width": "1.5"
861
- }, null, 8, Me),
862
- e.labelText ? (m(), i("text", {
937
+ }, null, 8, Pe),
938
+ e.labelText ? (f(), i("text", {
863
939
  key: 0,
864
940
  x: e.cx - e.textWidth / 2 + 8,
865
- y: R.value + e.row * Y + 8,
941
+ y: Je.value + e.row * q + 8,
866
942
  "font-size": "11",
867
943
  "font-weight": "600",
868
944
  fill: e.color
869
- }, v(e.labelText), 9, Ne)) : r("", !0),
870
- e.descText ? (m(), i("text", {
945
+ }, g(e.labelText), 9, Fe)) : r("", !0),
946
+ e.descText ? (f(), i("text", {
871
947
  key: 1,
872
948
  x: e.cx - e.textWidth / 2 + 8,
873
- y: R.value + e.row * Y + 22,
949
+ y: Je.value + e.row * q + 22,
874
950
  "font-size": "11",
875
951
  fill: "currentColor",
876
952
  "fill-opacity": "0.6"
877
- }, v(e.descText), 9, Pe)) : r("", !0)
953
+ }, g(e.descText), 9, Ie)) : r("", !0)
878
954
  ]))), 128))
879
- ], 8, H)),
880
- Ze.value && X.value !== null && $.value ? (m(), i("div", {
955
+ ], 8, B)),
956
+ at.value && Z.value !== null && ut.value ? (f(), i("div", {
881
957
  key: 1,
882
958
  ref_key: "tooltipRef",
883
- ref: Xe,
959
+ ref: it,
884
960
  class: "chart-tooltip-content",
885
- style: f({
961
+ style: d({
886
962
  position: "absolute",
887
963
  top: "0",
888
964
  left: "0",
889
965
  willChange: "transform",
890
- transform: Q.value ? `translate3d(${Q.value.left}px, ${Q.value.top}px, 0) translateY(-50%)` : "translateY(-50%)",
891
- visibility: Q.value ? "visible" : "hidden"
966
+ transform: $.value ? `translate3d(${$.value.left}px, ${$.value.top}px, 0) translateY(-50%)` : "translateY(-50%)",
967
+ visibility: $.value ? "visible" : "hidden"
892
968
  })
893
- }, [_(t.$slots, "tooltip", d(l($.value)), () => [a("div", Fe, [$.value.xLabel ? (m(), i("div", Ie, v($.value.xLabel), 1)) : r("", !0), (m(!0), i(e, null, g($.value.values, (e) => (m(), i("div", {
969
+ }, [h(t.$slots, "tooltip", ee(l(ut.value)), () => [a("div", Le, [ut.value.xLabel ? (f(), i("div", Re, g(ut.value.xLabel), 1)) : r("", !0), (f(!0), i(e, null, m(ut.value.values, (e) => (f(), i("div", {
894
970
  key: e.seriesIndex,
895
971
  class: "line-chart-tooltip-row"
896
972
  }, [a("span", {
897
973
  class: "line-chart-tooltip-swatch",
898
- style: f({ background: e.color })
899
- }, null, 4), o(" " + v(isFinite(e.value) ? He(e.value) : "—"), 1)]))), 128))])], !0)], 4)) : r("", !0),
900
- lt.value ? (m(), i("a", {
974
+ style: d({ background: e.color })
975
+ }, null, 4), o(" " + g(isFinite(e.value) ? X(e.value) : "—"), 1)]))), 128))])], !0)], 4)) : r("", !0),
976
+ bt.value ? (f(), i("a", {
901
977
  key: 2,
902
978
  class: "line-chart-download-link",
903
- href: ut.value,
904
- download: `${Ke()}.csv`
905
- }, v(lt.value), 9, Le)) : r("", !0)
979
+ href: xt.value,
980
+ download: `${et()}.csv`
981
+ }, g(bt.value), 9, ze)) : r("", !0)
906
982
  ], 512));
907
983
  }
908
- }), [["__scopeId", "data-v-459cca76"]]), Ue = {
984
+ }), [["__scopeId", "data-v-dc8afa83"]]), We = {
909
985
  "01013": "010259",
910
986
  "01015": "010177",
911
987
  "01029": "010177",
@@ -4066,7 +4142,7 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
4066
4142
  51019: "510014",
4067
4143
  "02158": "020820",
4068
4144
  46102: "460957"
4069
- }, We = {
4145
+ }, Ge = {
4070
4146
  "010259": "Butler, AL",
4071
4147
  "010177": "Calhoun (Anniston), AL - Cleburne, AL",
4072
4148
  "010172": "Chambers, AL - Randolph, AL",
@@ -5016,25 +5092,25 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5016
5092
  560775: "Teton, WY - Lincoln, WY",
5017
5093
  560792: "Uinta, WY",
5018
5094
  560804: "Weston, WY"
5019
- }, Ge = ["width", "height"], Ke = [
5095
+ }, Ke = ["width", "height"], qe = [
5020
5096
  "data-feat-id",
5021
5097
  "d",
5022
5098
  "fill",
5023
5099
  "stroke",
5024
5100
  "stroke-width"
5025
- ], qe = { key: 0 }, Je = ["d", "stroke"], X = ["transform"], Ye = {
5101
+ ], Je = { key: 0 }, Ye = ["d", "stroke"], Y = ["transform"], Xe = {
5026
5102
  key: 0,
5027
5103
  y: 5,
5028
5104
  "font-size": "13",
5029
5105
  "font-weight": "600",
5030
5106
  fill: "currentColor"
5031
- }, Xe = ["x", "fill"], Z = ["x"], Q = {
5107
+ }, X = ["x", "fill"], Ze = ["x"], Qe = {
5032
5108
  key: 0,
5033
5109
  y: 5,
5034
5110
  "font-size": "13",
5035
5111
  "font-weight": "600",
5036
5112
  fill: "currentColor"
5037
- }, Ze = ["offset", "stop-color"], Qe = ["x", "fill"], $e = ["x"], $ = ["x"], et = /* @__PURE__ */ R(/* @__PURE__ */ c({
5113
+ }, $e = ["offset", "stop-color"], et = ["x", "fill"], tt = ["x"], nt = ["x"], Z = /* @__PURE__ */ I(/* @__PURE__ */ c({
5038
5114
  __name: "ChoroplethMap",
5039
5115
  props: {
5040
5116
  topology: {},
@@ -5070,80 +5146,80 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5070
5146
  },
5071
5147
  emits: ["stateClick", "stateHover"],
5072
5148
  setup(o, { emit: s }) {
5073
- let c = o, l = s, d = `choropleth-gradient-${x()}`, f = h(null), _ = h(null), b = h(null), S = h(0), C = null, w = null, T = !1, E = typeof window < "u" && "ontouchstart" in window, D = null, O = null;
5074
- function k() {
5075
- if (E) return;
5076
- let e = b.value;
5077
- e && (e.addEventListener("click", q), e.addEventListener("mouseover", q), e.addEventListener("mousemove", De), e.addEventListener("mouseout", Oe));
5149
+ let c = o, l = s, ee = `choropleth-gradient-${y()}`, d = p(null), h = p(null), v = p(null), b = p(0), x = null, S = null, C = !1, ie = typeof window < "u" && "ontouchstart" in window, w = null, T = null;
5150
+ function E() {
5151
+ if (ie) return;
5152
+ let e = v.value;
5153
+ e && (e.addEventListener("click", G), e.addEventListener("mouseover", G), e.addEventListener("mousemove", ke), e.addEventListener("mouseout", Ae));
5078
5154
  }
5079
- function A() {
5080
- let e = b.value;
5081
- e && (e.removeEventListener("click", q), e.removeEventListener("mouseover", q), e.removeEventListener("mousemove", De), e.removeEventListener("mouseout", Oe));
5155
+ function D() {
5156
+ let e = v.value;
5157
+ e && (e.removeEventListener("click", G), e.removeEventListener("mouseover", G), e.removeEventListener("mousemove", ke), e.removeEventListener("mouseout", Ae));
5082
5158
  }
5083
- p(() => {
5084
- f.value && (S.value = f.value.clientWidth, D = new ResizeObserver((e) => {
5159
+ te(() => {
5160
+ d.value && (b.value = d.value.clientWidth, w = new ResizeObserver((e) => {
5085
5161
  let t = e[0];
5086
- t && (S.value = t.contentRect.width);
5087
- }), D.observe(f.value)), j(), k();
5088
- }), ee(() => {
5089
- D?.disconnect(), M(), A(), we();
5162
+ t && (b.value = t.contentRect.width);
5163
+ }), w.observe(d.value)), O(), E();
5164
+ }), ne(() => {
5165
+ w?.disconnect(), ae(), D(), Ee();
5090
5166
  });
5091
- function j() {
5092
- if (!_.value || !b.value || !c.zoom && !c.pan) return;
5093
- let e = ne(_.value);
5094
- O = F().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
5095
- T = !0, Ee();
5167
+ function O() {
5168
+ if (!h.value || !v.value || !c.zoom && !c.pan) return;
5169
+ let e = se(h.value);
5170
+ T = A().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
5171
+ C = !0, Oe();
5096
5172
  }).on("zoom", (e) => {
5097
- b.value && b.value.setAttribute("transform", e.transform);
5173
+ v.value && v.value.setAttribute("transform", e.transform);
5098
5174
  }).on("end", () => {
5099
- T = !1;
5100
- }), c.pan || O.filter((e) => e.type === "wheel" || e.type === "dblclick"), e.call(O);
5175
+ C = !1;
5176
+ }), c.pan || T.filter((e) => e.type === "wheel" || e.type === "dblclick"), e.call(T);
5101
5177
  }
5102
- function M() {
5103
- _.value && O && (ne(_.value).on(".zoom", null), O = null);
5178
+ function ae() {
5179
+ h.value && T && (se(h.value).on(".zoom", null), T = null);
5104
5180
  }
5105
- te(() => [c.zoom, c.pan], () => {
5106
- M(), A(), j(), k();
5181
+ re(() => [c.zoom, c.pan], () => {
5182
+ ae(), D(), O(), E();
5107
5183
  });
5108
- let I = t(() => c.width ?? (S.value || 600)), L = t(() => c.width && c.height ? c.height / c.width : .625), oe = t(() => I.value * L.value), R = t(() => {
5109
- let e = y(c.topology), t = e.objects.counties.geometries, n = /* @__PURE__ */ new Map();
5184
+ let P = t(() => c.width ?? (b.value || 600)), ce = t(() => c.width && c.height ? c.height / c.width : .625), F = t(() => P.value * ce.value), I = t(() => {
5185
+ let e = _(c.topology), t = e.objects.counties.geometries, n = /* @__PURE__ */ new Map();
5110
5186
  for (let e of t) {
5111
- let t = Ue[String(e.id).padStart(5, "0")];
5187
+ let t = We[String(e.id).padStart(5, "0")];
5112
5188
  t && (n.has(t) || n.set(t, []), n.get(t).push(e));
5113
5189
  }
5114
5190
  let r = [];
5115
5191
  for (let [t, i] of n) r.push({
5116
5192
  type: "Feature",
5117
5193
  id: t,
5118
- properties: { name: We[t] ?? t },
5119
- geometry: ie(e, i)
5194
+ properties: { name: Ge[t] ?? t },
5195
+ geometry: M(e, i)
5120
5196
  });
5121
5197
  return {
5122
5198
  type: "FeatureCollection",
5123
5199
  features: r
5124
5200
  };
5125
- }), z = t(() => {
5126
- if (c.geoType === "hsas") return R.value;
5201
+ }), L = t(() => {
5202
+ if (c.geoType === "hsas") return I.value;
5127
5203
  if (c.geoType === "counties") {
5128
- let e = y(c.topology);
5129
- return re(e, e.objects.counties);
5204
+ let e = _(c.topology);
5205
+ return j(e, e.objects.counties);
5130
5206
  }
5131
- let e = y(c.topology);
5132
- return re(e, e.objects.states);
5133
- }), ue = t(() => {
5207
+ let e = _(c.topology);
5208
+ return j(e, e.objects.states);
5209
+ }), fe = t(() => {
5134
5210
  if (c.geoType !== "counties" && c.geoType !== "hsas") return null;
5135
- let e = y(c.topology);
5136
- return ae(e, e.objects.states, (e, t) => e !== t);
5137
- }), B = t(() => N().fitExtent([[0, Pe.value], [I.value, oe.value + Pe.value]], z.value)), V = t(() => P(B.value)), H = t(() => c.geoType === "counties" || c.geoType === "hsas" ? c.strokeWidth * .5 : c.strokeWidth), fe = t(() => {
5211
+ let e = _(c.topology);
5212
+ return N(e, e.objects.states, (e, t) => e !== t);
5213
+ }), R = t(() => oe().fitExtent([[0, Ie.value], [P.value, F.value + Ie.value]], L.value)), z = t(() => k(R.value)), B = t(() => c.geoType === "counties" || c.geoType === "hsas" ? c.strokeWidth * .5 : c.strokeWidth), me = t(() => {
5138
5214
  let e = /* @__PURE__ */ new Map();
5139
5215
  if (!c.data) return e;
5140
5216
  for (let t of c.data) {
5141
5217
  e.set(t.id, t.value);
5142
- let n = z.value.features.find((e) => e.properties?.name === t.id);
5218
+ let n = L.value.features.find((e) => e.properties?.name === t.id);
5143
5219
  n?.id != null && e.set(String(n.id), t.value);
5144
5220
  }
5145
5221
  return e;
5146
- }), pe = t(() => {
5222
+ }), he = t(() => {
5147
5223
  if (!c.data || c.data.length === 0) return {
5148
5224
  min: 0,
5149
5225
  max: 1
@@ -5160,8 +5236,8 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5160
5236
  min: 0,
5161
5237
  max: 1
5162
5238
  };
5163
- }), U = t(() => Array.isArray(c.colorScale) && c.colorScale.length > 0 && "value" in c.colorScale[0]), W = t(() => Array.isArray(c.colorScale) && !U.value), me = t(() => W.value ? "" : c.colorScale?.min ?? "#e5f0fa"), he = t(() => W.value ? "" : c.colorScale?.max ?? "#08519c");
5164
- function ge(e) {
5239
+ }), V = t(() => Array.isArray(c.colorScale) && c.colorScale.length > 0 && "value" in c.colorScale[0]), H = t(() => Array.isArray(c.colorScale) && !V.value), ge = t(() => H.value ? "" : c.colorScale?.min ?? "#e5f0fa"), _e = t(() => H.value ? "" : c.colorScale?.max ?? "#08519c");
5240
+ function ve(e) {
5165
5241
  let t = e.replace("#", "");
5166
5242
  return [
5167
5243
  parseInt(t.slice(0, 2), 16),
@@ -5169,103 +5245,103 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5169
5245
  parseInt(t.slice(4, 6), 16)
5170
5246
  ];
5171
5247
  }
5172
- function _e(e) {
5173
- let [t, n, r] = ge(me.value), [i, a, o] = ge(he.value);
5248
+ function ye(e) {
5249
+ let [t, n, r] = ve(ge.value), [i, a, o] = ve(_e.value);
5174
5250
  return `rgb(${Math.round(t + (i - t) * e)},${Math.round(n + (a - n) * e)},${Math.round(r + (o - r) * e)})`;
5175
5251
  }
5176
- function ve(e) {
5252
+ function be(e) {
5177
5253
  let t = c.colorScale.slice().sort((e, t) => t.min - e.min);
5178
5254
  for (let n of t) if (e >= n.min) return n.color;
5179
5255
  return c.noDataColor;
5180
5256
  }
5181
- function ye(e) {
5257
+ function xe(e) {
5182
5258
  let t = c.colorScale.find((t) => t.value === String(e));
5183
5259
  return t ? t.color : c.noDataColor;
5184
5260
  }
5185
- function be(e) {
5186
- let t = fe.value.get(String(e));
5261
+ function Se(e) {
5262
+ let t = me.value.get(String(e));
5187
5263
  if (t == null) return c.noDataColor;
5188
- if (U.value) return ye(t);
5189
- if (W.value) return ve(t);
5190
- let { min: n, max: r } = pe.value;
5191
- return _e((t - n) / (r - n));
5264
+ if (V.value) return xe(t);
5265
+ if (H.value) return be(t);
5266
+ let { min: n, max: r } = he.value;
5267
+ return ye((t - n) / (r - n));
5192
5268
  }
5193
- function G(e) {
5269
+ function U(e) {
5194
5270
  return e.properties?.name ?? String(e.id);
5195
5271
  }
5196
- function K(e) {
5197
- return fe.value.get(String(e.id));
5272
+ function W(e) {
5273
+ return me.value.get(String(e.id));
5198
5274
  }
5199
- let xe = t(() => {
5275
+ let Ce = t(() => {
5200
5276
  let e = /* @__PURE__ */ new Map();
5201
- for (let t of z.value.features) e.set(String(t.id), t);
5277
+ for (let t of L.value.features) e.set(String(t.id), t);
5202
5278
  return e;
5203
5279
  });
5204
- function Se(e) {
5280
+ function we(e) {
5205
5281
  let t = e;
5206
5282
  for (; t && !t.dataset?.featId;) t = t.parentElement;
5207
5283
  if (!t) return null;
5208
- let n = xe.value.get(t.dataset.featId);
5284
+ let n = Ce.value.get(t.dataset.featId);
5209
5285
  return n ? {
5210
5286
  pathEl: t,
5211
5287
  feat: n
5212
5288
  } : null;
5213
5289
  }
5214
- function Ce(e, t, n) {
5215
- w || (w = document.createElement("div"), w.className = "chart-tooltip-content", w.style.position = "fixed", w.style.transform = "translateY(-50%)", document.body.appendChild(w));
5216
- let r = G(e), i = K(e), a = {
5290
+ function Te(e, t, n) {
5291
+ S || (S = document.createElement("div"), S.className = "chart-tooltip-content", S.style.position = "fixed", S.style.transform = "translateY(-50%)", document.body.appendChild(S));
5292
+ let r = U(e), i = W(e), a = {
5217
5293
  id: String(e.id),
5218
5294
  name: r,
5219
5295
  value: i
5220
5296
  };
5221
- c.tooltipFormat ? w.innerHTML = c.tooltipFormat(a) : w.textContent = i == null ? r : `${r}: ${i}`;
5222
- let o = f.value?.getBoundingClientRect(), { left: s, top: l } = de(t, n, w.offsetWidth, w.offsetHeight, c.tooltipClamp, o);
5223
- w.style.left = `${s}px`, w.style.top = `${l}px`;
5297
+ c.tooltipFormat ? S.innerHTML = c.tooltipFormat(a) : S.textContent = i == null ? r : `${r}: ${i}`;
5298
+ let o = d.value?.getBoundingClientRect(), { left: s, top: l } = pe(t, n, S.offsetWidth, S.offsetHeight, c.tooltipClamp, o);
5299
+ S.style.left = `${s}px`, S.style.top = `${l}px`;
5224
5300
  }
5225
- function we() {
5226
- w &&= (w.remove(), null);
5301
+ function Ee() {
5302
+ S &&= (S.remove(), null);
5227
5303
  }
5228
- function Te(e, t) {
5229
- C && C !== e && (C.setAttribute("stroke-width", String(H.value)), C.setAttribute("stroke", c.strokeColor)), C = e, e.parentNode?.appendChild(e), e.setAttribute("stroke-width", String(H.value + 1)), e.setAttribute("stroke", "#555");
5304
+ function De(e, t) {
5305
+ x && x !== e && (x.setAttribute("stroke-width", String(B.value)), x.setAttribute("stroke", c.strokeColor)), x = e, e.parentNode?.appendChild(e), e.setAttribute("stroke-width", String(B.value + 1)), e.setAttribute("stroke", "#555");
5230
5306
  }
5231
- function Ee() {
5232
- C && (C.setAttribute("stroke-width", String(H.value)), C.setAttribute("stroke", c.strokeColor), C = null, l("stateHover", null)), we();
5307
+ function Oe() {
5308
+ x && (x.setAttribute("stroke-width", String(B.value)), x.setAttribute("stroke", c.strokeColor), x = null, l("stateHover", null)), Ee();
5233
5309
  }
5234
- function q(e) {
5235
- if (T) return;
5236
- let t = e, n = Se(t.target);
5310
+ function G(e) {
5311
+ if (C) return;
5312
+ let t = e, n = we(t.target);
5237
5313
  n && (e.type === "click" ? l("stateClick", {
5238
5314
  id: String(n.feat.id),
5239
- name: G(n.feat),
5240
- value: K(n.feat)
5241
- }) : e.type === "mouseover" && (Te(n.pathEl, n.feat), c.tooltipTrigger && Ce(n.feat, t.clientX, t.clientY), l("stateHover", {
5315
+ name: U(n.feat),
5316
+ value: W(n.feat)
5317
+ }) : e.type === "mouseover" && (De(n.pathEl, n.feat), c.tooltipTrigger && Te(n.feat, t.clientX, t.clientY), l("stateHover", {
5242
5318
  id: String(n.feat.id),
5243
- name: G(n.feat),
5244
- value: K(n.feat)
5319
+ name: U(n.feat),
5320
+ value: W(n.feat)
5245
5321
  })));
5246
5322
  }
5247
- function De(e) {
5248
- T || !w || (w.style.left = `${e.clientX + 16}px`, w.style.top = `${e.clientY}px`);
5323
+ function ke(e) {
5324
+ C || !S || (S.style.left = `${e.clientX + 16}px`, S.style.top = `${e.clientY}px`);
5249
5325
  }
5250
- function Oe(e) {
5326
+ function Ae(e) {
5251
5327
  let t = e.relatedTarget;
5252
- t && b.value?.contains(t) || Ee();
5328
+ t && v.value?.contains(t) || Oe();
5253
5329
  }
5254
- function ke() {
5330
+ function je() {
5255
5331
  return typeof c.menu == "string" ? c.menu : "choropleth";
5256
5332
  }
5257
- let Ae = t(() => c.legend && (U.value || W.value || c.data)), je = t(() => c.colorScale.slice().sort((e, t) => e.min - t.min)), Me = t(() => c.title ? 24 : 0), Ne = t(() => Ae.value ? 28 : 0), Pe = t(() => Me.value + Ne.value), Fe = t(() => oe.value + Pe.value), Ie = t(() => Me.value + 18), Le = t(() => {
5333
+ let Me = t(() => c.legend && (V.value || H.value || c.data)), Ne = t(() => c.colorScale.slice().sort((e, t) => e.min - t.min)), Pe = t(() => c.title ? 24 : 0), Fe = t(() => Me.value ? 28 : 0), Ie = t(() => Pe.value + Fe.value), Le = t(() => F.value + Ie.value), Re = t(() => Pe.value + 18), ze = t(() => {
5258
5334
  let e = [];
5259
5335
  for (let t = 0; t <= 10; t++) {
5260
5336
  let n = t / 10;
5261
5337
  e.push({
5262
5338
  offset: `${(n * 100).toFixed(0)}%`,
5263
- color: _e(n)
5339
+ color: ye(n)
5264
5340
  });
5265
5341
  }
5266
5342
  return e;
5267
- }), J = t(() => {
5268
- let { min: e, max: t } = pe.value, n = t - e, r = [];
5343
+ }), K = t(() => {
5344
+ let { min: e, max: t } = he.value, n = t - e, r = [];
5269
5345
  for (let t = 1; t <= 3; t++) {
5270
5346
  let i = t / 4, a = e + n * i, o = Number.isInteger(a) ? String(a) : a.toFixed(1).replace(/\.0$/, "");
5271
5347
  r.push({
@@ -5274,118 +5350,118 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5274
5350
  });
5275
5351
  }
5276
5352
  return r;
5277
- }), Y = t(() => {
5353
+ }), q = t(() => {
5278
5354
  let e = [];
5279
- if (U.value) for (let t of c.colorScale) e.push({
5355
+ if (V.value) for (let t of c.colorScale) e.push({
5280
5356
  key: t.value,
5281
5357
  color: t.color,
5282
5358
  label: t.value
5283
5359
  });
5284
- else if (W.value) for (let t of je.value) e.push({
5360
+ else if (H.value) for (let t of Ne.value) e.push({
5285
5361
  key: String(t.min),
5286
5362
  color: t.color,
5287
5363
  label: t.label ?? String(t.min)
5288
5364
  });
5289
5365
  return e;
5290
- }), Re = t(() => {
5366
+ }), Be = t(() => {
5291
5367
  let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
5292
- for (let t of Y.value) e += 16 + t.label.length * 7 + 12;
5293
- return e - (Y.value.length > 0 ? 12 : 0);
5294
- }), ze = t(() => {
5368
+ for (let t of q.value) e += 16 + t.label.length * 7 + 12;
5369
+ return e - (q.value.length > 0 ? 12 : 0);
5370
+ }), Ve = t(() => {
5295
5371
  let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
5296
- return Y.value.map((t) => {
5372
+ return q.value.map((t) => {
5297
5373
  let n = e;
5298
5374
  return e += 16 + t.label.length * 7 + 12, n;
5299
5375
  });
5300
- }), Be = t(() => {
5301
- if (U.value || W.value) return (I.value - Re.value) / 2;
5376
+ }), He = t(() => {
5377
+ if (V.value || H.value) return (P.value - Be.value) / 2;
5302
5378
  let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
5303
- return (I.value - e - 160) / 2;
5304
- }), Ve = t(() => {
5305
- let e = ke();
5379
+ return (P.value - e - 160) / 2;
5380
+ }), Ue = t(() => {
5381
+ let e = je();
5306
5382
  return [{
5307
5383
  label: "Save as SVG",
5308
5384
  action: () => {
5309
- _.value && ce(_.value, e);
5385
+ h.value && ue(h.value, e);
5310
5386
  }
5311
5387
  }, {
5312
5388
  label: "Save as PNG",
5313
5389
  action: () => {
5314
- _.value && le(_.value, e);
5390
+ h.value && de(h.value, e);
5315
5391
  }
5316
5392
  }];
5317
5393
  });
5318
- return (t, s) => (m(), i("div", {
5394
+ return (t, s) => (f(), i("div", {
5319
5395
  ref_key: "containerRef",
5320
- ref: f,
5396
+ ref: d,
5321
5397
  class: u(["choropleth-wrapper", { pannable: o.pan }])
5322
- }, [o.menu ? (m(), n(se, {
5398
+ }, [o.menu ? (f(), n(le, {
5323
5399
  key: 0,
5324
- items: Ve.value
5325
- }, null, 8, ["items"])) : r("", !0), (m(), i("svg", {
5400
+ items: Ue.value
5401
+ }, null, 8, ["items"])) : r("", !0), (f(), i("svg", {
5326
5402
  ref_key: "svgRef",
5327
- ref: _,
5328
- width: I.value,
5329
- height: Fe.value
5403
+ ref: h,
5404
+ width: P.value,
5405
+ height: Le.value
5330
5406
  }, [
5331
5407
  a("g", {
5332
5408
  ref_key: "mapGroupRef",
5333
- ref: b
5334
- }, [(m(!0), i(e, null, g(z.value.features, (e) => (m(), i("path", {
5409
+ ref: v
5410
+ }, [(f(!0), i(e, null, m(L.value.features, (e) => (f(), i("path", {
5335
5411
  key: String(e.id),
5336
5412
  "data-feat-id": String(e.id),
5337
- d: V.value(e) ?? void 0,
5338
- fill: be(e.id),
5413
+ d: z.value(e) ?? void 0,
5414
+ fill: Se(e.id),
5339
5415
  stroke: o.strokeColor,
5340
- "stroke-width": H.value,
5416
+ "stroke-width": B.value,
5341
5417
  class: "state-path"
5342
- }, [o.tooltipTrigger ? r("", !0) : (m(), i("title", qe, v(G(e)) + v(K(e) == null ? "" : `: ${K(e)}`), 1))], 8, Ke))), 128)), ue.value ? (m(), i("path", {
5418
+ }, [o.tooltipTrigger ? r("", !0) : (f(), i("title", Je, g(U(e)) + g(W(e) == null ? "" : `: ${W(e)}`), 1))], 8, qe))), 128)), fe.value ? (f(), i("path", {
5343
5419
  key: 0,
5344
- d: V.value(ue.value) ?? void 0,
5420
+ d: z.value(fe.value) ?? void 0,
5345
5421
  fill: "none",
5346
5422
  stroke: o.strokeColor,
5347
5423
  "stroke-width": 1,
5348
5424
  "stroke-linejoin": "round",
5349
5425
  "pointer-events": "none"
5350
- }, null, 8, Je)) : r("", !0)], 512),
5351
- Ae.value ? (m(), i("g", {
5426
+ }, null, 8, Ye)) : r("", !0)], 512),
5427
+ Me.value ? (f(), i("g", {
5352
5428
  key: 0,
5353
5429
  class: "choropleth-legend",
5354
- transform: `translate(${Be.value},${Ie.value})`
5355
- }, [U.value || W.value ? (m(), i(e, { key: 0 }, [o.legendTitle ? (m(), i("text", Ye, v(o.legendTitle), 1)) : r("", !0), (m(!0), i(e, null, g(Y.value, (t, n) => (m(), i(e, { key: t.key }, [a("rect", {
5356
- x: ze.value[n],
5430
+ transform: `translate(${He.value},${Re.value})`
5431
+ }, [V.value || H.value ? (f(), i(e, { key: 0 }, [o.legendTitle ? (f(), i("text", Xe, g(o.legendTitle), 1)) : r("", !0), (f(!0), i(e, null, m(q.value, (t, n) => (f(), i(e, { key: t.key }, [a("rect", {
5432
+ x: Ve.value[n],
5357
5433
  y: -5,
5358
5434
  width: "12",
5359
5435
  height: "12",
5360
5436
  rx: "3",
5361
5437
  fill: t.color
5362
- }, null, 8, Xe), a("text", {
5363
- x: ze.value[n] + 16,
5438
+ }, null, 8, X), a("text", {
5439
+ x: Ve.value[n] + 16,
5364
5440
  y: 5,
5365
5441
  "font-size": "13",
5366
5442
  fill: "currentColor"
5367
- }, v(t.label), 9, Z)], 64))), 128))], 64)) : (m(), i(e, { key: 1 }, [
5368
- o.legendTitle ? (m(), i("text", Q, v(o.legendTitle), 1)) : r("", !0),
5443
+ }, g(t.label), 9, Ze)], 64))), 128))], 64)) : (f(), i(e, { key: 1 }, [
5444
+ o.legendTitle ? (f(), i("text", Qe, g(o.legendTitle), 1)) : r("", !0),
5369
5445
  a("defs", null, [a("linearGradient", {
5370
- id: d,
5446
+ id: ee,
5371
5447
  x1: "0",
5372
5448
  x2: "1",
5373
5449
  y1: "0",
5374
5450
  y2: "0"
5375
- }, [(m(!0), i(e, null, g(Le.value, (e) => (m(), i("stop", {
5451
+ }, [(f(!0), i(e, null, m(ze.value, (e) => (f(), i("stop", {
5376
5452
  key: e.offset,
5377
5453
  offset: e.offset,
5378
5454
  "stop-color": e.color
5379
- }, null, 8, Ze))), 128))])]),
5455
+ }, null, 8, $e))), 128))])]),
5380
5456
  a("rect", {
5381
5457
  x: o.legendTitle ? o.legendTitle.length * 8 + 12 : 0,
5382
5458
  y: -6,
5383
5459
  width: 160,
5384
5460
  height: 12,
5385
5461
  rx: "2",
5386
- fill: `url(#${d})`
5387
- }, null, 8, Qe),
5388
- (m(!0), i(e, null, g(J.value, (e) => (m(), i("text", {
5462
+ fill: `url(#${ee})`
5463
+ }, null, 8, et),
5464
+ (f(!0), i(e, null, m(K.value, (e) => (f(), i("text", {
5389
5465
  key: e.value,
5390
5466
  x: (o.legendTitle ? o.legendTitle.length * 8 + 12 : 0) + e.pct / 100 * 160,
5391
5467
  y: 20,
@@ -5393,20 +5469,20 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5393
5469
  fill: "currentColor",
5394
5470
  opacity: "0.7",
5395
5471
  "text-anchor": "middle"
5396
- }, v(e.value), 9, $e))), 128))
5397
- ], 64))], 8, X)) : r("", !0),
5398
- o.title ? (m(), i("text", {
5472
+ }, g(e.value), 9, tt))), 128))
5473
+ ], 64))], 8, Y)) : r("", !0),
5474
+ o.title ? (f(), i("text", {
5399
5475
  key: 1,
5400
- x: I.value / 2,
5476
+ x: P.value / 2,
5401
5477
  y: 18,
5402
5478
  "text-anchor": "middle",
5403
5479
  "font-size": "14",
5404
5480
  "font-weight": "600",
5405
5481
  fill: "currentColor"
5406
- }, v(o.title), 9, $)) : r("", !0)
5407
- ], 8, Ge))], 2));
5482
+ }, g(o.title), 9, nt)) : r("", !0)
5483
+ ], 8, Ke))], 2));
5408
5484
  }
5409
- }), [["__scopeId", "data-v-25a20d5b"]]), tt = /* @__PURE__ */ R(/* @__PURE__ */ c({
5485
+ }), [["__scopeId", "data-v-25a20d5b"]]), rt = /* @__PURE__ */ I(/* @__PURE__ */ c({
5410
5486
  __name: "ChartTooltip",
5411
5487
  props: {
5412
5488
  x: {},
@@ -5417,30 +5493,30 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5417
5493
  },
5418
5494
  emits: ["close"],
5419
5495
  setup(e) {
5420
- return (t, o) => e.mode === "hover" && e.open ? (m(), i("div", {
5496
+ return (t, o) => e.mode === "hover" && e.open ? (f(), i("div", {
5421
5497
  key: 0,
5422
5498
  class: "chart-tooltip-content",
5423
- style: f({
5499
+ style: d({
5424
5500
  position: "absolute",
5425
5501
  left: `${e.x + e.sideOffset}px`,
5426
5502
  top: `${e.y}px`,
5427
5503
  transform: "translateY(-50%)"
5428
5504
  })
5429
- }, [_(t.$slots, "default", {}, void 0, !0)], 4)) : e.mode === "click" ? (m(), n(b(M), {
5505
+ }, [h(t.$slots, "default", {}, void 0, !0)], 4)) : e.mode === "click" ? (f(), n(v(ae), {
5430
5506
  key: 1,
5431
5507
  open: e.open
5432
5508
  }, {
5433
- default: S(() => [s(b(k), { "as-child": "" }, {
5434
- default: S(() => [a("div", {
5509
+ default: b(() => [s(v(E), { "as-child": "" }, {
5510
+ default: b(() => [a("div", {
5435
5511
  class: "chart-tooltip-anchor",
5436
- style: f({
5512
+ style: d({
5437
5513
  left: `${e.x}px`,
5438
5514
  top: `${e.y}px`
5439
5515
  })
5440
5516
  }, null, 4)]),
5441
5517
  _: 1
5442
- }), s(b(j), null, {
5443
- default: S(() => [e.open ? (m(), n(b(A), {
5518
+ }), s(v(O), null, {
5519
+ default: b(() => [e.open ? (f(), n(v(D), {
5444
5520
  key: 0,
5445
5521
  class: "chart-tooltip-content",
5446
5522
  side: "right",
@@ -5449,7 +5525,7 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5449
5525
  onPointerDownOutside: o[0] ||= (e) => t.$emit("close"),
5450
5526
  onEscapeKeyDown: o[1] ||= (e) => t.$emit("close")
5451
5527
  }, {
5452
- default: S(() => [_(t.$slots, "default", {}, void 0, !0)]),
5528
+ default: b(() => [h(t.$slots, "default", {}, void 0, !0)]),
5453
5529
  _: 3
5454
5530
  }, 8, ["side-offset"])) : r("", !0)]),
5455
5531
  _: 3
@@ -5457,7 +5533,7 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5457
5533
  _: 3
5458
5534
  }, 8, ["open"])) : r("", !0);
5459
5535
  }
5460
- }), [["__scopeId", "data-v-44377f70"]]), nt = { class: "TableWrapper" }, rt = { class: "Table" }, it = ["href", "download"], at = /* @__PURE__ */ R(/* @__PURE__ */ c({
5536
+ }), [["__scopeId", "data-v-44377f70"]]), it = { class: "TableWrapper" }, Q = { class: "Table" }, $ = ["href", "download"], at = /* @__PURE__ */ I(/* @__PURE__ */ c({
5461
5537
  __name: "DataTable",
5462
5538
  props: {
5463
5539
  data: {},
@@ -5480,7 +5556,7 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5480
5556
  function l(e) {
5481
5557
  return c.columnConfig?.[e]?.label ?? e;
5482
5558
  }
5483
- function d(e) {
5559
+ function ee(e) {
5484
5560
  let t = c.columnConfig?.[e]?.width;
5485
5561
  if (t == null) return;
5486
5562
  let n = typeof t == "number" ? `${t}px` : s[t];
@@ -5489,16 +5565,16 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5489
5565
  minWidth: n
5490
5566
  };
5491
5567
  }
5492
- function p(e) {
5568
+ function te(e) {
5493
5569
  let t = c.columnConfig?.[e]?.align;
5494
5570
  if (t) return { textAlign: t };
5495
5571
  }
5496
- function ee(e) {
5572
+ function ne(e) {
5497
5573
  return typeof e.column == "function";
5498
5574
  }
5499
- let h = t(() => {
5575
+ let p = t(() => {
5500
5576
  let e = c.data;
5501
- return ee(e) ? e.columns.map((t) => ({
5577
+ return ne(e) ? e.columns.map((t) => ({
5502
5578
  name: t.name,
5503
5579
  values: e.column(t.name),
5504
5580
  enumLabels: t.enumLabels
@@ -5506,65 +5582,65 @@ var H = ["width", "height"], fe = ["x"], pe = { key: 1 }, U = [
5506
5582
  name: e,
5507
5583
  values: t
5508
5584
  }));
5509
- }), _ = t(() => {
5510
- let e = h.value;
5585
+ }), h = t(() => {
5586
+ let e = p.value;
5511
5587
  if (e.length === 0) return 0;
5512
5588
  let t = 0;
5513
5589
  for (let n of e) t = Math.max(t, n.values.length);
5514
5590
  return c.maxRows ? Math.min(t, c.maxRows) : t;
5515
5591
  });
5516
- function y(e, t) {
5592
+ function _(e, t) {
5517
5593
  let n = e.values[t];
5518
5594
  return n == null ? "" : e.enumLabels && typeof n == "number" ? e.enumLabels[n] ?? String(n) : typeof n == "number" ? Number.isInteger(n) ? n.toString() : n.toFixed(4) : typeof n == "boolean" ? n ? "true" : "false" : String(n);
5519
5595
  }
5520
- function b() {
5596
+ function v() {
5521
5597
  return c.filename ? c.filename : typeof c.menu == "string" ? c.menu : "data";
5522
5598
  }
5523
- function x(e) {
5599
+ function y(e) {
5524
5600
  return e.includes(",") || e.includes("\"") || e.includes("\n") ? `"${e.replace(/"/g, "\"\"")}"` : e;
5525
5601
  }
5526
- function te() {
5602
+ function re() {
5527
5603
  if (typeof c.csv == "function") return c.csv();
5528
5604
  if (typeof c.csv == "string") return c.csv;
5529
- let e = h.value, t = _.value, n = [e.map((e) => x(l(e.name))).join(",")];
5605
+ let e = p.value, t = h.value, n = [e.map((e) => y(l(e.name))).join(",")];
5530
5606
  for (let r = 0; r < t; r++) {
5531
- let t = e.map((e) => x(y(e, r)));
5607
+ let t = e.map((e) => y(_(e, r)));
5532
5608
  n.push(t.join(","));
5533
5609
  }
5534
5610
  return n.join("\n");
5535
5611
  }
5536
- let S = t(() => c.downloadLink ? [] : [{
5612
+ let b = t(() => c.downloadLink ? [] : [{
5537
5613
  label: "Download CSV",
5538
- action: () => ue(te(), b())
5539
- }]), C = t(() => c.downloadLink ? typeof c.downloadLink == "string" ? c.downloadLink : "Download data (CSV)" : null), w = t(() => c.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(te())}` : null), T = t(() => c.menu && S.value.length > 0);
5540
- return (t, s) => (m(), i("div", { class: u(["TableOuter", { "has-menu": T.value }]) }, [
5541
- T.value ? (m(), n(se, {
5614
+ action: () => fe(re(), v())
5615
+ }]), x = t(() => c.downloadLink ? typeof c.downloadLink == "string" ? c.downloadLink : "Download data (CSV)" : null), S = t(() => c.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(re())}` : null), C = t(() => c.menu && b.value.length > 0);
5616
+ return (t, s) => (f(), i("div", { class: u(["TableOuter", { "has-menu": C.value }]) }, [
5617
+ C.value ? (f(), n(le, {
5542
5618
  key: 0,
5543
- items: S.value
5619
+ items: b.value
5544
5620
  }, null, 8, ["items"])) : r("", !0),
5545
- a("div", nt, [a("table", rt, [
5546
- a("colgroup", null, [(m(!0), i(e, null, g(h.value, (e) => (m(), i("col", {
5621
+ a("div", it, [a("table", Q, [
5622
+ a("colgroup", null, [(f(!0), i(e, null, m(p.value, (e) => (f(), i("col", {
5547
5623
  key: e.name,
5548
- style: f(d(e.name))
5624
+ style: d(ee(e.name))
5549
5625
  }, null, 4))), 128))]),
5550
- a("thead", null, [a("tr", null, [(m(!0), i(e, null, g(h.value, (e) => (m(), i("th", {
5626
+ a("thead", null, [a("tr", null, [(f(!0), i(e, null, m(p.value, (e) => (f(), i("th", {
5551
5627
  key: e.name,
5552
- style: f(p(e.name))
5553
- }, v(l(e.name)), 5))), 128))])]),
5554
- a("tbody", null, [(m(!0), i(e, null, g(_.value, (t) => (m(), i("tr", { key: t }, [(m(!0), i(e, null, g(h.value, (e) => (m(), i("td", {
5628
+ style: d(te(e.name))
5629
+ }, g(l(e.name)), 5))), 128))])]),
5630
+ a("tbody", null, [(f(!0), i(e, null, m(h.value, (t) => (f(), i("tr", { key: t }, [(f(!0), i(e, null, m(p.value, (e) => (f(), i("td", {
5555
5631
  key: e.name,
5556
5632
  class: u(o.columnConfig?.[e.name]?.cellClass),
5557
- style: f(p(e.name))
5558
- }, v(y(e, t - 1)), 7))), 128))]))), 128))])
5633
+ style: d(te(e.name))
5634
+ }, g(_(e, t - 1)), 7))), 128))]))), 128))])
5559
5635
  ])]),
5560
- C.value ? (m(), i("a", {
5636
+ x.value ? (f(), i("a", {
5561
5637
  key: 1,
5562
5638
  class: "data-table-download-link",
5563
- href: w.value,
5564
- download: `${b()}.csv`
5565
- }, v(C.value), 9, it)) : r("", !0)
5639
+ href: S.value,
5640
+ download: `${v()}.csv`
5641
+ }, g(x.value), 9, $)) : r("", !0)
5566
5642
  ], 2));
5567
5643
  }
5568
5644
  }), [["__scopeId", "data-v-505e2187"]]);
5569
5645
  //#endregion
5570
- export { tt as ChartTooltip, et as ChoroplethMap, at as DataTable, He as LineChart };
5646
+ export { rt as ChartTooltip, Z as ChoroplethMap, at as DataTable, J as LineChart };