@tellaro/tql 1.3.8 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/index.js +44 -41
  2. package/dist/node_modules/@kurkle/color/dist/color.esm.js +442 -0
  3. package/dist/node_modules/chart.js/dist/chart.js +6149 -0
  4. package/dist/node_modules/chart.js/dist/chunks/helpers.dataset.js +1685 -0
  5. package/dist/node_modules/chartjs-adapter-luxon/dist/chartjs-adapter-luxon.esm.js +56 -0
  6. package/dist/node_modules/chartjs-plugin-annotation/dist/chartjs-plugin-annotation.esm.js +1655 -0
  7. package/dist/node_modules/chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.esm.js +607 -0
  8. package/dist/node_modules/luxon/build/es6/luxon.js +5524 -0
  9. package/dist/src/builder.d.ts +62 -0
  10. package/dist/src/builder.js +56 -0
  11. package/dist/src/chart/colors.d.ts +23 -0
  12. package/dist/src/chart/colors.js +101 -0
  13. package/dist/src/chart/formatters.d.ts +17 -0
  14. package/dist/src/chart/formatters.js +49 -0
  15. package/dist/src/chart/index.d.ts +9 -0
  16. package/dist/src/chart/index.js +31 -0
  17. package/dist/src/chart/mappers.d.ts +849 -0
  18. package/dist/src/chart/mappers.js +613 -0
  19. package/dist/src/completionProvider.js +294 -165
  20. package/dist/src/index.d.ts +2 -1
  21. package/dist/src/parser.d.ts +10 -0
  22. package/dist/src/parser.js +41 -9
  23. package/dist/src/tokenizer.js +124 -103
  24. package/dist/src/types.d.ts +27 -3
  25. package/dist/src/validator.js +10 -9
  26. package/dist/tql.css +1 -1
  27. package/dist/vue/TqlChart.vue.d.ts +2 -0
  28. package/dist/vue/TqlChart.vue.js +7 -0
  29. package/dist/vue/TqlChart.vue2.js +212 -0
  30. package/dist/vue/index.d.ts +1 -0
  31. package/dist/vue/index.js +12 -10
  32. package/dist/vue/useTqlInput.js +80 -80
  33. package/package.json +39 -3
@@ -0,0 +1,613 @@
1
+ import { colorArray as g, PALETTES as w, SEVERITY as T } from "./colors.js";
2
+ import { tickFormatter as _, formatValue as v } from "./formatters.js";
3
+ function z(o) {
4
+ return o == null ? "(empty)" : typeof o == "object" ? Object.values(o).join(" • ") : String(o);
5
+ }
6
+ function M(o) {
7
+ if (o == null) return "(empty)";
8
+ if (typeof o == "object") {
9
+ const t = Object.values(o);
10
+ return t.length > 0 ? String(t[0]) : "(empty)";
11
+ }
12
+ return String(o);
13
+ }
14
+ function R(o) {
15
+ if (typeof o == "object" && o !== null) {
16
+ const t = Object.values(o);
17
+ return t.length > 1 ? String(t[1]) : null;
18
+ }
19
+ return null;
20
+ }
21
+ function N(o) {
22
+ const t = o.results;
23
+ if (!Array.isArray(t) || t.length === 0) return !1;
24
+ const e = t[0].key;
25
+ return typeof e == "object" && e !== null && Object.keys(e).length >= 2;
26
+ }
27
+ function J(o) {
28
+ const t = o.group_by;
29
+ if (!t || t.length === 0) return !1;
30
+ const e = t[0].toLowerCase();
31
+ return e === "@timestamp" || e.includes("timestamp") || e.includes("date") || e.endsWith("_at");
32
+ }
33
+ function S(o) {
34
+ for (const [t, e] of Object.entries(o))
35
+ if (!(t === "key" || t === "key_as_string" || t === "doc_count") && e && typeof e == "object" && !Array.isArray(e) && Array.isArray(e.buckets))
36
+ return t;
37
+ return null;
38
+ }
39
+ function D(o, t) {
40
+ const e = [];
41
+ for (const r of o) {
42
+ const a = r.key_as_string ?? r.key, s = S(r);
43
+ if (!s) {
44
+ e.push(r);
45
+ continue;
46
+ }
47
+ const n = s.replace(/^group_by_/, "").replace(/\.keyword$/, ""), p = r[s].buckets;
48
+ for (const d of p) {
49
+ const f = d.key_as_string ?? d.key;
50
+ let l = d.doc_count;
51
+ for (const [i, u] of Object.entries(d))
52
+ if (i !== "key" && i !== "key_as_string" && i !== "doc_count" && u && typeof u == "object") {
53
+ const b = u;
54
+ if (b.value !== void 0) {
55
+ l = Number(b.value);
56
+ break;
57
+ }
58
+ }
59
+ e.push({
60
+ key: { [t]: String(a), [n]: String(f) },
61
+ doc_count: l
62
+ });
63
+ }
64
+ }
65
+ return e;
66
+ }
67
+ function V(o) {
68
+ if (o.results !== void 0) return o;
69
+ for (const [t, e] of Object.entries(o))
70
+ if (e && typeof e == "object" && !Array.isArray(e)) {
71
+ const r = e;
72
+ if (Array.isArray(r.buckets)) {
73
+ const a = r.buckets;
74
+ if (a.length > 0 && S(a[0])) {
75
+ const s = t.replace(/^group_by_/, "").replace(/\.keyword$/, ""), n = D(a, s);
76
+ return { ...o, results: n };
77
+ }
78
+ return { ...o, results: a };
79
+ }
80
+ }
81
+ for (const [, t] of Object.entries(o))
82
+ if (t && typeof t == "object" && !Array.isArray(t)) {
83
+ const e = t;
84
+ if (e.value !== void 0 && !e.buckets)
85
+ return { ...o, values: e.value };
86
+ }
87
+ return o;
88
+ }
89
+ function k(o) {
90
+ const t = V(o), e = t.results, r = [], a = [];
91
+ if (N(t) && Array.isArray(e)) {
92
+ const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
93
+ for (const d of e) {
94
+ const f = d, l = M(f.key), i = R(f.key), u = Number(f.count ?? f.value ?? f.doc_count ?? 0);
95
+ n.add(l);
96
+ const b = i || "value";
97
+ s.has(b) || s.set(b, /* @__PURE__ */ new Map()), s.get(b).set(l, u);
98
+ }
99
+ const c = [...n], p = {};
100
+ for (const [d, f] of s)
101
+ p[d] = c.map((l) => f.get(l) ?? 0);
102
+ return { labels: c, values: c.map(() => 0), multiValues: p };
103
+ }
104
+ if (Array.isArray(e))
105
+ for (const s of e) {
106
+ const n = s;
107
+ r.push(z(n.key ?? n.group)), a.push(Number(n.count ?? n.value ?? n.doc_count ?? 0));
108
+ }
109
+ else if (e && typeof e == "object")
110
+ for (const [s, n] of Object.entries(e))
111
+ if (r.push(s), typeof n == "number") a.push(n);
112
+ else if (n && typeof n == "object") {
113
+ const c = n;
114
+ a.push(Number(c.count ?? c.value ?? c.doc_count ?? 0));
115
+ } else a.push(Number(n ?? 0));
116
+ return { labels: r, values: a };
117
+ }
118
+ function Q(o) {
119
+ if (o.values !== void 0) return Number(o.values);
120
+ if (o.value !== void 0) return Number(o.value);
121
+ if (o.count !== void 0) return Number(o.count);
122
+ for (const t of Object.values(o))
123
+ if (t && typeof t == "object" && !Array.isArray(t)) {
124
+ const e = t;
125
+ if (e.value !== void 0 && !e.buckets) return Number(e.value);
126
+ if (Array.isArray(e.buckets))
127
+ return e.buckets.reduce(
128
+ (r, a) => r + Number(a.doc_count ?? a.count ?? a.value ?? 0),
129
+ 0
130
+ );
131
+ }
132
+ return Array.isArray(o.results) ? o.results.reduce(
133
+ (t, e) => t + Number(e.count ?? e.value ?? e.doc_count ?? 0),
134
+ 0
135
+ ) : 0;
136
+ }
137
+ function $(o) {
138
+ if (!o || o in w) return null;
139
+ if (o === "severity") return { ...T };
140
+ const t = {};
141
+ for (const e of o.split(",")) {
142
+ const [r, a] = e.split(":").map((s) => s.trim());
143
+ r && a && (t[r.toLowerCase()] = a);
144
+ }
145
+ return Object.keys(t).length > 0 ? t : null;
146
+ }
147
+ function F(o, t) {
148
+ const e = t?.colors;
149
+ if (e && e in w)
150
+ return g(o.length, e);
151
+ const r = $(e);
152
+ if (r) {
153
+ const a = g(o.length);
154
+ return o.map((s, n) => r[s.toLowerCase()] || a[n]);
155
+ }
156
+ return g(o.length);
157
+ }
158
+ function A(o) {
159
+ return o ? o.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean) : null;
160
+ }
161
+ function C(o, t) {
162
+ if (!t) return o;
163
+ let { labels: e, values: r } = o;
164
+ const a = A(t.include), s = A(t.exclude), n = t.other === !0 || t.other === "true", c = t.top !== void 0 ? Number(t.top) : null, p = t.sort, d = t.normalize === !0 || t.normalize === "true";
165
+ if (a || s) {
166
+ const l = [];
167
+ let i = 0;
168
+ for (let u = 0; u < e.length; u++) {
169
+ const b = e[u].toLowerCase(), h = a ? a.includes(b) : !0, m = s ? s.includes(b) : !1;
170
+ h && !m ? l.push({ label: e[u], value: r[u] }) : i += r[u];
171
+ }
172
+ n && i > 0 && l.push({ label: "Other", value: i }), e = l.map((u) => u.label), r = l.map((u) => u.value);
173
+ }
174
+ if (c && c > 0 && e.length > c) {
175
+ const l = e.map((h, m) => ({ label: h, value: r[m] }));
176
+ l.sort((h, m) => m.value - h.value);
177
+ const i = l.slice(0, c), b = l.slice(c).reduce((h, m) => h + m.value, 0);
178
+ e = i.map((h) => h.label), r = i.map((h) => h.value), n !== !1 && b > 0 && (e.push("Other"), r.push(b));
179
+ }
180
+ if (p === "desc" || p === "asc") {
181
+ const l = e.map((i, u) => ({ label: i, value: r[u] }));
182
+ l.sort((i, u) => p === "desc" ? u.value - i.value : i.value - u.value), e = l.map((i) => i.label), r = l.map((i) => i.value);
183
+ }
184
+ if (d) {
185
+ const l = r.reduce((i, u) => i + u, 0);
186
+ l > 0 && (r = r.map((i) => i / l * 100));
187
+ }
188
+ const f = F(e, t);
189
+ for (let l = 0; l < e.length; l++)
190
+ e[l] === "Other" && (f[l] = "#6b7280");
191
+ return { labels: e, values: r, colors: f };
192
+ }
193
+ function Y(o, t) {
194
+ return o.replace(/\{\{value\}\}/g, encodeURIComponent(t.value)).replace(/\{\{label\}\}/g, encodeURIComponent(t.label)).replace(/\{\{field\}\}/g, encodeURIComponent(t.field || "")).replace(/\{\{count\}\}/g, String(t.count ?? ""));
195
+ }
196
+ function Z(o) {
197
+ const t = o.toLowerCase().trim();
198
+ return !(t.startsWith("javascript:") || t.startsWith("data:") || t.startsWith("vbscript:"));
199
+ }
200
+ function I(o) {
201
+ const t = k(o.stats);
202
+ if (t.multiValues && Object.keys(t.multiValues).length > 1) {
203
+ const d = Object.keys(t.multiValues), f = g(d.length);
204
+ return {
205
+ labels: t.labels,
206
+ datasets: d.map((l, i) => ({
207
+ label: l,
208
+ data: t.multiValues[l],
209
+ backgroundColor: f[i],
210
+ borderColor: f[i] + "cc",
211
+ borderWidth: 1,
212
+ borderRadius: 4,
213
+ borderSkipped: !1,
214
+ maxBarThickness: 64
215
+ }))
216
+ };
217
+ }
218
+ const { labels: e, values: r, colors: a } = C(t, o.viz_params), s = a || g(e.length), n = [
219
+ {
220
+ label: "",
221
+ // Empty label — filtered from legend when threshold is shown
222
+ data: r,
223
+ backgroundColor: s,
224
+ borderColor: s.map((d) => d + "cc"),
225
+ borderWidth: 1,
226
+ borderRadius: 4,
227
+ borderSkipped: !1,
228
+ maxBarThickness: 64
229
+ }
230
+ ], c = o.viz_params || {}, p = E(c, e.length);
231
+ return p && n.push(p), { labels: e, datasets: n };
232
+ }
233
+ function O(o, t = !1, e = !1) {
234
+ const r = k(o.stats), a = o.viz_params || {}, s = a.nulls;
235
+ if (r.multiValues && Object.keys(r.multiValues).length > 1) {
236
+ const f = Object.keys(r.multiValues), l = g(f.length);
237
+ return {
238
+ labels: r.labels,
239
+ datasets: f.map((i, u) => ({
240
+ label: i,
241
+ data: r.multiValues[i],
242
+ borderColor: l[u],
243
+ backgroundColor: t ? l[u] + "33" : "transparent",
244
+ fill: t,
245
+ tension: e ? 0.4 : 0.1,
246
+ pointRadius: 3,
247
+ pointHoverRadius: 5,
248
+ pointBackgroundColor: l[u],
249
+ pointBorderColor: "#1e1e2e",
250
+ pointBorderWidth: 2,
251
+ borderWidth: 2.5,
252
+ spanGaps: s === "connect"
253
+ }))
254
+ };
255
+ }
256
+ const { labels: n, values: c, colors: p } = C(r, a), d = p?.[0] || g(1)[0];
257
+ return {
258
+ labels: n,
259
+ datasets: [
260
+ {
261
+ data: c,
262
+ borderColor: d,
263
+ backgroundColor: t ? d + "33" : "transparent",
264
+ fill: t,
265
+ tension: e ? 0.4 : 0.1,
266
+ pointRadius: 4,
267
+ pointHoverRadius: 6,
268
+ pointBackgroundColor: d,
269
+ // Single color for single-series dots
270
+ pointBorderColor: "#1e1e2e",
271
+ pointBorderWidth: 2,
272
+ borderWidth: 2.5,
273
+ spanGaps: s === "connect"
274
+ }
275
+ ]
276
+ };
277
+ }
278
+ function K(o, t) {
279
+ const e = parseInt(o.replace("#", ""), 16), r = Math.min(255, Math.max(0, (e >> 16 & 255) + t)), a = Math.min(255, Math.max(0, (e >> 8 & 255) + t)), s = Math.min(255, Math.max(0, (e & 255) + t));
280
+ return `#${(1 << 24 | r << 16 | a << 8 | s).toString(16).slice(1)}`;
281
+ }
282
+ function j(o) {
283
+ const t = k(o.stats);
284
+ if (t.multiValues && Object.keys(t.multiValues).length > 1) {
285
+ const n = Object.keys(t.multiValues), c = g(t.labels.length), p = t.labels.map(
286
+ (i, u) => n.reduce((b, h) => b + (t.multiValues[h][u] ?? 0), 0)
287
+ ), d = [], f = [], l = [];
288
+ for (let i = 0; i < t.labels.length; i++) {
289
+ const u = c[i];
290
+ for (let b = 0; b < n.length; b++) {
291
+ const h = t.multiValues[n[b]][i] ?? 0;
292
+ if (h > 0) {
293
+ d.push(`${t.labels[i]} • ${n[b]}`), f.push(h);
294
+ const m = Math.round((b - n.length / 2) / n.length * 60);
295
+ l.push(K(u, m));
296
+ }
297
+ }
298
+ }
299
+ return {
300
+ labels: d,
301
+ datasets: [
302
+ // Inner ring (primary field)
303
+ {
304
+ label: "Primary",
305
+ data: p,
306
+ backgroundColor: c,
307
+ borderColor: "#1a1a2e",
308
+ borderWidth: 2,
309
+ hoverBorderColor: "#fff",
310
+ hoverBorderWidth: 2,
311
+ hoverOffset: 4
312
+ },
313
+ // Outer ring (secondary breakdown)
314
+ {
315
+ label: "Detail",
316
+ data: f,
317
+ backgroundColor: l,
318
+ borderColor: "#1a1a2e",
319
+ borderWidth: 1,
320
+ hoverBorderColor: "#fff",
321
+ hoverBorderWidth: 2,
322
+ hoverOffset: 6
323
+ }
324
+ ]
325
+ };
326
+ }
327
+ const { labels: e, values: r, colors: a } = C(t, o.viz_params), s = a || g(e.length);
328
+ return {
329
+ labels: e,
330
+ datasets: [
331
+ {
332
+ data: r,
333
+ backgroundColor: s,
334
+ borderColor: "#1a1a2e",
335
+ borderWidth: 2,
336
+ hoverBorderColor: "#fff",
337
+ hoverBorderWidth: 2,
338
+ hoverOffset: 6
339
+ }
340
+ ]
341
+ };
342
+ }
343
+ const L = { duration: 600, easing: "easeOutQuart" };
344
+ function W(o, t = !1) {
345
+ const e = o?.format, r = o?.tooltip === "all" || o?.crosshair === !0, a = o?.y_label;
346
+ return {
347
+ enabled: !0,
348
+ mode: r ? "index" : "nearest",
349
+ intersect: !r,
350
+ backgroundColor: "#1e1e2e",
351
+ titleColor: "#e0e0e0",
352
+ bodyColor: "#a0a0b0",
353
+ borderColor: "#333",
354
+ borderWidth: 1,
355
+ cornerRadius: 8,
356
+ padding: 12,
357
+ titleFont: { size: 13, weight: "600" },
358
+ bodyFont: { size: 12 },
359
+ displayColors: t,
360
+ boxPadding: 4,
361
+ callbacks: {
362
+ // Title: just the x-axis label (category name)
363
+ title: (s) => s[0]?.label ?? "",
364
+ // Body: formatted value, optionally with series name for multi-series
365
+ label: (s) => {
366
+ const n = s.parsed.y ?? s.parsed.x ?? 0;
367
+ let c;
368
+ return e ? c = v(n, e) : a ? c = (Number.isInteger(n) ? n.toLocaleString() : n.toFixed(2)) + " " + a : c = Number.isInteger(n) ? n.toLocaleString() : n.toFixed(2), t && s.dataset.label ? `${s.dataset.label}: ${c}` : c;
369
+ }
370
+ }
371
+ };
372
+ }
373
+ function B(o) {
374
+ const t = o?.labels;
375
+ if (!t || t === "false" || t === !1) return { display: !1 };
376
+ const e = o?.format;
377
+ return {
378
+ display: t === "minmax" ? "auto" : !0,
379
+ color: "#c0c0c0",
380
+ font: { size: 11, weight: "500" },
381
+ anchor: "end",
382
+ align: "top",
383
+ offset: 4,
384
+ formatter: e ? (r) => v(r, e) : void 0
385
+ };
386
+ }
387
+ function E(o, t) {
388
+ const e = o?.threshold;
389
+ if (e == null) return null;
390
+ const r = o?.threshold_color || "#ef4444";
391
+ return {
392
+ label: o?.threshold_label || `Threshold: ${e}`,
393
+ data: Array(t).fill(Number(e)),
394
+ type: "line",
395
+ borderColor: r,
396
+ borderWidth: 2,
397
+ borderDash: [6, 4],
398
+ pointRadius: 0,
399
+ pointHoverRadius: 0,
400
+ fill: !1,
401
+ order: 0,
402
+ // Draw on top
403
+ datalabels: { display: !1 }
404
+ // Don't show "5" above each threshold point
405
+ };
406
+ }
407
+ function y(o, t = !1) {
408
+ const e = o || {}, r = e.title, a = e.stacked === !0 || e.stacked === "true", s = e.horizontal === !0, n = e.format, c = e.normalize === !0 || e.normalize === "true", p = e.threshold !== void 0;
409
+ return {
410
+ responsive: !0,
411
+ maintainAspectRatio: !1,
412
+ indexAxis: s ? "y" : "x",
413
+ animation: L,
414
+ layout: { padding: { top: 8, right: 16, bottom: 8, left: 8 } },
415
+ interaction: {
416
+ mode: e.crosshair === !0 || e.tooltip === "all" || t ? "index" : "nearest",
417
+ intersect: !(e.crosshair === !0 || e.tooltip === "all" || t)
418
+ },
419
+ plugins: {
420
+ legend: {
421
+ display: t || p,
422
+ labels: {
423
+ color: "#c0c0c0",
424
+ font: { size: 12 },
425
+ padding: 12,
426
+ usePointStyle: !0,
427
+ pointStyleWidth: 10,
428
+ // Hide the bar dataset from legend when threshold is shown (only show threshold line label)
429
+ filter: p && !t ? (d) => d.text !== void 0 && d.text !== "" : void 0
430
+ }
431
+ },
432
+ title: {
433
+ display: !!r,
434
+ text: r || "",
435
+ color: "#e0e0e0",
436
+ font: { size: 15, weight: "600" },
437
+ padding: { top: 4, bottom: 16 }
438
+ },
439
+ tooltip: W(e, t),
440
+ datalabels: B(e)
441
+ },
442
+ scales: {
443
+ x: {
444
+ stacked: a,
445
+ title: {
446
+ display: !!e.x_label,
447
+ text: e.x_label || "",
448
+ color: "#888",
449
+ font: { size: 12 },
450
+ padding: { top: 8 }
451
+ },
452
+ ticks: {
453
+ color: "#888",
454
+ font: { size: s ? 11 : 10 },
455
+ maxRotation: 60,
456
+ autoSkip: !0,
457
+ maxTicksLimit: 15,
458
+ padding: 4,
459
+ callback: s ? _(c ? "percent_raw" : n) : void 0
460
+ },
461
+ grid: { color: "#ffffff08", drawTicks: !1 },
462
+ border: { color: "#333" }
463
+ },
464
+ y: {
465
+ stacked: a,
466
+ beginAtZero: !0,
467
+ min: e.y_min !== void 0 ? Number(e.y_min) : void 0,
468
+ max: e.y_max !== void 0 ? Number(e.y_max) : c ? 100 : void 0,
469
+ title: {
470
+ display: !!e.y_label,
471
+ text: e.y_label || "",
472
+ color: "#888",
473
+ font: { size: 12 },
474
+ padding: { bottom: 8 }
475
+ },
476
+ ticks: {
477
+ color: "#888",
478
+ font: { size: 11 },
479
+ padding: 8,
480
+ callback: s ? void 0 : _(c ? "percent_raw" : n),
481
+ // Prevent duplicate formatted ticks: force integer step for small ranges
482
+ ...n && n !== "percent_raw" && n !== "percent" ? { stepSize: 1 } : {}
483
+ },
484
+ grid: { color: "#ffffff0a" },
485
+ border: { display: !1 }
486
+ }
487
+ }
488
+ };
489
+ }
490
+ function H(o, t = !1) {
491
+ const e = y(o, t);
492
+ return e.scales.x.grid = { color: "transparent", drawTicks: !1 }, e;
493
+ }
494
+ function x(o, t = !1, e = !1) {
495
+ const r = o || {}, a = r.title, s = r.legend || "right", n = r.format;
496
+ return {
497
+ responsive: !0,
498
+ maintainAspectRatio: !1,
499
+ animation: L,
500
+ // Multi-level: force donut so inner ring is visible
501
+ cutout: t || e ? "35%" : 0,
502
+ layout: { padding: { top: 8, right: 8, bottom: 8, left: 8 } },
503
+ plugins: {
504
+ legend: {
505
+ display: !0,
506
+ position: s,
507
+ labels: {
508
+ color: "#c0c0c0",
509
+ font: { size: 12 },
510
+ padding: 16,
511
+ usePointStyle: !0,
512
+ pointStyleWidth: 12,
513
+ boxHeight: 8
514
+ }
515
+ },
516
+ title: {
517
+ display: !!a,
518
+ text: a || "",
519
+ color: "#e0e0e0",
520
+ font: { size: 15, weight: "600" },
521
+ padding: { top: 4, bottom: 12 }
522
+ },
523
+ tooltip: {
524
+ ...W(r),
525
+ // Pie/donut: label shows "category: value" — override for clean display
526
+ callbacks: {
527
+ title: () => "",
528
+ // No title for pie — label IS the title
529
+ label: (c) => {
530
+ const p = n ? v(c.parsed, n) : c.parsed.toLocaleString();
531
+ return ` ${c.label}: ${p}`;
532
+ }
533
+ }
534
+ },
535
+ datalabels: B(r)
536
+ }
537
+ };
538
+ }
539
+ function q(o) {
540
+ switch (o) {
541
+ case "bar":
542
+ case "stacked_bar":
543
+ case "grouped_bar":
544
+ case "horizontal_bar":
545
+ return "bar";
546
+ case "line":
547
+ case "area":
548
+ case "stacked_area":
549
+ return "line";
550
+ case "pie":
551
+ return "pie";
552
+ case "donut":
553
+ return "doughnut";
554
+ case "scatter":
555
+ return "scatter";
556
+ default:
557
+ return "bar";
558
+ }
559
+ }
560
+ function X(o, t) {
561
+ const e = o.viz_params || {};
562
+ switch (t) {
563
+ case "line":
564
+ return O(o, !1, e.smooth === !0 || e.smooth === "true");
565
+ case "area":
566
+ case "stacked_area":
567
+ return O(o, !0, e.smooth === !0 || e.smooth === "true");
568
+ case "pie":
569
+ return j(o);
570
+ case "donut":
571
+ return j(o);
572
+ default:
573
+ return I(o);
574
+ }
575
+ }
576
+ function P(o, t) {
577
+ const e = o.viz_params || {}, r = V(o.stats), a = N(r);
578
+ switch (t) {
579
+ case "line":
580
+ case "area":
581
+ case "stacked_area":
582
+ return H(e, a);
583
+ case "pie":
584
+ return x(e, !1, a);
585
+ case "donut":
586
+ return x(e, !0, a);
587
+ case "horizontal_bar":
588
+ return y({ ...e, horizontal: !0 }, a);
589
+ case "stacked_bar":
590
+ return y({ ...e, stacked: !0 }, a);
591
+ default:
592
+ return y(e, a);
593
+ }
594
+ }
595
+ export {
596
+ C as applyVizFilters,
597
+ I as barChartData,
598
+ y as barChartOptions,
599
+ X as buildChartData,
600
+ P as buildChartOptions,
601
+ q as chartJsType,
602
+ Y as expandLinkTemplate,
603
+ k as extractGroupedData,
604
+ Q as extractScalarValue,
605
+ Z as isLinkTemplateSafe,
606
+ J as isTimeSeriesData,
607
+ O as lineChartData,
608
+ H as lineChartOptions,
609
+ V as normalizeOpenSearchAggs,
610
+ $ as parseColorMap,
611
+ j as pieChartData,
612
+ x as pieChartOptions
613
+ };