@tellaro/tql 3.3.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +86 -79
- package/dist/src/chart/index.d.ts +1 -1
- package/dist/src/chart/index.js +39 -26
- package/dist/src/chart/mappers.d.ts +861 -69
- package/dist/src/chart/mappers.js +502 -201
- package/dist/src/completionProvider.d.ts +11 -0
- package/dist/src/completionProvider.js +99 -59
- package/dist/src/index.d.ts +3 -3
- package/dist/src/parser.d.ts +36 -0
- package/dist/src/parser.js +263 -151
- package/dist/src/tokenizer.d.ts +20 -0
- package/dist/src/tokenizer.js +123 -104
- package/dist/src/types.d.ts +114 -3
- package/dist/tql.css +1 -1
- package/dist/vue/TqlChart.vue.js +1 -1
- package/dist/vue/TqlChart.vue2.js +148 -130
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { colorArray as
|
|
2
|
-
import { tickFormatter as
|
|
3
|
-
function
|
|
1
|
+
import { colorArray as y, PALETTES as T, SEVERITY as Z } from "./colors.js";
|
|
2
|
+
import { tickFormatter as W, formatValue as j } from "./formatters.js";
|
|
3
|
+
function D(o) {
|
|
4
4
|
return o == null ? "(empty)" : typeof o == "object" ? Object.values(o).join(" • ") : String(o);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function P(o) {
|
|
7
7
|
if (o == null) return "(empty)";
|
|
8
8
|
if (typeof o == "object") {
|
|
9
9
|
const t = Object.values(o);
|
|
@@ -11,71 +11,97 @@ function M(o) {
|
|
|
11
11
|
}
|
|
12
12
|
return String(o);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ee(o) {
|
|
15
15
|
if (typeof o == "object" && o !== null) {
|
|
16
16
|
const t = Object.values(o);
|
|
17
17
|
return t.length > 1 ? String(t[1]) : null;
|
|
18
18
|
}
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function K(o) {
|
|
22
22
|
const t = o.results;
|
|
23
23
|
if (!Array.isArray(t) || t.length === 0) return !1;
|
|
24
24
|
const e = t[0].key;
|
|
25
25
|
return typeof e == "object" && e !== null && Object.keys(e).length >= 2;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function ve(o) {
|
|
28
28
|
const t = o.group_by;
|
|
29
29
|
if (!t || t.length === 0) return !1;
|
|
30
|
-
const e = t[0]
|
|
31
|
-
|
|
30
|
+
const e = t[0];
|
|
31
|
+
if (typeof e == "object" && e !== null) {
|
|
32
|
+
if (e.bucket?.type === "date_histogram") return !0;
|
|
33
|
+
if (e.bucket) return !1;
|
|
34
|
+
}
|
|
35
|
+
const r = (typeof e == "string" ? e : e?.field ?? "").toLowerCase();
|
|
36
|
+
return r === "@timestamp" || r.includes("timestamp") || r.includes("date") || r.endsWith("_at");
|
|
32
37
|
}
|
|
33
|
-
function
|
|
38
|
+
function I(o) {
|
|
34
39
|
for (const [t, e] of Object.entries(o))
|
|
35
40
|
if (!(t === "key" || t === "key_as_string" || t === "doc_count") && e && typeof e == "object" && !Array.isArray(e) && Array.isArray(e.buckets))
|
|
36
41
|
return t;
|
|
37
42
|
return null;
|
|
38
43
|
}
|
|
39
|
-
function
|
|
44
|
+
function A(o) {
|
|
45
|
+
return typeof o.key == "number" && typeof o.key_as_string == "string" && Date.parse(o.key_as_string) === o.key;
|
|
46
|
+
}
|
|
47
|
+
function E(o, t) {
|
|
48
|
+
const e = {
|
|
49
|
+
key: { [t]: o.key_as_string },
|
|
50
|
+
doc_count: o.doc_count,
|
|
51
|
+
bucket_meta: { [t]: { epoch_ms: o.key } }
|
|
52
|
+
};
|
|
53
|
+
for (const [r, n] of Object.entries(o))
|
|
54
|
+
if (!(r === "key" || r === "key_as_string" || r === "doc_count") && n && typeof n == "object" && n.value !== void 0) {
|
|
55
|
+
e.value = n.value;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
return e;
|
|
59
|
+
}
|
|
60
|
+
function te(o, t) {
|
|
40
61
|
const e = [];
|
|
41
62
|
for (const r of o) {
|
|
42
|
-
const
|
|
63
|
+
const n = r.key_as_string ?? r.key, s = I(r);
|
|
43
64
|
if (!s) {
|
|
44
|
-
e.push(r);
|
|
65
|
+
e.push(A(r) ? E(r, t) : r);
|
|
45
66
|
continue;
|
|
46
67
|
}
|
|
47
|
-
const
|
|
48
|
-
for (const d of
|
|
49
|
-
const
|
|
50
|
-
let
|
|
51
|
-
for (const [
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
|
|
68
|
+
const a = s.replace(/^group_by_/, "").replace(/\.keyword$/, ""), u = r[s].buckets;
|
|
69
|
+
for (const d of u) {
|
|
70
|
+
const c = d.key_as_string ?? d.key;
|
|
71
|
+
let i = d.doc_count;
|
|
72
|
+
for (const [p, b] of Object.entries(d))
|
|
73
|
+
if (p !== "key" && p !== "key_as_string" && p !== "doc_count" && b && typeof b == "object") {
|
|
74
|
+
const m = b;
|
|
75
|
+
if (m.value !== void 0) {
|
|
76
|
+
i = Number(m.value);
|
|
56
77
|
break;
|
|
57
78
|
}
|
|
58
79
|
}
|
|
59
|
-
|
|
60
|
-
key: { [t]: String(
|
|
61
|
-
doc_count:
|
|
62
|
-
}
|
|
80
|
+
const f = {
|
|
81
|
+
key: { [t]: String(n), [a]: String(c) },
|
|
82
|
+
doc_count: i
|
|
83
|
+
};
|
|
84
|
+
A(r) && (f.bucket_meta = { [t]: { epoch_ms: r.key } }), e.push(f);
|
|
63
85
|
}
|
|
64
86
|
}
|
|
65
87
|
return e;
|
|
66
88
|
}
|
|
67
|
-
function
|
|
89
|
+
function O(o) {
|
|
68
90
|
if (o.results !== void 0) return o;
|
|
69
91
|
for (const [t, e] of Object.entries(o))
|
|
70
92
|
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
71
93
|
const r = e;
|
|
72
94
|
if (Array.isArray(r.buckets)) {
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
return { ...o, results:
|
|
95
|
+
const n = r.buckets;
|
|
96
|
+
if (n.length > 0 && I(n[0])) {
|
|
97
|
+
const a = t.replace(/^group_by_/, "").replace(/\.keyword$/, ""), l = te(n, a);
|
|
98
|
+
return { ...o, results: l };
|
|
77
99
|
}
|
|
78
|
-
|
|
100
|
+
const s = t.replace(/^group_by_/, "").replace(/\.keyword$/, "");
|
|
101
|
+
return {
|
|
102
|
+
...o,
|
|
103
|
+
results: n.map((a) => A(a) ? E(a, s) : a)
|
|
104
|
+
};
|
|
79
105
|
}
|
|
80
106
|
}
|
|
81
107
|
for (const [, t] of Object.entries(o))
|
|
@@ -86,36 +112,36 @@ function V(o) {
|
|
|
86
112
|
}
|
|
87
113
|
return o;
|
|
88
114
|
}
|
|
89
|
-
function
|
|
90
|
-
const t =
|
|
91
|
-
if (
|
|
92
|
-
const s = /* @__PURE__ */ new Map(),
|
|
115
|
+
function S(o) {
|
|
116
|
+
const t = O(o), e = t.results, r = [], n = [];
|
|
117
|
+
if (K(t) && Array.isArray(e)) {
|
|
118
|
+
const s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
93
119
|
for (const d of e) {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
const b =
|
|
97
|
-
s.has(b) || s.set(b, /* @__PURE__ */ new Map()), s.get(b).set(
|
|
120
|
+
const c = d, i = P(c.key), f = ee(c.key), p = _(c) ?? 0;
|
|
121
|
+
a.add(i);
|
|
122
|
+
const b = f || "value";
|
|
123
|
+
s.has(b) || s.set(b, /* @__PURE__ */ new Map()), s.get(b).set(i, p);
|
|
98
124
|
}
|
|
99
|
-
const
|
|
100
|
-
for (const [d,
|
|
101
|
-
|
|
102
|
-
return { labels:
|
|
125
|
+
const l = [...a], u = {};
|
|
126
|
+
for (const [d, c] of s)
|
|
127
|
+
u[d] = l.map((i) => c.get(i) ?? 0);
|
|
128
|
+
return { labels: l, values: l.map(() => 0), multiValues: u };
|
|
103
129
|
}
|
|
104
130
|
if (Array.isArray(e))
|
|
105
131
|
for (const s of e) {
|
|
106
|
-
const
|
|
107
|
-
r.push(
|
|
132
|
+
const a = s;
|
|
133
|
+
r.push(D(a.key ?? a.group)), n.push(_(a) ?? 0);
|
|
108
134
|
}
|
|
109
135
|
else if (e && typeof e == "object")
|
|
110
|
-
for (const [s,
|
|
111
|
-
if (r.push(s), typeof
|
|
112
|
-
else if (
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
} else
|
|
116
|
-
return { labels: r, values:
|
|
136
|
+
for (const [s, a] of Object.entries(e))
|
|
137
|
+
if (r.push(s), typeof a == "number") n.push(a);
|
|
138
|
+
else if (a && typeof a == "object") {
|
|
139
|
+
const l = a;
|
|
140
|
+
n.push(Number(l.count ?? l.value ?? l.doc_count ?? 0));
|
|
141
|
+
} else n.push(Number(a ?? 0));
|
|
142
|
+
return { labels: r, values: n };
|
|
117
143
|
}
|
|
118
|
-
function
|
|
144
|
+
function _e(o) {
|
|
119
145
|
if (o.values !== void 0) return Number(o.values);
|
|
120
146
|
if (o.value !== void 0) return Number(o.value);
|
|
121
147
|
if (o.count !== void 0) return Number(o.count);
|
|
@@ -125,7 +151,7 @@ function Q(o) {
|
|
|
125
151
|
if (e.value !== void 0 && !e.buckets) return Number(e.value);
|
|
126
152
|
if (Array.isArray(e.buckets))
|
|
127
153
|
return e.buckets.reduce(
|
|
128
|
-
(r,
|
|
154
|
+
(r, n) => r + Number(n.doc_count ?? n.count ?? n.value ?? 0),
|
|
129
155
|
0
|
|
130
156
|
);
|
|
131
157
|
}
|
|
@@ -134,80 +160,80 @@ function Q(o) {
|
|
|
134
160
|
0
|
|
135
161
|
) : 0;
|
|
136
162
|
}
|
|
137
|
-
function
|
|
138
|
-
if (!o || o in
|
|
139
|
-
if (o === "severity") return { ...
|
|
163
|
+
function oe(o) {
|
|
164
|
+
if (!o || o in T) return null;
|
|
165
|
+
if (o === "severity") return { ...Z };
|
|
140
166
|
const t = {};
|
|
141
167
|
for (const e of o.split(",")) {
|
|
142
|
-
const [r,
|
|
143
|
-
r &&
|
|
168
|
+
const [r, n] = e.split(":").map((s) => s.trim());
|
|
169
|
+
r && n && (t[r.toLowerCase()] = n);
|
|
144
170
|
}
|
|
145
171
|
return Object.keys(t).length > 0 ? t : null;
|
|
146
172
|
}
|
|
147
|
-
function
|
|
173
|
+
function re(o, t) {
|
|
148
174
|
const e = t?.colors;
|
|
149
|
-
if (e && e in
|
|
150
|
-
return
|
|
151
|
-
const r =
|
|
175
|
+
if (e && e in T)
|
|
176
|
+
return y(o.length, e);
|
|
177
|
+
const r = oe(e);
|
|
152
178
|
if (r) {
|
|
153
|
-
const
|
|
154
|
-
return o.map((s,
|
|
179
|
+
const n = y(o.length);
|
|
180
|
+
return o.map((s, a) => r[s.toLowerCase()] || n[a]);
|
|
155
181
|
}
|
|
156
|
-
return
|
|
182
|
+
return y(o.length);
|
|
157
183
|
}
|
|
158
|
-
function
|
|
184
|
+
function B(o) {
|
|
159
185
|
return o ? o.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean) : null;
|
|
160
186
|
}
|
|
161
|
-
function
|
|
187
|
+
function M(o, t) {
|
|
162
188
|
if (!t) return o;
|
|
163
189
|
let { labels: e, values: r } = o;
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
166
|
-
const
|
|
167
|
-
let
|
|
168
|
-
for (let
|
|
169
|
-
const b = e[
|
|
170
|
-
|
|
190
|
+
const n = B(t.include), s = B(t.exclude), a = t.other === !0 || t.other === "true", l = t.top !== void 0 ? Number(t.top) : null, u = t.sort, d = t.normalize === !0 || t.normalize === "true";
|
|
191
|
+
if (n || s) {
|
|
192
|
+
const i = [];
|
|
193
|
+
let f = 0;
|
|
194
|
+
for (let p = 0; p < e.length; p++) {
|
|
195
|
+
const b = e[p].toLowerCase(), m = n ? n.includes(b) : !0, h = s ? s.includes(b) : !1;
|
|
196
|
+
m && !h ? i.push({ label: e[p], value: r[p] }) : f += r[p];
|
|
171
197
|
}
|
|
172
|
-
|
|
198
|
+
a && f > 0 && i.push({ label: "Other", value: f }), e = i.map((p) => p.label), r = i.map((p) => p.value);
|
|
173
199
|
}
|
|
174
|
-
if (
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
e =
|
|
200
|
+
if (l && l > 0 && e.length > l) {
|
|
201
|
+
const i = e.map((m, h) => ({ label: m, value: r[h] }));
|
|
202
|
+
i.sort((m, h) => h.value - m.value);
|
|
203
|
+
const f = i.slice(0, l), b = i.slice(l).reduce((m, h) => m + h.value, 0);
|
|
204
|
+
e = f.map((m) => m.label), r = f.map((m) => m.value), a !== !1 && b > 0 && (e.push("Other"), r.push(b));
|
|
179
205
|
}
|
|
180
|
-
if (
|
|
181
|
-
const
|
|
182
|
-
|
|
206
|
+
if (u === "desc" || u === "asc") {
|
|
207
|
+
const i = e.map((f, p) => ({ label: f, value: r[p] }));
|
|
208
|
+
i.sort((f, p) => u === "desc" ? p.value - f.value : f.value - p.value), e = i.map((f) => f.label), r = i.map((f) => f.value);
|
|
183
209
|
}
|
|
184
210
|
if (d) {
|
|
185
|
-
const
|
|
186
|
-
|
|
211
|
+
const i = r.reduce((f, p) => f + p, 0);
|
|
212
|
+
i > 0 && (r = r.map((f) => f / i * 100));
|
|
187
213
|
}
|
|
188
|
-
const
|
|
189
|
-
for (let
|
|
190
|
-
e[
|
|
191
|
-
return { labels: e, values: r, colors:
|
|
214
|
+
const c = re(e, t);
|
|
215
|
+
for (let i = 0; i < e.length; i++)
|
|
216
|
+
e[i] === "Other" && (c[i] = "#6b7280");
|
|
217
|
+
return { labels: e, values: r, colors: c };
|
|
192
218
|
}
|
|
193
|
-
function
|
|
219
|
+
function Ce(o, t) {
|
|
194
220
|
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
221
|
}
|
|
196
|
-
function
|
|
222
|
+
function xe(o) {
|
|
197
223
|
const t = o.toLowerCase().trim();
|
|
198
224
|
return !(t.startsWith("javascript:") || t.startsWith("data:") || t.startsWith("vbscript:"));
|
|
199
225
|
}
|
|
200
|
-
function
|
|
201
|
-
const t =
|
|
226
|
+
function ne(o) {
|
|
227
|
+
const t = S(o.stats);
|
|
202
228
|
if (t.multiValues && Object.keys(t.multiValues).length > 1) {
|
|
203
|
-
const d = Object.keys(t.multiValues),
|
|
229
|
+
const d = Object.keys(t.multiValues), c = y(d.length);
|
|
204
230
|
return {
|
|
205
231
|
labels: t.labels,
|
|
206
|
-
datasets: d.map((
|
|
207
|
-
label:
|
|
208
|
-
data: t.multiValues[
|
|
209
|
-
backgroundColor: f
|
|
210
|
-
borderColor: f
|
|
232
|
+
datasets: d.map((i, f) => ({
|
|
233
|
+
label: i,
|
|
234
|
+
data: t.multiValues[i],
|
|
235
|
+
backgroundColor: c[f],
|
|
236
|
+
borderColor: c[f] + "cc",
|
|
211
237
|
borderWidth: 1,
|
|
212
238
|
borderRadius: 4,
|
|
213
239
|
borderSkipped: !1,
|
|
@@ -215,7 +241,7 @@ function I(o) {
|
|
|
215
241
|
}))
|
|
216
242
|
};
|
|
217
243
|
}
|
|
218
|
-
const { labels: e, values: r, colors:
|
|
244
|
+
const { labels: e, values: r, colors: n } = M(t, o.viz_params), s = n || y(e.length), a = [
|
|
219
245
|
{
|
|
220
246
|
label: "",
|
|
221
247
|
// Empty label — filtered from legend when threshold is shown
|
|
@@ -227,25 +253,25 @@ function I(o) {
|
|
|
227
253
|
borderSkipped: !1,
|
|
228
254
|
maxBarThickness: 64
|
|
229
255
|
}
|
|
230
|
-
],
|
|
231
|
-
return
|
|
256
|
+
], l = o.viz_params || {}, u = le(l, e.length);
|
|
257
|
+
return u && a.push(u), { labels: e, datasets: a };
|
|
232
258
|
}
|
|
233
|
-
function
|
|
234
|
-
const r =
|
|
259
|
+
function R(o, t = !1, e = !1) {
|
|
260
|
+
const r = S(o.stats), n = o.viz_params || {}, s = n.nulls;
|
|
235
261
|
if (r.multiValues && Object.keys(r.multiValues).length > 1) {
|
|
236
|
-
const
|
|
262
|
+
const c = Object.keys(r.multiValues), i = y(c.length);
|
|
237
263
|
return {
|
|
238
264
|
labels: r.labels,
|
|
239
|
-
datasets:
|
|
240
|
-
label:
|
|
241
|
-
data: r.multiValues[
|
|
242
|
-
borderColor:
|
|
243
|
-
backgroundColor: t ?
|
|
265
|
+
datasets: c.map((f, p) => ({
|
|
266
|
+
label: f,
|
|
267
|
+
data: r.multiValues[f],
|
|
268
|
+
borderColor: i[p],
|
|
269
|
+
backgroundColor: t ? i[p] + "33" : "transparent",
|
|
244
270
|
fill: t,
|
|
245
271
|
tension: e ? 0.4 : 0.1,
|
|
246
272
|
pointRadius: 3,
|
|
247
273
|
pointHoverRadius: 5,
|
|
248
|
-
pointBackgroundColor:
|
|
274
|
+
pointBackgroundColor: i[p],
|
|
249
275
|
pointBorderColor: "#1e1e2e",
|
|
250
276
|
pointBorderWidth: 2,
|
|
251
277
|
borderWidth: 2.5,
|
|
@@ -253,12 +279,12 @@ function O(o, t = !1, e = !1) {
|
|
|
253
279
|
}))
|
|
254
280
|
};
|
|
255
281
|
}
|
|
256
|
-
const { labels:
|
|
282
|
+
const { labels: a, values: l, colors: u } = M(r, n), d = u?.[0] || y(1)[0];
|
|
257
283
|
return {
|
|
258
|
-
labels:
|
|
284
|
+
labels: a,
|
|
259
285
|
datasets: [
|
|
260
286
|
{
|
|
261
|
-
data:
|
|
287
|
+
data: l,
|
|
262
288
|
borderColor: d,
|
|
263
289
|
backgroundColor: t ? d + "33" : "transparent",
|
|
264
290
|
fill: t,
|
|
@@ -275,24 +301,24 @@ function O(o, t = !1, e = !1) {
|
|
|
275
301
|
]
|
|
276
302
|
};
|
|
277
303
|
}
|
|
278
|
-
function
|
|
279
|
-
const e = parseInt(o.replace("#", ""), 16), r = Math.min(255, Math.max(0, (e >> 16 & 255) + t)),
|
|
280
|
-
return `#${(1 << 24 | r << 16 |
|
|
304
|
+
function se(o, t) {
|
|
305
|
+
const e = parseInt(o.replace("#", ""), 16), r = Math.min(255, Math.max(0, (e >> 16 & 255) + t)), n = Math.min(255, Math.max(0, (e >> 8 & 255) + t)), s = Math.min(255, Math.max(0, (e & 255) + t));
|
|
306
|
+
return `#${(1 << 24 | r << 16 | n << 8 | s).toString(16).slice(1)}`;
|
|
281
307
|
}
|
|
282
|
-
function
|
|
283
|
-
const t =
|
|
308
|
+
function ae(o) {
|
|
309
|
+
const t = S(o.stats);
|
|
284
310
|
if (t.multiValues && Object.keys(t.multiValues).length > 1) {
|
|
285
|
-
const
|
|
286
|
-
(
|
|
287
|
-
), d = [],
|
|
288
|
-
for (let
|
|
289
|
-
const
|
|
290
|
-
for (let b = 0; b <
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
293
|
-
d.push(`${t.labels[
|
|
294
|
-
const
|
|
295
|
-
|
|
311
|
+
const a = Object.keys(t.multiValues), l = y(t.labels.length), u = t.labels.map(
|
|
312
|
+
(f, p) => a.reduce((b, m) => b + (t.multiValues[m][p] ?? 0), 0)
|
|
313
|
+
), d = [], c = [], i = [];
|
|
314
|
+
for (let f = 0; f < t.labels.length; f++) {
|
|
315
|
+
const p = l[f];
|
|
316
|
+
for (let b = 0; b < a.length; b++) {
|
|
317
|
+
const m = t.multiValues[a[b]][f] ?? 0;
|
|
318
|
+
if (m > 0) {
|
|
319
|
+
d.push(`${t.labels[f]} • ${a[b]}`), c.push(m);
|
|
320
|
+
const h = Math.round((b - a.length / 2) / a.length * 60);
|
|
321
|
+
i.push(se(p, h));
|
|
296
322
|
}
|
|
297
323
|
}
|
|
298
324
|
}
|
|
@@ -302,8 +328,8 @@ function j(o) {
|
|
|
302
328
|
// Inner ring (primary field)
|
|
303
329
|
{
|
|
304
330
|
label: "Primary",
|
|
305
|
-
data:
|
|
306
|
-
backgroundColor:
|
|
331
|
+
data: u,
|
|
332
|
+
backgroundColor: l,
|
|
307
333
|
borderColor: "#1a1a2e",
|
|
308
334
|
borderWidth: 2,
|
|
309
335
|
hoverBorderColor: "#fff",
|
|
@@ -313,8 +339,8 @@ function j(o) {
|
|
|
313
339
|
// Outer ring (secondary breakdown)
|
|
314
340
|
{
|
|
315
341
|
label: "Detail",
|
|
316
|
-
data:
|
|
317
|
-
backgroundColor:
|
|
342
|
+
data: c,
|
|
343
|
+
backgroundColor: i,
|
|
318
344
|
borderColor: "#1a1a2e",
|
|
319
345
|
borderWidth: 1,
|
|
320
346
|
hoverBorderColor: "#fff",
|
|
@@ -324,7 +350,7 @@ function j(o) {
|
|
|
324
350
|
]
|
|
325
351
|
};
|
|
326
352
|
}
|
|
327
|
-
const { labels: e, values: r, colors:
|
|
353
|
+
const { labels: e, values: r, colors: n } = M(t, o.viz_params), s = n || y(e.length);
|
|
328
354
|
return {
|
|
329
355
|
labels: e,
|
|
330
356
|
datasets: [
|
|
@@ -341,8 +367,8 @@ function j(o) {
|
|
|
341
367
|
};
|
|
342
368
|
}
|
|
343
369
|
const L = { duration: 600, easing: "easeOutQuart" };
|
|
344
|
-
function
|
|
345
|
-
const e = o?.format, r = o?.tooltip === "all" || o?.crosshair === !0,
|
|
370
|
+
function F(o, t = !1) {
|
|
371
|
+
const e = o?.format, r = o?.tooltip === "all" || o?.crosshair === !0, n = o?.y_label;
|
|
346
372
|
return {
|
|
347
373
|
enabled: !0,
|
|
348
374
|
mode: r ? "index" : "nearest",
|
|
@@ -363,14 +389,14 @@ function W(o, t = !1) {
|
|
|
363
389
|
title: (s) => s[0]?.label ?? "",
|
|
364
390
|
// Body: formatted value, optionally with series name for multi-series
|
|
365
391
|
label: (s) => {
|
|
366
|
-
const
|
|
367
|
-
let
|
|
368
|
-
return e ?
|
|
392
|
+
const a = s.parsed.y ?? s.parsed.x ?? 0;
|
|
393
|
+
let l;
|
|
394
|
+
return e ? l = j(a, e) : n ? l = (Number.isInteger(a) ? a.toLocaleString() : a.toFixed(2)) + " " + n : l = Number.isInteger(a) ? a.toLocaleString() : a.toFixed(2), t && s.dataset.label ? `${s.dataset.label}: ${l}` : l;
|
|
369
395
|
}
|
|
370
396
|
}
|
|
371
397
|
};
|
|
372
398
|
}
|
|
373
|
-
function
|
|
399
|
+
function H(o) {
|
|
374
400
|
const t = o?.labels;
|
|
375
401
|
if (!t || t === "false" || t === !1) return { display: !1 };
|
|
376
402
|
const e = o?.format;
|
|
@@ -381,10 +407,10 @@ function B(o) {
|
|
|
381
407
|
anchor: "end",
|
|
382
408
|
align: "top",
|
|
383
409
|
offset: 4,
|
|
384
|
-
formatter: e ? (r) =>
|
|
410
|
+
formatter: e ? (r) => j(r, e) : void 0
|
|
385
411
|
};
|
|
386
412
|
}
|
|
387
|
-
function
|
|
413
|
+
function le(o, t) {
|
|
388
414
|
const e = o?.threshold;
|
|
389
415
|
if (e == null) return null;
|
|
390
416
|
const r = o?.threshold_color || "#ef4444";
|
|
@@ -404,8 +430,8 @@ function E(o, t) {
|
|
|
404
430
|
// Don't show "5" above each threshold point
|
|
405
431
|
};
|
|
406
432
|
}
|
|
407
|
-
function
|
|
408
|
-
const e = o || {}, r = e.title,
|
|
433
|
+
function g(o, t = !1) {
|
|
434
|
+
const e = o || {}, r = e.title, n = e.stacked === !0 || e.stacked === "true", s = e.horizontal === !0, a = e.format, l = e.normalize === !0 || e.normalize === "true", u = e.threshold !== void 0;
|
|
409
435
|
return {
|
|
410
436
|
responsive: !0,
|
|
411
437
|
maintainAspectRatio: !1,
|
|
@@ -418,7 +444,7 @@ function y(o, t = !1) {
|
|
|
418
444
|
},
|
|
419
445
|
plugins: {
|
|
420
446
|
legend: {
|
|
421
|
-
display: t ||
|
|
447
|
+
display: t || u,
|
|
422
448
|
labels: {
|
|
423
449
|
color: "#c0c0c0",
|
|
424
450
|
font: { size: 12 },
|
|
@@ -426,7 +452,7 @@ function y(o, t = !1) {
|
|
|
426
452
|
usePointStyle: !0,
|
|
427
453
|
pointStyleWidth: 10,
|
|
428
454
|
// Hide the bar dataset from legend when threshold is shown (only show threshold line label)
|
|
429
|
-
filter:
|
|
455
|
+
filter: u && !t ? (d) => d.text !== void 0 && d.text !== "" : void 0
|
|
430
456
|
}
|
|
431
457
|
},
|
|
432
458
|
title: {
|
|
@@ -436,12 +462,12 @@ function y(o, t = !1) {
|
|
|
436
462
|
font: { size: 15, weight: "600" },
|
|
437
463
|
padding: { top: 4, bottom: 16 }
|
|
438
464
|
},
|
|
439
|
-
tooltip:
|
|
440
|
-
datalabels:
|
|
465
|
+
tooltip: F(e, t),
|
|
466
|
+
datalabels: H(e)
|
|
441
467
|
},
|
|
442
468
|
scales: {
|
|
443
469
|
x: {
|
|
444
|
-
stacked:
|
|
470
|
+
stacked: n,
|
|
445
471
|
title: {
|
|
446
472
|
display: !!e.x_label,
|
|
447
473
|
text: e.x_label || "",
|
|
@@ -456,16 +482,16 @@ function y(o, t = !1) {
|
|
|
456
482
|
autoSkip: !0,
|
|
457
483
|
maxTicksLimit: 15,
|
|
458
484
|
padding: 4,
|
|
459
|
-
callback: s ?
|
|
485
|
+
callback: s ? W(l ? "percent_raw" : a) : void 0
|
|
460
486
|
},
|
|
461
487
|
grid: { color: "#ffffff08", drawTicks: !1 },
|
|
462
488
|
border: { color: "#333" }
|
|
463
489
|
},
|
|
464
490
|
y: {
|
|
465
|
-
stacked:
|
|
491
|
+
stacked: n,
|
|
466
492
|
beginAtZero: !0,
|
|
467
493
|
min: e.y_min !== void 0 ? Number(e.y_min) : void 0,
|
|
468
|
-
max: e.y_max !== void 0 ? Number(e.y_max) :
|
|
494
|
+
max: e.y_max !== void 0 ? Number(e.y_max) : l ? 100 : void 0,
|
|
469
495
|
title: {
|
|
470
496
|
display: !!e.y_label,
|
|
471
497
|
text: e.y_label || "",
|
|
@@ -477,9 +503,9 @@ function y(o, t = !1) {
|
|
|
477
503
|
color: "#888",
|
|
478
504
|
font: { size: 11 },
|
|
479
505
|
padding: 8,
|
|
480
|
-
callback: s ? void 0 :
|
|
506
|
+
callback: s ? void 0 : W(l ? "percent_raw" : a),
|
|
481
507
|
// Prevent duplicate formatted ticks: force integer step for small ranges
|
|
482
|
-
...
|
|
508
|
+
...a && a !== "percent_raw" && a !== "percent" ? { stepSize: 1 } : {}
|
|
483
509
|
},
|
|
484
510
|
grid: { color: "#ffffff0a" },
|
|
485
511
|
border: { display: !1 }
|
|
@@ -487,12 +513,12 @@ function y(o, t = !1) {
|
|
|
487
513
|
}
|
|
488
514
|
};
|
|
489
515
|
}
|
|
490
|
-
function
|
|
491
|
-
const e =
|
|
516
|
+
function U(o, t = !1) {
|
|
517
|
+
const e = g(o, t);
|
|
492
518
|
return e.scales.x.grid = { color: "transparent", drawTicks: !1 }, e;
|
|
493
519
|
}
|
|
494
|
-
function
|
|
495
|
-
const r = o || {},
|
|
520
|
+
function $(o, t = !1, e = !1) {
|
|
521
|
+
const r = o || {}, n = r.title, s = r.legend || "right", a = r.format;
|
|
496
522
|
return {
|
|
497
523
|
responsive: !0,
|
|
498
524
|
maintainAspectRatio: !1,
|
|
@@ -514,31 +540,274 @@ function x(o, t = !1, e = !1) {
|
|
|
514
540
|
}
|
|
515
541
|
},
|
|
516
542
|
title: {
|
|
517
|
-
display: !!
|
|
518
|
-
text:
|
|
543
|
+
display: !!n,
|
|
544
|
+
text: n || "",
|
|
519
545
|
color: "#e0e0e0",
|
|
520
546
|
font: { size: 15, weight: "600" },
|
|
521
547
|
padding: { top: 4, bottom: 12 }
|
|
522
548
|
},
|
|
523
549
|
tooltip: {
|
|
524
|
-
...
|
|
550
|
+
...F(r),
|
|
525
551
|
// Pie/donut: label shows "category: value" — override for clean display
|
|
526
552
|
callbacks: {
|
|
527
553
|
title: () => "",
|
|
528
554
|
// No title for pie — label IS the title
|
|
529
|
-
label: (
|
|
530
|
-
const
|
|
531
|
-
return ` ${
|
|
555
|
+
label: (l) => {
|
|
556
|
+
const u = a ? j(l.parsed, a) : l.parsed.toLocaleString();
|
|
557
|
+
return ` ${l.label}: ${u}`;
|
|
532
558
|
}
|
|
533
559
|
}
|
|
534
560
|
},
|
|
535
|
-
datalabels:
|
|
561
|
+
datalabels: H(r)
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function k(o) {
|
|
566
|
+
const t = o.group_by;
|
|
567
|
+
return Array.isArray(t) ? t.map((e) => {
|
|
568
|
+
if (typeof e == "string") return { field: e, key: e, bucketType: "terms" };
|
|
569
|
+
const r = e ?? {}, n = r.key ?? r.field ?? "";
|
|
570
|
+
return {
|
|
571
|
+
field: r.field ?? null,
|
|
572
|
+
key: n,
|
|
573
|
+
bucketType: r.bucket?.type ?? "terms",
|
|
574
|
+
interval: r.bucket?.interval
|
|
575
|
+
};
|
|
576
|
+
}) : [];
|
|
577
|
+
}
|
|
578
|
+
function x(o) {
|
|
579
|
+
const t = O(o).results;
|
|
580
|
+
return Array.isArray(t) ? t : [];
|
|
581
|
+
}
|
|
582
|
+
const ie = /* @__PURE__ */ new Set(["key", "doc_count", "bucket_meta", "other", "aggregations", "key_as_string", "from", "to"]);
|
|
583
|
+
function _(o) {
|
|
584
|
+
const t = o.aggregations;
|
|
585
|
+
if (t && typeof t == "object") {
|
|
586
|
+
const e = Object.values(t)[0];
|
|
587
|
+
return e == null ? null : Number(e);
|
|
588
|
+
}
|
|
589
|
+
for (const [e, r] of Object.entries(o))
|
|
590
|
+
if (!ie.has(e)) {
|
|
591
|
+
if (r === null) return null;
|
|
592
|
+
if (typeof r == "number") return r;
|
|
593
|
+
}
|
|
594
|
+
return Number(o.doc_count ?? 0);
|
|
595
|
+
}
|
|
596
|
+
function v(o, t) {
|
|
597
|
+
const e = o.key;
|
|
598
|
+
return e && typeof e == "object" ? e[t] : e;
|
|
599
|
+
}
|
|
600
|
+
function G(o, t) {
|
|
601
|
+
return o.bucket_meta?.[t];
|
|
602
|
+
}
|
|
603
|
+
function N(o) {
|
|
604
|
+
const t = k(o).find((e) => e.bucketType === "date_histogram");
|
|
605
|
+
if (t) return t.key;
|
|
606
|
+
for (const e of x(o)) {
|
|
607
|
+
const r = e.bucket_meta;
|
|
608
|
+
for (const [n, s] of Object.entries(r ?? {}))
|
|
609
|
+
if (typeof s?.epoch_ms == "number") return n;
|
|
610
|
+
}
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
function ce(o, t) {
|
|
614
|
+
const e = G(o, t)?.epoch_ms;
|
|
615
|
+
if (typeof e == "number") return e;
|
|
616
|
+
const r = Date.parse(String(v(o, t)));
|
|
617
|
+
return Number.isNaN(r) ? null : r;
|
|
618
|
+
}
|
|
619
|
+
function ue(o, t) {
|
|
620
|
+
const e = o.stats, r = N(e);
|
|
621
|
+
if (!r) return null;
|
|
622
|
+
const n = k(e).find((b) => b.key !== r)?.key ?? null, s = x(e), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
623
|
+
for (const b of s) {
|
|
624
|
+
const m = ce(b, r);
|
|
625
|
+
if (m === null) continue;
|
|
626
|
+
a.add(m);
|
|
627
|
+
const h = n ? String(v(b, n) ?? "(empty)") : "value";
|
|
628
|
+
l.has(h) || l.set(h, /* @__PURE__ */ new Map()), l.get(h).set(m, _(b));
|
|
629
|
+
}
|
|
630
|
+
const u = [...a].sort((b, m) => b - m), d = [...l.keys()], c = y(d.length), i = t === "area" || t === "stacked_area", f = C(t) === "bar", p = o.viz_params || {};
|
|
631
|
+
return {
|
|
632
|
+
labels: [],
|
|
633
|
+
datasets: d.map((b, m) => {
|
|
634
|
+
const h = b === "Other" && n ? "#6b7280" : c[m], z = l.get(b), X = u.map((w) => ({ x: w, y: z.has(w) ? z.get(w) : null })), V = { label: n ? b : "", data: X };
|
|
635
|
+
return f ? { ...V, backgroundColor: h, borderColor: h + "cc", borderWidth: 1, borderRadius: 2, maxBarThickness: 48 } : {
|
|
636
|
+
...V,
|
|
637
|
+
borderColor: h,
|
|
638
|
+
backgroundColor: i ? h + "33" : "transparent",
|
|
639
|
+
fill: i ? t === "stacked_area" && m > 0 ? "-1" : "origin" : !1,
|
|
640
|
+
tension: p.smooth === !0 || p.smooth === "true" ? 0.4 : 0.1,
|
|
641
|
+
pointRadius: u.length > 60 ? 0 : 3,
|
|
642
|
+
borderWidth: 2,
|
|
643
|
+
spanGaps: p.nulls === "connect"
|
|
644
|
+
};
|
|
645
|
+
})
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
function de(o) {
|
|
649
|
+
if (!o || o === "auto") return;
|
|
650
|
+
if (["minute", "hour", "day", "week", "month", "quarter", "year"].includes(o)) return o;
|
|
651
|
+
const e = /^[0-9]+(ms|s|m|h|d)$/.exec(o)?.[1];
|
|
652
|
+
return e ? { ms: "millisecond", s: "second", m: "minute", h: "hour", d: "day" }[e] : void 0;
|
|
653
|
+
}
|
|
654
|
+
function fe(o, t) {
|
|
655
|
+
const e = o.viz_params || {}, r = t === "stacked_bar" || t === "stacked_area" || e.stacked === !0 || e.stacked === "true", n = C(t) === "bar" ? g({ ...e, stacked: r }, !0) : U({ ...e, stacked: r }, !0), s = N(o.stats), a = k(o.stats).find((d) => d.key === s), l = de(a?.interval), u = k(o.stats).some((d) => d.key !== s);
|
|
656
|
+
return {
|
|
657
|
+
...n,
|
|
658
|
+
interaction: { mode: "index", intersect: !1 },
|
|
659
|
+
plugins: {
|
|
660
|
+
...n.plugins,
|
|
661
|
+
legend: { ...n.plugins.legend, display: u },
|
|
662
|
+
tooltip: { ...n.plugins.tooltip, displayColors: u, callbacks: void 0 }
|
|
663
|
+
},
|
|
664
|
+
scales: {
|
|
665
|
+
...n.scales,
|
|
666
|
+
x: {
|
|
667
|
+
...n.scales.x,
|
|
668
|
+
type: "time",
|
|
669
|
+
stacked: r,
|
|
670
|
+
offset: C(t) === "bar",
|
|
671
|
+
time: l ? { unit: l } : {},
|
|
672
|
+
ticks: { ...n.scales.x.ticks, maxRotation: 0, autoSkip: !0, maxTicksLimit: 12, callback: void 0 }
|
|
673
|
+
},
|
|
674
|
+
y: { ...n.scales.y, stacked: r }
|
|
536
675
|
}
|
|
537
676
|
};
|
|
538
677
|
}
|
|
539
678
|
function q(o) {
|
|
679
|
+
const t = o.stats, e = k(t), r = x(t), n = e[0]?.key, s = e[1]?.key, a = r.map((c) => ({
|
|
680
|
+
x: String(n ? v(c, n) : D(c.key)),
|
|
681
|
+
y: s ? String(v(c, s)) : "value",
|
|
682
|
+
v: _(c)
|
|
683
|
+
})), l = [...new Set(a.map((c) => c.x))], u = [...new Set(a.map((c) => c.y))], d = Math.max(1, ...a.map((c) => c.v ?? 0));
|
|
684
|
+
return {
|
|
685
|
+
labels: [],
|
|
686
|
+
xLabels: l,
|
|
687
|
+
yLabels: u,
|
|
688
|
+
datasets: [
|
|
689
|
+
{
|
|
690
|
+
label: "",
|
|
691
|
+
data: a,
|
|
692
|
+
backgroundColor: (c) => `rgba(129, 140, 248, ${(0.08 + 0.92 * Math.max(0, Math.min(1, (c.raw?.v ?? 0) / d))).toFixed(3)})`,
|
|
693
|
+
borderColor: "#12121e",
|
|
694
|
+
borderWidth: 1,
|
|
695
|
+
width: (c) => Math.max(1, (c.chart.chartArea?.width ?? 0) / Math.max(1, l.length) - 1),
|
|
696
|
+
height: (c) => Math.max(1, (c.chart.chartArea?.height ?? 0) / Math.max(1, u.length) - 1)
|
|
697
|
+
}
|
|
698
|
+
]
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
function pe(o) {
|
|
702
|
+
const t = o.viz_params || {}, e = q(o), r = g(t, !1);
|
|
703
|
+
return {
|
|
704
|
+
...r,
|
|
705
|
+
plugins: {
|
|
706
|
+
...r.plugins,
|
|
707
|
+
legend: { display: !1 },
|
|
708
|
+
tooltip: {
|
|
709
|
+
...r.plugins.tooltip,
|
|
710
|
+
callbacks: {
|
|
711
|
+
title: () => "",
|
|
712
|
+
label: (n) => `${n.raw.x} • ${n.raw.y}: ${n.raw.v ?? "—"}`
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
scales: {
|
|
717
|
+
x: { type: "category", labels: e.xLabels, offset: !0, grid: { display: !1 }, ticks: r.scales.x.ticks },
|
|
718
|
+
y: { type: "category", labels: e.yLabels, offset: !0, grid: { display: !1 }, ticks: { color: "#888" } }
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
const be = "0123456789bcdefghjkmnpqrstuvwxyz";
|
|
723
|
+
function me(o) {
|
|
724
|
+
const t = /^([0-9]+)\/([0-9]+)\/([0-9]+)$/.exec(o);
|
|
725
|
+
if (t) {
|
|
726
|
+
const l = 2 ** Number(t[1]), u = Number(t[2]) + 0.5, d = Number(t[3]) + 0.5;
|
|
727
|
+
return { lat: Math.atan(Math.sinh(Math.PI * (1 - 2 * d / l))) * 180 / Math.PI, lon: u / l * 360 - 180 };
|
|
728
|
+
}
|
|
729
|
+
if (!/^[0-9b-hjkmnp-z]+$/.test(o)) return null;
|
|
730
|
+
let [e, r, n, s] = [-90, 90, -180, 180], a = !0;
|
|
731
|
+
for (const l of o) {
|
|
732
|
+
const u = be.indexOf(l);
|
|
733
|
+
for (let d = 4; d >= 0; d--) {
|
|
734
|
+
const c = u >> d & 1;
|
|
735
|
+
if (a) {
|
|
736
|
+
const i = (n + s) / 2;
|
|
737
|
+
c ? n = i : s = i;
|
|
738
|
+
} else {
|
|
739
|
+
const i = (e + r) / 2;
|
|
740
|
+
c ? e = i : r = i;
|
|
741
|
+
}
|
|
742
|
+
a = !a;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return { lat: (e + r) / 2, lon: (n + s) / 2 };
|
|
746
|
+
}
|
|
747
|
+
function Y(o) {
|
|
748
|
+
const t = o.stats, e = k(t), r = e.find((u) => u.bucketType === "geotile" || u.bucketType === "geohash") ?? e[0] ?? { key: "" }, n = e.find((u) => u !== r)?.key ?? null, s = /* @__PURE__ */ new Map();
|
|
749
|
+
for (const u of x(t)) {
|
|
750
|
+
if (!r) break;
|
|
751
|
+
const d = String(v(u, r.key) ?? ""), c = G(u, r.key), i = typeof c?.lat == "number" && typeof c?.lon == "number" ? { lat: c.lat, lon: c.lon } : me(d);
|
|
752
|
+
if (!i) continue;
|
|
753
|
+
const f = n ? String(v(u, n)) : "";
|
|
754
|
+
s.has(f) || s.set(f, []), s.get(f).push({
|
|
755
|
+
latitude: i.lat,
|
|
756
|
+
longitude: i.lon,
|
|
757
|
+
lat: i.lat,
|
|
758
|
+
lon: i.lon,
|
|
759
|
+
value: _(u),
|
|
760
|
+
key: d
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
const a = [...s.keys()], l = y(Math.max(1, a.length));
|
|
764
|
+
return {
|
|
765
|
+
labels: [],
|
|
766
|
+
datasets: a.map((u, d) => ({
|
|
767
|
+
label: u,
|
|
768
|
+
data: s.get(u),
|
|
769
|
+
backgroundColor: l[d] + "99",
|
|
770
|
+
borderColor: l[d],
|
|
771
|
+
borderWidth: 1
|
|
772
|
+
}))
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
function he(o) {
|
|
776
|
+
const t = o.viz_params || {}, e = Y(o), r = t.title;
|
|
777
|
+
return {
|
|
778
|
+
responsive: !0,
|
|
779
|
+
maintainAspectRatio: !1,
|
|
780
|
+
animation: L,
|
|
781
|
+
plugins: {
|
|
782
|
+
legend: { display: e.datasets.length > 1 },
|
|
783
|
+
title: { display: !!r, text: r || "", color: "#e0e0e0" },
|
|
784
|
+
tooltip: {
|
|
785
|
+
callbacks: {
|
|
786
|
+
label: (n) => `${n.raw.key}: ${n.raw.value ?? "—"}`
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
scales: {
|
|
791
|
+
projection: { axis: "x", projection: t.projection || "equalEarth" },
|
|
792
|
+
size: { axis: "x", size: [3, 24] }
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
const we = ["treemap", "sunburst", "chord", "nested_pie", "nested_donut"];
|
|
797
|
+
function Ae(o) {
|
|
798
|
+
return typeof o == "object" && o !== null && o.unsupported === !0;
|
|
799
|
+
}
|
|
800
|
+
function Q(o) {
|
|
801
|
+
return {
|
|
802
|
+
unsupported: !0,
|
|
803
|
+
type: o,
|
|
804
|
+
reason: `Chart type "${o}" is not supported by the TQL chart mappers`
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
function C(o) {
|
|
540
808
|
switch (o) {
|
|
541
809
|
case "bar":
|
|
810
|
+
case "barchart":
|
|
542
811
|
case "stacked_bar":
|
|
543
812
|
case "grouped_bar":
|
|
544
813
|
case "horizontal_bar":
|
|
@@ -553,61 +822,93 @@ function q(o) {
|
|
|
553
822
|
return "doughnut";
|
|
554
823
|
case "scatter":
|
|
555
824
|
return "scatter";
|
|
825
|
+
case "heatmap":
|
|
826
|
+
return "matrix";
|
|
827
|
+
case "map":
|
|
828
|
+
return "bubbleMap";
|
|
556
829
|
default:
|
|
557
|
-
return
|
|
830
|
+
return null;
|
|
558
831
|
}
|
|
559
832
|
}
|
|
560
|
-
|
|
561
|
-
|
|
833
|
+
const ye = /* @__PURE__ */ new Set(["line", "area", "stacked_area", "bar", "barchart", "stacked_bar", "grouped_bar"]);
|
|
834
|
+
function J(o, t, e) {
|
|
835
|
+
return e.timeAxis !== !1 && ye.has(t) && N(o.stats) !== null;
|
|
836
|
+
}
|
|
837
|
+
function je(o, t, e = {}) {
|
|
838
|
+
if (C(t) === null) return Q(t);
|
|
839
|
+
const r = o.viz_params || {};
|
|
840
|
+
if (J(o, t, e)) return ue(o, t);
|
|
562
841
|
switch (t) {
|
|
563
842
|
case "line":
|
|
564
|
-
return
|
|
843
|
+
return R(o, !1, r.smooth === !0 || r.smooth === "true");
|
|
565
844
|
case "area":
|
|
566
845
|
case "stacked_area":
|
|
567
|
-
return
|
|
846
|
+
return R(o, !0, r.smooth === !0 || r.smooth === "true");
|
|
568
847
|
case "pie":
|
|
569
|
-
return j(o);
|
|
570
848
|
case "donut":
|
|
571
|
-
return
|
|
849
|
+
return ae(o);
|
|
850
|
+
case "heatmap":
|
|
851
|
+
return q(o);
|
|
852
|
+
case "map":
|
|
853
|
+
return Y(o);
|
|
572
854
|
default:
|
|
573
|
-
return
|
|
855
|
+
return ne(o);
|
|
574
856
|
}
|
|
575
857
|
}
|
|
576
|
-
function
|
|
577
|
-
|
|
858
|
+
function Oe(o, t, e = {}) {
|
|
859
|
+
if (C(t) === null) return Q(t);
|
|
860
|
+
if (J(o, t, e)) return fe(o, t);
|
|
861
|
+
const r = o.viz_params || {}, n = O(o.stats), s = K(n);
|
|
578
862
|
switch (t) {
|
|
579
863
|
case "line":
|
|
580
864
|
case "area":
|
|
581
865
|
case "stacked_area":
|
|
582
|
-
return
|
|
866
|
+
return U(r, s);
|
|
583
867
|
case "pie":
|
|
584
|
-
return
|
|
868
|
+
return $(r, !1, s);
|
|
585
869
|
case "donut":
|
|
586
|
-
return
|
|
870
|
+
return $(r, !0, s);
|
|
587
871
|
case "horizontal_bar":
|
|
588
|
-
return
|
|
872
|
+
return g({ ...r, horizontal: !0 }, s);
|
|
589
873
|
case "stacked_bar":
|
|
590
|
-
return
|
|
874
|
+
return g({ ...r, stacked: !0 }, s);
|
|
875
|
+
case "heatmap":
|
|
876
|
+
return pe(o);
|
|
877
|
+
case "map":
|
|
878
|
+
return he(o);
|
|
591
879
|
default:
|
|
592
|
-
return
|
|
880
|
+
return g(r, s);
|
|
593
881
|
}
|
|
594
882
|
}
|
|
595
883
|
export {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
884
|
+
we as UNSUPPORTED_CHART_TYPES,
|
|
885
|
+
M as applyVizFilters,
|
|
886
|
+
ne as barChartData,
|
|
887
|
+
g as barChartOptions,
|
|
888
|
+
je as buildChartData,
|
|
889
|
+
Oe as buildChartOptions,
|
|
890
|
+
C as chartJsType,
|
|
891
|
+
me as decodeGeoCell,
|
|
892
|
+
Ce as expandLinkTemplate,
|
|
893
|
+
S as extractGroupedData,
|
|
894
|
+
_e as extractScalarValue,
|
|
895
|
+
k as groupLevels,
|
|
896
|
+
q as heatmapData,
|
|
897
|
+
pe as heatmapOptions,
|
|
898
|
+
xe as isLinkTemplateSafe,
|
|
899
|
+
ve as isTimeSeriesData,
|
|
900
|
+
Ae as isUnsupportedChart,
|
|
901
|
+
R as lineChartData,
|
|
902
|
+
U as lineChartOptions,
|
|
903
|
+
Y as mapData,
|
|
904
|
+
he as mapOptions,
|
|
905
|
+
O as normalizeOpenSearchAggs,
|
|
906
|
+
oe as parseColorMap,
|
|
907
|
+
ae as pieChartData,
|
|
908
|
+
$ as pieChartOptions,
|
|
909
|
+
_ as rowMetricValue,
|
|
910
|
+
N as timeLevelKey,
|
|
911
|
+
ue as timeSeriesData,
|
|
912
|
+
fe as timeSeriesOptions,
|
|
913
|
+
de as timeUnitForInterval
|
|
613
914
|
};
|