react-semaphor 0.1.526 → 0.1.528

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 (180) hide show
  1. package/DATA_APP_SDK.md +5 -1
  2. package/dist/analytics-protocol/index.js +1190 -296
  3. package/dist/brand-studio/index.js +15 -15
  4. package/dist/briefings/index.js +50 -49
  5. package/dist/chunks/{calculated-field-identity-D1ofR4KJ.js → calculated-field-identity-DUu-tCQw.js} +66 -65
  6. package/dist/chunks/{card-config-utils-9sv4e-Vb.js → card-config-utils-BdPceiw8.js} +68 -65
  7. package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
  8. package/dist/chunks/dashboard-BkskKMck.js +14 -0
  9. package/dist/chunks/{dashboard-briefing-launcher-DXz1GhFZ.js → dashboard-briefing-launcher-Bb0RhGRC.js} +372 -359
  10. package/dist/chunks/{dashboard-controls-Df8qOSrs.js → dashboard-controls-loWTHPMi.js} +739 -686
  11. package/dist/chunks/{dashboard-json-Xldp0qww.js → dashboard-json-DUci_SOR.js} +10 -10
  12. package/dist/chunks/{edit-dashboard-visual-COHBqyic.js → edit-dashboard-visual-z9WN26w7.js} +6603 -6572
  13. package/dist/chunks/{editor-action-buttons-DahlP57T.js → editor-action-buttons-CGSFK9S-.js} +266 -267
  14. package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-CdXSo1pb.js} +19 -19
  15. package/dist/chunks/{field-dependencies-v-lJNzC7.js → field-dependencies-CGYic38w.js} +1 -1
  16. package/dist/chunks/{index-CbjuruKe.js → index-CTYnXU85.js} +781 -780
  17. package/dist/chunks/{matrix-analytical-definition-BimC4XIV.js → matrix-analytical-definition-BJyH5-99.js} +1 -1
  18. package/dist/chunks/{matrix-card-CIlz0Dnp.js → matrix-card-DhykwdZs.js} +7 -6
  19. package/dist/chunks/{matrix-control-sources-2VAzGlt8.js → matrix-control-sources-BV9ywFtJ.js} +11 -11
  20. package/dist/chunks/{matrix-definition-E5gXXSTZ.js → matrix-definition-Cdn3LoxW.js} +3 -3
  21. package/dist/chunks/{semantic-format-Baqp8kD_.js → matrix-formatter-1Mm8x8w7.js} +655 -511
  22. package/dist/chunks/{matrix-member-presentation-Bw7-JCrr.js → matrix-member-presentation-BBW0n1iY.js} +1 -1
  23. package/dist/chunks/matrix-operation-contract-Dp7kFpVk.js +1383 -0
  24. package/dist/chunks/{metric-comparison-BphoJ9bq.js → metric-comparison-Crljx_XY.js} +15 -10
  25. package/dist/chunks/{numeric-presentation-VhMUHfrJ.js → numeric-presentation-LvnNY5Ma.js} +68 -68
  26. package/dist/chunks/pivot-header-presentation-CZa3556D.js +618 -0
  27. package/dist/chunks/{pivot-result-identity-BzUQiCEV.js → pivot-result-identity-CY__BuwI.js} +1 -1
  28. package/dist/chunks/{pivot-result-lifecycle-BFO354lk.js → pivot-result-lifecycle-Bqdtknud.js} +259 -204
  29. package/dist/chunks/{raw-temporal-7bFbXd2a.js → raw-temporal-CdnA_OXJ.js} +10 -10
  30. package/dist/chunks/{raw-temporal-contract-BQZIJ1fn.js → raw-temporal-contract-Bc9z83t-.js} +1 -1
  31. package/dist/chunks/relative-date-DAF9J7mt.js +456 -0
  32. package/dist/chunks/{report-preferences-dialog-BcH-0lR-.js → report-preferences-dialog-VV0-Ro6F.js} +131 -132
  33. package/dist/chunks/{report-runtime-context-CxIoGyNM.js → report-runtime-context-CtaGGlit.js} +1 -1
  34. package/dist/chunks/{selection-reducer-NF5C07yM.js → selection-reducer-IZjBSU6Z.js} +47 -26
  35. package/dist/chunks/semantic-format-BBLvfwua.js +192 -0
  36. package/dist/chunks/{semaphor-ready-indicator-BLRDuLr4.js → semaphor-ready-indicator-DbA4mVQL.js} +49909 -46207
  37. package/dist/chunks/{slider-BYIH4icg.js → slider-DpiJG8lv.js} +81 -82
  38. package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
  39. package/dist/chunks/switch-C4YH-W1X.js +24003 -0
  40. package/dist/chunks/{temporal-bucket-PcLFSYWX.js → temporal-bucket-DlFuhCnT.js} +6 -6
  41. package/dist/chunks/{temporal-bucket-contract-DTLDRzgV.js → temporal-bucket-contract-C6lUGPS3.js} +1 -1
  42. package/dist/chunks/temporal-input-presentation-DyMWCZYh.js +195 -0
  43. package/dist/chunks/{token-types-BC6RcUY8.js → token-types-UjyNz95-.js} +1 -1
  44. package/dist/chunks/{validators-CsdOtZI6.js → validators-CQcG0EPN.js} +852 -731
  45. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
  46. package/dist/dashboard/index.js +1 -1
  47. package/dist/dashboard-authoring/index.js +138 -137
  48. package/dist/data-app-sdk/index.js +12 -12
  49. package/dist/data-app-sdk-adapters/index.js +23 -22
  50. package/dist/data-app-sdk-validation/index.js +27 -26
  51. package/dist/format-utils/index.js +247 -329
  52. package/dist/index.js +165 -168
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +1 -1
  56. package/dist/types/briefings/index.d.ts +3 -0
  57. package/dist/types/components/explorer/filters/card-date-filter.d.ts +13 -5
  58. package/dist/types/components/explorer/filters/card-date-selection.d.ts +28 -0
  59. package/dist/types/components/sharing-and-management/dashboard-actions-menu.d.ts +1 -1
  60. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -1
  61. package/dist/types/components/surfboard/download-settings-dialog.d.ts +8 -0
  62. package/dist/types/components/surfboard/filter/types.d.ts +8 -29
  63. package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +5 -1
  64. package/dist/types/components/ui-custom/date-range-picker.d.ts +18 -2
  65. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -21
  66. package/dist/types/components/ui-custom/report-calendar.d.ts +18 -0
  67. package/dist/types/components/visual/aggregated-table/utils/export-utils.d.ts +3 -5
  68. package/dist/types/components/visual/data-table/data-table-toolbar.d.ts +1 -1
  69. package/dist/types/components/visual/pivot-table/utils/pivot-table-export-utils.d.ts +3 -1
  70. package/dist/types/index.js +5 -5
  71. package/dist/types/lib/api/exports-api.d.ts +3 -0
  72. package/dist/types/lib/csv-download.d.ts +9 -0
  73. package/dist/types/lib/csv-encoding-options.d.ts +6 -0
  74. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +2 -1
  75. package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +0 -1
  76. package/dist/types/lib/document/document-input-runtime.d.ts +2 -1
  77. package/dist/types/lib/export-utils.d.ts +17 -15
  78. package/dist/types/lib/hooks/explorer/use-filter-builder.d.ts +2 -2
  79. package/dist/types/lib/hooks/use-relative-date-summarizer.d.ts +7 -0
  80. package/dist/types/lib/matrix-table/matrix-application-adapter.d.ts +3 -2
  81. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  82. package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +1 -1
  83. package/dist/types/lib/matrix-table/matrix-dataset-history.d.ts +47 -0
  84. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +7 -3
  85. package/dist/types/lib/matrix-table/matrix-execution-context.d.ts +2 -0
  86. package/dist/types/lib/matrix-table/matrix-query-transport.d.ts +4 -1
  87. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +105 -4
  88. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +43 -2
  89. package/dist/types/lib/matrix-table/use-matrix.d.ts +6 -0
  90. package/dist/types/lib/query-context/build-card-query-context.d.ts +5 -1
  91. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +0 -1
  92. package/dist/types/lib/query-context/build-global-date-comparison-context.d.ts +1 -2
  93. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +1 -2
  94. package/dist/types/lib/query-context/dashboard-card-query-key.d.ts +10 -0
  95. package/dist/types/lib/query-context/query-auth-scope.d.ts +5 -0
  96. package/dist/types/lib/stores/dashboard-store.d.ts +9 -4
  97. package/dist/types/lib/temporal-filter/temporal-filter-utils.d.ts +9 -2
  98. package/dist/types/lib/types/common-types.d.ts +5 -0
  99. package/dist/types/lib/types/explorer-types.d.ts +14 -0
  100. package/dist/types/lib/types/semantic-types.d.ts +4 -2
  101. package/dist/types/lib/types/token-types.d.ts +0 -1
  102. package/dist/types/lib/utils/aggregate-expression-utils.d.ts +0 -4
  103. package/dist/types/lib/utils/card-definition.d.ts +1 -1
  104. package/dist/types/lib/utils/date-timezone-utils.d.ts +4 -46
  105. package/dist/types/lib/utils/filter-default-value-utils.d.ts +8 -2
  106. package/dist/types/lib/utils/inline-filter-utils.d.ts +3 -2
  107. package/dist/types/lib/utils/relative-date-description.d.ts +38 -0
  108. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +89 -0
  109. package/dist/types/shared/analytics-protocol/analytics-refusal.d.ts +32 -0
  110. package/dist/types/shared/analytics-protocol/contracts.d.ts +48 -7
  111. package/dist/types/shared/analytics-protocol/index.d.ts +15 -1
  112. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +20 -20
  113. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +10 -10
  114. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +8 -8
  115. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +61 -6
  116. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +63 -0
  117. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +9 -3
  118. package/dist/types/shared/analytics-protocol/operation-temporal-state.d.ts +64 -0
  119. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +61 -0
  120. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +20 -0
  121. package/dist/types/shared/analytics-protocol/runtime-schemas.d.ts +0 -2
  122. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +314 -0
  123. package/dist/types/shared/analytics-protocol/time-window.d.ts +13 -0
  124. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +8 -4
  125. package/dist/types/shared/format-utils/exporters/csv-utils.d.ts +46 -15
  126. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -3
  127. package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +2 -1
  128. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +2 -2
  129. package/dist/types/shared/format-utils/types/format-types.d.ts +0 -42
  130. package/dist/types/shared/temporal/calendar-periods.d.ts +56 -0
  131. package/dist/types/shared/temporal/index.d.ts +5 -0
  132. package/dist/types/shared/temporal/relative-date.d.ts +21 -0
  133. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +73 -0
  134. package/dist/types/shared/temporal/time-window-periods.d.ts +21 -0
  135. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +23 -0
  136. package/package.json +1 -17
  137. package/src/data-app-sdk/README.md +6 -3
  138. package/dist/chunks/code-highlight-994tgM9v.js +0 -22265
  139. package/dist/chunks/dashboard-CsHvEtjN.js +0 -15
  140. package/dist/chunks/dashboard-date-comparison-definition-BqNhECUr.js +0 -183
  141. package/dist/chunks/matrix-formatter-WBgtebUT.js +0 -341
  142. package/dist/chunks/matrix-operation-contract-D32U2CSw.js +0 -1802
  143. package/dist/chunks/mouse-pointer-2-BZvGk45-.js +0 -19
  144. package/dist/chunks/pivot-header-presentation-CGtudHo7.js +0 -661
  145. package/dist/chunks/pre-block-Cq1RqhZX.js +0 -3987
  146. package/dist/chunks/search-CJz-QQ0Q.js +0 -24
  147. package/dist/chunks/switch-XaAACBrJ.js +0 -2234
  148. package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +0 -222
  149. package/dist/chunks/update-policy-DhAUtiC8.js +0 -913
  150. package/dist/data-app-builder/index.js +0 -3666
  151. package/dist/data-app-builder-browser-runtime/index.js +0 -8
  152. package/dist/data-app-codegen/index.js +0 -22
  153. package/dist/data-app-codegen-node/index.js +0 -1807
  154. package/dist/types/components/data-app-runtime/published-data-app-runtime.d.ts +0 -7
  155. package/dist/types/components/surfboard/json-to-csv.d.ts +0 -7
  156. package/dist/types/components/visual/data-table/utils/export-utils.d.ts +0 -31
  157. package/dist/types/data-app-builder/browser-runtime.d.ts +0 -174
  158. package/dist/types/data-app-builder/constants.d.ts +0 -14
  159. package/dist/types/data-app-builder/data-app-builder.d.ts +0 -14
  160. package/dist/types/data-app-builder/index.d.ts +0 -1
  161. package/dist/types/data-app-builder/lib/api.d.ts +0 -36
  162. package/dist/types/data-app-builder/lib/context-select.d.ts +0 -3
  163. package/dist/types/data-app-builder/lib/diagnostics.d.ts +0 -12
  164. package/dist/types/data-app-builder/lib/file-tree.d.ts +0 -2
  165. package/dist/types/data-app-builder/types.d.ts +0 -558
  166. package/dist/types/data-app-builder-browser-runtime.d.ts +0 -2
  167. package/dist/types/data-app-builder.d.ts +0 -2
  168. package/dist/types/data-app-codegen/generate-contract.d.ts +0 -26
  169. package/dist/types/data-app-codegen/generated-contract-files.d.ts +0 -7
  170. package/dist/types/data-app-codegen/generated-contract-validation.d.ts +0 -13
  171. package/dist/types/data-app-codegen/index.d.ts +0 -6
  172. package/dist/types/data-app-codegen/live-execution.d.ts +0 -42
  173. package/dist/types/data-app-codegen/node.d.ts +0 -2
  174. package/dist/types/data-app-codegen/update-policy.d.ts +0 -25
  175. package/dist/types/data-app-codegen/validation.d.ts +0 -8
  176. package/dist/types/data-app-codegen-node.d.ts +0 -2
  177. package/dist/types/data-app-codegen.d.ts +0 -2
  178. package/dist/types/shared/analytics-protocol/data-app-codegen-summary.d.ts +0 -418
  179. package/dist/types/shared/format-utils/exporters/pivot-exporter.d.ts +0 -13
  180. package/dist/types/shared/format-utils/exporters/table-exporter.d.ts +0 -10
@@ -1,16 +1,16 @@
1
1
  import { z as i } from "zod";
2
- const Ot = [
2
+ const Bt = [
3
3
  "missing_dependency",
4
4
  "missing_relationship",
5
5
  "population_required",
6
6
  "ambiguous_relationship"
7
7
  ];
8
- function ia(e) {
9
- return Ot.includes(
8
+ function ga(e) {
9
+ return Bt.includes(
10
10
  e
11
11
  );
12
12
  }
13
- const De = 200, z = [
13
+ const Ne = 200, W = [
14
14
  "second",
15
15
  "minute",
16
16
  "hour",
@@ -20,44 +20,66 @@ const De = 200, z = [
20
20
  "quarter",
21
21
  "year"
22
22
  ];
23
- function na(e) {
24
- return typeof e == "string" && z.includes(e);
23
+ function ha(e) {
24
+ return typeof e == "string" && W.includes(e);
25
25
  }
26
- const Yt = [
26
+ const qt = [
27
27
  "week_of_short",
28
28
  "week_of_long",
29
29
  "quarter_short",
30
30
  "quarter_long",
31
31
  "fiscal_quarter_short",
32
32
  "fiscal_year"
33
- ], aa = {
33
+ ], _a = {
34
34
  invalidMetadata: "invalid_raw_temporal_metadata"
35
35
  };
36
- function Pt(e) {
36
+ function Lt(e) {
37
37
  return e === "second" || e === "minute" || e === "hour" ? "datetime" : "date";
38
38
  }
39
- const oa = {
39
+ const ba = {
40
40
  missingMetadata: "missing_temporal_bucket_metadata",
41
41
  invalidMetadata: "invalid_temporal_bucket_metadata",
42
42
  invalidValue: "invalid_temporal_bucket_value"
43
- }, sa = "__auto_count__";
44
- function Bt(e) {
43
+ }, ya = "__auto_count__";
44
+ function Ut(e) {
45
45
  return typeof e == "string" || typeof e == "number" && Number.isFinite(e) || typeof e == "boolean";
46
46
  }
47
- function qt(e) {
48
- return !Array.isArray(e) || e.length === 0 || e.length > De || !e.every(Bt) ? {
47
+ function Vt(e) {
48
+ return !Array.isArray(e) || e.length === 0 || e.length > Ne || !e.every(Ut) ? {
49
49
  ok: !1,
50
- error: `matchValues must be 1 to ${De} string, number or boolean values.`
50
+ error: `matchValues must be 1 to ${Ne} string, number or boolean values.`
51
51
  } : { ok: !0, values: e };
52
52
  }
53
- function Lt(e) {
53
+ const Ht = [
54
+ "day",
55
+ "week",
56
+ "month",
57
+ "quarter",
58
+ "year"
59
+ ], va = ["this", "previous"], Gt = ["now", "latest_available"], zt = [
60
+ "include_partial",
61
+ "complete_periods"
62
+ ], Sa = {
63
+ second: 31536e4,
64
+ minute: 5256e3,
65
+ hour: 87600,
66
+ day: 3650,
67
+ week: 520,
68
+ month: 120,
69
+ quarter: 40,
70
+ year: 10
71
+ };
72
+ function Ia(e) {
73
+ return e.anchor ?? "latest_available";
74
+ }
75
+ function Wt(e) {
54
76
  try {
55
77
  return new Intl.DateTimeFormat("en-US", { timeZone: e }).format(), !0;
56
78
  } catch {
57
79
  return !1;
58
80
  }
59
81
  }
60
- const Ut = i.record(i.string(), i.unknown()), O = i.array(Ut), R = i.enum([
82
+ const Kt = i.record(i.string(), i.unknown()), O = i.array(Kt), R = i.enum([
61
83
  "SUM",
62
84
  "COUNT",
63
85
  "AVG",
@@ -76,40 +98,40 @@ const Ut = i.record(i.string(), i.unknown()), O = i.array(Ut), R = i.enum([
76
98
  "duckdb",
77
99
  "sqlite",
78
100
  "unknown"
79
- ]), U = i.enum(z), Q = i.enum([
101
+ ]), V = i.enum(W), Q = i.enum([
80
102
  "dimension",
81
103
  "measure",
82
104
  "date",
83
105
  "id",
84
106
  "unknown"
85
- ]), W = i.enum([
107
+ ]), X = i.enum([
86
108
  "string",
87
109
  "number",
88
110
  "boolean",
89
111
  "date",
90
112
  "datetime",
91
113
  "unknown"
92
- ]), te = i.union([i.number(), i.string(), i.null()]), ie = i.enum([
114
+ ]), ie = i.union([i.number(), i.string(), i.null()]), ne = i.enum([
93
115
  "millisecond",
94
116
  "second",
95
117
  "minute",
96
118
  "hour",
97
119
  "day"
98
- ]), Vt = i.enum(Yt), Ht = i.discriminatedUnion("mode", [
120
+ ]), Qt = i.enum(qt), Xt = i.discriminatedUnion("mode", [
99
121
  i.object({ mode: i.literal("auto") }).strict(),
100
122
  i.object({
101
123
  mode: i.literal("preset"),
102
- preset: Vt
124
+ preset: Qt
103
125
  }).strict(),
104
126
  i.object({
105
127
  mode: i.literal("pattern"),
106
128
  pattern: i.string().min(1)
107
129
  }).strict()
108
- ]), X = i.object({
130
+ ]), Z = i.object({
109
131
  type: i.literal("temporal_bucket"),
110
- presentation: Ht
111
- }).strict(), Gt = i.object({
112
- tz: i.string().min(1).refine(Lt, {
132
+ presentation: Xt
133
+ }).strict(), Zt = i.object({
134
+ tz: i.string().min(1).refine(Wt, {
113
135
  message: "tz must be a valid IANA timezone"
114
136
  }),
115
137
  weekStart: i.number().int().min(0).max(6),
@@ -117,14 +139,14 @@ const Ut = i.record(i.string(), i.unknown()), O = i.array(Ut), R = i.enum([
117
139
  kind: i.literal("month_aligned"),
118
140
  yearStartMonth: i.number().int().min(1).max(12)
119
141
  }).strict().optional()
120
- }).strict(), re = i.object({
142
+ }).strict(), le = i.object({
121
143
  kind: i.literal("temporal_bucket"),
122
- granularity: U,
123
- calendar: Gt
124
- }).strict(), zt = i.object({
144
+ granularity: V,
145
+ calendar: Zt
146
+ }).strict(), Jt = i.object({
125
147
  kind: i.literal("raw_temporal"),
126
148
  valueKind: i.enum(["date", "wall_datetime", "instant"])
127
- }).strict(), he = i.union([
149
+ }).strict(), _e = i.union([
128
150
  i.object({
129
151
  type: i.enum([
130
152
  "number",
@@ -163,10 +185,10 @@ const Ut = i.record(i.string(), i.unknown()), O = i.array(Ut), R = i.enum([
163
185
  }).passthrough(),
164
186
  i.object({
165
187
  type: i.literal("duration"),
166
- inputUnit: ie.optional(),
188
+ inputUnit: ne.optional(),
167
189
  outputStyle: i.enum(["compact", "digital", "long"]).optional(),
168
- largestUnit: ie.optional(),
169
- smallestUnit: ie.optional(),
190
+ largestUnit: ne.optional(),
191
+ smallestUnit: ne.optional(),
170
192
  maxUnits: i.number().optional(),
171
193
  prefix: i.string().optional(),
172
194
  suffix: i.string().optional(),
@@ -178,7 +200,7 @@ const Ut = i.record(i.string(), i.unknown()), O = i.array(Ut), R = i.enum([
178
200
  suffix: i.string().optional()
179
201
  }).passthrough()
180
202
  ]);
181
- function Kt(e, t) {
203
+ function ei(e, t) {
182
204
  return i.object(e).passthrough().superRefine((n, o) => {
183
205
  for (const a of t)
184
206
  Object.prototype.hasOwnProperty.call(n, a) || o.addIssue({
@@ -188,14 +210,14 @@ function Kt(e, t) {
188
210
  });
189
211
  });
190
212
  }
191
- const _e = i.object({
213
+ const be = i.object({
192
214
  kind: i.literal("semantic"),
193
215
  domainId: i.string(),
194
216
  datasetName: i.string(),
195
217
  datasetId: i.string().optional(),
196
218
  label: i.string().optional(),
197
219
  connectionId: i.string().optional()
198
- }).passthrough(), Qe = i.object({
220
+ }).passthrough(), Je = i.object({
199
221
  kind: i.literal("physical"),
200
222
  connectionId: i.string(),
201
223
  connectionType: i.string().optional(),
@@ -204,37 +226,37 @@ const _e = i.object({
204
226
  schemaName: i.string().optional(),
205
227
  label: i.string().optional(),
206
228
  dialect: K.optional()
207
- }).passthrough(), Qt = i.object({
229
+ }).passthrough(), ti = i.object({
208
230
  kind: i.literal("sql"),
209
231
  connectionId: i.string(),
210
232
  dialect: K.optional(),
211
233
  label: i.string().optional()
212
- }).passthrough(), We = i.union([
213
- _e,
214
- Qe,
215
- Qt
216
- ]), Xe = i.object({
234
+ }).passthrough(), et = i.union([
235
+ be,
236
+ Je,
237
+ ti
238
+ ]), tt = i.object({
217
239
  name: i.string(),
218
240
  label: i.string().optional(),
219
241
  role: Q.optional(),
220
- dataType: W.optional(),
221
- source: We.optional(),
242
+ dataType: X.optional(),
243
+ source: et.optional(),
222
244
  aggregate: R.optional()
223
- }).passthrough(), Ze = Xe, Wt = i.object({
245
+ }).passthrough(), it = tt, ii = i.object({
224
246
  kind: i.literal("field"),
225
- field: Ze,
247
+ field: it,
226
248
  aggregate: R.optional()
227
- }).passthrough(), Je = i.object({
249
+ }).passthrough(), nt = i.object({
228
250
  kind: i.literal("derived_field"),
229
251
  name: i.string(),
230
252
  label: i.string(),
231
253
  description: i.string().optional(),
232
254
  resultRole: Q,
233
- dataType: W,
255
+ dataType: X,
234
256
  computeStage: i.enum(["row", "aggregate"]),
235
257
  expression: i.string(),
236
258
  expressionLanguage: i.literal("semaphor_sql_template").optional(),
237
- inputs: i.record(Wt),
259
+ inputs: i.record(ii),
238
260
  defaultAggregate: R.optional(),
239
261
  aggregationBehavior: i.enum([
240
262
  "additive",
@@ -250,13 +272,13 @@ const _e = i.object({
250
272
  "aggregate_then_join",
251
273
  "weighted"
252
274
  ]).optional(),
253
- format: he.optional(),
275
+ format: _e.optional(),
254
276
  tags: i.array(i.string()).optional()
255
- }).passthrough(), et = Je, ra = Ze.and(
277
+ }).passthrough(), at = nt, wa = it.and(
256
278
  i.object({
257
- derivedField: et.optional()
279
+ derivedField: at.optional()
258
280
  }).passthrough()
259
- ), Xt = _e, Zt = i.object({
281
+ ), ni = be, ai = i.object({
260
282
  kind: i.literal("physical"),
261
283
  connectionId: i.string().optional(),
262
284
  connectionType: i.string().optional(),
@@ -265,22 +287,22 @@ const _e = i.object({
265
287
  schemaName: i.string().optional(),
266
288
  label: i.string().optional(),
267
289
  dialect: K.optional()
268
- }).passthrough(), Jt = i.object({
290
+ }).passthrough(), oi = i.object({
269
291
  kind: i.literal("sql"),
270
292
  connectionId: i.string().optional(),
271
293
  dialect: K.optional(),
272
294
  label: i.string().optional()
273
- }).passthrough(), ei = i.union([
274
- Xt,
275
- Zt,
276
- Jt
277
- ]), la = i.object({
295
+ }).passthrough(), si = i.union([
296
+ ni,
297
+ ai,
298
+ oi
299
+ ]), ka = i.object({
278
300
  key: i.string().optional(),
279
301
  name: i.string(),
280
302
  label: i.string().optional(),
281
303
  role: Q.optional(),
282
- dataType: W.optional(),
283
- source: ei.optional(),
304
+ dataType: X.optional(),
305
+ source: si.optional(),
284
306
  aggregate: R.optional(),
285
307
  derivedField: i.never().optional()
286
308
  }).passthrough(), j = i.object({
@@ -288,12 +310,12 @@ const _e = i.object({
288
310
  name: i.string(),
289
311
  label: i.string(),
290
312
  role: Q.optional(),
291
- dataType: W.optional(),
313
+ dataType: X.optional(),
292
314
  aggregate: R.optional(),
293
- source: We.optional(),
294
- derivedField: et.optional(),
295
- temporalBucket: re.optional(),
296
- rawTemporal: zt.optional(),
315
+ source: et.optional(),
316
+ derivedField: at.optional(),
317
+ temporalBucket: le.optional(),
318
+ rawTemporal: Jt.optional(),
297
319
  pivotIdentity: i.object({
298
320
  metricId: i.string().min(1),
299
321
  metricAlias: i.string().min(1),
@@ -301,7 +323,7 @@ const _e = i.object({
301
323
  i.object({
302
324
  fieldId: i.string().min(1),
303
325
  value: i.string().nullable(),
304
- temporalBucket: re.optional()
326
+ temporalBucket: le.optional()
305
327
  }).strict()
306
328
  )
307
329
  }).strict().optional()
@@ -311,7 +333,7 @@ const _e = i.object({
311
333
  path: ["rawTemporal"],
312
334
  message: "A result column cannot carry both temporalBucket and rawTemporal metadata."
313
335
  }), e.temporalBucket) {
314
- const n = Pt(
336
+ const n = Lt(
315
337
  e.temporalBucket.granularity
316
338
  );
317
339
  e.dataType !== n && t.addIssue({
@@ -328,13 +350,13 @@ const _e = i.object({
328
350
  message: `${e.rawTemporal.valueKind} raw temporal values require dataType ${n}.`
329
351
  });
330
352
  }
331
- }), da = i.object({
353
+ }), Aa = i.object({
332
354
  records: O,
333
355
  columns: i.array(j).optional()
334
- }).passthrough(), ua = i.object({
356
+ }).passthrough(), xa = i.object({
335
357
  records: O,
336
358
  columns: i.array(j)
337
- }).passthrough(), tt = i.object({
359
+ }).passthrough(), ot = i.object({
338
360
  code: i.string(),
339
361
  message: i.string().optional(),
340
362
  invalidField: i.string().optional(),
@@ -343,47 +365,47 @@ const _e = i.object({
343
365
  validDateCandidates: i.array(i.string()).optional(),
344
366
  validDimensionCandidates: i.array(i.string()).optional(),
345
367
  recommendedNextStep: i.string()
346
- }).passthrough(), Ee = i.object({
368
+ }).passthrough(), je = i.object({
347
369
  code: i.string(),
348
370
  message: i.string(),
349
371
  path: i.string().optional(),
350
372
  fieldRole: i.enum(["measure", "date", "dimension", "input", "source", "sql"]).optional(),
351
- repairHint: tt.optional()
352
- }).passthrough(), ca = i.object({
373
+ repairHint: ot.optional()
374
+ }).passthrough(), Fa = i.object({
353
375
  ok: i.boolean(),
354
- errors: i.array(Ee),
355
- warnings: i.array(Ee),
356
- repairHints: i.array(tt)
357
- }).passthrough(), ti = i.object({
376
+ errors: i.array(je),
377
+ warnings: i.array(je),
378
+ repairHints: i.array(ot)
379
+ }).passthrough(), ri = i.object({
358
380
  page: i.number(),
359
381
  pageSize: i.number(),
360
382
  pageCount: i.number(),
361
383
  totalCount: i.number(),
362
384
  hasNextPage: i.boolean(),
363
385
  hasPrevPage: i.boolean()
364
- }).passthrough(), Z = {
386
+ }).passthrough(), J = {
365
387
  intentId: i.string().optional(),
366
388
  queryPath: i.enum(["query_spec", "sql", "sql_python"]),
367
389
  warnings: i.array(i.string()).optional(),
368
390
  rowCount: i.number().optional(),
369
391
  rowLimitExceeded: i.boolean().optional(),
370
392
  limit: i.number().optional(),
371
- pagination: ti.optional()
372
- }, pa = i.object({
373
- ...Z,
393
+ pagination: ri.optional()
394
+ }, Ra = i.object({
395
+ ...J,
374
396
  kind: i.literal("metric"),
375
- primaryValue: te,
376
- measures: i.record(te).optional(),
397
+ primaryValue: ie,
398
+ measures: i.record(ie).optional(),
377
399
  missingMeasures: i.array(i.string()).optional(),
378
400
  comparison: i.object({
379
401
  kind: i.enum(["previous_period", "previous_year", "target"]),
380
- value: te.optional(),
402
+ value: ie.optional(),
381
403
  delta: i.union([i.number(), i.null()]).optional(),
382
404
  deltaPercent: i.union([i.number(), i.null()]).optional()
383
405
  }).passthrough().optional(),
384
406
  records: O.optional()
385
- }).passthrough(), ma = i.object({
386
- ...Z,
407
+ }).passthrough(), Ta = i.object({
408
+ ...J,
387
409
  kind: i.literal("records"),
388
410
  columns: i.array(j),
389
411
  records: O,
@@ -393,7 +415,7 @@ const _e = i.object({
393
415
  row: i.record(i.string(), i.unknown()),
394
416
  columns: i.array(j).optional()
395
417
  }).passthrough().optional()
396
- }).passthrough(), ii = i.object({
418
+ }).passthrough(), li = i.object({
397
419
  inputId: i.string().min(1),
398
420
  status: i.enum(["applied", "inactive", "skipped", "overridden", "error"]),
399
421
  reason: i.enum([
@@ -406,16 +428,16 @@ const _e = i.object({
406
428
  "unsupported_dependency",
407
429
  "override_not_eligible"
408
430
  ]).optional()
409
- }), ni = i.object({
431
+ }), di = i.object({
410
432
  complete: i.boolean(),
411
433
  reason: i.enum(["unsupported", "truncated"]).optional()
412
- }), fa = i.object({
413
- ...Z,
434
+ }), Da = i.object({
435
+ ...J,
414
436
  kind: i.literal("inputOptions"),
415
- dependencyOutcomes: i.array(ii).optional(),
416
- match: ni.optional(),
437
+ dependencyOutcomes: i.array(li).optional(),
438
+ match: di.optional(),
417
439
  options: i.array(
418
- Kt(
440
+ ei(
419
441
  {
420
442
  label: i.string(),
421
443
  value: i.unknown(),
@@ -425,8 +447,8 @@ const _e = i.object({
425
447
  ["value"]
426
448
  )
427
449
  )
428
- }).passthrough(), ga = i.object({
429
- ...Z,
450
+ }).passthrough(), Ma = i.object({
451
+ ...J,
430
452
  kind: i.literal("sql"),
431
453
  columns: i.array(j),
432
454
  records: O,
@@ -442,16 +464,16 @@ function r(e, t, n) {
442
464
  function m(e) {
443
465
  return typeof e == "string" && e.trim().length > 0;
444
466
  }
445
- function ai(e) {
467
+ function ui(e) {
446
468
  const t = /* @__PURE__ */ new Set();
447
- return oi(e, (n) => (t.add(n), `{${n}}`)), Array.from(t);
469
+ return ci(e, (n) => (t.add(n), `{${n}}`)), Array.from(t);
448
470
  }
449
- function oi(e, t) {
471
+ function ci(e, t) {
450
472
  let n = "", o = 0, a = 0;
451
473
  for (; a < e.length; ) {
452
474
  const s = e[a];
453
475
  if (s === "'" || s === '"') {
454
- a = si(e, a);
476
+ a = pi(e, a);
455
477
  continue;
456
478
  }
457
479
  if (s === "{") {
@@ -468,7 +490,7 @@ function oi(e, t) {
468
490
  }
469
491
  return n + e.slice(o);
470
492
  }
471
- function si(e, t) {
493
+ function pi(e, t) {
472
494
  const n = e[t];
473
495
  let o = t + 1;
474
496
  for (; o < e.length; ) {
@@ -486,7 +508,7 @@ function si(e, t) {
486
508
  function f(e) {
487
509
  return !!(e && typeof e == "object" && !Array.isArray(e));
488
510
  }
489
- const ri = /* @__PURE__ */ new Set([
511
+ const mi = /* @__PURE__ */ new Set([
490
512
  "SUM",
491
513
  "COUNT",
492
514
  "AVG",
@@ -495,7 +517,7 @@ const ri = /* @__PURE__ */ new Set([
495
517
  "MEDIAN",
496
518
  "DISTINCT"
497
519
  ]);
498
- function be(e, t, n) {
520
+ function ye(e, t, n) {
499
521
  if (!e || typeof e != "object") {
500
522
  n.push(
501
523
  r("missing_source", "Analytics intent needs a source.", t)
@@ -561,10 +583,10 @@ function y(e, t, n, o = {}) {
561
583
  "Field reference needs a name.",
562
584
  `${t}.name`
563
585
  )
564
- ), e.source !== void 0 && be(e.source, `${t}.source`, n), ye(e.aggregate, `${t}.aggregate`, n);
586
+ ), e.source !== void 0 && ye(e.source, `${t}.source`, n), ve(e.aggregate, `${t}.aggregate`, n);
565
587
  }
566
- function ye(e, t, n) {
567
- e !== void 0 && (typeof e != "string" || !ri.has(e)) && n.push(
588
+ function ve(e, t, n) {
589
+ e !== void 0 && (typeof e != "string" || !mi.has(e)) && n.push(
568
590
  r(
569
591
  "invalid_aggregate",
570
592
  "Field aggregate must be SUM, COUNT, AVG, MIN, MAX, MEDIAN, or DISTINCT.",
@@ -572,20 +594,20 @@ function ye(e, t, n) {
572
594
  )
573
595
  );
574
596
  }
575
- const li = /* @__PURE__ */ new Set([
597
+ const fi = /* @__PURE__ */ new Set([
576
598
  "measure",
577
599
  "dimension",
578
600
  "date",
579
601
  "id",
580
602
  "unknown"
581
- ]), di = /* @__PURE__ */ new Set(["row", "aggregate"]), it = /* @__PURE__ */ new Set([
603
+ ]), gi = /* @__PURE__ */ new Set(["row", "aggregate"]), st = /* @__PURE__ */ new Set([
582
604
  "string",
583
605
  "number",
584
606
  "boolean",
585
607
  "date",
586
608
  "datetime",
587
609
  "unknown"
588
- ]), ui = /* @__PURE__ */ new Set([
610
+ ]), hi = /* @__PURE__ */ new Set([
589
611
  "number",
590
612
  "currency",
591
613
  "percent",
@@ -596,14 +618,14 @@ const li = /* @__PURE__ */ new Set([
596
618
  "duration",
597
619
  "string",
598
620
  "temporal_bucket"
599
- ]), ci = /* @__PURE__ */ new Set([
621
+ ]), _i = /* @__PURE__ */ new Set([
600
622
  "millisecond",
601
623
  "second",
602
624
  "minute",
603
625
  "hour",
604
626
  "day"
605
- ]), pi = /* @__PURE__ */ new Set(["compact", "digital", "long"]);
606
- function nt(e, t, n) {
627
+ ]), bi = /* @__PURE__ */ new Set(["compact", "digital", "long"]);
628
+ function rt(e, t, n) {
607
629
  if (e === void 0)
608
630
  return;
609
631
  if (!f(e)) {
@@ -617,13 +639,13 @@ function nt(e, t, n) {
617
639
  return;
618
640
  }
619
641
  const o = e;
620
- (typeof o.type != "string" || !ui.has(o.type)) && n.push(
642
+ (typeof o.type != "string" || !hi.has(o.type)) && n.push(
621
643
  r(
622
644
  "invalid_value_format_type",
623
645
  "Value format type must be number, currency, percent, percentage, scientific, date, datetime, duration, string, or temporal_bucket.",
624
646
  `${t}.type`
625
647
  )
626
- ), o.type === "temporal_bucket" && !X.safeParse(e).success && n.push(
648
+ ), o.type === "temporal_bucket" && !Z.safeParse(e).success && n.push(
627
649
  r(
628
650
  "invalid_temporal_bucket_format",
629
651
  "Temporal bucket format must contain a valid auto, preset, or pattern presentation.",
@@ -664,7 +686,7 @@ function nt(e, t, n) {
664
686
  );
665
687
  for (const a of ["inputUnit", "largestUnit", "smallestUnit"]) {
666
688
  const s = e[a];
667
- s !== void 0 && (typeof s != "string" || !ci.has(s)) && n.push(
689
+ s !== void 0 && (typeof s != "string" || !_i.has(s)) && n.push(
668
690
  r(
669
691
  "invalid_value_format_duration_unit",
670
692
  "Duration format units must be millisecond, second, minute, hour, or day.",
@@ -672,7 +694,7 @@ function nt(e, t, n) {
672
694
  )
673
695
  );
674
696
  }
675
- e.outputStyle !== void 0 && (typeof e.outputStyle != "string" || !pi.has(e.outputStyle)) && n.push(
697
+ e.outputStyle !== void 0 && (typeof e.outputStyle != "string" || !bi.has(e.outputStyle)) && n.push(
676
698
  r(
677
699
  "invalid_value_format_duration_style",
678
700
  "Duration format outputStyle must be compact, digital, or long.",
@@ -689,20 +711,20 @@ function B(e, t, n) {
689
711
  )
690
712
  );
691
713
  }
692
- const mi = /* @__PURE__ */ new Set([
714
+ const yi = /* @__PURE__ */ new Set([
693
715
  "additive",
694
716
  "non_additive",
695
717
  "ratio_of_sums",
696
718
  "weighted",
697
719
  "pre_aggregated",
698
720
  "snapshot"
699
- ]), fi = /* @__PURE__ */ new Set([
721
+ ]), vi = /* @__PURE__ */ new Set([
700
722
  "default",
701
723
  "symmetric_aggregate",
702
724
  "aggregate_then_join",
703
725
  "weighted"
704
726
  ]);
705
- function gi(e, t, n) {
727
+ function Si(e, t, n) {
706
728
  if (!e || !f(e)) {
707
729
  n.push(
708
730
  r(
@@ -714,7 +736,7 @@ function gi(e, t, n) {
714
736
  return;
715
737
  }
716
738
  if (e.kind === "field") {
717
- y(e.field, `${t}.field`, n, { required: !0 }), ye(e.aggregate, `${t}.aggregate`, n);
739
+ y(e.field, `${t}.field`, n, { required: !0 }), ve(e.aggregate, `${t}.aggregate`, n);
718
740
  return;
719
741
  }
720
742
  n.push(
@@ -725,7 +747,7 @@ function gi(e, t, n) {
725
747
  )
726
748
  );
727
749
  }
728
- function ve(e) {
750
+ function Se(e) {
729
751
  const t = [];
730
752
  if (!f(e))
731
753
  return t.push(
@@ -752,19 +774,19 @@ function ve(e) {
752
774
  "Derived field needs a label.",
753
775
  "label"
754
776
  )
755
- ), li.has(e.resultRole) || t.push(
777
+ ), fi.has(e.resultRole) || t.push(
756
778
  r(
757
779
  "invalid_derived_field_role",
758
780
  "Derived field resultRole must be measure, dimension, date, id, or unknown.",
759
781
  "resultRole"
760
782
  )
761
- ), it.has(e.dataType) || t.push(
783
+ ), st.has(e.dataType) || t.push(
762
784
  r(
763
785
  "invalid_derived_field_data_type",
764
786
  "Derived field dataType must be string, number, boolean, date, datetime, or unknown.",
765
787
  "dataType"
766
788
  )
767
- ), di.has(e.computeStage) || t.push(
789
+ ), gi.has(e.computeStage) || t.push(
768
790
  r(
769
791
  "invalid_derived_field_compute_stage",
770
792
  "Derived field computeStage must be row or aggregate.",
@@ -788,11 +810,11 @@ function ve(e) {
788
810
  "Row-stage measure derived fields must declare defaultAggregate so row results have explicit rollup semantics.",
789
811
  "defaultAggregate"
790
812
  )
791
- ), ye(
813
+ ), ve(
792
814
  e.defaultAggregate,
793
815
  "defaultAggregate",
794
816
  t
795
- ), e.aggregationBehavior !== void 0 && !mi.has(
817
+ ), e.aggregationBehavior !== void 0 && !yi.has(
796
818
  e.aggregationBehavior
797
819
  ) && t.push(
798
820
  r(
@@ -800,7 +822,7 @@ function ve(e) {
800
822
  "Derived field aggregationBehavior is not supported.",
801
823
  "aggregationBehavior"
802
824
  )
803
- ), e.aggregationStrategy !== void 0 && !fi.has(
825
+ ), e.aggregationStrategy !== void 0 && !vi.has(
804
826
  e.aggregationStrategy
805
827
  ) && t.push(
806
828
  r(
@@ -837,13 +859,13 @@ function ve(e) {
837
859
  );
838
860
  return;
839
861
  }
840
- gi(
862
+ Si(
841
863
  a,
842
864
  `inputs.${o}`,
843
865
  t
844
866
  );
845
867
  }), m(e.expression) && f(e.inputs)) {
846
- const o = ai(
868
+ const o = ui(
847
869
  e.expression
848
870
  ), a = new Set(o), s = Object.keys(e.inputs).filter(
849
871
  (l) => m(l)
@@ -873,7 +895,7 @@ function ve(e) {
873
895
  "Derived field computation metadata cannot own temporal bucket presentation; declare grain and format on the grouped field.",
874
896
  "format"
875
897
  )
876
- ) : nt(n, "format", t), e.tags !== void 0 && (!Array.isArray(e.tags) || e.tags.some((o) => !m(o))) && t.push(
898
+ ) : rt(n, "format", t), e.tags !== void 0 && (!Array.isArray(e.tags) || e.tags.some((o) => !m(o))) && t.push(
877
899
  r(
878
900
  "invalid_derived_field_tags",
879
901
  "Derived field tags must be non-empty strings.",
@@ -881,55 +903,55 @@ function ve(e) {
881
903
  )
882
904
  ), { ok: t.length === 0, errors: t, warnings: [] };
883
905
  }
884
- const M = i.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), [hi, _i, bi, yi] = he.options, at = i.union([
885
- hi.innerType().omit({ locale: !0 }).strict().superRefine((e, t) => {
906
+ const D = i.string().min(1).refine((e) => e.trim().length > 0, "Must not be blank."), [Ii, wi, ki, Ai] = _e.options, lt = i.union([
907
+ Ii.innerType().omit({ locale: !0 }).strict().superRefine((e, t) => {
886
908
  const { minimumFractionDigits: n = 0, maximumFractionDigits: o = 2 } = e;
887
909
  (![n, o].every((a) => Number.isInteger(a) && a >= 0 && a <= 20) || n > o) && t.addIssue({
888
910
  code: "custom",
889
911
  message: "Fraction digits must be integers from 0 to 20 with minimum <= maximum."
890
912
  }), e.scale !== void 0 && !Number.isFinite(e.scale) && t.addIssue({ code: "custom", message: "Scale must be finite." });
891
913
  }),
892
- _i.strict(),
893
- bi.strict(),
894
- yi.strict()
895
- ]), Ne = i.union([
896
- at,
897
- X
898
- ]), Se = i.union([
899
- _e.extend({ domainId: M, datasetName: M }).strict(),
900
- Qe.extend({ connectionId: M, tableName: M }).strict()
901
- ]), ot = Xe.extend({
902
- name: M,
903
- source: Se.optional()
904
- }).strict(), Ie = Je.extend({
905
- format: at.optional(),
914
+ wi.strict(),
915
+ ki.strict(),
916
+ Ai.strict()
917
+ ]), Ce = i.union([
918
+ lt,
919
+ Z
920
+ ]), Ie = i.union([
921
+ be.extend({ domainId: D, datasetName: D }).strict(),
922
+ Je.extend({ connectionId: D, tableName: D }).strict()
923
+ ]), dt = tt.extend({
924
+ name: D,
925
+ source: Ie.optional()
926
+ }).strict(), we = nt.extend({
927
+ format: lt.optional(),
906
928
  inputs: i.record(
907
929
  i.object({
908
930
  kind: i.literal("field"),
909
- field: ot,
931
+ field: dt,
910
932
  aggregate: R.optional()
911
933
  }).strict()
912
934
  )
913
935
  }).strict().superRefine((e, t) => {
914
936
  var n;
915
- for (const o of ve(e).errors)
937
+ for (const o of Se(e).errors)
916
938
  t.addIssue({
917
939
  code: "custom",
918
940
  path: ((n = o.path) == null ? void 0 : n.split(".")) ?? [],
919
941
  message: o.message
920
942
  });
921
- }), vi = ot.extend({
922
- derivedField: Ie.optional()
943
+ }), xi = dt.extend({
944
+ derivedField: we.optional()
923
945
  }).strict();
924
946
  function ke(e) {
925
947
  return typeof e == "string" ? e.trim().toLowerCase() : "";
926
948
  }
927
- function Si(e) {
949
+ function Fi(e) {
928
950
  return String(
929
951
  e.column_name || e.name || e.qualifiedFieldName || ""
930
952
  );
931
953
  }
932
- function Ii(e) {
954
+ function Ri(e) {
933
955
  return Array.from(
934
956
  new Set(
935
957
  [e.column_name, e.name, e.qualifiedFieldName, e.alias].filter(
@@ -938,11 +960,11 @@ function Ii(e) {
938
960
  )
939
961
  );
940
962
  }
941
- function st(e) {
942
- const t = lt(e);
943
- return t ? Ai(t) ? "number" : t.includes("timestamp") || t.includes("datetime") || t.startsWith("time") ? "datetime" : t.includes("date") ? "date" : t.includes("bool") ? "boolean" : "string" : "unknown";
963
+ function Ae(e) {
964
+ const t = ct(e);
965
+ return t ? Mi(t) ? "number" : t.includes("timestamp") || t.includes("datetime") || t.startsWith("time") ? "datetime" : t.includes("date") ? "date" : t.includes("bool") ? "boolean" : "string" : "unknown";
944
966
  }
945
- const ne = /* @__PURE__ */ new Map([
967
+ const ae = /* @__PURE__ */ new Map([
946
968
  // Integer families (PostgreSQL, ClickHouse, DuckDB, MySQL).
947
969
  ["int", "integer"],
948
970
  ["uint", "integer"],
@@ -970,76 +992,76 @@ const ne = /* @__PURE__ */ new Map([
970
992
  ["money", null],
971
993
  ["currency", null],
972
994
  ["percent", null]
973
- ]), ki = ["int", "uint", "decimal", "float"];
974
- function wi(e) {
995
+ ]), Ti = ["int", "uint", "decimal", "float"];
996
+ function Di(e) {
975
997
  return e.length > 0 && Array.from(e).every((t) => t >= "0" && t <= "9");
976
998
  }
977
- function rt(e) {
999
+ function ut(e) {
978
1000
  const t = e.split(/[\s(]/, 1)[0] || "";
979
- if (ne.has(t))
980
- return { numeric: !0, kind: ne.get(t) ?? null };
981
- const n = ki.find(
982
- (o) => t.startsWith(o) && wi(t.slice(o.length))
1001
+ if (ae.has(t))
1002
+ return { numeric: !0, kind: ae.get(t) ?? null };
1003
+ const n = Ti.find(
1004
+ (o) => t.startsWith(o) && Di(t.slice(o.length))
983
1005
  );
984
- return n ? { numeric: !0, kind: ne.get(n) ?? null } : { numeric: !1, kind: null };
1006
+ return n ? { numeric: !0, kind: ae.get(n) ?? null } : { numeric: !1, kind: null };
985
1007
  }
986
- function Ai(e) {
987
- return rt(e).numeric;
1008
+ function Mi(e) {
1009
+ return ut(e).numeric;
988
1010
  }
989
- function xi(e) {
990
- return rt(lt(e)).kind;
1011
+ function Ei(e) {
1012
+ return ut(ct(e)).kind;
991
1013
  }
992
- function lt(e) {
1014
+ function ct(e) {
993
1015
  let t = ke(e), n = "";
994
1016
  for (; t && t !== n; )
995
- n = t, t = je(t, "nullable"), t = je(t, "lowcardinality");
1017
+ n = t, t = $e(t, "nullable"), t = $e(t, "lowcardinality");
996
1018
  return t;
997
1019
  }
998
- function je(e, t) {
1020
+ function $e(e, t) {
999
1021
  const n = `${t}(`;
1000
1022
  return !e.startsWith(n) || !e.endsWith(")") ? e : e.slice(n.length, -1).trim();
1001
1023
  }
1002
- function Fi(e) {
1003
- const t = st(e);
1024
+ function Ni(e) {
1025
+ const t = Ae(e);
1004
1026
  return t === "date" || t === "datetime";
1005
1027
  }
1006
- function dt(e) {
1007
- return Fi(e.dataType || e.data_type);
1028
+ function pt(e) {
1029
+ return Ni(e.dataType || e.data_type);
1008
1030
  }
1009
- function ut(e) {
1010
- const t = ct(e);
1031
+ function mt(e) {
1032
+ const t = ft(e);
1011
1033
  return t === "id" || t === "row_id";
1012
1034
  }
1013
- function $e(e) {
1014
- const t = ct(e);
1015
- return ut(e) || t.endsWith("_id") || t.endsWith("_key") || t.endsWith("_number");
1035
+ function Oe(e) {
1036
+ const t = ft(e);
1037
+ return mt(e) || t.endsWith("_id") || t.endsWith("_key") || t.endsWith("_number");
1016
1038
  }
1017
- function ct(e) {
1039
+ function ft(e) {
1018
1040
  return ke(
1019
- Si(e) || e.name || e.alias
1041
+ Fi(e) || e.name || e.alias
1020
1042
  ).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
1021
1043
  }
1022
- function pt(e, t = {}) {
1044
+ function gt(e, t = {}) {
1023
1045
  const n = ke(e.role);
1024
- return n === "metric" || n === "measure" ? !t.excludeIdentifiers || !$e(e) : n === "groupby" || n === "dimension" || n === "date" || n === "id" ? !1 : st(
1046
+ return n === "metric" || n === "measure" ? !t.excludeIdentifiers || !Oe(e) : n === "groupby" || n === "dimension" || n === "date" || n === "id" ? !1 : Ae(
1025
1047
  e.dataType || e.data_type
1026
- ) === "number" && (!t.excludeIdentifiers || !$e(e));
1048
+ ) === "number" && (!t.excludeIdentifiers || !Oe(e));
1027
1049
  }
1028
- function ha(e) {
1029
- return !pt(e) && !dt(e);
1050
+ function Ea(e) {
1051
+ return !gt(e) && !pt(e);
1030
1052
  }
1031
- function _a(e) {
1053
+ function Na(e) {
1032
1054
  const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
1033
1055
  for (const a of e) {
1034
- if (ut(a))
1056
+ if (mt(a))
1035
1057
  continue;
1036
- const s = Ii(a);
1058
+ const s = Ri(a);
1037
1059
  if (s.length !== 0) {
1038
- if (dt(a)) {
1060
+ if (pt(a)) {
1039
1061
  s.forEach((l) => n.add(l));
1040
1062
  continue;
1041
1063
  }
1042
- if (pt(a, { excludeIdentifiers: !0 })) {
1064
+ if (gt(a, { excludeIdentifiers: !0 })) {
1043
1065
  s.forEach((l) => t.add(l));
1044
1066
  continue;
1045
1067
  }
@@ -1052,8 +1074,8 @@ function _a(e) {
1052
1074
  validDimensionCandidates: Array.from(o).sort()
1053
1075
  };
1054
1076
  }
1055
- const D = 16 * 1024;
1056
- function V(e) {
1077
+ const M = 16 * 1024;
1078
+ function H(e) {
1057
1079
  const t = /^([+-]?)(?:(\d+)(?:\.(\d*))?|\.(\d+))(?:[eE]([+-]?\d+))?$/.exec(e);
1058
1080
  return t ? {
1059
1081
  sign: t[1],
@@ -1062,44 +1084,44 @@ function V(e) {
1062
1084
  exponent: Number(t[5] ?? "0")
1063
1085
  } : null;
1064
1086
  }
1065
- function Ce(e) {
1087
+ function Pe(e) {
1066
1088
  const { sign: t, whole: n, fraction: o = "", exponent: a } = e, s = (n + o).replace(/^0+/, ""), l = s.replace(/0+$/, ""), d = a - o.length + s.length - l.length;
1067
1089
  return !Number.isSafeInteger(a) || !Number.isSafeInteger(d) ? null : l ? `${t === "-" ? "-" : ""}${l}e${d}` : "0";
1068
1090
  }
1069
- function Ri(e) {
1070
- const t = V(e);
1091
+ function ji(e) {
1092
+ const t = H(e);
1071
1093
  if (!t) return null;
1072
1094
  const n = t.sign === "+" ? e.slice(1) : e, o = Number(e);
1073
1095
  if (!Number.isFinite(o)) return n;
1074
- const a = Ce(t), s = V(String(o));
1075
- return a !== null && s !== null && a === Ce(s) ? o : n;
1096
+ const a = Pe(t), s = H(String(o));
1097
+ return a !== null && s !== null && a === Pe(s) ? o : n;
1076
1098
  }
1077
- function Ti(e) {
1078
- if (e.length > D)
1099
+ function Ci(e) {
1100
+ if (e.length > M)
1079
1101
  throw new RangeError("Exact numeric text exceeds 16 KiB.");
1080
- const t = V(e);
1102
+ const t = H(e);
1081
1103
  if (!t) throw new TypeError("Expected finite decimal text.");
1082
1104
  const { sign: n, whole: o, fraction: a, exponent: s } = t, l = `${n}${o || "0"}${a ? `.${a}` : ""}`;
1083
1105
  return x(`${l}e${s}`);
1084
1106
  }
1085
1107
  function x(e) {
1086
- if (e.length > D)
1108
+ if (e.length > M)
1087
1109
  throw new RangeError("Exact numeric text exceeds 16 KiB.");
1088
- const t = V(e);
1110
+ const t = H(e);
1089
1111
  if (!t || t.whole === "" || t.fraction === "")
1090
1112
  throw new TypeError("Expected finite decimal text.");
1091
1113
  const { sign: n, whole: o, fraction: a = "", exponent: s } = t;
1092
- if (!Number.isSafeInteger(s) || Math.abs(s) > D)
1114
+ if (!Number.isSafeInteger(s) || Math.abs(s) > M)
1093
1115
  throw new RangeError("Exact numeric exponent exceeds the text budget.");
1094
1116
  const l = o + a, d = o.length + s;
1095
- if (Math.max(l.length, d) + Math.max(0, -d) + 3 > D)
1117
+ if (Math.max(l.length, d) + Math.max(0, -d) + 3 > M)
1096
1118
  throw new RangeError("Normalized exact numeric text exceeds 16 KiB.");
1097
1119
  let p;
1098
1120
  d <= 0 ? p = `0.${"0".repeat(-d)}${l}` : d >= l.length ? p = l + "0".repeat(d - l.length) : p = `${l.slice(0, d)}.${l.slice(d)}`;
1099
1121
  const [u, _ = ""] = p.split("."), b = u.replace(/^0+(?=\d)/, ""), S = _.replace(/0+$/, ""), h = b + (S ? `.${S}` : "");
1100
1122
  return n === "-" && h !== "0" ? `-${h}` : h;
1101
1123
  }
1102
- function mt(e, t) {
1124
+ function ht(e, t) {
1103
1125
  const n = e.startsWith("-"), o = t.startsWith("-");
1104
1126
  if (n !== o) return n ? -1 : 1;
1105
1127
  const [a, s = ""] = (n ? e.slice(1) : e).split("."), [l, d = ""] = (o ? t.slice(1) : t).split(".");
@@ -1110,7 +1132,7 @@ function mt(e, t) {
1110
1132
  }
1111
1133
  return c === 0 ? 0 : n ? -c : c;
1112
1134
  }
1113
- function ba(e, t) {
1135
+ function ja(e, t) {
1114
1136
  if (typeof t == "number" && !Number.isFinite(t))
1115
1137
  throw new TypeError("Numeric scale must be finite.");
1116
1138
  const n = [e, x(String(t))].map((s) => {
@@ -1119,34 +1141,34 @@ function ba(e, t) {
1119
1141
  }), o = n[0].coefficient * n[1].coefficient, a = n[0].digits + n[1].digits;
1120
1142
  return x(`${o}e-${a}`);
1121
1143
  }
1122
- function Mi(e) {
1144
+ function $i(e) {
1123
1145
  try {
1124
1146
  return x(e) === e;
1125
1147
  } catch {
1126
1148
  return !1;
1127
1149
  }
1128
1150
  }
1129
- const ft = i.object({
1151
+ const _t = i.object({
1130
1152
  kind: i.literal("exact_number"),
1131
1153
  type: i.enum(["integer", "decimal"]),
1132
- value: i.string().max(D).refine(Mi, "Expected canonical decimal text.")
1154
+ value: i.string().max(M).refine($i, "Expected canonical decimal text.")
1133
1155
  }).strict().superRefine((e, t) => {
1134
1156
  e.type === "integer" && e.value.includes(".") && t.addIssue({ code: "custom", path: ["value"], message: "An integer cannot have fractional digits." });
1135
- }), L = i.union([
1157
+ }), U = i.union([
1136
1158
  i.null(),
1137
1159
  i.string(),
1138
1160
  i.boolean(),
1139
1161
  i.number().finite(),
1140
- ft
1162
+ _t
1141
1163
  ]);
1142
- function Di(e, t) {
1143
- return ft.parse({ kind: "exact_number", type: t, value: x(e) });
1164
+ function Oi(e, t) {
1165
+ return _t.parse({ kind: "exact_number", type: t, value: x(e) });
1144
1166
  }
1145
- function H(e) {
1167
+ function G(e) {
1146
1168
  return typeof e == "object" && e !== null && "kind" in e && e.kind === "exact_number" && "type" in e && (e.type === "integer" || e.type === "decimal") && "value" in e && typeof e.value == "string";
1147
1169
  }
1148
- function ya(e) {
1149
- const t = xi(e.nativeDataType);
1170
+ function Ca(e) {
1171
+ const t = Ei(e.nativeDataType);
1150
1172
  if (!t) throw new TypeError("Numeric result type is not established.");
1151
1173
  if (e.value === null) return null;
1152
1174
  if (t === "float") {
@@ -1156,12 +1178,12 @@ function ya(e) {
1156
1178
  }
1157
1179
  if (e.exactText === void 0)
1158
1180
  throw new TypeError("Exact numeric sidecar is required; rounded result values cannot substitute.");
1159
- return Di(e.exactText, t);
1181
+ return Oi(e.exactText, t);
1160
1182
  }
1161
- const we = i.string().uuid(), Ae = i.enum(["rows", "columns"]), Ei = i.enum(["member", "subtotal", "grand_total", "others"]), Ni = i.discriminatedUnion("kind", [
1162
- i.object({ kind: i.literal("value"), value: L }).strict(),
1163
- i.object({ kind: i.literal("others"), rankingId: we }).strict()
1164
- ]), F = i.array(i.object({ levelId: we, member: Ni }).strict()).readonly().superRefine((e, t) => {
1183
+ const xe = i.string().uuid(), Fe = i.enum(["rows", "columns"]), Pi = i.enum(["member", "subtotal", "grand_total", "others"]), Yi = i.discriminatedUnion("kind", [
1184
+ i.object({ kind: i.literal("value"), value: U }).strict(),
1185
+ i.object({ kind: i.literal("others"), rankingId: xe }).strict()
1186
+ ]), F = i.array(i.object({ levelId: xe, member: Yi }).strict()).readonly().superRefine((e, t) => {
1165
1187
  new Set(e.map((n) => n.levelId)).size !== e.length && t.addIssue({
1166
1188
  code: "custom",
1167
1189
  path: [],
@@ -1173,12 +1195,12 @@ const we = i.string().uuid(), Ae = i.enum(["rows", "columns"]), Ei = i.enum(["me
1173
1195
  path: [],
1174
1196
  message: "Others is terminal."
1175
1197
  });
1176
- }), va = i.object({
1198
+ }), $a = i.object({
1177
1199
  rowPath: F,
1178
1200
  columnPath: F,
1179
- measureId: we
1201
+ measureId: xe
1180
1202
  }).strict();
1181
- function gt(e) {
1203
+ function bt(e) {
1182
1204
  return JSON.stringify(
1183
1205
  e.map(({ levelId: t, member: n }) => [
1184
1206
  t,
@@ -1186,11 +1208,11 @@ function gt(e) {
1186
1208
  ])
1187
1209
  );
1188
1210
  }
1189
- const le = "SEMAPHOR_CALCULATED_FIELD", ji = "calculated_fields";
1190
- function $i(e) {
1211
+ const de = "SEMAPHOR_CALCULATED_FIELD", Bi = "calculated_fields";
1212
+ function qi(e) {
1191
1213
  return (e == null ? void 0 : e.sourceField) || (e == null ? void 0 : e.name) || "";
1192
1214
  }
1193
- const Ci = [
1215
+ const Li = [
1194
1216
  // Day granularity formats
1195
1217
  "MM-DD-YYYY",
1196
1218
  "YYYY-MM-DD",
@@ -1225,16 +1247,16 @@ const Ci = [
1225
1247
  // Custom format
1226
1248
  "custom"
1227
1249
  ];
1228
- function Sa(e) {
1250
+ function Oa(e) {
1229
1251
  return e.role === "metric" && "expression" in e && !!e.expression;
1230
1252
  }
1231
- function Ia(e) {
1253
+ function Pa(e) {
1232
1254
  return !!e.expression;
1233
1255
  }
1234
- function Oi(e) {
1235
- return !!(e && (e.calculationRepresentation || e.expression || e.derivedField || e.calculatedFieldOrigin || e.calculatedFormula || de(e)));
1256
+ function Ui(e) {
1257
+ return !!(e && (e.calculationRepresentation || e.expression || e.derivedField || e.calculatedFieldOrigin || e.calculatedFormula || ue(e)));
1236
1258
  }
1237
- function ht(e) {
1259
+ function yt(e) {
1238
1260
  var _, b, S;
1239
1261
  if (!e)
1240
1262
  return {
@@ -1245,11 +1267,11 @@ function ht(e) {
1245
1267
  legacyManual: !1
1246
1268
  };
1247
1269
  const t = e.fieldScope === "domain" ? "domain" : "local", n = ((_ = e.derivedField) == null ? void 0 : _.computeStage) || ((b = e.calculatedFormula) == null ? void 0 : b.computeStage), o = !e.calculatedFormula || Array.isArray(e.calculatedFormula.inputFields) && e.calculatedFormula.inputFields.every((h) => {
1248
- const P = h && $i(h);
1249
- return typeof P == "string" && !!P.trim();
1270
+ const Y = h && qi(h);
1271
+ return typeof Y == "string" && !!Y.trim();
1250
1272
  }), a = typeof e.expression == "string" && !!e.expression.trim() && o, s = e.calculationRepresentation;
1251
1273
  if (e.derivedField || s === "typed-derived") {
1252
- const h = e.derivedField !== void 0 && ve(e.derivedField).ok;
1274
+ const h = e.derivedField !== void 0 && Se(e.derivedField).ok;
1253
1275
  return {
1254
1276
  representation: "typed-derived",
1255
1277
  ownership: t,
@@ -1259,7 +1281,7 @@ function ht(e) {
1259
1281
  legacyManual: !1
1260
1282
  };
1261
1283
  }
1262
- if (!(!!s || Oi(e)))
1284
+ if (!(!!s || Ui(e)))
1263
1285
  return {
1264
1286
  representation: "physical",
1265
1287
  ownership: t,
@@ -1267,7 +1289,7 @@ function ht(e) {
1267
1289
  runtimeExecutable: !1,
1268
1290
  legacyManual: !1
1269
1291
  };
1270
- const d = n || (e.role === "groupby" || ((S = e.calculatedFieldOrigin) == null ? void 0 : S.role) === "groupby" ? "row" : void 0), c = t === "domain" || de(e) || e.fieldScope === "card" || e.fieldScope === "sheet" || e.fieldScope === "dashboard" ? "manual" : "inline-expression", p = s === "manual" || s === "inline-expression" ? s : c, u = (!s || s === "manual" || s === "inline-expression") && !(s === "inline-expression" && de(e));
1292
+ const d = n || (e.role === "groupby" || ((S = e.calculatedFieldOrigin) == null ? void 0 : S.role) === "groupby" ? "row" : void 0), c = t === "domain" || ue(e) || e.fieldScope === "card" || e.fieldScope === "sheet" || e.fieldScope === "dashboard" ? "manual" : "inline-expression", p = s === "manual" || s === "inline-expression" ? s : c, u = (!s || s === "manual" || s === "inline-expression") && !(s === "inline-expression" && ue(e));
1271
1293
  return {
1272
1294
  representation: p,
1273
1295
  ownership: t,
@@ -1277,38 +1299,75 @@ function ht(e) {
1277
1299
  legacyManual: p === "manual" && t === "local" && !d
1278
1300
  };
1279
1301
  }
1280
- function ka(e) {
1302
+ function Ya(e) {
1281
1303
  if (e.calculationRepresentation) return e;
1282
- const { representation: t } = ht(e);
1304
+ const { representation: t } = yt(e);
1283
1305
  return t === "physical" ? e : { ...e, calculationRepresentation: t };
1284
1306
  }
1285
- function wa(e) {
1286
- return ht(e).computeStage;
1307
+ function Ba(e) {
1308
+ return yt(e).computeStage;
1287
1309
  }
1288
- function Aa(e, t) {
1310
+ function qa(e, t) {
1289
1311
  return e === "aggregate" && t === "default";
1290
1312
  }
1291
- function xa(e) {
1313
+ function La(e) {
1292
1314
  var n, o;
1293
1315
  const t = e;
1294
1316
  return !!(t != null && t.expression && ((o = (n = t.calculatedFormula) == null ? void 0 : n.inputFields) != null && o.length));
1295
1317
  }
1296
- function Fa(e) {
1297
- return !!(e && (e.entityName === le || e.entityId === le));
1318
+ function Ua(e) {
1319
+ return !!(e && (e.entityName === de || e.entityId === de));
1298
1320
  }
1299
- function de(e) {
1321
+ function ue(e) {
1300
1322
  return e ? [e.entityName, e.entityId, e.qualifiedEntityName].some(
1301
- (t) => t === le || t === ji
1323
+ (t) => t === de || t === Bi
1302
1324
  ) : !1;
1303
1325
  }
1304
- var Yi = /* @__PURE__ */ ((e) => (e.SUBTOTAL = "__SUBTOTAL__", e.TOTAL = "__TOTAL__", e.ALL = "__ALL__", e))(Yi || {});
1305
- const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1306
- Pi.innerType().strict(),
1307
- Bi.extend({ type: i.literal("date") }).strict(),
1308
- qi.strict(),
1309
- Li.strict(),
1310
- X
1311
- ]), v = i.string().min(1), Oe = i.enum(["groupby", "metric", "sortby", "pivotby", "detail"]), _t = i.enum([
1326
+ var Vi = /* @__PURE__ */ ((e) => (e.SUBTOTAL = "__SUBTOTAL__", e.TOTAL = "__TOTAL__", e.ALL = "__ALL__", e))(Vi || {});
1327
+ function Va(e) {
1328
+ return typeof e == "object" && e !== null && e.mode === "last" && e.relativeTo === "latest_data";
1329
+ }
1330
+ function Hi(e) {
1331
+ return e === "between" || e === "not between";
1332
+ }
1333
+ const q = i.enum(["day", "week", "month", "quarter", "year"]), Gi = i.enum(["minute", "hour"]), Ye = i.number().int().positive(), Be = i.number().int(), zi = i.union([
1334
+ i.object({
1335
+ mode: i.literal("last"),
1336
+ n: Ye,
1337
+ unit: Gi,
1338
+ complete: i.literal(!1).optional(),
1339
+ relativeTo: i.literal("latest_data").optional()
1340
+ }).strict(),
1341
+ i.object({
1342
+ mode: i.literal("last"),
1343
+ n: Ye,
1344
+ unit: q,
1345
+ complete: i.boolean().optional(),
1346
+ relativeTo: i.literal("latest_data").optional()
1347
+ }).strict(),
1348
+ i.object({
1349
+ mode: i.literal("this"),
1350
+ unit: q,
1351
+ toDate: i.boolean().optional(),
1352
+ boundary: i.enum(["first_day", "last_day"]).optional()
1353
+ }).strict().refine((e) => e.boundary === void 0 || e.unit === "month", {
1354
+ message: 'A month boundary requires unit "month".',
1355
+ path: ["boundary"]
1356
+ }),
1357
+ i.object({ mode: i.literal("previous"), unit: q }).strict(),
1358
+ i.object({
1359
+ mode: i.literal("between"),
1360
+ unit: q,
1361
+ from: Be,
1362
+ to: Be
1363
+ }).strict()
1364
+ ]), [Wi, Ki, Qi, Xi] = _e.options, Zi = i.union([
1365
+ Wi.innerType().strict(),
1366
+ Ki.extend({ type: i.literal("date") }).strict(),
1367
+ Qi.strict(),
1368
+ Xi.strict(),
1369
+ Z
1370
+ ]), v = i.string().min(1), qe = i.enum(["groupby", "metric", "sortby", "pivotby", "detail"]), vt = i.enum([
1312
1371
  "table",
1313
1372
  "view",
1314
1373
  "materialized view",
@@ -1317,7 +1376,7 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1317
1376
  "dataset",
1318
1377
  "url",
1319
1378
  "upload"
1320
- ]), ae = i.object({
1379
+ ]), oe = i.object({
1321
1380
  connectionId: v,
1322
1381
  connectionType: i.enum([
1323
1382
  "GoogleSheets",
@@ -1334,7 +1393,7 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1334
1393
  "API",
1335
1394
  "none"
1336
1395
  ]),
1337
- type: _t,
1396
+ type: vt,
1338
1397
  name: v,
1339
1398
  // Grounded relationship plans retain semantic identity and display metadata.
1340
1399
  // SQL stays server-resolved; it is not accepted inside a join entity.
@@ -1357,7 +1416,7 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1357
1416
  "duckdb",
1358
1417
  "mssql"
1359
1418
  ]).optional()
1360
- }).strict(), G = i.lazy(
1419
+ }).strict(), z = i.lazy(
1361
1420
  () => i.object({
1362
1421
  id: v,
1363
1422
  name: v,
@@ -1368,28 +1427,28 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1368
1427
  dataType: v,
1369
1428
  entityId: v,
1370
1429
  entityName: v,
1371
- entityType: _t,
1430
+ entityType: vt,
1372
1431
  alias: i.string().optional(),
1373
1432
  sourceField: i.string().optional(),
1374
- source: Se.optional(),
1433
+ source: Ie.optional(),
1375
1434
  nativeDataType: i.string().optional(),
1376
1435
  description: i.string().optional(),
1377
1436
  qualifiedEntityName: i.string().optional(),
1378
- dateFormat: i.enum(Ci).optional(),
1437
+ dateFormat: i.enum(Li).optional(),
1379
1438
  customFormat: i.string().optional(),
1380
- granularity: U.optional(),
1381
- role: Oe.optional(),
1439
+ granularity: V.optional(),
1440
+ role: qe.optional(),
1382
1441
  calculationRepresentation: i.enum(["inline-expression", "manual", "typed-derived"]).optional(),
1383
- calculatedFieldOrigin: i.object({ id: v, role: Oe.optional() }).strict().optional(),
1442
+ calculatedFieldOrigin: i.object({ id: v, role: qe.optional() }).strict().optional(),
1384
1443
  aggregateOrigin: i.enum(["default", "explicit"]).optional(),
1385
1444
  labelOrigin: i.enum(["semantic", "override"]).optional(),
1386
1445
  formatOrigin: i.enum(["semantic", "override"]).optional(),
1387
1446
  expression: i.string().optional(),
1388
- derivedField: Ie.optional(),
1389
- format: Ui.optional(),
1447
+ derivedField: we.optional(),
1448
+ format: Zi.optional(),
1390
1449
  semanticTemporalPresentation: i.object({
1391
- granularity: U,
1392
- format: X
1450
+ granularity: V,
1451
+ format: Z
1393
1452
  }).strict().optional(),
1394
1453
  aggregate: R.optional(),
1395
1454
  fieldScope: i.enum(["card", "sheet", "dashboard", "domain"]).optional(),
@@ -1404,20 +1463,20 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1404
1463
  "scale",
1405
1464
  "custom"
1406
1465
  ]),
1407
- inputFields: i.array(G),
1466
+ inputFields: i.array(z),
1408
1467
  constant: i.number().finite().optional(),
1409
1468
  computeStage: i.enum(["row", "aggregate"]).optional()
1410
1469
  }).strict().optional()
1411
1470
  }).strict()
1412
- ), Vi = i.union([
1471
+ ), Ji = i.union([
1413
1472
  i.string(),
1414
1473
  i.number().finite(),
1415
1474
  i.boolean(),
1416
1475
  i.date(),
1417
1476
  i.null()
1418
- ]), Hi = i.object({
1477
+ ]), en = i.object({
1419
1478
  id: v,
1420
- field: G,
1479
+ field: z,
1421
1480
  operator: i.enum([
1422
1481
  "=",
1423
1482
  "!=",
@@ -1437,35 +1496,49 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1437
1496
  "isNull",
1438
1497
  "isNotNull"
1439
1498
  ]),
1440
- value: i.union([Vi, i.array(i.string()), i.array(i.number().finite())]),
1499
+ value: i.union([Ji, i.array(i.string()), i.array(i.number().finite())]),
1441
1500
  label: i.string().optional(),
1442
- temporalBucket: re.optional()
1501
+ temporalBucket: le.optional(),
1502
+ relativeMeta: zi.optional(),
1503
+ latestValue: i.literal(!0).optional()
1443
1504
  }).strict().superRefine((e, t) => {
1444
1505
  const { operator: n, value: o } = e;
1445
- (n === "between" || n === "not between") && (!Array.isArray(o) || o.length !== 2) && t.addIssue({
1506
+ if ((n === "between" || n === "not between") && (!Array.isArray(o) || o.length !== 2) && t.addIssue({
1446
1507
  code: "custom",
1447
1508
  path: ["value"],
1448
1509
  message: "Between requires two endpoints."
1449
- }), (n === "in" || n === "not in") && !Array.isArray(o) && t.addIssue({
1510
+ }), e.relativeMeta && !Hi(n) && t.addIssue({
1511
+ code: "custom",
1512
+ path: ["relativeMeta"],
1513
+ message: "A relative date requires between or not between."
1514
+ }), e.latestValue) {
1515
+ const s = [e.field.nativeDataType, e.field.dataType].map((l) => Ae(l)).some((l) => l === "date" || l === "datetime");
1516
+ (n !== "=" || !s) && t.addIssue({
1517
+ code: "custom",
1518
+ path: ["latestValue"],
1519
+ message: "Latest value requires = on a date or timestamp field."
1520
+ });
1521
+ }
1522
+ (n === "in" || n === "not in") && !Array.isArray(o) && t.addIssue({
1450
1523
  code: "custom",
1451
1524
  path: ["value"],
1452
1525
  message: "Membership requires an array."
1453
1526
  });
1454
- }), bt = i.lazy(
1527
+ }), St = i.lazy(
1455
1528
  () => i.object({
1456
1529
  id: v,
1457
1530
  logicalOperator: i.enum(["AND", "OR"]),
1458
1531
  negate: i.boolean(),
1459
- conditions: i.array(Hi),
1460
- groups: i.array(bt)
1532
+ conditions: i.array(en),
1533
+ groups: i.array(St)
1461
1534
  }).strict()
1462
- ), Gi = i.object({
1463
- baseEntity: ae,
1535
+ ), tn = i.object({
1536
+ baseEntity: oe,
1464
1537
  joins: i.array(
1465
1538
  i.object({
1466
1539
  id: v,
1467
- source: ae,
1468
- target: ae,
1540
+ source: oe,
1541
+ target: oe,
1469
1542
  joinType: i.enum(["INNER", "LEFT", "RIGHT", "FULL"]),
1470
1543
  sequence: i.number().int().nonnegative(),
1471
1544
  relationshipId: i.string().optional(),
@@ -1479,8 +1552,8 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1479
1552
  keys: i.array(
1480
1553
  i.object({
1481
1554
  id: i.string().optional(),
1482
- source: G,
1483
- target: G,
1555
+ source: z,
1556
+ target: z,
1484
1557
  operator: i.enum(["=", "!=", ">", ">=", "<", "<="])
1485
1558
  }).strict()
1486
1559
  ).min(1)
@@ -1488,14 +1561,14 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1488
1561
  ).min(1)
1489
1562
  }).strict()
1490
1563
  )
1491
- }).strict(), zi = i.object({
1492
- axis: Ae,
1564
+ }).strict(), nn = i.object({
1565
+ axis: Fe,
1493
1566
  levelId: i.string().uuid().optional(),
1494
1567
  // Persisted table preferences are edited through Immer; runtime paths remain readonly.
1495
1568
  oppositePath: F.transform((e) => [...e]).optional()
1496
- }).strict(), k = i.string().min(1), Ki = i.array(
1569
+ }).strict(), w = i.string().min(1), an = i.array(
1497
1570
  i.enum(["body", "header", "footer", "subtotal", "grandTotal"])
1498
- ), Qi = i.enum(["normal", "medium", "semibold", "bold"]), Wi = i.enum(["none", "underline", "line-through"]), yt = i.object({
1571
+ ), on = i.enum(["normal", "medium", "semibold", "bold"]), sn = i.enum(["none", "underline", "line-through"]), It = i.object({
1499
1572
  version: i.literal(1),
1500
1573
  rules: i.array(
1501
1574
  i.object({
@@ -1504,11 +1577,11 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1504
1577
  enabled: i.boolean().optional(),
1505
1578
  target: i.object({
1506
1579
  level: i.enum(["cell", "row"]),
1507
- matrix: zi.optional(),
1508
- columnIds: i.array(k).optional(),
1509
- conditionColumnId: k.optional(),
1510
- applyToColumnIds: i.array(k).optional(),
1511
- tableParts: Ki.optional(),
1580
+ matrix: nn.optional(),
1581
+ columnIds: i.array(w).optional(),
1582
+ conditionColumnId: w.optional(),
1583
+ applyToColumnIds: i.array(w).optional(),
1584
+ tableParts: an.optional(),
1512
1585
  rowRoles: i.array(i.string()).optional(),
1513
1586
  depth: i.number().int().nonnegative().optional(),
1514
1587
  includeTotals: i.boolean().optional(),
@@ -1517,38 +1590,38 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1517
1590
  condition: i.discriminatedUnion("kind", [
1518
1591
  i.object({
1519
1592
  kind: i.literal("comparison"),
1520
- columnId: k,
1593
+ columnId: w,
1521
1594
  operator: i.enum(["eq", "neq", "gt", "gte", "lt", "lte"]),
1522
- value: L
1595
+ value: U
1523
1596
  }).strict(),
1524
1597
  i.object({
1525
1598
  kind: i.literal("between"),
1526
- columnId: k,
1527
- min: L,
1528
- max: L,
1599
+ columnId: w,
1600
+ min: U,
1601
+ max: U,
1529
1602
  inclusive: i.boolean().optional()
1530
1603
  }).strict(),
1531
1604
  i.object({
1532
1605
  kind: i.literal("blank"),
1533
- columnId: k,
1606
+ columnId: w,
1534
1607
  isBlank: i.boolean()
1535
1608
  }).strict(),
1536
1609
  i.object({
1537
1610
  kind: i.literal("contains"),
1538
- columnId: k,
1611
+ columnId: w,
1539
1612
  value: i.string(),
1540
1613
  caseSensitive: i.boolean().optional(),
1541
1614
  exact: i.boolean().optional()
1542
1615
  }).strict(),
1543
1616
  i.object({
1544
1617
  kind: i.literal("topBottom"),
1545
- columnId: k,
1618
+ columnId: w,
1546
1619
  direction: i.enum(["top", "bottom"]),
1547
1620
  count: i.number().int().positive()
1548
1621
  }).strict(),
1549
1622
  i.object({
1550
1623
  kind: i.literal("colorScale"),
1551
- columnId: k,
1624
+ columnId: w,
1552
1625
  range: i.enum(["auto", "manual"]),
1553
1626
  min: i.number().finite().optional(),
1554
1627
  mid: i.number().finite().optional(),
@@ -1561,7 +1634,7 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1561
1634
  }).strict(),
1562
1635
  i.object({
1563
1636
  kind: i.literal("dataBar"),
1564
- columnId: k,
1637
+ columnId: w,
1565
1638
  range: i.enum(["auto", "manual"]),
1566
1639
  min: i.number().finite().optional(),
1567
1640
  max: i.number().finite().optional(),
@@ -1572,39 +1645,39 @@ const [Pi, Bi, qi, Li] = he.options, Ui = i.union([
1572
1645
  style: i.object({
1573
1646
  backgroundColor: i.string().optional(),
1574
1647
  textColor: i.string().optional(),
1575
- fontWeight: Qi.optional(),
1648
+ fontWeight: on.optional(),
1576
1649
  italic: i.boolean().optional(),
1577
- textDecoration: Wi.optional(),
1650
+ textDecoration: sn.optional(),
1578
1651
  icon: i.enum(["arrowUp", "arrowDown", "warning", "check", "x"]).optional(),
1579
1652
  dataBar: i.object({ color: i.string(), showValue: i.boolean() }).strict().optional()
1580
1653
  }).strict().optional()
1581
1654
  }).strict()
1582
1655
  )
1583
1656
  }).strict();
1584
- function Ra(e, t) {
1657
+ function Ha(e, t) {
1585
1658
  const n = (s) => {
1586
- if (H(s)) return s.value;
1587
- const l = typeof s == "string" ? Ri(s.trim()) ?? ue(s) : ue(s);
1659
+ if (G(s)) return s.value;
1660
+ const l = typeof s == "string" ? ji(s.trim()) ?? ce(s) : ce(s);
1588
1661
  if (l === null) return null;
1589
1662
  try {
1590
- return Ti(String(l));
1663
+ return Ci(String(l));
1591
1664
  } catch {
1592
1665
  return null;
1593
1666
  }
1594
1667
  }, o = n(e), a = n(t);
1595
- return o === null || a === null ? null : mt(o, a);
1668
+ return o === null || a === null ? null : ht(o, a);
1596
1669
  }
1597
- function Ta(e, t, n) {
1598
- const o = Ji(e);
1670
+ function Ga(e, t, n) {
1671
+ const o = dn(e);
1599
1672
  if (o === null) return null;
1600
1673
  if (typeof o == "number" && typeof t == "number" && typeof n == "number") {
1601
- const h = en(o, t, n);
1674
+ const h = un(o, t, n);
1602
1675
  return { ratio: h, midpointComparison: Math.sign(h - 0.5) };
1603
1676
  }
1604
1677
  if ([t, n].some((h) => typeof h == "number" && !Number.isFinite(h))) return null;
1605
1678
  const a = [o, t, n].map((h) => {
1606
- const P = typeof h == "number" ? x(String(h)) : h.value, [Ct, Me = ""] = P.split(".");
1607
- return { coefficient: Ct + Me, scale: Me.length };
1679
+ const Y = typeof h == "number" ? x(String(h)) : h.value, [Yt, Ee = ""] = Y.split(".");
1680
+ return { coefficient: Yt + Ee, scale: Ee.length };
1608
1681
  }), s = Math.max(...a.map((h) => h.scale)), [l, d, c] = a.map(
1609
1682
  (h) => BigInt(h.coefficient) * 10n ** BigInt(s - h.scale)
1610
1683
  ), p = c - d, u = l - d;
@@ -1616,20 +1689,20 @@ function Ta(e, t, n) {
1616
1689
  const _ = u * 2n - p, b = _ < 0n ? -1 : _ > 0n ? 1 : 0;
1617
1690
  return { ratio: u <= 0n ? 0 : u >= p ? 1 : Number(u * 1000000000n / p) / 1e9, midpointComparison: b };
1618
1691
  }
1619
- function Ma(e) {
1692
+ function za(e) {
1620
1693
  return !!e && typeof e == "object" && !Array.isArray(e);
1621
1694
  }
1622
- function Da(e) {
1695
+ function Wa(e) {
1623
1696
  return e.enabled !== !1;
1624
1697
  }
1625
- function Ea(e) {
1698
+ function Ka(e) {
1626
1699
  return e.kind === "topBottom" || e.kind === "colorScale" && e.range === "auto" || e.kind === "dataBar" && e.range === "auto";
1627
1700
  }
1628
- function Xi(e) {
1701
+ function rn(e) {
1629
1702
  return e.columnId;
1630
1703
  }
1631
- function Zi(e) {
1632
- const t = [Xi(e.condition)];
1704
+ function ln(e) {
1705
+ const t = [rn(e.condition)];
1633
1706
  return { validationRefs: [.../* @__PURE__ */ new Set([
1634
1707
  ...t,
1635
1708
  ...e.target.conditionColumnId === void 0 ? [] : [e.target.conditionColumnId],
@@ -1637,7 +1710,7 @@ function Zi(e) {
1637
1710
  ...e.target.applyToColumnIds ?? []
1638
1711
  ])], evaluationInputs: t };
1639
1712
  }
1640
- function ue(e) {
1713
+ function ce(e) {
1641
1714
  if (typeof e == "number")
1642
1715
  return Number.isFinite(e) ? e : null;
1643
1716
  if (typeof e == "string" && e.trim() !== "") {
@@ -1646,30 +1719,30 @@ function ue(e) {
1646
1719
  }
1647
1720
  return null;
1648
1721
  }
1649
- function Ji(e) {
1650
- return H(e) ? e : ue(e);
1722
+ function dn(e) {
1723
+ return G(e) ? e : ce(e);
1651
1724
  }
1652
- function Na(e) {
1725
+ function Qa(e) {
1653
1726
  const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
1654
1727
  for (const o of e)
1655
- H(o) ? n.add(o.value) : t.add(o);
1728
+ G(o) ? n.add(o.value) : t.add(o);
1656
1729
  return {
1657
- has: (o) => H(o) ? n.has(o.value) : t.has(o)
1730
+ has: (o) => G(o) ? n.has(o.value) : t.has(o)
1658
1731
  };
1659
1732
  }
1660
- function ja(e, t) {
1661
- return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) : mt(
1733
+ function Xa(e, t) {
1734
+ return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) : ht(
1662
1735
  typeof e == "number" ? x(String(e)) : e.value,
1663
1736
  typeof t == "number" ? x(String(t)) : t.value
1664
1737
  );
1665
1738
  }
1666
- function $a(e) {
1739
+ function Za(e) {
1667
1740
  return e == null || e === "";
1668
1741
  }
1669
- function en(e, t, n) {
1742
+ function un(e, t, n) {
1670
1743
  return !Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) ? 0 : n === t ? e >= n ? 1 : 0 : Math.max(0, Math.min(1, (e - t) / (n - t)));
1671
1744
  }
1672
- function tn(e) {
1745
+ function cn(e) {
1673
1746
  switch (e) {
1674
1747
  case "bold":
1675
1748
  return 700;
@@ -1683,91 +1756,91 @@ function tn(e) {
1683
1756
  return;
1684
1757
  }
1685
1758
  }
1686
- function Ca(e) {
1687
- return e ? vt({
1688
- fontWeight: tn(e.fontWeight),
1759
+ function Ja(e) {
1760
+ return e ? wt({
1761
+ fontWeight: cn(e.fontWeight),
1689
1762
  fontStyle: e.italic ? "italic" : void 0,
1690
1763
  color: e.textColor,
1691
1764
  backgroundColor: e.backgroundColor,
1692
1765
  textDecoration: e.textDecoration
1693
1766
  }) : {};
1694
1767
  }
1695
- function Oa(...e) {
1768
+ function eo(...e) {
1696
1769
  return Object.assign(
1697
1770
  {},
1698
- ...e.filter((t) => !!t).map(vt)
1771
+ ...e.filter((t) => !!t).map(wt)
1699
1772
  );
1700
1773
  }
1701
- function vt(e) {
1774
+ function wt(e) {
1702
1775
  return Object.fromEntries(
1703
1776
  Object.entries(e).filter(([, t]) => t !== void 0)
1704
1777
  );
1705
1778
  }
1706
- const I = i.string().uuid(), nn = i.string().min(1), an = i.number().int().positive().max(Number.MAX_SAFE_INTEGER), on = i.enum([
1779
+ const I = i.string().uuid(), pn = i.string().min(1), mn = i.number().int().positive().max(Number.MAX_SAFE_INTEGER), fn = i.enum([
1707
1780
  "SUM",
1708
1781
  "COUNT",
1709
1782
  "DISTINCT",
1710
1783
  "AVG",
1711
1784
  "MIN",
1712
1785
  "MAX"
1713
- ]), St = vi.omit({
1786
+ ]), kt = xi.omit({
1714
1787
  aggregate: !0
1715
- }), sn = {
1788
+ }), gn = {
1716
1789
  id: I,
1717
- field: St,
1718
- grain: U.optional()
1719
- }, ce = i.object(sn).strict(), rn = i.object({
1790
+ field: kt,
1791
+ grain: V.optional()
1792
+ }, pe = i.object(gn).strict(), hn = i.object({
1720
1793
  id: I,
1721
1794
  kind: i.literal("aggregate"),
1722
- field: St,
1723
- aggregate: on
1724
- }).strict(), ln = i.object({
1795
+ field: kt,
1796
+ aggregate: fn
1797
+ }).strict(), _n = i.object({
1725
1798
  id: I,
1726
1799
  kind: i.literal("calculated"),
1727
- definition: Ie
1728
- }).strict(), It = i.discriminatedUnion("kind", [rn, ln]), dn = i.discriminatedUnion("kind", [
1800
+ definition: we
1801
+ }).strict(), At = i.discriminatedUnion("kind", [hn, _n]), bn = i.discriminatedUnion("kind", [
1729
1802
  i.object({ kind: i.literal("member") }).strict(),
1730
1803
  i.object({
1731
1804
  kind: i.literal("measure"),
1732
1805
  measureId: I,
1733
1806
  oppositePath: F
1734
1807
  }).strict()
1735
- ]), un = {
1736
- axis: Ae,
1808
+ ]), yn = {
1809
+ axis: Fe,
1737
1810
  levelId: I,
1738
1811
  scope: i.discriminatedUnion("kind", [
1739
1812
  i.object({ kind: i.literal("level") }).strict(),
1740
1813
  i.object({ kind: i.literal("branch"), parent: F }).strict()
1741
1814
  ]),
1742
- target: dn,
1815
+ target: bn,
1743
1816
  direction: i.enum(["asc", "desc"]),
1744
1817
  nulls: i.enum(["first", "last"])
1745
- }, kt = i.object(un).strict(), cn = i.object({
1818
+ }, xt = i.object(yn).strict(), vn = i.object({
1746
1819
  id: I,
1747
- axis: Ae,
1820
+ axis: Fe,
1748
1821
  levelId: I,
1749
1822
  direction: i.enum(["top", "bottom"]),
1750
- count: an,
1823
+ count: mn,
1751
1824
  measureId: I,
1752
1825
  oppositePath: F,
1753
1826
  others: i.boolean()
1754
- }).strict(), wt = i.object({
1755
- source: Se,
1756
- rows: i.array(ce).min(1).readonly(),
1757
- columns: i.array(ce).readonly(),
1758
- measures: i.array(It).min(1).readonly(),
1759
- filters: bt.optional(),
1760
- joinPlan: Gi.optional(),
1761
- relationshipHint: i.object({ relationshipIds: i.array(nn).optional() }).strict().optional(),
1762
- sorts: i.array(kt).readonly(),
1763
- rankings: i.array(cn).readonly()
1827
+ }).strict(), Ft = i.object({
1828
+ source: Ie,
1829
+ rows: i.array(pe).min(1).readonly(),
1830
+ columns: i.array(pe).readonly(),
1831
+ measures: i.array(At).min(1).readonly(),
1832
+ filters: St.optional(),
1833
+ joinPlan: tn.optional(),
1834
+ relationshipHint: i.object({ relationshipIds: i.array(pn).optional() }).strict().optional(),
1835
+ sorts: i.array(xt).readonly(),
1836
+ rankings: i.array(vn).readonly()
1764
1837
  }).strict();
1765
- function At(e) {
1838
+ function Rt(e) {
1766
1839
  return JSON.stringify([
1767
1840
  e.axis,
1768
1841
  e.levelId,
1769
1842
  e.scope.kind,
1770
- e.scope.kind === "branch" ? gt(e.scope.parent) : null
1843
+ e.scope.kind === "branch" ? bt(e.scope.parent) : null
1771
1844
  ]);
1772
1845
  }
1773
1846
  function g(e, t, n) {
@@ -1776,7 +1849,7 @@ function g(e, t, n) {
1776
1849
  function A(e, t, n) {
1777
1850
  new Set(e).size !== e.length && g(t, n, "Duplicate identity.");
1778
1851
  }
1779
- function $(e, t, n, o, a, s = !1) {
1852
+ function C(e, t, n, o, a, s = !1) {
1780
1853
  n.length > e[t].length && g(o, a, "Path exceeds axis depth."), n.forEach((l, d) => {
1781
1854
  var c;
1782
1855
  if (l.levelId !== ((c = e[t][d]) == null ? void 0 : c.id) && g(o, [...a, d], "Path must be an ordered axis prefix."), l.member.kind === "others") {
@@ -1791,10 +1864,10 @@ function $(e, t, n, o, a, s = !1) {
1791
1864
  }
1792
1865
  });
1793
1866
  }
1794
- function xt(e, t, n, o) {
1795
- A(t.map(At), n, o), t.forEach((a, s) => {
1867
+ function Tt(e, t, n, o) {
1868
+ A(t.map(Rt), n, o), t.forEach((a, s) => {
1796
1869
  const l = [...o, s], d = e[a.axis].findIndex((c) => c.id === a.levelId);
1797
- if (d < 0 && g(n, l, "Sort level is not on its axis."), a.scope.kind === "branch" && ($(
1870
+ if (d < 0 && g(n, l, "Sort level is not on its axis."), a.scope.kind === "branch" && (C(
1798
1871
  e,
1799
1872
  a.axis,
1800
1873
  a.scope.parent,
@@ -1807,7 +1880,7 @@ function xt(e, t, n, o) {
1807
1880
  "Branch sort must name the immediate parent of its level."
1808
1881
  )), a.target.kind === "measure") {
1809
1882
  const c = a.target.measureId;
1810
- e.measures.some((p) => p.id === c) || g(n, l, "Unknown sort measure."), $(
1883
+ e.measures.some((p) => p.id === c) || g(n, l, "Unknown sort measure."), C(
1811
1884
  e,
1812
1885
  a.axis === "rows" ? "columns" : "rows",
1813
1886
  a.target.oppositePath,
@@ -1818,19 +1891,19 @@ function xt(e, t, n, o) {
1818
1891
  }
1819
1892
  });
1820
1893
  }
1821
- function q(e, t, n, o) {
1894
+ function L(e, t, n, o) {
1822
1895
  e && (e.kind !== t.kind || e.kind === "semantic" && t.kind === "semantic" && e.domainId !== t.domainId || e.kind === "physical" && t.kind === "physical" && e.connectionId !== t.connectionId) && g(
1823
1896
  n,
1824
1897
  o,
1825
1898
  "Field source must belong to the same semantic domain or physical connection."
1826
1899
  );
1827
1900
  }
1828
- function oe(e, t, n) {
1901
+ function se(e, t, n) {
1829
1902
  (e.defaultAggregate === "MEDIAN" || Object.values(e.inputs).some(
1830
1903
  (o) => o.aggregate === "MEDIAN" || o.field.aggregate === "MEDIAN"
1831
1904
  )) && g(t, n, "MEDIAN dependencies are not supported at launch."), (e.aggregationBehavior === "snapshot" || e.aggregationBehavior === "weighted" || e.aggregationStrategy === "weighted") && g(t, n, "This measure semantic requires a later capability.");
1832
1905
  }
1833
- function Ft(e, t) {
1906
+ function Dt(e, t) {
1834
1907
  A(
1835
1908
  [...e.rows, ...e.columns, ...e.measures].map((a) => a.id),
1836
1909
  t,
@@ -1854,7 +1927,7 @@ function Ft(e, t) {
1854
1927
  ...e.measures.filter((a) => a.kind === "aggregate")
1855
1928
  ];
1856
1929
  for (const a of n)
1857
- if (q(a.field.source, e.source, t, [
1930
+ if (L(a.field.source, e.source, t, [
1858
1931
  a.id,
1859
1932
  "field",
1860
1933
  "source"
@@ -1863,9 +1936,9 @@ function Ft(e, t) {
1863
1936
  t,
1864
1937
  [a.id],
1865
1938
  "Aggregate-stage calculations cannot be grouped or wrapped in an aggregate."
1866
- ), oe(a.field.derivedField, t, [a.id]);
1939
+ ), se(a.field.derivedField, t, [a.id]);
1867
1940
  for (const s of Object.values(a.field.derivedField.inputs))
1868
- q(s.field.source, e.source, t, [a.id, "inputs"]);
1941
+ L(s.field.source, e.source, t, [a.id, "inputs"]);
1869
1942
  }
1870
1943
  for (const a of e.measures)
1871
1944
  if (a.kind === "calculated") {
@@ -1873,9 +1946,9 @@ function Ft(e, t) {
1873
1946
  t,
1874
1947
  [a.id],
1875
1948
  "Calculated measures require aggregate stage and measure role."
1876
- ), oe(a.definition, t, [a.id]);
1949
+ ), se(a.definition, t, [a.id]);
1877
1950
  for (const s of Object.values(a.definition.inputs))
1878
- q(s.field.source, e.source, t, [
1951
+ L(s.field.source, e.source, t, [
1879
1952
  a.id,
1880
1953
  "inputs"
1881
1954
  ]);
@@ -1884,9 +1957,9 @@ function Ft(e, t) {
1884
1957
  const s = (l, d) => {
1885
1958
  var c, p;
1886
1959
  if ((l.aggregate || ((c = l.derivedField) == null ? void 0 : c.computeStage) === "aggregate") && g(t, d, "Aggregate/HAVING filters are not supported."), l.derivedField) {
1887
- oe(l.derivedField, t, d);
1960
+ se(l.derivedField, t, d);
1888
1961
  for (const u of Object.values(l.derivedField.inputs))
1889
- q(u.field.source, e.source, t, d);
1962
+ L(u.field.source, e.source, t, d);
1890
1963
  }
1891
1964
  for (const u of ((p = l.calculatedFormula) == null ? void 0 : p.inputFields) ?? [])
1892
1965
  s(u, d);
@@ -1906,8 +1979,8 @@ function Ft(e, t) {
1906
1979
  ["joinPlan", "joins"]
1907
1980
  );
1908
1981
  }
1909
- xt(e, e.sorts, t, ["sorts"]), e.rankings.forEach((a, s) => {
1910
- (!e[a.axis].some((l) => l.id === a.levelId) || !e.measures.some((l) => l.id === a.measureId)) && g(t, ["rankings", s], "Unknown ranking level or measure."), $(
1982
+ Tt(e, e.sorts, t, ["sorts"]), e.rankings.forEach((a, s) => {
1983
+ (!e[a.axis].some((l) => l.id === a.levelId) || !e.measures.some((l) => l.id === a.measureId)) && g(t, ["rankings", s], "Unknown ranking level or measure."), C(
1911
1984
  e,
1912
1985
  a.axis === "rows" ? "columns" : "rows",
1913
1986
  a.oppositePath,
@@ -1917,29 +1990,29 @@ function Ft(e, t) {
1917
1990
  );
1918
1991
  });
1919
1992
  }
1920
- const Y = wt.superRefine(Ft), pn = wt.extend({
1921
- rows: i.array(ce).readonly(),
1922
- measures: i.array(It).readonly()
1923
- }), mn = pn.superRefine(Ft), fn = Y.innerType().extend({ kind: i.literal("matrix") }), gn = fn.superRefine(({ kind: e, ...t }, n) => {
1924
- const o = Y.safeParse(t);
1993
+ const P = Ft.superRefine(Dt), Sn = Ft.extend({
1994
+ rows: i.array(pe).readonly(),
1995
+ measures: i.array(At).readonly()
1996
+ }), In = Sn.superRefine(Dt), wn = P.innerType().extend({ kind: i.literal("matrix") }), kn = wn.superRefine(({ kind: e, ...t }, n) => {
1997
+ const o = P.safeParse(t);
1925
1998
  o.success || o.error.issues.forEach((a) => n.addIssue(a));
1926
- }), hn = "{member}", Ye = i.object({
1999
+ }), An = "{member}", Le = i.object({
1927
2000
  visible: i.boolean(),
1928
2001
  position: i.enum(["before", "after"]),
1929
2002
  /** As written; a subtotal's `{member}` becomes its member's name. */
1930
2003
  label: i.string().optional()
1931
- }).strict(), Pe = i.object({
1932
- grand: Ye,
1933
- levels: i.record(I, Ye).readonly(),
2004
+ }).strict(), Ue = i.object({
2005
+ grand: Le,
2006
+ levels: i.record(I, Le).readonly(),
1934
2007
  /**
1935
2008
  * Skip a subtotal that only repeats one row: an expanded group with
1936
2009
  * exactly one child shows no subtotal. Off when absent.
1937
2010
  */
1938
2011
  skipRedundant: i.boolean().optional()
1939
- }).strict(), Be = yt.shape.rules.element, _n = yt.extend({
1940
- rules: i.array(Be.extend({
1941
- target: Be.shape.target.extend({
1942
- rowRoles: i.array(Ei).optional()
2012
+ }).strict(), Ve = It.shape.rules.element, xn = It.extend({
2013
+ rules: i.array(Ve.extend({
2014
+ target: Ve.shape.target.extend({
2015
+ rowRoles: i.array(Pi).optional()
1943
2016
  })
1944
2017
  }))
1945
2018
  }).superRefine((e, t) => {
@@ -1966,13 +2039,13 @@ const Y = wt.superRefine(Ft), pn = wt.extend({
1966
2039
  );
1967
2040
  }
1968
2041
  });
1969
- function bn(e, t, n, o, a = []) {
2042
+ function Fn(e, t, n, o, a = []) {
1970
2043
  for (const s of e.rules) {
1971
2044
  const l = [...a, "rules", s.id], d = s.target.matrix;
1972
- d && (d.levelId !== void 0 && !t[d.axis].some((c) => c.id === d.levelId) && g(o, [...l, "target", "matrix", "levelId"], "Conditional-format level is not on the selected axis."), d.oppositePath !== void 0 && $(t, d.axis === "rows" ? "columns" : "rows", d.oppositePath, o, [...l, "target", "matrix", "oppositePath"])), Zi(s).validationRefs.some((c) => !n.has(c)) && g(o, l, "Conditional rules must reference displayed measures.");
2045
+ d && (d.levelId !== void 0 && !t[d.axis].some((c) => c.id === d.levelId) && g(o, [...l, "target", "matrix", "levelId"], "Conditional-format level is not on the selected axis."), d.oppositePath !== void 0 && C(t, d.axis === "rows" ? "columns" : "rows", d.oppositePath, o, [...l, "target", "matrix", "oppositePath"])), ln(s).validationRefs.some((c) => !n.has(c)) && g(o, l, "Conditional rules must reference displayed measures.");
1973
2046
  }
1974
2047
  }
1975
- const yn = {
2048
+ const Rn = {
1976
2049
  layout: i.discriminatedUnion("kind", [
1977
2050
  i.object({ kind: i.literal("compact") }).strict(),
1978
2051
  i.object({ kind: i.literal("tabular"), repeatLabels: i.boolean() }).strict()
@@ -1980,25 +2053,25 @@ const yn = {
1980
2053
  absence: i.object({ emptyText: i.string(), nullText: i.string() }).strict(),
1981
2054
  levelLabels: i.record(I, i.string()).readonly(),
1982
2055
  measureLabels: i.record(I, i.string()).readonly(),
1983
- levelFormats: i.record(I, Ne).readonly(),
1984
- measureFormats: i.record(I, Ne).readonly(),
1985
- totals: i.object({ rows: Pe, columns: Pe }).strict(),
1986
- conditionalFormatting: _n.optional()
1987
- }, xe = i.object(yn).strict(), vn = i.object({
2056
+ levelFormats: i.record(I, Ce).readonly(),
2057
+ measureFormats: i.record(I, Ce).readonly(),
2058
+ totals: i.object({ rows: Ue, columns: Ue }).strict(),
2059
+ conditionalFormatting: xn.optional()
2060
+ }, Re = i.object(Rn).strict(), Tn = i.object({
1988
2061
  depth: i.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
1989
2062
  overrides: i.array(
1990
2063
  i.object({ path: F, expanded: i.boolean() }).strict()
1991
2064
  ).readonly()
1992
- }).strict(), qe = vn.superRefine(
2065
+ }).strict(), He = Tn.superRefine(
1993
2066
  (e, t) => A(
1994
- e.overrides.map((n) => gt(n.path)),
2067
+ e.overrides.map((n) => bt(n.path)),
1995
2068
  t,
1996
2069
  ["overrides"]
1997
2070
  )
1998
- ), Sn = { rows: qe, columns: qe }, J = i.object(Sn).strict(), In = J.extend({ sorts: i.array(kt).readonly() }).strict(), kn = In.superRefine(
1999
- (e, t) => A(e.sorts.map(At), t, ["sorts"])
2071
+ ), Dn = { rows: He, columns: He }, ee = i.object(Dn).strict(), Mn = ee.extend({ sorts: i.array(xt).readonly() }).strict(), En = Mn.superRefine(
2072
+ (e, t) => A(e.sorts.map(Rt), t, ["sorts"])
2000
2073
  );
2001
- function ee(e, t) {
2074
+ function te(e, t) {
2002
2075
  var c, p;
2003
2076
  const { spec: n, presentation: o, defaults: a, session: s } = e, l = new Set([...n.rows, ...n.columns].map((u) => u.id)), d = new Set(n.measures.map((u) => u.id));
2004
2077
  for (const u of [
@@ -2029,7 +2102,7 @@ function ee(e, t) {
2029
2102
  );
2030
2103
  for (const u of ["rows", "columns"]) {
2031
2104
  (p = o.totals[u].grand.label) != null && p.includes(
2032
- hn
2105
+ An
2033
2106
  ) && g(
2034
2107
  t,
2035
2108
  ["presentation", "totals", u, "grand", "label"],
@@ -2043,7 +2116,7 @@ function ee(e, t) {
2043
2116
  );
2044
2117
  for (const b of [a, ...s ? [s] : []])
2045
2118
  for (const S of b[u].overrides)
2046
- $(
2119
+ C(
2047
2120
  n,
2048
2121
  u,
2049
2122
  S.path,
@@ -2056,7 +2129,7 @@ function ee(e, t) {
2056
2129
  "Use depth to expand/collapse the root."
2057
2130
  );
2058
2131
  }
2059
- s && xt(n, s.sorts, t, ["session", "sorts"]), o.conditionalFormatting && bn(
2132
+ s && Tt(n, s.sorts, t, ["session", "sorts"]), o.conditionalFormatting && Fn(
2060
2133
  o.conditionalFormatting,
2061
2134
  n,
2062
2135
  d,
@@ -2064,32 +2137,32 @@ function ee(e, t) {
2064
2137
  ["presentation", "conditionalFormatting"]
2065
2138
  );
2066
2139
  }
2067
- const wn = i.object({
2068
- spec: Y,
2069
- presentation: xe,
2070
- defaults: J,
2071
- session: kn.optional()
2072
- }).strict(), Ya = wn.superRefine(ee), An = i.object({
2140
+ const Nn = i.object({
2141
+ spec: P,
2142
+ presentation: Re,
2143
+ defaults: ee,
2144
+ session: En.optional()
2145
+ }).strict(), to = Nn.superRefine(te), jn = i.object({
2073
2146
  version: i.literal(1),
2074
- spec: Y,
2075
- presentation: xe,
2076
- defaultView: J
2077
- }).strict(), xn = An.superRefine(
2078
- (e, t) => ee({ ...e, defaults: e.defaultView }, t)
2079
- ), Fn = xn.innerType().extend({
2080
- spec: mn
2081
- }), Pa = Fn.superRefine((e, t) => ee({ ...e, defaults: e.defaultView }, t)), Le = i.object({ spec: Y, presentation: xe }).strict(), Rn = i.union([
2082
- Le.extend({
2147
+ spec: P,
2148
+ presentation: Re,
2149
+ defaultView: ee
2150
+ }).strict(), Cn = jn.superRefine(
2151
+ (e, t) => te({ ...e, defaults: e.defaultView }, t)
2152
+ ), $n = Cn.innerType().extend({
2153
+ spec: In
2154
+ }), io = $n.superRefine((e, t) => te({ ...e, defaults: e.defaultView }, t)), Ge = i.object({ spec: P, presentation: Re }).strict(), On = i.union([
2155
+ Ge.extend({
2083
2156
  mode: i.literal("layout"),
2084
2157
  format: i.enum(["csv", "xlsx", "pdf"]),
2085
2158
  expansion: i.union([
2086
- J.extend({ kind: i.literal("current") }).strict(),
2159
+ ee.extend({ kind: i.literal("current") }).strict(),
2087
2160
  i.object({ kind: i.literal("all") }).strict()
2088
2161
  ])
2089
2162
  }).strict(),
2090
- Le.extend({ mode: i.literal("flat"), format: i.literal("csv") }).strict()
2091
- ]), Ba = Rn.superRefine(
2092
- (e, t) => ee(
2163
+ Ge.extend({ mode: i.literal("flat"), format: i.literal("csv") }).strict()
2164
+ ]), no = On.superRefine(
2165
+ (e, t) => te(
2093
2166
  {
2094
2167
  ...e,
2095
2168
  defaults: e.mode === "layout" && e.expansion.kind === "current" ? e.expansion : {
@@ -2100,29 +2173,29 @@ const wn = i.object({
2100
2173
  t
2101
2174
  )
2102
2175
  );
2103
- function qa(e) {
2176
+ function ao(e) {
2104
2177
  return e && "id" in e ? e.id : void 0;
2105
2178
  }
2106
- const Tn = "SUM";
2107
- function w(e) {
2179
+ const Pn = "SUM";
2180
+ function k(e) {
2108
2181
  return typeof e == "string" && e.trim().length > 0;
2109
2182
  }
2110
2183
  function E(e) {
2111
- return w(e) ? e.trim().toLowerCase() : "";
2184
+ return k(e) ? e.trim().toLowerCase() : "";
2112
2185
  }
2113
- function La(e) {
2114
- const t = w(e.id) ? e.id.trim() : void 0;
2186
+ function oo(e) {
2187
+ const t = k(e.id) ? e.id.trim() : void 0;
2115
2188
  if (!t) return;
2116
- const n = E(t), o = w(e.table) ? e.table.trim() : void 0;
2189
+ const n = E(t), o = k(e.table) ? e.table.trim() : void 0;
2117
2190
  if (!(n === E(e.name) || o && n === E(o)))
2118
2191
  return t;
2119
2192
  }
2120
2193
  function T(e) {
2121
- const t = w(e.datasetId) ? e.datasetId.trim() : void 0;
2194
+ const t = k(e.datasetId) ? e.datasetId.trim() : void 0;
2122
2195
  if (t)
2123
2196
  return E(t) === E(e.datasetName) ? void 0 : t;
2124
2197
  }
2125
- function Rt(e) {
2198
+ function Mt(e) {
2126
2199
  if (e.kind !== "semantic") return e;
2127
2200
  const t = T(e), { datasetId: n, ...o } = e;
2128
2201
  return {
@@ -2130,10 +2203,10 @@ function Rt(e) {
2130
2203
  ...t ? { datasetId: t } : {}
2131
2204
  };
2132
2205
  }
2133
- function Ua(e) {
2134
- return e ? e.kind === "semantic" ? !!(w(e.domainId) && (w(e.datasetId) || w(e.datasetName))) : e.kind === "physical" ? w(e.connectionId) && w(e.tableName) : w(e.connectionId) : !1;
2206
+ function so(e) {
2207
+ return e ? e.kind === "semantic" ? !!(k(e.domainId) && (k(e.datasetId) || k(e.datasetName))) : e.kind === "physical" ? k(e.connectionId) && k(e.tableName) : k(e.connectionId) : !1;
2135
2208
  }
2136
- function pe(e) {
2209
+ function me(e) {
2137
2210
  if (!e)
2138
2211
  return "";
2139
2212
  if (e.kind === "semantic") {
@@ -2157,7 +2230,7 @@ function pe(e) {
2157
2230
  e.label || ""
2158
2231
  ].join(":");
2159
2232
  }
2160
- function Fe(e, t) {
2233
+ function Te(e, t) {
2161
2234
  if (!e || !t)
2162
2235
  return e === t;
2163
2236
  if (e.kind !== t.kind)
@@ -2168,10 +2241,10 @@ function Fe(e, t) {
2168
2241
  const n = T(e), o = T(t);
2169
2242
  return n && o ? n === o : e.datasetName === t.datasetName;
2170
2243
  }
2171
- return pe(e) === pe(t);
2244
+ return me(e) === me(t);
2172
2245
  }
2173
- function Tt(e, t) {
2174
- return e.kind !== "semantic" || t.kind !== "semantic" ? e : Rt({
2246
+ function Et(e, t) {
2247
+ return e.kind !== "semantic" || t.kind !== "semantic" ? e : Mt({
2175
2248
  ...e,
2176
2249
  datasetName: e.datasetName || t.datasetName,
2177
2250
  datasetId: T(e) || T(t),
@@ -2179,75 +2252,75 @@ function Tt(e, t) {
2179
2252
  connectionId: e.connectionId || t.connectionId
2180
2253
  });
2181
2254
  }
2182
- function Va(e) {
2255
+ function ro(e) {
2183
2256
  const t = [];
2184
2257
  for (const n of e) {
2185
- const o = Rt(
2258
+ const o = Mt(
2186
2259
  n
2187
2260
  ), a = t.findIndex(
2188
- (s) => Fe(s, o)
2261
+ (s) => Te(s, o)
2189
2262
  );
2190
2263
  if (a === -1) {
2191
2264
  t.push(o);
2192
2265
  continue;
2193
2266
  }
2194
- t[a] = Tt(
2267
+ t[a] = Et(
2195
2268
  t[a],
2196
2269
  o
2197
2270
  );
2198
2271
  }
2199
2272
  return t;
2200
2273
  }
2201
- function Mn(e, t) {
2202
- return e.name === t.name && Fe(e.source, t.source);
2274
+ function Yn(e, t) {
2275
+ return e.name === t.name && Te(e.source, t.source);
2203
2276
  }
2204
- function Ha(e) {
2277
+ function lo(e) {
2205
2278
  return [
2206
- e.source ? pe(e.source) : "unknown",
2207
- Mt(e),
2279
+ e.source ? me(e.source) : "unknown",
2280
+ Nt(e),
2208
2281
  e.name
2209
2282
  ].filter(Boolean).join(":");
2210
2283
  }
2211
- function Mt(e) {
2212
- return Dn(
2213
- e.aggregate || Tn
2284
+ function Nt(e) {
2285
+ return Bn(
2286
+ e.aggregate || Pn
2214
2287
  );
2215
2288
  }
2216
- function Dn(e) {
2289
+ function Bn(e) {
2217
2290
  return e.trim().toUpperCase();
2218
2291
  }
2219
- function Ga(e, t) {
2292
+ function uo(e, t) {
2220
2293
  return {
2221
2294
  ...e,
2222
2295
  label: e.label || t.label,
2223
2296
  role: e.role || t.role,
2224
2297
  dataType: e.dataType || t.dataType,
2225
- source: e.source && t.source ? Tt(e.source, t.source) : e.source || t.source
2298
+ source: e.source && t.source ? Et(e.source, t.source) : e.source || t.source
2226
2299
  };
2227
2300
  }
2228
- function En(e) {
2301
+ function qn(e) {
2229
2302
  for (let t = 0; t < e.length; t += 1) {
2230
2303
  const n = e[t];
2231
2304
  if (e.some(
2232
- (o, a) => a !== t && Et(o, n)
2305
+ (o, a) => a !== t && Ct(o, n)
2233
2306
  ))
2234
2307
  return !1;
2235
2308
  }
2236
2309
  return !0;
2237
2310
  }
2238
- function Dt(e, t) {
2239
- return Mn(e, t);
2311
+ function jt(e, t) {
2312
+ return Yn(e, t);
2240
2313
  }
2241
- function Et(e, t) {
2242
- return Dt(e, t) && C(e) === C(t);
2314
+ function Ct(e, t) {
2315
+ return jt(e, t) && $(e) === $(t);
2243
2316
  }
2244
- function Nn(e) {
2245
- return `Metric intent has duplicate measure "${e.name}" with the same aggregate (${C(e)}). Use different aggregates to request both, or remove one entry.`;
2317
+ function Ln(e) {
2318
+ return `Metric intent has duplicate measure "${e.name}" with the same aggregate (${$(e)}). Use different aggregates to request both, or remove one entry.`;
2246
2319
  }
2247
- function Ue(e) {
2320
+ function ze(e) {
2248
2321
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
2249
2322
  }
2250
- function jn(e, t, n) {
2323
+ function Un(e, t, n) {
2251
2324
  if (e !== void 0) {
2252
2325
  if (!e || typeof e != "object" || Array.isArray(e)) {
2253
2326
  n.push(
@@ -2270,7 +2343,7 @@ function jn(e, t, n) {
2270
2343
  );
2271
2344
  return;
2272
2345
  }
2273
- (Array.isArray(a) ? a.every(Ue) : Ue(a)) || n.push(
2346
+ (Array.isArray(a) ? a.every(ze) : ze(a)) || n.push(
2274
2347
  r(
2275
2348
  "invalid_sql_default_parameter_value",
2276
2349
  "SQL defaultParameters values must be strings, numbers, booleans, nulls, or arrays of those scalar values.",
@@ -2280,51 +2353,51 @@ function jn(e, t, n) {
2280
2353
  });
2281
2354
  }
2282
2355
  }
2283
- function $n(e, t) {
2284
- return Re(e, t).length === 1;
2356
+ function Vn(e, t) {
2357
+ return De(e, t).length === 1;
2285
2358
  }
2286
- function Cn(e, t) {
2287
- return Re(e, t).length === 1;
2359
+ function Hn(e, t) {
2360
+ return De(e, t).length === 1;
2288
2361
  }
2289
- function Re(e, t) {
2362
+ function De(e, t) {
2290
2363
  return t.filter(
2291
- (o) => On(e, o)
2364
+ (o) => Gn(e, o)
2292
2365
  );
2293
2366
  }
2294
- function On(e, t) {
2295
- return Yn(e, t) ? e.source ? Dt(t, e) : !0 : !1;
2367
+ function Gn(e, t) {
2368
+ return zn(e, t) ? e.source ? jt(t, e) : !0 : !1;
2296
2369
  }
2297
- function Yn(e, t) {
2298
- return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role || Pn(e, t) && C(t) !== C(e));
2370
+ function zn(e, t) {
2371
+ return !(t.name !== e.name || e.role !== void 0 && t.role !== void 0 && t.role !== e.role || Wn(e, t) && $(t) !== $(e));
2299
2372
  }
2300
- function Pn(e, t) {
2373
+ function Wn(e, t) {
2301
2374
  return e.role === "measure" || t.role === "measure" || e.aggregate !== void 0 || t.aggregate !== void 0;
2302
2375
  }
2303
- function C(e) {
2304
- return Mt(e);
2376
+ function $(e) {
2377
+ return Nt(e);
2305
2378
  }
2306
- const Bn = /^(\d{4})-(\d{2})-(\d{2})$/, Nt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/;
2307
- function me(e) {
2379
+ const Kn = /^(\d{4})-(\d{2})-(\d{2})$/, $t = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:\d{2})$/;
2380
+ function fe(e) {
2308
2381
  if (typeof e != "string")
2309
2382
  return null;
2310
- const t = e.trim(), n = Bn.exec(t);
2383
+ const t = e.trim(), n = Kn.exec(t);
2311
2384
  if (n) {
2312
2385
  const [, b, S, h] = n;
2313
- return Ve(b, S, h) ? new Date(Date.UTC(Number(b), Number(S) - 1, Number(h))) : null;
2386
+ return We(b, S, h) ? new Date(Date.UTC(Number(b), Number(S) - 1, Number(h))) : null;
2314
2387
  }
2315
- const o = Nt.exec(t);
2388
+ const o = $t.exec(t);
2316
2389
  if (!o)
2317
2390
  return null;
2318
2391
  const [, a, s, l, d, c, p = "00", , u] = o;
2319
- if (!Ve(a, s, l) || !N(d, 0, 23) || !N(c, 0, 59) || !N(p, 0, 59) || !qn(u))
2392
+ if (!We(a, s, l) || !N(d, 0, 23) || !N(c, 0, 59) || !N(p, 0, 59) || !Qn(u))
2320
2393
  return null;
2321
2394
  const _ = new Date(t);
2322
2395
  return Number.isFinite(_.getTime()) ? _ : null;
2323
2396
  }
2324
- function za(e) {
2325
- return typeof e != "string" || !Nt.test(e.trim()) ? null : me(e);
2397
+ function co(e) {
2398
+ return typeof e != "string" || !$t.test(e.trim()) ? null : fe(e);
2326
2399
  }
2327
- function Ve(e, t, n) {
2400
+ function We(e, t, n) {
2328
2401
  const o = Number(e), a = Number(t), s = Number(n);
2329
2402
  if (!Number.isInteger(o) || !Number.isInteger(a) || !Number.isInteger(s) || a < 1 || a > 12)
2330
2403
  return !1;
@@ -2335,13 +2408,13 @@ function N(e, t, n) {
2335
2408
  const o = Number(e);
2336
2409
  return Number.isInteger(o) && o >= t && o <= n;
2337
2410
  }
2338
- function qn(e) {
2411
+ function Qn(e) {
2339
2412
  if (e === "Z")
2340
2413
  return !0;
2341
2414
  const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
2342
2415
  return !!(t && N(t[2], 0, 23) && N(t[3], 0, 59));
2343
2416
  }
2344
- function He(e, t, n) {
2417
+ function Ke(e, t, n) {
2345
2418
  if (e !== void 0) {
2346
2419
  if (!f(e)) {
2347
2420
  n.push(
@@ -2368,7 +2441,7 @@ function He(e, t, n) {
2368
2441
  );
2369
2442
  }
2370
2443
  }
2371
- function Ge(e) {
2444
+ function Qe(e) {
2372
2445
  const t = /* @__PURE__ */ new Set();
2373
2446
  for (const n of e) {
2374
2447
  if (t.has(n))
@@ -2377,7 +2450,7 @@ function Ge(e) {
2377
2450
  }
2378
2451
  return null;
2379
2452
  }
2380
- function Ln(e, t, n) {
2453
+ function Xn(e, t, n) {
2381
2454
  if (!f(e)) {
2382
2455
  n.push(
2383
2456
  r(
@@ -2400,13 +2473,13 @@ function Ln(e, t, n) {
2400
2473
  "Input binding kind must be filter or control.",
2401
2474
  `${t}.kind`
2402
2475
  )
2403
- ), e.field !== void 0 && y(e.field, `${t}.field`, n), e.relationshipHint !== void 0 && Te(
2476
+ ), e.field !== void 0 && y(e.field, `${t}.field`, n), e.relationshipHint !== void 0 && Me(
2404
2477
  e.relationshipHint,
2405
2478
  `${t}.relationshipHint`,
2406
2479
  n
2407
2480
  );
2408
2481
  }
2409
- function Te(e, t, n) {
2482
+ function Me(e, t, n) {
2410
2483
  if (!f(e)) {
2411
2484
  n.push(
2412
2485
  r(
@@ -2425,7 +2498,7 @@ function Te(e, t, n) {
2425
2498
  )
2426
2499
  );
2427
2500
  }
2428
- function Un(e, t) {
2501
+ function Zn(e, t) {
2429
2502
  var o, a;
2430
2503
  if (((o = e.source) == null ? void 0 : o.kind) !== "semantic" && ((a = e.source) == null ? void 0 : a.kind) !== "physical" && t.push(
2431
2504
  r(
@@ -2446,7 +2519,7 @@ function Un(e, t) {
2446
2519
  "search"
2447
2520
  )
2448
2521
  ), e.matchValues !== void 0) {
2449
- const s = qt(e.matchValues);
2522
+ const s = Vt(e.matchValues);
2450
2523
  s.ok || t.push(
2451
2524
  r("invalid_input_options_match_values", s.error, "matchValues")
2452
2525
  ), typeof e.search == "string" && e.search.trim() && t.push(
@@ -2500,7 +2573,7 @@ function Un(e, t) {
2500
2573
  path: `disambiguationFields.${l}`
2501
2574
  })) : []
2502
2575
  ].forEach(({ field: s, path: l }) => {
2503
- s != null && s.source && !Fe(s.source, e.source) && t.push(
2576
+ s != null && s.source && !Te(s.source, e.source) && t.push(
2504
2577
  r(
2505
2578
  "input_options_field_source_mismatch",
2506
2579
  "Input option fields must belong to the declared option source.",
@@ -2508,10 +2581,10 @@ function Un(e, t) {
2508
2581
  )
2509
2582
  );
2510
2583
  }), e.dependencies !== void 0) {
2511
- const s = Hn(
2584
+ const s = ea(
2512
2585
  e.dependencies
2513
2586
  );
2514
- t.push(...s.errors), s.ok && zn(e, t);
2587
+ t.push(...s.errors), s.ok && ia(e, t);
2515
2588
  }
2516
2589
  if (e.population !== void 0) {
2517
2590
  const s = e.population;
@@ -2543,11 +2616,11 @@ function Un(e, t) {
2543
2616
  "Input options population relationshipHint is only valid for related_population.",
2544
2617
  "population.relationshipHint"
2545
2618
  )
2546
- ), l === "related_population" && (be(
2619
+ ), l === "related_population" && (ye(
2547
2620
  s.baseSource,
2548
2621
  "population.baseSource",
2549
2622
  t
2550
- ), s.relationshipHint !== void 0 && Te(
2623
+ ), s.relationshipHint !== void 0 && Me(
2551
2624
  s.relationshipHint,
2552
2625
  "population.relationshipHint",
2553
2626
  t
@@ -2555,7 +2628,7 @@ function Un(e, t) {
2555
2628
  }
2556
2629
  }
2557
2630
  }
2558
- function Vn(e, t) {
2631
+ function Jn(e, t) {
2559
2632
  if (!(!("inputs" in e) || e.inputs === void 0)) {
2560
2633
  if (!Array.isArray(e.inputs)) {
2561
2634
  t.push(
@@ -2568,11 +2641,11 @@ function Vn(e, t) {
2568
2641
  return;
2569
2642
  }
2570
2643
  e.inputs.forEach(
2571
- (n, o) => Ln(n, `inputs.${o}`, t)
2644
+ (n, o) => Xn(n, `inputs.${o}`, t)
2572
2645
  );
2573
2646
  }
2574
2647
  }
2575
- function Hn(e, t = "protocol") {
2648
+ function ea(e, t = "protocol") {
2576
2649
  const n = [];
2577
2650
  if (!f(e))
2578
2651
  return n.push(
@@ -2589,12 +2662,12 @@ function Hn(e, t = "protocol") {
2589
2662
  "Input options dependencies mode must be independent, explicit, or all_applicable.",
2590
2663
  "dependencies.mode"
2591
2664
  )
2592
- ), se(
2665
+ ), re(
2593
2666
  o.includeInputIds,
2594
2667
  "dependencies.includeInputIds",
2595
2668
  n,
2596
2669
  "Input options includeInputIds must be non-empty strings."
2597
- ), se(
2670
+ ), re(
2598
2671
  o.excludeInputIds,
2599
2672
  "dependencies.excludeInputIds",
2600
2673
  n,
@@ -2605,7 +2678,7 @@ function Hn(e, t = "protocol") {
2605
2678
  "All applicable dependencies cannot specify includeInputIds.",
2606
2679
  "dependencies.includeInputIds"
2607
2680
  )
2608
- ), se(
2681
+ ), re(
2609
2682
  o.omitInputIds,
2610
2683
  "dependencies.omitInputIds",
2611
2684
  n,
@@ -2622,9 +2695,9 @@ function Hn(e, t = "protocol") {
2622
2695
  )
2623
2696
  );
2624
2697
  }
2625
- return t === "dashboard" && Gn(o, n), { ok: n.length === 0, errors: n, warnings: [] };
2698
+ return t === "dashboard" && ta(o, n), { ok: n.length === 0, errors: n, warnings: [] };
2626
2699
  }
2627
- function Gn(e, t) {
2700
+ function ta(e, t) {
2628
2701
  const { mode: n, includeInputIds: o, excludeInputIds: a } = e;
2629
2702
  n === void 0 && t.push(
2630
2703
  r(
@@ -2658,7 +2731,7 @@ function Gn(e, t) {
2658
2731
  )
2659
2732
  );
2660
2733
  }
2661
- function zn(e, t) {
2734
+ function ia(e, t) {
2662
2735
  var a, s, l;
2663
2736
  const n = new Set(
2664
2737
  Array.isArray(e.inputs) ? e.inputs.map((d) => f(d) ? d.inputId : void 0).filter((d) => typeof d == "string") : []
@@ -2680,11 +2753,11 @@ function zn(e, t) {
2680
2753
  )
2681
2754
  );
2682
2755
  }
2683
- function se(e, t, n, o) {
2756
+ function re(e, t, n, o) {
2684
2757
  e !== void 0 && (!Array.isArray(e) || e.some((a) => !m(a))) && n.push(r("invalid_input_options_dependencies", o, t));
2685
2758
  }
2686
- const Kn = new Set(z);
2687
- function Qn(e, t, n) {
2759
+ const na = new Set(W);
2760
+ function aa(e, t, n) {
2688
2761
  if (f(e) && e.type === "temporal_bucket") {
2689
2762
  n.push(
2690
2763
  r(
@@ -2695,9 +2768,9 @@ function Qn(e, t, n) {
2695
2768
  );
2696
2769
  return;
2697
2770
  }
2698
- nt(e, t, n);
2771
+ rt(e, t, n);
2699
2772
  }
2700
- function ze(e, t, n) {
2773
+ function Xe(e, t, n) {
2701
2774
  if (!f(e)) {
2702
2775
  n.push(
2703
2776
  r(
@@ -2723,7 +2796,7 @@ function ze(e, t, n) {
2723
2796
  required: !0
2724
2797
  });
2725
2798
  }
2726
- function Wn(e, t, n) {
2799
+ function oa(e, t, n) {
2727
2800
  if (!f(e)) {
2728
2801
  n.push(
2729
2802
  r(
@@ -2740,15 +2813,15 @@ function Wn(e, t, n) {
2740
2813
  "Result calculation output needs a stable key.",
2741
2814
  `${t}.key`
2742
2815
  )
2743
- ), e.dataType !== void 0 && (typeof e.dataType != "string" || !it.has(e.dataType)) && n.push(
2816
+ ), e.dataType !== void 0 && (typeof e.dataType != "string" || !st.has(e.dataType)) && n.push(
2744
2817
  r(
2745
2818
  "invalid_result_calculation_output",
2746
2819
  "Result calculation output dataType must be string, number, boolean, date, datetime, or unknown.",
2747
2820
  `${t}.dataType`
2748
2821
  )
2749
- ), Qn(e.format, `${t}.format`, n);
2822
+ ), aa(e.format, `${t}.format`, n);
2750
2823
  }
2751
- function Xn(e, t) {
2824
+ function sa(e, t) {
2752
2825
  if (e.analysis === void 0)
2753
2826
  return;
2754
2827
  if (!f(e.analysis)) {
@@ -2791,9 +2864,43 @@ function Xn(e, t) {
2791
2864
  )
2792
2865
  );
2793
2866
  const { timeWindow: n } = e.analysis;
2794
- n !== void 0 && fe(n, "analysis.timeWindow", t);
2867
+ n !== void 0 && ge(n, "analysis.timeWindow", t);
2868
+ }
2869
+ const ra = new Set(
2870
+ Ht
2871
+ ), la = new Set(
2872
+ Gt
2873
+ ), da = new Set(
2874
+ zt
2875
+ );
2876
+ function ua(e, t, n) {
2877
+ ra.has(e.unit) || n.push(
2878
+ r(
2879
+ "invalid_time_window",
2880
+ "Calendar time window unit must be one of: day, week, month, quarter, year.",
2881
+ `${t}.unit`
2882
+ )
2883
+ ), e.period !== "this" && e.period !== "previous" && n.push(
2884
+ r(
2885
+ "invalid_time_window",
2886
+ "Calendar time window period must be this or previous.",
2887
+ `${t}.period`
2888
+ )
2889
+ ), e.toDate !== void 0 && typeof e.toDate != "boolean" ? n.push(
2890
+ r(
2891
+ "invalid_time_window",
2892
+ "Calendar time window toDate must be a boolean.",
2893
+ `${t}.toDate`
2894
+ )
2895
+ ) : e.toDate === !0 && e.period !== "this" && n.push(
2896
+ r(
2897
+ "invalid_time_window",
2898
+ "Calendar time window toDate is only allowed with period this.",
2899
+ `${t}.toDate`
2900
+ )
2901
+ );
2795
2902
  }
2796
- function fe(e, t, n) {
2903
+ function ge(e, t, n) {
2797
2904
  if (!f(e)) {
2798
2905
  n.push(
2799
2906
  r(
@@ -2804,13 +2911,17 @@ function fe(e, t, n) {
2804
2911
  );
2805
2912
  return;
2806
2913
  }
2807
- if (e.kind !== void 0 && e.kind !== "relative" && e.kind !== "absolute" && n.push(
2914
+ if (e.kind !== void 0 && e.kind !== "relative" && e.kind !== "calendar" && e.kind !== "absolute" && n.push(
2808
2915
  r(
2809
2916
  "invalid_time_window",
2810
- "Time window kind must be relative or absolute.",
2917
+ "Time window kind must be relative, calendar or absolute.",
2811
2918
  `${t}.kind`
2812
2919
  )
2813
- ), e.kind === "absolute") {
2920
+ ), e.kind === "calendar") {
2921
+ ua(e, t, n);
2922
+ return;
2923
+ }
2924
+ if (e.kind === "absolute") {
2814
2925
  if (m(e.start) || n.push(
2815
2926
  r(
2816
2927
  "invalid_time_window",
@@ -2824,7 +2935,7 @@ function fe(e, t, n) {
2824
2935
  `${t}.end`
2825
2936
  )
2826
2937
  ), m(e.start) && m(e.end)) {
2827
- const o = me(e.start), a = me(e.end);
2938
+ const o = fe(e.start), a = fe(e.end);
2828
2939
  o || n.push(
2829
2940
  r(
2830
2941
  "invalid_time_window",
@@ -2847,10 +2958,10 @@ function fe(e, t, n) {
2847
2958
  }
2848
2959
  return;
2849
2960
  }
2850
- (typeof e.unit != "string" || !Kn.has(e.unit)) && n.push(
2961
+ (typeof e.unit != "string" || !na.has(e.unit)) && n.push(
2851
2962
  r(
2852
2963
  "invalid_time_window",
2853
- `Time window unit must be one of: ${z.join(", ")}.`,
2964
+ `Time window unit must be one of: ${W.join(", ")}.`,
2854
2965
  `${t}.unit`
2855
2966
  )
2856
2967
  ), (typeof e.value != "number" || !Number.isFinite(e.value) || e.value <= 0) && n.push(
@@ -2859,13 +2970,13 @@ function fe(e, t, n) {
2859
2970
  "Time window value must be a positive number.",
2860
2971
  `${t}.value`
2861
2972
  )
2862
- ), e.anchor !== void 0 && e.anchor !== "now" && e.anchor !== "latest_available" && n.push(
2973
+ ), e.anchor !== void 0 && !la.has(e.anchor) && n.push(
2863
2974
  r(
2864
2975
  "invalid_time_window",
2865
2976
  "Time window anchor must be now or latest_available.",
2866
2977
  `${t}.anchor`
2867
2978
  )
2868
- ), e.completeness !== void 0 && e.completeness !== "include_partial" && e.completeness !== "complete_periods" && n.push(
2979
+ ), e.completeness !== void 0 && !da.has(e.completeness) && n.push(
2869
2980
  r(
2870
2981
  "invalid_time_window",
2871
2982
  "Time window completeness must be include_partial or complete_periods.",
@@ -2873,7 +2984,7 @@ function fe(e, t, n) {
2873
2984
  )
2874
2985
  );
2875
2986
  }
2876
- function ge(e, t, n) {
2987
+ function he(e, t, n) {
2877
2988
  if (e !== void 0) {
2878
2989
  if (!Array.isArray(e)) {
2879
2990
  n.push(
@@ -2970,7 +3081,7 @@ function ge(e, t, n) {
2970
3081
  });
2971
3082
  }
2972
3083
  }
2973
- function Ka(e) {
3084
+ function po(e) {
2974
3085
  const t = [];
2975
3086
  if (!f(e))
2976
3087
  return t.push(
@@ -2997,11 +3108,11 @@ function Ka(e) {
2997
3108
  "Result calculation kind must be percent_of_total, rank, running_total, or previous_row_delta.",
2998
3109
  "kind"
2999
3110
  )
3000
- ), ze(e.input, "input", t), Wn(e.output, "output", t), e.kind === "percent_of_total") {
3111
+ ), Xe(e.input, "input", t), oa(e.output, "output", t), e.kind === "percent_of_total") {
3001
3112
  const n = e.denominator;
3002
3113
  n !== void 0 && (f(n) ? n.scope === "population" ? (y(n.metric, "denominator.metric", t, {
3003
3114
  required: !0
3004
- }), ge(
3115
+ }), he(
3005
3116
  n.filters,
3006
3117
  "denominator.filters",
3007
3118
  t
@@ -3025,9 +3136,9 @@ function Ka(e) {
3025
3136
  "Rank result calculation order must be asc or desc.",
3026
3137
  "order"
3027
3138
  )
3028
- ), (e.kind === "running_total" || e.kind === "previous_row_delta") && e.orderBy !== void 0 && ze(e.orderBy, "orderBy", t), { ok: t.length === 0, errors: t, warnings: [] };
3139
+ ), (e.kind === "running_total" || e.kind === "previous_row_delta") && e.orderBy !== void 0 && Xe(e.orderBy, "orderBy", t), { ok: t.length === 0, errors: t, warnings: [] };
3029
3140
  }
3030
- function jt(e) {
3141
+ function Ot(e) {
3031
3142
  var o;
3032
3143
  const t = [], n = [];
3033
3144
  if (!e || typeof e != "object")
@@ -3048,8 +3159,8 @@ function jt(e) {
3048
3159
  ]
3049
3160
  };
3050
3161
  if (e.kind === "matrix") {
3051
- const a = gn.safeParse(e);
3052
- return a.success || t.push(...a.error.issues.map((s) => r("invalid_matrix_intent", s.message, s.path.join(".")))), { ok: t.length === 0, errors: t, warnings: n, repairHints: Ke(t) };
3162
+ const a = kn.safeParse(e);
3163
+ return a.success || t.push(...a.error.issues.map((s) => r("invalid_matrix_intent", s.message, s.path.join(".")))), { ok: t.length === 0, errors: t, warnings: n, repairHints: Ze(t) };
3053
3164
  }
3054
3165
  if (e.version !== void 0 && e.version !== 1 && t.push(
3055
3166
  r(
@@ -3057,7 +3168,7 @@ function jt(e) {
3057
3168
  "Analytics intent version must be 1.",
3058
3169
  "version"
3059
3170
  )
3060
- ), be(e.source, "source", t), Zn(e, t), Vn(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && Te(
3171
+ ), ye(e.source, "source", t), ca(e, t), Jn(e, t), "relationshipHint" in e && e.relationshipHint !== void 0 && Me(
3061
3172
  e.relationshipHint,
3062
3173
  "relationshipHint",
3063
3174
  t
@@ -3083,21 +3194,21 @@ function jt(e) {
3083
3194
  y(s, `measures.${l}`, t, {
3084
3195
  required: !0
3085
3196
  });
3086
- }), a.length > 0 && !En(a)) {
3197
+ }), a.length > 0 && !qn(a)) {
3087
3198
  const s = a.find(
3088
3199
  (l, d) => a.some(
3089
- (c, p) => p !== d && Et(c, l)
3200
+ (c, p) => p !== d && Ct(c, l)
3090
3201
  )
3091
3202
  );
3092
3203
  s && t.push(
3093
3204
  r(
3094
3205
  "duplicate_measure",
3095
- Nn(s),
3206
+ Ln(s),
3096
3207
  "measures"
3097
3208
  )
3098
3209
  );
3099
3210
  }
3100
- if (f(e.primaryMeasure) && m(e.primaryMeasure.name) && Re(
3211
+ if (f(e.primaryMeasure) && m(e.primaryMeasure.name) && De(
3101
3212
  e.primaryMeasure,
3102
3213
  a
3103
3214
  ).length > 1 && t.push(
@@ -3108,7 +3219,7 @@ function jt(e) {
3108
3219
  )
3109
3220
  ), e.primaryMeasure !== void 0 && (y(e.primaryMeasure, "primaryMeasure", t, {
3110
3221
  required: !0
3111
- }), f(e.primaryMeasure) && m(e.primaryMeasure.name) && a.length > 0 && !$n(
3222
+ }), f(e.primaryMeasure) && m(e.primaryMeasure.name) && a.length > 0 && !Vn(
3112
3223
  e.primaryMeasure,
3113
3224
  a
3114
3225
  ) && t.push(
@@ -3131,13 +3242,13 @@ function jt(e) {
3131
3242
  "Metric intent dimensions must be an array of field references with names.",
3132
3243
  "dimensions"
3133
3244
  )
3134
- ), e.dateField !== void 0 && y(e.dateField, "dateField", t), e.timeWindow !== void 0 && (fe(e.timeWindow, "timeWindow", t), e.dateField || t.push(
3245
+ ), e.dateField !== void 0 && y(e.dateField, "dateField", t), e.timeWindow !== void 0 && (ge(e.timeWindow, "timeWindow", t), e.dateField || t.push(
3135
3246
  r(
3136
3247
  "missing_time_window_date_field",
3137
3248
  "Metric timeWindow needs a dateField.",
3138
3249
  "dateField"
3139
3250
  )
3140
- )), ge(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((s, l) => {
3251
+ )), he(e.filters, "filters", t), Array.isArray(e.dimensions) && e.dimensions.forEach((s, l) => {
3141
3252
  y(s, `dimensions.${l}`, t);
3142
3253
  }), e.orderBy !== void 0) {
3143
3254
  if (!f(e.orderBy))
@@ -3164,7 +3275,7 @@ function jt(e) {
3164
3275
  (l) => f(l) && m(l.name)
3165
3276
  ) : []
3166
3277
  ];
3167
- s.length > 0 && !Cn(
3278
+ s.length > 0 && !Hn(
3168
3279
  e.orderBy.field,
3169
3280
  s
3170
3281
  ) && t.push(
@@ -3176,7 +3287,7 @@ function jt(e) {
3176
3287
  );
3177
3288
  }
3178
3289
  }
3179
- Xn(e, t);
3290
+ sa(e, t);
3180
3291
  } else if (e.kind === "records") {
3181
3292
  if (!Array.isArray(e.fields) || e.fields.length === 0 ? t.push(
3182
3293
  r(
@@ -3194,13 +3305,13 @@ function jt(e) {
3194
3305
  )
3195
3306
  ), Array.isArray(e.fields) && e.fields.forEach((a, s) => {
3196
3307
  y(a, `fields.${s}`, t);
3197
- }), e.dateField !== void 0 && y(e.dateField, "dateField", t), He(e.pagination, "pagination", t), e.timeWindow !== void 0 && (fe(e.timeWindow, "timeWindow", t), e.dateField || t.push(
3308
+ }), e.dateField !== void 0 && y(e.dateField, "dateField", t), Ke(e.pagination, "pagination", t), e.timeWindow !== void 0 && (ge(e.timeWindow, "timeWindow", t), e.dateField || t.push(
3198
3309
  r(
3199
3310
  "missing_time_window_date_field",
3200
3311
  "Records timeWindow needs a dateField.",
3201
3312
  "dateField"
3202
3313
  )
3203
- )), ge(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((a, s) => {
3314
+ )), he(e.filters, "filters", t), Array.isArray(e.filters) && e.filters.forEach((a, s) => {
3204
3315
  f(a) && a.scope === "aggregate" && t.push(
3205
3316
  r(
3206
3317
  "unsupported_record_filter_scope",
@@ -3258,7 +3369,7 @@ function jt(e) {
3258
3369
  );
3259
3370
  });
3260
3371
  }
3261
- } else e.kind === "inputOptions" ? Un(e, t) : e.kind === "sql" ? (((o = e.source) == null ? void 0 : o.kind) !== "sql" && t.push(
3372
+ } else e.kind === "inputOptions" ? Zn(e, t) : e.kind === "sql" ? (((o = e.source) == null ? void 0 : o.kind) !== "sql" && t.push(
3262
3373
  r(
3263
3374
  "invalid_sql_source",
3264
3375
  "SQL analytics intent must use a SQL execution source.",
@@ -3266,13 +3377,13 @@ function jt(e) {
3266
3377
  )
3267
3378
  ), m(e.sql) || t.push(
3268
3379
  r("missing_sql", "SQL analytics intent needs SQL text.", "sql")
3269
- ), jn(
3380
+ ), Un(
3270
3381
  e.defaultParameters,
3271
3382
  "defaultParameters",
3272
3383
  t
3273
3384
  ), Array.isArray(e.fields) && e.fields.forEach((a, s) => {
3274
3385
  y(a, `fields.${s}`, t);
3275
- }), He(e.pagination, "pagination", t)) : t.push(
3386
+ }), Ke(e.pagination, "pagination", t)) : t.push(
3276
3387
  r(
3277
3388
  "invalid_analytics_kind",
3278
3389
  "Analytics kind is not supported.",
@@ -3283,10 +3394,10 @@ function jt(e) {
3283
3394
  ok: t.length === 0,
3284
3395
  errors: t,
3285
3396
  warnings: n,
3286
- repairHints: Ke(t)
3397
+ repairHints: Ze(t)
3287
3398
  };
3288
3399
  }
3289
- function Zn(e, t) {
3400
+ function ca(e, t) {
3290
3401
  if (!(!("derivedFields" in e) || e.derivedFields === void 0)) {
3291
3402
  if (!Array.isArray(e.derivedFields)) {
3292
3403
  t.push(
@@ -3299,7 +3410,7 @@ function Zn(e, t) {
3299
3410
  return;
3300
3411
  }
3301
3412
  e.derivedFields.forEach((n, o) => {
3302
- ve(
3413
+ Se(
3303
3414
  n
3304
3415
  ).errors.forEach((s) => {
3305
3416
  t.push({
@@ -3310,7 +3421,7 @@ function Zn(e, t) {
3310
3421
  });
3311
3422
  }
3312
3423
  }
3313
- function Jn(e) {
3424
+ function pa(e) {
3314
3425
  const t = [], n = [];
3315
3426
  if (!e || typeof e != "object")
3316
3427
  return {
@@ -3357,7 +3468,7 @@ function Jn(e) {
3357
3468
  )
3358
3469
  );
3359
3470
  });
3360
- else if (e.kind === "dashboard_change" || e.kind === "data_app_change") {
3471
+ else if (e.kind === "dashboard_change") {
3361
3472
  if (m(e.instruction) || t.push(
3362
3473
  r(
3363
3474
  "missing_instruction",
@@ -3365,7 +3476,7 @@ function Jn(e) {
3365
3476
  "instruction"
3366
3477
  )
3367
3478
  ), e.analyticsIntent) {
3368
- const o = jt(
3479
+ const o = Ot(
3369
3480
  e.analyticsIntent
3370
3481
  );
3371
3482
  t.push(...o.errors), n.push(...o.warnings);
@@ -3382,10 +3493,10 @@ function Jn(e) {
3382
3493
  ok: t.length === 0,
3383
3494
  errors: t,
3384
3495
  warnings: n,
3385
- repairHints: $t(t)
3496
+ repairHints: Pt(t)
3386
3497
  };
3387
3498
  }
3388
- function Qa(e) {
3499
+ function mo(e) {
3389
3500
  const t = [], n = [];
3390
3501
  if (!e || typeof e != "object")
3391
3502
  return {
@@ -3413,7 +3524,7 @@ function Qa(e) {
3413
3524
  "kind"
3414
3525
  )
3415
3526
  );
3416
- const o = Jn(
3527
+ const o = pa(
3417
3528
  e.operationIntent
3418
3529
  );
3419
3530
  return t.push(...o.errors), n.push(...o.warnings), Array.isArray(e.plannedToolCalls) || t.push(
@@ -3426,16 +3537,16 @@ function Qa(e) {
3426
3537
  ok: t.length === 0,
3427
3538
  errors: t,
3428
3539
  warnings: n,
3429
- repairHints: $t(t)
3540
+ repairHints: Pt(t)
3430
3541
  };
3431
3542
  }
3432
- function $t(e) {
3543
+ function Pt(e) {
3433
3544
  return e.map((t) => ({
3434
3545
  code: t.code,
3435
3546
  recommendedNextStep: t.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."
3436
3547
  }));
3437
3548
  }
3438
- function Ke(e) {
3549
+ function Ze(e) {
3439
3550
  return e.map((t) => {
3440
3551
  switch (t.code) {
3441
3552
  case "invalid_matrix_intent":
@@ -3523,7 +3634,7 @@ function Ke(e) {
3523
3634
  }
3524
3635
  }).filter((t) => !!t);
3525
3636
  }
3526
- function ea(e, t, n, o) {
3637
+ function ma(e, t, n, o) {
3527
3638
  if (!e || typeof e != "object") {
3528
3639
  n.push(
3529
3640
  r("invalid_view", "Dashboard view must be an object.", t)
@@ -3569,7 +3680,7 @@ function ea(e, t, n, o) {
3569
3680
  `${t}.analytics.kind`
3570
3681
  )
3571
3682
  );
3572
- const a = jt(e.analytics);
3683
+ const a = Ot(e.analytics);
3573
3684
  for (const s of a.errors)
3574
3685
  n.push(
3575
3686
  r(
@@ -3587,7 +3698,7 @@ function ea(e, t, n, o) {
3587
3698
  )
3588
3699
  );
3589
3700
  }
3590
- function Wa(e) {
3701
+ function fo(e) {
3591
3702
  const t = [], n = [];
3592
3703
  if (!e || typeof e != "object")
3593
3704
  return {
@@ -3607,7 +3718,7 @@ function Wa(e) {
3607
3718
  ), m(e.title) || t.push(
3608
3719
  r("missing_title", "Dashboard intent needs a title.", "title")
3609
3720
  );
3610
- const o = Array.isArray(e.inputs) ? e.inputs : [], a = Ge(
3721
+ const o = Array.isArray(e.inputs) ? e.inputs : [], a = Qe(
3611
3722
  o.filter(f).map((c) => c.id).filter((c) => typeof c == "string")
3612
3723
  );
3613
3724
  a && t.push(
@@ -3643,7 +3754,7 @@ function Wa(e) {
3643
3754
  );
3644
3755
  const l = s.flatMap(
3645
3756
  (c) => c && typeof c == "object" && Array.isArray(c.views) ? c.views.filter(f).map((p) => p.id).filter((p) => !!p) : []
3646
- ), d = Ge(l);
3757
+ ), d = Qe(l);
3647
3758
  d && t.push(
3648
3759
  r(
3649
3760
  "duplicate_view_id",
@@ -3680,7 +3791,7 @@ function Wa(e) {
3680
3791
  continue;
3681
3792
  }
3682
3793
  for (const [_, b] of p.views.entries())
3683
- ea(
3794
+ ma(
3684
3795
  b,
3685
3796
  `${u}.views.${_}`,
3686
3797
  t,
@@ -3690,154 +3801,164 @@ function Wa(e) {
3690
3801
  return { ok: t.length === 0, errors: t, warnings: n };
3691
3802
  }
3692
3803
  export {
3693
- Ba as $,
3694
- Ua as A,
3695
- Ei as B,
3696
- le as C,
3697
- Ci as D,
3698
- Ae as E,
3699
- on as F,
3700
- St as G,
3701
- ce as H,
3702
- It as I,
3703
- Ni as J,
3704
- F as K,
3705
- ji as L,
3706
- va as M,
3707
- dn as N,
3708
- kt as O,
3709
- Yi as P,
3710
- cn as Q,
3711
- aa as R,
3712
- gt as S,
3713
- oa as T,
3714
- Y as U,
3715
- Ye as V,
3716
- hn as W,
3717
- xe as X,
3718
- qe as Y,
3719
- J as Z,
3720
- kn as _,
3721
- Mt as a,
3722
- Fe as a$,
3723
- Se as a0,
3724
- Ot as a1,
3725
- ia as a2,
3726
- De as a3,
3727
- z as a4,
3728
- na as a5,
3729
- Yt as a6,
3730
- sa as a7,
3731
- Bt as a8,
3732
- qt as a9,
3733
- zt as aA,
3734
- he as aB,
3735
- _e as aC,
3736
- Qe as aD,
3737
- Qt as aE,
3738
- We as aF,
3739
- Xe as aG,
3740
- Ze as aH,
3741
- Je as aI,
3742
- et as aJ,
3743
- ra as aK,
3744
- la as aL,
3745
- j as aM,
3746
- da as aN,
3747
- ua as aO,
3748
- Ee as aP,
3749
- ca as aQ,
3750
- pa as aR,
3751
- ma as aS,
3752
- ii as aT,
3753
- ni as aU,
3754
- fa as aV,
3755
- ga as aW,
3756
- qa as aX,
3757
- La as aY,
3758
- T as aZ,
3759
- Rt as a_,
3760
- me as aa,
3761
- Hn as ab,
3762
- Ka as ac,
3763
- jt as ad,
3764
- Jn as ae,
3765
- Qa as af,
3766
- Wa as ag,
3767
- ve as ah,
3768
- ke as ai,
3769
- Si as aj,
3770
- Ii as ak,
3771
- st as al,
3772
- xi as am,
3773
- Fi as an,
3774
- dt as ao,
3775
- ut as ap,
3776
- $e as aq,
3777
- pt as ar,
3778
- ha as as,
3779
- _a as at,
3780
- Ut as au,
3781
- O as av,
3782
- R as aw,
3783
- U as ax,
3784
- te as ay,
3785
- X as az,
3786
- Sa as b,
3787
- Tt as b0,
3788
- Ha as b1,
3789
- ft as b2,
3790
- L as b3,
3791
- Di as b4,
3792
- H as b5,
3793
- ya as b6,
3794
- x as b7,
3795
- Ri as b8,
3796
- ba as b9,
3797
- mt as ba,
3798
- $ as bb,
3799
- Ne as bc,
3800
- Zi as bd,
3801
- _n as be,
3802
- Ma as bf,
3803
- zi as bg,
3804
- Oa as bh,
3804
+ Fe as $,
3805
+ co as A,
3806
+ bt as B,
3807
+ de as C,
3808
+ Li as D,
3809
+ ke as E,
3810
+ Ae as F,
3811
+ Te as G,
3812
+ Ot as H,
3813
+ ao as I,
3814
+ oo as J,
3815
+ ja as K,
3816
+ Bi as L,
3817
+ ht as M,
3818
+ so as N,
3819
+ zt as O,
3820
+ Vi as P,
3821
+ Gt as Q,
3822
+ _a as R,
3823
+ ya as S,
3824
+ ba as T,
3825
+ W as U,
3826
+ Sa as V,
3827
+ va as W,
3828
+ Ht as X,
3829
+ fe as Y,
3830
+ St as Z,
3831
+ Pi as _,
3832
+ Nt as a,
3833
+ Fa as a$,
3834
+ fn as a0,
3835
+ kt as a1,
3836
+ pe as a2,
3837
+ At as a3,
3838
+ Yi as a4,
3839
+ F as a5,
3840
+ $a as a6,
3841
+ bn as a7,
3842
+ xt as a8,
3843
+ vn as a9,
3844
+ pt as aA,
3845
+ mt as aB,
3846
+ Oe as aC,
3847
+ gt as aD,
3848
+ Ea as aE,
3849
+ Na as aF,
3850
+ Kt as aG,
3851
+ O as aH,
3852
+ R as aI,
3853
+ V as aJ,
3854
+ ie as aK,
3855
+ Jt as aL,
3856
+ _e as aM,
3857
+ be as aN,
3858
+ Je as aO,
3859
+ ti as aP,
3860
+ et as aQ,
3861
+ tt as aR,
3862
+ it as aS,
3863
+ nt as aT,
3864
+ at as aU,
3865
+ wa as aV,
3866
+ ka as aW,
3867
+ j as aX,
3868
+ Aa as aY,
3869
+ xa as aZ,
3870
+ je as a_,
3871
+ P as aa,
3872
+ Le as ab,
3873
+ An as ac,
3874
+ Re as ad,
3875
+ He as ae,
3876
+ ee as af,
3877
+ En as ag,
3878
+ no as ah,
3879
+ Ie as ai,
3880
+ Bt as aj,
3881
+ ga as ak,
3882
+ Ne as al,
3883
+ ha as am,
3884
+ qt as an,
3885
+ Ut as ao,
3886
+ Vt as ap,
3887
+ ea as aq,
3888
+ po as ar,
3889
+ pa as as,
3890
+ mo as at,
3891
+ fo as au,
3892
+ Se as av,
3893
+ Fi as aw,
3894
+ Ri as ax,
3895
+ Ei as ay,
3896
+ Ni as az,
3897
+ Oa as b,
3898
+ Ra as b0,
3899
+ Ta as b1,
3900
+ li as b2,
3901
+ di as b3,
3902
+ Da as b4,
3903
+ Ma as b5,
3904
+ T as b6,
3905
+ Mt as b7,
3906
+ Et as b8,
3907
+ lo as b9,
3908
+ Ha as bA,
3909
+ ce as bB,
3910
+ Ga as bC,
3911
+ Fn as bD,
3912
+ we as bE,
3913
+ ci as bF,
3914
+ Va as ba,
3915
+ Hi as bb,
3916
+ zi as bc,
3917
+ Ia as bd,
3918
+ _t as be,
3919
+ U as bf,
3920
+ Oi as bg,
3921
+ G as bh,
3805
3922
  Ca as bi,
3806
- Da as bj,
3807
- Ea as bk,
3808
- Xi as bl,
3809
- Ji as bm,
3810
- ja as bn,
3811
- Na as bo,
3812
- $a as bp,
3813
- Ra as bq,
3814
- ue as br,
3815
- Ta as bs,
3816
- bn as bt,
3817
- Ie as bu,
3818
- oi as bv,
3819
- Ia as c,
3820
- Oi as d,
3821
- ht as e,
3822
- wa as f,
3823
- $i as g,
3824
- Aa as h,
3825
- Lt as i,
3826
- xa as j,
3827
- Fa as k,
3828
- de as l,
3829
- gn as m,
3830
- ka as n,
3831
- At as o,
3832
- Ga as p,
3833
- pe as q,
3834
- Pa as r,
3835
- Mn as s,
3836
- xn as t,
3837
- Va as u,
3838
- re as v,
3839
- Pt as w,
3840
- mn as x,
3841
- Ya as y,
3842
- za as z
3923
+ x as bj,
3924
+ ji as bk,
3925
+ C as bl,
3926
+ Ce as bm,
3927
+ ln as bn,
3928
+ xn as bo,
3929
+ za as bp,
3930
+ nn as bq,
3931
+ eo as br,
3932
+ Ja as bs,
3933
+ Wa as bt,
3934
+ Ka as bu,
3935
+ rn as bv,
3936
+ dn as bw,
3937
+ Xa as bx,
3938
+ Qa as by,
3939
+ Za as bz,
3940
+ Pa as c,
3941
+ Ui as d,
3942
+ yt as e,
3943
+ Ba as f,
3944
+ qi as g,
3945
+ qa as h,
3946
+ Wt as i,
3947
+ La as j,
3948
+ Ua as k,
3949
+ ue as l,
3950
+ kn as m,
3951
+ Ya as n,
3952
+ Rt as o,
3953
+ uo as p,
3954
+ me as q,
3955
+ io as r,
3956
+ Yn as s,
3957
+ Cn as t,
3958
+ ro as u,
3959
+ Z as v,
3960
+ le as w,
3961
+ Lt as x,
3962
+ In as y,
3963
+ to as z
3843
3964
  };