react-semaphor 0.1.325 → 0.1.326

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 (57) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +260 -226
  3. package/dist/brand-studio/index.cjs +2 -2
  4. package/dist/brand-studio/index.js +7 -6
  5. package/dist/chunks/{braces-C7BeIXvM.js → braces-DVaMJoCd.js} +1 -1
  6. package/dist/chunks/{braces-ZjRH2Kl7.js → braces-dHeaioTd.js} +1 -1
  7. package/dist/chunks/{calendar-preferences-dialog-DHhT6Sja.js → calendar-preferences-dialog--2jD-eKu.js} +6 -5
  8. package/dist/chunks/calendar-preferences-dialog-mqU_uOmY.js +1 -0
  9. package/dist/chunks/{chevrons-up-down-CA-XvN1o.js → chevrons-up-down-CLbzBHoI.js} +1 -1
  10. package/dist/chunks/{chevrons-up-down-Cuilz9aY.js → chevrons-up-down-DNQE-uEp.js} +1 -1
  11. package/dist/chunks/{dashboard-briefing-launcher-DZiFMK8I.js → dashboard-briefing-launcher-DguNfFr8.js} +1 -1
  12. package/dist/chunks/{dashboard-briefing-launcher-BzIxRlzW.js → dashboard-briefing-launcher-DsjXUPFq.js} +29 -28
  13. package/dist/chunks/{dashboard-controls-DVwsWny9.js → dashboard-controls-DgNkM1yT.js} +10 -9
  14. package/dist/chunks/{dashboard-controls-BX693lE0.js → dashboard-controls-XCa9PZuU.js} +1 -1
  15. package/dist/chunks/dashboard-json-DiBd65Xf.js +1 -0
  16. package/dist/chunks/{dashboard-json-D15C_I9e.js → dashboard-json-DkA6Bf0Y.js} +7 -6
  17. package/dist/chunks/{edit-dashboard-visual-90_qEgRc.js → edit-dashboard-visual-BC9eOc4U.js} +2 -2
  18. package/dist/chunks/{edit-dashboard-visual-wQyJEcVH.js → edit-dashboard-visual-Q5hW5MXk.js} +11 -9
  19. package/dist/chunks/{index-YTk9Hab2.js → index-B1-46PoR.js} +213 -213
  20. package/dist/chunks/index-BxM99sFL.js +1 -0
  21. package/dist/chunks/index-CuHybtft.js +51 -0
  22. package/dist/chunks/{index-CffvIaZO.js → index-DwfDwtv2.js} +20578 -20474
  23. package/dist/chunks/{palette-CanPG11m.js → palette-DpcvHAiY.js} +1 -1
  24. package/dist/chunks/{palette-D96DOM7E.js → palette-DtmNws9a.js} +1 -1
  25. package/dist/chunks/{resource-management-panel-DlnrD0y-.js → resource-management-panel-CGwWKZOP.js} +1 -1
  26. package/dist/chunks/{resource-management-panel-CLoO2DL3.js → resource-management-panel-D2oAQkKi.js} +6 -5
  27. package/dist/chunks/{save-DxkSzUTZ.js → save-BY7WF62U.js} +1 -1
  28. package/dist/chunks/{save-CqrBQKG6.js → save-Cv_XRb94.js} +1 -1
  29. package/dist/chunks/{switch-BXICAlvS.js → switch-5aQ_jcLH.js} +39 -39
  30. package/dist/chunks/{switch-Deo2Ltmj.js → switch-j3AThLFk.js} +2580 -2628
  31. package/dist/chunks/{use-create-flow-overlay-state-DocFanjO.js → use-create-flow-overlay-state-BQPXP0AM.js} +1 -1
  32. package/dist/chunks/{use-create-flow-overlay-state-DsPoCfMu.js → use-create-flow-overlay-state-CP6GDQAX.js} +29 -28
  33. package/dist/chunks/{use-visual-utils-BdO22fQZ.js → use-visual-utils-CSXU-96k.js} +2 -2
  34. package/dist/chunks/{use-visual-utils-DSbXQQD1.js → use-visual-utils-NpOW5uZ1.js} +1 -1
  35. package/dist/chunks/validators-DJUMR5An.js +2 -0
  36. package/dist/chunks/validators-DvTxl9i0.js +352 -0
  37. package/dist/dashboard/index.cjs +1 -1
  38. package/dist/dashboard/index.js +1 -1
  39. package/dist/dashboard-authoring/index.cjs +3 -3
  40. package/dist/dashboard-authoring/index.js +168 -136
  41. package/dist/data-app-sdk/index.cjs +1 -0
  42. package/dist/data-app-sdk/index.js +512 -0
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +141 -140
  45. package/dist/surfboard/index.cjs +1 -1
  46. package/dist/surfboard/index.js +2 -2
  47. package/dist/types/analytics-protocol.d.ts +325 -2
  48. package/dist/types/dashboard-authoring.d.ts +23 -1
  49. package/dist/types/dashboard.d.ts +6 -1
  50. package/dist/types/data-app-sdk.d.ts +378 -0
  51. package/dist/types/main.d.ts +117 -2
  52. package/dist/types/shared.d.ts +1 -0
  53. package/dist/types/surfboard.d.ts +6 -1
  54. package/dist/types/types.d.ts +6 -1
  55. package/package.json +6 -1
  56. package/dist/chunks/calendar-preferences-dialog-BxeROxyq.js +0 -1
  57. package/dist/chunks/dashboard-json-DxNEFM-p.js +0 -1
@@ -1,15 +1,15 @@
1
- import { validateSemaphorDashboardIntent as Q } from "../analytics-protocol/index.js";
2
- const Z = [
1
+ import { a as Z, v as ee } from "../chunks/validators-DvTxl9i0.js";
2
+ const te = [
3
3
  "lg",
4
4
  "md",
5
5
  "sm",
6
6
  "xs",
7
7
  "xxs"
8
- ], D = 10;
8
+ ], $ = 10;
9
9
  function f(e, t, a) {
10
10
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
11
11
  }
12
- function $(e) {
12
+ function D(e) {
13
13
  const t = /* @__PURE__ */ new Set();
14
14
  for (const a of e) {
15
15
  if (t.has(a))
@@ -18,7 +18,7 @@ function $(e) {
18
18
  }
19
19
  return null;
20
20
  }
21
- function ee(e) {
21
+ function ae(e) {
22
22
  var w, C;
23
23
  const t = [];
24
24
  if (!e || typeof e != "object")
@@ -51,17 +51,17 @@ function ee(e) {
51
51
  f("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
52
52
  );
53
53
  const l = (d == null ? void 0 : d.cards) || [];
54
- l.length > D && t.push(
54
+ l.length > $ && t.push(
55
55
  f(
56
56
  "too_many_cards",
57
- `Generated dashboards can contain at most ${D} cards.`
57
+ `Generated dashboards can contain at most ${$} cards.`
58
58
  )
59
59
  );
60
- const s = $(l.map((u) => u.id));
60
+ const s = D(l.map((u) => u.id));
61
61
  s && t.push(
62
62
  f("duplicate_card_id", `Duplicate generated card id: ${s}.`)
63
63
  );
64
- const c = $(l.map((u) => u.frameId));
64
+ const c = D(l.map((u) => u.frameId));
65
65
  c && t.push(
66
66
  f(
67
67
  "duplicate_frame_id",
@@ -82,22 +82,22 @@ function ee(e) {
82
82
  u.id
83
83
  )
84
84
  );
85
- const m = Array.isArray(a.filterInputs) ? a.filterInputs : [], y = m.map((u) => u.id), g = $(y);
85
+ const m = Array.isArray(a.filterInputs) ? a.filterInputs : [], y = m.map((u) => u.id), g = D(y);
86
86
  g && t.push(
87
87
  f(
88
88
  "duplicate_input_id",
89
89
  `Duplicate dashboard input id: ${g}.`
90
90
  )
91
91
  );
92
- const o = m.map((u) => u.variableName).filter(Boolean) || [], b = $(o);
92
+ const o = m.map((u) => u.variableName).filter(Boolean) || [], b = D(o);
93
93
  b && t.push(
94
94
  f(
95
95
  "duplicate_input_variable",
96
96
  `Duplicate dashboard input variable name: ${b}.`
97
97
  )
98
98
  );
99
- const k = Array.isArray(a.calculatedFields) ? a.calculatedFields : [];
100
- for (const u of k)
99
+ const x = Array.isArray(a.calculatedFields) ? a.calculatedFields : [];
100
+ for (const u of x)
101
101
  u.scope === "domain" && u.reuseOnly !== !0 && t.push(
102
102
  f(
103
103
  "domain_calculated_field_create_out_of_scope",
@@ -106,7 +106,7 @@ function ee(e) {
106
106
  );
107
107
  return { ok: t.length === 0, errors: t, warnings: n };
108
108
  }
109
- function te(e) {
109
+ function ne(e) {
110
110
  var d;
111
111
  const t = [];
112
112
  if (!e || typeof e != "object")
@@ -155,14 +155,14 @@ function te(e) {
155
155
  }
156
156
  return { ok: t.length === 0, errors: t, warnings: n };
157
157
  }
158
- const ae = {
158
+ const re = {
159
159
  lg: 48,
160
160
  md: 36,
161
161
  sm: 24,
162
162
  xs: 12,
163
163
  xxs: 6
164
164
  };
165
- function ne(e, t) {
165
+ function ie(e, t) {
166
166
  let a = 0, n = 0, i = 0;
167
167
  return e.map((r) => {
168
168
  const d = Math.min(r.w, t);
@@ -180,22 +180,22 @@ function ne(e, t) {
180
180
  return a += d, i = Math.max(i, r.h), l;
181
181
  });
182
182
  }
183
- function re(e) {
183
+ function se(e) {
184
184
  const t = [...e].sort((s, c) => s.priority - c.priority), a = t.filter((s) => s.role === "kpi"), n = t.filter((s) => s.role === "chart"), i = t.filter((s) => s.role === "table"), r = t.filter((s) => s.role === "text"), d = r.slice(0, 1), l = r.slice(d.length);
185
185
  return { kpis: a, introText: d, charts: n, tables: i, supportingText: l };
186
186
  }
187
- function ie(e, t, a) {
187
+ function de(e, t, a) {
188
188
  return t === "xxs" || t === "xs" ? a : t === "sm" ? Math.min(12, a) : t === "md" ? e <= 1 || e === 2 ? 18 : 12 : e <= 1 || e === 2 ? 24 : e === 3 ? 16 : 12;
189
189
  }
190
- function se(e, t, a, n) {
190
+ function oe(e, t, a, n) {
191
191
  return a === "xxs" || a === "xs" || a === "sm" || a === "md" || t === 1 || t % 2 === 1 && e === 0 ? n : n / 2;
192
192
  }
193
- function de(e) {
193
+ function le(e) {
194
194
  const { item: t, band: a, index: n, bandCount: i, breakpoint: r, columns: d } = e;
195
195
  return a === "kpi" ? {
196
196
  ...t,
197
197
  band: a,
198
- w: ie(i, r, d),
198
+ w: de(i, r, d),
199
199
  h: 15,
200
200
  minW: Math.min(6, d),
201
201
  minH: 12
@@ -223,7 +223,7 @@ function de(e) {
223
223
  } : {
224
224
  ...t,
225
225
  band: a,
226
- w: se(n, i, r, d),
226
+ w: oe(n, i, r, d),
227
227
  h: r === "xxs" || r === "xs" ? 28 : 30,
228
228
  minW: Math.min(12, d),
229
229
  minH: 16
@@ -231,7 +231,7 @@ function de(e) {
231
231
  }
232
232
  function A(e, t, a, n) {
233
233
  return e.map(
234
- (i, r) => de({
234
+ (i, r) => le({
235
235
  item: i,
236
236
  band: t,
237
237
  index: r,
@@ -242,36 +242,36 @@ function A(e, t, a, n) {
242
242
  );
243
243
  }
244
244
  function P(e) {
245
- const t = re(e);
245
+ const t = se(e);
246
246
  return Object.fromEntries(
247
- Z.map((a) => {
248
- const n = ae[a], i = [
247
+ te.map((a) => {
248
+ const n = re[a], i = [
249
249
  ...A(t.introText, "introText", a, n),
250
250
  ...A(t.kpis, "kpi", a, n),
251
251
  ...A(t.charts, "chart", a, n),
252
252
  ...A(t.tables, "table", a, n),
253
253
  ...A(t.supportingText, "supportingText", a, n)
254
254
  ];
255
- return [a, ne(i, n)];
255
+ return [a, ie(i, n)];
256
256
  })
257
257
  );
258
258
  }
259
- function oe(e) {
259
+ function ce(e) {
260
260
  const t = String(e || "").trim().toLowerCase();
261
261
  return t.includes("date") || t.includes("time") || t.includes("timestamp") ? "date" : t.includes("int") || t.includes("float") || t.includes("double") || t.includes("decimal") || t.includes("numeric") || t.includes("number") || t.includes("currency") || t.includes("percent") ? "number" : t.includes("bool") ? "boolean" : "string";
262
262
  }
263
- function le(e) {
263
+ function ue(e) {
264
264
  return !!(e && typeof e == "object" && !Array.isArray(e));
265
265
  }
266
- function ce(e) {
267
- return le(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
266
+ function fe(e) {
267
+ return ue(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
268
268
  }
269
- function ue(e) {
269
+ function pe(e) {
270
270
  return e.filter(
271
271
  (t) => typeof t == "string" || typeof t == "number"
272
272
  );
273
273
  }
274
- function fe(e) {
274
+ function me(e) {
275
275
  return e.filter(
276
276
  (t) => t instanceof Date || typeof t == "string"
277
277
  );
@@ -279,8 +279,8 @@ function fe(e) {
279
279
  function q(e, t) {
280
280
  if (t === void 0)
281
281
  return;
282
- const a = oe(e.dataType), n = e.operation || "in";
283
- if (ce(t))
282
+ const a = ce(e.dataType), n = e.operation || "in";
283
+ if (fe(t))
284
284
  return {
285
285
  ...t,
286
286
  filterId: e.id,
@@ -301,7 +301,7 @@ function q(e, t) {
301
301
  fieldMeta: e.fieldMeta,
302
302
  semanticContext: e.semanticContext
303
303
  };
304
- const i = Array.isArray(t) ? t : [t], r = a === "date" ? fe(i) : ue(i);
304
+ const i = Array.isArray(t) ? t : [t], r = a === "date" ? me(i) : pe(i);
305
305
  if (r.length !== 0 && !((n === "between" || n === "not between") && r.length < 2))
306
306
  return {
307
307
  filterId: e.id,
@@ -314,10 +314,10 @@ function q(e, t) {
314
314
  semanticContext: e.semanticContext
315
315
  };
316
316
  }
317
- function pe(e, t, a) {
317
+ function he(e, t, a) {
318
318
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
319
319
  }
320
- function me(e, t, a) {
320
+ function be(e, t, a) {
321
321
  const n = (t || []).filter(
322
322
  (i) => i.scope === "card" && i.targetCardId === a
323
323
  ).map((i) => i.field).filter(Boolean);
@@ -329,7 +329,7 @@ function me(e, t, a) {
329
329
  ]
330
330
  };
331
331
  }
332
- function he(e) {
332
+ function ge(e) {
333
333
  const t = {};
334
334
  return {
335
335
  inputs: (e.filterInputs || []).map((n, i) => {
@@ -361,9 +361,9 @@ function he(e) {
361
361
  defaultInputValues: t.shared && Object.keys(t.shared).length > 0 ? t : void 0
362
362
  };
363
363
  }
364
- function qe(e) {
364
+ function Oe(e) {
365
365
  var y, g;
366
- const t = ee(e.plan);
366
+ const t = ae(e.plan);
367
367
  if (!t.ok)
368
368
  throw new Error(
369
369
  t.errors.map((o) => o.message).join(`
@@ -375,7 +375,7 @@ function qe(e) {
375
375
  for (const o of a.cards) {
376
376
  const b = r.get(o.id);
377
377
  if (!b) {
378
- const w = pe(
378
+ const w = he(
379
379
  "missing_card_artifact",
380
380
  `Card "${o.title}" was skipped because no generated artifact was supplied.`,
381
381
  o.id
@@ -384,20 +384,20 @@ function qe(e) {
384
384
  continue;
385
385
  }
386
386
  n.push(...b.warnings || []);
387
- const k = me(
387
+ const x = be(
388
388
  b.card,
389
389
  e.plan.calculatedFields,
390
390
  o.id
391
391
  );
392
392
  d.push({
393
393
  id: o.frameId,
394
- cards: [k],
395
- activeCardId: k.id
394
+ cards: [x],
395
+ activeCardId: x.id
396
396
  });
397
397
  }
398
398
  if (d.length === 0)
399
399
  throw new Error("Dashboard plan did not produce any persistable cards.");
400
- const { inputs: l, defaultInputValues: s } = he(e.plan), c = P(
400
+ const { inputs: l, defaultInputValues: s } = ge(e.plan), c = P(
401
401
  a.cards.filter((o) => d.some((b) => b.id === o.frameId)).map((o) => ({
402
402
  frameId: o.frameId,
403
403
  priority: o.priority,
@@ -424,13 +424,13 @@ function qe(e) {
424
424
  ...s ? { defaultInputValues: s } : {}
425
425
  }, warnings: n, skippedOperations: i };
426
426
  }
427
- function v(e, t, a) {
427
+ function k(e, t, a) {
428
428
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
429
429
  }
430
- function be(e) {
430
+ function Ie(e) {
431
431
  return JSON.parse(JSON.stringify(e));
432
432
  }
433
- function ge(e) {
433
+ function ye(e) {
434
434
  var t;
435
435
  return (t = e.sheets) == null ? void 0 : t.find(
436
436
  (a) => (a.kind || "dashboard") === "dashboard"
@@ -446,40 +446,40 @@ function M(e, t) {
446
446
  }
447
447
  return null;
448
448
  }
449
- function H(e) {
449
+ function W(e) {
450
450
  var a, n;
451
451
  const t = (n = (a = e.cards) == null ? void 0 : a[0]) == null ? void 0 : n.type;
452
452
  return t === "kpi" ? "kpi" : t === "table" || t === "detailTable" || t === "pivotTable" ? "table" : t === "text" ? "text" : "chart";
453
453
  }
454
- function Ie(e) {
454
+ function we(e) {
455
455
  var t;
456
456
  return new Map(
457
457
  (((t = e.layouts) == null ? void 0 : t.lg) || []).map((a, n) => [a.i, n])
458
458
  );
459
459
  }
460
- function W(e, t = /* @__PURE__ */ new Map()) {
461
- const a = Ie(e), n = Math.max(
460
+ function G(e, t = /* @__PURE__ */ new Map()) {
461
+ const a = we(e), n = Math.max(
462
462
  a.size,
463
463
  t.size
464
464
  ), i = (e.frames || []).map(
465
465
  (r, d) => ({
466
466
  frameId: r.id,
467
- role: H(r),
467
+ role: W(r),
468
468
  priority: t.get(r.id) ?? a.get(r.id) ?? n + d
469
469
  })
470
470
  );
471
471
  e.layouts = P(i);
472
472
  }
473
- function ye(e) {
473
+ function _e(e) {
474
474
  return Object.values(e.layouts || {}).some((t) => t.length > 0);
475
475
  }
476
- function we(e, t) {
477
- if (!ye(e)) {
478
- W(e);
476
+ function ve(e, t) {
477
+ if (!_e(e)) {
478
+ G(e);
479
479
  return;
480
480
  }
481
481
  const a = P([
482
- { frameId: t.id, role: H(t), priority: 0 }
482
+ { frameId: t.id, role: W(t), priority: 0 }
483
483
  ]);
484
484
  e.layouts ?? (e.layouts = {});
485
485
  for (const [n, i] of Object.entries(a)) {
@@ -499,7 +499,7 @@ function we(e, t) {
499
499
  ];
500
500
  }
501
501
  }
502
- function _e(e, t) {
502
+ function ke(e, t) {
503
503
  var n;
504
504
  const a = q(
505
505
  t.filter,
@@ -513,17 +513,17 @@ function _e(e, t) {
513
513
  }
514
514
  });
515
515
  }
516
- function Be(e) {
516
+ function Ee(e) {
517
517
  var l;
518
- const t = te(e.changePlan);
518
+ const t = ne(e.changePlan);
519
519
  if (!t.ok)
520
520
  throw new Error(
521
521
  t.errors.map((s) => s.message).join(`
522
522
  `) || "Dashboard change plan is invalid."
523
523
  );
524
- const a = be(e.dashboard), n = [...t.warnings], i = [], r = new Map(
524
+ const a = Ie(e.dashboard), n = [...t.warnings], i = [], r = new Map(
525
525
  e.cardArtifacts.map((s) => [s.planCardId, s])
526
- ), d = ge(a);
526
+ ), d = ye(a);
527
527
  if (!d)
528
528
  throw new Error("Dashboard has no editable dashboard sheet.");
529
529
  d.frames ?? (d.frames = []);
@@ -536,11 +536,11 @@ function Be(e) {
536
536
  return g + (((b = o.cards) == null ? void 0 : b.length) || 0);
537
537
  },
538
538
  0
539
- ) >= D) {
539
+ ) >= $) {
540
540
  i.push(
541
- v(
541
+ k(
542
542
  "generated_card_limit_reached",
543
- `MVP AI refinement is capped at ${D} cards.`,
543
+ `MVP AI refinement is capped at ${$} cards.`,
544
544
  s.card.id
545
545
  )
546
546
  );
@@ -549,7 +549,7 @@ function Be(e) {
549
549
  const m = r.get(s.card.id);
550
550
  if (!m) {
551
551
  i.push(
552
- v(
552
+ k(
553
553
  "missing_card_artifact",
554
554
  `Card "${s.card.title}" was skipped because no generated artifact was supplied.`,
555
555
  s.card.id
@@ -562,7 +562,7 @@ function Be(e) {
562
562
  cards: [m.card],
563
563
  activeCardId: m.card.id
564
564
  };
565
- d.frames.push(y), we(d, y);
565
+ d.frames.push(y), ve(d, y);
566
566
  break;
567
567
  }
568
568
  case "addFilterInput": {
@@ -584,7 +584,7 @@ function Be(e) {
584
584
  exports: ["label", "value", "start", "end", "range"],
585
585
  filter: s.input.filter
586
586
  };
587
- a.inputs.push(c), _e(a, s.input);
587
+ a.inputs.push(c), ke(a, s.input);
588
588
  break;
589
589
  }
590
590
  case "addCalculatedField": {
@@ -595,7 +595,7 @@ function Be(e) {
595
595
  else if (s.field.scope === "card" && s.field.field) {
596
596
  const c = s.field.targetCardId ? M(a, s.field.targetCardId) : null;
597
597
  c ? ((l = c.card).calculatedFields ?? (l.calculatedFields = []), c.card.calculatedFields.push(s.field.field)) : i.push(
598
- v(
598
+ k(
599
599
  "missing_calculated_field_target",
600
600
  `Calculated field "${s.field.name}" needs a valid target card.`
601
601
  )
@@ -607,7 +607,7 @@ function Be(e) {
607
607
  const c = M(a, s.cardId);
608
608
  if (!c) {
609
609
  i.push(
610
- v(
610
+ k(
611
611
  "card_not_found",
612
612
  `Card "${s.cardId}" could not be renamed because it was not found.`,
613
613
  s.cardId
@@ -624,12 +624,12 @@ function Be(e) {
624
624
  const y = s.cardIds[m], g = M(a, y);
625
625
  g && c.set(g.frame.id, m);
626
626
  }
627
- W(d, c);
627
+ G(d, c);
628
628
  break;
629
629
  }
630
630
  case "reuseCalculatedField":
631
631
  n.push(
632
- v(
632
+ k(
633
633
  "reused_calculated_field",
634
634
  `Calculated field "${s.fieldId}" is reused by reference.`
635
635
  )
@@ -637,7 +637,7 @@ function Be(e) {
637
637
  break;
638
638
  case "unsupported":
639
639
  i.push(
640
- v("unsupported_operation", s.reason || s.requestedAction)
640
+ k("unsupported_operation", s.reason || s.requestedAction)
641
641
  );
642
642
  break;
643
643
  }
@@ -649,7 +649,7 @@ function I(e, t, a) {
649
649
  function S(e, t) {
650
650
  return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || t;
651
651
  }
652
- function G(e, t) {
652
+ function K(e, t) {
653
653
  if (!t.has(e))
654
654
  return t.add(e), e;
655
655
  let a = 2, n = `${e}-${a}`;
@@ -657,7 +657,7 @@ function G(e, t) {
657
657
  a += 1, n = `${e}-${a}`;
658
658
  return t.add(n), n;
659
659
  }
660
- function ve(e) {
660
+ function xe(e) {
661
661
  return e.kind === "semantic" ? [
662
662
  "semantic",
663
663
  e.domainId,
@@ -672,28 +672,28 @@ function ve(e) {
672
672
  e.tableName
673
673
  ].join(":") : ["sql", e.connectionId, e.sql].join(":");
674
674
  }
675
- function x(e) {
675
+ function v(e) {
676
676
  return !!(e && typeof e == "object");
677
677
  }
678
678
  function E(e) {
679
- return x(e) && (e.kind === "semantic" || e.kind === "physical" || e.kind === "sql");
679
+ return v(e) && (e.kind === "semantic" || e.kind === "physical" || e.kind === "sql");
680
680
  }
681
- function K(e) {
681
+ function U(e) {
682
682
  return Array.isArray(e.inputs) ? e.inputs.filter(
683
- (t) => x(t) && typeof t.id == "string"
683
+ (t) => v(t) && typeof t.id == "string"
684
684
  ) : [];
685
685
  }
686
- function U(e) {
686
+ function J(e) {
687
687
  return Array.isArray(e.sections) ? e.sections.filter(
688
- (t) => x(t)
688
+ (t) => v(t)
689
689
  ) : [];
690
690
  }
691
- function J(e) {
691
+ function X(e) {
692
692
  return Array.isArray(e.views) ? e.views.filter(
693
- (t) => x(t)
693
+ (t) => v(t)
694
694
  ) : [];
695
695
  }
696
- function xe(e) {
696
+ function Ce(e) {
697
697
  return e.kind === "semantic" ? {
698
698
  kind: "semantic",
699
699
  domainId: e.domainId,
@@ -710,25 +710,25 @@ function xe(e) {
710
710
  label: e.label
711
711
  } : null;
712
712
  }
713
- function ke(e) {
713
+ function Fe(e) {
714
714
  return (e == null ? void 0 : e.source) || null;
715
715
  }
716
- function X(e) {
716
+ function Y(e) {
717
717
  const t = [];
718
- for (const a of K(e))
719
- E(a.source) && t.push(a.source);
720
718
  for (const a of U(e))
721
- for (const n of J(a)) {
722
- const i = ke(n.analytics);
719
+ E(a.source) && t.push(a.source);
720
+ for (const a of J(e))
721
+ for (const n of X(a)) {
722
+ const i = Fe(n.analytics);
723
723
  E(i) && t.push(i);
724
724
  }
725
725
  return t;
726
726
  }
727
- function Ce(e, t) {
727
+ function Ae(e, t) {
728
728
  const a = /* @__PURE__ */ new Map();
729
- for (const i of X(e))
730
- a.set(ve(i), i);
731
- const n = [...a.values()].map(xe).filter((i) => !!i);
729
+ for (const i of Y(e))
730
+ a.set(xe(i), i);
731
+ const n = [...a.values()].map(Ce).filter((i) => !!i);
732
732
  return n.length === 0 ? (t.push(
733
733
  I(
734
734
  "missing_materializable_dataset",
@@ -741,31 +741,62 @@ function Ce(e, t) {
741
741
  )
742
742
  ), [n[0]]);
743
743
  }
744
- function Fe(e) {
744
+ function Se(e) {
745
745
  return (Array.isArray(e.fields) ? e.fields : []).map((t) => t.name).filter((t) => {
746
746
  var a;
747
747
  return t !== ((a = e.dateField) == null ? void 0 : a.name);
748
748
  });
749
749
  }
750
- function Ae(e) {
750
+ function Te(e) {
751
+ const t = Array.isArray(e.metrics) ? e.metrics.filter(
752
+ (a) => typeof a == "string" && a.trim().length > 0
753
+ ) : [];
754
+ return Array.from(
755
+ new Set(
756
+ [e.metric, ...t].filter(
757
+ (a) => typeof a == "string" && a.trim().length > 0
758
+ )
759
+ )
760
+ );
761
+ }
762
+ function De(e) {
763
+ return v(e) && typeof e.name == "string" && e.name.trim().length > 0;
764
+ }
765
+ function $e(e) {
766
+ if (!Array.isArray(e.dimensions))
767
+ return;
768
+ const t = e.dimensions.filter(De).map((a) => a.name);
769
+ return t.length ? t : void 0;
770
+ }
771
+ function H(e) {
772
+ return e === "hour" ? "day" : e;
773
+ }
774
+ function Ne(e) {
751
775
  var t, a;
752
776
  if (e) {
753
777
  if (e.kind === "metric")
754
778
  return {
755
779
  metric: e.metric,
756
- dateField: (t = e.dateField) == null ? void 0 : t.name
780
+ metrics: Te(e),
781
+ dateField: (t = e.dateField) == null ? void 0 : t.name,
782
+ timeGrain: H(e.timeGrain),
783
+ dimensions: $e(e),
784
+ limit: e.limit
757
785
  };
758
786
  if (e.kind === "records")
759
787
  return {
760
788
  metrics: e.measures,
761
789
  dateField: (a = e.dateField) == null ? void 0 : a.name,
762
- timeGrain: e.timeGrain === "hour" ? "day" : e.timeGrain,
763
- dimensions: Fe(e),
790
+ timeGrain: H(e.timeGrain),
791
+ dimensions: Se(e),
764
792
  limit: e.limit
765
793
  };
766
794
  }
767
795
  }
768
- function Se(e) {
796
+ function Me(e) {
797
+ return e && ee(e).ok ? e : void 0;
798
+ }
799
+ function Ve(e) {
769
800
  var t;
770
801
  switch ((t = e.presentation) == null ? void 0 : t.kind) {
771
802
  case "kpi":
@@ -784,11 +815,11 @@ function Se(e) {
784
815
  return null;
785
816
  }
786
817
  }
787
- function Te(e) {
818
+ function Pe(e) {
788
819
  var t, a, n;
789
820
  return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((a = e.presentation) == null ? void 0 : a.kind) === "table" ? "table" : ((n = e.presentation) == null ? void 0 : n.kind) === "text" ? "text" : "chart";
790
821
  }
791
- function $e(e) {
822
+ function qe(e) {
792
823
  switch (e) {
793
824
  case "not_in":
794
825
  return "not in";
@@ -798,14 +829,14 @@ function $e(e) {
798
829
  return e || "in";
799
830
  }
800
831
  }
801
- function De(e) {
802
- return x(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
832
+ function Be(e) {
833
+ return v(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
803
834
  }
804
- function Ne(e) {
835
+ function Le(e) {
805
836
  if (!(!e || e.kind !== "physical"))
806
837
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
807
838
  }
808
- function Me(e, t, a, n, i) {
839
+ function ze(e, t, a, n, i) {
809
840
  if (e.kind !== "filter")
810
841
  return i.push(
811
842
  I(
@@ -813,7 +844,7 @@ function Me(e, t, a, n, i) {
813
844
  `Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`
814
845
  )
815
846
  ), null;
816
- if (!x(e.field) || typeof e.field.name != "string")
847
+ if (!v(e.field) || typeof e.field.name != "string")
817
848
  return i.push(
818
849
  I(
819
850
  "filter_requires_field",
@@ -829,7 +860,7 @@ function Me(e, t, a, n, i) {
829
860
  )
830
861
  ), null;
831
862
  const c = {
832
- id: `filter-${G(
863
+ id: `filter-${K(
833
864
  S(e.id, e.field.name),
834
865
  n
835
866
  )}`,
@@ -837,10 +868,10 @@ function Me(e, t, a, n, i) {
837
868
  connectionId: d,
838
869
  title: e.label,
839
870
  column: e.field.name,
840
- dataType: De(e),
841
- qualifiedTableName: Ne(r),
871
+ dataType: Be(e),
872
+ qualifiedTableName: Le(r),
842
873
  sql: "",
843
- operation: $e(e.operator),
874
+ operation: qe(e.operator),
844
875
  type: e.multi === !1 ? "single" : "multiple",
845
876
  location: "dashboard",
846
877
  displayMode: "toolbar",
@@ -880,7 +911,7 @@ function V(e) {
880
911
  )
881
912
  ), Array.from(new Set(t));
882
913
  }
883
- function Ve(e) {
914
+ function Re(e) {
884
915
  var n, i;
885
916
  if (!e.protocolScope) {
886
917
  const r = Array.from(new Set(e.boundCardIds));
@@ -939,20 +970,20 @@ function Ve(e) {
939
970
  cardIds: t.filter((r) => !a.has(r))
940
971
  };
941
972
  }
942
- function Le(e) {
973
+ function He(e) {
943
974
  var w, C, u;
944
- const t = [], a = Q(e);
975
+ const t = [], a = Z(e);
945
976
  for (const p of a.warnings)
946
977
  t.push(I(p.code, p.message));
947
978
  for (const p of a.errors)
948
979
  t.push(I(p.code, p.message));
949
- const n = U(e), i = K(e), r = Ce(e, t), d = X(e)[0], l = [], s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set();
980
+ const n = J(e), i = U(e), r = Ae(e, t), d = Y(e)[0], l = [], s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set();
950
981
  let o = 0;
951
982
  for (const [p, _] of n.entries()) {
952
983
  const F = typeof _.title == "string" ? _.title : `Section ${p + 1}`, B = _.id || S(F, `section-${p + 1}`);
953
984
  c.set(B, []);
954
- for (const [L, h] of J(_).entries()) {
955
- const z = Se(h), N = S(
985
+ for (const [L, h] of X(_).entries()) {
986
+ const z = Ve(h), N = S(
956
987
  h.id || `${F}-${h.title || `View ${L + 1}`}`,
957
988
  `card-${p + 1}-${L + 1}`
958
989
  );
@@ -976,29 +1007,30 @@ function Le(e) {
976
1007
  );
977
1008
  continue;
978
1009
  }
979
- const j = G(N, y), T = `card-${j}`;
1010
+ const R = K(N, y), T = `card-${R}`;
980
1011
  h.id && s.set(h.id, T), (u = c.get(B)) == null || u.push(T);
981
- const Y = h.analytics && "inputs" in h.analytics ? h.analytics.inputs : void 0;
982
- for (const R of Y || []) {
983
- const O = m.get(R.inputId) || [];
984
- O.push(T), m.set(R.inputId, O);
1012
+ const Q = h.analytics && "inputs" in h.analytics ? h.analytics.inputs : void 0;
1013
+ for (const j of Q || []) {
1014
+ const O = m.get(j.inputId) || [];
1015
+ O.push(T), m.set(j.inputId, O);
985
1016
  }
986
1017
  l.push({
987
1018
  id: T,
988
- frameId: `frame-${j}`,
1019
+ frameId: `frame-${R}`,
989
1020
  title: h.title,
990
1021
  description: h.description,
991
1022
  type: z,
992
- role: Te(h),
1023
+ role: Pe(h),
993
1024
  priority: o,
994
1025
  section: F,
995
- query: Ae(h.analytics),
1026
+ query: Ne(h.analytics),
1027
+ analyticsIntent: Me(h.analytics),
996
1028
  text: h.text
997
1029
  }), o += 1;
998
1030
  }
999
1031
  }
1000
1032
  const b = i.map((p) => {
1001
- const _ = Ve({
1033
+ const _ = Re({
1002
1034
  protocolScope: p.scope,
1003
1035
  inputLabel: p.label,
1004
1036
  allCardIds: l.map((F) => F.id),
@@ -1007,7 +1039,7 @@ function Le(e) {
1007
1039
  sectionIdToCardIds: c,
1008
1040
  warnings: t
1009
1041
  });
1010
- return _ === null ? null : Me(
1042
+ return _ === null ? null : ze(
1011
1043
  p,
1012
1044
  d,
1013
1045
  _,
@@ -1036,12 +1068,12 @@ function Le(e) {
1036
1068
  }, warnings: t };
1037
1069
  }
1038
1070
  export {
1039
- Z as DASHBOARD_AUTHORING_BREAKPOINTS,
1040
- D as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
1041
- Be as applyDashboardChangePlan,
1042
- qe as compileDashboardFromPlan,
1071
+ te as DASHBOARD_AUTHORING_BREAKPOINTS,
1072
+ $ as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
1073
+ Ee as applyDashboardChangePlan,
1074
+ Oe as compileDashboardFromPlan,
1043
1075
  P as compileResponsiveDashboardLayouts,
1044
- Le as dashboardPlanFromSemaphorDashboardIntent,
1045
- te as validateDashboardChangePlan,
1046
- ee as validateDashboardPlan
1076
+ He as dashboardPlanFromSemaphorDashboardIntent,
1077
+ ne as validateDashboardChangePlan,
1078
+ ae as validateDashboardPlan
1047
1079
  };