react-semaphor 0.1.385 → 0.1.387

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.
@@ -1,24 +1,24 @@
1
- import { toSemaphorInputSnapshots as qr, toSemaphorInputBinding as Ar, toSemaphorActiveInputSnapshots as U, toSemaphorMatrixIntent as Rr, toSemaphorSqlIntent as Er, toSemaphorInputOptionsIntent as Tr, toSemaphorRecordsIntent as kr, toSemaphorAnalysisQueryOptions as Cr, toSemaphorAnalysisIntent as Dr, toSemaphorMetricIntent as Or, hasSemaphorInputValue as re, normalizeSemaphorInputOptions as Ze, toSemaphorInputSpec as er } from "../data-app-sdk-adapters/index.js";
2
- import { jsxs as p, Fragment as Lr, jsx as s } from "react/jsx-runtime";
3
- import { createContext as fe, useContext as z, useState as Q, useRef as k, useEffect as L, useMemo as b, useId as rr, useCallback as C, useReducer as Br } from "react";
4
- import { M as Kr, a as $r, S as _r, E as Nr } from "../chunks/search-0LmWwZzW.js";
5
- import { X as Fr, j as Mr } from "../chunks/x-IdR_js6f.js";
6
- import { b as Wr } from "../chunks/validators-CHPH6ORs.js";
1
+ import { toSemaphorInputSnapshots as Rt, toSemaphorInputBinding as Et, toSemaphorActiveInputSnapshots as U, toSemaphorMatrixIntent as kt, toSemaphorSqlIntent as Ct, toSemaphorInputOptionsIntent as Dt, toSemaphorRecordsIntent as Lt, toSemaphorAnalysisQueryOptions as Ot, toSemaphorAnalysisIntent as Bt, toSemaphorMetricIntent as Kt, hasSemaphorInputValue as re, normalizeSemaphorInputOptions as tt, toSemaphorInputSpec as rt } from "../data-app-sdk-adapters/index.js";
2
+ import { jsxs as p, Fragment as $t, jsx as s } from "react/jsx-runtime";
3
+ import { createContext as pe, useContext as z, useState as Q, useRef as C, useEffect as B, useMemo as b, useId as nt, useCallback as D, useReducer as _t } from "react";
4
+ import { M as Nt, a as Ft, S as Wt, E as Mt } from "../chunks/search-0LmWwZzW.js";
5
+ import { X as zt, j as jt } from "../chunks/x-IdR_js6f.js";
6
+ import { b as Ht } from "../chunks/validators-CHPH6ORs.js";
7
7
  import "../chunks/analyze-result-contract-DuhlklhI.js";
8
- function ie(e, r, t = {}) {
8
+ function oe(e, t, r = {}) {
9
9
  return {
10
- ...t,
10
+ ...r,
11
11
  name: e,
12
- role: r
12
+ role: t
13
13
  };
14
14
  }
15
- function Wn(e) {
15
+ function Qn(e) {
16
16
  return e;
17
17
  }
18
- function zn(e) {
18
+ function Un(e) {
19
19
  return e;
20
20
  }
21
- const jn = {
21
+ const Gn = {
22
22
  source: {
23
23
  semantic(e) {
24
24
  return {
@@ -34,17 +34,17 @@ const jn = {
34
34
  }
35
35
  },
36
36
  field: {
37
- measure(e, r) {
38
- return ie(e, "measure", r);
37
+ measure(e, t) {
38
+ return oe(e, "measure", t);
39
39
  },
40
- dimension(e, r) {
41
- return ie(e, "dimension", r);
40
+ dimension(e, t) {
41
+ return oe(e, "dimension", t);
42
42
  },
43
- date(e, r) {
44
- return ie(e, "date", r);
43
+ date(e, t) {
44
+ return oe(e, "date", t);
45
45
  },
46
- id(e, r) {
47
- return ie(e, "id", r);
46
+ id(e, t) {
47
+ return oe(e, "id", t);
48
48
  }
49
49
  },
50
50
  filter(e) {
@@ -53,15 +53,15 @@ const jn = {
53
53
  kind: "filter"
54
54
  };
55
55
  },
56
- bindInput(e, r) {
56
+ bindInput(e, t) {
57
57
  return {
58
58
  toAnalyticsInput() {
59
- const [t] = qr([e]), n = Ar({
60
- ...r,
61
- inputId: r.inputId || t.inputId
59
+ const [r] = Rt([e]), n = Et({
60
+ ...t,
61
+ inputId: t.inputId || r.inputId
62
62
  });
63
63
  return {
64
- ...t,
64
+ ...r,
65
65
  inputId: n.inputId,
66
66
  ...n.kind ? { kind: n.kind } : {},
67
67
  ...n.controlRole ? { controlRole: n.controlRole } : {},
@@ -128,144 +128,144 @@ const jn = {
128
128
  queryKind: "matrix"
129
129
  };
130
130
  }
131
- }, ye = 10, he = 100, zr = 25, jr = 500, tr = {
131
+ }, he = 10, ve = 100, Pt = 25, Vt = 500, it = {
132
132
  enabled: !1,
133
133
  queries: [],
134
134
  getQuery: () => {
135
135
  },
136
136
  getQueries: () => []
137
- }, Te = fe(null), ke = fe(null), Ce = fe(
137
+ }, ke = pe(null), Ce = pe(null), De = pe(
138
138
  void 0
139
- ), W = [];
140
- function Hr({
139
+ ), M = [];
140
+ function Qt({
141
141
  debug: e,
142
- children: r
142
+ children: t
143
143
  }) {
144
- const t = b(() => Mt(e), [e]), [n, i] = Br(
145
- Ct,
146
- t,
147
- fr
148
- ), l = k(n), u = rr(), [c, d] = Q({ open: !1 });
149
- l.current = n, L(() => {
150
- i({ type: "config", config: t });
151
- }, [t]), L(() => {
144
+ const r = b(() => Vr(e), [e]), [n, i] = _t(
145
+ $r,
146
+ r,
147
+ yt
148
+ ), o = C(n), u = nt(), [c, d] = Q({ open: !1 });
149
+ o.current = n, B(() => {
150
+ i({ type: "config", config: r });
151
+ }, [r]), B(() => {
152
152
  if (!n.enabled || !n.exposeWindowBridge || typeof window > "u")
153
153
  return;
154
- const S = $t(() => l.current);
155
- return Pr({
154
+ const S = zr(() => o.current);
155
+ return Ut({
156
156
  ownerId: u,
157
157
  bridge: S
158
158
  }), () => {
159
- Vr(u);
159
+ Gt(u);
160
160
  };
161
161
  }, [u, n.enabled, n.exposeWindowBridge]);
162
- const f = b(() => ({ state: n, dispatch: i }), [n]), g = C((S) => {
162
+ const f = b(() => ({ state: n, dispatch: i }), [n]), y = D((S) => {
163
163
  d({ open: !0, focus: S });
164
- }, []), y = C(() => {
164
+ }, []), g = D(() => {
165
165
  d((S) => ({ ...S, open: !1 }));
166
- }, []), h = C((S) => {
166
+ }, []), h = D((S) => {
167
167
  d({ open: !0, focus: S });
168
168
  }, []), m = b(
169
169
  () => ({
170
170
  open: c.open,
171
171
  focus: c.focus,
172
- openDevtools: g,
173
- closeDevtools: y,
172
+ openDevtools: y,
173
+ closeDevtools: g,
174
174
  focusTrace: h
175
175
  }),
176
176
  [
177
- y,
178
- h,
179
177
  g,
178
+ h,
179
+ y,
180
180
  c.focus,
181
181
  c.open
182
182
  ]
183
183
  );
184
- return /* @__PURE__ */ s(Te.Provider, { value: f, children: /* @__PURE__ */ s(ke.Provider, { value: m, children: r }) });
184
+ return /* @__PURE__ */ s(ke.Provider, { value: f, children: /* @__PURE__ */ s(Ce.Provider, { value: m, children: t }) });
185
185
  }
186
- function Pr(e) {
187
- const r = W.findIndex(
188
- (t) => t.ownerId === e.ownerId
186
+ function Ut(e) {
187
+ const t = M.findIndex(
188
+ (r) => r.ownerId === e.ownerId
189
189
  );
190
- r >= 0 && W.splice(r, 1), W.push(e), nr();
190
+ t >= 0 && M.splice(t, 1), M.push(e), ot();
191
191
  }
192
- function Vr(e) {
193
- const r = W.findIndex(
194
- (t) => t.ownerId === e
192
+ function Gt(e) {
193
+ const t = M.findIndex(
194
+ (r) => r.ownerId === e
195
195
  );
196
- r >= 0 && W.splice(r, 1), nr();
196
+ t >= 0 && M.splice(t, 1), ot();
197
197
  }
198
- function nr() {
198
+ function ot() {
199
199
  if (typeof window > "u")
200
200
  return;
201
- const e = W[W.length - 1];
201
+ const e = M[M.length - 1];
202
202
  e ? window.__SEMAPHOR_DEVTOOLS__ = e.bridge : delete window.__SEMAPHOR_DEVTOOLS__;
203
203
  }
204
- function Hn({
204
+ function Jn({
205
205
  id: e,
206
- title: r,
207
- children: t
206
+ title: t,
207
+ children: r
208
208
  }) {
209
- const n = b(() => ({ id: e, title: r }), [e, r]);
210
- return /* @__PURE__ */ s(Ce.Provider, { value: n, children: t });
209
+ const n = b(() => ({ id: e, title: t }), [e, t]);
210
+ return /* @__PURE__ */ s(De.Provider, { value: n, children: r });
211
211
  }
212
- function Qr({
212
+ function Jt({
213
213
  buttonPosition: e = "bottom-right",
214
- initialIsOpen: r = !1,
215
- panelPosition: t = "right",
214
+ initialIsOpen: t = !1,
215
+ panelPosition: r = "right",
216
216
  className: n,
217
217
  style: i
218
218
  } = {}) {
219
- const l = ir(), u = z(ke), [c, d] = Q(""), [f, g] = Q(!1), y = k(null), h = k(null), m = u == null ? void 0 : u.openDevtools, S = u == null ? void 0 : u.closeDevtools, R = (u == null ? void 0 : u.open) === !0;
220
- L(() => {
221
- cr();
222
- }, []), L(() => {
223
- r && l.enabled && (m == null || m());
224
- }, [r, l.enabled, m]), L(() => {
225
- if (!R || !S)
219
+ const o = st(), u = z(Ce), [c, d] = Q(""), [f, y] = Q(!1), g = C(null), h = C(null), m = u == null ? void 0 : u.openDevtools, S = u == null ? void 0 : u.closeDevtools, T = (u == null ? void 0 : u.open) === !0;
220
+ B(() => {
221
+ mt();
222
+ }, []), B(() => {
223
+ t && o.enabled && (m == null || m());
224
+ }, [t, o.enabled, m]), B(() => {
225
+ if (!T || !S)
226
226
  return;
227
227
  const v = (I) => {
228
- var E, O;
229
- const D = I.target;
230
- D instanceof Node && ((E = y.current) != null && E.contains(D) || (O = h.current) != null && O.contains(D) || S());
228
+ var R, O;
229
+ const L = I.target;
230
+ L instanceof Node && ((R = g.current) != null && R.contains(L) || (O = h.current) != null && O.contains(L) || S());
231
231
  };
232
232
  return document.addEventListener("pointerdown", v, !0), document.addEventListener("mousedown", v, !0), document.addEventListener("click", v, !0), () => {
233
233
  document.removeEventListener("pointerdown", v, !0), document.removeEventListener("mousedown", v, !0), document.removeEventListener("click", v, !0);
234
234
  };
235
- }, [S, R]);
236
- const o = b(
237
- () => it(l.queries),
238
- [l.queries]
239
- ), x = b(
240
- () => ot(l.queries, c),
241
- [l.queries, c]
242
- ), B = b(
243
- () => st(x),
244
- [x]
245
- ), T = b(
246
- () => or(x, u == null ? void 0 : u.focus) || x[0],
247
- [x, u == null ? void 0 : u.focus]
235
+ }, [S, T]);
236
+ const a = b(
237
+ () => ar(o.queries),
238
+ [o.queries]
239
+ ), w = b(
240
+ () => lr(o.queries, c),
241
+ [o.queries, c]
242
+ ), K = b(
243
+ () => ur(w),
244
+ [w]
245
+ ), E = b(
246
+ () => at(w, u == null ? void 0 : u.focus) || w[0],
247
+ [w, u == null ? void 0 : u.focus]
248
248
  );
249
- return !l.enabled || !u ? null : /* @__PURE__ */ p(Lr, { children: [
249
+ return !o.enabled || !u ? null : /* @__PURE__ */ p($t, { children: [
250
250
  /* @__PURE__ */ p(
251
251
  "button",
252
252
  {
253
- ref: y,
253
+ ref: g,
254
254
  type: "button",
255
255
  "aria-label": "Open Semaphor DevTools",
256
256
  title: "Open Semaphor DevTools",
257
257
  className: n ? `${$} ${n}` : $,
258
258
  style: {
259
- ...a.launcher,
260
- ...It(e),
261
- ...qt(o.severity),
259
+ ...l.launcher,
260
+ ...kr(e),
261
+ ...Cr(a.severity),
262
262
  ...i
263
263
  },
264
264
  onClick: () => u.openDevtools(),
265
265
  children: [
266
- /* @__PURE__ */ s(Gr, {}),
267
- /* @__PURE__ */ s("span", { style: a.launcherText, children: o.total }),
268
- o.issueCount > 0 ? /* @__PURE__ */ s("span", { style: a.launcherIssueCount, children: o.issueCount }) : null
266
+ /* @__PURE__ */ s(Xt, {}),
267
+ /* @__PURE__ */ s("span", { style: l.launcherText, children: a.total }),
268
+ a.issueCount > 0 ? /* @__PURE__ */ s("span", { style: l.launcherIssueCount, children: a.issueCount }) : null
269
269
  ]
270
270
  }
271
271
  ),
@@ -278,34 +278,34 @@ function Qr({
278
278
  "aria-modal": "false",
279
279
  className: $,
280
280
  style: {
281
- ...a.panel,
282
- ...At(t),
283
- ...f ? a.panelFullscreen : null
281
+ ...l.panel,
282
+ ...Dr(r),
283
+ ...f ? l.panelFullscreen : null
284
284
  },
285
285
  children: [
286
- /* @__PURE__ */ p("div", { style: a.panelHeader, children: [
287
- /* @__PURE__ */ p("div", { style: a.panelTitleBlock, children: [
288
- /* @__PURE__ */ s("div", { style: a.panelTitle, children: "Semaphor DevTools" }),
289
- /* @__PURE__ */ p("div", { style: a.panelSubtitle, children: [
290
- o.total,
286
+ /* @__PURE__ */ p("div", { style: l.panelHeader, children: [
287
+ /* @__PURE__ */ p("div", { style: l.panelTitleBlock, children: [
288
+ /* @__PURE__ */ s("div", { style: l.panelTitle, children: "Semaphor DevTools" }),
289
+ /* @__PURE__ */ p("div", { style: l.panelSubtitle, children: [
290
+ a.total,
291
291
  " queries · ",
292
- o.loading,
292
+ a.loading,
293
293
  " loading ·",
294
294
  " ",
295
- o.failed,
295
+ a.failed,
296
296
  " failed"
297
297
  ] })
298
298
  ] }),
299
- /* @__PURE__ */ p("div", { style: a.panelActions, children: [
299
+ /* @__PURE__ */ p("div", { style: l.panelActions, children: [
300
300
  /* @__PURE__ */ s(
301
301
  "button",
302
302
  {
303
303
  type: "button",
304
304
  "aria-label": f ? "Exit fullscreen Semaphor DevTools" : "Enter fullscreen Semaphor DevTools",
305
305
  title: f ? "Exit fullscreen Semaphor DevTools" : "Enter fullscreen Semaphor DevTools",
306
- style: a.iconButton,
307
- onClick: () => g((v) => !v),
308
- children: f ? /* @__PURE__ */ s(Kr, { size: 15 }) : /* @__PURE__ */ s($r, { size: 15 })
306
+ style: l.iconButton,
307
+ onClick: () => y((v) => !v),
308
+ children: f ? /* @__PURE__ */ s(Nt, { size: 15 }) : /* @__PURE__ */ s(Ft, { size: 15 })
309
309
  }
310
310
  ),
311
311
  /* @__PURE__ */ s(
@@ -313,15 +313,15 @@ function Qr({
313
313
  {
314
314
  type: "button",
315
315
  "aria-label": "Close Semaphor DevTools",
316
- style: a.iconButton,
316
+ style: l.iconButton,
317
317
  onClick: u.closeDevtools,
318
- children: /* @__PURE__ */ s(Fr, { size: 15 })
318
+ children: /* @__PURE__ */ s(zt, { size: 15 })
319
319
  }
320
320
  )
321
321
  ] })
322
322
  ] }),
323
- /* @__PURE__ */ p("label", { style: a.searchBox, children: [
324
- /* @__PURE__ */ s(_r, { size: 14 }),
323
+ /* @__PURE__ */ p("label", { style: l.searchBox, children: [
324
+ /* @__PURE__ */ s(Wt, { size: 14 }),
325
325
  /* @__PURE__ */ s(
326
326
  "input",
327
327
  {
@@ -329,7 +329,7 @@ function Qr({
329
329
  value: c,
330
330
  onChange: (v) => d(v.currentTarget.value),
331
331
  placeholder: "Search traces",
332
- style: a.searchInput
332
+ style: l.searchInput
333
333
  }
334
334
  )
335
335
  ] }),
@@ -337,34 +337,34 @@ function Qr({
337
337
  "div",
338
338
  {
339
339
  style: {
340
- ...a.panelBody,
341
- ...Rt(t)
340
+ ...l.panelBody,
341
+ ...Lr(r)
342
342
  },
343
343
  children: [
344
344
  /* @__PURE__ */ s(
345
345
  "div",
346
346
  {
347
347
  style: {
348
- ...a.queryList,
349
- ...Et()
348
+ ...l.queryList,
349
+ ...Or()
350
350
  },
351
351
  "aria-label": "Registered queries",
352
- children: x.length ? B.map((v) => /* @__PURE__ */ p("div", { style: a.queryGroup, children: [
353
- /* @__PURE__ */ p("div", { style: a.queryGroupHeader, children: [
352
+ children: w.length ? K.map((v) => /* @__PURE__ */ p("div", { style: l.queryGroup, children: [
353
+ /* @__PURE__ */ p("div", { style: l.queryGroupHeader, children: [
354
354
  /* @__PURE__ */ s("span", { children: v.title }),
355
- /* @__PURE__ */ s("span", { style: a.queryGroupCount, children: v.traces.length })
355
+ /* @__PURE__ */ s("span", { style: l.queryGroupCount, children: v.traces.length })
356
356
  ] }),
357
357
  v.traces.length ? v.traces.map((I) => {
358
- var K;
359
- const D = lt(I, T), E = De(I), O = sr(I.queryKind), w = pe(I);
358
+ var J;
359
+ const L = cr(I, E), R = Le(I), O = ut(I), x = lt(I), k = me(I);
360
360
  return /* @__PURE__ */ p(
361
361
  "button",
362
362
  {
363
363
  type: "button",
364
- title: `${E} · ${O} · ${w}`,
364
+ title: `${R} · ${O} · ${k}`,
365
365
  style: {
366
- ...a.queryListItem,
367
- ...D ? a.queryListItemSelected : null
366
+ ...l.queryListItem,
367
+ ...L ? l.queryListItemSelected : null
368
368
  },
369
369
  onClick: () => u.focusTrace({
370
370
  traceId: I.traceId,
@@ -372,29 +372,38 @@ function Qr({
372
372
  viewId: I.viewId
373
373
  }),
374
374
  children: [
375
- /* @__PURE__ */ p("span", { style: a.queryListItemHeader, children: [
376
- /* @__PURE__ */ s(Yr, { status: (K = I.latestAttempt) == null ? void 0 : K.status }),
377
- /* @__PURE__ */ s("span", { style: a.queryListTitle, title: E, children: E }),
378
- /* @__PURE__ */ s("span", { style: a.queryListKindChip, children: O })
375
+ /* @__PURE__ */ p("span", { style: l.queryListItemHeader, children: [
376
+ /* @__PURE__ */ s(er, { status: (J = I.latestAttempt) == null ? void 0 : J.status }),
377
+ /* @__PURE__ */ s("span", { style: l.queryListTitle, title: R, children: R }),
378
+ /* @__PURE__ */ s("span", { style: l.queryListKindChip, children: O })
379
379
  ] }),
380
380
  /* @__PURE__ */ s(
381
381
  "span",
382
382
  {
383
383
  className: `${$}-source`,
384
- style: a.queryListSource,
385
- title: w,
386
- children: w
384
+ style: l.queryListSource,
385
+ title: `${x} · ${k}`,
386
+ children: x
387
+ }
388
+ ),
389
+ /* @__PURE__ */ s(
390
+ "span",
391
+ {
392
+ className: `${$}-source`,
393
+ style: l.queryListSourceSecondary,
394
+ title: k,
395
+ children: k
387
396
  }
388
397
  )
389
398
  ]
390
399
  },
391
400
  Re(I)
392
401
  );
393
- }) : /* @__PURE__ */ s("div", { style: a.queryGroupEmpty, children: "No input traces" })
394
- ] }, v.title)) : /* @__PURE__ */ s("div", { style: a.emptyState, children: "No matching traces" })
402
+ }) : /* @__PURE__ */ s("div", { style: l.queryGroupEmpty, children: "No input traces" })
403
+ ] }, v.title)) : /* @__PURE__ */ s("div", { style: l.emptyState, children: "No matching traces" })
395
404
  }
396
405
  ),
397
- /* @__PURE__ */ s(Jr, { trace: T })
406
+ /* @__PURE__ */ s(Zt, { trace: E })
398
407
  ]
399
408
  }
400
409
  )
@@ -403,42 +412,42 @@ function Qr({
403
412
  ) : null
404
413
  ] });
405
414
  }
406
- function Pn({
415
+ function Yn({
407
416
  queryId: e,
408
- viewId: r,
409
- label: t,
417
+ viewId: t,
418
+ label: r,
410
419
  className: n,
411
420
  style: i
412
421
  } = {}) {
413
- var y, h;
414
- const l = ir(), u = z(ke), c = z(Ce);
415
- L(() => {
416
- cr();
422
+ var g, h;
423
+ const o = st(), u = z(Ce), c = z(De);
424
+ B(() => {
425
+ mt();
417
426
  }, []);
418
- const d = r || (c == null ? void 0 : c.id), f = b(
419
- () => at(l.queries, {
427
+ const d = t || (c == null ? void 0 : c.id), f = b(
428
+ () => dr(o.queries, {
420
429
  queryId: e,
421
430
  viewId: d
422
431
  }),
423
432
  [
424
- l.queries,
433
+ o.queries,
425
434
  e,
426
435
  d
427
436
  ]
428
437
  );
429
- if (!l.enabled || !u || !f)
438
+ if (!o.enabled || !u || !f)
430
439
  return null;
431
- const g = t || `Inspect ${De(f)}`;
440
+ const y = r || `Inspect ${pr(f, !!e)}`;
432
441
  return /* @__PURE__ */ p(
433
442
  "button",
434
443
  {
435
444
  type: "button",
436
- "aria-label": g,
437
- title: g,
445
+ "aria-label": y,
446
+ title: y,
438
447
  className: n ? `${$} ${n}` : $,
439
448
  style: {
440
- ...a.inspectButton,
441
- ...Tt((y = f.latestAttempt) == null ? void 0 : y.status),
449
+ ...l.inspectButton,
450
+ ...Br((g = f.latestAttempt) == null ? void 0 : g.status),
442
451
  ...i
443
452
  },
444
453
  onClick: () => u.openDevtools({
@@ -447,25 +456,25 @@ function Pn({
447
456
  viewId: f.viewId
448
457
  }),
449
458
  children: [
450
- /* @__PURE__ */ s(Nr, { size: 13 }),
451
- /* @__PURE__ */ s("span", { style: a.inspectButtonText, children: ((h = f.latestAttempt) == null ? void 0 : h.status) || "idle" })
459
+ /* @__PURE__ */ s(Mt, { size: 13 }),
460
+ /* @__PURE__ */ s("span", { style: l.inspectButtonText, children: ((h = f.latestAttempt) == null ? void 0 : h.status) || "idle" })
452
461
  ]
453
462
  }
454
463
  );
455
464
  }
456
- function ir() {
457
- const e = z(Te);
458
- return !e || !e.state.enabled ? tr : de(e.state);
465
+ function st() {
466
+ const e = z(ke);
467
+ return !e || !e.state.enabled ? it : ce(e.state);
459
468
  }
460
- function Ur({
469
+ function Yt({
461
470
  spec: e,
462
- queryKind: r,
463
- queryKey: t,
471
+ queryKind: t,
472
+ queryKey: r,
464
473
  intent: n,
465
474
  activeInputs: i,
466
- debug: l
475
+ debug: o
467
476
  }) {
468
- const u = z(Te), c = z(Ce), d = !!(u != null && u.state.enabled), f = u == null ? void 0 : u.dispatch, g = Wt(e), y = e.label, h = b(
477
+ const u = z(ke), c = z(De), d = !!(u != null && u.state.enabled), f = u == null ? void 0 : u.dispatch, y = Qr(e), g = e.label, h = b(
469
478
  () => JSON.stringify(e),
470
479
  [e]
471
480
  ), m = b(
@@ -474,159 +483,163 @@ function Ur({
474
483
  ), S = b(
475
484
  () => JSON.stringify(n || null),
476
485
  [n]
477
- ), R = k(e), o = k(h), x = k(n), B = k(S), T = k(i), v = k(m);
478
- o.current !== h && (o.current = h, R.current = e), B.current !== S && (B.current = S, x.current = n), v.current !== m && (v.current = m, T.current = i);
479
- const I = R.current, D = x.current, E = T.current, O = rr(), w = b(
480
- () => g || `query_${hr(t)}`,
481
- [t, g]
482
- ), K = (l == null ? void 0 : l.viewId) || (c == null ? void 0 : c.id), Ke = (l == null ? void 0 : l.title) || (c == null ? void 0 : c.title), wr = JSON.stringify(Pe(l) || []), $e = b(
483
- () => Pe(l),
486
+ ), T = C(e), a = C(h), w = C(n), K = C(S), E = C(i), v = C(m);
487
+ a.current !== h && (a.current = h, T.current = e), K.current !== S && (K.current = S, w.current = n), v.current !== m && (v.current = m, E.current = i);
488
+ const I = T.current, L = w.current, R = E.current, O = nt(), x = b(
489
+ () => y || `query_${St(r)}`,
490
+ [r, y]
491
+ ), k = (o == null ? void 0 : o.viewId) || (c == null ? void 0 : c.id), J = (o == null ? void 0 : o.viewTitle) || (o == null ? void 0 : o.title) || (c == null ? void 0 : c.title), $e = o == null ? void 0 : o.visualType, _e = o == null ? void 0 : o.sectionTitle, At = JSON.stringify(Qe(o) || []), Ne = b(
492
+ () => Qe(o),
484
493
  // Keep inline debug={{ sourceHint: ... }} objects from re-registering every render.
485
494
  // eslint-disable-next-line react-hooks/exhaustive-deps
486
- [wr]
495
+ [At]
487
496
  ), F = b(
488
497
  () => [
489
- K || "unscoped-view",
490
- w,
498
+ k || "unscoped-view",
499
+ x,
491
500
  O
492
501
  ].join("::"),
493
- [w, O, K]
494
- ), _e = b(
502
+ [x, O, k]
503
+ ), Fe = b(
495
504
  () => ({
496
505
  traceKey: F,
497
506
  spec: I,
498
- queryId: w,
499
- queryLabel: y,
500
- queryKind: r,
501
- builder: zt(r),
502
- viewId: K,
503
- viewTitle: Ke,
504
- sourceHints: $e,
505
- intent: D,
506
- activeInputs: E,
507
- clientWarnings: g ? [] : ["Query spec is missing an explicit id; using an opaque internal id."]
507
+ queryId: x,
508
+ queryLabel: g,
509
+ queryKind: t,
510
+ builder: Ur(t),
511
+ viewId: k,
512
+ viewTitle: J,
513
+ visualType: $e,
514
+ sectionTitle: _e,
515
+ sourceHints: Ne,
516
+ intent: L,
517
+ activeInputs: R,
518
+ clientWarnings: y ? [] : ["Query spec is missing an explicit id; using an opaque internal id."]
508
519
  }),
509
520
  [
510
- w,
511
- r,
512
- g,
521
+ x,
522
+ t,
513
523
  y,
524
+ g,
514
525
  I,
515
- E,
516
- D,
517
- $e,
526
+ R,
527
+ L,
528
+ Ne,
529
+ _e,
518
530
  F,
519
- K,
520
- Ke
531
+ k,
532
+ J,
533
+ $e
521
534
  ]
522
535
  );
523
- L(() => {
536
+ B(() => {
524
537
  if (!(!d || !f))
525
- return f({ type: "register", descriptor: _e }), () => {
538
+ return f({ type: "register", descriptor: Fe }), () => {
526
539
  f({ type: "unregister", traceKey: F });
527
540
  };
528
- }, [_e, f, d, F]);
529
- const _ = C(
541
+ }, [Fe, f, d, F]);
542
+ const _ = D(
530
543
  (A, j) => {
531
544
  !d || !f || f({ type: "event", traceKey: F, event: A, latestAttempt: j });
532
545
  },
533
546
  [f, d, F]
534
- ), Ne = C(() => {
547
+ ), We = D(() => {
535
548
  _(
536
549
  {
537
550
  type: "query_started",
538
- queryId: w,
539
- at: le()
551
+ queryId: x,
552
+ at: ue()
540
553
  },
541
554
  { status: "loading" }
542
555
  );
543
- }, [_, w]), Fe = C(
556
+ }, [_, x]), Me = D(
544
557
  (A, j) => {
545
- const J = Je(A), Y = Jt(A), Ir = Yt(A);
558
+ const Y = Xe(A), X = rn(A), Tt = nn(A);
546
559
  _(
547
560
  {
548
561
  type: "query_succeeded",
549
- queryId: w,
550
- requestId: J,
551
- at: le(),
552
- rowCount: Y,
562
+ queryId: x,
563
+ requestId: Y,
564
+ at: ue(),
565
+ rowCount: X,
553
566
  durationMs: j
554
567
  },
555
568
  {
556
- requestId: J,
569
+ requestId: Y,
557
570
  status: "success",
558
571
  durationMs: j,
559
- rowCount: Y,
560
- columnCount: Ir,
561
- executionResult: Ge(A)
572
+ rowCount: X,
573
+ columnCount: Tt,
574
+ executionResult: Ye(A)
562
575
  }
563
576
  );
564
577
  },
565
- [_, w]
566
- ), ne = C(
578
+ [_, x]
579
+ ), ie = D(
567
580
  (A, j) => {
568
- const J = Je(A), Y = A instanceof Error ? A.message : String(A);
581
+ const Y = Xe(A), X = A instanceof Error ? A.message : String(A);
569
582
  _(
570
583
  {
571
584
  type: "query_failed",
572
- queryId: w,
573
- requestId: J,
574
- at: le(),
575
- errorMessage: Y
585
+ queryId: x,
586
+ requestId: Y,
587
+ at: ue(),
588
+ errorMessage: X
576
589
  },
577
590
  {
578
- requestId: J,
591
+ requestId: Y,
579
592
  status: "error",
580
593
  durationMs: j,
581
- errorMessage: Y,
582
- executionResult: Ge(A)
594
+ errorMessage: X,
595
+ executionResult: Ye(A)
583
596
  }
584
597
  );
585
598
  },
586
- [_, w]
587
- ), Me = C(
599
+ [_, x]
600
+ ), ze = D(
588
601
  (A) => {
589
602
  _(
590
603
  {
591
604
  type: "query_ignored_stale",
592
- queryId: w,
593
- at: le(),
605
+ queryId: x,
606
+ at: ue(),
594
607
  reason: A
595
608
  }
596
609
  );
597
610
  },
598
- [_, w]
599
- ), We = C(
611
+ [_, x]
612
+ ), je = D(
600
613
  (A) => {
601
- ne(A, 0);
614
+ ie(A, 0);
602
615
  },
603
- [ne]
616
+ [ie]
604
617
  ), ge = d ? u == null ? void 0 : u.state.entries[F] : void 0;
605
618
  return b(
606
619
  () => ({
607
620
  enabled: d,
608
- queryId: w,
609
- trace: ge ? ue(ge) : void 0,
610
- start: Ne,
611
- success: Fe,
612
- failure: ne,
613
- ignored: Me,
614
- validationFailure: We
621
+ queryId: x,
622
+ trace: ge ? de(ge) : void 0,
623
+ start: We,
624
+ success: Me,
625
+ failure: ie,
626
+ ignored: ze,
627
+ validationFailure: je
615
628
  }),
616
629
  [
617
630
  d,
618
- ne,
631
+ ie,
632
+ ze,
633
+ x,
634
+ We,
619
635
  Me,
620
- w,
621
- Ne,
622
- Fe,
623
636
  ge,
624
- We
637
+ je
625
638
  ]
626
639
  );
627
640
  }
628
- function Gr() {
629
- return /* @__PURE__ */ s("span", { style: a.logoMark, "aria-hidden": !0, children: /* @__PURE__ */ p(
641
+ function Xt() {
642
+ return /* @__PURE__ */ s("span", { style: l.logoMark, "aria-hidden": !0, children: /* @__PURE__ */ p(
630
643
  "svg",
631
644
  {
632
645
  viewBox: "0 0 100 100",
@@ -643,99 +656,105 @@ function Gr() {
643
656
  }
644
657
  ) });
645
658
  }
646
- function Jr({
659
+ function Zt({
647
660
  trace: e
648
661
  }) {
649
- var R, o, x, B, T;
662
+ var T, a, w, K, E;
650
663
  if (!e)
651
- return /* @__PURE__ */ s("div", { style: a.detailsPane, children: /* @__PURE__ */ s("div", { style: a.emptyState, children: "No traces registered yet" }) });
652
- const r = e.latestAttempt, t = r == null ? void 0 : r.executionResult, n = ve(
653
- (R = t == null ? void 0 : t.validation) == null ? void 0 : R.warnings
654
- ), i = ve((o = t == null ? void 0 : t.validation) == null ? void 0 : o.errors), l = ve(
655
- (x = t == null ? void 0 : t.coverage) == null ? void 0 : x.missingObligations
656
- ), u = t == null ? void 0 : t.compiledQuery, c = wt(t), d = ((B = e.server) == null ? void 0 : B.compiledSql) || c.compiledSql, f = r != null && r.errorMessage ? [r.errorMessage] : [], g = [
664
+ return /* @__PURE__ */ s("div", { style: l.detailsPane, children: /* @__PURE__ */ s("div", { style: l.emptyState, children: "No traces registered yet" }) });
665
+ const t = e.latestAttempt, r = t == null ? void 0 : t.executionResult, n = be(
666
+ (T = r == null ? void 0 : r.validation) == null ? void 0 : T.warnings
667
+ ), i = be((a = r == null ? void 0 : r.validation) == null ? void 0 : a.errors), o = be(
668
+ (w = r == null ? void 0 : r.coverage) == null ? void 0 : w.missingObligations
669
+ ), u = r == null ? void 0 : r.compiledQuery, c = Er(r), d = ((K = e.server) == null ? void 0 : K.compiledSql) || c.compiledSql, f = t != null && t.errorMessage ? [t.errorMessage] : [], y = [
657
670
  ...e.clientWarnings,
658
671
  ...n,
659
672
  ...i,
660
- ...l
661
- ], y = pe(e), h = e.viewId ? `${e.viewId} - ${e.queryId}` : e.queryId, m = e.inputsApplied.length > 0, S = !!(u || d);
662
- return /* @__PURE__ */ p("div", { style: a.detailsPane, children: [
663
- /* @__PURE__ */ p("div", { style: a.detailsHeader, children: [
664
- /* @__PURE__ */ p("div", { style: a.detailsHeaderTopRow, children: [
673
+ ...o
674
+ ], g = me(e), h = lt(e), m = e.inputsApplied.length > 0, S = !!(u || d);
675
+ return /* @__PURE__ */ p("div", { style: l.detailsPane, children: [
676
+ /* @__PURE__ */ p("div", { style: l.detailsHeader, children: [
677
+ /* @__PURE__ */ p("div", { style: l.detailsHeaderTopRow, children: [
665
678
  /* @__PURE__ */ s(
666
679
  "span",
667
680
  {
668
681
  "aria-hidden": !0,
669
682
  style: {
670
- ...a.detailsHeaderStatusDot,
671
- ...dr(r == null ? void 0 : r.status)
683
+ ...l.detailsHeaderStatusDot,
684
+ ...pt(t == null ? void 0 : t.status)
672
685
  }
673
686
  }
674
687
  ),
675
- /* @__PURE__ */ s("span", { style: a.detailsTitle, children: De(e) }),
676
- /* @__PURE__ */ s("span", { style: a.detailsKindChip, children: sr(e.queryKind) })
688
+ /* @__PURE__ */ s("span", { style: l.detailsTitle, children: Le(e) }),
689
+ /* @__PURE__ */ s("span", { style: l.detailsKindChip, children: ut(e) })
677
690
  ] }),
678
- /* @__PURE__ */ p("div", { style: a.detailsCaption, children: [
679
- /* @__PURE__ */ s(
680
- "span",
681
- {
682
- style: { ...a.detailsCaptionItem, ...a.detailsCaptionItemMono },
683
- children: h
684
- }
685
- ),
686
- /* @__PURE__ */ p("span", { style: a.detailsCaptionItem, children: [
687
- /* @__PURE__ */ s("span", { style: a.detailsCaptionLabel, children: "Source" }),
688
- /* @__PURE__ */ s("span", { style: a.detailsCaptionValue, children: y })
691
+ /* @__PURE__ */ p("div", { style: l.detailsCaption, children: [
692
+ /* @__PURE__ */ p("span", { style: l.detailsCaptionItem, children: [
693
+ /* @__PURE__ */ s("span", { style: l.detailsCaptionLabel, children: "Query" }),
694
+ /* @__PURE__ */ s(
695
+ "span",
696
+ {
697
+ style: {
698
+ ...l.detailsCaptionValue,
699
+ ...l.detailsCaptionItemMono
700
+ },
701
+ children: h
702
+ }
703
+ )
704
+ ] }),
705
+ /* @__PURE__ */ p("span", { style: l.detailsCaptionItem, children: [
706
+ /* @__PURE__ */ s("span", { style: l.detailsCaptionLabel, children: "Source" }),
707
+ /* @__PURE__ */ s("span", { style: l.detailsCaptionValue, children: g })
689
708
  ] }),
690
- /* @__PURE__ */ p("span", { style: a.detailsCaptionItem, children: [
691
- /* @__PURE__ */ s("span", { style: a.detailsCaptionLabel, children: "Rows" }),
692
- /* @__PURE__ */ s("span", { style: a.detailsCaptionValue, children: yt(r == null ? void 0 : r.rowCount) })
709
+ /* @__PURE__ */ p("span", { style: l.detailsCaptionItem, children: [
710
+ /* @__PURE__ */ s("span", { style: l.detailsCaptionLabel, children: "Rows" }),
711
+ /* @__PURE__ */ s("span", { style: l.detailsCaptionValue, children: xr(t == null ? void 0 : t.rowCount) })
693
712
  ] }),
694
- /* @__PURE__ */ p("span", { style: a.detailsCaptionItem, children: [
695
- /* @__PURE__ */ s("span", { style: a.detailsCaptionLabel, children: "Duration" }),
696
- /* @__PURE__ */ s("span", { style: a.detailsCaptionValue, children: ht(r == null ? void 0 : r.durationMs) })
713
+ /* @__PURE__ */ p("span", { style: l.detailsCaptionItem, children: [
714
+ /* @__PURE__ */ s("span", { style: l.detailsCaptionLabel, children: "Duration" }),
715
+ /* @__PURE__ */ s("span", { style: l.detailsCaptionValue, children: Ir(t == null ? void 0 : t.durationMs) })
697
716
  ] })
698
717
  ] })
699
718
  ] }),
700
- f.length ? /* @__PURE__ */ s(ze, { tone: "error", title: "Error", items: f }) : null,
701
- g.length ? /* @__PURE__ */ s(ze, { tone: "warning", title: "Warnings", items: g }) : null,
702
- /* @__PURE__ */ s(Xr, { trace: e }),
703
- /* @__PURE__ */ s(Zr, { trace: e }),
704
- (T = e.sourceHints) != null && T.length ? /* @__PURE__ */ s(et, { hints: e.sourceHints }) : null,
705
- m ? /* @__PURE__ */ s(tt, { inputs: e.inputsApplied }) : null,
706
- S ? /* @__PURE__ */ s(ee, { title: "Compiled query", children: /* @__PURE__ */ s(
707
- nt,
719
+ f.length ? /* @__PURE__ */ s(He, { tone: "error", title: "Error", items: f }) : null,
720
+ y.length ? /* @__PURE__ */ s(He, { tone: "warning", title: "Warnings", items: y }) : null,
721
+ /* @__PURE__ */ s(tr, { trace: e }),
722
+ /* @__PURE__ */ s(rr, { trace: e }),
723
+ (E = e.sourceHints) != null && E.length ? /* @__PURE__ */ s(nr, { hints: e.sourceHints }) : null,
724
+ m ? /* @__PURE__ */ s(or, { inputs: e.inputsApplied }) : null,
725
+ S ? /* @__PURE__ */ s(te, { title: "Compiled query", children: /* @__PURE__ */ s(
726
+ sr,
708
727
  {
709
728
  compiledQuery: u,
710
729
  compiledSql: d
711
730
  }
712
731
  ) }) : null,
713
- /* @__PURE__ */ s(ee, { title: "Lifecycle events", children: e.recentEvents.length ? /* @__PURE__ */ s("div", { style: a.eventList, children: e.recentEvents.slice(-5).map((v, I) => /* @__PURE__ */ p(
732
+ /* @__PURE__ */ s(te, { title: "Lifecycle events", children: e.recentEvents.length ? /* @__PURE__ */ s("div", { style: l.eventList, children: e.recentEvents.slice(-5).map((v, I) => /* @__PURE__ */ p(
714
733
  "div",
715
734
  {
716
- style: a.eventRow,
735
+ style: l.eventRow,
717
736
  children: [
718
- /* @__PURE__ */ s("span", { style: a.eventType, children: bt(v) }),
719
- /* @__PURE__ */ s("span", { style: a.eventMeta, children: St(v) })
737
+ /* @__PURE__ */ s("span", { style: l.eventType, children: Ar(v) }),
738
+ /* @__PURE__ */ s("span", { style: l.eventMeta, children: Tr(v) })
720
739
  ]
721
740
  },
722
741
  `${v.type}:${v.at}:${I}`
723
- )) }) : /* @__PURE__ */ s("div", { style: a.mutedText, children: "No attempts recorded" }) }),
724
- /* @__PURE__ */ s(ee, { title: "Raw trace JSON", children: /* @__PURE__ */ s("pre", { style: a.codeBlock, children: vt(e) }) })
742
+ )) }) : /* @__PURE__ */ s("div", { style: l.mutedText, children: "No attempts recorded" }) }),
743
+ /* @__PURE__ */ s(te, { title: "Raw trace JSON", children: /* @__PURE__ */ s("pre", { style: l.codeBlock, children: qr(e) }) })
725
744
  ] });
726
745
  }
727
- function ze({
746
+ function He({
728
747
  tone: e,
729
- title: r,
730
- items: t
748
+ title: t,
749
+ items: r
731
750
  }) {
732
- const n = e === "error" ? a.alertCardError : a.alertCardWarning;
733
- return /* @__PURE__ */ p("div", { style: { ...a.alertCard, ...n }, children: [
734
- /* @__PURE__ */ s("div", { style: a.alertCardTitle, children: r }),
735
- t.length > 1 ? /* @__PURE__ */ s("ul", { style: a.alertCardList, children: t.map((i, l) => /* @__PURE__ */ s("li", { children: i }, `${e}-${l}`)) }) : /* @__PURE__ */ s("div", { children: t[0] })
751
+ const n = e === "error" ? l.alertCardError : l.alertCardWarning;
752
+ return /* @__PURE__ */ p("div", { style: { ...l.alertCard, ...n }, children: [
753
+ /* @__PURE__ */ s("div", { style: l.alertCardTitle, children: t }),
754
+ r.length > 1 ? /* @__PURE__ */ s("ul", { style: l.alertCardList, children: r.map((i, o) => /* @__PURE__ */ s("li", { children: i }, `${e}-${o}`)) }) : /* @__PURE__ */ s("div", { children: r[0] })
736
755
  ] });
737
756
  }
738
- function Yr({
757
+ function er({
739
758
  status: e
740
759
  }) {
741
760
  return /* @__PURE__ */ s(
@@ -743,53 +762,53 @@ function Yr({
743
762
  {
744
763
  "aria-hidden": !0,
745
764
  style: {
746
- ...a.statusDot,
747
- ...dr(e)
765
+ ...l.statusDot,
766
+ ...pt(e)
748
767
  }
749
768
  }
750
769
  );
751
770
  }
752
- function ee({
771
+ function te({
753
772
  title: e,
754
- children: r
773
+ children: t
755
774
  }) {
756
- return /* @__PURE__ */ p("details", { style: a.disclosure, children: [
757
- /* @__PURE__ */ s("summary", { style: a.disclosureSummary, children: e }),
758
- /* @__PURE__ */ s("div", { style: a.disclosureBody, children: r })
775
+ return /* @__PURE__ */ p("details", { style: l.disclosure, children: [
776
+ /* @__PURE__ */ s("summary", { style: l.disclosureSummary, children: e }),
777
+ /* @__PURE__ */ s("div", { style: l.disclosureBody, children: t })
759
778
  ] });
760
779
  }
761
- function Xr({
780
+ function tr({
762
781
  trace: e
763
782
  }) {
764
- var l;
765
- const r = (l = e.projectionFieldRefs) != null && l.length ? e.projectionFieldRefs : e.fieldRefs, t = e.inputFieldRefs || [], n = ut(r), i = dt(e, n, r);
766
- return /* @__PURE__ */ p("div", { style: a.recipe, children: [
767
- /* @__PURE__ */ s("div", { style: a.recipeSummary, children: i.map((u) => /* @__PURE__ */ p("div", { style: a.recipeSummaryRow, children: [
768
- /* @__PURE__ */ s("span", { style: a.recipeSummaryLabel, children: u.label }),
769
- /* @__PURE__ */ s("span", { style: a.recipeSummaryValue, title: u.value, children: u.value })
783
+ var o;
784
+ const t = (o = e.projectionFieldRefs) != null && o.length ? e.projectionFieldRefs : e.fieldRefs, r = e.inputFieldRefs || [], n = yr(t), i = gr(e, n, t);
785
+ return /* @__PURE__ */ p("div", { style: l.recipe, children: [
786
+ /* @__PURE__ */ s("div", { style: l.recipeSummary, children: i.map((u) => /* @__PURE__ */ p("div", { style: l.recipeSummaryRow, children: [
787
+ /* @__PURE__ */ s("span", { style: l.recipeSummaryLabel, children: u.label }),
788
+ /* @__PURE__ */ s("span", { style: l.recipeSummaryValue, title: u.value, children: u.value })
770
789
  ] }, u.label)) }),
771
- /* @__PURE__ */ s(M, { title: "Measures", fields: n.measures }),
772
- /* @__PURE__ */ s(M, { title: "Time fields", fields: n.timeFields }),
790
+ /* @__PURE__ */ s(W, { title: "Measures", fields: n.measures }),
791
+ /* @__PURE__ */ s(W, { title: "Time fields", fields: n.timeFields }),
773
792
  /* @__PURE__ */ s(
774
- M,
793
+ W,
775
794
  {
776
795
  title: "Dimensions",
777
796
  fields: n.dimensions,
778
797
  emptyText: "No dimensions selected"
779
798
  }
780
799
  ),
781
- /* @__PURE__ */ s(M, { title: "Identifiers", fields: n.identifiers }),
782
- /* @__PURE__ */ s(M, { title: "Other fields", fields: n.other }),
783
- /* @__PURE__ */ s(M, { title: "Input bindings", fields: t })
800
+ /* @__PURE__ */ s(W, { title: "Identifiers", fields: n.identifiers }),
801
+ /* @__PURE__ */ s(W, { title: "Other fields", fields: n.other }),
802
+ /* @__PURE__ */ s(W, { title: "Input bindings", fields: r })
784
803
  ] });
785
804
  }
786
- function Zr({
805
+ function rr({
787
806
  trace: e
788
807
  }) {
789
- return !e.sourceRefs.length && !e.fieldRefs.length ? null : /* @__PURE__ */ s(ee, { title: "Sources and field refs", children: /* @__PURE__ */ p("div", { style: a.traceLineage, children: [
790
- /* @__PURE__ */ s(rt, { sources: e.sourceRefs }),
808
+ return !e.sourceRefs.length && !e.fieldRefs.length ? null : /* @__PURE__ */ s(te, { title: "Sources and field refs", children: /* @__PURE__ */ p("div", { style: l.traceLineage, children: [
809
+ /* @__PURE__ */ s(ir, { sources: e.sourceRefs }),
791
810
  /* @__PURE__ */ s(
792
- M,
811
+ W,
793
812
  {
794
813
  title: "All field refs",
795
814
  fields: e.fieldRefs,
@@ -798,201 +817,204 @@ function Zr({
798
817
  )
799
818
  ] }) });
800
819
  }
801
- function et({
820
+ function nr({
802
821
  hints: e
803
822
  }) {
804
- return /* @__PURE__ */ s(ee, { title: "Source hints", children: /* @__PURE__ */ s("div", { style: a.recipeFieldList, children: e.map((r, t) => {
805
- const n = gt(r), i = r.component || r.exportName || n || "Source hint", l = [
806
- r.exportName && r.exportName !== i ? r.exportName : void 0,
823
+ return /* @__PURE__ */ s(te, { title: "Source hints", children: /* @__PURE__ */ s("div", { style: l.recipeFieldList, children: e.map((t, r) => {
824
+ const n = wr(t), i = t.component || t.exportName || n || "Source hint", o = [
825
+ t.exportName && t.exportName !== i ? t.exportName : void 0,
807
826
  n,
808
- r.note
827
+ t.note
809
828
  ].filter(Boolean).join(" · ");
810
829
  return /* @__PURE__ */ p(
811
830
  "div",
812
831
  {
813
- style: a.recipeFieldRow,
814
- title: l || i,
832
+ style: l.recipeFieldRow,
833
+ title: o || i,
815
834
  children: [
816
- /* @__PURE__ */ s("span", { style: a.recipeFieldName, children: i }),
817
- l ? /* @__PURE__ */ s("span", { style: a.recipeFieldMeta, children: l }) : null
835
+ /* @__PURE__ */ s("span", { style: l.recipeFieldName, children: i }),
836
+ o ? /* @__PURE__ */ s("span", { style: l.recipeFieldMeta, children: o }) : null
818
837
  ]
819
838
  },
820
- `${i}:${n}:${t}`
839
+ `${i}:${n}:${r}`
821
840
  );
822
841
  }) }) });
823
842
  }
824
- function rt({
843
+ function ir({
825
844
  sources: e
826
845
  }) {
827
- return /* @__PURE__ */ p("div", { style: a.recipeGroup, children: [
828
- /* @__PURE__ */ p("div", { style: a.recipeGroupHeader, children: [
829
- /* @__PURE__ */ s("span", { style: a.recipeGroupTitle, children: "Sources" }),
830
- /* @__PURE__ */ s("span", { style: a.recipeGroupCount, children: e.length })
846
+ return /* @__PURE__ */ p("div", { style: l.recipeGroup, children: [
847
+ /* @__PURE__ */ p("div", { style: l.recipeGroupHeader, children: [
848
+ /* @__PURE__ */ s("span", { style: l.recipeGroupTitle, children: "Sources" }),
849
+ /* @__PURE__ */ s("span", { style: l.recipeGroupCount, children: e.length })
831
850
  ] }),
832
- e.length ? /* @__PURE__ */ s("div", { style: a.recipeFieldList, children: e.map((r, t) => /* @__PURE__ */ p(
851
+ e.length ? /* @__PURE__ */ s("div", { style: l.recipeFieldList, children: e.map((t, r) => /* @__PURE__ */ p(
833
852
  "div",
834
853
  {
835
- style: a.recipeFieldRow,
836
- title: V(r),
854
+ style: l.recipeFieldRow,
855
+ title: V(t),
837
856
  children: [
838
- /* @__PURE__ */ s("span", { style: a.recipeFieldName, children: V(r) }),
839
- /* @__PURE__ */ s("span", { style: a.recipeFieldMeta, children: r.kind })
857
+ /* @__PURE__ */ s("span", { style: l.recipeFieldName, children: V(t) }),
858
+ /* @__PURE__ */ s("span", { style: l.recipeFieldMeta, children: t.kind })
840
859
  ]
841
860
  },
842
- `${V(r)}:${t}`
843
- )) }) : /* @__PURE__ */ s("div", { style: a.recipeEmptyText, children: "No sources captured" })
861
+ `${V(t)}:${r}`
862
+ )) }) : /* @__PURE__ */ s("div", { style: l.recipeEmptyText, children: "No sources captured" })
844
863
  ] });
845
864
  }
846
- function M({
865
+ function W({
847
866
  title: e,
848
- fields: r,
849
- emptyText: t
867
+ fields: t,
868
+ emptyText: r
850
869
  }) {
851
- return !r.length && !t ? null : /* @__PURE__ */ p("div", { style: a.recipeGroup, children: [
852
- /* @__PURE__ */ p("div", { style: a.recipeGroupHeader, children: [
853
- /* @__PURE__ */ s("span", { style: a.recipeGroupTitle, children: e }),
854
- /* @__PURE__ */ s("span", { style: a.recipeGroupCount, children: r.length })
870
+ return !t.length && !r ? null : /* @__PURE__ */ p("div", { style: l.recipeGroup, children: [
871
+ /* @__PURE__ */ p("div", { style: l.recipeGroupHeader, children: [
872
+ /* @__PURE__ */ s("span", { style: l.recipeGroupTitle, children: e }),
873
+ /* @__PURE__ */ s("span", { style: l.recipeGroupCount, children: t.length })
855
874
  ] }),
856
- r.length ? /* @__PURE__ */ s("div", { style: a.recipeFieldList, children: r.map((n, i) => {
857
- const l = lr(n), u = n.dataType && n.dataType !== "unknown" ? n.dataType : void 0, c = n.source ? V(n.source) : void 0, d = [l, u, c].filter(Boolean).join(" · ");
875
+ t.length ? /* @__PURE__ */ s("div", { style: l.recipeFieldList, children: t.map((n, i) => {
876
+ const o = ct(n), u = n.dataType && n.dataType !== "unknown" ? n.dataType : void 0, c = n.source ? V(n.source) : void 0, d = [o, u, c].filter(Boolean).join(" · ");
858
877
  return /* @__PURE__ */ p(
859
878
  "div",
860
879
  {
861
- style: a.recipeFieldRow,
880
+ style: l.recipeFieldRow,
862
881
  title: d,
863
882
  children: [
864
- /* @__PURE__ */ s("span", { style: a.recipeFieldName, children: l }),
865
- /* @__PURE__ */ p("span", { style: a.recipeFieldMeta, children: [
883
+ /* @__PURE__ */ s("span", { style: l.recipeFieldName, children: o }),
884
+ /* @__PURE__ */ p("span", { style: l.recipeFieldMeta, children: [
866
885
  u ? /* @__PURE__ */ s("span", { children: u }) : null,
867
- u && c ? /* @__PURE__ */ s("span", { style: a.recipeFieldMetaDivider, children: " · " }) : null,
886
+ u && c ? /* @__PURE__ */ s("span", { style: l.recipeFieldMetaDivider, children: " · " }) : null,
868
887
  c ? /* @__PURE__ */ s("span", { children: c }) : null
869
888
  ] })
870
889
  ]
871
890
  },
872
891
  `${Oe(n)}:${i}`
873
892
  );
874
- }) }) : /* @__PURE__ */ s("div", { style: a.recipeEmptyText, children: t })
893
+ }) }) : /* @__PURE__ */ s("div", { style: l.recipeEmptyText, children: r })
875
894
  ] });
876
895
  }
877
- function tt({
896
+ function or({
878
897
  inputs: e
879
898
  }) {
880
- return /* @__PURE__ */ p("div", { style: a.inputsAppliedBlock, children: [
881
- /* @__PURE__ */ p("div", { style: a.inputsAppliedHeader, children: [
882
- /* @__PURE__ */ s("span", { style: a.inputsAppliedTitle, children: "Inputs applied" }),
883
- /* @__PURE__ */ s("span", { style: a.inputsAppliedCount, children: e.length })
899
+ return /* @__PURE__ */ p("div", { style: l.inputsAppliedBlock, children: [
900
+ /* @__PURE__ */ p("div", { style: l.inputsAppliedHeader, children: [
901
+ /* @__PURE__ */ s("span", { style: l.inputsAppliedTitle, children: "Inputs applied" }),
902
+ /* @__PURE__ */ s("span", { style: l.inputsAppliedCount, children: e.length })
884
903
  ] }),
885
- /* @__PURE__ */ s("div", { style: a.inputRecipeList, children: e.map((r) => {
886
- const t = ur(r);
904
+ /* @__PURE__ */ s("div", { style: l.inputRecipeList, children: e.map((t) => {
905
+ const r = ft(t);
887
906
  return /* @__PURE__ */ p(
888
907
  "div",
889
908
  {
890
- style: a.inputRecipeRow,
891
- title: t.title,
909
+ style: l.inputRecipeRow,
910
+ title: r.title,
892
911
  children: [
893
- /* @__PURE__ */ p("div", { style: a.inputRecipeHeader, children: [
894
- /* @__PURE__ */ s("span", { style: a.inputRecipeId, title: r.inputId, children: r.inputId }),
895
- t.operator ? /* @__PURE__ */ s("span", { style: a.inputOperatorBadge, children: t.operator }) : null,
896
- /* @__PURE__ */ s("span", { style: a.inputValuePreview, title: t.value, children: t.value })
912
+ /* @__PURE__ */ p("div", { style: l.inputRecipeHeader, children: [
913
+ /* @__PURE__ */ s("span", { style: l.inputRecipeId, title: t.inputId, children: t.inputId }),
914
+ r.operator ? /* @__PURE__ */ s("span", { style: l.inputOperatorBadge, children: r.operator }) : null,
915
+ /* @__PURE__ */ s("span", { style: l.inputValuePreview, title: r.value, children: r.value })
897
916
  ] }),
898
- t.binding ? /* @__PURE__ */ s("div", { style: a.inputRecipeBinding, title: t.binding, children: t.binding }) : null
917
+ r.binding ? /* @__PURE__ */ s("div", { style: l.inputRecipeBinding, title: r.binding, children: r.binding }) : null
899
918
  ]
900
919
  },
901
- r.inputId
920
+ t.inputId
902
921
  );
903
922
  }) })
904
923
  ] });
905
924
  }
906
- function nt({
925
+ function sr({
907
926
  compiledQuery: e,
908
- compiledSql: r
927
+ compiledSql: t
909
928
  }) {
910
- return (e == null ? void 0 : e.kind) === "sql" ? /* @__PURE__ */ p("div", { style: a.compiledQuery, children: [
911
- /* @__PURE__ */ s(X, { label: "SQL", value: e.sql }),
912
- e.pythonCode ? /* @__PURE__ */ s(X, { label: "Python", value: e.pythonCode }) : null,
929
+ return (e == null ? void 0 : e.kind) === "sql" ? /* @__PURE__ */ p("div", { style: l.compiledQuery, children: [
930
+ /* @__PURE__ */ s(Z, { label: "SQL", value: e.sql }),
931
+ e.pythonCode ? /* @__PURE__ */ s(Z, { label: "Python", value: e.pythonCode }) : null,
913
932
  e.parameters ? /* @__PURE__ */ s(
914
- X,
933
+ Z,
915
934
  {
916
935
  label: "Parameters",
917
936
  value: Ee(e.parameters)
918
937
  }
919
938
  ) : null
920
- ] }) : r ? /* @__PURE__ */ s(X, { label: "SQL", value: r }) : /* @__PURE__ */ s(X, { label: "Compiled query", value: Ee(e) });
939
+ ] }) : t ? /* @__PURE__ */ s(Z, { label: "SQL", value: t }) : /* @__PURE__ */ s(Z, { label: "Compiled query", value: Ee(e) });
921
940
  }
922
- function X({
941
+ function Z({
923
942
  label: e,
924
- value: r
943
+ value: t
925
944
  }) {
926
- return /* @__PURE__ */ p("div", { style: a.codeBlockGroup, children: [
927
- /* @__PURE__ */ s("div", { style: a.codeBlockLabel, children: e }),
928
- /* @__PURE__ */ s("pre", { style: a.codeBlock, children: r })
945
+ return /* @__PURE__ */ p("div", { style: l.codeBlockGroup, children: [
946
+ /* @__PURE__ */ s("div", { style: l.codeBlockLabel, children: e }),
947
+ /* @__PURE__ */ s("pre", { style: l.codeBlock, children: t })
929
948
  ] });
930
949
  }
931
- function it(e) {
932
- const r = e.filter(
950
+ function ar(e) {
951
+ const t = e.filter(
933
952
  (i) => {
934
- var l;
935
- return ((l = i.latestAttempt) == null ? void 0 : l.status) === "error";
953
+ var o;
954
+ return ((o = i.latestAttempt) == null ? void 0 : o.status) === "error";
936
955
  }
937
- ).length, t = e.filter(
956
+ ).length, r = e.filter(
938
957
  (i) => {
939
- var l;
940
- return ((l = i.latestAttempt) == null ? void 0 : l.status) === "loading";
958
+ var o;
959
+ return ((o = i.latestAttempt) == null ? void 0 : o.status) === "loading";
941
960
  }
942
961
  ).length, n = e.filter(
943
962
  (i) => {
944
- var l, u, c, d;
945
- return i.clientWarnings.length > 0 || !!((d = (c = (u = (l = i.latestAttempt) == null ? void 0 : l.executionResult) == null ? void 0 : u.validation) == null ? void 0 : c.warnings) != null && d.length);
963
+ var o, u, c, d;
964
+ return i.clientWarnings.length > 0 || !!((d = (c = (u = (o = i.latestAttempt) == null ? void 0 : o.executionResult) == null ? void 0 : u.validation) == null ? void 0 : c.warnings) != null && d.length);
946
965
  }
947
966
  ).length;
948
967
  return {
949
968
  total: e.length,
950
- failed: r,
951
- loading: t,
969
+ failed: t,
970
+ loading: r,
952
971
  warningCount: n,
953
- issueCount: r + n,
954
- severity: r ? "error" : n ? "warning" : "ok"
972
+ issueCount: t + n,
973
+ severity: t ? "error" : n ? "warning" : "ok"
955
974
  };
956
975
  }
957
- function ot(e, r) {
958
- const t = r.trim().toLowerCase();
959
- return t ? e.filter(
976
+ function lr(e, t) {
977
+ const r = t.trim().toLowerCase();
978
+ return r ? e.filter(
960
979
  (n) => [
961
980
  n.queryId,
962
981
  n.queryLabel,
963
982
  n.viewId,
983
+ n.viewTitle,
984
+ n.visualType,
985
+ n.sectionTitle,
964
986
  n.builder,
965
987
  n.queryKind,
966
- pe(n)
967
- ].filter(Boolean).join(" ").toLowerCase().includes(t)
988
+ me(n)
989
+ ].filter(Boolean).join(" ").toLowerCase().includes(r)
968
990
  ) : e;
969
991
  }
970
- function st(e) {
971
- const r = e.filter((i) => i.queryKind === "inputOptions"), t = new Set(r.map(Re));
992
+ function ur(e) {
993
+ const t = e.filter((i) => i.queryKind === "inputOptions"), r = new Set(t.map(Re));
972
994
  return [
973
- { title: "Cards", traces: e.filter((i) => !t.has(Re(i))) },
974
- { title: "Inputs", traces: r }
995
+ { title: "Cards", traces: e.filter((i) => !r.has(Re(i))) },
996
+ { title: "Inputs", traces: t }
975
997
  ];
976
998
  }
977
- function or(e, r) {
978
- if (!(!(r != null && r.traceId) && !(r != null && r.queryId) && !(r != null && r.viewId)))
979
- return r.traceId ? e.find((t) => t.traceId === r.traceId) : e.find((t) => !(r.queryId && t.queryId !== r.queryId || r.viewId && t.viewId !== r.viewId));
999
+ function at(e, t) {
1000
+ if (!(!(t != null && t.traceId) && !(t != null && t.queryId) && !(t != null && t.viewId)))
1001
+ return t.traceId ? e.find((r) => r.traceId === t.traceId) : e.find((r) => !(t.queryId && r.queryId !== t.queryId || t.viewId && r.viewId !== t.viewId));
980
1002
  }
981
- function at(e, r) {
982
- if (r.queryId)
983
- return or(e, r);
984
- if (!r.viewId)
1003
+ function dr(e, t) {
1004
+ if (t.queryId)
1005
+ return at(e, t);
1006
+ if (!t.viewId)
985
1007
  return;
986
- const t = e.filter((n) => n.viewId === r.viewId);
987
- return t.length === 1 ? t[0] : void 0;
1008
+ const r = e.filter((n) => n.viewId === t.viewId);
1009
+ return r.length === 1 ? r[0] : void 0;
988
1010
  }
989
- function lt(e, r) {
990
- return !!(e && r && e.traceId === r.traceId);
1011
+ function cr(e, t) {
1012
+ return !!(e && t && e.traceId === t.traceId);
991
1013
  }
992
1014
  function Re(e) {
993
1015
  return e.traceId;
994
1016
  }
995
- function sr(e) {
1017
+ function fr(e) {
996
1018
  switch (e) {
997
1019
  case "metric":
998
1020
  return "metric";
@@ -1007,19 +1029,32 @@ function sr(e) {
1007
1029
  case "sql":
1008
1030
  return "sql";
1009
1031
  default:
1010
- return me(e);
1032
+ return ye(e);
1011
1033
  }
1012
1034
  }
1013
- function De(e) {
1014
- return e.queryLabel || e.viewId || e.queryId;
1035
+ function Le(e) {
1036
+ return e.viewTitle || e.queryLabel || e.viewId || e.queryId;
1015
1037
  }
1016
- function pe(e) {
1017
- const r = e.sourceRefs.map(V);
1018
- return r.length ? r.length === 1 ? r[0] : `${r[0]} + ${r.length - 1} more` : "No source";
1038
+ function lt(e) {
1039
+ return e.viewTitle && e.queryLabel && e.queryLabel !== e.viewTitle ? `${e.queryLabel} · ${e.queryId}` : e.viewTitle || e.queryLabel ? e.queryId : e.viewId ? `${e.viewId} · ${e.queryId}` : e.queryId;
1019
1040
  }
1020
1041
  function ut(e) {
1042
+ return mr(e.visualType) || fr(e.queryKind);
1043
+ }
1044
+ function pr(e, t) {
1045
+ return t ? e.queryLabel || e.queryId : Le(e);
1046
+ }
1047
+ function mr(e) {
1048
+ if (e)
1049
+ return e.replace(/[_-]+/g, " ").replace(/\b\w/g, (t) => t.toUpperCase());
1050
+ }
1051
+ function me(e) {
1052
+ const t = e.sourceRefs.map(V);
1053
+ return t.length ? t.length === 1 ? t[0] : `${t[0]} + ${t.length - 1} more` : "No source";
1054
+ }
1055
+ function yr(e) {
1021
1056
  return e.reduce(
1022
- (r, t) => (t.role === "measure" ? r.measures.push(t) : t.role === "date" ? r.timeFields.push(t) : t.role === "dimension" ? r.dimensions.push(t) : t.role === "id" ? r.identifiers.push(t) : r.other.push(t), r),
1057
+ (t, r) => (r.role === "measure" ? t.measures.push(r) : r.role === "date" ? t.timeFields.push(r) : r.role === "dimension" ? t.dimensions.push(r) : r.role === "id" ? t.identifiers.push(r) : t.other.push(r), t),
1023
1058
  {
1024
1059
  measures: [],
1025
1060
  timeFields: [],
@@ -1029,31 +1064,31 @@ function ut(e) {
1029
1064
  }
1030
1065
  );
1031
1066
  }
1032
- function dt(e, r, t) {
1067
+ function gr(e, t, r) {
1033
1068
  const n = [
1034
1069
  {
1035
1070
  label: "Operation",
1036
- value: ct(e)
1071
+ value: hr(e)
1037
1072
  }
1038
- ], i = ft(e, r, t);
1073
+ ], i = vr(e, t, r);
1039
1074
  i && n.push(i);
1040
- const l = pt(r);
1041
- l && n.push({
1075
+ const o = br(t);
1076
+ o && n.push({
1042
1077
  label: "Grouped by",
1043
- value: l
1078
+ value: o
1044
1079
  });
1045
- const u = mt(e.inputsApplied);
1080
+ const u = Sr(e.inputsApplied);
1046
1081
  return u && n.push({
1047
1082
  label: "Filtered by",
1048
1083
  value: u
1049
1084
  }), n.push({
1050
1085
  label: "Source",
1051
- value: pe(e)
1086
+ value: me(e)
1052
1087
  }), n;
1053
1088
  }
1054
- function ct(e) {
1055
- var r, t;
1056
- if (e.queryKind === "records" && ((r = e.projectionFieldRefs) != null && r.length) && e.projectionFieldRefs.every((n) => n.role === "measure") && ((t = e.latestAttempt) == null ? void 0 : t.rowCount) === 1)
1089
+ function hr(e) {
1090
+ var t, r;
1091
+ if (e.queryKind === "records" && ((t = e.projectionFieldRefs) != null && t.length) && e.projectionFieldRefs.every((n) => n.role === "measure") && ((r = e.latestAttempt) == null ? void 0 : r.rowCount) === 1)
1057
1092
  return "KPI query";
1058
1093
  switch (e.queryKind) {
1059
1094
  case "metric":
@@ -1069,29 +1104,29 @@ function ct(e) {
1069
1104
  case "sql":
1070
1105
  return "SQL query";
1071
1106
  default:
1072
- return me(e.queryKind);
1107
+ return ye(e.queryKind);
1073
1108
  }
1074
1109
  }
1075
- function ft(e, r, t) {
1110
+ function vr(e, t, r) {
1076
1111
  if (e.queryKind === "records")
1077
1112
  return {
1078
- label: r.measures.length ? "Computes" : "Selects",
1079
- value: Z(t)
1113
+ label: t.measures.length ? "Computes" : "Selects",
1114
+ value: ee(r)
1080
1115
  };
1081
1116
  if (e.queryKind === "inputOptions")
1082
1117
  return {
1083
1118
  label: "Options from",
1084
- value: Z(t)
1119
+ value: ee(r)
1085
1120
  };
1086
- if (r.measures.length)
1121
+ if (t.measures.length)
1087
1122
  return {
1088
1123
  label: "Computes",
1089
- value: Z(r.measures)
1124
+ value: ee(t.measures)
1090
1125
  };
1091
- if (t.length)
1126
+ if (r.length)
1092
1127
  return {
1093
1128
  label: "Uses",
1094
- value: Z(t)
1129
+ value: ee(r)
1095
1130
  };
1096
1131
  if (e.queryKind === "sql")
1097
1132
  return {
@@ -1099,49 +1134,49 @@ function ft(e, r, t) {
1099
1134
  value: "Open compiled query for SQL or Python."
1100
1135
  };
1101
1136
  }
1102
- function pt(e) {
1103
- const r = [
1137
+ function br(e) {
1138
+ const t = [
1104
1139
  ...e.dimensions,
1105
1140
  ...e.timeFields
1106
1141
  ];
1107
- return r.length ? Z(r) : void 0;
1142
+ return t.length ? ee(t) : void 0;
1108
1143
  }
1109
- function mt(e) {
1144
+ function Sr(e) {
1110
1145
  if (e.length)
1111
- return ar(
1112
- e.map((r) => {
1113
- const t = ur(r);
1146
+ return dt(
1147
+ e.map((t) => {
1148
+ const r = ft(t);
1114
1149
  return [
1115
- r.inputId,
1116
- t.operator,
1117
- t.value
1150
+ t.inputId,
1151
+ r.operator,
1152
+ r.value
1118
1153
  ].filter(Boolean).join(" ");
1119
1154
  })
1120
1155
  );
1121
1156
  }
1122
- function Z(e) {
1123
- return ar(e.map(lr));
1157
+ function ee(e) {
1158
+ return dt(e.map(ct));
1124
1159
  }
1125
- function ar(e) {
1126
- const r = e.filter(Boolean);
1127
- return r.length === 0 ? "-" : r.length === 1 ? r[0] : r.length === 2 ? `${r[0]} and ${r[1]}` : `${r.slice(0, -1).join(", ")}, and ${r[r.length - 1]}`;
1160
+ function dt(e) {
1161
+ const t = e.filter(Boolean);
1162
+ return t.length === 0 ? "-" : t.length === 1 ? t[0] : t.length === 2 ? `${t[0]} and ${t[1]}` : `${t.slice(0, -1).join(", ")}, and ${t[t.length - 1]}`;
1128
1163
  }
1129
- function lr(e) {
1164
+ function ct(e) {
1130
1165
  return [e.aggregate, e.label || e.name].filter(Boolean).join(" ");
1131
1166
  }
1132
- function ur(e) {
1167
+ function ft(e) {
1133
1168
  var u, c, d;
1134
- const r = e.valuePreview || "redacted", t = ((u = e.fieldRef) == null ? void 0 : u.label) || ((c = e.fieldRef) == null ? void 0 : c.name), n = (d = e.fieldRef) != null && d.source ? V(e.fieldRef.source) : void 0, i = [t ? `on ${t}` : void 0, n].filter(Boolean).join(" · "), l = [
1169
+ const t = e.valuePreview || "redacted", r = ((u = e.fieldRef) == null ? void 0 : u.label) || ((c = e.fieldRef) == null ? void 0 : c.name), n = (d = e.fieldRef) != null && d.source ? V(e.fieldRef.source) : void 0, i = [r ? `on ${r}` : void 0, n].filter(Boolean).join(" · "), o = [
1135
1170
  e.inputId,
1136
1171
  e.operator,
1137
- r,
1172
+ t,
1138
1173
  i
1139
1174
  ].filter(Boolean).join(" - ");
1140
1175
  return {
1141
1176
  operator: e.operator,
1142
- value: r,
1177
+ value: t,
1143
1178
  binding: i,
1144
- title: l
1179
+ title: o
1145
1180
  };
1146
1181
  }
1147
1182
  function V(e) {
@@ -1150,23 +1185,23 @@ function V(e) {
1150
1185
  e.tableName
1151
1186
  ].filter(Boolean).join(".") || e.tableName : e.connectionId ? `SQL ${e.connectionId}` : "SQL source";
1152
1187
  }
1153
- function gt(e) {
1188
+ function wr(e) {
1154
1189
  if (e.file)
1155
1190
  return e.line && e.column ? `${e.file}:${e.line}:${e.column}` : e.line ? `${e.file}:${e.line}` : e.file;
1156
1191
  }
1157
- function yt(e) {
1192
+ function xr(e) {
1158
1193
  return typeof e == "number" ? e.toLocaleString() : "-";
1159
1194
  }
1160
- function ht(e) {
1195
+ function Ir(e) {
1161
1196
  return typeof e == "number" ? `${Math.round(e)}ms` : "-";
1162
1197
  }
1163
- function vt(e) {
1198
+ function qr(e) {
1164
1199
  return Ee(e);
1165
1200
  }
1166
1201
  function Ee(e) {
1167
1202
  return JSON.stringify(e, null, 2) ?? "undefined";
1168
1203
  }
1169
- function bt(e) {
1204
+ function Ar(e) {
1170
1205
  switch (e.type) {
1171
1206
  case "query_started":
1172
1207
  return "Started";
@@ -1179,10 +1214,10 @@ function bt(e) {
1179
1214
  case "input_changed":
1180
1215
  return "Input changed";
1181
1216
  default:
1182
- return xt(e);
1217
+ return Rr(e);
1183
1218
  }
1184
1219
  }
1185
- function St(e) {
1220
+ function Tr(e) {
1186
1221
  return [
1187
1222
  e.at,
1188
1223
  "durationMs" in e && typeof e.durationMs == "number" ? `${Math.round(e.durationMs)}ms` : void 0,
@@ -1191,20 +1226,20 @@ function St(e) {
1191
1226
  "errorMessage" in e ? e.errorMessage : void 0
1192
1227
  ].filter(Boolean).join(" - ");
1193
1228
  }
1194
- function xt(e) {
1229
+ function Rr(e) {
1195
1230
  throw new Error(`Unsupported Semaphor trace event: ${JSON.stringify(e)}`);
1196
1231
  }
1197
- function ve(e) {
1198
- return Array.isArray(e) ? e.filter((r) => typeof r == "string") : [];
1232
+ function be(e) {
1233
+ return Array.isArray(e) ? e.filter((t) => typeof t == "string") : [];
1199
1234
  }
1200
- function wt(e) {
1201
- const r = e == null ? void 0 : e.metadata, t = r && typeof r == "object" && !Array.isArray(r) && "dataAppDebug" in r && r.dataAppDebug && typeof r.dataAppDebug == "object" && !Array.isArray(r.dataAppDebug) ? r.dataAppDebug : void 0;
1235
+ function Er(e) {
1236
+ const t = e == null ? void 0 : e.metadata, r = t && typeof t == "object" && !Array.isArray(t) && "dataAppDebug" in t && t.dataAppDebug && typeof t.dataAppDebug == "object" && !Array.isArray(t.dataAppDebug) ? t.dataAppDebug : void 0;
1202
1237
  return {
1203
- compiledSql: typeof (t == null ? void 0 : t.compiledSql) == "string" ? t.compiledSql : void 0,
1204
- queryHash: typeof (t == null ? void 0 : t.queryHash) == "string" ? t.queryHash : void 0
1238
+ compiledSql: typeof (r == null ? void 0 : r.compiledSql) == "string" ? r.compiledSql : void 0,
1239
+ queryHash: typeof (r == null ? void 0 : r.queryHash) == "string" ? r.queryHash : void 0
1205
1240
  };
1206
1241
  }
1207
- function It(e) {
1242
+ function kr(e) {
1208
1243
  return e === "relative" ? {
1209
1244
  position: "relative",
1210
1245
  top: "auto",
@@ -1218,7 +1253,7 @@ function It(e) {
1218
1253
  left: e.endsWith("left") ? 20 : "auto"
1219
1254
  };
1220
1255
  }
1221
- function qt(e) {
1256
+ function Cr(e) {
1222
1257
  return e === "error" ? {
1223
1258
  borderColor: "var(--sd-error-border)",
1224
1259
  background: "var(--sd-error-bg)",
@@ -1233,7 +1268,7 @@ function qt(e) {
1233
1268
  color: "var(--sd-success-fg)"
1234
1269
  };
1235
1270
  }
1236
- function At(e) {
1271
+ function Dr(e) {
1237
1272
  return e === "right" ? {
1238
1273
  top: 16,
1239
1274
  right: 16,
@@ -1252,23 +1287,23 @@ function At(e) {
1252
1287
  borderRadius: 6
1253
1288
  };
1254
1289
  }
1255
- function Rt(e) {
1290
+ function Lr(e) {
1256
1291
  return e === "right" ? {
1257
1292
  gridTemplateColumns: "minmax(210px, 280px) minmax(0, 1fr)"
1258
1293
  } : {
1259
1294
  gridTemplateColumns: "minmax(260px, 340px) minmax(0, 1fr)"
1260
1295
  };
1261
1296
  }
1262
- function Et(e) {
1297
+ function Or(e) {
1263
1298
  return {
1264
1299
  borderRight: "1px solid var(--sd-border)",
1265
1300
  borderBottom: 0
1266
1301
  };
1267
1302
  }
1268
- function dr(e) {
1303
+ function pt(e) {
1269
1304
  return e === "error" ? { background: "var(--sd-error-dot)" } : e === "success" ? { background: "var(--sd-success-dot)" } : e === "loading" ? { background: "var(--sd-loading-dot)" } : { background: "var(--sd-idle-dot)" };
1270
1305
  }
1271
- function Tt(e) {
1306
+ function Br(e) {
1272
1307
  return e === "error" ? {
1273
1308
  borderColor: "var(--sd-error-border)",
1274
1309
  color: "var(--sd-error-fg)"
@@ -1283,7 +1318,7 @@ function Tt(e) {
1283
1318
  color: "var(--sd-fg-muted)"
1284
1319
  };
1285
1320
  }
1286
- const je = "semaphor-devtools-stylesheet", $ = "semaphor-devtools", kt = `
1321
+ const Pe = "semaphor-devtools-stylesheet", $ = "semaphor-devtools", Kr = `
1287
1322
  .${$} {
1288
1323
  --sd-bg: #ffffff;
1289
1324
  --sd-bg-muted: #fafafa;
@@ -1351,19 +1386,19 @@ const je = "semaphor-devtools-stylesheet", $ = "semaphor-devtools", kt = `
1351
1386
  word-break: break-all;
1352
1387
  }
1353
1388
  `;
1354
- function cr() {
1355
- if (typeof document > "u" || document.getElementById(je))
1389
+ function mt() {
1390
+ if (typeof document > "u" || document.getElementById(Pe))
1356
1391
  return;
1357
1392
  const e = document.createElement("style");
1358
- e.id = je, e.textContent = kt, document.head.appendChild(e);
1393
+ e.id = Pe, e.textContent = Kr, document.head.appendChild(e);
1359
1394
  }
1360
- const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', se = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", be = {
1395
+ const se = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', ae = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", Se = {
1361
1396
  color: "var(--sd-fg-muted)",
1362
1397
  fontSize: 10,
1363
1398
  fontWeight: 600,
1364
1399
  textTransform: "uppercase",
1365
1400
  letterSpacing: "0.08em"
1366
- }, a = {
1401
+ }, l = {
1367
1402
  launcher: {
1368
1403
  position: "fixed",
1369
1404
  bottom: 20,
@@ -1378,7 +1413,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1378
1413
  borderStyle: "solid",
1379
1414
  borderRadius: 6,
1380
1415
  boxShadow: "var(--sd-shadow)",
1381
- font: `600 12px/1.2 ${oe}`,
1416
+ font: `600 12px/1.2 ${se}`,
1382
1417
  cursor: "pointer"
1383
1418
  },
1384
1419
  launcherText: {
@@ -1420,7 +1455,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1420
1455
  background: "var(--sd-bg)",
1421
1456
  color: "var(--sd-fg)",
1422
1457
  boxShadow: "var(--sd-shadow)",
1423
- font: `13px/1.4 ${oe}`
1458
+ font: `13px/1.4 ${se}`
1424
1459
  },
1425
1460
  panelFullscreen: {
1426
1461
  top: 0,
@@ -1489,7 +1524,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1489
1524
  outline: 0,
1490
1525
  background: "transparent",
1491
1526
  color: "var(--sd-fg)",
1492
- font: `12px/1.4 ${oe}`
1527
+ font: `12px/1.4 ${se}`
1493
1528
  },
1494
1529
  panelBody: {
1495
1530
  display: "grid",
@@ -1515,7 +1550,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1515
1550
  alignItems: "center",
1516
1551
  justifyContent: "space-between",
1517
1552
  padding: "4px 6px 3px",
1518
- ...be
1553
+ ...Se
1519
1554
  },
1520
1555
  queryGroupCount: {
1521
1556
  color: "var(--sd-fg-subtle)",
@@ -1581,6 +1616,13 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1581
1616
  fontSize: 11,
1582
1617
  lineHeight: 1.35
1583
1618
  },
1619
+ queryListSourceSecondary: {
1620
+ minWidth: 0,
1621
+ paddingLeft: 14,
1622
+ color: "var(--sd-fg-subtle)",
1623
+ fontSize: 10,
1624
+ lineHeight: 1.3
1625
+ },
1584
1626
  detailsPane: {
1585
1627
  minHeight: 0,
1586
1628
  overflowY: "auto",
@@ -1639,7 +1681,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1639
1681
  gap: 4
1640
1682
  },
1641
1683
  detailsCaptionItemMono: {
1642
- fontFamily: se
1684
+ fontFamily: ae
1643
1685
  },
1644
1686
  detailsCaptionLabel: {
1645
1687
  color: "var(--sd-fg-subtle)"
@@ -1653,7 +1695,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1653
1695
  },
1654
1696
  disclosureSummary: {
1655
1697
  cursor: "pointer",
1656
- ...be
1698
+ ...Se
1657
1699
  },
1658
1700
  disclosureBody: {
1659
1701
  marginTop: 8
@@ -1845,7 +1887,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1845
1887
  textOverflow: "ellipsis",
1846
1888
  whiteSpace: "nowrap",
1847
1889
  color: "var(--sd-fg)",
1848
- fontFamily: se,
1890
+ fontFamily: ae,
1849
1891
  fontSize: 11,
1850
1892
  fontWeight: 600
1851
1893
  },
@@ -1858,7 +1900,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1858
1900
  borderRadius: 3,
1859
1901
  background: "var(--sd-bg-accent)",
1860
1902
  color: "var(--sd-fg-muted)",
1861
- fontFamily: se,
1903
+ fontFamily: ae,
1862
1904
  fontSize: 10,
1863
1905
  textTransform: "uppercase",
1864
1906
  letterSpacing: "0.06em"
@@ -1917,7 +1959,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1917
1959
  gap: 5
1918
1960
  },
1919
1961
  codeBlockLabel: {
1920
- ...be
1962
+ ...Se
1921
1963
  },
1922
1964
  codeBlock: {
1923
1965
  maxHeight: 260,
@@ -1928,7 +1970,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1928
1970
  borderRadius: 5,
1929
1971
  background: "var(--sd-bg-muted)",
1930
1972
  color: "var(--sd-fg)",
1931
- fontFamily: se,
1973
+ fontFamily: ae,
1932
1974
  fontSize: 11,
1933
1975
  lineHeight: 1.5,
1934
1976
  whiteSpace: "pre-wrap"
@@ -1950,7 +1992,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1950
1992
  borderStyle: "solid",
1951
1993
  borderRadius: 5,
1952
1994
  background: "var(--sd-bg)",
1953
- font: `600 11px/1 ${oe}`,
1995
+ font: `600 11px/1 ${se}`,
1954
1996
  cursor: "pointer"
1955
1997
  },
1956
1998
  inspectButtonText: {
@@ -1959,7 +2001,7 @@ const oe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1959
2001
  whiteSpace: "nowrap"
1960
2002
  }
1961
2003
  };
1962
- function fr(e) {
2004
+ function yt(e) {
1963
2005
  return {
1964
2006
  ...e,
1965
2007
  order: [],
@@ -1967,88 +2009,88 @@ function fr(e) {
1967
2009
  sequence: 0
1968
2010
  };
1969
2011
  }
1970
- function Ct(e, r) {
1971
- if (r.type === "config")
1972
- return r.config.enabled ? {
2012
+ function $r(e, t) {
2013
+ if (t.type === "config")
2014
+ return t.config.enabled ? {
1973
2015
  ...e,
1974
- ...r.config
1975
- } : fr(r.config);
2016
+ ...t.config
2017
+ } : yt(t.config);
1976
2018
  if (!e.enabled)
1977
2019
  return e;
1978
- switch (r.type) {
2020
+ switch (t.type) {
1979
2021
  case "register":
1980
- return Bt(Dt(e, r.descriptor));
2022
+ return Wr(_r(e, t.descriptor));
1981
2023
  case "unregister":
1982
- return Ot(e, r.traceKey);
2024
+ return Nr(e, t.traceKey);
1983
2025
  case "event":
1984
- return Lt(e, r);
2026
+ return Fr(e, t);
1985
2027
  default:
1986
2028
  return e;
1987
2029
  }
1988
2030
  }
1989
- function Dt(e, r) {
1990
- const t = e.entries[r.traceKey], n = t ? e.sequence : e.sequence + 1, i = Le(), l = {
1991
- ...t || Kt(r),
1992
- ...pr(r),
1993
- traceKey: r.traceKey,
1994
- latestAttempt: (t == null ? void 0 : t.latestAttempt) || { status: "idle" },
1995
- recentEvents: (t == null ? void 0 : t.recentEvents) || [],
2031
+ function _r(e, t) {
2032
+ const r = e.entries[t.traceKey], n = r ? e.sequence : e.sequence + 1, i = Be(), o = {
2033
+ ...r || Mr(t),
2034
+ ...gt(t),
2035
+ traceKey: t.traceKey,
2036
+ latestAttempt: (r == null ? void 0 : r.latestAttempt) || { status: "idle" },
2037
+ recentEvents: (r == null ? void 0 : r.recentEvents) || [],
1996
2038
  mounted: !0,
1997
- registeredAt: (t == null ? void 0 : t.registeredAt) || n,
1998
- lastEventAt: (t == null ? void 0 : t.lastEventAt) || i
2039
+ registeredAt: (r == null ? void 0 : r.registeredAt) || n,
2040
+ lastEventAt: (r == null ? void 0 : r.lastEventAt) || i
1999
2041
  };
2000
2042
  return {
2001
2043
  ...e,
2002
2044
  sequence: n,
2003
- order: t ? e.order : [...e.order, r.traceKey],
2045
+ order: r ? e.order : [...e.order, t.traceKey],
2004
2046
  entries: {
2005
2047
  ...e.entries,
2006
- [r.traceKey]: l
2048
+ [t.traceKey]: o
2007
2049
  }
2008
2050
  };
2009
2051
  }
2010
- function Ot(e, r) {
2011
- const t = e.entries[r];
2012
- return t ? {
2052
+ function Nr(e, t) {
2053
+ const r = e.entries[t];
2054
+ return r ? {
2013
2055
  ...e,
2014
2056
  entries: {
2015
2057
  ...e.entries,
2016
- [r]: {
2017
- ...t,
2058
+ [t]: {
2059
+ ...r,
2018
2060
  mounted: !1
2019
2061
  }
2020
2062
  }
2021
2063
  } : e;
2022
2064
  }
2023
- function Lt(e, r) {
2024
- const t = e.entries[r.traceKey];
2025
- if (!t)
2065
+ function Fr(e, t) {
2066
+ const r = e.entries[t.traceKey];
2067
+ if (!r)
2026
2068
  return e;
2027
- const n = Le(), i = [
2028
- ...t.recentEvents,
2029
- r.event
2069
+ const n = Be(), i = [
2070
+ ...r.recentEvents,
2071
+ t.event
2030
2072
  ].slice(-e.maxEventsPerQuery);
2031
2073
  return {
2032
2074
  ...e,
2033
2075
  entries: {
2034
2076
  ...e.entries,
2035
- [r.traceKey]: {
2036
- ...t,
2037
- latestAttempt: r.latestAttempt ? {
2038
- ...t.latestAttempt,
2039
- ...r.latestAttempt
2040
- } : t.latestAttempt,
2077
+ [t.traceKey]: {
2078
+ ...r,
2079
+ latestAttempt: t.latestAttempt ? {
2080
+ ...r.latestAttempt,
2081
+ ...t.latestAttempt
2082
+ } : r.latestAttempt,
2041
2083
  recentEvents: i,
2042
2084
  lastEventAt: n
2043
2085
  }
2044
2086
  }
2045
2087
  };
2046
2088
  }
2047
- function Bt(e) {
2089
+ function Wr(e) {
2048
2090
  if (e.order.length <= e.maxQueries)
2049
2091
  return e;
2050
- const r = e.order.map((i) => e.entries[i]).filter((i) => !!i).sort((i, l) => i.mounted !== l.mounted ? i.mounted ? 1 : -1 : i.lastEventAt - l.lastEventAt), t = e.order.length - e.maxQueries, n = new Set(
2051
- r.slice(0, t).map((i) => i.traceKey)
2092
+ const t = e.order.map((i) => e.entries[i]).filter((i) => !!i).sort((i, o) => i.mounted !== o.mounted ? i.mounted ? 1 : -1 : i.lastEventAt - o.lastEventAt), r = e.order.length - e.maxQueries, n = new Set(
2093
+ t.slice(0, r).map((i) => i.traceKey)
2052
2094
  );
2053
2095
  return n.size ? {
2054
2096
  ...e,
@@ -2058,186 +2100,189 @@ function Bt(e) {
2058
2100
  )
2059
2101
  } : e;
2060
2102
  }
2061
- function Kt(e) {
2062
- const r = Le();
2103
+ function Mr(e) {
2104
+ const t = Be();
2063
2105
  return {
2064
- ...pr(e),
2106
+ ...gt(e),
2065
2107
  traceKey: e.traceKey,
2066
2108
  latestAttempt: { status: "idle" },
2067
2109
  recentEvents: [],
2068
2110
  mounted: !0,
2069
2111
  registeredAt: 0,
2070
- lastEventAt: r
2112
+ lastEventAt: t
2071
2113
  };
2072
2114
  }
2073
- function pr(e) {
2115
+ function gt(e) {
2074
2116
  var n;
2075
- const r = Vt(e.spec), t = Qt(
2117
+ const t = Xr(e.spec), r = Zr(
2076
2118
  e.spec,
2077
2119
  e.activeInputs
2078
2120
  );
2079
2121
  return {
2080
- traceId: hr(e.traceKey),
2122
+ traceId: St(e.traceKey),
2081
2123
  viewId: e.viewId,
2124
+ viewTitle: e.viewTitle,
2125
+ visualType: e.visualType,
2126
+ sectionTitle: e.sectionTitle,
2082
2127
  queryId: e.queryId,
2083
- queryLabel: e.queryLabel || e.viewTitle,
2128
+ queryLabel: e.queryLabel,
2084
2129
  queryKind: e.queryKind,
2085
2130
  builder: e.builder,
2086
- sourceRefs: Pt(e.intent),
2131
+ sourceRefs: Yr(e.intent),
2087
2132
  sourceHints: (n = e.sourceHints) != null && n.length ? e.sourceHints : void 0,
2088
- projectionFieldRefs: r,
2089
- inputFieldRefs: t,
2090
- fieldRefs: Ut(e.intent),
2133
+ projectionFieldRefs: t,
2134
+ inputFieldRefs: r,
2135
+ fieldRefs: en(e.intent),
2091
2136
  inputsApplied: (e.activeInputs || []).map((i) => ({
2092
2137
  inputId: i.inputId,
2093
2138
  fieldRef: i.field,
2094
2139
  operator: i.operator,
2095
- valuePreview: jt(i)
2140
+ valuePreview: Gr(i)
2096
2141
  })),
2097
2142
  recentEvents: [],
2098
2143
  clientWarnings: e.clientWarnings
2099
2144
  };
2100
2145
  }
2101
- function ue(e) {
2146
+ function de(e) {
2102
2147
  const {
2103
- traceKey: r,
2104
- mounted: t,
2148
+ traceKey: t,
2149
+ mounted: r,
2105
2150
  registeredAt: n,
2106
2151
  lastEventAt: i,
2107
- ...l
2152
+ ...o
2108
2153
  } = e;
2109
- return l;
2154
+ return o;
2110
2155
  }
2111
- function de(e) {
2156
+ function ce(e) {
2112
2157
  return e.enabled ? {
2113
2158
  enabled: !0,
2114
- queries: e.order.map((t) => e.entries[t]).filter((t) => !!t).map(ue),
2115
- getQuery: (t) => {
2159
+ queries: e.order.map((r) => e.entries[r]).filter((r) => !!r).map(de),
2160
+ getQuery: (r) => {
2116
2161
  const n = Object.values(e.entries).find(
2117
- (i) => i.queryId === t
2162
+ (i) => i.queryId === r
2118
2163
  );
2119
- return n ? ue(n) : void 0;
2164
+ return n ? de(n) : void 0;
2120
2165
  },
2121
- getQueries: (t) => Object.values(e.entries).filter((n) => n.queryId === t).map(ue)
2122
- } : tr;
2166
+ getQueries: (r) => Object.values(e.entries).filter((n) => n.queryId === r).map(de)
2167
+ } : it;
2123
2168
  }
2124
- function $t(e) {
2169
+ function zr(e) {
2125
2170
  return {
2126
- snapshot: () => _t(de(e())),
2127
- getQuery: (r) => He(de(e()).getQuery(r)),
2128
- getQueries: (r) => de(e()).getQueries(r).map((t) => He(t)).filter((t) => !!t)
2171
+ snapshot: () => jr(ce(e())),
2172
+ getQuery: (t) => Ve(ce(e()).getQuery(t)),
2173
+ getQueries: (t) => ce(e()).getQueries(t).map((r) => Ve(r)).filter((r) => !!r)
2129
2174
  };
2130
2175
  }
2131
- function _t(e) {
2176
+ function jr(e) {
2132
2177
  if (!e.enabled)
2133
2178
  return e;
2134
- const r = e.queries.map(mr);
2179
+ const t = e.queries.map(ht);
2135
2180
  return {
2136
2181
  enabled: e.enabled,
2137
- queries: r,
2138
- getQuery: (t) => r.find((n) => n.queryId === t),
2139
- getQueries: (t) => r.filter((n) => n.queryId === t)
2182
+ queries: t,
2183
+ getQuery: (r) => t.find((n) => n.queryId === r),
2184
+ getQueries: (r) => t.filter((n) => n.queryId === r)
2140
2185
  };
2141
2186
  }
2142
- function He(e) {
2143
- return e ? mr(e) : void 0;
2187
+ function Ve(e) {
2188
+ return e ? ht(e) : void 0;
2144
2189
  }
2145
- function mr(e) {
2146
- var r;
2147
- return (r = e == null ? void 0 : e.latestAttempt) != null && r.executionResult ? {
2190
+ function ht(e) {
2191
+ var t;
2192
+ return (t = e == null ? void 0 : e.latestAttempt) != null && t.executionResult ? {
2148
2193
  ...e,
2149
2194
  latestAttempt: {
2150
2195
  ...e.latestAttempt,
2151
- executionResult: Nt(
2196
+ executionResult: Hr(
2152
2197
  e.latestAttempt.executionResult
2153
2198
  )
2154
2199
  }
2155
2200
  } : e;
2156
2201
  }
2157
- function Nt(e) {
2202
+ function Hr(e) {
2158
2203
  const {
2159
- compiledQuery: r,
2160
- intent: t,
2204
+ compiledQuery: t,
2205
+ intent: r,
2161
2206
  result: n,
2162
2207
  ...i
2163
- } = e, l = Ft(
2208
+ } = e, o = Pr(
2164
2209
  i.metadata
2165
2210
  );
2166
2211
  return {
2167
2212
  ...i,
2168
- ...l ? { metadata: l } : {}
2213
+ ...o ? { metadata: o } : {}
2169
2214
  };
2170
2215
  }
2171
- function Ft(e) {
2216
+ function Pr(e) {
2172
2217
  if (!e || typeof e != "object" || Array.isArray(e))
2173
2218
  return e;
2174
- const r = e.dataAppDebug;
2175
- if (!r || typeof r != "object" || Array.isArray(r))
2219
+ const t = e.dataAppDebug;
2220
+ if (!t || typeof t != "object" || Array.isArray(t))
2176
2221
  return e;
2177
- const { compiledSql: t, ...n } = r;
2222
+ const { compiledSql: r, ...n } = t;
2178
2223
  return {
2179
2224
  ...e,
2180
2225
  dataAppDebug: n
2181
2226
  };
2182
2227
  }
2183
- function Mt(e) {
2228
+ function Vr(e) {
2184
2229
  return e === void 0 || e === !1 ? {
2185
2230
  enabled: !1,
2186
2231
  exposeWindowBridge: !1,
2187
- maxEventsPerQuery: ye,
2188
- maxQueries: he
2232
+ maxEventsPerQuery: he,
2233
+ maxQueries: ve
2189
2234
  } : e === !0 ? {
2190
2235
  enabled: !0,
2191
2236
  exposeWindowBridge: !1,
2192
- maxEventsPerQuery: ye,
2193
- maxQueries: he
2237
+ maxEventsPerQuery: he,
2238
+ maxQueries: ve
2194
2239
  } : {
2195
2240
  enabled: e.enabled !== !1,
2196
2241
  exposeWindowBridge: e.exposeWindowBridge === !0,
2197
- maxEventsPerQuery: Qe(
2242
+ maxEventsPerQuery: Ge(
2198
2243
  e.maxEventsPerQuery,
2199
- ye,
2200
- zr
2244
+ he,
2245
+ Pt
2201
2246
  ),
2202
- maxQueries: Qe(
2247
+ maxQueries: Ge(
2203
2248
  e.maxQueries,
2204
- he,
2205
- jr
2249
+ ve,
2250
+ Vt
2206
2251
  )
2207
2252
  };
2208
2253
  }
2209
- function Pe(e) {
2210
- const t = [
2254
+ function Qe(e) {
2255
+ const r = [
2211
2256
  e == null ? void 0 : e.sourceHint,
2212
2257
  ...(e == null ? void 0 : e.sourceHints) || []
2213
2258
  ].filter((n) => !!n).map((n) => ({
2214
- file: ae(n.file),
2215
- line: Ve(n.line),
2216
- column: Ve(n.column),
2217
- exportName: ae(n.exportName),
2218
- component: ae(n.component),
2219
- note: ae(n.note)
2259
+ file: le(n.file),
2260
+ line: Ue(n.line),
2261
+ column: Ue(n.column),
2262
+ exportName: le(n.exportName),
2263
+ component: le(n.component),
2264
+ note: le(n.note)
2220
2265
  })).filter(
2221
2266
  (n) => !!(n.file || n.line || n.column || n.exportName || n.component || n.note)
2222
2267
  );
2223
- return t.length ? t : void 0;
2268
+ return r.length ? r : void 0;
2224
2269
  }
2225
- function ae(e) {
2270
+ function le(e) {
2226
2271
  if (typeof e != "string")
2227
2272
  return;
2228
- const r = e.trim();
2229
- return r || void 0;
2273
+ const t = e.trim();
2274
+ return t || void 0;
2230
2275
  }
2231
- function Ve(e) {
2276
+ function Ue(e) {
2232
2277
  return typeof e == "number" && Number.isInteger(e) && e > 0 ? e : void 0;
2233
2278
  }
2234
- function Qe(e, r, t) {
2235
- return e === void 0 || !Number.isFinite(e) || !Number.isInteger(e) || e <= 0 ? r : Math.min(e, t);
2279
+ function Ge(e, t, r) {
2280
+ return e === void 0 || !Number.isFinite(e) || !Number.isInteger(e) || e <= 0 ? t : Math.min(e, r);
2236
2281
  }
2237
- function Wt(e) {
2282
+ function Qr(e) {
2238
2283
  return typeof e.id == "string" && e.id.trim() ? e.id : void 0;
2239
2284
  }
2240
- function zt(e) {
2285
+ function Ur(e) {
2241
2286
  switch (e) {
2242
2287
  case "metric":
2243
2288
  return "semaphor.metric";
@@ -2252,51 +2297,51 @@ function zt(e) {
2252
2297
  case "sql":
2253
2298
  return "semaphor.sql";
2254
2299
  default:
2255
- return me(e);
2300
+ return ye(e);
2256
2301
  }
2257
2302
  }
2258
- function me(e) {
2303
+ function ye(e) {
2259
2304
  throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
2260
2305
  }
2261
- function jt(e) {
2262
- if (Ht(e))
2306
+ function Gr(e) {
2307
+ if (Jr(e))
2263
2308
  return;
2264
- const r = e.value;
2265
- if (r !== void 0) {
2266
- if (Array.isArray(r)) {
2267
- const t = r.filter(
2309
+ const t = e.value;
2310
+ if (t !== void 0) {
2311
+ if (Array.isArray(t)) {
2312
+ const r = t.filter(
2268
2313
  (n) => typeof n == "string" || typeof n == "number" || typeof n == "boolean"
2269
2314
  ).map((n) => String(n));
2270
- if (t.length === r.length && t.length > 0) {
2271
- const n = t.slice(0, 3).join(", "), i = t.length > 3 ? `, +${t.length - 3} more` : "";
2272
- return Ue(`${n}${i}`);
2315
+ if (r.length === t.length && r.length > 0) {
2316
+ const n = r.slice(0, 3).join(", "), i = r.length > 3 ? `, +${r.length - 3} more` : "";
2317
+ return Je(`${n}${i}`);
2273
2318
  }
2274
- return `${r.length} selected`;
2319
+ return `${t.length} selected`;
2275
2320
  }
2276
- return typeof r == "number" || typeof r == "boolean" ? String(r) : typeof r == "string" ? Ue(r) : r && typeof r == "object" ? `object(${Object.keys(r).slice(0, 5).join(",")})` : String(r);
2321
+ return typeof t == "number" || typeof t == "boolean" ? String(t) : typeof t == "string" ? Je(t) : t && typeof t == "object" ? `object(${Object.keys(t).slice(0, 5).join(",")})` : String(t);
2277
2322
  }
2278
2323
  }
2279
- function Ue(e) {
2324
+ function Je(e) {
2280
2325
  return e.length > 80 ? `${e.slice(0, 77)}...` : e;
2281
2326
  }
2282
- function Ht(e) {
2283
- var t;
2284
- const r = [
2327
+ function Jr(e) {
2328
+ var r;
2329
+ const t = [
2285
2330
  e.inputId,
2286
2331
  e.label,
2287
- (t = e.field) == null ? void 0 : t.name
2332
+ (r = e.field) == null ? void 0 : r.name
2288
2333
  ].filter(Boolean).join(" ").toLowerCase();
2289
2334
  return ["token", "secret", "password", "email", "phone", "ssn"].some(
2290
- (n) => r.includes(n)
2335
+ (n) => t.includes(n)
2291
2336
  );
2292
2337
  }
2293
- function Pt(e) {
2294
- const r = /* @__PURE__ */ new Map();
2295
- return ce(e, (t) => {
2296
- Gt(t) && r.set(yr(t), t);
2297
- }), [...r.values()];
2338
+ function Yr(e) {
2339
+ const t = /* @__PURE__ */ new Map();
2340
+ return fe(e, (r) => {
2341
+ tn(r) && t.set(bt(r), r);
2342
+ }), [...t.values()];
2298
2343
  }
2299
- function Vt(e) {
2344
+ function Xr(e) {
2300
2345
  switch (e.queryKind) {
2301
2346
  case "metric":
2302
2347
  case "analysis":
@@ -2319,76 +2364,76 @@ function Vt(e) {
2319
2364
  return P(e.fields || []);
2320
2365
  case "matrix":
2321
2366
  return P([
2322
- ...(e.rows || []).map(Se),
2323
- ...(e.columns || []).map(Se),
2324
- ...(e.values || []).map(Se)
2367
+ ...(e.rows || []).map(we),
2368
+ ...(e.columns || []).map(we),
2369
+ ...(e.values || []).map(we)
2325
2370
  ]);
2326
2371
  default:
2327
- return me(e);
2372
+ return ye(e);
2328
2373
  }
2329
2374
  }
2330
- function Qt(e, r) {
2331
- const t = [
2332
- ...(e.inputs || []).map(gr),
2333
- ...(r || []).map((n) => n.field)
2375
+ function Zr(e, t) {
2376
+ const r = [
2377
+ ...(e.inputs || []).map(vt),
2378
+ ...(t || []).map((n) => n.field)
2334
2379
  ];
2335
- return P(t);
2380
+ return P(r);
2336
2381
  }
2337
2382
  function P(e) {
2338
- const r = /* @__PURE__ */ new Map();
2339
- return e.forEach((t) => {
2340
- t && te(t) && r.set(Oe(t), t);
2341
- }), [...r.values()];
2383
+ const t = /* @__PURE__ */ new Map();
2384
+ return e.forEach((r) => {
2385
+ r && ne(r) && t.set(Oe(r), r);
2386
+ }), [...t.values()];
2342
2387
  }
2343
- function gr(e) {
2388
+ function vt(e) {
2344
2389
  if (!e || typeof e != "object")
2345
2390
  return;
2346
- const r = e.toAnalyticsInput;
2347
- if (typeof r == "function") {
2348
- const n = r.call(e);
2349
- return gr(n);
2391
+ const t = e.toAnalyticsInput;
2392
+ if (typeof t == "function") {
2393
+ const n = t.call(e);
2394
+ return vt(n);
2350
2395
  }
2351
- const t = e.field;
2352
- return te(t) ? t : void 0;
2396
+ const r = e.field;
2397
+ return ne(r) ? r : void 0;
2353
2398
  }
2354
- function Se(e) {
2355
- if (te(e))
2399
+ function we(e) {
2400
+ if (ne(e))
2356
2401
  return e;
2357
2402
  if (!e || typeof e != "object")
2358
2403
  return;
2359
- const r = e.field;
2360
- return te(r) ? r : void 0;
2404
+ const t = e.field;
2405
+ return ne(t) ? t : void 0;
2361
2406
  }
2362
- function Ut(e) {
2363
- const r = /* @__PURE__ */ new Map();
2364
- return ce(e, (t) => {
2365
- te(t) && r.set(Oe(t), t);
2366
- }), [...r.values()];
2407
+ function en(e) {
2408
+ const t = /* @__PURE__ */ new Map();
2409
+ return fe(e, (r) => {
2410
+ ne(r) && t.set(Oe(r), r);
2411
+ }), [...t.values()];
2367
2412
  }
2368
- function ce(e, r) {
2413
+ function fe(e, t) {
2369
2414
  if (!(!e || typeof e != "object")) {
2370
- if (r(e), Array.isArray(e)) {
2371
- e.forEach((t) => ce(t, r));
2415
+ if (t(e), Array.isArray(e)) {
2416
+ e.forEach((r) => fe(r, t));
2372
2417
  return;
2373
2418
  }
2374
2419
  Object.values(e).forEach(
2375
- (t) => ce(t, r)
2420
+ (r) => fe(r, t)
2376
2421
  );
2377
2422
  }
2378
2423
  }
2379
- function Gt(e) {
2424
+ function tn(e) {
2380
2425
  if (!e || typeof e != "object")
2381
2426
  return !1;
2382
- const r = e;
2383
- return r.kind === "semantic" ? typeof r.domainId == "string" && typeof r.datasetName == "string" : r.kind === "physical" ? typeof r.connectionId == "string" && typeof r.tableName == "string" : r.kind === "sql" ? typeof r.connectionId == "string" : !1;
2427
+ const t = e;
2428
+ return t.kind === "semantic" ? typeof t.domainId == "string" && typeof t.datasetName == "string" : t.kind === "physical" ? typeof t.connectionId == "string" && typeof t.tableName == "string" : t.kind === "sql" ? typeof t.connectionId == "string" : !1;
2384
2429
  }
2385
- function te(e) {
2430
+ function ne(e) {
2386
2431
  if (!e || typeof e != "object")
2387
2432
  return !1;
2388
- const r = e;
2389
- return typeof r.name == "string" && (r.source !== void 0 || r.role !== void 0 || r.dataType !== void 0 || r.aggregate !== void 0);
2433
+ const t = e;
2434
+ return typeof t.name == "string" && (t.source !== void 0 || t.role !== void 0 || t.dataType !== void 0 || t.aggregate !== void 0);
2390
2435
  }
2391
- function yr(e) {
2436
+ function bt(e) {
2392
2437
  return e.kind === "semantic" ? [
2393
2438
  e.kind,
2394
2439
  e.domainId,
@@ -2406,38 +2451,38 @@ function Oe(e) {
2406
2451
  e.name,
2407
2452
  e.role,
2408
2453
  e.aggregate,
2409
- e.source ? yr(e.source) : ""
2454
+ e.source ? bt(e.source) : ""
2410
2455
  ].join(":");
2411
2456
  }
2412
- function Jt(e) {
2413
- const r = e;
2414
- return typeof (r == null ? void 0 : r.rowCount) == "number" ? r.rowCount : Array.isArray(r == null ? void 0 : r.records) ? r.records.length : void 0;
2457
+ function rn(e) {
2458
+ const t = e;
2459
+ return typeof (t == null ? void 0 : t.rowCount) == "number" ? t.rowCount : Array.isArray(t == null ? void 0 : t.records) ? t.records.length : void 0;
2415
2460
  }
2416
- function Yt(e) {
2417
- const r = e;
2418
- return Array.isArray(r == null ? void 0 : r.columns) ? r.columns.length : void 0;
2461
+ function nn(e) {
2462
+ const t = e;
2463
+ return Array.isArray(t == null ? void 0 : t.columns) ? t.columns.length : void 0;
2419
2464
  }
2420
- function Ge(e) {
2421
- const r = e;
2422
- return r == null ? void 0 : r.executionResult;
2465
+ function Ye(e) {
2466
+ const t = e;
2467
+ return t == null ? void 0 : t.executionResult;
2423
2468
  }
2424
- function Je(e) {
2425
- const r = e;
2426
- return typeof (r == null ? void 0 : r.requestId) == "string" ? r.requestId : void 0;
2469
+ function Xe(e) {
2470
+ const t = e;
2471
+ return typeof (t == null ? void 0 : t.requestId) == "string" ? t.requestId : void 0;
2427
2472
  }
2428
- function hr(e) {
2429
- let r = 2166136261;
2430
- for (let t = 0; t < e.length; t += 1)
2431
- r ^= e.charCodeAt(t), r = Math.imul(r, 16777619);
2432
- return (r >>> 0).toString(36);
2473
+ function St(e) {
2474
+ let t = 2166136261;
2475
+ for (let r = 0; r < e.length; r += 1)
2476
+ t ^= e.charCodeAt(r), t = Math.imul(t, 16777619);
2477
+ return (t >>> 0).toString(36);
2433
2478
  }
2434
- function le() {
2479
+ function ue() {
2435
2480
  return (/* @__PURE__ */ new Date()).toISOString();
2436
2481
  }
2437
- function Le() {
2482
+ function Be() {
2438
2483
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
2439
2484
  }
2440
- const Xt = [
2485
+ const on = [
2441
2486
  "records",
2442
2487
  "changes",
2443
2488
  "drivers",
@@ -2445,7 +2490,7 @@ const Xt = [
2445
2490
  "largestPositiveChanges",
2446
2491
  "largestNegativeDrivers",
2447
2492
  "largestPositiveDrivers"
2448
- ], Zt = [
2493
+ ], sn = [
2449
2494
  "records",
2450
2495
  "changes",
2451
2496
  "drivers",
@@ -2454,13 +2499,13 @@ const Xt = [
2454
2499
  "largestNegativeDrivers",
2455
2500
  "largestPositiveDrivers"
2456
2501
  ];
2457
- function vr(e) {
2502
+ function wt(e) {
2458
2503
  if (!e)
2459
2504
  return {};
2460
- const r = on(e.executionResult), t = en(e, r), n = tn(t);
2505
+ const t = cn(e.executionResult), r = an(e, t), n = un(r);
2461
2506
  return {
2462
2507
  ...e,
2463
- ...Object.keys(t).length ? { resultSets: t } : {},
2508
+ ...Object.keys(r).length ? { resultSets: r } : {},
2464
2509
  ...n ? {
2465
2510
  columns: n.columns,
2466
2511
  records: n.records,
@@ -2468,136 +2513,136 @@ function vr(e) {
2468
2513
  } : {}
2469
2514
  };
2470
2515
  }
2471
- function en(e, r) {
2472
- const t = rn(e.resultSets);
2473
- for (const i of Xt) {
2474
- if (t[i]) {
2475
- t[i] = br(t[i]);
2516
+ function an(e, t) {
2517
+ const r = ln(e.resultSets);
2518
+ for (const i of on) {
2519
+ if (r[i]) {
2520
+ r[i] = xt(r[i]);
2476
2521
  continue;
2477
2522
  }
2478
- const l = sn(e[i]);
2479
- if (!l.length)
2523
+ const o = fn(e[i]);
2524
+ if (!o.length)
2480
2525
  continue;
2481
- const u = r.length ? r : an(l);
2482
- t[i] = {
2483
- records: Be(l, u),
2526
+ const u = t.length ? t : pn(o);
2527
+ r[i] = {
2528
+ records: Ke(o, u),
2484
2529
  columns: u,
2485
- rowCount: l.length
2530
+ rowCount: o.length
2486
2531
  };
2487
2532
  }
2488
- const n = nn(e.executionResult);
2489
- return n && n.records.length > 0 && !t.records && (t.records = n), t;
2533
+ const n = dn(e.executionResult);
2534
+ return n && n.records.length > 0 && !r.records && (r.records = n), r;
2490
2535
  }
2491
- function rn(e) {
2536
+ function ln(e) {
2492
2537
  return Object.fromEntries(
2493
- Object.entries(e || {}).map(([r, t]) => [
2494
- r,
2495
- br(t)
2538
+ Object.entries(e || {}).map(([t, r]) => [
2539
+ t,
2540
+ xt(r)
2496
2541
  ])
2497
2542
  );
2498
2543
  }
2499
- function br(e) {
2500
- var r;
2544
+ function xt(e) {
2545
+ var t;
2501
2546
  return {
2502
2547
  ...e,
2503
- records: Be(
2548
+ records: Ke(
2504
2549
  e.records || [],
2505
2550
  e.columns || []
2506
2551
  ),
2507
- rowCount: e.rowCount ?? ((r = e.records) == null ? void 0 : r.length) ?? 0
2552
+ rowCount: e.rowCount ?? ((t = e.records) == null ? void 0 : t.length) ?? 0
2508
2553
  };
2509
2554
  }
2510
- function tn(e) {
2511
- var r;
2512
- for (const t of Zt)
2513
- if ((r = e[t]) != null && r.records.length)
2514
- return e[t];
2515
- return Object.values(e).find((t) => t.records.length) || Object.values(e)[0];
2516
- }
2517
- function nn(e) {
2518
- const r = e == null ? void 0 : e.result;
2519
- if (!(!r || r.kind !== "records" && r.kind !== "sql"))
2555
+ function un(e) {
2556
+ var t;
2557
+ for (const r of sn)
2558
+ if ((t = e[r]) != null && t.records.length)
2559
+ return e[r];
2560
+ return Object.values(e).find((r) => r.records.length) || Object.values(e)[0];
2561
+ }
2562
+ function dn(e) {
2563
+ const t = e == null ? void 0 : e.result;
2564
+ if (!(!t || t.kind !== "records" && t.kind !== "sql"))
2520
2565
  return {
2521
- records: Be(r.records, r.columns),
2522
- columns: r.columns,
2523
- rowCount: r.rowCount ?? r.records.length
2566
+ records: Ke(t.records, t.columns),
2567
+ columns: t.columns,
2568
+ rowCount: t.rowCount ?? t.records.length
2524
2569
  };
2525
2570
  }
2526
- function on(e) {
2527
- const r = e == null ? void 0 : e.result;
2528
- return !r || r.kind !== "records" && r.kind !== "sql" ? [] : r.columns;
2571
+ function cn(e) {
2572
+ const t = e == null ? void 0 : e.result;
2573
+ return !t || t.kind !== "records" && t.kind !== "sql" ? [] : t.columns;
2529
2574
  }
2530
- function sn(e) {
2575
+ function fn(e) {
2531
2576
  return Array.isArray(e) ? e.filter(
2532
- (r) => !!(r && typeof r == "object" && !Array.isArray(r))
2577
+ (t) => !!(t && typeof t == "object" && !Array.isArray(t))
2533
2578
  ) : [];
2534
2579
  }
2535
- function Be(e, r) {
2536
- return r.length ? e.map((t) => {
2580
+ function Ke(e, t) {
2581
+ return t.length ? e.map((r) => {
2537
2582
  const n = {};
2538
- return r.forEach((i, l) => {
2539
- const u = ln(t, {
2583
+ return t.forEach((i, o) => {
2584
+ const u = mn(r, {
2540
2585
  name: i.key,
2541
2586
  label: i.label,
2542
- fallbackNames: [i.name, Object.keys(t)[l]]
2587
+ fallbackNames: [i.name, Object.keys(r)[o]]
2543
2588
  });
2544
2589
  u !== void 0 && (n[i.key] = u);
2545
- }), Object.keys(n).length ? n : t;
2590
+ }), Object.keys(n).length ? n : r;
2546
2591
  }) : e;
2547
2592
  }
2548
- function an(e) {
2593
+ function pn(e) {
2549
2594
  return Array.from(
2550
- new Set(e.flatMap((t) => Object.keys(t)))
2551
- ).map((t) => ({
2552
- key: t,
2553
- name: t,
2554
- label: t
2595
+ new Set(e.flatMap((r) => Object.keys(r)))
2596
+ ).map((r) => ({
2597
+ key: r,
2598
+ name: r,
2599
+ label: r
2555
2600
  }));
2556
2601
  }
2557
- function ln(e, r) {
2558
- const t = [
2559
- r.name,
2560
- r.label,
2561
- ...r.fallbackNames || []
2602
+ function mn(e, t) {
2603
+ const r = [
2604
+ t.name,
2605
+ t.label,
2606
+ ...t.fallbackNames || []
2562
2607
  ].filter((n) => !!n);
2563
- for (const n of t)
2608
+ for (const n of r)
2564
2609
  if (Object.prototype.hasOwnProperty.call(e, n))
2565
2610
  return e[n];
2566
2611
  }
2567
- function un() {
2612
+ function yn() {
2568
2613
  return {
2569
- executeAnalysis: (e, r, t) => H(
2614
+ executeAnalysis: (e, t, r) => H(
2570
2615
  e,
2571
- r,
2572
- t ?? {}
2573
- ).then(vr),
2574
- executeMetric: (e, r) => H(e, r),
2575
- executeRecords: (e, r) => H(e, r),
2576
- executeInputOptions: (e, r) => H(e, r),
2577
- executeSql: (e, r) => H(e, r),
2578
- executeMatrix: (e, r) => H(e, r)
2616
+ t,
2617
+ r ?? {}
2618
+ ).then(wt),
2619
+ executeMetric: (e, t) => H(e, t),
2620
+ executeRecords: (e, t) => H(e, t),
2621
+ executeInputOptions: (e, t) => H(e, t),
2622
+ executeSql: (e, t) => H(e, t),
2623
+ executeMatrix: (e, t) => H(e, t)
2579
2624
  };
2580
2625
  }
2581
- async function H(e, r, t) {
2582
- if (!r.token)
2626
+ async function H(e, t, r) {
2627
+ if (!t.token)
2583
2628
  throw new Error(
2584
2629
  "SemaphorDataAppProvider needs a token to execute queries."
2585
2630
  );
2586
- const n = hn(r), i = fn(e, n);
2587
- let l;
2631
+ const n = In(t), i = vn(e, n);
2632
+ let o;
2588
2633
  try {
2589
- l = await fetch(n, {
2634
+ o = await fetch(n, {
2590
2635
  method: "POST",
2591
2636
  headers: {
2592
2637
  "Content-Type": "application/json",
2593
- Authorization: `Bearer ${r.token}`
2638
+ Authorization: `Bearer ${t.token}`
2594
2639
  },
2595
2640
  body: JSON.stringify({
2596
2641
  intent: e,
2597
- activeInputs: r.activeInputs,
2598
- ...t ? { analysisOptions: t } : {},
2642
+ activeInputs: t.activeInputs,
2643
+ ...r ? { analysisOptions: r } : {},
2599
2644
  resultShape: e.kind,
2600
- ...cn(r) ? { debug: { responseDetail: "debug" } } : {}
2645
+ ...hn(t) ? { debug: { responseDetail: "debug" } } : {}
2601
2646
  })
2602
2647
  });
2603
2648
  } catch (c) {
@@ -2605,51 +2650,51 @@ async function H(e, r, t) {
2605
2650
  `${i}: ${c instanceof Error ? c.message : String(c)}`
2606
2651
  );
2607
2652
  }
2608
- const u = await gn(l);
2609
- if (!l.ok || u.error)
2610
- throw dn(
2611
- `${i}: ${u.error || `Semaphor Data App execution failed with status ${l.status}.`}`,
2653
+ const u = await wn(o);
2654
+ if (!o.ok || u.error)
2655
+ throw gn(
2656
+ `${i}: ${u.error || `Semaphor Data App execution failed with status ${o.status}.`}`,
2612
2657
  u
2613
2658
  );
2614
2659
  return u;
2615
2660
  }
2616
- function dn(e, r) {
2617
- const t = new Error(e);
2618
- return r.requestId && (t.requestId = r.requestId), r.details !== void 0 && (t.details = r.details), r.executionResult !== void 0 && (t.executionResult = r.executionResult), t;
2661
+ function gn(e, t) {
2662
+ const r = new Error(e);
2663
+ return t.requestId && (r.requestId = t.requestId), t.details !== void 0 && (r.details = t.details), t.executionResult !== void 0 && (r.executionResult = t.executionResult), r;
2619
2664
  }
2620
- function cn(e) {
2621
- const r = e.debug;
2622
- return r ? r === !0 ? !0 : r.enabled !== !1 && r.requestServerDebug !== !1 : !1;
2665
+ function hn(e) {
2666
+ const t = e.debug;
2667
+ return t ? t === !0 ? !0 : t.enabled !== !1 && t.requestServerDebug !== !1 : !1;
2623
2668
  }
2624
- function fn(e, r) {
2669
+ function vn(e, t) {
2625
2670
  return [
2626
2671
  `Semaphor ${e.kind} query`,
2627
2672
  e.id ? `id=${e.id}` : void 0,
2628
2673
  e.label ? `label=${e.label}` : void 0,
2629
- pn(e),
2630
- `endpoint=${mn(r)}`
2631
- ].filter((t) => !!t).join(" ");
2632
- }
2633
- function pn(e) {
2634
- const r = "source" in e ? e.source : void 0;
2635
- if (!(!r || typeof r != "object")) {
2636
- if (r.kind === "semantic")
2674
+ bn(e),
2675
+ `endpoint=${Sn(t)}`
2676
+ ].filter((r) => !!r).join(" ");
2677
+ }
2678
+ function bn(e) {
2679
+ const t = "source" in e ? e.source : void 0;
2680
+ if (!(!t || typeof t != "object")) {
2681
+ if (t.kind === "semantic")
2637
2682
  return `source=${[
2638
- r.domainId,
2639
- r.datasetId || r.datasetName
2683
+ t.domainId,
2684
+ t.datasetId || t.datasetName
2640
2685
  ].filter(Boolean).join("/")}`;
2641
- if (r.kind === "physical")
2686
+ if (t.kind === "physical")
2642
2687
  return `source=${[
2643
- r.connectionId,
2644
- r.databaseName,
2645
- r.schemaName,
2646
- r.tableName
2688
+ t.connectionId,
2689
+ t.databaseName,
2690
+ t.schemaName,
2691
+ t.tableName
2647
2692
  ].filter(Boolean).join("/")}`;
2648
- if (r.kind === "sql")
2649
- return r.connectionId ? `source=${r.connectionId}` : void 0;
2693
+ if (t.kind === "sql")
2694
+ return t.connectionId ? `source=${t.connectionId}` : void 0;
2650
2695
  }
2651
2696
  }
2652
- function mn(e) {
2697
+ function Sn(e) {
2653
2698
  if (!e)
2654
2699
  return "/api/v1/data-app/execute";
2655
2700
  try {
@@ -2658,218 +2703,218 @@ function mn(e) {
2658
2703
  return e;
2659
2704
  }
2660
2705
  }
2661
- async function gn(e) {
2662
- const r = await e.text().catch(() => "");
2663
- if (!r.trim())
2706
+ async function wn(e) {
2707
+ const t = await e.text().catch(() => "");
2708
+ if (!t.trim())
2664
2709
  return e.ok ? {
2665
2710
  error: "Semaphor Data App execution returned an empty response."
2666
2711
  } : {};
2667
2712
  try {
2668
- return JSON.parse(r);
2713
+ return JSON.parse(t);
2669
2714
  } catch {
2670
2715
  return e.ok ? {
2671
2716
  error: "Semaphor Data App execution returned invalid JSON.",
2672
- details: r
2717
+ details: t
2673
2718
  } : {
2674
- error: yn(e, r),
2675
- details: r
2719
+ error: xn(e, t),
2720
+ details: t
2676
2721
  };
2677
2722
  }
2678
2723
  }
2679
- function yn(e, r) {
2680
- const t = e.statusText ? ` ${e.statusText}` : "", n = r.replace(/\s+/g, " ").trim();
2681
- return n ? `Semaphor Data App execution failed with status ${e.status}${t}: ${n.slice(0, 240)}` : `Semaphor Data App execution failed with status ${e.status}${t}.`;
2724
+ function xn(e, t) {
2725
+ const r = e.statusText ? ` ${e.statusText}` : "", n = t.replace(/\s+/g, " ").trim();
2726
+ return n ? `Semaphor Data App execution failed with status ${e.status}${r}: ${n.slice(0, 240)}` : `Semaphor Data App execution failed with status ${e.status}${r}.`;
2682
2727
  }
2683
- function hn(e) {
2684
- const r = vn(e).replace(/\/+$/, "");
2685
- return r ? r.endsWith("/api") ? `${r}/v1/data-app/execute` : `${r}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
2728
+ function In(e) {
2729
+ const t = qn(e).replace(/\/+$/, "");
2730
+ return t ? t.endsWith("/api") ? `${t}/v1/data-app/execute` : `${t}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
2686
2731
  }
2687
- function vn(e) {
2732
+ function qn(e) {
2688
2733
  if (e.apiBaseUrl)
2689
2734
  return e.apiBaseUrl;
2690
2735
  if (!e.token)
2691
2736
  return "";
2692
2737
  try {
2693
- return Mr(e.token).apiServiceUrl || "";
2738
+ return jt(e.token).apiServiceUrl || "";
2694
2739
  } catch {
2695
2740
  return "";
2696
2741
  }
2697
2742
  }
2698
- const Sr = fe({});
2699
- function bn() {
2743
+ const It = pe({});
2744
+ function An() {
2700
2745
  if (!(typeof window > "u"))
2701
2746
  return window.__SEMAPHOR_DATA_APP_RUNTIME__;
2702
2747
  }
2703
- function Sn() {
2704
- return z(Sr);
2748
+ function Tn() {
2749
+ return z(It);
2705
2750
  }
2706
- const xe = { value: null }, we = {}, xn = { records: [] }, Ie = { options: [] }, wn = { records: [] }, qe = {};
2707
- function In(e) {
2708
- const r = U(e.inputs), t = Cr(e);
2751
+ const xe = { value: null }, Ie = {}, Rn = { records: [] }, qe = { options: [] }, En = { records: [] }, Ae = {};
2752
+ function kn(e) {
2753
+ const t = U(e.inputs), r = Ot(e);
2709
2754
  try {
2710
- const n = Dr(e), i = G(n);
2755
+ const n = Bt(e), i = G(n);
2711
2756
  return i ? {
2712
2757
  error: i,
2713
- activeInputs: r,
2714
- analysisOptions: t,
2758
+ activeInputs: t,
2759
+ analysisOptions: r,
2715
2760
  queryKey: q(
2716
2761
  void 0,
2717
- r,
2762
+ t,
2718
2763
  i,
2719
- t
2764
+ r
2720
2765
  ),
2721
- idleData: we
2766
+ idleData: Ie
2722
2767
  } : {
2723
2768
  intent: n,
2724
2769
  error: null,
2725
- activeInputs: r,
2726
- analysisOptions: t,
2727
- queryKey: q(n, r, void 0, t),
2728
- idleData: we
2770
+ activeInputs: t,
2771
+ analysisOptions: r,
2772
+ queryKey: q(n, t, void 0, r),
2773
+ idleData: Ie
2729
2774
  };
2730
2775
  } catch (n) {
2731
2776
  const i = N(n);
2732
2777
  return {
2733
2778
  error: i,
2734
- activeInputs: r,
2735
- analysisOptions: t,
2779
+ activeInputs: t,
2780
+ analysisOptions: r,
2736
2781
  queryKey: q(
2737
2782
  void 0,
2738
- r,
2783
+ t,
2739
2784
  i,
2740
- t
2785
+ r
2741
2786
  ),
2742
- idleData: we
2787
+ idleData: Ie
2743
2788
  };
2744
2789
  }
2745
2790
  }
2746
- function qn(e) {
2747
- const r = U(e.inputs);
2791
+ function Cn(e) {
2792
+ const t = U(e.inputs);
2748
2793
  try {
2749
- const t = Or(e), n = G(t);
2794
+ const r = Kt(e), n = G(r);
2750
2795
  return n ? {
2751
2796
  error: n,
2752
- activeInputs: r,
2753
- queryKey: q(void 0, r, n),
2797
+ activeInputs: t,
2798
+ queryKey: q(void 0, t, n),
2754
2799
  idleData: xe
2755
2800
  } : {
2756
- intent: t,
2801
+ intent: r,
2757
2802
  error: null,
2758
- activeInputs: r,
2759
- queryKey: q(t, r),
2803
+ activeInputs: t,
2804
+ queryKey: q(r, t),
2760
2805
  idleData: xe
2761
2806
  };
2762
- } catch (t) {
2763
- const n = N(t);
2807
+ } catch (r) {
2808
+ const n = N(r);
2764
2809
  return {
2765
2810
  error: n,
2766
- activeInputs: r,
2767
- queryKey: q(void 0, r, n),
2811
+ activeInputs: t,
2812
+ queryKey: q(void 0, t, n),
2768
2813
  idleData: xe
2769
2814
  };
2770
2815
  }
2771
2816
  }
2772
- function An(e) {
2773
- const r = U(e.inputs), t = xn;
2817
+ function Dn(e) {
2818
+ const t = U(e.inputs), r = Rn;
2774
2819
  try {
2775
- const n = kr(e), i = G(n);
2820
+ const n = Lt(e), i = G(n);
2776
2821
  return i ? {
2777
2822
  error: i,
2778
- activeInputs: r,
2779
- queryKey: q(void 0, r, i),
2780
- idleData: t
2823
+ activeInputs: t,
2824
+ queryKey: q(void 0, t, i),
2825
+ idleData: r
2781
2826
  } : {
2782
2827
  intent: n,
2783
2828
  error: null,
2784
- activeInputs: r,
2785
- queryKey: q(n, r),
2786
- idleData: t
2829
+ activeInputs: t,
2830
+ queryKey: q(n, t),
2831
+ idleData: r
2787
2832
  };
2788
2833
  } catch (n) {
2789
2834
  const i = N(n);
2790
2835
  return {
2791
2836
  error: i,
2792
- activeInputs: r,
2793
- queryKey: q(void 0, r, i),
2794
- idleData: t
2837
+ activeInputs: t,
2838
+ queryKey: q(void 0, t, i),
2839
+ idleData: r
2795
2840
  };
2796
2841
  }
2797
2842
  }
2798
- function Rn(e) {
2799
- const r = U(e.inputs);
2843
+ function Ln(e) {
2844
+ const t = U(e.inputs);
2800
2845
  try {
2801
- const t = Tr(e), n = G(t);
2846
+ const r = Dt(e), n = G(r);
2802
2847
  return n ? {
2803
2848
  error: n,
2804
- activeInputs: r,
2805
- queryKey: q(void 0, r, n),
2806
- idleData: Ie
2849
+ activeInputs: t,
2850
+ queryKey: q(void 0, t, n),
2851
+ idleData: qe
2807
2852
  } : {
2808
- intent: t,
2853
+ intent: r,
2809
2854
  error: null,
2810
- activeInputs: r,
2811
- queryKey: q(t, r),
2812
- idleData: Ie
2855
+ activeInputs: t,
2856
+ queryKey: q(r, t),
2857
+ idleData: qe
2813
2858
  };
2814
- } catch (t) {
2815
- const n = N(t);
2859
+ } catch (r) {
2860
+ const n = N(r);
2816
2861
  return {
2817
2862
  error: n,
2818
- activeInputs: r,
2819
- queryKey: q(void 0, r, n),
2820
- idleData: Ie
2863
+ activeInputs: t,
2864
+ queryKey: q(void 0, t, n),
2865
+ idleData: qe
2821
2866
  };
2822
2867
  }
2823
2868
  }
2824
- function En(e) {
2825
- const r = U(e.inputs), t = wn;
2869
+ function On(e) {
2870
+ const t = U(e.inputs), r = En;
2826
2871
  try {
2827
- const n = Er(e), i = G(n);
2872
+ const n = Ct(e), i = G(n);
2828
2873
  return i ? {
2829
2874
  error: i,
2830
- activeInputs: r,
2831
- queryKey: q(void 0, r, i),
2832
- idleData: t
2875
+ activeInputs: t,
2876
+ queryKey: q(void 0, t, i),
2877
+ idleData: r
2833
2878
  } : {
2834
2879
  intent: n,
2835
2880
  error: null,
2836
- activeInputs: r,
2837
- queryKey: q(n, r),
2838
- idleData: t
2881
+ activeInputs: t,
2882
+ queryKey: q(n, t),
2883
+ idleData: r
2839
2884
  };
2840
2885
  } catch (n) {
2841
2886
  const i = N(n);
2842
2887
  return {
2843
2888
  error: i,
2844
- activeInputs: r,
2845
- queryKey: q(void 0, r, i),
2846
- idleData: t
2889
+ activeInputs: t,
2890
+ queryKey: q(void 0, t, i),
2891
+ idleData: r
2847
2892
  };
2848
2893
  }
2849
2894
  }
2850
- function Tn(e) {
2851
- const r = U(e.inputs);
2895
+ function Bn(e) {
2896
+ const t = U(e.inputs);
2852
2897
  try {
2853
- const t = Rr(e), n = G(t);
2898
+ const r = kt(e), n = G(r);
2854
2899
  return n ? {
2855
2900
  error: n,
2856
- activeInputs: r,
2857
- queryKey: q(void 0, r, n),
2858
- idleData: qe
2901
+ activeInputs: t,
2902
+ queryKey: q(void 0, t, n),
2903
+ idleData: Ae
2859
2904
  } : {
2860
- intent: t,
2905
+ intent: r,
2861
2906
  error: null,
2862
- activeInputs: r,
2863
- queryKey: q(t, r),
2864
- idleData: qe
2907
+ activeInputs: t,
2908
+ queryKey: q(r, t),
2909
+ idleData: Ae
2865
2910
  };
2866
- } catch (t) {
2867
- const n = N(t);
2911
+ } catch (r) {
2912
+ const n = N(r);
2868
2913
  return {
2869
2914
  error: n,
2870
- activeInputs: r,
2871
- queryKey: q(void 0, r, n),
2872
- idleData: qe
2915
+ activeInputs: t,
2916
+ queryKey: q(void 0, t, n),
2917
+ idleData: Ae
2873
2918
  };
2874
2919
  }
2875
2920
  }
@@ -2877,36 +2922,36 @@ function N(e) {
2877
2922
  return e instanceof Error ? e : new Error(String(e));
2878
2923
  }
2879
2924
  function G(e) {
2880
- const r = Wr(e);
2881
- if (r.ok)
2925
+ const t = Ht(e);
2926
+ if (t.ok)
2882
2927
  return null;
2883
- const t = r.errors.map(
2928
+ const r = t.errors.map(
2884
2929
  (n) => n.path ? `${n.code} at ${n.path}: ${n.message}` : `${n.code}: ${n.message}`
2885
2930
  ).join("; ");
2886
- return new Error(`Invalid Semaphor analytics intent. ${t}`);
2931
+ return new Error(`Invalid Semaphor analytics intent. ${r}`);
2887
2932
  }
2888
- function q(e, r, t, n) {
2933
+ function q(e, t, r, n) {
2889
2934
  return JSON.stringify({
2890
2935
  intent: e,
2891
- activeInputs: r,
2936
+ activeInputs: t,
2892
2937
  analysisOptions: n,
2893
- error: t == null ? void 0 : t.message
2938
+ error: r == null ? void 0 : r.message
2894
2939
  });
2895
2940
  }
2896
- function Vn(e) {
2897
- const [r, t] = Q(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), i = n ? e.value : r, l = b(
2898
- () => Ze(e.options),
2941
+ function Xn(e) {
2942
+ const [t, r] = Q(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), i = n ? e.value : t, o = b(
2943
+ () => tt(e.options),
2899
2944
  [e.options]
2900
- ), u = C(
2945
+ ), u = D(
2901
2946
  (d) => {
2902
- var g;
2947
+ var y;
2903
2948
  const f = d;
2904
- (g = e.onValueChange) == null || g.call(e, f), n || t(f);
2949
+ (y = e.onValueChange) == null || y.call(e, f), n || r(f);
2905
2950
  },
2906
2951
  [n, e]
2907
- ), c = C(() => u(void 0), [u]);
2952
+ ), c = D(() => u(void 0), [u]);
2908
2953
  return b(() => {
2909
- const d = er(e);
2954
+ const d = rt(e);
2910
2955
  return {
2911
2956
  id: e.id,
2912
2957
  kind: e.kind,
@@ -2916,7 +2961,7 @@ function Vn(e) {
2916
2961
  relationshipHint: d.relationshipHint,
2917
2962
  controlRole: e.kind === "control" ? e.role : void 0,
2918
2963
  value: i,
2919
- options: l,
2964
+ options: o,
2920
2965
  isActive: re(i),
2921
2966
  setValue: u,
2922
2967
  clear: c,
@@ -2932,15 +2977,15 @@ function Vn(e) {
2932
2977
  controlRole: e.kind === "control" ? e.role : void 0
2933
2978
  })
2934
2979
  };
2935
- }, [c, l, u, e, i]);
2980
+ }, [c, o, u, e, i]);
2936
2981
  }
2937
- function Qn(e) {
2938
- const [r, t] = Q(() => On(e));
2939
- return L(() => {
2940
- t((n) => {
2982
+ function Zn(e) {
2983
+ const [t, r] = Q(() => Nn(e));
2984
+ return B(() => {
2985
+ r((n) => {
2941
2986
  let i = n;
2942
- for (const l of e)
2943
- !Object.prototype.hasOwnProperty.call(i, l.id) && l.defaultValue !== void 0 && (i = { ...i, [l.id]: l.defaultValue });
2987
+ for (const o of e)
2988
+ !Object.prototype.hasOwnProperty.call(i, o.id) && o.defaultValue !== void 0 && (i = { ...i, [o.id]: o.defaultValue });
2944
2989
  return i;
2945
2990
  });
2946
2991
  }, [e]), b(
@@ -2948,13 +2993,13 @@ function Qn(e) {
2948
2993
  const i = Object.prototype.hasOwnProperty.call(
2949
2994
  n,
2950
2995
  "value"
2951
- ), l = i ? n.value : r[n.id], u = Ze(n.options), c = (g) => {
2952
- var y;
2953
- (y = n.onValueChange) == null || y.call(n, g), i || t((h) => ({
2996
+ ), o = i ? n.value : t[n.id], u = tt(n.options), c = (y) => {
2997
+ var g;
2998
+ (g = n.onValueChange) == null || g.call(n, y), i || r((h) => ({
2954
2999
  ...h,
2955
- [n.id]: g
3000
+ [n.id]: y
2956
3001
  }));
2957
- }, d = () => c(void 0), f = er(n);
3002
+ }, d = () => c(void 0), f = rt(n);
2958
3003
  return {
2959
3004
  id: n.id,
2960
3005
  kind: n.kind,
@@ -2963,9 +3008,9 @@ function Qn(e) {
2963
3008
  operator: f.operator,
2964
3009
  relationshipHint: f.relationshipHint,
2965
3010
  controlRole: n.kind === "control" ? n.role : void 0,
2966
- value: l,
3011
+ value: o,
2967
3012
  options: u,
2968
- isActive: re(l),
3013
+ isActive: re(o),
2969
3014
  setValue: c,
2970
3015
  clear: d,
2971
3016
  toAnalyticsInput: () => ({
@@ -2973,89 +3018,89 @@ function Qn(e) {
2973
3018
  field: f.field,
2974
3019
  kind: n.kind,
2975
3020
  label: n.label,
2976
- value: l,
2977
- isActive: re(l),
3021
+ value: o,
3022
+ isActive: re(o),
2978
3023
  operator: f.operator,
2979
3024
  relationshipHint: f.relationshipHint,
2980
3025
  controlRole: n.kind === "control" ? n.role : void 0
2981
3026
  })
2982
3027
  };
2983
3028
  }),
2984
- [e, r]
3029
+ [e, t]
2985
3030
  );
2986
3031
  }
2987
- function Un(e, r) {
2988
- const t = (r == null ? void 0 : r.status) === "success" ? r.options : void 0, n = b(() => Cn(t), [t]);
2989
- L(() => {
2990
- kn(e.value, t) || e.clear();
2991
- }, [e, n, r == null ? void 0 : r.status, t]);
3032
+ function ei(e, t) {
3033
+ const r = (t == null ? void 0 : t.status) === "success" ? t.options : void 0, n = b(() => $n(r), [r]);
3034
+ B(() => {
3035
+ Kn(e.value, r) || e.clear();
3036
+ }, [e, n, t == null ? void 0 : t.status, r]);
2992
3037
  }
2993
- function kn(e, r) {
2994
- if (!re(e) || r === void 0)
3038
+ function Kn(e, t) {
3039
+ if (!re(e) || t === void 0)
2995
3040
  return !0;
2996
- const t = new Set(
2997
- r.map((i) => Ye(i.value))
3041
+ const r = new Set(
3042
+ t.map((i) => Ze(i.value))
2998
3043
  );
2999
3044
  return (Array.isArray(e) ? e : [e]).every(
3000
- (i) => t.has(Ye(i))
3045
+ (i) => r.has(Ze(i))
3001
3046
  );
3002
3047
  }
3003
- function Cn(e) {
3004
- return JSON.stringify((e || []).map((r) => r.value));
3048
+ function $n(e) {
3049
+ return JSON.stringify((e || []).map((t) => t.value));
3005
3050
  }
3006
- function Ye(e) {
3051
+ function Ze(e) {
3007
3052
  return `${typeof e}:${String(e)}`;
3008
3053
  }
3009
- function Gn(e, r = {}) {
3010
- const t = b(
3011
- () => r.inputs ? {
3054
+ function ti(e, t = {}) {
3055
+ const r = b(
3056
+ () => t.inputs ? {
3012
3057
  ...e,
3013
- inputs: r.inputs
3058
+ inputs: t.inputs
3014
3059
  } : e,
3015
- [r.inputs, e]
3060
+ [t.inputs, e]
3016
3061
  ), n = b(() => {
3017
- switch (t.queryKind) {
3062
+ switch (r.queryKind) {
3018
3063
  case "metric":
3019
3064
  return {
3020
- queryKind: t.queryKind,
3021
- request: qn(t)
3065
+ queryKind: r.queryKind,
3066
+ request: Cn(r)
3022
3067
  };
3023
3068
  case "analysis":
3024
3069
  return {
3025
- queryKind: t.queryKind,
3026
- request: In(t)
3070
+ queryKind: r.queryKind,
3071
+ request: kn(r)
3027
3072
  };
3028
3073
  case "records":
3029
3074
  return {
3030
- queryKind: t.queryKind,
3031
- request: An(t)
3075
+ queryKind: r.queryKind,
3076
+ request: Dn(r)
3032
3077
  };
3033
3078
  case "inputOptions":
3034
3079
  return {
3035
- queryKind: t.queryKind,
3036
- request: Rn(t)
3080
+ queryKind: r.queryKind,
3081
+ request: Ln(r)
3037
3082
  };
3038
3083
  case "sql":
3039
3084
  return {
3040
- queryKind: t.queryKind,
3041
- request: En(t)
3085
+ queryKind: r.queryKind,
3086
+ request: On(r)
3042
3087
  };
3043
3088
  case "matrix":
3044
3089
  return {
3045
- queryKind: t.queryKind,
3046
- request: Tn(t)
3090
+ queryKind: r.queryKind,
3091
+ request: Bn(r)
3047
3092
  };
3048
3093
  default:
3049
- return Ae(t);
3094
+ return Te(r);
3050
3095
  }
3051
- }, [t]), i = Ur({
3052
- spec: t,
3096
+ }, [r]), i = Yt({
3097
+ spec: r,
3053
3098
  queryKind: n.queryKind,
3054
3099
  queryKey: n.request.queryKey,
3055
3100
  intent: n.request.intent,
3056
3101
  activeInputs: n.request.activeInputs,
3057
- debug: r.debug
3058
- }), l = k(null), u = b(
3102
+ debug: t.debug
3103
+ }), o = C(null), u = b(
3059
3104
  () => ({
3060
3105
  start: i.start,
3061
3106
  success: i.success,
@@ -3068,266 +3113,266 @@ function Gn(e, r = {}) {
3068
3113
  i.start,
3069
3114
  i.success
3070
3115
  ]
3071
- ), c = C(
3072
- (o) => {
3073
- var B, T, v, I, D, E, O, w, K;
3074
- const x = n.request;
3075
- if (x.intent)
3116
+ ), c = D(
3117
+ (a) => {
3118
+ var K, E, v, I, L, R, O, x, k;
3119
+ const w = n.request;
3120
+ if (w.intent)
3076
3121
  switch (n.queryKind) {
3077
3122
  case "metric":
3078
- return (B = o.executor) == null ? void 0 : B.executeMetric(
3079
- x.intent,
3080
- o
3123
+ return (K = a.executor) == null ? void 0 : K.executeMetric(
3124
+ w.intent,
3125
+ a
3081
3126
  );
3082
3127
  case "analysis":
3083
- return (v = (T = o.executor) == null ? void 0 : T.executeAnalysis) == null ? void 0 : v.call(
3084
- T,
3085
- x.intent,
3086
- o,
3087
- x.analysisOptions
3128
+ return (v = (E = a.executor) == null ? void 0 : E.executeAnalysis) == null ? void 0 : v.call(
3129
+ E,
3130
+ w.intent,
3131
+ a,
3132
+ w.analysisOptions
3088
3133
  );
3089
3134
  case "records":
3090
- return (I = o.executor) == null ? void 0 : I.executeRecords(
3091
- x.intent,
3092
- o
3135
+ return (I = a.executor) == null ? void 0 : I.executeRecords(
3136
+ w.intent,
3137
+ a
3093
3138
  );
3094
3139
  case "inputOptions":
3095
- return (D = o.executor) == null ? void 0 : D.executeInputOptions(
3096
- x.intent,
3097
- o
3140
+ return (L = a.executor) == null ? void 0 : L.executeInputOptions(
3141
+ w.intent,
3142
+ a
3098
3143
  );
3099
3144
  case "sql":
3100
- return (O = (E = o.executor) == null ? void 0 : E.executeSql) == null ? void 0 : O.call(
3101
- E,
3102
- x.intent,
3103
- o
3145
+ return (O = (R = a.executor) == null ? void 0 : R.executeSql) == null ? void 0 : O.call(
3146
+ R,
3147
+ w.intent,
3148
+ a
3104
3149
  );
3105
3150
  case "matrix":
3106
- return (K = (w = o.executor) == null ? void 0 : w.executeMatrix) == null ? void 0 : K.call(
3107
- w,
3108
- x.intent,
3109
- o
3151
+ return (k = (x = a.executor) == null ? void 0 : x.executeMatrix) == null ? void 0 : k.call(
3152
+ x,
3153
+ w.intent,
3154
+ a
3110
3155
  );
3111
3156
  default:
3112
- return Ae(n);
3157
+ return Te(n);
3113
3158
  }
3114
3159
  },
3115
3160
  [n]
3116
- ), d = Dn(
3161
+ ), d = _n(
3117
3162
  n.request.queryKey,
3118
3163
  c,
3119
3164
  n.request.idleData,
3120
3165
  n.request.activeInputs,
3121
3166
  u
3122
- ), f = i.queryId, g = i.validationFailure;
3123
- L(() => {
3124
- const o = n.request.error;
3125
- if (!o) {
3126
- l.current = null;
3167
+ ), f = i.queryId, y = i.validationFailure;
3168
+ B(() => {
3169
+ const a = n.request.error;
3170
+ if (!a) {
3171
+ o.current = null;
3127
3172
  return;
3128
3173
  }
3129
- const x = `${f}:${o.message}`;
3130
- l.current !== x && (l.current = x, g(o));
3174
+ const w = `${f}:${a.message}`;
3175
+ o.current !== w && (o.current = w, y(a));
3131
3176
  }, [
3132
3177
  n.request.error,
3133
3178
  n.request.queryKey,
3134
3179
  f,
3135
- g
3180
+ y
3136
3181
  ]);
3137
- const y = n.request.error ? n.request.idleData : d.data, h = n.request.error ? "error" : d.status, m = !n.request.error && d.status === "loading", S = n.request.error || d.error, R = i.trace;
3182
+ const g = n.request.error ? n.request.idleData : d.data, h = n.request.error ? "error" : d.status, m = !n.request.error && d.status === "loading", S = n.request.error || d.error, T = i.trace;
3138
3183
  switch (n.queryKind) {
3139
3184
  case "metric": {
3140
- const o = y;
3185
+ const a = g;
3141
3186
  return {
3142
- id: t.id,
3187
+ id: r.id,
3143
3188
  intent: n.request.intent,
3144
- value: (o == null ? void 0 : o.value) ?? null,
3145
- measures: o == null ? void 0 : o.measures,
3146
- comparisonValue: o == null ? void 0 : o.comparisonValue,
3147
- delta: o == null ? void 0 : o.delta,
3148
- deltaPercent: o == null ? void 0 : o.deltaPercent,
3149
- records: o == null ? void 0 : o.records,
3150
- executionResult: o == null ? void 0 : o.executionResult,
3189
+ value: (a == null ? void 0 : a.value) ?? null,
3190
+ measures: a == null ? void 0 : a.measures,
3191
+ comparisonValue: a == null ? void 0 : a.comparisonValue,
3192
+ delta: a == null ? void 0 : a.delta,
3193
+ deltaPercent: a == null ? void 0 : a.deltaPercent,
3194
+ records: a == null ? void 0 : a.records,
3195
+ executionResult: a == null ? void 0 : a.executionResult,
3151
3196
  status: h,
3152
3197
  isLoading: m,
3153
3198
  error: S,
3154
- trace: R
3199
+ trace: T
3155
3200
  };
3156
3201
  }
3157
3202
  case "analysis": {
3158
- const o = vr(y);
3203
+ const a = wt(g);
3159
3204
  return {
3160
- id: t.id,
3205
+ id: r.id,
3161
3206
  intent: n.request.intent,
3162
- ...o || {},
3207
+ ...a || {},
3163
3208
  status: h,
3164
3209
  isLoading: m,
3165
3210
  error: S,
3166
- trace: R
3211
+ trace: T
3167
3212
  };
3168
3213
  }
3169
3214
  case "records": {
3170
- const o = y;
3215
+ const a = g;
3171
3216
  return {
3172
- id: t.id,
3217
+ id: r.id,
3173
3218
  intent: n.request.intent,
3174
- records: (o == null ? void 0 : o.records) || [],
3175
- columns: o == null ? void 0 : o.columns,
3176
- rowCount: o == null ? void 0 : o.rowCount,
3177
- pagination: o == null ? void 0 : o.pagination,
3178
- executionResult: o == null ? void 0 : o.executionResult,
3219
+ records: (a == null ? void 0 : a.records) || [],
3220
+ columns: a == null ? void 0 : a.columns,
3221
+ rowCount: a == null ? void 0 : a.rowCount,
3222
+ pagination: a == null ? void 0 : a.pagination,
3223
+ executionResult: a == null ? void 0 : a.executionResult,
3179
3224
  status: h,
3180
3225
  isLoading: m,
3181
3226
  error: S,
3182
- trace: R
3227
+ trace: T
3183
3228
  };
3184
3229
  }
3185
3230
  case "inputOptions": {
3186
- const o = y;
3231
+ const a = g;
3187
3232
  return {
3188
- id: t.id,
3233
+ id: r.id,
3189
3234
  intent: n.request.intent,
3190
- options: (o == null ? void 0 : o.options) || [],
3191
- executionResult: o == null ? void 0 : o.executionResult,
3235
+ options: (a == null ? void 0 : a.options) || [],
3236
+ executionResult: a == null ? void 0 : a.executionResult,
3192
3237
  status: h,
3193
3238
  isLoading: m,
3194
3239
  error: S,
3195
- trace: R
3240
+ trace: T
3196
3241
  };
3197
3242
  }
3198
3243
  case "sql": {
3199
- const o = y;
3244
+ const a = g;
3200
3245
  return {
3201
- id: t.id,
3246
+ id: r.id,
3202
3247
  intent: n.request.intent,
3203
- records: (o == null ? void 0 : o.records) || [],
3204
- columns: o == null ? void 0 : o.columns,
3205
- rowCount: o == null ? void 0 : o.rowCount,
3206
- pagination: o == null ? void 0 : o.pagination,
3207
- output: o == null ? void 0 : o.output,
3208
- rowLimitExceeded: o == null ? void 0 : o.rowLimitExceeded,
3209
- executionResult: o == null ? void 0 : o.executionResult,
3248
+ records: (a == null ? void 0 : a.records) || [],
3249
+ columns: a == null ? void 0 : a.columns,
3250
+ rowCount: a == null ? void 0 : a.rowCount,
3251
+ pagination: a == null ? void 0 : a.pagination,
3252
+ output: a == null ? void 0 : a.output,
3253
+ rowLimitExceeded: a == null ? void 0 : a.rowLimitExceeded,
3254
+ executionResult: a == null ? void 0 : a.executionResult,
3210
3255
  status: h,
3211
3256
  isLoading: m,
3212
3257
  error: S,
3213
- trace: R
3258
+ trace: T
3214
3259
  };
3215
3260
  }
3216
3261
  case "matrix": {
3217
- const o = y;
3262
+ const a = g;
3218
3263
  return {
3219
- id: t.id,
3264
+ id: r.id,
3220
3265
  intent: n.request.intent,
3221
- matrixResult: o == null ? void 0 : o.matrixResult,
3222
- grid: o == null ? void 0 : o.grid,
3223
- expansion: o == null ? void 0 : o.expansion,
3224
- executionResult: o == null ? void 0 : o.executionResult,
3266
+ matrixResult: a == null ? void 0 : a.matrixResult,
3267
+ grid: a == null ? void 0 : a.grid,
3268
+ expansion: a == null ? void 0 : a.expansion,
3269
+ executionResult: a == null ? void 0 : a.executionResult,
3225
3270
  status: h,
3226
3271
  isLoading: m,
3227
3272
  error: S,
3228
- trace: R
3273
+ trace: T
3229
3274
  };
3230
3275
  }
3231
3276
  default:
3232
- return Ae(n);
3277
+ return Te(n);
3233
3278
  }
3234
3279
  }
3235
- function Dn(e, r, t, n, i) {
3236
- const l = Sn(), u = k(r), c = k(n), [d, f] = Q({
3280
+ function _n(e, t, r, n, i) {
3281
+ const o = Tn(), u = C(t), c = C(n), [d, f] = Q({
3237
3282
  status: "idle",
3238
- data: t,
3283
+ data: r,
3239
3284
  error: null
3240
3285
  });
3241
- return u.current = r, c.current = n, L(() => {
3242
- let g;
3286
+ return u.current = t, c.current = n, B(() => {
3287
+ let y;
3243
3288
  try {
3244
- g = u.current({
3245
- ...l,
3289
+ y = u.current({
3290
+ ...o,
3246
3291
  activeInputs: c.current
3247
3292
  });
3248
3293
  } catch (m) {
3249
3294
  i == null || i.failure(m, 0), f({
3250
3295
  status: "error",
3251
- data: t,
3296
+ data: r,
3252
3297
  error: N(m)
3253
3298
  });
3254
3299
  return;
3255
3300
  }
3256
- if (!g) {
3257
- f({ status: "idle", data: t, error: null });
3301
+ if (!y) {
3302
+ f({ status: "idle", data: r, error: null });
3258
3303
  return;
3259
3304
  }
3260
- let y = !1;
3261
- const h = xr();
3305
+ let g = !1;
3306
+ const h = qt();
3262
3307
  return i == null || i.start(), f((m) => ({
3263
3308
  status: "loading",
3264
3309
  data: m.data,
3265
3310
  error: null
3266
- })), g.then((m) => {
3267
- y ? i == null || i.ignored("superseded") : (i == null || i.success(m, Xe(h)), f({ status: "success", data: m, error: null }));
3311
+ })), y.then((m) => {
3312
+ g ? i == null || i.ignored("superseded") : (i == null || i.success(m, et(h)), f({ status: "success", data: m, error: null }));
3268
3313
  }).catch((m) => {
3269
- y ? i == null || i.ignored("superseded") : (i == null || i.failure(m, Xe(h)), f({
3314
+ g ? i == null || i.ignored("superseded") : (i == null || i.failure(m, et(h)), f({
3270
3315
  status: "error",
3271
- data: t,
3316
+ data: r,
3272
3317
  error: N(m)
3273
3318
  }));
3274
3319
  }), () => {
3275
- y = !0;
3320
+ g = !0;
3276
3321
  };
3277
- }, [t, e, l, i]), d;
3322
+ }, [r, e, o, i]), d;
3278
3323
  }
3279
- function xr() {
3324
+ function qt() {
3280
3325
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
3281
3326
  }
3282
- function Xe(e) {
3283
- return Math.max(0, Math.round(xr() - e));
3327
+ function et(e) {
3328
+ return Math.max(0, Math.round(qt() - e));
3284
3329
  }
3285
- function On(e) {
3330
+ function Nn(e) {
3286
3331
  return Object.fromEntries(
3287
- e.filter((r) => r.defaultValue !== void 0).map((r) => [r.id, r.defaultValue])
3332
+ e.filter((t) => t.defaultValue !== void 0).map((t) => [t.id, t.defaultValue])
3288
3333
  );
3289
3334
  }
3290
- function Ae(e) {
3335
+ function Te(e) {
3291
3336
  throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
3292
3337
  }
3293
- function Ln(e) {
3338
+ function Fn(e) {
3294
3339
  return !e || typeof e == "boolean" || e.enabled === !1 ? null : e.autoRenderDevtools === !0 ? {} : e.autoRenderDevtools ? e.autoRenderDevtools : null;
3295
3340
  }
3296
- function Jn({
3341
+ function ri({
3297
3342
  token: e,
3298
- apiBaseUrl: r,
3299
- executor: t,
3343
+ apiBaseUrl: t,
3344
+ executor: r,
3300
3345
  debug: n,
3301
3346
  children: i
3302
3347
  }) {
3303
3348
  var m;
3304
- const l = bn(), u = ((m = l == null ? void 0 : l.authToken) == null ? void 0 : m.accessToken) || e, c = (l == null ? void 0 : l.dataApiBaseUrl) || (l == null ? void 0 : l.apiBaseUrl) || r, d = (l == null ? void 0 : l.debug) ?? n, f = Ln(d), g = b(() => un(), []), y = t || g, h = b(
3349
+ const o = An(), u = ((m = o == null ? void 0 : o.authToken) == null ? void 0 : m.accessToken) || e, c = (o == null ? void 0 : o.dataApiBaseUrl) || (o == null ? void 0 : o.apiBaseUrl) || t, d = (o == null ? void 0 : o.debug) ?? n, f = Fn(d), y = b(() => yn(), []), g = r || y, h = b(
3305
3350
  () => ({
3306
3351
  token: u,
3307
3352
  apiBaseUrl: c,
3308
- executor: y,
3353
+ executor: g,
3309
3354
  debug: d
3310
3355
  }),
3311
- [c, d, y, u]
3356
+ [c, d, g, u]
3312
3357
  );
3313
- return /* @__PURE__ */ s(Hr, { debug: d, children: /* @__PURE__ */ p(Sr.Provider, { value: h, children: [
3358
+ return /* @__PURE__ */ s(Qt, { debug: d, children: /* @__PURE__ */ p(It.Provider, { value: h, children: [
3314
3359
  i,
3315
- f ? /* @__PURE__ */ s(Qr, { ...f }) : null
3360
+ f ? /* @__PURE__ */ s(Jt, { ...f }) : null
3316
3361
  ] }) });
3317
3362
  }
3318
3363
  export {
3319
- Jn as SemaphorDataAppProvider,
3320
- Qr as SemaphorDevtools,
3321
- Pn as SemaphorDevtoolsInspectButton,
3322
- Hn as SemaphorViewBoundary,
3323
- un as createSemaphorQueryExecutor,
3324
- Wn as defineSemaphorDataApp,
3325
- zn as defineSemaphorInput,
3326
- kn as isSemaphorInputValueValidForOptions,
3327
- jn as semaphor,
3328
- Un as useClearInvalidSemaphorInputValue,
3329
- ir as useSemaphorDevtools,
3330
- Vn as useSemaphorInput,
3331
- Qn as useSemaphorInputs,
3332
- Gn as useSemaphorQuery
3364
+ ri as SemaphorDataAppProvider,
3365
+ Jt as SemaphorDevtools,
3366
+ Yn as SemaphorDevtoolsInspectButton,
3367
+ Jn as SemaphorViewBoundary,
3368
+ yn as createSemaphorQueryExecutor,
3369
+ Qn as defineSemaphorDataApp,
3370
+ Un as defineSemaphorInput,
3371
+ Kn as isSemaphorInputValueValidForOptions,
3372
+ Gn as semaphor,
3373
+ ei as useClearInvalidSemaphorInputValue,
3374
+ st as useSemaphorDevtools,
3375
+ Xn as useSemaphorInput,
3376
+ Zn as useSemaphorInputs,
3377
+ ti as useSemaphorQuery
3333
3378
  };