react-semaphor 0.1.383 → 0.1.385

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