react-semaphor 0.1.387 → 0.1.388

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