react-semaphor 0.1.428 → 0.1.430

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 (96) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +72 -71
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +5 -4
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +1031 -622
  7. package/dist/chunks/analyze-result-contract-BswhsmWT.js +1 -0
  8. package/dist/chunks/{analyze-result-contract-DnfF8kBb.js → analyze-result-contract-CfOBEwaC.js} +681 -759
  9. package/dist/chunks/{code-editor-CojfM3qp.js → code-editor-C65eEYyU.js} +2980 -2960
  10. package/dist/chunks/code-editor-DOh3aYEh.js +138 -0
  11. package/dist/chunks/{comparison-document-migration-b6c3xiWh.js → comparison-document-migration-DbU_BTxR.js} +1 -1
  12. package/dist/chunks/{comparison-document-migration-BJH1idOd.js → comparison-document-migration-Dj6xZMCb.js} +2 -2
  13. package/dist/chunks/csv-utils-Co0WxHke.js +4 -0
  14. package/dist/chunks/csv-utils-suxSkJGj.js +376 -0
  15. package/dist/chunks/{dashboard-509sbC4_.js → dashboard-0Tpj3XFq.js} +49934 -47167
  16. package/dist/chunks/dashboard-CVDy3fbO.js +1402 -0
  17. package/dist/chunks/{dashboard-briefing-launcher-B-ZTWJwo.js → dashboard-briefing-launcher-DLQqwXMF.js} +1 -1
  18. package/dist/chunks/{dashboard-briefing-launcher-DIdYHNTq.js → dashboard-briefing-launcher-pkNPk_4j.js} +100 -99
  19. package/dist/chunks/{dashboard-controls-CbRzWo1N.js → dashboard-controls-CIN4biYx.js} +114 -113
  20. package/dist/chunks/{dashboard-controls-CWprw-Pb.js → dashboard-controls-DbW9Jt_P.js} +2 -2
  21. package/dist/chunks/dashboard-json-BDKT0Z-m.js +1 -0
  22. package/dist/chunks/{dashboard-json-jO4GQfZk.js → dashboard-json-DBfR770k.js} +18 -17
  23. package/dist/chunks/edit-dashboard-visual-BjAp_UpK.js +182 -0
  24. package/dist/chunks/{edit-dashboard-visual-KgQTjqWp.js → edit-dashboard-visual-qkvRHS8Q.js} +8721 -8481
  25. package/dist/chunks/{metric-comparison-CWweq9RG.js → metric-comparison-CPoDx56y.js} +1 -1
  26. package/dist/chunks/{metric-comparison-BKgkMy9r.js → metric-comparison-DVy3fll_.js} +1 -1
  27. package/dist/chunks/numeric-presentation-CGTcqocU.js +517 -0
  28. package/dist/chunks/numeric-presentation-Dlb-Dk4c.js +1 -0
  29. package/dist/chunks/report-preferences-dialog-Bx8uzG8K.js +690 -0
  30. package/dist/chunks/report-preferences-dialog-LCHeqh7t.js +1 -0
  31. package/dist/chunks/source-identity-5OPV4gvg.js +92 -0
  32. package/dist/chunks/source-identity-Cbo2LOHQ.js +1 -0
  33. package/dist/chunks/{update-policy-CY2k-pJP.js → update-policy-De2NswtM.js} +1 -1
  34. package/dist/chunks/{update-policy-BgONreNd.js → update-policy-DnF_74zC.js} +1 -1
  35. package/dist/chunks/{use-create-flow-overlay-state-BiMYdjZP.js → use-create-flow-overlay-state-C-CxrQ48.js} +1 -1
  36. package/dist/chunks/{use-create-flow-overlay-state-CGsLzp9A.js → use-create-flow-overlay-state-C-j8E5IZ.js} +97 -96
  37. package/dist/chunks/validators-B2vUAqTf.js +1 -0
  38. package/dist/chunks/{validators-Cz-XuORM.js → validators-Bce_J7Vd.js} +19 -13
  39. package/dist/dashboard/index.cjs +1 -1
  40. package/dist/dashboard/index.js +1 -1
  41. package/dist/dashboard-authoring/index.cjs +3 -3
  42. package/dist/dashboard-authoring/index.js +20 -19
  43. package/dist/data-app-builder/index.cjs +1 -1
  44. package/dist/data-app-builder/index.js +50 -50
  45. package/dist/data-app-codegen/index.cjs +1 -1
  46. package/dist/data-app-codegen/index.js +2 -2
  47. package/dist/data-app-codegen-node/index.cjs +1 -1
  48. package/dist/data-app-codegen-node/index.js +3 -3
  49. package/dist/data-app-sdk/index.cjs +2 -2
  50. package/dist/data-app-sdk/index.js +27 -26
  51. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  52. package/dist/data-app-sdk-adapters/index.js +25 -24
  53. package/dist/data-app-sdk-validation/index.cjs +1 -1
  54. package/dist/data-app-sdk-validation/index.js +57 -55
  55. package/dist/format-utils/index.cjs +2 -5
  56. package/dist/format-utils/index.js +136 -161
  57. package/dist/index.cjs +1 -1
  58. package/dist/index.js +158 -155
  59. package/dist/report-runtime-context/index.cjs +1 -0
  60. package/dist/report-runtime-context/index.js +394 -0
  61. package/dist/style.css +1 -1
  62. package/dist/surfboard/index.cjs +1 -1
  63. package/dist/surfboard/index.js +7 -6
  64. package/dist/types/analytics-protocol.d.ts +0 -4
  65. package/dist/types/briefings.d.ts +216 -19
  66. package/dist/types/dashboard-assistant.d.ts +0 -2
  67. package/dist/types/dashboard-authoring.d.ts +34 -9
  68. package/dist/types/dashboard.d.ts +93 -9
  69. package/dist/types/data-app-builder.d.ts +0 -1
  70. package/dist/types/data-app-codegen-node.d.ts +6 -28
  71. package/dist/types/data-app-codegen.d.ts +6 -28
  72. package/dist/types/data-app-sdk-adapters.d.ts +6 -28
  73. package/dist/types/data-app-sdk-validation.d.ts +6 -29
  74. package/dist/types/data-app-sdk.d.ts +6 -31
  75. package/dist/types/format-utils.d.ts +128 -4
  76. package/dist/types/index.cjs +1 -1
  77. package/dist/types/index.js +10 -13
  78. package/dist/types/main.d.ts +249 -89
  79. package/dist/types/report-runtime-context.d.ts +99 -0
  80. package/dist/types/shared.d.ts +34 -9
  81. package/dist/types/surfboard.d.ts +119 -16
  82. package/dist/types/types.d.ts +156 -73
  83. package/dist/types/value-format-preferences.d.ts +126 -0
  84. package/dist/value-format-preferences/index.cjs +1 -0
  85. package/dist/value-format-preferences/index.js +635 -0
  86. package/package.json +11 -1
  87. package/dist/chunks/analyze-result-contract-ege_u6Nl.js +0 -1
  88. package/dist/chunks/calendar-preferences-dialog-BF9bNAF_.js +0 -457
  89. package/dist/chunks/calendar-preferences-dialog-_L9eBQfj.js +0 -1
  90. package/dist/chunks/code-editor-BoowcKU0.js +0 -138
  91. package/dist/chunks/dashboard-CMDXBLnG.js +0 -1402
  92. package/dist/chunks/dashboard-json-BEZrxx_k.js +0 -1
  93. package/dist/chunks/date-formatter-BTTYdAik.js +0 -1
  94. package/dist/chunks/date-formatter-D-89jTjG.js +0 -514
  95. package/dist/chunks/edit-dashboard-visual-D3uhqgm3.js +0 -182
  96. package/dist/chunks/validators-B4VMLX3_.js +0 -1
@@ -1,8 +1,235 @@
1
- var Q = Object.defineProperty;
2
- var ee = (t, n, e) => n in t ? Q(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
- var M = (t, n, e) => ee(t, typeof n != "symbol" ? n + "" : n, e);
4
- import { i as te } from "../chunks/card-config-utils-BYZ5MJOh.js";
5
- const P = [
1
+ var le = Object.defineProperty;
2
+ var de = (t, n, e) => n in t ? le(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var H = (t, n, e) => de(t, typeof n != "symbol" ? n + "" : n, e);
4
+ import { d as me, j as W } from "../chunks/numeric-presentation-CGTcqocU.js";
5
+ import { parseReportRuntimeContext as se } from "../report-runtime-context/index.js";
6
+ import { i as fe } from "../chunks/card-config-utils-BYZ5MJOh.js";
7
+ function pe(t) {
8
+ return !!t && typeof t == "object" && !Array.isArray(t);
9
+ }
10
+ function E(t, n, e) {
11
+ return pe(t) ? t : (e.push({ field: n, message: "Expected an object." }), {});
12
+ }
13
+ function C(t, n, e, r) {
14
+ const o = new Set(e);
15
+ Object.keys(t).forEach((a) => {
16
+ o.has(a) || r.push({
17
+ field: `${n}.${a}`,
18
+ message: "Unexpected property."
19
+ });
20
+ });
21
+ }
22
+ function T(t, n, e, r, o = {}) {
23
+ if (t == null)
24
+ return;
25
+ if (typeof t != "string") {
26
+ r.push({ field: n, message: "Expected a string." });
27
+ return;
28
+ }
29
+ const a = o.trim === !1 ? t : t.trim();
30
+ if (!o.allowEmpty && a.length === 0) {
31
+ r.push({ field: n, message: "Expected a non-empty string." });
32
+ return;
33
+ }
34
+ if (a.length > e) {
35
+ r.push({
36
+ field: n,
37
+ message: `Expected ${e} characters or fewer.`
38
+ });
39
+ return;
40
+ }
41
+ return a;
42
+ }
43
+ function L(t, n, e) {
44
+ const r = T(t, n, 2e3, e);
45
+ if (r)
46
+ try {
47
+ return new URL(r), r;
48
+ } catch {
49
+ e.push({ field: n, message: "Expected an absolute URL." });
50
+ return;
51
+ }
52
+ }
53
+ function G(t, n, e) {
54
+ const r = E(t, n, e);
55
+ C(r, n, ["tokens", "components"], e);
56
+ const o = {};
57
+ if (r.tokens !== void 0) {
58
+ const a = E(r.tokens, `${n}.tokens`, e);
59
+ C(
60
+ a,
61
+ `${n}.tokens`,
62
+ ["color", "typography"],
63
+ e
64
+ );
65
+ const i = {};
66
+ if (a.color !== void 0) {
67
+ const c = E(
68
+ a.color,
69
+ `${n}.tokens.color`,
70
+ e
71
+ ), d = [
72
+ "background",
73
+ "foreground",
74
+ "muted",
75
+ "mutedForeground",
76
+ "border",
77
+ "primary",
78
+ "primaryForeground",
79
+ "positive",
80
+ "negative",
81
+ "warning",
82
+ "info"
83
+ ];
84
+ C(c, `${n}.tokens.color`, d, e);
85
+ const m = {};
86
+ d.forEach((p) => {
87
+ const v = T(
88
+ c[p],
89
+ `${n}.tokens.color.${p}`,
90
+ 120,
91
+ e
92
+ );
93
+ v !== void 0 && (m[p] = v);
94
+ }), i.color = m;
95
+ }
96
+ if (a.typography !== void 0) {
97
+ const c = E(
98
+ a.typography,
99
+ `${n}.tokens.typography`,
100
+ e
101
+ );
102
+ C(
103
+ c,
104
+ `${n}.tokens.typography`,
105
+ ["fontFamily", "monoFontFamily"],
106
+ e
107
+ );
108
+ const d = T(
109
+ c.fontFamily,
110
+ `${n}.tokens.typography.fontFamily`,
111
+ 500,
112
+ e,
113
+ { allowEmpty: !0 }
114
+ ), m = T(
115
+ c.monoFontFamily,
116
+ `${n}.tokens.typography.monoFontFamily`,
117
+ 500,
118
+ e,
119
+ { allowEmpty: !0 }
120
+ );
121
+ i.typography = {
122
+ ...d !== void 0 ? { fontFamily: d } : {},
123
+ ...m !== void 0 ? { monoFontFamily: m } : {}
124
+ };
125
+ }
126
+ o.tokens = i;
127
+ }
128
+ if (r.components !== void 0) {
129
+ const a = E(
130
+ r.components,
131
+ `${n}.components`,
132
+ e
133
+ );
134
+ if (C(a, `${n}.components`, ["chart"], e), a.chart !== void 0) {
135
+ const i = E(
136
+ a.chart,
137
+ `${n}.components.chart`,
138
+ e
139
+ );
140
+ C(i, `${n}.components.chart`, ["palette"], e);
141
+ let c;
142
+ i.palette !== void 0 && (Array.isArray(i.palette) ? i.palette.length > 20 ? e.push({
143
+ field: `${n}.components.chart.palette`,
144
+ message: "Expected 20 colors or fewer."
145
+ }) : c = i.palette.map(
146
+ (d, m) => T(
147
+ d,
148
+ `${n}.components.chart.palette.${m}`,
149
+ 120,
150
+ e
151
+ )
152
+ ).filter((d) => d !== void 0) : e.push({
153
+ field: `${n}.components.chart.palette`,
154
+ message: "Expected an array."
155
+ })), o.components = {
156
+ chart: c ? { palette: c } : {}
157
+ };
158
+ }
159
+ }
160
+ return o;
161
+ }
162
+ function ue(t, n) {
163
+ const e = "presentation.appearance", r = E(t, e, n);
164
+ C(r, e, ["version", "schemes"], n);
165
+ const o = {};
166
+ if (r.version !== void 0 && (typeof r.version != "number" || !Number.isFinite(r.version) ? n.push({ field: `${e}.version`, message: "Expected a number." }) : o.version = r.version), r.schemes !== void 0) {
167
+ const a = E(r.schemes, `${e}.schemes`, n);
168
+ C(a, `${e}.schemes`, ["light", "dark"], n), o.schemes = {
169
+ ...a.light !== void 0 ? {
170
+ light: G(
171
+ a.light,
172
+ `${e}.schemes.light`,
173
+ n
174
+ )
175
+ } : {},
176
+ ...a.dark !== void 0 ? {
177
+ dark: G(
178
+ a.dark,
179
+ `${e}.schemes.dark`,
180
+ n
181
+ )
182
+ } : {}
183
+ };
184
+ }
185
+ return o;
186
+ }
187
+ function he(t, n) {
188
+ const e = "presentation.brandOverrides", r = E(t, e, n);
189
+ C(r, e, ["brandName", "logoUrl", "link"], n);
190
+ const o = T(
191
+ r.brandName,
192
+ `${e}.brandName`,
193
+ 200,
194
+ n
195
+ ), a = L(r.logoUrl, `${e}.logoUrl`, n), i = T(r.link, `${e}.link`, 120, n);
196
+ return {
197
+ ...o !== void 0 ? { brandName: o } : {},
198
+ ...a !== void 0 ? { logoUrl: a } : {},
199
+ ...i !== void 0 ? { link: i } : {}
200
+ };
201
+ }
202
+ function ye(t, n) {
203
+ const e = "presentation.fragments", r = E(t, e, n), o = [
204
+ "preHeaderText",
205
+ "headerBannerHtml",
206
+ "signatureHtml",
207
+ "footerHtml",
208
+ "disclaimerHtml",
209
+ "unsubscribeUrl"
210
+ ];
211
+ C(r, e, o, n);
212
+ const a = {};
213
+ return o.forEach((i) => {
214
+ const c = i === "unsubscribeUrl" ? L(r[i], `${e}.${i}`, n) : T(
215
+ r[i],
216
+ `${e}.${i}`,
217
+ i === "preHeaderText" ? 200 : 5e3,
218
+ n,
219
+ { trim: i === "preHeaderText" }
220
+ );
221
+ c !== void 0 && (a[i] = c);
222
+ }), a;
223
+ }
224
+ function ge(t) {
225
+ const n = [], e = {};
226
+ if (t.appearance !== void 0 && (e.appearance = ue(t.appearance, n)), t.brandOverrides !== void 0 && (e.brandOverrides = he(t.brandOverrides, n)), t.fragments !== void 0 && (e.fragments = ye(t.fragments, n)), t.viewUrl !== void 0) {
227
+ const r = L(t.viewUrl, "presentation.viewUrl", n);
228
+ r !== void 0 && (e.viewUrl = r);
229
+ }
230
+ return { value: e, issues: n };
231
+ }
232
+ const Z = [
6
233
  "SUN",
7
234
  "MON",
8
235
  "TUE",
@@ -10,15 +237,15 @@ const P = [
10
237
  "THU",
11
238
  "FRI",
12
239
  "SAT"
13
- ], ne = new Map(
14
- P.map((t, n) => [t, n])
15
- ), Xe = {
240
+ ], ve = new Map(
241
+ Z.map((t, n) => [t, n])
242
+ ), bt = {
16
243
  cadence: "weekly",
17
244
  hour: 9,
18
245
  minute: 0,
19
246
  weekdays: [1]
20
247
  };
21
- function Qe(t) {
248
+ function $t(t) {
22
249
  if (typeof t != "string" || t.length === 0 || t !== t.trim() || /^(?:(?:UTC|GMT)[+-]|[+-]\d{2}:\d{2}$)/.test(t))
23
250
  return !1;
24
251
  try {
@@ -27,27 +254,27 @@ function Qe(t) {
27
254
  return !1;
28
255
  }
29
256
  }
30
- function re(t) {
257
+ function be(t) {
31
258
  return Number.isInteger(t.minute) && t.minute >= 0 && t.minute <= 59 && Number.isInteger(t.hour) && t.hour >= 0 && t.hour <= 23;
32
259
  }
33
- function U(t) {
260
+ function Y(t) {
34
261
  if (t.length === 0) return null;
35
262
  const n = [...t].sort((e, r) => e - r);
36
263
  return n.some(
37
264
  (e, r) => !Number.isInteger(e) || e < 0 || e > 6 || r > 0 && e === n[r - 1]
38
265
  ) ? null : n;
39
266
  }
40
- function et(t) {
41
- if (!re(t))
267
+ function It(t) {
268
+ if (!be(t))
42
269
  throw new Error("Choose a valid schedule time.");
43
270
  const n = `${t.minute} ${t.hour}`;
44
271
  switch (t.cadence) {
45
272
  case "daily":
46
273
  return `${n} * * *`;
47
274
  case "weekly": {
48
- const e = U(t.weekdays);
275
+ const e = Y(t.weekdays);
49
276
  if (!e) throw new Error("Choose at least one weekday.");
50
- return `${n} * * ${e.map((r) => P[r]).join(",")}`;
277
+ return `${n} * * ${e.map((r) => Z[r]).join(",")}`;
51
278
  }
52
279
  case "twice_monthly":
53
280
  return `${n} 1,15 * *`;
@@ -55,7 +282,7 @@ function et(t) {
55
282
  return `${n} 1 * *`;
56
283
  }
57
284
  }
58
- function oe(t) {
285
+ function $e(t) {
59
286
  if (typeof t != "string" || t.length === 0)
60
287
  return { ok: !1, issue: "Choose a supported schedule." };
61
288
  if (t !== t.trim() || t.includes(" "))
@@ -63,43 +290,43 @@ function oe(t) {
63
290
  const n = t.split(" ");
64
291
  if (n.length !== 5)
65
292
  return { ok: !1, issue: "Choose a supported schedule." };
66
- const [e, r, o, i, a] = n;
293
+ const [e, r, o, a, i] = n;
67
294
  if (!/^(0|[1-9]\d?)$/.test(e) || !/^(0|[1-9]\d?)$/.test(r))
68
295
  return { ok: !1, issue: "Choose a supported schedule." };
69
- const l = Number(e), f = Number(r);
70
- if (l > 59 || f > 23 || i !== "*")
296
+ const c = Number(e), d = Number(r);
297
+ if (c > 59 || d > 23 || a !== "*")
71
298
  return { ok: !1, issue: "Choose a supported schedule." };
72
- if (o === "*" && a === "*")
299
+ if (o === "*" && i === "*")
73
300
  return {
74
301
  ok: !0,
75
- value: { cadence: "daily", hour: f, minute: l, weekdays: [] }
302
+ value: { cadence: "daily", hour: d, minute: c, weekdays: [] }
76
303
  };
77
- if (o === "*" && a !== "*") {
78
- const m = a.split(",").map((p) => ne.get(p));
79
- if (m.some((p) => p === void 0))
304
+ if (o === "*" && i !== "*") {
305
+ const p = i.split(",").map((y) => ve.get(y));
306
+ if (p.some((y) => y === void 0))
80
307
  return { ok: !1, issue: "Choose a supported schedule." };
81
- const I = m, v = U(I);
82
- return !v || v.some((p, C) => p !== I[C]) ? { ok: !1, issue: "Choose a supported schedule." } : {
308
+ const v = p, b = Y(v);
309
+ return !b || b.some((y, S) => y !== v[S]) ? { ok: !1, issue: "Choose a supported schedule." } : {
83
310
  ok: !0,
84
- value: { cadence: "weekly", hour: f, minute: l, weekdays: v }
311
+ value: { cadence: "weekly", hour: d, minute: c, weekdays: b }
85
312
  };
86
313
  }
87
- return o === "1,15" && a === "*" ? {
314
+ return o === "1,15" && i === "*" ? {
88
315
  ok: !0,
89
- value: { cadence: "twice_monthly", hour: f, minute: l, weekdays: [] }
90
- } : o === "1" && a === "*" ? {
316
+ value: { cadence: "twice_monthly", hour: d, minute: c, weekdays: [] }
317
+ } : o === "1" && i === "*" ? {
91
318
  ok: !0,
92
- value: { cadence: "monthly", hour: f, minute: l, weekdays: [] }
319
+ value: { cadence: "monthly", hour: d, minute: c, weekdays: [] }
93
320
  } : { ok: !1, issue: "Choose a supported schedule." };
94
321
  }
95
- function ie(t, n, e) {
322
+ function Ie(t, n, e) {
96
323
  return new Intl.DateTimeFormat(e, {
97
324
  hour: "numeric",
98
325
  minute: "2-digit",
99
326
  timeZone: "UTC"
100
327
  }).format(new Date(Date.UTC(2020, 0, 1, t, n)));
101
328
  }
102
- function ae(t, n) {
329
+ function Ee(t, n) {
103
330
  var e;
104
331
  if (t === "UTC") return "UTC";
105
332
  try {
@@ -111,39 +338,39 @@ function ae(t, n) {
111
338
  return null;
112
339
  }
113
340
  }
114
- function tt(t, n, e = "en-US") {
115
- const r = oe(t);
341
+ function Et(t, n, e = "en-US") {
342
+ const r = $e(t);
116
343
  if (!r.ok) return null;
117
344
  try {
118
- const o = ie(r.value.hour, r.value.minute, e), i = ae(n, e);
119
- if (!i) return null;
345
+ const o = Ie(r.value.hour, r.value.minute, e), a = Ee(n, e);
346
+ if (!a) return null;
120
347
  switch (r.value.cadence) {
121
348
  case "daily":
122
- return `Daily at ${o} ${i}`;
349
+ return `Daily at ${o} ${a}`;
123
350
  case "weekly": {
124
- const a = new Intl.DateTimeFormat(e, {
351
+ const i = new Intl.DateTimeFormat(e, {
125
352
  weekday: "long",
126
353
  timeZone: "UTC"
127
354
  });
128
355
  return `${r.value.weekdays.map(
129
- (f) => a.format(new Date(Date.UTC(2023, 0, 1 + f)))
130
- ).join(" and ")} at ${o} ${i}`;
356
+ (d) => i.format(new Date(Date.UTC(2023, 0, 1 + d)))
357
+ ).join(" and ")} at ${o} ${a}`;
131
358
  }
132
359
  case "twice_monthly":
133
- return `On the 1st and 15th at ${o} ${i}`;
360
+ return `On the 1st and 15th at ${o} ${a}`;
134
361
  case "monthly":
135
- return `Monthly on the 1st at ${o} ${i}`;
362
+ return `Monthly on the 1st at ${o} ${a}`;
136
363
  }
137
364
  } catch {
138
365
  return null;
139
366
  }
140
367
  }
141
- const ce = /* @__PURE__ */ new Set([
368
+ const Ce = /* @__PURE__ */ new Set([
142
369
  "table",
143
370
  "aggregateTable",
144
371
  "pivotTable",
145
372
  "detailTable"
146
- ]), le = /* @__PURE__ */ new Set([
373
+ ]), ke = /* @__PURE__ */ new Set([
147
374
  "bar",
148
375
  "horizontalBar",
149
376
  "line",
@@ -174,51 +401,51 @@ const ce = /* @__PURE__ */ new Set([
174
401
  "treemap",
175
402
  "custom"
176
403
  ]);
177
- function nt(t) {
178
- var r, o, i;
179
- const n = le.has(t.type) && (t.type !== "custom" || !!((r = t.customCardPreferences) != null && r.url));
180
- return t.type === "text" || !n || te(t) ? { formats: [], defaultFormat: null } : {
181
- formats: de({
404
+ function Ct(t) {
405
+ var r, o, a;
406
+ const n = ke.has(t.type) && (t.type !== "custom" || !!((r = t.customCardPreferences) != null && r.url));
407
+ return t.type === "text" || !n || fe(t) ? { formats: [], defaultFormat: null } : {
408
+ formats: Te({
182
409
  cardType: t.type,
183
410
  allowDownload: (o = t.preferences) == null ? void 0 : o.allowDownload
184
411
  }),
185
- defaultFormat: se({
412
+ defaultFormat: xe({
186
413
  cardType: t.type,
187
- allowDownload: (i = t.preferences) == null ? void 0 : i.allowDownload
414
+ allowDownload: (a = t.preferences) == null ? void 0 : a.allowDownload
188
415
  })
189
416
  };
190
417
  }
191
- function de(t) {
418
+ function Te(t) {
192
419
  return t.allowDownload === !1 ? ["pdf"] : ["pdf", "csv"];
193
420
  }
194
- function se(t) {
195
- return ce.has(t.cardType) && t.allowDownload !== !1 ? "csv" : "pdf";
421
+ function xe(t) {
422
+ return Ce.has(t.cardType) && t.allowDownload !== !1 ? "csv" : "pdf";
196
423
  }
197
- function rt(t) {
424
+ function kt(t) {
198
425
  return t != null && t.role ? t.type === "tenant" ? t.role === "POWER_USER" : ["AUTHOR", "ADMIN", "SUPER_ADMIN"].includes(t.role) : !1;
199
426
  }
200
- function ot(t) {
427
+ function Tt(t) {
201
428
  return t.canCreate ? [
202
429
  ...t.scheduledReportAvailable ? ["scheduled_report"] : [],
203
430
  ...t.analyticalBriefingsEnabled ? ["analytical_briefing"] : []
204
431
  ] : [];
205
432
  }
206
- function fe(t) {
433
+ function Ae(t) {
207
434
  const n = (t == null ? void 0 : t.channels) ?? [];
208
435
  return n.length === 1 && n[0] === "EMAIL";
209
436
  }
210
- function ue(t) {
211
- return t.body.type === "generated_analysis" ? "Analytical briefing" : t.body.type === "custom_message" && t.attachments.length > 0 && fe(t.deliveryConfig) ? t.scheduleExpr ? "Scheduled report" : "On-demand report" : "Plain briefing";
437
+ function Se(t) {
438
+ return t.body.type === "generated_analysis" ? "Analytical briefing" : t.body.type === "custom_message" && t.attachments.length > 0 && Ae(t.deliveryConfig) ? t.scheduleExpr ? "Scheduled report" : "On-demand report" : "Plain briefing";
212
439
  }
213
- function it(t) {
214
- const n = ue(t), e = n === "Scheduled report" || n === "On-demand report" ? "report" : "briefing";
440
+ function xt(t) {
441
+ const n = Se(t), e = n === "Scheduled report" || n === "On-demand report" ? "report" : "briefing";
215
442
  return {
216
443
  typeLabel: n,
217
444
  noun: e,
218
445
  pluralNoun: e === "report" ? "reports" : "briefings"
219
446
  };
220
447
  }
221
- const L = "BRIEFING", me = ["markdown", "html"], N = ["markdown"], w = 20, d = {
448
+ const O = "BRIEFING", we = ["markdown", "html"], R = ["markdown"], _ = 20, s = {
222
449
  name: 500,
223
450
  description: 2e3,
224
451
  instruction: 5e4,
@@ -234,61 +461,83 @@ const L = "BRIEFING", me = ["markdown", "html"], N = ["markdown"], w = 20, d = {
234
461
  presentationTone: 500,
235
462
  presentationFormat: 2e3,
236
463
  id: 500
237
- }, b = {
464
+ }, $ = {
238
465
  maxBlocks: 50,
239
466
  maxTableRows: 100,
240
467
  maxTableColumns: 20,
241
- maxTableCellCharacters: d.contentCell,
242
- maxParagraphCharacters: d.contentText,
243
- maxFindingCharacters: d.contentText,
468
+ maxTableCellCharacters: s.contentCell,
469
+ maxParagraphCharacters: s.contentText,
470
+ maxFindingCharacters: s.contentText,
244
471
  maxListItems: 100,
245
472
  // A kpi_grid is rendered as a 2-up tile arrangement in emails. Cap at 8 so
246
473
  // the visual stays at most 4 rows (4 columns wide on desktop would force
247
474
  // tiny tiles in narrow client panels; 2-up was the chosen layout).
248
475
  maxKpiTiles: 8
249
- }, j = new Set(me), pe = /* @__PURE__ */ new Set([
476
+ };
477
+ function De(t) {
478
+ if (t === null || typeof t != "object" || Array.isArray(t))
479
+ return !1;
480
+ const n = t;
481
+ if (typeof n.value != "number" || !Number.isFinite(n.value))
482
+ return !1;
483
+ const e = n.target;
484
+ if (e === null || typeof e != "object" || Array.isArray(e))
485
+ return !1;
486
+ const r = e;
487
+ return (r.kind === "metric" && typeof r.metricId == "string" && !!r.metricId.trim() || r.kind === "column" && typeof r.columnKey == "string" && !!r.columnKey.trim() || r.kind === "matrix_measure" && typeof r.measureId == "string" && !!r.measureId.trim()) && W(n.format).ok;
488
+ }
489
+ function _e(t) {
490
+ return t == null ? "" : De(t) ? me(t.value, t.format) : String(t);
491
+ }
492
+ function At(t) {
493
+ return [t.delta, t.percentChange].filter(
494
+ (n) => n != null
495
+ ).map(_e).filter(Boolean).join(" / ");
496
+ }
497
+ const J = new Set(we), Be = /* @__PURE__ */ new Set([
250
498
  "EMAIL",
251
499
  "WEBHOOK",
252
500
  "SLACK",
253
501
  "IN_APP",
254
502
  "TELEGRAM"
255
- ]), D = {
503
+ ]), B = {
256
504
  maxToolCalls: { min: 1, max: 100 },
505
+ maxPlanningIterations: { min: 1, max: 10 },
257
506
  maxRows: { min: 1, max: 1e5 },
258
507
  timeoutMs: { min: 1e3, max: 30 * 6e4 }
259
- }, he = /* @__PURE__ */ new Set([
508
+ }, Fe = /* @__PURE__ */ new Set([
260
509
  "letter",
261
510
  "legal",
262
511
  "a4",
263
512
  "a3",
264
513
  "tabloid"
265
- ]), ye = /* @__PURE__ */ new Set([
514
+ ]), Ne = /* @__PURE__ */ new Set([
266
515
  "portrait",
267
516
  "landscape"
268
- ]), ge = /* @__PURE__ */ new Set([",", ";", " "]), ve = /* @__PURE__ */ new Set([
517
+ ]), Oe = /* @__PURE__ */ new Set([",", ";", " "]), Re = /* @__PURE__ */ new Set([
269
518
  "current",
270
519
  "all"
271
- ]), be = /* @__PURE__ */ new Set([
520
+ ]), Le = /* @__PURE__ */ new Set([
272
521
  "concise",
273
522
  "balanced",
274
523
  "detailed"
275
- ]), Ie = /* @__PURE__ */ new Set([
524
+ ]), ze = /* @__PURE__ */ new Set([
276
525
  "info",
277
526
  "positive",
278
527
  "warning",
279
528
  "critical"
280
- ]), $e = /* @__PURE__ */ new Set([
529
+ ]), Ve = /* @__PURE__ */ new Set([
281
530
  "text",
282
531
  "number",
283
532
  "currency",
284
533
  "percent",
285
534
  "date",
286
535
  "boolean"
287
- ]), Ee = /* @__PURE__ */ new Set([
536
+ ]), Ue = /* @__PURE__ */ new Set([
288
537
  "left",
289
538
  "center",
290
539
  "right"
291
- ]), Te = [
540
+ ]), Pe = [
292
541
  "pageSize",
293
542
  "orientation",
294
543
  "includeFilters",
@@ -314,142 +563,142 @@ const L = "BRIEFING", me = ["markdown", "html"], N = ["markdown"], w = 20, d = {
314
563
  "allowDownload",
315
564
  "theme"
316
565
  ];
317
- class A extends Error {
566
+ class D extends Error {
318
567
  constructor(e) {
319
568
  super(e.map((r) => `${r.field}: ${r.message}`).join("; "));
320
- M(this, "issues");
569
+ H(this, "issues");
321
570
  this.name = "BriefingContractError", this.issues = e;
322
571
  }
323
572
  }
324
- function q(t) {
573
+ function X(t) {
325
574
  return typeof t == "object" && t !== null && !Array.isArray(t);
326
575
  }
327
- function c(t, n, e) {
576
+ function l(t, n, e) {
328
577
  t.push({ field: n, message: e });
329
578
  }
330
579
  function g(t, n, e) {
331
- return q(t) ? t : (c(e, n, "Expected an object."), {});
580
+ return X(t) ? t : (l(e, n, "Expected an object."), {});
332
581
  }
333
- function u(t, n, e, r) {
582
+ function f(t, n, e, r) {
334
583
  const o = new Set(e);
335
- Object.keys(t).forEach((i) => {
336
- o.has(i) || c(
584
+ Object.keys(t).forEach((a) => {
585
+ o.has(a) || l(
337
586
  r,
338
- n ? `${n}.${i}` : i,
339
- `Unexpected field "${i}".`
587
+ n ? `${n}.${a}` : a,
588
+ `Unexpected field "${a}".`
340
589
  );
341
590
  });
342
591
  }
343
- function y(t, n, e, r) {
592
+ function u(t, n, e, r) {
344
593
  if (typeof t != "string")
345
- return c(r, n, "Expected a string."), "";
594
+ return l(r, n, "Expected a string."), "";
346
595
  const o = t.trim();
347
- return o ? (o.length > e && c(r, n, `Must be ${e} characters or fewer.`), o) : (c(r, n, "Required value cannot be empty."), "");
596
+ return o ? (o.length > e && l(r, n, `Must be ${e} characters or fewer.`), o) : (l(r, n, "Required value cannot be empty."), "");
348
597
  }
349
598
  function h(t, n, e, r) {
350
599
  if (t == null)
351
600
  return;
352
601
  if (typeof t != "string") {
353
- c(r, n, "Expected a string.");
602
+ l(r, n, "Expected a string.");
354
603
  return;
355
604
  }
356
605
  const o = t.trim();
357
606
  if (o)
358
- return o.length > e && c(r, n, `Must be ${e} characters or fewer.`), o;
607
+ return o.length > e && l(r, n, `Must be ${e} characters or fewer.`), o;
359
608
  }
360
- function Ce(t, n, e, r) {
609
+ function je(t, n, e, r) {
361
610
  if (typeof t != "string")
362
- return c(r, n, "Expected a string."), "";
611
+ return l(r, n, "Expected a string."), "";
363
612
  const o = t.trim();
364
- return o.length > e && c(r, n, `Must be ${e} characters or fewer.`), o;
613
+ return o.length > e && l(r, n, `Must be ${e} characters or fewer.`), o;
365
614
  }
366
- function ke(t, n, e) {
615
+ function Me(t, n, e) {
367
616
  if (t != null) {
368
617
  if (!Number.isInteger(t) || Number(t) < 0) {
369
- c(e, n, "Expected a non-negative integer.");
618
+ l(e, n, "Expected a non-negative integer.");
370
619
  return;
371
620
  }
372
621
  return Number(t);
373
622
  }
374
623
  }
375
- function $(t, n, e, r = {}) {
624
+ function I(t, n, e, r = {}) {
376
625
  if (t == null)
377
- return r.required ? (c(e, n, "Expected at least one evidence id."), []) : void 0;
626
+ return r.required ? (l(e, n, "Expected at least one evidence id."), []) : void 0;
378
627
  if (!Array.isArray(t))
379
- return c(e, n, "Expected an array."), r.required ? [] : void 0;
628
+ return l(e, n, "Expected an array."), r.required ? [] : void 0;
380
629
  const o = [];
381
- return t.forEach((i, a) => {
382
- const l = y(
383
- i,
384
- `${n}.${a}`,
385
- d.id,
630
+ return t.forEach((a, i) => {
631
+ const c = u(
632
+ a,
633
+ `${n}.${i}`,
634
+ s.id,
386
635
  e
387
636
  );
388
- l && !o.includes(l) && o.push(l);
389
- }), r.required && o.length === 0 && c(e, n, "Expected at least one evidence id."), o.length > 0 || r.required ? o : void 0;
637
+ c && !o.includes(c) && o.push(c);
638
+ }), r.required && o.length === 0 && l(e, n, "Expected at least one evidence id."), o.length > 0 || r.required ? o : void 0;
390
639
  }
391
- function T(t, n, e, r) {
392
- return t == null ? n : typeof t != "boolean" ? (c(r, e, "Expected a boolean."), n) : t;
640
+ function A(t, n, e, r) {
641
+ return t == null ? n : typeof t != "boolean" ? (l(r, e, "Expected a boolean."), n) : t;
393
642
  }
394
- function Ae(t, n) {
395
- return t == null ? "ACTIVE" : t === "ACTIVE" || t === "PAUSED" || t === "DISABLED" ? t : (c(n, "status", "Expected ACTIVE, PAUSED, or DISABLED."), "ACTIVE");
643
+ function Ke(t, n) {
644
+ return t == null ? "ACTIVE" : t === "ACTIVE" || t === "PAUSED" || t === "DISABLED" ? t : (l(n, "status", "Expected ACTIVE, PAUSED, or DISABLED."), "ACTIVE");
396
645
  }
397
- function xe(t) {
646
+ function qe(t) {
398
647
  return t.includes("@") && t.includes(".") && !t.includes(" ");
399
648
  }
400
- function K(t, n) {
649
+ function Q(t, n) {
401
650
  if (t == null)
402
651
  return { type: "project" };
403
652
  const e = g(t, "source", n), r = e.type;
404
- return r === "project" ? (u(e, "source", ["type"], n), { type: "project" }) : r === "dashboard" ? (u(e, "source", ["type", "dashboardId"], n), {
653
+ return r === "project" ? (f(e, "source", ["type"], n), { type: "project" }) : r === "dashboard" ? (f(e, "source", ["type", "dashboardId"], n), {
405
654
  type: "dashboard",
406
- dashboardId: y(
655
+ dashboardId: u(
407
656
  e.dashboardId,
408
657
  "source.dashboardId",
409
- d.id,
658
+ s.id,
410
659
  n
411
660
  )
412
- }) : (c(n, "source.type", "Expected project or dashboard."), { type: "project" });
661
+ }) : (l(n, "source.type", "Expected project or dashboard."), { type: "project" });
413
662
  }
414
- function G(t, n) {
663
+ function ee(t, n) {
415
664
  const e = g(t, "body", n), r = e.type;
416
- return r === "generated_analysis" ? (u(e, "body", ["type", "instruction"], n), {
665
+ return r === "generated_analysis" ? (f(e, "body", ["type", "instruction"], n), {
417
666
  type: "generated_analysis",
418
- instruction: y(
667
+ instruction: u(
419
668
  e.instruction,
420
669
  "body.instruction",
421
- d.instruction,
670
+ s.instruction,
422
671
  n
423
672
  )
424
- }) : r === "custom_message" ? (u(e, "body", ["type", "message"], n), {
673
+ }) : r === "custom_message" ? (f(e, "body", ["type", "message"], n), {
425
674
  type: "custom_message",
426
- message: Ce(
675
+ message: je(
427
676
  e.message,
428
677
  "body.message",
429
- d.customMessage,
678
+ s.customMessage,
430
679
  n
431
680
  )
432
- }) : r === "none" ? (u(e, "body", ["type"], n), { type: "none" }) : (c(
681
+ }) : r === "none" ? (f(e, "body", ["type"], n), { type: "none" }) : (l(
433
682
  n,
434
683
  "body.type",
435
684
  "Expected generated_analysis, custom_message, or none."
436
685
  ), { type: "none" });
437
686
  }
438
- function Se(t, n) {
687
+ function He(t, n) {
439
688
  if (t == null)
440
- return [...N];
689
+ return [...R];
441
690
  if (!Array.isArray(t))
442
- return c(n, "presentation.artifactFormats", "Expected an array."), [...N];
691
+ return l(n, "presentation.artifactFormats", "Expected an array."), [...R];
443
692
  if (t.length === 0)
444
- return c(
693
+ return l(
445
694
  n,
446
695
  "presentation.artifactFormats",
447
696
  "Choose at least one artifact format."
448
697
  ), [];
449
698
  const e = [];
450
699
  return t.forEach((r, o) => {
451
- if (typeof r != "string" || !j.has(r)) {
452
- c(
700
+ if (typeof r != "string" || !J.has(r)) {
701
+ l(
453
702
  n,
454
703
  `presentation.artifactFormats.${o}`,
455
704
  "Expected markdown or html."
@@ -459,29 +708,40 @@ function Se(t, n) {
459
708
  e.includes(r) || e.push(r);
460
709
  }), e;
461
710
  }
462
- function H(t, n) {
711
+ function te(t, n) {
463
712
  if (t == null)
464
713
  return {
465
- artifactFormats: [...N],
714
+ artifactFormats: [...R],
466
715
  includeEvidence: !0,
467
716
  includeSql: !0
468
717
  };
469
718
  const e = g(t, "presentation", n);
470
- u(
719
+ f(
471
720
  e,
472
721
  "presentation",
473
- ["artifactFormats", "includeEvidence", "includeSql", "audience", "tone", "format"],
722
+ [
723
+ "artifactFormats",
724
+ "includeEvidence",
725
+ "includeSql",
726
+ "audience",
727
+ "tone",
728
+ "format",
729
+ "appearance",
730
+ "brandOverrides",
731
+ "fragments",
732
+ "viewUrl"
733
+ ],
474
734
  n
475
735
  );
476
736
  const r = {
477
- artifactFormats: Se(e.artifactFormats, n),
478
- includeEvidence: T(
737
+ artifactFormats: He(e.artifactFormats, n),
738
+ includeEvidence: A(
479
739
  e.includeEvidence,
480
740
  !0,
481
741
  "presentation.includeEvidence",
482
742
  n
483
743
  ),
484
- includeSql: T(
744
+ includeSql: A(
485
745
  e.includeSql,
486
746
  !0,
487
747
  "presentation.includeSql",
@@ -490,383 +750,512 @@ function H(t, n) {
490
750
  }, o = h(
491
751
  e.audience,
492
752
  "presentation.audience",
493
- d.presentationAudience,
753
+ s.presentationAudience,
494
754
  n
495
- ), i = h(
755
+ ), a = h(
496
756
  e.tone,
497
757
  "presentation.tone",
498
- d.presentationTone,
758
+ s.presentationTone,
499
759
  n
500
- ), a = h(
760
+ ), i = h(
501
761
  e.format,
502
762
  "presentation.format",
503
- d.presentationFormat,
763
+ s.presentationFormat,
504
764
  n
505
765
  );
506
- return o && (r.audience = o), i && (r.tone = i), a && (r.format = a), r;
766
+ o && (r.audience = o), a && (r.tone = a), i && (r.format = i);
767
+ const c = ge(e);
768
+ return c.issues.forEach((d) => l(n, d.field, d.message)), Object.assign(r, c.value), r;
507
769
  }
508
- function we(t, n, e) {
509
- return Array.isArray(t) ? (t.length === 0 && c(e, n, "Expected at least one item."), t.length > b.maxListItems && c(
770
+ function Ge(t, n, e) {
771
+ return Array.isArray(t) ? (t.length === 0 && l(e, n, "Expected at least one item."), t.length > $.maxListItems && l(
510
772
  e,
511
773
  n,
512
- `Must have ${b.maxListItems} items or fewer.`
513
- ), t.slice(0, b.maxListItems).map(
514
- (r, o) => y(
774
+ `Must have ${$.maxListItems} items or fewer.`
775
+ ), t.slice(0, $.maxListItems).map(
776
+ (r, o) => u(
515
777
  r,
516
778
  `${n}.${o}`,
517
- d.contentItem,
779
+ s.contentItem,
518
780
  e
519
781
  )
520
- ).filter(Boolean)) : (c(e, n, "Expected an array."), []);
782
+ ).filter(Boolean)) : (l(e, n, "Expected an array."), []);
783
+ }
784
+ function We(t, n, e) {
785
+ const r = g(t, n, e);
786
+ if (r.kind === "metric")
787
+ return f(r, n, ["kind", "metricId"], e), {
788
+ kind: "metric",
789
+ metricId: u(
790
+ r.metricId,
791
+ `${n}.metricId`,
792
+ s.id,
793
+ e
794
+ )
795
+ };
796
+ if (r.kind === "column")
797
+ return f(r, n, ["kind", "columnKey"], e), {
798
+ kind: "column",
799
+ columnKey: u(
800
+ r.columnKey,
801
+ `${n}.columnKey`,
802
+ s.id,
803
+ e
804
+ )
805
+ };
806
+ if (r.kind === "matrix_measure")
807
+ return f(r, n, ["kind", "measureId"], e), {
808
+ kind: "matrix_measure",
809
+ measureId: u(
810
+ r.measureId,
811
+ `${n}.measureId`,
812
+ s.id,
813
+ e
814
+ )
815
+ };
816
+ l(
817
+ e,
818
+ `${n}.kind`,
819
+ "Expected metric, column, or matrix_measure."
820
+ );
821
+ }
822
+ function ne(t, n, e) {
823
+ if (t === null || typeof t != "object" || Array.isArray(t))
824
+ return;
825
+ const r = g(t, n, e);
826
+ if (!Object.prototype.hasOwnProperty.call(r, "target") && !Object.prototype.hasOwnProperty.call(r, "format"))
827
+ return;
828
+ f(r, n, ["value", "target", "format"], e), (typeof r.value != "number" || !Number.isFinite(r.value)) && l(e, `${n}.value`, "Expected a finite number.");
829
+ const o = We(
830
+ r.target,
831
+ `${n}.target`,
832
+ e
833
+ ), a = W(r.format);
834
+ if (a.ok || a.issues.forEach(
835
+ (i) => l(
836
+ e,
837
+ i.path === "$" ? `${n}.format` : `${n}.format.${i.path}`,
838
+ i.message
839
+ )
840
+ ), !(typeof r.value != "number" || !Number.isFinite(r.value) || !o || !a.ok))
841
+ return { value: r.value, target: o, format: a.value };
842
+ }
843
+ function k(t, n, e) {
844
+ if (typeof t == "string")
845
+ return t;
846
+ if (typeof t == "number") {
847
+ if (!Number.isFinite(t)) {
848
+ l(e, n, "Expected a finite number.");
849
+ return;
850
+ }
851
+ return t;
852
+ }
853
+ const r = ne(t, n, e);
854
+ if (r) return r;
855
+ l(
856
+ e,
857
+ n,
858
+ "Expected a string, number, or structured numeric value."
859
+ );
521
860
  }
522
- function De(t, n, e) {
523
- return t === null || typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? typeof t == "string" && t.length > d.contentCell ? (c(
861
+ function Ze(t, n, e) {
862
+ if (t === null || typeof t == "string" || typeof t == "number" || typeof t == "boolean")
863
+ return typeof t == "string" && t.length > s.contentCell ? (l(
864
+ e,
865
+ n,
866
+ `Must be ${s.contentCell} characters or fewer.`
867
+ ), t.slice(0, s.contentCell)) : typeof t == "number" && !Number.isFinite(t) ? (l(e, n, "Expected a finite number."), null) : t;
868
+ const r = ne(t, n, e);
869
+ return r || (l(
524
870
  e,
525
871
  n,
526
- `Must be ${d.contentCell} characters or fewer.`
527
- ), t.slice(0, d.contentCell)) : typeof t == "number" && !Number.isFinite(t) ? (c(e, n, "Expected a finite number."), null) : t : (c(e, n, "Expected a string, number, boolean, or null."), null);
872
+ "Expected a string, number, boolean, structured numeric value, or null."
873
+ ), null);
528
874
  }
529
- function _e(t, n, e) {
875
+ function Ye(t, n, e) {
530
876
  if (!Array.isArray(t))
531
- return c(e, n, "Expected an array."), [];
532
- t.length === 0 && c(e, n, "Expected at least one column."), t.length > b.maxTableColumns && c(
877
+ return l(e, n, "Expected an array."), [];
878
+ t.length === 0 && l(e, n, "Expected at least one column."), t.length > $.maxTableColumns && l(
533
879
  e,
534
880
  n,
535
- `Must have ${b.maxTableColumns} columns or fewer.`
881
+ `Must have ${$.maxTableColumns} columns or fewer.`
536
882
  );
537
883
  const r = /* @__PURE__ */ new Set();
538
- return t.slice(0, b.maxTableColumns).map((o, i) => {
539
- const a = `${n}.${i}`, l = g(o, a, e);
540
- u(l, a, ["key", "label", "kind", "align"], e);
541
- const f = y(
542
- l.key,
543
- `${a}.key`,
544
- d.id,
884
+ return t.slice(0, $.maxTableColumns).map((o, a) => {
885
+ const i = `${n}.${a}`, c = g(o, i, e);
886
+ f(c, i, ["key", "label", "kind", "align"], e);
887
+ const d = u(
888
+ c.key,
889
+ `${i}.key`,
890
+ s.id,
545
891
  e
546
892
  );
547
- f && (r.has(f) && c(e, `${a}.key`, "Column key must be unique."), r.add(f));
548
- const s = y(
549
- l.label,
550
- `${a}.label`,
551
- d.contentTitle,
893
+ d && (r.has(d) && l(e, `${i}.key`, "Column key must be unique."), r.add(d));
894
+ const m = u(
895
+ c.label,
896
+ `${i}.label`,
897
+ s.contentTitle,
552
898
  e
553
- ), m = E(
554
- l.kind,
555
- `${a}.kind`,
556
- $e,
899
+ ), p = x(
900
+ c.kind,
901
+ `${i}.kind`,
902
+ Ve,
557
903
  "text, number, currency, percent, date, or boolean",
558
904
  e
559
- ), I = E(
560
- l.align,
561
- `${a}.align`,
562
- Ee,
905
+ ), v = x(
906
+ c.align,
907
+ `${i}.align`,
908
+ Ue,
563
909
  "left, center, or right",
564
910
  e
565
911
  );
566
912
  return {
567
- key: f,
568
- label: s,
569
- ...m ? { kind: m } : {},
570
- ...I ? { align: I } : {}
913
+ key: d,
914
+ label: m,
915
+ ...p ? { kind: p } : {},
916
+ ...v ? { align: v } : {}
571
917
  };
572
918
  });
573
919
  }
574
- function Be(t, n, e, r) {
920
+ function Je(t, n, e, r) {
575
921
  if (!Array.isArray(t))
576
- return c(r, n, "Expected an array."), [];
577
- t.length > b.maxTableRows && c(
922
+ return l(r, n, "Expected an array."), [];
923
+ t.length > $.maxTableRows && l(
578
924
  r,
579
925
  n,
580
- `Must have ${b.maxTableRows} rows or fewer.`
926
+ `Must have ${$.maxTableRows} rows or fewer.`
581
927
  );
582
- const o = new Set(e.map((i) => i.key).filter(Boolean));
583
- return t.slice(0, b.maxTableRows).map((i, a) => {
584
- const l = `${n}.${a}`, f = g(i, l, r);
585
- return Object.keys(f).forEach((s) => {
586
- o.has(s) || c(r, `${l}.${s}`, `Unexpected table cell "${s}".`);
928
+ const o = new Set(e.map((a) => a.key).filter(Boolean));
929
+ return t.slice(0, $.maxTableRows).map((a, i) => {
930
+ const c = `${n}.${i}`, d = g(a, c, r);
931
+ return Object.keys(d).forEach((m) => {
932
+ o.has(m) || l(r, `${c}.${m}`, `Unexpected table cell "${m}".`);
587
933
  }), Object.fromEntries(
588
- e.map((s) => [
589
- s.key,
590
- De(f[s.key] ?? null, `${l}.${s.key}`, r)
934
+ e.map((m) => [
935
+ m.key,
936
+ Ze(d[m.key] ?? null, `${c}.${m.key}`, r)
591
937
  ])
592
938
  );
593
939
  });
594
940
  }
595
- function Le(t, n, e) {
596
- const r = `content.blocks.${n}`, o = g(t, r, e), i = o.type;
597
- if (i === "heading") {
598
- u(o, r, ["type", "text", "level", "evidenceIds"], e);
599
- const a = o.level === void 0 || o.level === null ? void 0 : o.level === 2 || o.level === 3 ? o.level : void 0;
600
- o.level !== void 0 && o.level !== null && a === void 0 && c(e, `${r}.level`, "Expected 2 or 3.");
601
- const l = $(o.evidenceIds, `${r}.evidenceIds`, e);
941
+ function Xe(t, n, e) {
942
+ const r = `content.blocks.${n}`, o = g(t, r, e), a = o.type;
943
+ if (a === "heading") {
944
+ f(o, r, ["type", "text", "level", "evidenceIds"], e);
945
+ const i = o.level === void 0 || o.level === null ? void 0 : o.level === 2 || o.level === 3 ? o.level : void 0;
946
+ o.level !== void 0 && o.level !== null && i === void 0 && l(e, `${r}.level`, "Expected 2 or 3.");
947
+ const c = I(o.evidenceIds, `${r}.evidenceIds`, e);
602
948
  return {
603
949
  type: "heading",
604
- text: y(
950
+ text: u(
605
951
  o.text,
606
952
  `${r}.text`,
607
- d.contentTitle,
953
+ s.contentTitle,
608
954
  e
609
955
  ),
610
- ...a ? { level: a } : {},
611
- ...l ? { evidenceIds: l } : {}
956
+ ...i ? { level: i } : {},
957
+ ...c ? { evidenceIds: c } : {}
612
958
  };
613
959
  }
614
- if (i === "paragraph") {
615
- u(o, r, ["type", "text", "evidenceIds"], e);
616
- const a = $(o.evidenceIds, `${r}.evidenceIds`, e);
960
+ if (a === "paragraph") {
961
+ f(o, r, ["type", "text", "evidenceIds"], e);
962
+ const i = I(o.evidenceIds, `${r}.evidenceIds`, e);
617
963
  return {
618
964
  type: "paragraph",
619
- text: y(
965
+ text: u(
620
966
  o.text,
621
967
  `${r}.text`,
622
- d.contentText,
968
+ s.contentText,
623
969
  e
624
970
  ),
625
- ...a ? { evidenceIds: a } : {}
971
+ ...i ? { evidenceIds: i } : {}
626
972
  };
627
973
  }
628
- if (i === "finding") {
629
- u(o, r, ["type", "title", "text", "severity", "evidenceIds"], e);
630
- const a = h(
974
+ if (a === "finding") {
975
+ f(o, r, ["type", "title", "text", "severity", "evidenceIds"], e);
976
+ const i = h(
631
977
  o.title,
632
978
  `${r}.title`,
633
- d.contentTitle,
979
+ s.contentTitle,
634
980
  e
635
- ), l = E(
981
+ ), c = x(
636
982
  o.severity,
637
983
  `${r}.severity`,
638
- Ie,
984
+ ze,
639
985
  "info, positive, warning, or critical",
640
986
  e
641
987
  );
642
988
  return {
643
989
  type: "finding",
644
- ...a ? { title: a } : {},
645
- text: y(
990
+ ...i ? { title: i } : {},
991
+ text: u(
646
992
  o.text,
647
993
  `${r}.text`,
648
- d.contentText,
994
+ s.contentText,
649
995
  e
650
996
  ),
651
- ...l ? { severity: l } : {},
652
- evidenceIds: $(o.evidenceIds, `${r}.evidenceIds`, e, {
997
+ ...c ? { severity: c } : {},
998
+ evidenceIds: I(o.evidenceIds, `${r}.evidenceIds`, e, {
653
999
  required: !0
654
1000
  }) ?? []
655
1001
  };
656
1002
  }
657
- if (i === "bullets" || i === "actions" || i === "limitations") {
658
- u(o, r, ["type", "title", "items", "evidenceIds"], e);
659
- const a = h(
1003
+ if (a === "bullets" || a === "actions" || a === "limitations") {
1004
+ f(o, r, ["type", "title", "items", "evidenceIds"], e);
1005
+ const i = h(
660
1006
  o.title,
661
1007
  `${r}.title`,
662
- d.contentTitle,
1008
+ s.contentTitle,
663
1009
  e
664
- ), l = $(o.evidenceIds, `${r}.evidenceIds`, e);
1010
+ ), c = I(o.evidenceIds, `${r}.evidenceIds`, e);
665
1011
  return {
666
- type: i,
667
- ...a ? { title: a } : {},
668
- items: we(o.items, `${r}.items`, e),
669
- ...l ? { evidenceIds: l } : {}
1012
+ type: a,
1013
+ ...i ? { title: i } : {},
1014
+ items: Ge(o.items, `${r}.items`, e),
1015
+ ...c ? { evidenceIds: c } : {}
670
1016
  };
671
1017
  }
672
- if (i === "metric") {
673
- u(
1018
+ if (a === "metric") {
1019
+ f(
674
1020
  o,
675
1021
  r,
676
- ["type", "label", "value", "previousValue", "delta", "unit", "evidenceIds"],
1022
+ [
1023
+ "type",
1024
+ "label",
1025
+ "value",
1026
+ "previousValue",
1027
+ "delta",
1028
+ "percentChange",
1029
+ "unit",
1030
+ "evidenceIds"
1031
+ ],
677
1032
  e
678
1033
  );
679
- const a = typeof o.value == "string" || typeof o.value == "number" ? o.value : "";
680
- a === "" && c(e, `${r}.value`, "Expected a string or number.");
681
- const l = o.previousValue === void 0 || o.previousValue === null || typeof o.previousValue == "string" || typeof o.previousValue == "number" ? o.previousValue : void 0;
682
- o.previousValue !== void 0 && o.previousValue !== null && l === void 0 && c(e, `${r}.previousValue`, "Expected a string, number, or null.");
683
- const f = o.delta === void 0 || o.delta === null || typeof o.delta == "string" || typeof o.delta == "number" ? o.delta : void 0;
684
- o.delta !== void 0 && o.delta !== null && f === void 0 && c(e, `${r}.delta`, "Expected a string, number, or null.");
685
- const s = h(
1034
+ const i = k(o.value, `${r}.value`, e) ?? "";
1035
+ i === "" && l(
1036
+ e,
1037
+ `${r}.value`,
1038
+ "Expected a non-empty string, number, or structured numeric value."
1039
+ );
1040
+ const c = o.previousValue === void 0 || o.previousValue === null ? o.previousValue : k(
1041
+ o.previousValue,
1042
+ `${r}.previousValue`,
1043
+ e
1044
+ ), d = o.delta === void 0 || o.delta === null ? o.delta : k(
1045
+ o.delta,
1046
+ `${r}.delta`,
1047
+ e
1048
+ ), m = o.percentChange === void 0 || o.percentChange === null ? o.percentChange : k(
1049
+ o.percentChange,
1050
+ `${r}.percentChange`,
1051
+ e
1052
+ ), p = h(
686
1053
  o.unit,
687
1054
  `${r}.unit`,
688
- d.contentTitle,
1055
+ s.contentTitle,
689
1056
  e
690
- ), m = $(o.evidenceIds, `${r}.evidenceIds`, e);
1057
+ ), v = I(o.evidenceIds, `${r}.evidenceIds`, e);
691
1058
  return {
692
1059
  type: "metric",
693
- label: y(
1060
+ label: u(
694
1061
  o.label,
695
1062
  `${r}.label`,
696
- d.contentTitle,
1063
+ s.contentTitle,
697
1064
  e
698
1065
  ),
699
- value: a,
700
- ...l !== void 0 ? { previousValue: l } : {},
701
- ...f !== void 0 ? { delta: f } : {},
702
- ...s ? { unit: s } : {},
703
- ...m ? { evidenceIds: m } : {}
1066
+ value: i,
1067
+ ...c !== void 0 ? { previousValue: c } : {},
1068
+ ...d !== void 0 ? { delta: d } : {},
1069
+ ...m !== void 0 ? { percentChange: m } : {},
1070
+ ...p ? { unit: p } : {},
1071
+ ...v ? { evidenceIds: v } : {}
704
1072
  };
705
1073
  }
706
- if (i === "kpi_grid") {
707
- u(o, r, ["type", "title", "tiles", "evidenceIds"], e);
708
- const a = h(
1074
+ if (a === "kpi_grid") {
1075
+ f(o, r, ["type", "title", "tiles", "evidenceIds"], e);
1076
+ const i = h(
709
1077
  o.title,
710
1078
  `${r}.title`,
711
- d.contentTitle,
1079
+ s.contentTitle,
712
1080
  e
713
- ), l = Array.isArray(o.tiles) ? o.tiles : [];
714
- Array.isArray(o.tiles) || c(e, `${r}.tiles`, "Expected an array."), l.length === 0 && c(e, `${r}.tiles`, "Expected at least one tile."), l.length > b.maxKpiTiles && c(
1081
+ ), c = Array.isArray(o.tiles) ? o.tiles : [];
1082
+ Array.isArray(o.tiles) || l(e, `${r}.tiles`, "Expected an array."), c.length === 0 && l(e, `${r}.tiles`, "Expected at least one tile."), c.length > $.maxKpiTiles && l(
715
1083
  e,
716
1084
  `${r}.tiles`,
717
- `Must have ${b.maxKpiTiles} tiles or fewer.`
1085
+ `Must have ${$.maxKpiTiles} tiles or fewer.`
718
1086
  );
719
- const f = l.slice(0, b.maxKpiTiles).map((m, I) => {
720
- const v = `${r}.tiles.${I}`, p = g(m, v, e);
721
- u(
722
- p,
723
- v,
724
- ["label", "value", "previousValue", "delta", "unit", "evidenceIds"],
1087
+ const d = c.slice(0, $.maxKpiTiles).map((p, v) => {
1088
+ const b = `${r}.tiles.${v}`, y = g(p, b, e);
1089
+ f(
1090
+ y,
1091
+ b,
1092
+ [
1093
+ "label",
1094
+ "value",
1095
+ "previousValue",
1096
+ "delta",
1097
+ "percentChange",
1098
+ "unit",
1099
+ "evidenceIds"
1100
+ ],
725
1101
  e
726
1102
  );
727
- const C = typeof p.value == "string" || typeof p.value == "number" ? p.value : "";
728
- C === "" && c(e, `${v}.value`, "Expected a string or number.");
729
- const x = p.previousValue === void 0 || p.previousValue === null || typeof p.previousValue == "string" || typeof p.previousValue == "number" ? p.previousValue : void 0;
730
- p.previousValue !== void 0 && p.previousValue !== null && x === void 0 && c(
1103
+ const S = k(
1104
+ y.value,
1105
+ `${b}.value`,
1106
+ e
1107
+ ) ?? "";
1108
+ S === "" && l(
731
1109
  e,
732
- `${v}.previousValue`,
733
- "Expected a string, number, or null."
1110
+ `${b}.value`,
1111
+ "Expected a non-empty string, number, or structured numeric value."
734
1112
  );
735
- const S = p.delta === void 0 || p.delta === null || typeof p.delta == "string" || typeof p.delta == "number" ? p.delta : void 0;
736
- p.delta !== void 0 && p.delta !== null && S === void 0 && c(e, `${v}.delta`, "Expected a string, number, or null.");
737
- const V = h(
738
- p.unit,
739
- `${v}.unit`,
740
- d.contentTitle,
1113
+ const P = y.previousValue === void 0 || y.previousValue === null ? y.previousValue : k(
1114
+ y.previousValue,
1115
+ `${b}.previousValue`,
1116
+ e
1117
+ ), j = y.delta === void 0 || y.delta === null ? y.delta : k(
1118
+ y.delta,
1119
+ `${b}.delta`,
1120
+ e
1121
+ ), M = y.percentChange === void 0 || y.percentChange === null ? y.percentChange : k(
1122
+ y.percentChange,
1123
+ `${b}.percentChange`,
741
1124
  e
742
- ), z = $(
743
- p.evidenceIds,
744
- `${v}.evidenceIds`,
1125
+ ), K = h(
1126
+ y.unit,
1127
+ `${b}.unit`,
1128
+ s.contentTitle,
1129
+ e
1130
+ ), q = I(
1131
+ y.evidenceIds,
1132
+ `${b}.evidenceIds`,
745
1133
  e
746
1134
  );
747
1135
  return {
748
- label: y(
749
- p.label,
750
- `${v}.label`,
751
- d.contentTitle,
1136
+ label: u(
1137
+ y.label,
1138
+ `${b}.label`,
1139
+ s.contentTitle,
752
1140
  e
753
1141
  ),
754
- value: C,
755
- ...x !== void 0 ? { previousValue: x } : {},
756
- ...S !== void 0 ? { delta: S } : {},
757
- ...V ? { unit: V } : {},
758
- ...z ? { evidenceIds: z } : {}
1142
+ value: S,
1143
+ ...P !== void 0 ? { previousValue: P } : {},
1144
+ ...j !== void 0 ? { delta: j } : {},
1145
+ ...M !== void 0 ? { percentChange: M } : {},
1146
+ ...K ? { unit: K } : {},
1147
+ ...q ? { evidenceIds: q } : {}
759
1148
  };
760
- }), s = $(
1149
+ }), m = I(
761
1150
  o.evidenceIds,
762
1151
  `${r}.evidenceIds`,
763
1152
  e
764
1153
  );
765
1154
  return {
766
1155
  type: "kpi_grid",
767
- ...a ? { title: a } : {},
768
- tiles: f,
769
- ...s ? { evidenceIds: s } : {}
1156
+ ...i ? { title: i } : {},
1157
+ tiles: d,
1158
+ ...m ? { evidenceIds: m } : {}
770
1159
  };
771
1160
  }
772
- if (i === "progress") {
773
- u(o, r, ["type", "label", "value", "detail", "evidenceIds"], e);
774
- const a = typeof o.value == "number" && Number.isFinite(o.value) ? o.value : 0;
775
- (typeof o.value != "number" || !Number.isFinite(o.value)) && c(e, `${r}.value`, "Expected a finite number.");
776
- const l = h(
1161
+ if (a === "progress") {
1162
+ f(o, r, ["type", "label", "value", "detail", "evidenceIds"], e);
1163
+ const i = typeof o.value == "number" && Number.isFinite(o.value) ? o.value : 0;
1164
+ (typeof o.value != "number" || !Number.isFinite(o.value)) && l(e, `${r}.value`, "Expected a finite number.");
1165
+ const c = h(
777
1166
  o.detail,
778
1167
  `${r}.detail`,
779
- d.contentText,
1168
+ s.contentText,
780
1169
  e
781
- ), f = $(o.evidenceIds, `${r}.evidenceIds`, e);
1170
+ ), d = I(o.evidenceIds, `${r}.evidenceIds`, e);
782
1171
  return {
783
1172
  type: "progress",
784
- label: y(
1173
+ label: u(
785
1174
  o.label,
786
1175
  `${r}.label`,
787
- d.contentTitle,
1176
+ s.contentTitle,
788
1177
  e
789
1178
  ),
790
- value: a,
791
- ...l ? { detail: l } : {},
792
- ...f ? { evidenceIds: f } : {}
1179
+ value: i,
1180
+ ...c ? { detail: c } : {},
1181
+ ...d ? { evidenceIds: d } : {}
793
1182
  };
794
1183
  }
795
- if (i === "table") {
796
- u(
1184
+ if (a === "table") {
1185
+ f(
797
1186
  o,
798
1187
  r,
799
1188
  ["type", "id", "title", "columns", "rows", "caption", "totalRows", "evidenceIds"],
800
1189
  e
801
1190
  );
802
- const a = _e(o.columns, `${r}.columns`, e), l = h(
1191
+ const i = Ye(o.columns, `${r}.columns`, e), c = h(
803
1192
  o.title,
804
1193
  `${r}.title`,
805
- d.contentTitle,
1194
+ s.contentTitle,
806
1195
  e
807
- ), f = h(
1196
+ ), d = h(
808
1197
  o.id,
809
1198
  `${r}.id`,
810
- d.id,
1199
+ s.id,
811
1200
  e
812
- ), s = h(
1201
+ ), m = h(
813
1202
  o.caption,
814
1203
  `${r}.caption`,
815
- d.contentItem,
1204
+ s.contentItem,
816
1205
  e
817
- ), m = ke(
1206
+ ), p = Me(
818
1207
  o.totalRows,
819
1208
  `${r}.totalRows`,
820
1209
  e
821
- ), I = $(o.evidenceIds, `${r}.evidenceIds`, e);
1210
+ ), v = I(o.evidenceIds, `${r}.evidenceIds`, e);
822
1211
  return {
823
1212
  type: "table",
824
- ...f ? { id: f } : {},
825
- ...l ? { title: l } : {},
826
- columns: a,
827
- rows: Be(o.rows, `${r}.rows`, a, e),
828
- ...s ? { caption: s } : {},
829
- ...m !== void 0 ? { totalRows: m } : {},
830
- ...I ? { evidenceIds: I } : {}
1213
+ ...d ? { id: d } : {},
1214
+ ...c ? { title: c } : {},
1215
+ columns: i,
1216
+ rows: Je(o.rows, `${r}.rows`, i, e),
1217
+ ...m ? { caption: m } : {},
1218
+ ...p !== void 0 ? { totalRows: p } : {},
1219
+ ...v ? { evidenceIds: v } : {}
831
1220
  };
832
1221
  }
833
- if (i === "evidence_appendix") {
834
- u(o, r, ["type", "title", "evidenceIds"], e);
835
- const a = h(
1222
+ if (a === "evidence_appendix") {
1223
+ f(o, r, ["type", "title", "evidenceIds"], e);
1224
+ const i = h(
836
1225
  o.title,
837
1226
  `${r}.title`,
838
- d.contentTitle,
1227
+ s.contentTitle,
839
1228
  e
840
1229
  );
841
1230
  return {
842
1231
  type: "evidence_appendix",
843
- ...a ? { title: a } : {},
844
- evidenceIds: $(o.evidenceIds, `${r}.evidenceIds`, e, {
1232
+ ...i ? { title: i } : {},
1233
+ evidenceIds: I(o.evidenceIds, `${r}.evidenceIds`, e, {
845
1234
  required: !0
846
1235
  }) ?? []
847
1236
  };
848
1237
  }
849
- if (i === "sql") {
850
- u(o, r, ["type", "title", "sql", "evidenceIds"], e);
851
- const a = h(
1238
+ if (a === "sql") {
1239
+ f(o, r, ["type", "title", "sql", "evidenceIds"], e);
1240
+ const i = h(
852
1241
  o.title,
853
1242
  `${r}.title`,
854
- d.contentTitle,
1243
+ s.contentTitle,
855
1244
  e
856
- ), l = y(
1245
+ ), c = u(
857
1246
  o.sql,
858
1247
  `${r}.sql`,
859
- d.contentSql,
1248
+ s.contentSql,
860
1249
  e
861
- ), f = $(o.evidenceIds, `${r}.evidenceIds`, e);
1250
+ ), d = I(o.evidenceIds, `${r}.evidenceIds`, e);
862
1251
  return {
863
1252
  type: "sql",
864
- ...a ? { title: a } : {},
865
- sql: l,
866
- ...f ? { evidenceIds: f } : {}
1253
+ ...i ? { title: i } : {},
1254
+ sql: c,
1255
+ ...d ? { evidenceIds: d } : {}
867
1256
  };
868
1257
  }
869
- return c(
1258
+ return l(
870
1259
  e,
871
1260
  `${r}.type`,
872
1261
  "Expected heading, paragraph, finding, bullets, metric, kpi_grid, progress, table, actions, limitations, sql, or evidence_appendix."
@@ -875,122 +1264,122 @@ function Le(t, n, e) {
875
1264
  text: ""
876
1265
  };
877
1266
  }
878
- function Ne(t) {
1267
+ function Qe(t) {
879
1268
  const n = [], e = g(t, "content", n);
880
- u(e, "content", ["version", "title", "summary", "blocks"], n), e.version !== 1 && c(n, "content.version", "Expected version 1.");
1269
+ f(e, "content", ["version", "title", "summary", "blocks"], n), e.version !== 1 && l(n, "content.version", "Expected version 1.");
881
1270
  const r = h(
882
1271
  e.title,
883
1272
  "content.title",
884
- d.contentTitle,
1273
+ s.contentTitle,
885
1274
  n
886
1275
  ), o = h(
887
1276
  e.summary,
888
1277
  "content.summary",
889
- d.contentSummary,
1278
+ s.contentSummary,
890
1279
  n
891
1280
  );
892
- Array.isArray(e.blocks) || c(n, "content.blocks", "Expected an array.");
893
- const i = Array.isArray(e.blocks) ? e.blocks : [];
894
- i.length === 0 && c(n, "content.blocks", "Expected at least one block."), i.length > b.maxBlocks && c(
1281
+ Array.isArray(e.blocks) || l(n, "content.blocks", "Expected an array.");
1282
+ const a = Array.isArray(e.blocks) ? e.blocks : [];
1283
+ a.length === 0 && l(n, "content.blocks", "Expected at least one block."), a.length > $.maxBlocks && l(
895
1284
  n,
896
1285
  "content.blocks",
897
- `Must have ${b.maxBlocks} blocks or fewer.`
1286
+ `Must have ${$.maxBlocks} blocks or fewer.`
898
1287
  );
899
- const a = i.slice(0, b.maxBlocks).map((l, f) => Le(l, f, n));
900
- return O(n), {
1288
+ const i = a.slice(0, $.maxBlocks).map((c, d) => Xe(c, d, n));
1289
+ return z(n), {
901
1290
  version: 1,
902
1291
  ...r ? { title: r } : {},
903
1292
  ...o ? { summary: o } : {},
904
- blocks: a
1293
+ blocks: i
905
1294
  };
906
1295
  }
907
- function at(t) {
1296
+ function St(t) {
908
1297
  try {
909
1298
  return {
910
1299
  valid: !0,
911
- value: Ne(t),
1300
+ value: Qe(t),
912
1301
  issues: []
913
1302
  };
914
1303
  } catch (n) {
915
- if (n instanceof A)
1304
+ if (n instanceof D)
916
1305
  return { valid: !1, issues: n.issues };
917
1306
  throw n;
918
1307
  }
919
1308
  }
920
- function k(t, n, e, r) {
921
- return typeof t == "string" && e.includes(t) ? t : (c(r, n, `Expected ${e.join(" or ")}.`), e[0]);
1309
+ function w(t, n, e, r) {
1310
+ return typeof t == "string" && e.includes(t) ? t : (l(r, n, `Expected ${e.join(" or ")}.`), e[0]);
922
1311
  }
923
- function E(t, n, e, r, o) {
1312
+ function x(t, n, e, r, o) {
924
1313
  if (t != null) {
925
1314
  if (typeof t == "string" && e.has(t))
926
1315
  return t;
927
- c(o, n, `Expected ${r}.`);
1316
+ l(o, n, `Expected ${r}.`);
928
1317
  }
929
1318
  }
930
- function Oe(t, n, e) {
1319
+ function et(t, n, e) {
931
1320
  if (t != null) {
932
1321
  if (!Array.isArray(t)) {
933
- c(e, n, "Expected an array.");
1322
+ l(e, n, "Expected an array.");
934
1323
  return;
935
1324
  }
936
1325
  return t;
937
1326
  }
938
1327
  }
939
- function Fe(t, n, e) {
1328
+ function tt(t, n, e) {
940
1329
  if (t != null) {
941
- if (!q(t)) {
942
- c(e, n, "Expected an object.");
1330
+ if (!X(t)) {
1331
+ l(e, n, "Expected an object.");
943
1332
  return;
944
1333
  }
945
1334
  return t;
946
1335
  }
947
1336
  }
948
- function Re(t, n, e) {
1337
+ function nt(t, n, e) {
949
1338
  if (t == null)
950
1339
  return;
951
1340
  const r = g(t, n, e);
952
- u(r, n, Te, e);
953
- const o = {}, i = E(
1341
+ f(r, n, Pe, e);
1342
+ const o = {}, a = x(
954
1343
  r.pageSize,
955
1344
  `${n}.pageSize`,
956
- he,
1345
+ Fe,
957
1346
  "letter, legal, a4, a3, or tabloid",
958
1347
  e
959
- ), a = E(
1348
+ ), i = x(
960
1349
  r.orientation,
961
1350
  `${n}.orientation`,
962
- ye,
1351
+ Ne,
963
1352
  "portrait or landscape",
964
1353
  e
965
- ), l = E(
1354
+ ), c = x(
966
1355
  r.delimiter,
967
1356
  `${n}.delimiter`,
968
- ge,
1357
+ Oe,
969
1358
  "comma, semicolon, or tab",
970
1359
  e
971
- ), f = E(
1360
+ ), d = x(
972
1361
  r.sheetSelection,
973
1362
  `${n}.sheetSelection`,
974
- ve,
1363
+ Re,
975
1364
  "current or all",
976
1365
  e
977
1366
  );
978
- i && (o.pageSize = i), a && (o.orientation = a), l && (o.delimiter = l), f && (o.sheetSelection = f);
979
- for (const s of [
1367
+ a && (o.pageSize = a), i && (o.orientation = i), c && (o.delimiter = c), d && (o.sheetSelection = d);
1368
+ for (const m of [
980
1369
  "includeFilters",
981
1370
  "includeTimestamp",
982
1371
  "includeHeaders",
983
1372
  "useFormattedValues",
984
1373
  "allowDownload"
985
1374
  ])
986
- if (!(r[s] === void 0 || r[s] === null)) {
987
- if (typeof r[s] != "boolean") {
988
- c(e, `${n}.${s}`, "Expected a boolean.");
1375
+ if (!(r[m] === void 0 || r[m] === null)) {
1376
+ if (typeof r[m] != "boolean") {
1377
+ l(e, `${n}.${m}`, "Expected a boolean.");
989
1378
  continue;
990
1379
  }
991
- o[s] = r[s];
1380
+ o[m] = r[m];
992
1381
  }
993
- for (const s of [
1382
+ for (const m of [
994
1383
  "currentSheetId",
995
1384
  "currentSheetName",
996
1385
  "filterLine",
@@ -998,15 +1387,15 @@ function Re(t, n, e) {
998
1387
  "cardType",
999
1388
  "theme"
1000
1389
  ]) {
1001
- const m = h(
1002
- r[s],
1003
- `${n}.${s}`,
1004
- d.id,
1390
+ const p = h(
1391
+ r[m],
1392
+ `${n}.${m}`,
1393
+ s.id,
1005
1394
  e
1006
1395
  );
1007
- m && (o[s] = m);
1396
+ p && (o[m] = p);
1008
1397
  }
1009
- for (const s of [
1398
+ for (const m of [
1010
1399
  "filterValues",
1011
1400
  "inlineFilterValues",
1012
1401
  "sheetFilterValues",
@@ -1014,111 +1403,111 @@ function Re(t, n, e) {
1014
1403
  "cardControlDefinitions",
1015
1404
  "controlBindings"
1016
1405
  ]) {
1017
- const m = Oe(r[s], `${n}.${s}`, e);
1018
- m && (o[s] = m);
1406
+ const p = et(r[m], `${n}.${m}`, e);
1407
+ p && (o[m] = p);
1019
1408
  }
1020
- for (const s of [
1409
+ for (const m of [
1021
1410
  "controlValues",
1022
1411
  "tablePreferences",
1023
1412
  "dashboardInputExecutionSnapshot"
1024
1413
  ]) {
1025
- const m = Fe(r[s], `${n}.${s}`, e);
1026
- m && (o[s] = m);
1414
+ const p = tt(r[m], `${n}.${m}`, e);
1415
+ p && (o[m] = p);
1027
1416
  }
1028
1417
  return Object.keys(o).length > 0 ? o : void 0;
1029
1418
  }
1030
- function _(t, n, e, r) {
1419
+ function F(t, n, e, r) {
1031
1420
  const o = h(
1032
1421
  n,
1033
1422
  e,
1034
- d.attachmentTitle,
1423
+ s.attachmentTitle,
1035
1424
  r
1036
1425
  );
1037
1426
  return o && (t.title = o), t;
1038
1427
  }
1039
- function B(t, n, e, r) {
1040
- const o = Re(n, e, r);
1428
+ function N(t, n, e, r) {
1429
+ const o = nt(n, e, r);
1041
1430
  return o && (t.settings = o), t;
1042
1431
  }
1043
- function Ve(t, n, e) {
1044
- const r = `attachments.${n}`, o = g(t, r, e), i = o.type;
1045
- if (i === "dashboard") {
1046
- u(
1432
+ function rt(t, n, e) {
1433
+ const r = `attachments.${n}`, o = g(t, r, e), a = o.type;
1434
+ if (a === "dashboard") {
1435
+ f(
1047
1436
  o,
1048
1437
  r,
1049
1438
  ["type", "dashboardId", "format", "title", "settings"],
1050
1439
  e
1051
1440
  );
1052
- const a = _(
1441
+ const i = F(
1053
1442
  {
1054
1443
  type: "dashboard",
1055
- dashboardId: y(
1444
+ dashboardId: u(
1056
1445
  o.dashboardId,
1057
1446
  `${r}.dashboardId`,
1058
- d.id,
1447
+ s.id,
1059
1448
  e
1060
1449
  ),
1061
- format: k(o.format, `${r}.format`, ["pdf"], e)
1450
+ format: w(o.format, `${r}.format`, ["pdf"], e)
1062
1451
  },
1063
1452
  o.title,
1064
1453
  `${r}.title`,
1065
1454
  e
1066
1455
  );
1067
- return B(a, o.settings, `${r}.settings`, e);
1456
+ return N(i, o.settings, `${r}.settings`, e);
1068
1457
  }
1069
- if (i === "dashboard_sheet" || i === "document_sheet") {
1070
- u(
1458
+ if (a === "dashboard_sheet" || a === "document_sheet") {
1459
+ f(
1071
1460
  o,
1072
1461
  r,
1073
1462
  ["type", "dashboardId", "sheetId", "format", "title", "settings"],
1074
1463
  e
1075
1464
  );
1076
- const a = _(
1465
+ const i = F(
1077
1466
  {
1078
- type: i,
1079
- dashboardId: y(
1467
+ type: a,
1468
+ dashboardId: u(
1080
1469
  o.dashboardId,
1081
1470
  `${r}.dashboardId`,
1082
- d.id,
1471
+ s.id,
1083
1472
  e
1084
1473
  ),
1085
- sheetId: y(
1474
+ sheetId: u(
1086
1475
  o.sheetId,
1087
1476
  `${r}.sheetId`,
1088
- d.id,
1477
+ s.id,
1089
1478
  e
1090
1479
  ),
1091
- format: k(o.format, `${r}.format`, ["pdf"], e)
1480
+ format: w(o.format, `${r}.format`, ["pdf"], e)
1092
1481
  },
1093
1482
  o.title,
1094
1483
  `${r}.title`,
1095
1484
  e
1096
1485
  );
1097
- return B(a, o.settings, `${r}.settings`, e);
1486
+ return N(i, o.settings, `${r}.settings`, e);
1098
1487
  }
1099
- if (i === "card") {
1100
- u(
1488
+ if (a === "card") {
1489
+ f(
1101
1490
  o,
1102
1491
  r,
1103
1492
  ["type", "dashboardId", "cardId", "format", "title", "settings"],
1104
1493
  e
1105
1494
  );
1106
- const a = _(
1495
+ const i = F(
1107
1496
  {
1108
1497
  type: "card",
1109
- dashboardId: y(
1498
+ dashboardId: u(
1110
1499
  o.dashboardId,
1111
1500
  `${r}.dashboardId`,
1112
- d.id,
1501
+ s.id,
1113
1502
  e
1114
1503
  ),
1115
- cardId: y(
1504
+ cardId: u(
1116
1505
  o.cardId,
1117
1506
  `${r}.cardId`,
1118
- d.id,
1507
+ s.id,
1119
1508
  e
1120
1509
  ),
1121
- format: k(
1510
+ format: w(
1122
1511
  o.format,
1123
1512
  `${r}.format`,
1124
1513
  ["csv", "pdf"],
@@ -1129,15 +1518,15 @@ function Ve(t, n, e) {
1129
1518
  `${r}.title`,
1130
1519
  e
1131
1520
  );
1132
- return B(a, o.settings, `${r}.settings`, e);
1521
+ return N(i, o.settings, `${r}.settings`, e);
1133
1522
  }
1134
- return c(
1523
+ return l(
1135
1524
  e,
1136
1525
  `${r}.type`,
1137
1526
  "Expected dashboard, dashboard_sheet, document_sheet, or card."
1138
1527
  ), { type: "dashboard", dashboardId: "", format: "pdf" };
1139
1528
  }
1140
- function ze(t) {
1529
+ function ot(t) {
1141
1530
  switch (t.type) {
1142
1531
  case "dashboard":
1143
1532
  return `${t.type}:${t.dashboardId}:${t.format}`;
@@ -1148,142 +1537,159 @@ function ze(t) {
1148
1537
  return `${t.type}:${t.dashboardId}:${t.cardId}:${t.format}`;
1149
1538
  }
1150
1539
  }
1151
- function W(t, n) {
1540
+ function re(t, n) {
1152
1541
  if (t == null)
1153
1542
  return [];
1154
1543
  if (!Array.isArray(t))
1155
- return c(n, "attachments", "Expected an array."), [];
1156
- t.length > w && c(
1544
+ return l(n, "attachments", "Expected an array."), [];
1545
+ t.length > _ && l(
1157
1546
  n,
1158
1547
  "attachments",
1159
- `Choose ${w} attachments or fewer.`
1548
+ `Choose ${_} attachments or fewer.`
1160
1549
  );
1161
- const e = t.slice(0, w).map((o, i) => Ve(o, i, n)), r = /* @__PURE__ */ new Set();
1162
- return e.forEach((o, i) => {
1163
- const a = ze(o);
1164
- r.has(a) && c(n, `attachments.${i}`, "Duplicate attachment."), r.add(a);
1550
+ const e = t.slice(0, _).map((o, a) => rt(o, a, n)), r = /* @__PURE__ */ new Set();
1551
+ return e.forEach((o, a) => {
1552
+ const i = ot(o);
1553
+ r.has(i) && l(n, `attachments.${a}`, "Duplicate attachment."), r.add(i);
1165
1554
  }), e;
1166
1555
  }
1167
- function Z(t, n) {
1556
+ function oe(t, n) {
1168
1557
  if (t == null)
1169
1558
  return;
1170
1559
  const e = g(t, "limits", n);
1171
- u(e, "limits", Object.keys(D), n);
1560
+ f(e, "limits", Object.keys(B), n);
1172
1561
  const r = {};
1173
- return Object.keys(D).forEach((o) => {
1174
- const i = e[o];
1175
- if (i == null)
1562
+ return Object.keys(B).forEach((o) => {
1563
+ const a = e[o];
1564
+ if (a == null)
1176
1565
  return;
1177
- const a = D[o];
1178
- if (typeof i != "number" || !Number.isInteger(i) || i < a.min || i > a.max) {
1179
- c(
1566
+ const i = B[o];
1567
+ if (typeof a != "number" || !Number.isInteger(a) || a < i.min || a > i.max) {
1568
+ l(
1180
1569
  n,
1181
1570
  `limits.${o}`,
1182
- `Expected an integer between ${a.min} and ${a.max}.`
1571
+ `Expected an integer between ${i.min} and ${i.max}.`
1183
1572
  );
1184
1573
  return;
1185
1574
  }
1186
- r[o] = i;
1575
+ r[o] = a;
1187
1576
  }), Object.keys(r).length > 0 ? r : void 0;
1188
1577
  }
1189
- function O(t) {
1578
+ function z(t) {
1190
1579
  if (t.length > 0)
1191
- throw new A(t);
1580
+ throw new D(t);
1192
1581
  }
1193
- function Y(t, n, e) {
1194
- !(t.type === "generated_analysis" || t.type === "custom_message" && !!t.message.trim()) && n.length === 0 && c(
1582
+ function ae(t, n, e) {
1583
+ !(t.type === "generated_analysis" || t.type === "custom_message" && !!t.message.trim()) && n.length === 0 && l(
1195
1584
  e,
1196
1585
  "body",
1197
1586
  "Add briefing instructions, a custom message, or at least one attachment."
1198
1587
  );
1199
1588
  }
1200
- function J(t) {
1589
+ function ie(t) {
1201
1590
  const n = [], e = g(t, "jobConfig", n);
1202
- u(
1591
+ f(
1203
1592
  e,
1204
1593
  "jobConfig",
1205
- ["kind", "source", "body", "attachments", "presentation", "limits"],
1594
+ [
1595
+ "kind",
1596
+ "reportContext",
1597
+ "source",
1598
+ "body",
1599
+ "attachments",
1600
+ "presentation",
1601
+ "limits"
1602
+ ],
1206
1603
  n
1207
- ), e.kind !== L && c(n, "kind", "Expected BRIEFING.");
1208
- const r = K(e.source, n), o = G(e.body, n), i = W(e.attachments, n), a = H(e.presentation, n), l = Z(e.limits, n);
1209
- return Y(o, i, n), O(n), {
1210
- kind: L,
1211
- source: r,
1212
- body: o,
1604
+ ), e.kind !== O && l(n, "kind", "Expected BRIEFING.");
1605
+ const r = se(e.reportContext);
1606
+ r.ok || r.issues.forEach(
1607
+ (m) => l(
1608
+ n,
1609
+ m.path === "$" ? "jobConfig.reportContext" : `jobConfig.reportContext.${m.path}`,
1610
+ m.message
1611
+ )
1612
+ );
1613
+ const o = Q(e.source, n), a = ee(e.body, n), i = re(e.attachments, n), c = te(e.presentation, n), d = oe(e.limits, n);
1614
+ return ae(a, i, n), z(n), {
1615
+ kind: O,
1616
+ reportContext: r.ok ? r.value : e.reportContext,
1617
+ source: o,
1618
+ body: a,
1213
1619
  attachments: i,
1214
- presentation: a,
1215
- ...l ? { limits: l } : {}
1620
+ presentation: c,
1621
+ ...d ? { limits: d } : {}
1216
1622
  };
1217
1623
  }
1218
- function ct(t) {
1219
- return J({
1624
+ function wt(t) {
1625
+ return ie({
1220
1626
  ...t,
1221
- kind: L
1627
+ kind: O
1222
1628
  });
1223
1629
  }
1224
- function F(t, n, e, r = "deliveryConfig.recipients") {
1225
- const o = `${r}.${n}`, i = g(t, o, e), a = i.type;
1226
- if (a === "email") {
1227
- u(i, o, ["type", "address", "name"], e);
1228
- const l = y(
1229
- i.address,
1630
+ function V(t, n, e, r = "deliveryConfig.recipients") {
1631
+ const o = `${r}.${n}`, a = g(t, o, e), i = a.type;
1632
+ if (i === "email") {
1633
+ f(a, o, ["type", "address", "name"], e);
1634
+ const c = u(
1635
+ a.address,
1230
1636
  `${o}.address`,
1231
- d.id,
1637
+ s.id,
1232
1638
  e
1233
- ), f = h(
1234
- i.name,
1639
+ ), d = h(
1640
+ a.name,
1235
1641
  `${o}.name`,
1236
- d.attachmentTitle,
1642
+ s.attachmentTitle,
1237
1643
  e
1238
1644
  );
1239
- return l && !xe(l) && c(e, `${o}.address`, "Email address is invalid."), {
1645
+ return c && !qe(c) && l(e, `${o}.address`, "Email address is invalid."), {
1240
1646
  type: "email",
1241
- address: l,
1242
- ...f ? { name: f } : {}
1647
+ address: c,
1648
+ ...d ? { name: d } : {}
1243
1649
  };
1244
1650
  }
1245
- return a === "user" ? (u(i, o, ["type", "userId"], e), {
1651
+ return i === "user" ? (f(a, o, ["type", "userId"], e), {
1246
1652
  type: "user",
1247
- userId: y(
1248
- i.userId,
1653
+ userId: u(
1654
+ a.userId,
1249
1655
  `${o}.userId`,
1250
- d.id,
1656
+ s.id,
1251
1657
  e
1252
1658
  )
1253
- }) : a === "tenant_user" ? (u(i, o, ["type", "tenantUserId"], e), {
1659
+ }) : i === "tenant_user" ? (f(a, o, ["type", "tenantUserId"], e), {
1254
1660
  type: "tenant_user",
1255
- tenantUserId: y(
1256
- i.tenantUserId,
1661
+ tenantUserId: u(
1662
+ a.tenantUserId,
1257
1663
  `${o}.tenantUserId`,
1258
- d.id,
1664
+ s.id,
1259
1665
  e
1260
1666
  )
1261
- }) : a === "group" ? (u(i, o, ["type", "groupId"], e), {
1667
+ }) : i === "group" ? (f(a, o, ["type", "groupId"], e), {
1262
1668
  type: "group",
1263
- groupId: y(
1264
- i.groupId,
1669
+ groupId: u(
1670
+ a.groupId,
1265
1671
  `${o}.groupId`,
1266
- d.id,
1672
+ s.id,
1267
1673
  e
1268
1674
  )
1269
- }) : (c(
1675
+ }) : (l(
1270
1676
  e,
1271
1677
  `${o}.type`,
1272
1678
  "Expected email, user, tenant_user, or group."
1273
1679
  ), { type: "email", address: "" });
1274
1680
  }
1275
- function Me(t, n) {
1681
+ function at(t, n) {
1276
1682
  return t == null ? [] : Array.isArray(t) ? t.map(
1277
- (e, r) => F(e, r, n)
1278
- ) : (c(n, "deliveryConfig.recipients", "Expected an array."), []);
1683
+ (e, r) => V(e, r, n)
1684
+ ) : (l(n, "deliveryConfig.recipients", "Expected an array."), []);
1279
1685
  }
1280
- function Pe(t, n) {
1686
+ function it(t, n) {
1281
1687
  if (!Array.isArray(t))
1282
- return c(n, "deliveryConfig.channels", "Expected an array."), [];
1688
+ return l(n, "deliveryConfig.channels", "Expected an array."), [];
1283
1689
  const e = [];
1284
1690
  return t.forEach((r, o) => {
1285
- if (!X(r)) {
1286
- c(
1691
+ if (!ce(r)) {
1692
+ l(
1287
1693
  n,
1288
1694
  `deliveryConfig.channels.${o}`,
1289
1695
  "Expected EMAIL, WEBHOOK, SLACK, IN_APP, or TELEGRAM."
@@ -1293,56 +1699,56 @@ function Pe(t, n) {
1293
1699
  e.includes(r) || e.push(r);
1294
1700
  }), e;
1295
1701
  }
1296
- function Ue(t, n, e) {
1702
+ function ct(t, n, e) {
1297
1703
  if (t == null)
1298
1704
  return;
1299
1705
  const r = g(t, n, e), o = {};
1300
- return Object.entries(r).forEach(([i, a]) => {
1301
- if (typeof a != "string") {
1302
- c(e, `${n}.${i}`, "Expected a string.");
1706
+ return Object.entries(r).forEach(([a, i]) => {
1707
+ if (typeof i != "string") {
1708
+ l(e, `${n}.${a}`, "Expected a string.");
1303
1709
  return;
1304
1710
  }
1305
- o[i] = a.trim();
1711
+ o[a] = i.trim();
1306
1712
  }), Object.keys(o).length > 0 ? o : void 0;
1307
1713
  }
1308
- function je(t, n, e) {
1714
+ function lt(t, n, e) {
1309
1715
  if (t == null)
1310
1716
  return;
1311
1717
  const r = g(t, n, e);
1312
- u(
1718
+ f(
1313
1719
  r,
1314
1720
  n,
1315
1721
  ["url", "method", "headers", "secretEncrypted"],
1316
1722
  e
1317
1723
  );
1318
- const o = r.method === void 0 || r.method === null ? void 0 : k(r.method, `${n}.method`, ["POST", "PUT"], e), i = Ue(r.headers, `${n}.headers`, e), a = h(
1724
+ const o = r.method === void 0 || r.method === null ? void 0 : w(r.method, `${n}.method`, ["POST", "PUT"], e), a = ct(r.headers, `${n}.headers`, e), i = h(
1319
1725
  r.secretEncrypted,
1320
1726
  `${n}.secretEncrypted`,
1321
1727
  2e3,
1322
1728
  e
1323
1729
  );
1324
1730
  return {
1325
- url: y(r.url, `${n}.url`, 2e3, e),
1731
+ url: u(r.url, `${n}.url`, 2e3, e),
1326
1732
  ...o ? { method: o } : {},
1327
- ...i ? { headers: i } : {},
1328
- ...a ? { secretEncrypted: a } : {}
1733
+ ...a ? { headers: a } : {},
1734
+ ...i ? { secretEncrypted: i } : {}
1329
1735
  };
1330
1736
  }
1331
- function qe(t, n, e) {
1737
+ function dt(t, n, e) {
1332
1738
  const r = g(t, n, e), o = r.type;
1333
1739
  if (o === "channel") {
1334
- u(
1740
+ f(
1335
1741
  r,
1336
1742
  n,
1337
1743
  ["type", "channelId", "channelName", "isPrivate"],
1338
1744
  e
1339
1745
  );
1340
- const i = h(
1746
+ const a = h(
1341
1747
  r.channelName,
1342
1748
  `${n}.channelName`,
1343
- d.attachmentTitle,
1749
+ s.attachmentTitle,
1344
1750
  e
1345
- ), a = r.isPrivate === void 0 || r.isPrivate === null ? void 0 : T(
1751
+ ), i = r.isPrivate === void 0 || r.isPrivate === null ? void 0 : A(
1346
1752
  r.isPrivate,
1347
1753
  !1,
1348
1754
  `${n}.isPrivate`,
@@ -1350,42 +1756,42 @@ function qe(t, n, e) {
1350
1756
  );
1351
1757
  return {
1352
1758
  type: "channel",
1353
- channelId: y(
1759
+ channelId: u(
1354
1760
  r.channelId,
1355
1761
  `${n}.channelId`,
1356
- d.id,
1762
+ s.id,
1357
1763
  e
1358
1764
  ),
1359
- ...i ? { channelName: i } : {},
1360
- ...a !== void 0 ? { isPrivate: a } : {}
1765
+ ...a ? { channelName: a } : {},
1766
+ ...i !== void 0 ? { isPrivate: i } : {}
1361
1767
  };
1362
1768
  }
1363
- return o === "dm" ? (u(r, n, ["type", "recipient"], e), c(
1769
+ return o === "dm" ? (f(r, n, ["type", "recipient"], e), l(
1364
1770
  e,
1365
1771
  `${n}.type`,
1366
1772
  "Slack DM delivery is not supported in V1."
1367
1773
  ), {
1368
1774
  type: "dm",
1369
- recipient: F(r.recipient, 0, e, `${n}.recipient`)
1370
- }) : (c(e, `${n}.type`, "Expected channel."), { type: "channel", channelId: "" });
1775
+ recipient: V(r.recipient, 0, e, `${n}.recipient`)
1776
+ }) : (l(e, `${n}.type`, "Expected channel."), { type: "channel", channelId: "" });
1371
1777
  }
1372
- function Ke(t, n, e) {
1778
+ function mt(t, n, e) {
1373
1779
  if (t == null)
1374
1780
  return;
1375
1781
  if (!Array.isArray(t)) {
1376
- c(e, n, "Expected an array.");
1782
+ l(e, n, "Expected an array.");
1377
1783
  return;
1378
1784
  }
1379
1785
  const r = t.map(
1380
- (o, i) => F(o, i, e, n)
1786
+ (o, a) => V(o, a, e, n)
1381
1787
  );
1382
1788
  return r.length > 0 ? r : void 0;
1383
1789
  }
1384
- function Ge(t, n, e) {
1790
+ function st(t, n, e) {
1385
1791
  if (t == null)
1386
1792
  return;
1387
1793
  const r = g(t, n, e);
1388
- u(
1794
+ f(
1389
1795
  r,
1390
1796
  n,
1391
1797
  [
@@ -1397,41 +1803,41 @@ function Ge(t, n, e) {
1397
1803
  ],
1398
1804
  e
1399
1805
  );
1400
- const o = Ke(
1806
+ const o = mt(
1401
1807
  r.threadMentions,
1402
1808
  `${n}.threadMentions`,
1403
1809
  e
1404
- ), i = T(
1810
+ ), a = A(
1405
1811
  r.postThreadDetail,
1406
1812
  !0,
1407
1813
  `${n}.postThreadDetail`,
1408
1814
  e
1409
- ), a = T(
1815
+ ), i = A(
1410
1816
  r.includeDashboardLink,
1411
1817
  !0,
1412
1818
  `${n}.includeDashboardLink`,
1413
1819
  e
1414
- ), l = T(
1820
+ ), c = A(
1415
1821
  r.includeBriefingLink,
1416
1822
  !0,
1417
1823
  `${n}.includeBriefingLink`,
1418
1824
  e
1419
1825
  );
1420
1826
  return {
1421
- destination: qe(
1827
+ destination: dt(
1422
1828
  r.destination,
1423
1829
  `${n}.destination`,
1424
1830
  e
1425
1831
  ),
1426
1832
  ...o ? { threadMentions: o } : {},
1427
- ...r.postThreadDetail !== void 0 ? { postThreadDetail: i } : {},
1428
- ...r.includeDashboardLink !== void 0 ? { includeDashboardLink: a } : {},
1429
- ...r.includeBriefingLink !== void 0 ? { includeBriefingLink: l } : {}
1833
+ ...r.postThreadDetail !== void 0 ? { postThreadDetail: a } : {},
1834
+ ...r.includeDashboardLink !== void 0 ? { includeDashboardLink: i } : {},
1835
+ ...r.includeBriefingLink !== void 0 ? { includeBriefingLink: c } : {}
1430
1836
  };
1431
1837
  }
1432
- function He(t, n, e) {
1838
+ function ft(t, n, e) {
1433
1839
  const r = g(t, n, e);
1434
- u(
1840
+ f(
1435
1841
  r,
1436
1842
  n,
1437
1843
  [
@@ -1445,110 +1851,110 @@ function He(t, n, e) {
1445
1851
  ],
1446
1852
  e
1447
1853
  );
1448
- const o = E(
1854
+ const o = x(
1449
1855
  r.formatProfile,
1450
1856
  `${n}.formatProfile`,
1451
- be,
1857
+ Le,
1452
1858
  "concise, balanced, or detailed",
1453
1859
  e
1454
- ), i = h(
1860
+ ), a = h(
1455
1861
  r.subjectOverride,
1456
1862
  `${n}.subjectOverride`,
1457
1863
  500,
1458
1864
  e
1459
- ), a = h(
1865
+ ), i = h(
1460
1866
  r.titleOverride,
1461
1867
  `${n}.titleOverride`,
1462
1868
  500,
1463
1869
  e
1464
- ), l = h(
1870
+ ), c = h(
1465
1871
  r.summaryOverride,
1466
1872
  `${n}.summaryOverride`,
1467
1873
  2e3,
1468
1874
  e
1469
- ), f = T(
1875
+ ), d = A(
1470
1876
  r.actionBlockVisible,
1471
1877
  !0,
1472
1878
  `${n}.actionBlockVisible`,
1473
1879
  e
1474
- ), s = je(
1880
+ ), m = lt(
1475
1881
  r.webhookConfig,
1476
1882
  `${n}.webhookConfig`,
1477
1883
  e
1478
- ), m = Ge(
1884
+ ), p = st(
1479
1885
  r.slackConfig,
1480
1886
  `${n}.slackConfig`,
1481
1887
  e
1482
1888
  );
1483
1889
  return {
1484
1890
  ...o ? { formatProfile: o } : {},
1485
- ...i ? { subjectOverride: i } : {},
1486
- ...a ? { titleOverride: a } : {},
1487
- ...l ? { summaryOverride: l } : {},
1488
- ...r.actionBlockVisible !== void 0 ? { actionBlockVisible: f } : {},
1489
- ...m ? { slackConfig: m } : {},
1490
- ...s ? { webhookConfig: s } : {}
1891
+ ...a ? { subjectOverride: a } : {},
1892
+ ...i ? { titleOverride: i } : {},
1893
+ ...c ? { summaryOverride: c } : {},
1894
+ ...r.actionBlockVisible !== void 0 ? { actionBlockVisible: d } : {},
1895
+ ...p ? { slackConfig: p } : {},
1896
+ ...m ? { webhookConfig: m } : {}
1491
1897
  };
1492
1898
  }
1493
- function We(t, n) {
1899
+ function pt(t, n) {
1494
1900
  if (t == null)
1495
1901
  return;
1496
1902
  const e = g(t, "deliveryConfig.channelConfigs", n), r = {};
1497
- return Object.entries(e).forEach(([o, i]) => {
1498
- if (!X(o)) {
1499
- c(
1903
+ return Object.entries(e).forEach(([o, a]) => {
1904
+ if (!ce(o)) {
1905
+ l(
1500
1906
  n,
1501
1907
  `deliveryConfig.channelConfigs.${o}`,
1502
1908
  "Expected a supported delivery channel."
1503
1909
  );
1504
1910
  return;
1505
1911
  }
1506
- r[o] = He(
1507
- i,
1912
+ r[o] = ft(
1913
+ a,
1508
1914
  `deliveryConfig.channelConfigs.${o}`,
1509
1915
  n
1510
1916
  );
1511
1917
  }), Object.keys(r).length > 0 ? r : void 0;
1512
1918
  }
1513
- function Ze(t, n) {
1514
- var f, s, m;
1919
+ function ut(t, n) {
1920
+ var d, m, p;
1515
1921
  if (t == null)
1516
1922
  return null;
1517
1923
  const e = g(t, "deliveryConfig", n);
1518
- u(
1924
+ f(
1519
1925
  e,
1520
1926
  "deliveryConfig",
1521
1927
  ["recipients", "channels", "channelConfigs"],
1522
1928
  n
1523
1929
  );
1524
- const r = We(e.channelConfigs, n), o = Me(e.recipients, n), i = Pe(e.channels, n), a = ((s = (f = r == null ? void 0 : r.SLACK) == null ? void 0 : f.slackConfig) == null ? void 0 : s.destination.type) === "channel" && !!r.SLACK.slackConfig.destination.channelId.trim();
1525
- return i.some(
1526
- (I) => I !== "SLACK"
1527
- ) && o.length === 0 && c(
1930
+ const r = pt(e.channelConfigs, n), o = at(e.recipients, n), a = it(e.channels, n), i = ((m = (d = r == null ? void 0 : r.SLACK) == null ? void 0 : d.slackConfig) == null ? void 0 : m.destination.type) === "channel" && !!r.SLACK.slackConfig.destination.channelId.trim();
1931
+ return a.some(
1932
+ (v) => v !== "SLACK"
1933
+ ) && o.length === 0 && l(
1528
1934
  n,
1529
1935
  "deliveryConfig.recipients",
1530
1936
  "Add at least one recipient or remove delivery config."
1531
- ), i.length === 0 && c(
1937
+ ), a.length === 0 && l(
1532
1938
  n,
1533
1939
  "deliveryConfig.channels",
1534
1940
  "Choose at least one delivery channel or remove delivery config."
1535
- ), i.includes("SLACK") && !a && c(
1941
+ ), a.includes("SLACK") && !i && l(
1536
1942
  n,
1537
1943
  "deliveryConfig.channelConfigs.SLACK.slackConfig.destination.channelId",
1538
1944
  "Choose a Slack channel destination."
1539
- ), !i.includes("SLACK") && ((m = r == null ? void 0 : r.SLACK) != null && m.slackConfig) && c(
1945
+ ), !a.includes("SLACK") && ((p = r == null ? void 0 : r.SLACK) != null && p.slackConfig) && l(
1540
1946
  n,
1541
1947
  "deliveryConfig.channelConfigs.SLACK",
1542
1948
  "Slack config requires SLACK in deliveryConfig.channels."
1543
1949
  ), {
1544
1950
  recipients: o,
1545
- channels: i,
1951
+ channels: a,
1546
1952
  ...r ? { channelConfigs: r } : {}
1547
1953
  };
1548
1954
  }
1549
- function R(t) {
1955
+ function U(t) {
1550
1956
  const n = [], e = g(t, "draft", n);
1551
- u(
1957
+ f(
1552
1958
  e,
1553
1959
  "draft",
1554
1960
  [
@@ -1566,91 +1972,94 @@ function R(t) {
1566
1972
  ],
1567
1973
  n
1568
1974
  );
1569
- const r = y(
1975
+ const r = u(
1570
1976
  e.name,
1571
1977
  "name",
1572
- d.name,
1978
+ s.name,
1573
1979
  n
1574
1980
  ), o = h(
1575
1981
  e.description,
1576
1982
  "description",
1577
- d.description,
1983
+ s.description,
1578
1984
  n
1579
- ) ?? null, i = h(e.scheduleExpr, "scheduleExpr", 500, n) ?? null, a = h(e.timezone, "timezone", 200, n) ?? "UTC", l = Ae(e.status, n), f = K(e.source, n), s = G(e.body, n), m = W(e.attachments, n), I = H(e.presentation, n), v = Z(e.limits, n), p = Ze(e.deliveryConfig, n);
1580
- return Y(s, m, n), O(n), {
1985
+ ) ?? null, a = h(e.scheduleExpr, "scheduleExpr", 500, n) ?? null, i = h(e.timezone, "timezone", 200, n) ?? "UTC", c = Ke(e.status, n), d = Q(e.source, n), m = ee(e.body, n), p = re(e.attachments, n), v = te(e.presentation, n), b = oe(e.limits, n), y = ut(e.deliveryConfig, n);
1986
+ return ae(m, p, n), z(n), {
1581
1987
  name: r,
1582
1988
  description: o,
1583
- status: l,
1584
- scheduleExpr: i,
1585
- timezone: a,
1586
- source: f,
1587
- body: s,
1588
- attachments: m,
1589
- presentation: I,
1590
- ...v ? { limits: v } : {},
1591
- deliveryConfig: p
1989
+ status: c,
1990
+ scheduleExpr: a,
1991
+ timezone: i,
1992
+ source: d,
1993
+ body: m,
1994
+ attachments: p,
1995
+ presentation: v,
1996
+ ...b ? { limits: b } : {},
1997
+ deliveryConfig: y
1592
1998
  };
1593
1999
  }
1594
- function lt(t) {
1595
- return R(t);
2000
+ function Dt(t) {
2001
+ return U(t);
1596
2002
  }
1597
- function dt(t) {
1598
- return R(t);
2003
+ function _t(t) {
2004
+ return U(t);
1599
2005
  }
1600
- function st(t) {
2006
+ function Bt(t) {
1601
2007
  try {
1602
- return { valid: !0, value: R(t), issues: [] };
2008
+ return { valid: !0, value: U(t), issues: [] };
1603
2009
  } catch (n) {
1604
- if (n instanceof A)
2010
+ if (n instanceof D)
1605
2011
  return { valid: !1, issues: n.issues };
1606
2012
  throw n;
1607
2013
  }
1608
2014
  }
1609
- function ft(t) {
2015
+ function Ft(t) {
1610
2016
  try {
1611
- return { valid: !0, value: J(t), issues: [] };
2017
+ return { valid: !0, value: ie(t), issues: [] };
1612
2018
  } catch (n) {
1613
- if (n instanceof A)
2019
+ if (n instanceof D)
1614
2020
  return { valid: !1, issues: n.issues };
1615
2021
  throw n;
1616
2022
  }
1617
2023
  }
1618
- function ut(t) {
1619
- return typeof t == "string" && j.has(t);
2024
+ function Nt(t) {
2025
+ return typeof t == "string" && J.has(t);
1620
2026
  }
1621
- function X(t) {
1622
- return typeof t == "string" && pe.has(t);
2027
+ function ce(t) {
2028
+ return typeof t == "string" && Be.has(t);
1623
2029
  }
1624
2030
  export {
1625
- me as BRIEFING_ARTIFACT_FORMATS,
1626
- b as BRIEFING_CONTENT_LIMITS,
1627
- L as BRIEFING_KIND,
1628
- d as BRIEFING_TEXT_LIMITS,
1629
- A as BriefingContractError,
1630
- N as DEFAULT_BRIEFING_ARTIFACT_FORMATS,
1631
- Xe as DEFAULT_BRIEFING_SCHEDULE,
1632
- w as MAX_BRIEFING_ATTACHMENTS,
1633
- ct as buildBriefingJobConfig,
1634
- et as buildBriefingScheduleExpr,
1635
- lt as buildCreateBriefingRequest,
1636
- dt as buildUpdateBriefingRequest,
1637
- rt as canCreateBriefingForUser,
1638
- tt as describeBriefingSchedule,
1639
- nt as getBriefingCardAttachmentCapability,
1640
- de as getBriefingCardAttachmentFormats,
1641
- ot as getBriefingCreationIntents,
1642
- ue as getBriefingDisplayTypeLabel,
1643
- it as getBriefingPresentation,
1644
- se as getDefaultBriefingCardAttachmentFormat,
1645
- ut as isBriefingArtifactFormat,
1646
- X as isBriefingDeliveryChannel,
1647
- fe as isEmailOnlyBriefingDelivery,
1648
- Qe as isValidBriefingTimezone,
1649
- Ne as normalizeBriefingContentDocument,
1650
- R as normalizeBriefingDraft,
1651
- J as normalizeBriefingJobConfig,
1652
- oe as parseBriefingScheduleExpr,
1653
- at as validateBriefingContentDocument,
1654
- st as validateBriefingDraft,
1655
- ft as validateBriefingJobConfig
2031
+ we as BRIEFING_ARTIFACT_FORMATS,
2032
+ $ as BRIEFING_CONTENT_LIMITS,
2033
+ O as BRIEFING_KIND,
2034
+ s as BRIEFING_TEXT_LIMITS,
2035
+ D as BriefingContractError,
2036
+ R as DEFAULT_BRIEFING_ARTIFACT_FORMATS,
2037
+ bt as DEFAULT_BRIEFING_SCHEDULE,
2038
+ _ as MAX_BRIEFING_ATTACHMENTS,
2039
+ wt as buildBriefingJobConfig,
2040
+ It as buildBriefingScheduleExpr,
2041
+ Dt as buildCreateBriefingRequest,
2042
+ _t as buildUpdateBriefingRequest,
2043
+ kt as canCreateBriefingForUser,
2044
+ Et as describeBriefingSchedule,
2045
+ At as formatBriefingComparisonValues,
2046
+ _e as formatBriefingDisplayValue,
2047
+ Ct as getBriefingCardAttachmentCapability,
2048
+ Te as getBriefingCardAttachmentFormats,
2049
+ Tt as getBriefingCreationIntents,
2050
+ Se as getBriefingDisplayTypeLabel,
2051
+ xt as getBriefingPresentation,
2052
+ xe as getDefaultBriefingCardAttachmentFormat,
2053
+ Nt as isBriefingArtifactFormat,
2054
+ ce as isBriefingDeliveryChannel,
2055
+ De as isBriefingNumericValue,
2056
+ Ae as isEmailOnlyBriefingDelivery,
2057
+ $t as isValidBriefingTimezone,
2058
+ Qe as normalizeBriefingContentDocument,
2059
+ U as normalizeBriefingDraft,
2060
+ ie as normalizeBriefingJobConfig,
2061
+ $e as parseBriefingScheduleExpr,
2062
+ St as validateBriefingContentDocument,
2063
+ Bt as validateBriefingDraft,
2064
+ Ft as validateBriefingJobConfig
1656
2065
  };