react-semaphor 0.1.382 → 0.1.384

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