react-semaphor 0.1.343 → 0.1.345

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 (43) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +1 -1
  3. package/dist/chunks/{calendar-preferences-dialog-hS6POgEs.js → calendar-preferences-dialog-AVORk8vl.js} +1 -1
  4. package/dist/chunks/{calendar-preferences-dialog-_u4Xm011.js → calendar-preferences-dialog-CaeYg4gz.js} +1 -1
  5. package/dist/chunks/{dashboard-briefing-launcher-DHzIiaKF.js → dashboard-briefing-launcher-B7hc62UJ.js} +2062 -2062
  6. package/dist/chunks/dashboard-briefing-launcher-GmwoVZDA.js +106 -0
  7. package/dist/chunks/{dashboard-controls-CilLVS_Q.js → dashboard-controls-Bthl3kl3.js} +1 -1
  8. package/dist/chunks/{dashboard-controls-g1OcteYf.js → dashboard-controls-DOwo-4PX.js} +3 -3
  9. package/dist/chunks/{dashboard-json-ClH0kTga.js → dashboard-json-Bjge3tEx.js} +1 -1
  10. package/dist/chunks/{dashboard-json-BjnGSaxC.js → dashboard-json-CqWAmaOX.js} +1 -1
  11. package/dist/chunks/{edit-dashboard-visual-DbVMVMKM.js → edit-dashboard-visual-NXdSdqQS.js} +3 -3
  12. package/dist/chunks/{edit-dashboard-visual-C_3NYnPz.js → edit-dashboard-visual-biDU5oky.js} +1 -1
  13. package/dist/chunks/{index-BNZjkxPH.js → index-D7U5s9Uk.js} +70 -70
  14. package/dist/chunks/{index-CuSvSh86.js → index-DhuiooCy.js} +9167 -9167
  15. package/dist/chunks/{resource-management-panel-DxjN2uw4.js → resource-management-panel-DIt7NxsX.js} +2 -2
  16. package/dist/chunks/{resource-management-panel-N5iUOE89.js → resource-management-panel-MHam0keE.js} +1 -1
  17. package/dist/chunks/{use-create-flow-overlay-state-CSjc7cXZ.js → use-create-flow-overlay-state-DS5aPcKd.js} +1 -1
  18. package/dist/chunks/{use-create-flow-overlay-state-CXPnnXh1.js → use-create-flow-overlay-state-p_i0aUhH.js} +2 -2
  19. package/dist/chunks/{use-visual-utils-C3MRLrHu.js → use-visual-utils-EazVs86Z.js} +1 -1
  20. package/dist/chunks/{use-visual-utils-DsoGoqPF.js → use-visual-utils-PfpWtYcR.js} +1 -1
  21. package/dist/chunks/validators-8R9pr2K9.js +1 -0
  22. package/dist/chunks/{validators-BqEnmlC6.js → validators-yMB7Tm4j.js} +120 -109
  23. package/dist/dashboard/index.cjs +1 -1
  24. package/dist/dashboard/index.js +1 -1
  25. package/dist/dashboard-authoring/index.cjs +1 -1
  26. package/dist/dashboard-authoring/index.js +1 -1
  27. package/dist/data-app-builder/index.cjs +1 -1
  28. package/dist/data-app-builder/index.js +1 -1
  29. package/dist/data-app-sdk/index.cjs +1 -1
  30. package/dist/data-app-sdk/index.js +240 -227
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.js +5 -5
  33. package/dist/surfboard/index.cjs +1 -1
  34. package/dist/surfboard/index.js +2 -2
  35. package/dist/types/dashboard-authoring.d.ts +1 -0
  36. package/dist/types/dashboard.d.ts +1 -0
  37. package/dist/types/main.d.ts +15 -0
  38. package/dist/types/shared.d.ts +1 -0
  39. package/dist/types/surfboard.d.ts +1 -0
  40. package/dist/types/types.d.ts +15 -0
  41. package/package.json +1 -1
  42. package/dist/chunks/dashboard-briefing-launcher-D18qNhwa.js +0 -106
  43. package/dist/chunks/validators-v8WAqhaN.js +0 -1
@@ -1,4 +1,4 @@
1
- function y(e) {
1
+ function h(e) {
2
2
  return e ? e.kind === "semantic" ? [
3
3
  e.kind,
4
4
  e.domainId,
@@ -17,10 +17,10 @@ function y(e) {
17
17
  e.label || ""
18
18
  ].join(":") : "";
19
19
  }
20
- function M(e, i) {
21
- return !e || !i ? e === i : e.kind !== i.kind ? !1 : e.kind === "semantic" && i.kind === "semantic" ? e.domainId !== i.domainId ? !1 : e.datasetId && i.datasetId ? e.datasetId === i.datasetId : e.datasetName === i.datasetName : y(e) === y(i);
20
+ function $(e, i) {
21
+ return !e || !i ? e === i : e.kind !== i.kind ? !1 : e.kind === "semantic" && i.kind === "semantic" ? e.domainId !== i.domainId ? !1 : e.datasetId && i.datasetId ? e.datasetId === i.datasetId : e.datasetName === i.datasetName : h(e) === h(i);
22
22
  }
23
- function S(e, i) {
23
+ function N(e, i) {
24
24
  return e.kind !== "semantic" || i.kind !== "semantic" ? e : {
25
25
  ...e,
26
26
  datasetId: e.datasetId || i.datasetId,
@@ -28,51 +28,62 @@ function S(e, i) {
28
28
  connectionId: e.connectionId || i.connectionId
29
29
  };
30
30
  }
31
- function $(e, i) {
32
- return e.name === i.name && M(e.source, i.source);
31
+ function B(e, i) {
32
+ return e.name === i.name && $(e.source, i.source);
33
33
  }
34
- function P(e, i) {
34
+ function L(e, i) {
35
35
  return {
36
36
  ...e,
37
37
  label: e.label || i.label,
38
38
  role: e.role || i.role,
39
39
  dataType: e.dataType || i.dataType,
40
- source: e.source && i.source ? S(e.source, i.source) : e.source || i.source
40
+ source: e.source && i.source ? N(e.source, i.source) : e.source || i.source
41
41
  };
42
42
  }
43
43
  function a(e, i, s) {
44
44
  return s ? { code: e, message: i, path: s } : { code: e, message: i };
45
45
  }
46
- function N(e) {
46
+ function R(e) {
47
47
  for (let i = 0; i < e.length; i += 1) {
48
48
  const s = e[i];
49
49
  if (e.some(
50
- (r, o) => o !== i && _(r, s)
50
+ (o, r) => r !== i && b(o, s)
51
51
  ))
52
52
  return !1;
53
53
  }
54
54
  return !0;
55
55
  }
56
- function _(e, i) {
57
- return $(e, i);
56
+ function g(e, i) {
57
+ return B(e, i);
58
58
  }
59
- function B(e, i) {
60
- const s = i.filter((r) => r.name === e.name);
61
- return e.source ? s.some(
62
- (r) => _(r, e) && h(e, r)
63
- ) : s.length === 1 && h(e, s[0]);
59
+ function b(e, i) {
60
+ return g(e, i) && y(e) === y(i);
61
+ }
62
+ function F(e) {
63
+ return `Metric intent has duplicate metric "${e.name}" with the same aggregate (${y(e)}). Use different aggregates to request both, or remove one entry.`;
64
64
  }
65
- function h(e, i) {
66
- return i ? e.aggregate ? i.aggregate === e.aggregate : !0 : !1;
65
+ function j(e, i) {
66
+ return _(e, i).length === 1;
67
+ }
68
+ function x(e, i) {
69
+ return _(e, i).length === 1;
67
70
  }
68
- function R(e, i) {
69
- const s = i.filter(
70
- (r) => F(e, r)
71
+ function _(e, i) {
72
+ return i.filter(
73
+ (o) => T(e, o)
71
74
  );
72
- return e.source ? s.some((r) => _(r, e)) : s.length === 1;
73
75
  }
74
- function F(e, i) {
75
- return !(i.name !== e.name || e.role !== void 0 && i.role !== void 0 && i.role !== e.role || e.aggregate !== void 0 && i.aggregate !== e.aggregate);
76
+ function T(e, i) {
77
+ return D(e, i) ? e.source ? g(i, e) : !0 : !1;
78
+ }
79
+ function D(e, i) {
80
+ return !(i.name !== e.name || e.role !== void 0 && i.role !== void 0 && i.role !== e.role || q(e, i) && y(i) !== y(e));
81
+ }
82
+ function q(e, i) {
83
+ return e.role === "measure" || i.role === "measure" || e.aggregate !== void 0 || i.aggregate !== void 0;
84
+ }
85
+ function y(e) {
86
+ return (e.aggregate || "SUM").toUpperCase();
76
87
  }
77
88
  function d(e) {
78
89
  return typeof e == "string" && e.trim().length > 0;
@@ -89,7 +100,7 @@ function v(e) {
89
100
  }
90
101
  return null;
91
102
  }
92
- const j = /* @__PURE__ */ new Set([
103
+ const C = /* @__PURE__ */ new Set([
93
104
  "SUM",
94
105
  "COUNT",
95
106
  "AVG",
@@ -98,7 +109,7 @@ const j = /* @__PURE__ */ new Set([
98
109
  "MEDIAN",
99
110
  "DISTINCT"
100
111
  ]);
101
- function g(e, i, s) {
112
+ function A(e, i, s) {
102
113
  if (!e || typeof e != "object") {
103
114
  s.push(a("missing_source", "Analytics intent needs a source.", i));
104
115
  return;
@@ -147,19 +158,19 @@ function g(e, i, s) {
147
158
  }
148
159
  s.push(a("invalid_source_kind", "Source kind is not supported.", i));
149
160
  }
150
- function f(e, i, s, r = {}) {
161
+ function f(e, i, s, o = {}) {
151
162
  if (!e || !c(e)) {
152
- r.required && s.push(
163
+ o.required && s.push(
153
164
  a("missing_field_ref", "Field reference needs a name.", i)
154
165
  );
155
166
  return;
156
167
  }
157
168
  d(e.name) || s.push(
158
169
  a("missing_field_ref", "Field reference needs a name.", `${i}.name`)
159
- ), e.source !== void 0 && g(e.source, `${i}.source`, s), T(e.aggregate, `${i}.aggregate`, s);
170
+ ), e.source !== void 0 && A(e.source, `${i}.source`, s), E(e.aggregate, `${i}.aggregate`, s);
160
171
  }
161
- function T(e, i, s) {
162
- e !== void 0 && (typeof e != "string" || !j.has(e)) && s.push(
172
+ function E(e, i, s) {
173
+ e !== void 0 && (typeof e != "string" || !C.has(e)) && s.push(
163
174
  a(
164
175
  "invalid_aggregate",
165
176
  "Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
@@ -167,7 +178,7 @@ function T(e, i, s) {
167
178
  )
168
179
  );
169
180
  }
170
- function x(e, i) {
181
+ function P(e, i) {
171
182
  if (e.analysis === void 0)
172
183
  return;
173
184
  if (!c(e.analysis)) {
@@ -210,9 +221,9 @@ function x(e, i) {
210
221
  )
211
222
  );
212
223
  const { timeWindow: s } = e.analysis;
213
- s !== void 0 && b(s, "analysis.timeWindow", i);
224
+ s !== void 0 && k(s, "analysis.timeWindow", i);
214
225
  }
215
- function b(e, i, s) {
226
+ function k(e, i, s) {
216
227
  if (!c(e)) {
217
228
  s.push(
218
229
  a(
@@ -249,7 +260,7 @@ function b(e, i, s) {
249
260
  )
250
261
  );
251
262
  }
252
- function D(e, i, s) {
263
+ function O(e, i, s) {
253
264
  if (e !== void 0) {
254
265
  if (!Array.isArray(e)) {
255
266
  s.push(
@@ -261,9 +272,9 @@ function D(e, i, s) {
261
272
  );
262
273
  return;
263
274
  }
264
- e.forEach((r, o) => {
265
- const n = `${i}.${o}`;
266
- if (!c(r)) {
275
+ e.forEach((o, r) => {
276
+ const n = `${i}.${r}`;
277
+ if (!c(o)) {
267
278
  s.push(
268
279
  a(
269
280
  "invalid_analytics_filter",
@@ -273,7 +284,7 @@ function D(e, i, s) {
273
284
  );
274
285
  return;
275
286
  }
276
- const t = r;
287
+ const t = o;
277
288
  f(t.field, `${n}.field`, s, {
278
289
  required: !0
279
290
  });
@@ -310,8 +321,8 @@ function D(e, i, s) {
310
321
  });
311
322
  }
312
323
  }
313
- function A(e) {
314
- var r;
324
+ function w(e) {
325
+ var o;
315
326
  const i = [], s = [];
316
327
  if (!e || typeof e != "object")
317
328
  return {
@@ -332,8 +343,8 @@ function A(e) {
332
343
  };
333
344
  if (e.version !== void 0 && e.version !== 1 && i.push(
334
345
  a("invalid_version", "Analytics intent version must be 1.", "version")
335
- ), g(e.source, "source", i), e.kind === "metric") {
336
- const o = Array.isArray(e.metrics) ? e.metrics.filter(
346
+ ), A(e.source, "source", i), e.kind === "metric") {
347
+ const r = Array.isArray(e.metrics) ? e.metrics.filter(
337
348
  (n) => c(n) && d(n.name)
338
349
  ) : [];
339
350
  if (!Array.isArray(e.metrics) || e.metrics.length === 0 ? i.push(
@@ -346,38 +357,38 @@ function A(e) {
346
357
  "Metric intent metrics must be an array of field references with names.",
347
358
  "metrics"
348
359
  )
349
- ), o.forEach((n, t) => {
360
+ ), r.forEach((n, t) => {
350
361
  f(n, `metrics.${t}`, i, {
351
362
  required: !0
352
363
  });
353
- }), o.length > 0 && !N(o)) {
354
- const n = o.find(
355
- (t, p) => o.some(
356
- (u, l) => l !== p && _(u, t)
364
+ }), r.length > 0 && !R(r)) {
365
+ const n = r.find(
366
+ (t, p) => r.some(
367
+ (u, l) => l !== p && b(u, t)
357
368
  )
358
369
  );
359
370
  n && i.push(
360
371
  a(
361
372
  "duplicate_metric",
362
- `Metric intent has duplicate metric "${n.name}".`,
373
+ F(n),
363
374
  "metrics"
364
375
  )
365
376
  );
366
377
  }
367
- if (c(e.primaryMetric) && d(e.primaryMetric.name) && e.primaryMetric.source === void 0 && o.filter((n) => {
368
- var t;
369
- return n.name === ((t = e.primaryMetric) == null ? void 0 : t.name);
370
- }).length > 1 && i.push(
378
+ if (c(e.primaryMetric) && d(e.primaryMetric.name) && _(
379
+ e.primaryMetric,
380
+ r
381
+ ).length > 1 && i.push(
371
382
  a(
372
383
  "ambiguous_primary_metric",
373
- "Metric intent primaryMetric needs a source when it names a duplicated metric.",
384
+ "Metric intent primaryMetric must identify exactly one selected metric.",
374
385
  "primaryMetric"
375
386
  )
376
387
  ), e.primaryMetric !== void 0 && (f(e.primaryMetric, "primaryMetric", i, {
377
388
  required: !0
378
- }), c(e.primaryMetric) && d(e.primaryMetric.name) && o.length > 0 && !B(
389
+ }), c(e.primaryMetric) && d(e.primaryMetric.name) && r.length > 0 && !j(
379
390
  e.primaryMetric,
380
- o
391
+ r
381
392
  ) && i.push(
382
393
  a(
383
394
  "invalid_primary_metric",
@@ -398,13 +409,13 @@ function A(e) {
398
409
  "Metric intent dimensions must be an array of field references with names.",
399
410
  "dimensions"
400
411
  )
401
- ), e.dateField !== void 0 && f(e.dateField, "dateField", i), e.timeWindow !== void 0 && (b(e.timeWindow, "timeWindow", i), e.dateField || i.push(
412
+ ), e.dateField !== void 0 && f(e.dateField, "dateField", i), e.timeWindow !== void 0 && (k(e.timeWindow, "timeWindow", i), e.dateField || i.push(
402
413
  a(
403
414
  "missing_time_window_date_field",
404
415
  "Metric timeWindow needs a dateField.",
405
416
  "dateField"
406
417
  )
407
- )), D(e.filters, "filters", i), Array.isArray(e.dimensions) && e.dimensions.forEach((n, t) => {
418
+ )), O(e.filters, "filters", i), Array.isArray(e.dimensions) && e.dimensions.forEach((n, t) => {
408
419
  f(n, `dimensions.${t}`, i);
409
420
  }), e.orderBy !== void 0) {
410
421
  if (!c(e.orderBy))
@@ -425,13 +436,13 @@ function A(e) {
425
436
  )
426
437
  ), c(e.orderBy.field) && d(e.orderBy.field.name)) {
427
438
  const n = [
428
- ...o,
439
+ ...r,
429
440
  ...e.timeGrain && e.dateField && c(e.dateField) ? [e.dateField] : [],
430
441
  ...Array.isArray(e.dimensions) ? e.dimensions.filter(
431
442
  (t) => c(t) && d(t.name)
432
443
  ) : []
433
444
  ];
434
- n.length > 0 && !R(
445
+ n.length > 0 && !x(
435
446
  e.orderBy.field,
436
447
  n
437
448
  ) && i.push(
@@ -443,7 +454,7 @@ function A(e) {
443
454
  );
444
455
  }
445
456
  }
446
- x(e, i);
457
+ P(e, i);
447
458
  } else e.kind === "records" ? (!Array.isArray(e.fields) || e.fields.length === 0 ? i.push(
448
459
  a(
449
460
  "missing_record_fields",
@@ -451,15 +462,15 @@ function A(e) {
451
462
  "fields"
452
463
  )
453
464
  ) : e.fields.some(
454
- (o) => !c(o) || !d(o.name)
465
+ (r) => !c(r) || !d(r.name)
455
466
  ) && i.push(
456
467
  a(
457
468
  "invalid_record_fields",
458
469
  "Records intent fields must be field references with names.",
459
470
  "fields"
460
471
  )
461
- ), Array.isArray(e.fields) && e.fields.forEach((o, n) => {
462
- f(o, `fields.${n}`, i);
472
+ ), Array.isArray(e.fields) && e.fields.forEach((r, n) => {
473
+ f(r, `fields.${n}`, i);
463
474
  }), e.dateField !== void 0 && f(e.dateField, "dateField", i), e.orderBy !== void 0 && (c(e.orderBy) ? (f(e.orderBy.field, "orderBy.field", i, {
464
475
  required: !0
465
476
  }), e.orderBy.direction !== "asc" && e.orderBy.direction !== "desc" && i.push(
@@ -480,14 +491,14 @@ function A(e) {
480
491
  "Input options intent needs a field.",
481
492
  "field"
482
493
  )
483
- ), f(e.field, "field", i, { required: !0 })) : e.kind === "sql" ? (((r = e.source) == null ? void 0 : r.kind) !== "sql" && i.push(
494
+ ), f(e.field, "field", i, { required: !0 })) : e.kind === "sql" ? (((o = e.source) == null ? void 0 : o.kind) !== "sql" && i.push(
484
495
  a(
485
496
  "invalid_sql_source",
486
497
  "SQL analytics intent must use a SQL execution source.",
487
498
  "source"
488
499
  )
489
- ), d(e.sql) || i.push(a("missing_sql", "SQL analytics intent needs SQL text.", "sql")), Array.isArray(e.fields) && e.fields.forEach((o, n) => {
490
- f(o, `fields.${n}`, i);
500
+ ), d(e.sql) || i.push(a("missing_sql", "SQL analytics intent needs SQL text.", "sql")), Array.isArray(e.fields) && e.fields.forEach((r, n) => {
501
+ f(r, `fields.${n}`, i);
491
502
  })) : i.push(
492
503
  a("invalid_analytics_kind", "Analytics kind is not supported.", "kind")
493
504
  );
@@ -495,10 +506,10 @@ function A(e) {
495
506
  ok: i.length === 0,
496
507
  errors: i,
497
508
  warnings: s,
498
- repairHints: E(i)
509
+ repairHints: U(i)
499
510
  };
500
511
  }
501
- function q(e) {
512
+ function H(e) {
502
513
  const i = [], s = [];
503
514
  if (!e || typeof e != "object")
504
515
  return {
@@ -526,18 +537,18 @@ function q(e) {
526
537
  "Answer-obligations operation intent needs at least one obligation.",
527
538
  "obligations"
528
539
  )
529
- ) : e.obligations.forEach((r, o) => {
530
- d(r.id) || i.push(
540
+ ) : e.obligations.forEach((o, r) => {
541
+ d(o.id) || i.push(
531
542
  a(
532
543
  "missing_obligation_id",
533
544
  "Each analytics obligation needs an id.",
534
- `obligations.${o}.id`
545
+ `obligations.${r}.id`
535
546
  )
536
- ), d(r.prompt) || i.push(
547
+ ), d(o.prompt) || i.push(
537
548
  a(
538
549
  "missing_obligation_prompt",
539
550
  "Each analytics obligation needs a prompt.",
540
- `obligations.${o}.prompt`
551
+ `obligations.${r}.prompt`
541
552
  )
542
553
  );
543
554
  });
@@ -549,10 +560,10 @@ function q(e) {
549
560
  "instruction"
550
561
  )
551
562
  ), e.analyticsIntent) {
552
- const r = A(
563
+ const o = w(
553
564
  e.analyticsIntent
554
565
  );
555
- i.push(...r.errors), s.push(...r.warnings);
566
+ i.push(...o.errors), s.push(...o.warnings);
556
567
  }
557
568
  } else
558
569
  i.push(
@@ -566,10 +577,10 @@ function q(e) {
566
577
  ok: i.length === 0,
567
578
  errors: i,
568
579
  warnings: s,
569
- repairHints: k(i)
580
+ repairHints: I(i)
570
581
  };
571
582
  }
572
- function O(e) {
583
+ function Q(e) {
573
584
  const i = [], s = [];
574
585
  if (!e || typeof e != "object")
575
586
  return {
@@ -597,8 +608,8 @@ function O(e) {
597
608
  "kind"
598
609
  )
599
610
  );
600
- const r = q(e.operationIntent);
601
- return i.push(...r.errors), s.push(...r.warnings), Array.isArray(e.plannedToolCalls) || i.push(
611
+ const o = H(e.operationIntent);
612
+ return i.push(...o.errors), s.push(...o.warnings), Array.isArray(e.plannedToolCalls) || i.push(
602
613
  a(
603
614
  "invalid_planned_tool_calls",
604
615
  "Recovery plan plannedToolCalls must be an array.",
@@ -608,16 +619,16 @@ function O(e) {
608
619
  ok: i.length === 0,
609
620
  errors: i,
610
621
  warnings: s,
611
- repairHints: k(i)
622
+ repairHints: I(i)
612
623
  };
613
624
  }
614
- function k(e) {
625
+ function I(e) {
615
626
  return e.map((i) => ({
616
627
  code: i.code,
617
628
  recommendedNextStep: i.code === "missing_obligations" ? "Normalize the user request into one or more typed analytics obligations before recovery planning." : "Correct the operation/recovery contract shape before planning execution."
618
629
  }));
619
630
  }
620
- function E(e) {
631
+ function U(e) {
621
632
  return e.map((i) => {
622
633
  switch (i.code) {
623
634
  case "missing_source":
@@ -670,7 +681,7 @@ function E(e) {
670
681
  }
671
682
  }).filter((i) => !!i);
672
683
  }
673
- function C(e, i, s, r) {
684
+ function G(e, i, s, o) {
674
685
  if (!e || typeof e != "object") {
675
686
  s.push(a("invalid_view", "Dashboard view must be an object.", i));
676
687
  return;
@@ -686,7 +697,7 @@ function C(e, i, s, r) {
686
697
  return;
687
698
  }
688
699
  if (e.presentation.kind === "text") {
689
- d(e.text) || r.push(
700
+ d(e.text) || o.push(
690
701
  a(
691
702
  "missing_text_content",
692
703
  "Text views should include text content.",
@@ -705,13 +716,13 @@ function C(e, i, s, r) {
705
716
  );
706
717
  return;
707
718
  }
708
- const o = A(e.analytics);
709
- for (const n of o.errors)
719
+ const r = w(e.analytics);
720
+ for (const n of r.errors)
710
721
  s.push(
711
722
  a(n.code, n.message, `${i}.analytics${n.path ? `.${n.path}` : ""}`)
712
723
  );
713
- for (const n of o.warnings)
714
- r.push(
724
+ for (const n of r.warnings)
725
+ o.push(
715
726
  a(
716
727
  n.code,
717
728
  n.message,
@@ -719,7 +730,7 @@ function C(e, i, s, r) {
719
730
  )
720
731
  );
721
732
  }
722
- function H(e) {
733
+ function V(e) {
723
734
  const i = [], s = [];
724
735
  if (!e || typeof e != "object")
725
736
  return {
@@ -733,17 +744,17 @@ function H(e) {
733
744
  warnings: s
734
745
  };
735
746
  e.version !== 1 && i.push(a("invalid_version", "Dashboard intent version must be 1.")), e.kind !== "dashboard" && i.push(a("invalid_kind", "Experience intent kind must be dashboard.")), d(e.title) || i.push(a("missing_title", "Dashboard intent needs a title.", "title"));
736
- const r = Array.isArray(e.inputs) ? e.inputs : [], o = v(
737
- r.filter(c).map((u) => u.id).filter((u) => typeof u == "string")
747
+ const o = Array.isArray(e.inputs) ? e.inputs : [], r = v(
748
+ o.filter(c).map((u) => u.id).filter((u) => typeof u == "string")
738
749
  );
739
- o && i.push(
750
+ r && i.push(
740
751
  a(
741
752
  "duplicate_input_id",
742
- `Duplicate input id: ${o}.`,
753
+ `Duplicate input id: ${r}.`,
743
754
  "inputs"
744
755
  )
745
756
  );
746
- for (const [u, l] of r.entries()) {
757
+ for (const [u, l] of o.entries()) {
747
758
  const m = `inputs.${u}`;
748
759
  if (!c(l)) {
749
760
  i.push(a("invalid_input", "Dashboard input must be an object.", m));
@@ -793,10 +804,10 @@ function H(e) {
793
804
  );
794
805
  continue;
795
806
  }
796
- for (const [w, I] of l.views.entries())
797
- C(
798
- I,
799
- `${m}.views.${w}`,
807
+ for (const [M, S] of l.views.entries())
808
+ G(
809
+ S,
810
+ `${m}.views.${M}`,
800
811
  i,
801
812
  s
802
813
  );
@@ -804,13 +815,13 @@ function H(e) {
804
815
  return { ok: i.length === 0, errors: i, warnings: s };
805
816
  }
806
817
  export {
807
- q as a,
808
- O as b,
809
- H as c,
810
- M as d,
811
- $ as e,
812
- P as f,
813
- S as p,
814
- y as s,
815
- A as v
818
+ H as a,
819
+ Q as b,
820
+ V as c,
821
+ $ as d,
822
+ B as e,
823
+ L as f,
824
+ N as p,
825
+ h as s,
826
+ w as v
816
827
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-BNZjkxPH.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-D7U5s9Uk.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as o } from "../chunks/index-CuSvSh86.js";
1
+ import { D as o } from "../chunks/index-DhuiooCy.js";
2
2
  import { C as s, E as C } from "../chunks/common-types-4bjoIgvm.js";
3
3
  export {
4
4
  s as CONTROL_CARD_DEFAULT_VALUE,
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../chunks/validators-v8WAqhaN.js"),Se=require("../chunks/catalog-field-grounding-Du6mKDcF.js"),re=["lg","md","sm","xs","xxs"],$=10;function _(e){return e&&typeof e=="object"?e:null}function D(e){return typeof e=="string"?e:null}function ae(e){var t,n,r;return!!(e&&typeof e=="object")&&(((t=_(e))==null?void 0:t.kind)==="semantic"||((n=_(e))==null?void 0:n.kind)==="physical"||((r=_(e))==null?void 0:r.kind)==="sql")}function N(e){return ae(e)?e.kind==="semantic"?!!(e.domainId&&e.datasetName):e.kind==="physical"?!!(e.connectionId&&e.tableName):!1:!1}function we(e){return v.semaphorSourceIdentityKey(e)}function G(e,t){return v.semaphorSourcesReferToSameDataset(e,t)}function ie(e,t){return v.preferSemaphorSourceMetadata(e,t)}function M(e){const t=[];for(const n of e){const r=t.findIndex(a=>G(a,n));r===-1?t.push(n):t[r]=ie(t[r],n)}return t}function ve(e){return M(e)[0]}function H(e,t){return e.kind!=="semantic"||e.connectionId||(t==null?void 0:t.kind)!=="semantic"||!v.semaphorSourcesReferToSameDataset(e,t)||!t.connectionId?e:{...e,connectionId:t.connectionId}}function W(e){return N(e)?e:void 0}function ne(e,t){if(!(e.kind!=="semantic"||e.connectionId))return t.find(n=>(n==null?void 0:n.kind)==="semantic"&&v.semaphorSourcesReferToSameDataset(e,n)&&!!n.connectionId)}function w(e,t){const n=W(e==null?void 0:e.source);return n?H(n,t):void 0}function oe({explicitSource:e,field:t,defaultSource:n,fallbackSources:r}){const a=[n,...r||[]],i=W(e),o=i?H(i,ne(i,a)):void 0;if(o)return o;if(e!==void 0)return;const d=w(t,n),s=d?H(d,ne(d,a)):void 0;if(s)return s;if((t==null?void 0:t.source)===void 0)return W(n)}function De(e,t){if(!(e!=null&&e.name)||!(t!=null&&t.name)||e.name!==t.name)return!1;const n=w(e),r=w(t);return!n||!r?!0:G(n,r)}function C(e){var t;return D((t=_(e))==null?void 0:t.kind)}function se(e){var t,n;return C(e)!=="semantic"?null:((n=D((t=_(e))==null?void 0:t.domainId))==null?void 0:n.trim())||null}function Ae(e){var t;return C(e)!=="semantic"?null:D((t=_(e))==null?void 0:t.datasetName)}function Ce(e){var t;return C(e)!=="semantic"?null:D((t=_(e))==null?void 0:t.datasetId)}function ke(e){var t;return C(e)!=="physical"?null:D((t=_(e))==null?void 0:t.connectionId)}function xe(e){var t;return C(e)!=="physical"?null:D((t=_(e))==null?void 0:t.tableName)}function Fe(e){var t;return C(e)!=="physical"?"":D((t=_(e))==null?void 0:t.databaseName)||""}function Te(e){var t;return C(e)!=="physical"?"":D((t=_(e))==null?void 0:t.schemaName)||""}function de(e){if(e.analyticsIntent&&typeof e.analyticsIntent=="object"&&"source"in e.analyticsIntent)return e.analyticsIntent.source}function ce({datasets:e,requireAtLeastOne:t}){if(t&&e.length<1)return{ok:!1,issue:"invalid_dataset_count"};if(e.length<=1)return{ok:!0};const n=e.map(se),r=new Set(n.filter(Boolean));return n.some(a=>!a)||r.size!==1?{ok:!1,issue:"invalid_multi_dataset_scope"}:{ok:!0}}function z(e,t){if(!t)return!1;if(t.kind==="semantic"){const n=Ce(e);return se(e)===t.domainId?n&&t.datasetId?n===t.datasetId:Ae(e)===t.datasetName:!1}return t.kind==="physical"?ke(e)===t.connectionId&&xe(e)===t.tableName&&Fe(e)===(t.databaseName||"")&&Te(e)===(t.schemaName||""):!1}function $e(e,t){return e.find(n=>z(n,t))}function f(e,t,n){return n?{code:e,message:t,cardId:n}:{code:e,message:t}}function B(e){const t=new Set;for(const n of e){if(t.has(n))return n;t.add(n)}return null}function le({card:e,datasets:t,errors:n}){if(e.type==="text")return;const r=de(e);if(!r){if(t.length<=1)return;n.push(f("missing_card_analytics_source","Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",e.id));return}t.some(a=>z(a,r))||n.push(f("invalid_card_analytics_source","Dashboard cards with an explicit analytics source must use one of the selected datasets.",e.id))}function V(e){return e.map(t=>t==null?void 0:t.source).filter(t=>!!t)}function L(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function Me(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function Ne(e){var n;if(!e)return[];const t=[e.source];return e.kind==="metric"?t.push(...V([...L(e.metrics),e.primaryMetric,e.dateField,...L(e.dimensions),...Me(e.filters).map(r=>r.field)])):e.kind==="records"?t.push(...V([...L(e.fields),e.dateField,(n=e.orderBy)==null?void 0:n.field])):e.kind==="inputOptions"?t.push(...V([e.field])):e.kind==="sql"&&t.push(...V(e.fields||[])),t}function ue({card:e,datasets:t,errors:n}){if(e.type!=="text"){for(const r of Ne(e.analyticsIntent))if(r&&!t.some(a=>z(a,r))){n.push(f("invalid_card_query_source","Dashboard card query field references must use one of the selected datasets.",e.id));return}}}function fe({card:e,errors:t}){if(e.type==="text"||!e.analyticsIntent)return;const n=v.validateSemaphorAnalyticsIntent(e.analyticsIntent);if(!n.ok)for(const r of n.errors)t.push(f(r.code,r.path?`${r.path}: ${r.message}`:r.message,e.id))}function pe({datasets:e,errors:t,requireAtLeastOne:n}){const r=ce({datasets:e,requireAtLeastOne:n});if(!r.ok){if(r.issue==="invalid_dataset_count"){t.push(f("invalid_dataset_count","Dashboard authoring requires at least one selected dataset."));return}t.push(f("invalid_multi_dataset_scope","Multi-dataset dashboard authoring is limited to semantic datasets from one domain."))}}function he(e){var p,S;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[f("invalid_plan","Dashboard plan must be a structured object.")],warnings:[]};const n=e,r=[...n.warnings||[]];n.version!==1&&t.push(f("invalid_version","Dashboard plan version must be 1.")),(p=n.title)!=null&&p.trim()||t.push(f("missing_title","Dashboard plan needs a title."));const a=Array.isArray(n.datasets)?n.datasets:[],i=Array.isArray(n.sheets)?n.sheets:[];pe({datasets:a,errors:t,requireAtLeastOne:!0}),i.length!==1&&t.push(f("invalid_sheet_count","MVP dashboard authoring creates exactly one dashboard sheet."));const o=i[0];o&&o.kind!=="dashboard"&&t.push(f("invalid_sheet_kind",'Generated sheet must use kind "dashboard".'));const d=(o==null?void 0:o.cards)||[];d.length>$&&t.push(f("too_many_cards",`Generated dashboards can contain at most ${$} cards.`));const s=B(d.map(l=>l.id));s&&t.push(f("duplicate_card_id",`Duplicate generated card id: ${s}.`));const u=B(d.map(l=>l.frameId));u&&t.push(f("duplicate_frame_id",`Duplicate generated frame id: ${u}.`));for(const l of d)(S=l.title)!=null&&S.trim()||t.push(f("missing_card_title","Card title is required.",l.id)),l.type==="custom"&&t.push(f("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",l.id)),l.type!=="text"&&!l.analyticsIntent&&r.push(f("missing_analytics_intent","Non-text card has no analytics intent and may be skipped by the app layer.",l.id)),le({card:l,datasets:a,errors:t}),fe({card:l,errors:t}),ue({card:l,datasets:a,errors:t});const h=Array.isArray(n.filterInputs)?n.filterInputs:[],b=h.map(l=>l.id),y=B(b);y&&t.push(f("duplicate_input_id",`Duplicate dashboard input id: ${y}.`));const c=h.map(l=>l.variableName).filter(Boolean)||[],g=B(c);g&&t.push(f("duplicate_input_variable",`Duplicate dashboard input variable name: ${g}.`));const A=Array.isArray(n.calculatedFields)?n.calculatedFields:[];for(const l of A)l.scope==="domain"&&l.reuseOnly!==!0&&t.push(f("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${l.name}" is outside MVP.`));return{ok:t.length===0,errors:t,warnings:r}}function me(e){var o;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[f("invalid_change_plan","Dashboard change plan must be a structured object.")],warnings:[]};const n=e,r=[...n.warnings||[]];n.version!==1&&t.push(f("invalid_version","Dashboard change plan version must be 1.")),(o=n.dashboardId)!=null&&o.trim()||t.push(f("missing_dashboard_id","Dashboard change plan needs a dashboard id."));const a=Array.isArray(n.datasets)?n.datasets:[],i=Array.isArray(n.operations)?n.operations:[];pe({datasets:a,errors:t,requireAtLeastOne:!1});for(const d of i){if(d.kind==="unsupported"){r.push(f("unsupported_operation",d.reason||d.requestedAction));continue}d.kind==="addCard"&&d.card.type==="custom"&&t.push(f("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",d.card.id)),d.kind==="addCard"&&(le({card:d.card,datasets:a,errors:t}),fe({card:d.card,errors:t}),ue({card:d.card,datasets:a,errors:t})),d.kind==="addCalculatedField"&&d.field.scope==="domain"&&d.field.reuseOnly!==!0&&t.push(f("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${d.field.name}" is outside MVP.`))}return{ok:t.length===0,errors:t,warnings:r}}const Pe={lg:48,md:36,sm:24,xs:12,xxs:6};function Re(e,t){let n=0,r=0,a=0;return e.map(i=>{const o=Math.min(i.w,t);n>0&&n+o>t&&(n=0,r+=a,a=0);const d={i:i.frameId,x:n,y:r,w:o,h:i.h,minW:Math.min(i.minW,t),minH:i.minH,static:!1};return n+=o,a=Math.max(a,i.h),d})}function Be(e){const t=[...e].sort((s,u)=>s.priority-u.priority),n=t.filter(s=>s.role==="kpi"),r=t.filter(s=>s.role==="chart"),a=t.filter(s=>s.role==="table"),i=t.filter(s=>s.role==="text"),o=i.slice(0,1),d=i.slice(o.length);return{kpis:n,introText:o,charts:r,tables:a,supportingText:d}}function Ve(e,t,n){return t==="xxs"||t==="xs"?n:t==="sm"?Math.min(12,n):t==="md"?e<=1||e===2?18:12:e<=1||e===2?24:e===3?16:12}function ze(e,t,n,r){return n==="xxs"||n==="xs"||n==="sm"||n==="md"||t===1||t%2===1&&e===0?r:r/2}function Oe(e){const{item:t,band:n,index:r,bandCount:a,breakpoint:i,columns:o}=e;return n==="kpi"?{...t,band:n,w:Ve(a,i,o),h:15,minW:Math.min(6,o),minH:12}:n==="table"?{...t,band:n,w:o,h:i==="xxs"||i==="xs"?34:38,minW:Math.min(12,o),minH:18}:n==="introText"?{...t,band:n,w:o,h:i==="xxs"||i==="xs"?12:10,minW:Math.min(12,o),minH:8}:n==="supportingText"?{...t,band:n,w:i==="lg"?o/2:o,h:i==="xxs"||i==="xs"?12:10,minW:Math.min(12,o),minH:8}:{...t,band:n,w:ze(r,a,i,o),h:i==="xxs"||i==="xs"?28:30,minW:Math.min(12,o),minH:16}}function x(e,t,n,r){return e.map((a,i)=>Oe({item:a,band:t,index:i,bandCount:e.length,breakpoint:n,columns:r}))}function O(e){const t=Be(e);return Object.fromEntries(re.map(n=>{const r=Pe[n],a=[...x(t.introText,"introText",n,r),...x(t.kpis,"kpi",n,r),...x(t.charts,"chart",n,r),...x(t.tables,"table",n,r),...x(t.supportingText,"supportingText",n,r)];return[n,Re(a,r)]}))}function qe(e){const t=Se.normalizeAnalyticsCatalogDataType(e);return t==="datetime"?"date":t==="unknown"?"string":t}function Le(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function je(e){return Le(e)&&typeof e.filterId=="string"&&typeof e.operation=="string"&&Array.isArray(e.values)}function Ee(e){return e.filter(t=>typeof t=="string"||typeof t=="number")}function He(e){return e.filter(t=>t instanceof Date||typeof t=="string")}function K(e,t){if(t===void 0)return;const n=qe(e.dataType),r=e.operation||"in";if(je(t))return{...t,filterId:e.id,name:t.name||e.column,valueType:n,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};if(r==="is null"||r==="is not null")return{filterId:e.id,name:e.column,operation:r,valueType:n,values:[],dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};const a=Array.isArray(t)?t:[t],i=n==="date"?He(a):Ee(a);if(i.length!==0&&!((r==="between"||r==="not between")&&i.length<2))return{filterId:e.id,name:e.column,operation:r,valueType:n,values:i,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext}}function We(e,t,n){return n?{code:e,message:t,cardId:n}:{code:e,message:t}}function Ge(e,t,n){const r=(t||[]).filter(a=>a.scope==="card"&&a.targetCardId===n).map(a=>a.field).filter(Boolean);return r.length===0?e:{...e,calculatedFields:[...e.calculatedFields||[],...r]}}function Ke(e){const t={};return{inputs:(e.filterInputs||[]).map((r,a)=>{const i=K(r.filter,r.defaultValue);return i&&(t.shared??(t.shared={}),t.shared[r.id]={status:"set",value:{kind:"filter",filterValue:i}}),{id:r.id,kind:"filter",label:r.label,variableName:r.variableName,scope:r.scope||{kind:"allSheets",sheetKinds:["dashboard"]},runtimeScope:"shared",presentation:{placement:"toolbar",order:a},exports:["label","value","start","end","range"],filter:r.filter}}),defaultInputValues:t.shared&&Object.keys(t.shared).length>0?t:void 0}}function Ue(e){var b,y;const t=he(e.plan);if(!t.ok)throw new Error(t.errors.map(c=>c.message).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../chunks/validators-8R9pr2K9.js"),Se=require("../chunks/catalog-field-grounding-Du6mKDcF.js"),re=["lg","md","sm","xs","xxs"],$=10;function _(e){return e&&typeof e=="object"?e:null}function D(e){return typeof e=="string"?e:null}function ae(e){var t,n,r;return!!(e&&typeof e=="object")&&(((t=_(e))==null?void 0:t.kind)==="semantic"||((n=_(e))==null?void 0:n.kind)==="physical"||((r=_(e))==null?void 0:r.kind)==="sql")}function N(e){return ae(e)?e.kind==="semantic"?!!(e.domainId&&e.datasetName):e.kind==="physical"?!!(e.connectionId&&e.tableName):!1:!1}function we(e){return v.semaphorSourceIdentityKey(e)}function G(e,t){return v.semaphorSourcesReferToSameDataset(e,t)}function ie(e,t){return v.preferSemaphorSourceMetadata(e,t)}function M(e){const t=[];for(const n of e){const r=t.findIndex(a=>G(a,n));r===-1?t.push(n):t[r]=ie(t[r],n)}return t}function ve(e){return M(e)[0]}function H(e,t){return e.kind!=="semantic"||e.connectionId||(t==null?void 0:t.kind)!=="semantic"||!v.semaphorSourcesReferToSameDataset(e,t)||!t.connectionId?e:{...e,connectionId:t.connectionId}}function W(e){return N(e)?e:void 0}function ne(e,t){if(!(e.kind!=="semantic"||e.connectionId))return t.find(n=>(n==null?void 0:n.kind)==="semantic"&&v.semaphorSourcesReferToSameDataset(e,n)&&!!n.connectionId)}function w(e,t){const n=W(e==null?void 0:e.source);return n?H(n,t):void 0}function oe({explicitSource:e,field:t,defaultSource:n,fallbackSources:r}){const a=[n,...r||[]],i=W(e),o=i?H(i,ne(i,a)):void 0;if(o)return o;if(e!==void 0)return;const d=w(t,n),s=d?H(d,ne(d,a)):void 0;if(s)return s;if((t==null?void 0:t.source)===void 0)return W(n)}function De(e,t){if(!(e!=null&&e.name)||!(t!=null&&t.name)||e.name!==t.name)return!1;const n=w(e),r=w(t);return!n||!r?!0:G(n,r)}function C(e){var t;return D((t=_(e))==null?void 0:t.kind)}function se(e){var t,n;return C(e)!=="semantic"?null:((n=D((t=_(e))==null?void 0:t.domainId))==null?void 0:n.trim())||null}function Ae(e){var t;return C(e)!=="semantic"?null:D((t=_(e))==null?void 0:t.datasetName)}function Ce(e){var t;return C(e)!=="semantic"?null:D((t=_(e))==null?void 0:t.datasetId)}function ke(e){var t;return C(e)!=="physical"?null:D((t=_(e))==null?void 0:t.connectionId)}function xe(e){var t;return C(e)!=="physical"?null:D((t=_(e))==null?void 0:t.tableName)}function Fe(e){var t;return C(e)!=="physical"?"":D((t=_(e))==null?void 0:t.databaseName)||""}function Te(e){var t;return C(e)!=="physical"?"":D((t=_(e))==null?void 0:t.schemaName)||""}function de(e){if(e.analyticsIntent&&typeof e.analyticsIntent=="object"&&"source"in e.analyticsIntent)return e.analyticsIntent.source}function ce({datasets:e,requireAtLeastOne:t}){if(t&&e.length<1)return{ok:!1,issue:"invalid_dataset_count"};if(e.length<=1)return{ok:!0};const n=e.map(se),r=new Set(n.filter(Boolean));return n.some(a=>!a)||r.size!==1?{ok:!1,issue:"invalid_multi_dataset_scope"}:{ok:!0}}function z(e,t){if(!t)return!1;if(t.kind==="semantic"){const n=Ce(e);return se(e)===t.domainId?n&&t.datasetId?n===t.datasetId:Ae(e)===t.datasetName:!1}return t.kind==="physical"?ke(e)===t.connectionId&&xe(e)===t.tableName&&Fe(e)===(t.databaseName||"")&&Te(e)===(t.schemaName||""):!1}function $e(e,t){return e.find(n=>z(n,t))}function f(e,t,n){return n?{code:e,message:t,cardId:n}:{code:e,message:t}}function B(e){const t=new Set;for(const n of e){if(t.has(n))return n;t.add(n)}return null}function le({card:e,datasets:t,errors:n}){if(e.type==="text")return;const r=de(e);if(!r){if(t.length<=1)return;n.push(f("missing_card_analytics_source","Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",e.id));return}t.some(a=>z(a,r))||n.push(f("invalid_card_analytics_source","Dashboard cards with an explicit analytics source must use one of the selected datasets.",e.id))}function V(e){return e.map(t=>t==null?void 0:t.source).filter(t=>!!t)}function L(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function Me(e){return Array.isArray(e)?e.filter(t=>!!(t&&typeof t=="object")):[]}function Ne(e){var n;if(!e)return[];const t=[e.source];return e.kind==="metric"?t.push(...V([...L(e.metrics),e.primaryMetric,e.dateField,...L(e.dimensions),...Me(e.filters).map(r=>r.field)])):e.kind==="records"?t.push(...V([...L(e.fields),e.dateField,(n=e.orderBy)==null?void 0:n.field])):e.kind==="inputOptions"?t.push(...V([e.field])):e.kind==="sql"&&t.push(...V(e.fields||[])),t}function ue({card:e,datasets:t,errors:n}){if(e.type!=="text"){for(const r of Ne(e.analyticsIntent))if(r&&!t.some(a=>z(a,r))){n.push(f("invalid_card_query_source","Dashboard card query field references must use one of the selected datasets.",e.id));return}}}function fe({card:e,errors:t}){if(e.type==="text"||!e.analyticsIntent)return;const n=v.validateSemaphorAnalyticsIntent(e.analyticsIntent);if(!n.ok)for(const r of n.errors)t.push(f(r.code,r.path?`${r.path}: ${r.message}`:r.message,e.id))}function pe({datasets:e,errors:t,requireAtLeastOne:n}){const r=ce({datasets:e,requireAtLeastOne:n});if(!r.ok){if(r.issue==="invalid_dataset_count"){t.push(f("invalid_dataset_count","Dashboard authoring requires at least one selected dataset."));return}t.push(f("invalid_multi_dataset_scope","Multi-dataset dashboard authoring is limited to semantic datasets from one domain."))}}function he(e){var p,S;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[f("invalid_plan","Dashboard plan must be a structured object.")],warnings:[]};const n=e,r=[...n.warnings||[]];n.version!==1&&t.push(f("invalid_version","Dashboard plan version must be 1.")),(p=n.title)!=null&&p.trim()||t.push(f("missing_title","Dashboard plan needs a title."));const a=Array.isArray(n.datasets)?n.datasets:[],i=Array.isArray(n.sheets)?n.sheets:[];pe({datasets:a,errors:t,requireAtLeastOne:!0}),i.length!==1&&t.push(f("invalid_sheet_count","MVP dashboard authoring creates exactly one dashboard sheet."));const o=i[0];o&&o.kind!=="dashboard"&&t.push(f("invalid_sheet_kind",'Generated sheet must use kind "dashboard".'));const d=(o==null?void 0:o.cards)||[];d.length>$&&t.push(f("too_many_cards",`Generated dashboards can contain at most ${$} cards.`));const s=B(d.map(l=>l.id));s&&t.push(f("duplicate_card_id",`Duplicate generated card id: ${s}.`));const u=B(d.map(l=>l.frameId));u&&t.push(f("duplicate_frame_id",`Duplicate generated frame id: ${u}.`));for(const l of d)(S=l.title)!=null&&S.trim()||t.push(f("missing_card_title","Card title is required.",l.id)),l.type==="custom"&&t.push(f("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",l.id)),l.type!=="text"&&!l.analyticsIntent&&r.push(f("missing_analytics_intent","Non-text card has no analytics intent and may be skipped by the app layer.",l.id)),le({card:l,datasets:a,errors:t}),fe({card:l,errors:t}),ue({card:l,datasets:a,errors:t});const h=Array.isArray(n.filterInputs)?n.filterInputs:[],b=h.map(l=>l.id),y=B(b);y&&t.push(f("duplicate_input_id",`Duplicate dashboard input id: ${y}.`));const c=h.map(l=>l.variableName).filter(Boolean)||[],g=B(c);g&&t.push(f("duplicate_input_variable",`Duplicate dashboard input variable name: ${g}.`));const A=Array.isArray(n.calculatedFields)?n.calculatedFields:[];for(const l of A)l.scope==="domain"&&l.reuseOnly!==!0&&t.push(f("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${l.name}" is outside MVP.`));return{ok:t.length===0,errors:t,warnings:r}}function me(e){var o;const t=[];if(!e||typeof e!="object")return{ok:!1,errors:[f("invalid_change_plan","Dashboard change plan must be a structured object.")],warnings:[]};const n=e,r=[...n.warnings||[]];n.version!==1&&t.push(f("invalid_version","Dashboard change plan version must be 1.")),(o=n.dashboardId)!=null&&o.trim()||t.push(f("missing_dashboard_id","Dashboard change plan needs a dashboard id."));const a=Array.isArray(n.datasets)?n.datasets:[],i=Array.isArray(n.operations)?n.operations:[];pe({datasets:a,errors:t,requireAtLeastOne:!1});for(const d of i){if(d.kind==="unsupported"){r.push(f("unsupported_operation",d.reason||d.requestedAction));continue}d.kind==="addCard"&&d.card.type==="custom"&&t.push(f("custom_visual_out_of_scope","Whole-dashboard authoring supports built-in visual types only.",d.card.id)),d.kind==="addCard"&&(le({card:d.card,datasets:a,errors:t}),fe({card:d.card,errors:t}),ue({card:d.card,datasets:a,errors:t})),d.kind==="addCalculatedField"&&d.field.scope==="domain"&&d.field.reuseOnly!==!0&&t.push(f("domain_calculated_field_create_out_of_scope",`Creating domain calculated field "${d.field.name}" is outside MVP.`))}return{ok:t.length===0,errors:t,warnings:r}}const Pe={lg:48,md:36,sm:24,xs:12,xxs:6};function Re(e,t){let n=0,r=0,a=0;return e.map(i=>{const o=Math.min(i.w,t);n>0&&n+o>t&&(n=0,r+=a,a=0);const d={i:i.frameId,x:n,y:r,w:o,h:i.h,minW:Math.min(i.minW,t),minH:i.minH,static:!1};return n+=o,a=Math.max(a,i.h),d})}function Be(e){const t=[...e].sort((s,u)=>s.priority-u.priority),n=t.filter(s=>s.role==="kpi"),r=t.filter(s=>s.role==="chart"),a=t.filter(s=>s.role==="table"),i=t.filter(s=>s.role==="text"),o=i.slice(0,1),d=i.slice(o.length);return{kpis:n,introText:o,charts:r,tables:a,supportingText:d}}function Ve(e,t,n){return t==="xxs"||t==="xs"?n:t==="sm"?Math.min(12,n):t==="md"?e<=1||e===2?18:12:e<=1||e===2?24:e===3?16:12}function ze(e,t,n,r){return n==="xxs"||n==="xs"||n==="sm"||n==="md"||t===1||t%2===1&&e===0?r:r/2}function Oe(e){const{item:t,band:n,index:r,bandCount:a,breakpoint:i,columns:o}=e;return n==="kpi"?{...t,band:n,w:Ve(a,i,o),h:15,minW:Math.min(6,o),minH:12}:n==="table"?{...t,band:n,w:o,h:i==="xxs"||i==="xs"?34:38,minW:Math.min(12,o),minH:18}:n==="introText"?{...t,band:n,w:o,h:i==="xxs"||i==="xs"?12:10,minW:Math.min(12,o),minH:8}:n==="supportingText"?{...t,band:n,w:i==="lg"?o/2:o,h:i==="xxs"||i==="xs"?12:10,minW:Math.min(12,o),minH:8}:{...t,band:n,w:ze(r,a,i,o),h:i==="xxs"||i==="xs"?28:30,minW:Math.min(12,o),minH:16}}function x(e,t,n,r){return e.map((a,i)=>Oe({item:a,band:t,index:i,bandCount:e.length,breakpoint:n,columns:r}))}function O(e){const t=Be(e);return Object.fromEntries(re.map(n=>{const r=Pe[n],a=[...x(t.introText,"introText",n,r),...x(t.kpis,"kpi",n,r),...x(t.charts,"chart",n,r),...x(t.tables,"table",n,r),...x(t.supportingText,"supportingText",n,r)];return[n,Re(a,r)]}))}function qe(e){const t=Se.normalizeAnalyticsCatalogDataType(e);return t==="datetime"?"date":t==="unknown"?"string":t}function Le(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function je(e){return Le(e)&&typeof e.filterId=="string"&&typeof e.operation=="string"&&Array.isArray(e.values)}function Ee(e){return e.filter(t=>typeof t=="string"||typeof t=="number")}function He(e){return e.filter(t=>t instanceof Date||typeof t=="string")}function K(e,t){if(t===void 0)return;const n=qe(e.dataType),r=e.operation||"in";if(je(t))return{...t,filterId:e.id,name:t.name||e.column,valueType:n,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};if(r==="is null"||r==="is not null")return{filterId:e.id,name:e.column,operation:r,valueType:n,values:[],dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext};const a=Array.isArray(t)?t:[t],i=n==="date"?He(a):Ee(a);if(i.length!==0&&!((r==="between"||r==="not between")&&i.length<2))return{filterId:e.id,name:e.column,operation:r,valueType:n,values:i,dataType:e.dataType,fieldMeta:e.fieldMeta,semanticContext:e.semanticContext}}function We(e,t,n){return n?{code:e,message:t,cardId:n}:{code:e,message:t}}function Ge(e,t,n){const r=(t||[]).filter(a=>a.scope==="card"&&a.targetCardId===n).map(a=>a.field).filter(Boolean);return r.length===0?e:{...e,calculatedFields:[...e.calculatedFields||[],...r]}}function Ke(e){const t={};return{inputs:(e.filterInputs||[]).map((r,a)=>{const i=K(r.filter,r.defaultValue);return i&&(t.shared??(t.shared={}),t.shared[r.id]={status:"set",value:{kind:"filter",filterValue:i}}),{id:r.id,kind:"filter",label:r.label,variableName:r.variableName,scope:r.scope||{kind:"allSheets",sheetKinds:["dashboard"]},runtimeScope:"shared",presentation:{placement:"toolbar",order:a},exports:["label","value","start","end","range"],filter:r.filter}}),defaultInputValues:t.shared&&Object.keys(t.shared).length>0?t:void 0}}function Ue(e){var b,y;const t=he(e.plan);if(!t.ok)throw new Error(t.errors.map(c=>c.message).join(`
2
2
  `)||"Dashboard plan is invalid.");const n=e.plan.sheets[0],r=[...t.warnings],a=[],i=new Map(e.cardArtifacts.map(c=>[c.planCardId,c])),o=[];for(const c of n.cards){const g=i.get(c.id);if(!g){const p=We("missing_card_artifact",`Card "${c.title}" was skipped because no generated artifact was supplied.`,c.id);a.push(p);continue}r.push(...g.warnings||[]);const A=Ge(g.card,e.plan.calculatedFields,c.id);o.push({id:c.frameId,cards:[A],activeCardId:A.id})}if(o.length===0)throw new Error("Dashboard plan did not produce any persistable cards.");const{inputs:d,defaultInputValues:s}=Ke(e.plan),u=O(n.cards.filter(c=>o.some(g=>g.id===c.frameId)).map(c=>({frameId:c.frameId,priority:c.priority,role:c.role})));return{dashboard:{id:e.dashboardId,title:e.plan.title,description:e.plan.description||"",sheets:[{id:n.id,kind:"dashboard",title:n.title,description:n.description,frames:o,layouts:u,calculatedFields:(b=e.plan.calculatedFields)==null?void 0:b.filter(c=>c.scope==="sheet"&&c.field).map(c=>c.field)}],calculatedFields:(y=e.plan.calculatedFields)==null?void 0:y.filter(c=>c.scope==="dashboard"&&c.field).map(c=>c.field),inputs:d,...s?{defaultInputValues:s}:{}},warnings:r,skippedOperations:a}}function k(e,t,n){return n?{code:e,message:t,cardId:n}:{code:e,message:t}}function Xe(e){return JSON.parse(JSON.stringify(e))}function Je(e){var t;return(t=e.sheets)==null?void 0:t.find(n=>(n.kind||"dashboard")==="dashboard")}function j(e,t){var n;for(const r of e.sheets||[])for(const a of r.frames||[]){const i=(n=a.cards)==null?void 0:n.find(o=>o.id===t);if(i)return{sheet:r,frame:a,card:i}}return null}function ge(e){var n,r;const t=(r=(n=e.cards)==null?void 0:n[0])==null?void 0:r.type;return t==="kpi"?"kpi":t==="table"||t==="detailTable"||t==="pivotTable"?"table":t==="text"?"text":"chart"}function Qe(e){var t;return new Map((((t=e.layouts)==null?void 0:t.lg)||[]).map((n,r)=>[n.i,r]))}function be(e,t=new Map){const n=Qe(e),r=Math.max(n.size,t.size),a=(e.frames||[]).map((i,o)=>({frameId:i.id,role:ge(i),priority:t.get(i.id)??n.get(i.id)??r+o}));e.layouts=O(a)}function Ye(e){return Object.values(e.layouts||{}).some(t=>t.length>0)}function Ze(e,t){if(!Ye(e)){be(e);return}const n=O([{frameId:t.id,role:ge(t),priority:0}]);e.layouts??(e.layouts={});for(const[r,a]of Object.entries(n)){const i=e.layouts[r]||[];if(i.some(s=>s.i===t.id))continue;const o=a[0];if(!o)continue;const d=i.reduce((s,u)=>Math.max(s,u.y+u.h),0);e.layouts[r]=[...i,{...o,y:d}]}}function et(e,t){var r;const n=K(t.filter,t.defaultValue);n&&(e.defaultInputValues??(e.defaultInputValues={}),(r=e.defaultInputValues).shared??(r.shared={}),e.defaultInputValues.shared[t.id]={status:"set",value:{kind:"filter",filterValue:n}})}function tt(e){var d;const t=me(e.changePlan);if(!t.ok)throw new Error(t.errors.map(s=>s.message).join(`
3
3
  `)||"Dashboard change plan is invalid.");const n=Xe(e.dashboard),r=[...t.warnings],a=[],i=new Map(e.cardArtifacts.map(s=>[s.planCardId,s])),o=Je(n);if(!o)throw new Error("Dashboard has no editable dashboard sheet.");o.frames??(o.frames=[]);for(const s of e.changePlan.operations)switch(s.kind){case"addCard":{if((o.frames||[]).reduce((y,c)=>{var g;return y+(((g=c.cards)==null?void 0:g.length)||0)},0)>=$){a.push(k("generated_card_limit_reached",`MVP AI refinement is capped at ${$} cards.`,s.card.id));break}const h=i.get(s.card.id);if(!h){a.push(k("missing_card_artifact",`Card "${s.card.title}" was skipped because no generated artifact was supplied.`,s.card.id));break}const b={id:s.card.frameId,cards:[h.card],activeCardId:h.card.id};o.frames.push(b),Ze(o,b);break}case"addFilterInput":{n.inputs??(n.inputs=[]);const u={id:s.input.id,kind:"filter",label:s.input.label,variableName:s.input.variableName,scope:s.input.scope||{kind:"allSheets",sheetKinds:["dashboard"]},runtimeScope:"shared",presentation:{placement:"toolbar",order:n.inputs.length},exports:["label","value","start","end","range"],filter:s.input.filter};n.inputs.push(u),et(n,s.input);break}case"addCalculatedField":{if(s.field.scope==="dashboard"&&s.field.field)n.calculatedFields??(n.calculatedFields=[]),n.calculatedFields.push(s.field.field);else if(s.field.scope==="sheet"&&s.field.field)o.calculatedFields??(o.calculatedFields=[]),o.calculatedFields.push(s.field.field);else if(s.field.scope==="card"&&s.field.field){const u=s.field.targetCardId?j(n,s.field.targetCardId):null;u?((d=u.card).calculatedFields??(d.calculatedFields=[]),u.card.calculatedFields.push(s.field.field)):a.push(k("missing_calculated_field_target",`Calculated field "${s.field.name}" needs a valid target card.`))}break}case"renameCard":{const u=j(n,s.cardId);if(!u){a.push(k("card_not_found",`Card "${s.cardId}" could not be renamed because it was not found.`,s.cardId));break}u.card.title=s.title,s.description!==void 0&&(u.card.description=s.description);break}case"reorderCards":{const u=new Map;for(let h=0;h<s.cardIds.length;h+=1){const b=s.cardIds[h],y=j(n,b);y&&u.set(y.frame.id,h)}be(o,u);break}case"reuseCalculatedField":r.push(k("reused_calculated_field",`Calculated field "${s.fieldId}" is reused by reference.`));break;case"unsupported":a.push(k("unsupported_operation",s.reason||s.requestedAction));break}return{dashboard:n,warnings:r,skippedOperations:a}}function I(e,t,n){return n?{code:e,message:t,cardId:n}:{code:e,message:t}}function T(e,t){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||t}function Ie(e,t){if(!t.has(e))return t.add(e),e;let n=2,r=`${e}-${n}`;for(;t.has(r);)n+=1,r=`${e}-${n}`;return t.add(r),r}function P(e){return!!(e&&typeof e=="object")}function ye(e){return Array.isArray(e.inputs)?e.inputs.filter(t=>P(t)&&typeof t.id=="string"):[]}function U(e){return Array.isArray(e.sections)?e.sections.filter(t=>P(t)):[]}function X(e){return Array.isArray(e.views)?e.views.filter(t=>P(t)):[]}function F(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){const r=w(n);r&&t.push(r)}return t}function nt(e){var r;if(!e)return[];const t=[];if(N(e.source)&&t.push(e.source),e.kind==="metric"){t.push(...F(e.metrics));const a=w(e.dateField);a&&t.push(a),t.push(...F(e.dimensions)),t.push(...F((r=e.filters)==null?void 0:r.map(i=>i.field)))}else if(e.kind==="records"){const a=w(e.dateField);a&&t.push(a),t.push(...F(e.fields))}else if(e.kind==="inputOptions"){const a=w(e.field);a&&t.push(a)}else e.kind==="sql"&&t.push(...F(e.fields));const n="inputs"in e&&Array.isArray(e.inputs)?e.inputs:[];for(const a of n){const i=w(a.field);i&&t.push(i)}return t}function rt(e){const t=[];for(const n of ye(e)){const r=w(n.field);r&&t.push(r)}for(const n of U(e))for(const r of X(n))t.push(...nt(r.analytics));return t}function at(e){var n;const t=[];for(const r of U(e))for(const a of X(r))N((n=a.analytics)==null?void 0:n.source)&&t.push(a.analytics.source);return t}function it(e,t){const n=M(e).filter(N);if(n.length===0)return t.push(I("missing_materializable_dataset","No semantic or physical source could be converted into the current dashboard authoring dataset reference.")),[];const r=n.every(i=>i.kind==="semantic"),a=Array.from(new Set(n.filter(i=>i.kind==="semantic").map(i=>i.domainId)));return n.length>1&&(!r||a.length!==1)?(t.push(I("multiple_datasets_out_of_scope","The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest.")),[n[0]]):n}function ot(e,t){const n=U(e),r=ye(e),a=M(rt(e)),i=M(at(e));return{sections:n,inputs:r,sources:a,primarySources:i,defaultSource:i.length===1?i[0]:void 0,datasets:it(a,t)}}function st(e){return e&&v.validateSemaphorAnalyticsIntent(e).ok?e:void 0}function dt(e){var t;switch((t=e.presentation)==null?void 0:t.kind){case"kpi":return"kpi";case"lineChart":return"line";case"barChart":return"bar";case"areaChart":return"area";case"table":return"table";case"text":return"text";default:return null}}function ct(e){var t,n,r;return((t=e.presentation)==null?void 0:t.kind)==="kpi"?"kpi":((n=e.presentation)==null?void 0:n.kind)==="table"?"table":((r=e.presentation)==null?void 0:r.kind)==="text"?"text":"chart"}function lt(e){switch(e){case"not_in":return"not in";case"not_between":return"not between";case"contains":return"like";default:return e||"in"}}function ut(e){return P(e.field)?e.field.dataType==="datetime"?"date":e.field.dataType||"string":"string"}function ft(e){if(!(!e||e.kind!=="physical"))return[e.databaseName,e.schemaName,e.tableName].filter(Boolean).join(".")}function pt(e,t,n,r,a,i){if(e.kind!=="filter")return i.push(I("control_inputs_deferred",`Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`)),null;if(!P(e.field)||typeof e.field.name!="string")return i.push(I("filter_requires_field",`Filter "${e.label||e.id}" needs a field before the dashboard compiler can materialize it.`)),null;const o=oe({explicitSource:void 0,field:e.field,defaultSource:t,fallbackSources:n}),d=(o==null?void 0:o.kind)==="semantic"||(o==null?void 0:o.kind)==="physical"?o.connectionId:void 0;if(!d)return i.push(I("filter_requires_connection_id",`Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`)),null;const h={id:`filter-${Ie(T(e.id,e.field.name),a)}`,variableName:e.id,connectionId:d,title:e.label,column:e.field.name,dataType:ut(e),qualifiedTableName:ft(o),sql:"",operation:lt(e.operator),type:e.multi===!1?"single":"multiple",location:"dashboard",displayMode:"toolbar",fieldMeta:(o==null?void 0:o.kind)==="semantic"?{name:e.field.name,qualifiedFieldName:e.field.name,dataType:e.field.dataType,role:e.field.role==="measure"?"metric":"groupby"}:void 0,semanticContext:(o==null?void 0:o.kind)==="semantic"?{semanticDomainId:o.domainId,connectionId:o.connectionId}:void 0};return{id:e.id,label:e.label,variableName:e.id,scope:r,filter:h,defaultValue:K(h,e.defaultValue)}}function E(e){const t=[],n=[];for(const r of e.viewIds){const a=e.viewIdToCardId.get(r);a?t.push(a):n.push(r)}return n.length>0&&e.warnings.push(I("input_scope_view_not_found",`Filter "${e.inputLabel}" referenced unknown view ids: ${n.join(", ")}.`)),Array.from(new Set(t))}function ht(e){var r,a;if(!e.protocolScope){const i=Array.from(new Set(e.boundCardIds));return i.length>0&&i.length<e.allCardIds.length?{kind:"cards",cardIds:i}:void 0}if(e.protocolScope.level==="dashboard"){if(!((r=e.protocolScope.excludeViewIds)!=null&&r.length))return;const i=new Set(E({inputLabel:e.inputLabel,viewIds:e.protocolScope.excludeViewIds,viewIdToCardId:e.viewIdToCardId,warnings:e.warnings}));return{kind:"cards",cardIds:e.allCardIds.filter(o=>!i.has(o))}}if(e.protocolScope.level==="view"){const i=E({inputLabel:e.inputLabel,viewIds:e.protocolScope.viewIds,viewIdToCardId:e.viewIdToCardId,warnings:e.warnings});return i.length===0?(e.warnings.push(I("input_scope_has_no_materialized_cards",`Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`)),null):{kind:"cards",cardIds:i}}const t=e.sectionIdToCardIds.get(e.protocolScope.sectionId)||[];if(t.length===0)return e.warnings.push(I("input_scope_section_not_found",`Filter "${e.inputLabel}" was deferred because section "${e.protocolScope.sectionId}" does not match any materialized cards.`)),null;if(!((a=e.protocolScope.excludeViewIds)!=null&&a.length))return{kind:"cards",cardIds:t};const n=new Set(E({inputLabel:e.inputLabel,viewIds:e.protocolScope.excludeViewIds,viewIdToCardId:e.viewIdToCardId,warnings:e.warnings}));return{kind:"cards",cardIds:t.filter(i=>!n.has(i))}}function mt(e){var c,g,A;const t=[],n=v.validateSemaphorDashboardIntent(e);for(const p of n.warnings)t.push(I(p.code,p.message));for(const p of n.errors)t.push(I(p.code,p.message));const r=ot(e,t),a=[],i=new Map,o=new Map,d=new Map,s=new Set,u=new Set;let h=0;for(const[p,S]of r.sections.entries()){const l=typeof S.title=="string"?S.title:`Section ${p+1}`,J=S.id||T(l,`section-${p+1}`);o.set(J,[]);for(const[Q,m]of X(S).entries()){const Y=dt(m),q=T(m.id||`${l}-${m.title||`View ${Q+1}`}`,`card-${p+1}-${Q+1}`);if(!Y){t.push(I("unsupported_presentation",`Dashboard presentation "${((c=m.presentation)==null?void 0:c.kind)||"unknown"}" is not supported by the dashboard authoring adapter.`,`card-${q}`));continue}if(((g=m.analytics)==null?void 0:g.kind)==="sql"){t.push(I("sql_intent_deferred","SQL analytics intent is valid protocol, but the current dashboard authoring adapter only materializes semantic and physical config-card intents.",`card-${q}`));continue}const Z=Ie(q,s),R=`card-${Z}`;m.id&&i.set(m.id,R),(A=o.get(J))==null||A.push(R);const _e=m.analytics&&"inputs"in m.analytics?m.analytics.inputs:void 0;for(const ee of _e||[]){const te=d.get(ee.inputId)||[];te.push(R),d.set(ee.inputId,te)}a.push({id:R,frameId:`frame-${Z}`,title:m.title,description:m.description,type:Y,role:ct(m),priority:h,section:l,analyticsIntent:st(m.analytics),text:m.text}),h+=1}}const b=r.inputs.map(p=>{const S=ht({protocolScope:p.scope,inputLabel:p.label,allCardIds:a.map(l=>l.id),boundCardIds:d.get(p.id)||[],viewIdToCardId:i,sectionIdToCardIds:o,warnings:t});return S===null?null:pt(p,r.defaultSource,r.sources,S,u,t)}).filter(p=>!!p);return{plan:{version:1,id:`plan-${T(e.title,"dashboard")}`,title:e.title,description:e.description,datasets:r.datasets,sheets:[{id:`sheet-${T(e.title,"dashboard")}`,title:e.title,description:e.description,kind:"dashboard",cards:a}],filterInputs:b.length?b:void 0,warnings:t.length?t:void 0,unresolvedRequests:n.ok?void 0:n.errors.map(p=>p.message)},warnings:t}}exports.DASHBOARD_AUTHORING_BREAKPOINTS=re;exports.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS=$;exports.applyDashboardChangePlan=tt;exports.compileDashboardFromPlan=Ue;exports.compileResponsiveDashboardLayouts=O;exports.dashboardAuthoringDatasetMatchesSource=z;exports.dashboardAuthoringFieldsReferToSameTarget=De;exports.dashboardAuthoringSourceFromField=w;exports.dashboardAuthoringSourceKey=we;exports.dashboardAuthoringSourcesReferToSameDataset=G;exports.dashboardPlanFromSemaphorDashboardIntent=mt;exports.findDashboardAuthoringDatasetForSource=$e;exports.getDashboardAuthoringCardSource=de;exports.isMaterializableDashboardAuthoringSource=N;exports.isSemaphorSourceRef=ae;exports.mergeDashboardAuthoringSources=M;exports.preferDashboardAuthoringSourceMetadata=ie;exports.preferredDashboardAuthoringSource=ve;exports.resolveDashboardAuthoringSource=oe;exports.validateDashboardAuthoringDatasetScope=ce;exports.validateDashboardChangePlan=me;exports.validateDashboardPlan=he;
@@ -1,4 +1,4 @@
1
- import { s as he, d as W, p as me, v as ne, c as ge } from "../chunks/validators-BqEnmlC6.js";
1
+ import { s as he, d as W, p as me, v as ne, c as ge } from "../chunks/validators-yMB7Tm4j.js";
2
2
  import { b as be } from "../chunks/catalog-field-grounding-DoEBOXQd.js";
3
3
  const Ie = [
4
4
  "lg",