react-semaphor 0.1.387 → 0.1.389

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