react-semaphor 0.1.602 → 0.1.603

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 (107) hide show
  1. package/dist/analytics-protocol/index.js +415 -375
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +8 -8
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/{add-to-dashboard-ClhEIFst.js → add-to-dashboard-CFF-wFU-.js} +1 -1
  7. package/dist/chunks/{analytics-base-schemas-DevrgqQb.js → analytics-base-schemas-DsUh5Q3C.js} +14 -12
  8. package/dist/chunks/{assistant-chat-BWF3GYip.js → assistant-chat-B6hNQI1t.js} +146 -146
  9. package/dist/chunks/{bookmark-impact-BF3iRx5a.js → bookmark-impact-Ba2PLcGp.js} +3 -3
  10. package/dist/chunks/{bookmark-state-CBSTdW6q.js → bookmark-state-n7AaNzR_.js} +517 -516
  11. package/dist/chunks/{card-filter-builder-B8XHwMY6.js → card-filter-builder-Y22HizVx.js} +104 -104
  12. package/dist/chunks/{comparison-window-caption-W83qB4V5.js → comparison-window-caption-Ck2TIbnR.js} +69 -69
  13. package/dist/chunks/{context-BJoEFgNl.js → context-UCQ7sere.js} +1 -1
  14. package/dist/chunks/{dashboard-DG5EIYYB.js → dashboard-BghI99oY.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CBSrhyWZ.js → dashboard-briefing-launcher-DtBAnGiH.js} +103 -103
  16. package/dist/chunks/{dashboard-controls-D6ECO4N1.js → dashboard-controls-CtFXlyjV.js} +53 -53
  17. package/dist/chunks/{dashboard-json-DrJftBSL.js → dashboard-json-DfGBUtCd.js} +5 -5
  18. package/dist/chunks/dates-BnrXF4bb.js +185 -0
  19. package/dist/chunks/{edit-dashboard-visual-BDYAJIbb.js → edit-dashboard-visual-oxt3x1wb.js} +7976 -8184
  20. package/dist/chunks/{filter-line-BXT6y303.js → filter-line-Cy5YYqRL.js} +27 -27
  21. package/dist/chunks/{filter-reach-copy-BukhZmzm.js → filter-reach-copy-CE_ZX147.js} +1590 -1729
  22. package/dist/chunks/{filter-value-text-D3-bf3_b.js → filter-value-text-fWvSDwkl.js} +11 -11
  23. package/dist/chunks/{index-BW0yozjs.js → index-D5rxbtS4.js} +24 -24
  24. package/dist/chunks/{layout-grid-Ds0diMeY.js → layout-grid-9LndRoLa.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-CgQgVeeI.js → matrix-analytical-definition-CCp48UCw.js} +496 -425
  26. package/dist/chunks/matrix-member-presentation-zNehruXR.js +391 -0
  27. package/dist/chunks/{matrix-operation-contract--DkNCOzd.js → matrix-operation-contract-DPBj69D8.js} +3 -2
  28. package/dist/chunks/{metric-comparison-zMylnIkc.js → metric-comparison-B0FR-Q8I.js} +184 -125
  29. package/dist/chunks/{paintbrush-CX8pao1j.js → paintbrush-58FQYY-y.js} +1 -1
  30. package/dist/chunks/{palette-CuA0HlzF.js → palette-Be62Tkoa.js} +1 -1
  31. package/dist/chunks/{pivot-result-contract-expectations-C8KL7hPx.js → pivot-result-contract-expectations-BYqAmG9n.js} +1236 -1190
  32. package/dist/chunks/{pivot-result-identity-C1AOH1PS.js → pivot-result-identity-CAP4--iq.js} +1 -1
  33. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +3778 -0
  34. package/dist/chunks/{report-preferences-dialog-CbuVNDGi.js → report-preferences-dialog-uJp9GBTM.js} +219 -205
  35. package/dist/chunks/{report-runtime-context-E7USjN7E.js → report-runtime-context-c77_KF9v.js} +2 -2
  36. package/dist/chunks/{resolve-dashboard-input-context-CULCE_hM.js → resolve-dashboard-input-context-Rtl1ffmE.js} +7115 -6963
  37. package/dist/chunks/{save-BKHlDONy.js → save-C5A0JnEV.js} +1 -1
  38. package/dist/chunks/{saved-dashboard-context-C1WlOx5z.js → saved-dashboard-context-tcyTU8jm.js} +193 -207
  39. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +150 -0
  40. package/dist/chunks/{semaphor-ready-indicator-CBIRcDWs.js → semaphor-ready-indicator-FBvunj6S.js} +35550 -35273
  41. package/dist/chunks/{shelf-drop-preview-context-xR69SMA8.js → shelf-drop-preview-context-QKStrcK9.js} +6 -6
  42. package/dist/chunks/{stored-dashboard-BuM8vnWf.js → stored-dashboard-CHozcAY9.js} +621 -616
  43. package/dist/chunks/{style-sheet-parts-Bt9ZNre8.js → style-sheet-parts-CDCG-8Ej.js} +258 -251
  44. package/dist/chunks/{table-export-sheet-DVljtHkG.js → table-export-sheet-ZFIvs6Sj.js} +1 -1
  45. package/dist/chunks/{token-types-D_xKgyVS.js → token-types-XbM6QByy.js} +1 -1
  46. package/dist/chunks/{upload-Dll_M7XQ.js → upload-H15d7uHK.js} +1 -1
  47. package/dist/chunks/{validators-ClWHpYql.js → validators-Baf3VIf5.js} +3 -3
  48. package/dist/chunks/{variable-draft-CDGGl53R.js → variable-draft-C2y8Jp6Z.js} +3 -3
  49. package/dist/dashboard/index.js +2 -2
  50. package/dist/dashboard-authoring/index.js +2466 -2343
  51. package/dist/format-utils/index.js +205 -204
  52. package/dist/index.js +20 -20
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
  57. package/dist/types/index.js +5 -5
  58. package/dist/types/lib/document/document-edits.d.ts +0 -4
  59. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  60. package/dist/types/lib/types/common-types.d.ts +0 -2
  61. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  62. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  63. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  64. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  65. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  66. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  67. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  68. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  69. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  70. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  71. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  72. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  73. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +1 -1
  74. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  75. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  76. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  77. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  78. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +21 -358
  79. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  80. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  81. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  82. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  83. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  84. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  85. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  86. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  87. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  88. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  89. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  90. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  91. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +33 -8
  92. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +0 -2
  93. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +3 -0
  94. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  95. package/dist/types/shared/format-utils/index.d.ts +1 -0
  96. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  97. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  98. package/dist/types/shared/temporal/index.d.ts +2 -0
  99. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  100. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  101. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  102. package/dist/usage-events/index.js +1 -1
  103. package/package.json +3 -2
  104. package/dist/chunks/dates-Bz-qM5px.js +0 -164
  105. package/dist/chunks/matrix-member-presentation-DSBIIudt.js +0 -258
  106. package/dist/chunks/raw-temporal-value-E416F-0L.js +0 -454
  107. package/dist/chunks/selection-filter-compiler-ifT8JCXS.js +0 -131
@@ -1,59 +1,59 @@
1
- import { G as O, H as A, E as he, I as te, F as U, L as pe } from "./raw-temporal-value-E416F-0L.js";
2
- import { ah as z, ao as C, aq as w, ai as K, ag as p, ap as ve, av as Ne, aj as ke, a6 as Q, e as Ie, J as X, q as Ce } from "./validators-ClWHpYql.js";
3
- import { r as _e } from "./metric-comparison-zMylnIkc.js";
4
- import { M as Se } from "./matrix-operation-contract--DkNCOzd.js";
5
- class Y extends Error {
1
+ import { a0 as Q, a1 as T, U as _e, a2 as se, Z as V, W as re, T as Te, B as De, a5 as Ae } from "./raw-temporal-value-Dg_MTFF7.js";
2
+ import { ah as Z, ao as C, aq as U, ai as X, ag as p, ap as Ee, av as qe, aj as xe, a6 as K, e as Be, J as ee, q as Fe } from "./validators-Baf3VIf5.js";
3
+ import { a as Le, r as Pe } from "./metric-comparison-B0FR-Q8I.js";
4
+ import { M as He } from "./matrix-operation-contract-DPBj69D8.js";
5
+ class te extends Error {
6
6
  constructor(t) {
7
7
  super(t), this.name = "RelativeDateUsageError";
8
8
  }
9
9
  }
10
- function Ae(e, t, n = {}) {
11
- const i = n.spansBack ?? 0;
12
- if (i !== 0) return Te(e, t, i);
13
- const { calendar: a, now: r } = t;
10
+ function Me(e, t, n = {}) {
11
+ const a = n.spansBack ?? 0;
12
+ if (a !== 0) return Oe(e, t, a);
13
+ const { calendar: i, now: r } = t;
14
14
  switch (e.kind) {
15
15
  case "periods": {
16
- const o = ne(e, t);
16
+ const o = oe(e, t);
17
17
  return {
18
- start: U(o, e.unit, a, e.from).start,
19
- end: e.toDate ? o : ie(o, e.unit, a, e.to)
18
+ start: V(o, e.unit, i, e.from).start,
19
+ end: e.toDate ? o : ce(o, e.unit, i, e.to)
20
20
  };
21
21
  }
22
22
  case "rolling": {
23
- const o = e.anchor === "latest_data" ? t.latestData ?? r : r, s = he[e.unit];
23
+ const o = e.anchor === "latest_data" ? t.latestData ?? r : r, s = _e[e.unit];
24
24
  return {
25
- start: s === void 0 ? te(o, -e.n, e.unit, a) : new Date(o.getTime() - e.n * s),
25
+ start: s === void 0 ? se(o, -e.n, e.unit, i) : new Date(o.getTime() - e.n * s),
26
26
  end: o
27
27
  };
28
28
  }
29
29
  case "monthDay": {
30
- const o = e.day === "first" ? O(r, "month", a) : A(r, "month", a);
31
- return { start: O(o, "day", a), end: A(o, "day", a) };
30
+ const o = e.day === "first" ? Q(r, "month", i) : T(r, "month", i);
31
+ return { start: Q(o, "day", i), end: T(o, "day", i) };
32
32
  }
33
33
  }
34
34
  }
35
- function ne(e, t) {
35
+ function oe(e, t) {
36
36
  const { anchor: n } = e;
37
- return n === "latest_data" ? t.latestData ?? t.now : n === "now" ? t.now : new Date(O(t.now, n.lastComplete, t.calendar).getTime() - 1);
37
+ return n === "latest_data" ? t.latestData ?? t.now : n === "now" ? t.now : new Date(Q(t.now, n.lastComplete, t.calendar).getTime() - 1);
38
38
  }
39
- function ie(e, t, n, i) {
40
- return new Date(U(e, t, n, i).endExclusive.getTime() - 1);
39
+ function ce(e, t, n, a) {
40
+ return new Date(V(e, t, n, a).endExclusive.getTime() - 1);
41
41
  }
42
- function Te(e, t, n) {
42
+ function Oe(e, t, n) {
43
43
  if (!Number.isInteger(n) || n < 0)
44
- throw new Y(`spansBack must be a whole number of spans, got ${n}.`);
44
+ throw new te(`spansBack must be a whole number of spans, got ${n}.`);
45
45
  if (e.kind !== "periods" || typeof e.anchor != "object")
46
- throw new Y("spansBack applies only to a window anchored at the end of the last complete period.");
47
- const { calendar: i } = t, { unit: a } = e, r = Ae(e, t), o = -n * (e.to - e.from + 1), s = U(r.start, a, i, o).start;
48
- if (A(r.end, a, i).getTime() === r.end.getTime())
49
- return { start: s, end: ie(r.end, a, i, o) };
50
- const l = te(ne(e, t), o, a, i), c = Math.min(
51
- A(l, e.anchor.lastComplete, i).getTime(),
52
- A(l, a, i).getTime()
46
+ throw new te("spansBack applies only to a window anchored at the end of the last complete period.");
47
+ const { calendar: a } = t, { unit: i } = e, r = Me(e, t), o = -n * (e.to - e.from + 1), s = V(r.start, i, a, o).start;
48
+ if (T(r.end, i, a).getTime() === r.end.getTime())
49
+ return { start: s, end: ce(r.end, i, a, o) };
50
+ const l = se(oe(e, t), o, i, a), c = Math.min(
51
+ T(l, e.anchor.lastComplete, a).getTime(),
52
+ T(l, i, a).getTime()
53
53
  );
54
54
  return { start: s, end: new Date(c) };
55
55
  }
56
- function G(e) {
56
+ function J(e) {
57
57
  return e.prefixLevels.length === 1 && e.prefixLevels[0] === "table" ? ["table"] : Array.from(
58
58
  /* @__PURE__ */ new Set([
59
59
  "database",
@@ -61,25 +61,25 @@ function G(e) {
61
61
  ])
62
62
  );
63
63
  }
64
- function ae(e) {
65
- const { recorded: t, capabilities: n } = e, i = G(n);
66
- return !(t.databaseName && !i.includes("database") || t.schemaName && !i.includes("schema")) || !t.tableName ? t : {
67
- ...z({
64
+ function le(e) {
65
+ const { recorded: t, capabilities: n } = e, a = J(n);
66
+ return !(t.databaseName && !a.includes("database") || t.schemaName && !a.includes("schema")) || !t.tableName ? t : {
67
+ ...Z({
68
68
  qualifiedName: [t.databaseName, t.schemaName, t.tableName].filter(Boolean).join("."),
69
69
  capabilities: n
70
70
  }),
71
- ...i.includes("database") && t.databaseName ? { databaseName: t.databaseName } : {},
72
- ...i.includes("schema") && t.schemaName ? { schemaName: t.schemaName } : {},
71
+ ...a.includes("database") && t.databaseName ? { databaseName: t.databaseName } : {},
72
+ ...a.includes("schema") && t.schemaName ? { schemaName: t.schemaName } : {},
73
73
  tableName: t.tableName
74
74
  };
75
75
  }
76
- function rt(e) {
77
- const t = e.source.connectionType ? C(e.source.connectionType) : void 0, n = e.source.dialect ? w(e.source.dialect) : void 0, i = e.source.dialect && e.source.dialect !== "unknown" ? C(e.source.dialect) : void 0;
76
+ function kt(e) {
77
+ const t = e.source.connectionType ? C(e.source.connectionType) : void 0, n = e.source.dialect ? U(e.source.dialect) : void 0, a = e.source.dialect && e.source.dialect !== "unknown" ? C(e.source.dialect) : void 0;
78
78
  if (!e.capabilities && e.source.connectionType && e.source.dialect && e.source.dialect !== "unknown" && (!t || n === "unknown" || t.dialect !== n))
79
79
  return { kind: "incompatible_capabilities" };
80
- const a = e.capabilities || t || i;
81
- if (!a) return { kind: "incompatible_capabilities" };
82
- const r = G(a), o = {
80
+ const i = e.capabilities || t || a;
81
+ if (!i) return { kind: "incompatible_capabilities" };
82
+ const r = J(i), o = {
83
83
  ...r.includes("database") && e.source.databaseName ? { databaseName: e.source.databaseName } : {},
84
84
  ...r.includes("schema") && e.source.schemaName ? { schemaName: e.source.schemaName } : {},
85
85
  ...e.source.tableName ? { tableName: e.source.tableName } : {}
@@ -92,50 +92,50 @@ function rt(e) {
92
92
  function f(e) {
93
93
  return typeof e == "string" && e.trim() ? e.trim() : void 0;
94
94
  }
95
- function D(e) {
95
+ function E(e) {
96
96
  return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
97
97
  }
98
- function se(e) {
99
- const t = D(e);
98
+ function de(e) {
99
+ const t = E(e);
100
100
  return !t || !f(t.name) || t.type === "model" ? !1 : t.type === "dataset" ? t.datasetType === "physical" : !0;
101
101
  }
102
- function q(e, t) {
103
- const n = D(e);
102
+ function x(e, t) {
103
+ const n = E(e);
104
104
  if (!n) return {};
105
- const i = f(n.table) || f(n.name);
106
- return ae({
105
+ const a = f(n.table) || f(n.name);
106
+ return le({
107
107
  recorded: {
108
108
  ...f(n.database) ? { databaseName: f(n.database) } : {},
109
109
  ...f(n.schema) ? { schemaName: f(n.schema) } : {},
110
- ...i ? { tableName: i } : {}
110
+ ...a ? { tableName: a } : {}
111
111
  },
112
112
  capabilities: t
113
113
  });
114
114
  }
115
- function De(e) {
116
- if (Be(e)) return { kind: "malformed" };
117
- const t = e.entities.filter(se), n = Ee(e), i = qe({
115
+ function Re(e) {
116
+ if (We(e)) return { kind: "malformed" };
117
+ const t = e.entities.filter(de), n = je(e), a = ze({
118
118
  entities: t,
119
119
  connectionType: e.connectionType,
120
120
  dialect: e.dialect,
121
121
  capabilities: e.capabilities
122
122
  });
123
- if (!i) return { kind: "incompatible_capabilities" };
124
- const { capabilities: a } = i, r = He({
123
+ if (!a) return { kind: "incompatible_capabilities" };
124
+ const { capabilities: i } = a, r = Qe({
125
125
  hints: e.qualifiedHints || [],
126
126
  coordinateHint: e.coordinateHint,
127
- capabilityAuthority: i
127
+ capabilityAuthority: a
128
128
  });
129
129
  if (r.kind !== "valid")
130
130
  return { kind: r.kind };
131
131
  const o = r.coordinates, s = o ? t.filter(
132
- (c) => K({
133
- left: oe(
134
- q(c, a),
135
- a
132
+ (c) => X({
133
+ left: ue(
134
+ x(c, i),
135
+ i
136
136
  ),
137
137
  right: o,
138
- capabilities: a
138
+ capabilities: i
139
139
  })
140
140
  ) : t;
141
141
  if (o && s.length === 0)
@@ -143,19 +143,19 @@ function De(e) {
143
143
  kind: "not_found",
144
144
  basis: "qualified",
145
145
  coordinates: o,
146
- capabilityAuthority: i
146
+ capabilityAuthority: a
147
147
  };
148
148
  if (o && s.length === 1) {
149
- const c = s[0], d = R(
150
- i,
149
+ const c = s[0], d = O(
150
+ a,
151
151
  c
152
152
  );
153
153
  return {
154
154
  kind: "resolved",
155
155
  basis: "qualified",
156
156
  entity: c,
157
- coordinates: Re(
158
- q(
157
+ coordinates: Ge(
158
+ x(
159
159
  c,
160
160
  d.capabilities
161
161
  ),
@@ -165,27 +165,27 @@ function De(e) {
165
165
  capabilityAuthority: d
166
166
  };
167
167
  }
168
- const l = re([
168
+ const l = fe([
169
169
  ...e.bareHints || [],
170
170
  ...r.bareHints,
171
171
  o == null ? void 0 : o.tableName
172
172
  ]);
173
173
  if (l.size > 0) {
174
174
  const c = s.filter((d) => {
175
- const m = Pe(d);
175
+ const m = Ke(d);
176
176
  return Array.from(l).some((g) => m.has(g));
177
177
  });
178
178
  if (c.length === 1) {
179
- const d = c[0], m = R(
180
- i,
179
+ const d = c[0], m = O(
180
+ a,
181
181
  d
182
182
  );
183
183
  return {
184
184
  kind: "resolved",
185
185
  basis: "bare",
186
186
  entity: d,
187
- coordinates: B(
188
- q(
187
+ coordinates: F(
188
+ x(
189
189
  d,
190
190
  m.capabilities
191
191
  ),
@@ -194,7 +194,7 @@ function De(e) {
194
194
  capabilityAuthority: m
195
195
  };
196
196
  }
197
- return c.length > 1 ? { kind: "ambiguous", basis: "bare" } : { kind: "not_found", basis: "bare", capabilityAuthority: i };
197
+ return c.length > 1 ? { kind: "ambiguous", basis: "bare" } : { kind: "not_found", basis: "bare", capabilityAuthority: a };
198
198
  }
199
199
  if (o)
200
200
  return { kind: "ambiguous", basis: "qualified" };
@@ -202,19 +202,19 @@ function De(e) {
202
202
  return {
203
203
  kind: "not_found",
204
204
  basis: n,
205
- capabilityAuthority: i
205
+ capabilityAuthority: a
206
206
  };
207
207
  if (t.length === 1) {
208
- const c = t[0], d = R(
209
- i,
208
+ const c = t[0], d = O(
209
+ a,
210
210
  c
211
211
  );
212
212
  return {
213
213
  kind: "resolved",
214
214
  basis: "unqualified",
215
215
  entity: c,
216
- coordinates: B(
217
- q(
216
+ coordinates: F(
217
+ x(
218
218
  c,
219
219
  d.capabilities
220
220
  ),
@@ -225,29 +225,29 @@ function De(e) {
225
225
  }
226
226
  return { kind: "unqualified" };
227
227
  }
228
- function Ee(e) {
229
- const t = (e.qualifiedHints || []).map(f).filter((i) => !!i);
228
+ function je(e) {
229
+ const t = (e.qualifiedHints || []).map(f).filter((a) => !!a);
230
230
  return Object.values(e.coordinateHint || {}).some(
231
- (i) => !!f(i)
232
- ) || t.some((i) => i.includes(".")) ? "qualified" : [...t, ...e.bareHints || []].some(
233
- (i) => !!f(i)
231
+ (a) => !!f(a)
232
+ ) || t.some((a) => a.includes(".")) ? "qualified" : [...t, ...e.bareHints || []].some(
233
+ (a) => !!f(a)
234
234
  ) ? "bare" : void 0;
235
235
  }
236
- function T(e) {
236
+ function D(e) {
237
237
  return `${e.dialect}:${e.prefixLevels.join(".")}`;
238
238
  }
239
- function F(e) {
239
+ function B(e) {
240
240
  return {
241
241
  dialect: e.dialect,
242
242
  prefixLevels: [...e.prefixLevels]
243
243
  };
244
244
  }
245
- function qe(e) {
246
- var N;
247
- const t = f(e.connectionType), n = f(e.dialect), i = e.capabilities ? F(e.capabilities) : void 0, a = t ? C(t) : void 0, r = n ? w(n) : void 0, o = n && n !== "unknown" ? C(n) : void 0;
248
- if (t && !a || n && n !== "unknown" && r === "unknown" || i && a && T(i) !== T(a))
245
+ function ze(e) {
246
+ var k;
247
+ const t = f(e.connectionType), n = f(e.dialect), a = e.capabilities ? B(e.capabilities) : void 0, i = t ? C(t) : void 0, r = n ? U(n) : void 0, o = n && n !== "unknown" ? C(n) : void 0;
248
+ if (t && !i || n && n !== "unknown" && r === "unknown" || a && i && D(a) !== D(i))
249
249
  return;
250
- const s = i || (a ? F(a) : o ? F(o) : void 0);
250
+ const s = a || (i ? B(i) : o ? B(o) : void 0);
251
251
  if (s)
252
252
  return r && r !== "unknown" && s.dialect !== r ? void 0 : {
253
253
  capabilities: s,
@@ -256,16 +256,16 @@ function qe(e) {
256
256
  evidence: "explicit"
257
257
  };
258
258
  const l = e.entities.map((b) => {
259
- const k = D(b), h = f(k == null ? void 0 : k.connectionType), I = f(k == null ? void 0 : k.dialect), S = h ? C(h) : void 0, E = I ? w(I) : void 0, L = I && I !== "unknown" ? C(I) : void 0;
260
- if (h && !S || I && I !== "unknown" && E === "unknown" || I && I !== "unknown" && !S && !L || S && E && E !== "unknown" && S.dialect !== E)
259
+ const I = E(b), h = f(I == null ? void 0 : I.connectionType), N = f(I == null ? void 0 : I.dialect), _ = h ? C(h) : void 0, q = N ? U(N) : void 0, H = N && N !== "unknown" ? C(N) : void 0;
260
+ if (h && !_ || N && N !== "unknown" && q === "unknown" || N && N !== "unknown" && !_ && !H || _ && q && q !== "unknown" && _.dialect !== q)
261
261
  return;
262
- const J = S || L, P = J ? F(J) : Fe(k);
263
- return P ? {
264
- capabilities: P,
262
+ const w = _ || H, M = w ? B(w) : $e(I);
263
+ return M ? {
264
+ capabilities: M,
265
265
  connectionType: h,
266
- capabilityIdentity: h ? ve(h) : void 0,
267
- inferred: !S && !L,
268
- signature: T(P)
266
+ capabilityIdentity: h ? Ee(h) : void 0,
267
+ inferred: !_ && !H,
268
+ signature: D(M)
269
269
  } : void 0;
270
270
  });
271
271
  if (l.some((b) => !b)) return;
@@ -274,7 +274,7 @@ function qe(e) {
274
274
  );
275
275
  if (new Set(c.map((b) => b.signature)).size > 1)
276
276
  return;
277
- const d = (N = c[0]) == null ? void 0 : N.capabilities;
277
+ const d = (k = c[0]) == null ? void 0 : k.capabilities;
278
278
  if (!d || r && r !== "unknown" && d.dialect !== r)
279
279
  return;
280
280
  const m = new Set(
@@ -289,7 +289,7 @@ function qe(e) {
289
289
  evidence: c.every((b) => b.inferred) ? "coordinates" : "entity"
290
290
  };
291
291
  }
292
- function Fe(e) {
292
+ function $e(e) {
293
293
  const t = !!f(e == null ? void 0 : e.database), n = !!f(e == null ? void 0 : e.schema);
294
294
  if (!(t && n)) {
295
295
  if (n)
@@ -298,59 +298,59 @@ function Fe(e) {
298
298
  return { dialect: "unknown", prefixLevels: ["database", "table"] };
299
299
  }
300
300
  }
301
- function R(e, t) {
302
- var a;
301
+ function O(e, t) {
302
+ var i;
303
303
  if (e.evidence !== "entity") return e;
304
- const n = f((a = D(t)) == null ? void 0 : a.connectionType), i = n ? C(n) : void 0;
305
- return i && T(i) === T(e.capabilities) ? { ...e, connectionType: n } : e;
304
+ const n = f((i = E(t)) == null ? void 0 : i.connectionType), a = n ? C(n) : void 0;
305
+ return a && D(a) === D(e.capabilities) ? { ...e, connectionType: n } : e;
306
306
  }
307
- function Be(e) {
307
+ function We(e) {
308
308
  return (e.qualifiedHints || []).some(
309
309
  (n) => {
310
- const i = f(n);
311
- return !!(i && i.includes(".") && !p(i));
310
+ const a = f(n);
311
+ return !!(a && a.includes(".") && !p(a));
312
312
  }
313
313
  ) ? !0 : Object.values(e.coordinateHint || {}).some((n) => {
314
- const i = f(n);
315
- return !!(i && !p(i));
314
+ const a = f(n);
315
+ return !!(a && !p(a));
316
316
  });
317
317
  }
318
- function He(e) {
319
- const { capabilities: t } = e.capabilityAuthority, n = [], i = [];
318
+ function Qe(e) {
319
+ const { capabilities: t } = e.capabilityAuthority, n = [], a = [];
320
320
  for (const m of e.hints) {
321
321
  const g = f(m);
322
322
  if (!g) continue;
323
323
  if (!g.includes(".")) {
324
- i.push(g);
324
+ a.push(g);
325
325
  continue;
326
326
  }
327
- const N = p(g);
328
- if (!N) return { kind: "malformed" };
329
- n.push(N);
327
+ const k = p(g);
328
+ if (!k) return { kind: "malformed" };
329
+ n.push(k);
330
330
  }
331
- const a = xe(e.coordinateHint);
332
- if (a.kind === "malformed") return a;
331
+ const i = Ze(e.coordinateHint);
332
+ if (i.kind === "malformed") return i;
333
333
  const r = Array.from(new Set(n)).map(
334
- (m) => z({
334
+ (m) => Z({
335
335
  qualifiedName: m,
336
336
  capabilities: t
337
337
  })
338
338
  );
339
- if (!Le(r, t))
339
+ if (!Ue(r, t))
340
340
  return { kind: "conflicting" };
341
341
  const o = [...new Set(n)].sort(
342
342
  (m, g) => g.split(".").length - m.split(".").length
343
- )[0], s = o ? z({
343
+ )[0], s = o ? Z({
344
344
  qualifiedName: o,
345
345
  capabilities: t
346
- }) : void 0, l = oe(
347
- a.coordinates,
346
+ }) : void 0, l = ue(
347
+ i.coordinates,
348
348
  t
349
- ), c = B(
350
- a.coordinates,
349
+ ), c = F(
350
+ i.coordinates,
351
351
  e.capabilityAuthority
352
352
  ), d = !!(l.tableName && (l.databaseName || l.schemaName));
353
- return s && d && !K({
353
+ return s && d && !X({
354
354
  left: s,
355
355
  right: l,
356
356
  capabilities: t
@@ -361,55 +361,55 @@ function He(e) {
361
361
  ...s
362
362
  } : d ? c : void 0,
363
363
  bareHints: [
364
- ...i,
364
+ ...a,
365
365
  ...!d && l.tableName ? [l.tableName] : []
366
366
  ]
367
367
  };
368
368
  }
369
- function xe(e) {
369
+ function Ze(e) {
370
370
  const t = {};
371
- for (const [n, i] of Object.entries(e || {})) {
372
- const a = f(i);
373
- if (!a) continue;
374
- const r = p(a);
371
+ for (const [n, a] of Object.entries(e || {})) {
372
+ const i = f(a);
373
+ if (!i) continue;
374
+ const r = p(i);
375
375
  if (!r) return { kind: "malformed" };
376
376
  t[n] = r;
377
377
  }
378
378
  return { kind: "valid", coordinates: t };
379
379
  }
380
- function oe(e, t) {
380
+ function ue(e, t) {
381
381
  return {
382
382
  ...t.prefixLevels.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
383
383
  ...t.prefixLevels.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
384
384
  ...e.tableName ? { tableName: e.tableName } : {}
385
385
  };
386
386
  }
387
- function Le(e, t) {
387
+ function Ue(e, t) {
388
388
  return e.every(
389
- (n, i) => e.slice(i + 1).every(
390
- (a) => K({
389
+ (n, a) => e.slice(a + 1).every(
390
+ (i) => X({
391
391
  left: n,
392
- right: a,
392
+ right: i,
393
393
  capabilities: t
394
394
  })
395
395
  )
396
396
  );
397
397
  }
398
- function re(e) {
398
+ function fe(e) {
399
399
  return new Set(
400
400
  e.map(f).map(p).filter((t) => !!t)
401
401
  );
402
402
  }
403
- function Pe(e) {
404
- const t = D(e);
405
- return t ? re([
403
+ function Ke(e) {
404
+ const t = E(e);
405
+ return t ? fe([
406
406
  f(t.name),
407
407
  f(t.table),
408
408
  f(t.id)
409
409
  ]) : /* @__PURE__ */ new Set();
410
410
  }
411
- function Re(e, t, n) {
412
- return B(
411
+ function Ge(e, t, n) {
412
+ return F(
413
413
  {
414
414
  ...e,
415
415
  ...t
@@ -417,8 +417,8 @@ function Re(e, t, n) {
417
417
  n
418
418
  );
419
419
  }
420
- function B(e, t) {
421
- const n = t.evidence === "coordinates" ? t.capabilities.prefixLevels : G(t.capabilities);
420
+ function F(e, t) {
421
+ const n = t.evidence === "coordinates" ? t.capabilities.prefixLevels : J(t.capabilities);
422
422
  return {
423
423
  ...n.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
424
424
  ...n.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
@@ -428,63 +428,63 @@ function B(e, t) {
428
428
  function u(e) {
429
429
  return typeof e == "string" && e.trim() ? e.trim() : void 0;
430
430
  }
431
- function _(e) {
431
+ function S(e) {
432
432
  return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
433
433
  }
434
- function je(e) {
435
- const t = _(e);
434
+ function Ve(e) {
435
+ const t = S(e);
436
436
  return !!(t && t.type === "dataset" && u(t.name));
437
437
  }
438
- function ce(e) {
439
- const t = _(e);
438
+ function me(e) {
439
+ const t = S(e);
440
440
  return !!(t && t.type === "dataset" && t.datasetType !== "physical" && u(t.name));
441
441
  }
442
- function Z(e) {
442
+ function ne(e) {
443
443
  const t = /* @__PURE__ */ new Set();
444
444
  for (const n of e) {
445
- const i = u(n);
446
- if (!i) continue;
447
- const a = p(i);
445
+ const a = u(n);
448
446
  if (!a) continue;
449
- const r = a.toLowerCase();
447
+ const i = p(a);
448
+ if (!i) continue;
449
+ const r = i.toLowerCase();
450
450
  t.add(r);
451
451
  const o = r.split("."), s = o[o.length - 1];
452
452
  s && t.add(s);
453
453
  }
454
454
  return t;
455
455
  }
456
- function H(e) {
456
+ function L(e) {
457
457
  var n;
458
458
  const t = u(e);
459
459
  return t ? (n = p(t)) == null ? void 0 : n.toLowerCase() : void 0;
460
460
  }
461
- function j(e, t) {
462
- const n = _(t), i = u(n == null ? void 0 : n.domainId) || u(e.semanticDomainId), a = u(n == null ? void 0 : n.name);
463
- if (!i || !a) return;
464
- const r = (n == null ? void 0 : n.datasetType) === "physical" ? void 0 : Ne(n || {}), o = u(n == null ? void 0 : n.connectionId) || u(e.connectionId);
461
+ function R(e, t) {
462
+ const n = S(t), a = u(n == null ? void 0 : n.domainId) || u(e.semanticDomainId), i = u(n == null ? void 0 : n.name);
463
+ if (!a || !i) return;
464
+ const r = (n == null ? void 0 : n.datasetType) === "physical" ? void 0 : qe(n || {}), o = u(n == null ? void 0 : n.connectionId) || u(e.connectionId);
465
465
  return {
466
466
  kind: "semantic",
467
- domainId: i,
468
- datasetName: a,
467
+ domainId: a,
468
+ datasetName: i,
469
469
  ...r ? { datasetId: r } : {},
470
470
  ...o ? { connectionId: o } : {}
471
471
  };
472
472
  }
473
- function Me(e, t = {}) {
473
+ function Xe(e, t = {}) {
474
474
  const n = u(e.fieldEntityType);
475
475
  if (n && n !== "dataset")
476
476
  return { kind: "unqualified" };
477
- const i = e.entities.filter(
478
- (o) => t.includePhysicalDatasets ? je(o) : ce(o)
479
- ), a = u(e.entityId);
480
- if (a) {
481
- const o = H(a), s = i.filter((l) => {
482
- const c = _(l);
483
- return !!(o && H(c == null ? void 0 : c.id) === o);
477
+ const a = e.entities.filter(
478
+ (o) => t.includePhysicalDatasets ? Ve(o) : me(o)
479
+ ), i = u(e.entityId);
480
+ if (i) {
481
+ const o = L(i), s = a.filter((l) => {
482
+ const c = S(l);
483
+ return !!(o && L(c == null ? void 0 : c.id) === o);
484
484
  });
485
485
  if (s.length > 1) return { kind: "ambiguous", basis: "bare" };
486
486
  if (s.length === 1) {
487
- const l = j(e, s[0]);
487
+ const l = R(e, s[0]);
488
488
  return l ? {
489
489
  kind: "resolved",
490
490
  basis: "bare",
@@ -494,19 +494,19 @@ function Me(e, t = {}) {
494
494
  } : { kind: "not_found", basis: "bare" };
495
495
  }
496
496
  }
497
- const r = Z([
497
+ const r = ne([
498
498
  e.entityName,
499
499
  ...e.qualifiedHints || [],
500
500
  ...e.bareHints || []
501
501
  ]);
502
502
  if (r.size > 0) {
503
- const o = i.filter((s) => {
504
- const l = _(s);
505
- return [...Z([l == null ? void 0 : l.id, l == null ? void 0 : l.name])].some((d) => r.has(d));
503
+ const o = a.filter((s) => {
504
+ const l = S(s);
505
+ return [...ne([l == null ? void 0 : l.id, l == null ? void 0 : l.name])].some((d) => r.has(d));
506
506
  });
507
507
  if (o.length > 1) return { kind: "ambiguous", basis: "bare" };
508
508
  if (o.length === 1) {
509
- const s = j(e, o[0]);
509
+ const s = R(e, o[0]);
510
510
  return s ? {
511
511
  kind: "resolved",
512
512
  basis: "bare",
@@ -517,61 +517,61 @@ function Me(e, t = {}) {
517
517
  }
518
518
  return { kind: "not_found", basis: "bare" };
519
519
  }
520
- if (i.length === 1) {
521
- const o = j(e, i[0]);
520
+ if (a.length === 1) {
521
+ const o = R(e, a[0]);
522
522
  return o ? {
523
523
  kind: "resolved",
524
524
  basis: "unqualified",
525
- entity: i[0],
525
+ entity: a[0],
526
526
  source: o,
527
527
  matchedById: !1
528
528
  } : { kind: "unqualified" };
529
529
  }
530
530
  return { kind: "unqualified" };
531
531
  }
532
- function M(e) {
533
- const t = e.resolution.kind === "resolved" ? _(e.resolution.entity) : void 0, n = u(e.connectionId) || u(t == null ? void 0 : t.connectionId), { connectionType: i, dialect: a } = e.resolution.capabilityAuthority, r = C(a), o = !!(r && r.dialect === e.resolution.capabilityAuthority.capabilities.dialect && r.prefixLevels.join(".") === e.resolution.capabilityAuthority.capabilities.prefixLevels.join(
532
+ function j(e) {
533
+ const t = e.resolution.kind === "resolved" ? S(e.resolution.entity) : void 0, n = u(e.connectionId) || u(t == null ? void 0 : t.connectionId), { connectionType: a, dialect: i } = e.resolution.capabilityAuthority, r = C(i), o = !!(r && r.dialect === e.resolution.capabilityAuthority.capabilities.dialect && r.prefixLevels.join(".") === e.resolution.capabilityAuthority.capabilities.prefixLevels.join(
534
534
  "."
535
535
  )), s = e.resolution.coordinates;
536
536
  if (!(!n || !(s != null && s.tableName)))
537
537
  return {
538
538
  kind: "physical",
539
539
  connectionId: n,
540
- ...i ? { connectionType: i } : {},
541
- ...!i && o ? { dialect: a } : {},
540
+ ...a ? { connectionType: a } : {},
541
+ ...!a && o ? { dialect: i } : {},
542
542
  tableName: s.tableName,
543
543
  ...s.databaseName ? { databaseName: s.databaseName } : {},
544
544
  ...s.schemaName ? { schemaName: s.schemaName } : {}
545
545
  };
546
546
  }
547
- function $e(e) {
547
+ function Je(e) {
548
548
  if (!e.coordinates.tableName) return !1;
549
- const t = _(e.entity), n = H(t == null ? void 0 : t.id), i = e.qualifiedHints.map(u).filter((l) => !!(l != null && l.includes(".")));
550
- if (n && i.length > 0 && i.every((l) => H(l) === n))
549
+ const t = S(e.entity), n = L(t == null ? void 0 : t.id), a = e.qualifiedHints.map(u).filter((l) => !!(l != null && l.includes(".")));
550
+ if (n && a.length > 0 && a.every((l) => L(l) === n))
551
551
  return !0;
552
- const a = p(u(t == null ? void 0 : t.table));
553
- if (!a) return !1;
552
+ const i = p(u(t == null ? void 0 : t.table));
553
+ if (!i) return !1;
554
554
  const r = p(
555
555
  u(t == null ? void 0 : t.database)
556
556
  ), o = p(
557
557
  u(t == null ? void 0 : t.schema)
558
558
  ), { capabilities: s } = e.capabilityAuthority;
559
- return ke({
559
+ return xe({
560
560
  requested: e.coordinates,
561
- allowed: ae({
561
+ allowed: le({
562
562
  recorded: {
563
563
  ...r ? { databaseName: r } : {},
564
564
  ...o ? { schemaName: o } : {},
565
- tableName: a
565
+ tableName: i
566
566
  },
567
567
  capabilities: s
568
568
  }),
569
569
  capabilities: s
570
570
  });
571
571
  }
572
- function Oe(e) {
573
- var a, r, o;
574
- if (u(e.connectionType) || u(e.dialect) || e.capabilities || u(e.semanticDomainId) || u(e.fieldEntityType) === "dataset" || u((a = e.fallbackCoordinateHint) == null ? void 0 : a.databaseName) || u((r = e.fallbackCoordinateHint) == null ? void 0 : r.schemaName))
572
+ function Ye(e) {
573
+ var i, r, o;
574
+ if (u(e.connectionType) || u(e.dialect) || e.capabilities || u(e.semanticDomainId) || u(e.fieldEntityType) === "dataset" || u((i = e.fallbackCoordinateHint) == null ? void 0 : i.databaseName) || u((r = e.fallbackCoordinateHint) == null ? void 0 : r.schemaName))
575
575
  return;
576
576
  const t = [
577
577
  u((o = e.fallbackCoordinateHint) == null ? void 0 : o.tableName),
@@ -585,17 +585,17 @@ function Oe(e) {
585
585
  const n = t.map(p);
586
586
  return n.some((s) => !s) ? void 0 : new Set(n.map((s) => s.toLowerCase())).size === 1 ? n[0] : void 0;
587
587
  }
588
- function ct(e) {
588
+ function It(e) {
589
589
  const t = e.entities.filter(
590
- se
590
+ de
591
591
  ), n = e.entities.filter(
592
- ce
593
- ), i = t.length > 0 || n.length > 0, a = Me(e), r = e.qualifiedHints || [], o = r.some(
592
+ me
593
+ ), a = t.length > 0 || n.length > 0, i = Xe(e), r = e.qualifiedHints || [], o = r.some(
594
594
  (c) => {
595
595
  var d;
596
596
  return (d = u(c)) == null ? void 0 : d.includes(".");
597
597
  }
598
- ), s = De({
598
+ ), s = Re({
599
599
  entities: t,
600
600
  connectionType: u(e.connectionType),
601
601
  dialect: e.dialect,
@@ -607,7 +607,7 @@ function ct(e) {
607
607
  if (s.kind === "malformed" || s.kind === "conflicting" || s.kind === "incompatible_capabilities" && o || s.kind === "ambiguous" && s.basis === "qualified")
608
608
  return s;
609
609
  if (s.kind === "resolved" && s.basis === "qualified") {
610
- const c = M({
610
+ const c = j({
611
611
  resolution: s,
612
612
  connectionId: e.connectionId
613
613
  });
@@ -619,34 +619,34 @@ function ct(e) {
619
619
  } : { kind: "missing_connection" };
620
620
  }
621
621
  if (s.kind === "not_found" && s.basis === "qualified" && s.coordinates) {
622
- if (a.kind === "resolved" && a.matchedById && $e({
623
- entity: a.entity,
622
+ if (i.kind === "resolved" && i.matchedById && Je({
623
+ entity: i.entity,
624
624
  coordinates: s.coordinates,
625
625
  capabilityAuthority: s.capabilityAuthority,
626
626
  qualifiedHints: r
627
627
  }))
628
628
  return {
629
629
  kind: "resolved",
630
- basis: a.basis,
631
- source: a.source,
632
- entity: a.entity
630
+ basis: i.basis,
631
+ source: i.source,
632
+ entity: i.entity
633
633
  };
634
- const c = M({
634
+ const c = j({
635
635
  resolution: s,
636
636
  connectionId: e.connectionId
637
637
  });
638
- return c ? i ? { kind: "candidate", basis: "qualified", source: c } : { kind: "resolved", basis: "qualified", source: c } : { kind: "missing_connection" };
638
+ return c ? a ? { kind: "candidate", basis: "qualified", source: c } : { kind: "resolved", basis: "qualified", source: c } : { kind: "missing_connection" };
639
639
  }
640
- if (a.kind === "resolved")
641
- return s.kind === "resolved" && s.basis === "bare" && !a.matchedById ? { kind: "ambiguous", basis: "bare" } : {
640
+ if (i.kind === "resolved")
641
+ return s.kind === "resolved" && s.basis === "bare" && !i.matchedById ? { kind: "ambiguous", basis: "bare" } : {
642
642
  kind: "resolved",
643
- basis: a.basis,
644
- source: a.source,
645
- entity: a.entity
643
+ basis: i.basis,
644
+ source: i.source,
645
+ entity: i.entity
646
646
  };
647
- if (a.kind === "ambiguous") return a;
647
+ if (i.kind === "ambiguous") return i;
648
648
  if (s.kind === "resolved") {
649
- const c = M({
649
+ const c = j({
650
650
  resolution: s,
651
651
  connectionId: e.connectionId
652
652
  });
@@ -658,7 +658,7 @@ function ct(e) {
658
658
  } : { kind: "missing_connection" };
659
659
  }
660
660
  const l = u(e.entityName) || u(e.entityId);
661
- if (!i && !o && u(e.semanticDomainId) && (!u(e.fieldEntityType) || u(e.fieldEntityType) === "dataset") && l)
661
+ if (!a && !o && u(e.semanticDomainId) && (!u(e.fieldEntityType) || u(e.fieldEntityType) === "dataset") && l)
662
662
  return {
663
663
  kind: "resolved",
664
664
  basis: "historical",
@@ -670,7 +670,7 @@ function ct(e) {
670
670
  }
671
671
  };
672
672
  if (s.kind === "incompatible_capabilities") {
673
- const c = i ? void 0 : Oe(e), d = u(e.connectionId);
673
+ const c = a ? void 0 : Ye(e), d = u(e.connectionId);
674
674
  return c && d ? {
675
675
  kind: "resolved",
676
676
  basis: "historical",
@@ -682,72 +682,133 @@ function ct(e) {
682
682
  basis: s.basis
683
683
  } : { kind: "unqualified" };
684
684
  }
685
- const le = "click-reach:";
686
- function lt(e, t) {
685
+ function Nt(e, t) {
686
+ if (!e) return { kind: "range" };
687
+ const n = Le(e);
688
+ if (n.comparesBySpan) return { kind: "anchored", window: e };
689
+ if (n.bounds.start === "instant" && t === "date") return { kind: "range" };
690
+ if (n.subDay) return { kind: "elapsed", window: e };
691
+ switch (e.kind) {
692
+ case "periods":
693
+ return { kind: "calendar", unit: e.unit, n: e.to - e.from + 1, toDate: !!e.toDate, window: e };
694
+ case "rolling":
695
+ return { kind: "calendar", unit: e.unit, n: e.n, toDate: !1, window: e };
696
+ case "monthDay":
697
+ return { kind: "calendar", unit: "day", n: 1, toDate: !1, window: e };
698
+ }
699
+ }
700
+ function we(e, t) {
701
+ return De(e).toZonedDateTimeISO(t);
702
+ }
703
+ const A = we, be = (e) => e.startOfDay(), ge = (e) => e.toPlainDate().add({ days: 1 }).toZonedDateTime({ timeZone: e.timeZoneId });
704
+ function Ct(e) {
705
+ const t = A(e.start, e.zone), n = A(e.endExclusive, e.zone), a = e.basis;
706
+ return e.column === "timestamp" ? { start: t, endExclusive: n, column: e.column, basis: a } : {
707
+ start: be(t),
708
+ endExclusive: ge(A(new Date(n.epochMilliseconds - 1), e.zone)),
709
+ column: e.column,
710
+ basis: a
711
+ };
712
+ }
713
+ const ae = (e) => e.day === 1 && e.equals(be(e));
714
+ function ye(e) {
715
+ return ae(e.start) && ae(e.endExclusive);
716
+ }
717
+ function St(e, t) {
718
+ const n = t.getTime();
719
+ if (n <= e.start.epochMilliseconds) return null;
720
+ if (n >= e.endExclusive.epochMilliseconds - 1) return e;
721
+ const a = e.column === "date" ? ge(A(new Date(n - 1), e.start.timeZoneId)) : A(t, e.start.timeZoneId);
722
+ return a.epochMilliseconds < e.endExclusive.epochMilliseconds ? { ...e, endExclusive: a } : e;
723
+ }
724
+ function et(e) {
725
+ return e.start.toPlainDateTime().until(e.endExclusive.toPlainDateTime(), { largestUnit: "days" });
726
+ }
727
+ function z(e) {
728
+ return e.endExclusive.epochMilliseconds - e.start.epochMilliseconds;
729
+ }
730
+ function $(e, t, n) {
731
+ if (t === 0) return e;
732
+ const a = e.toPlainDateTime();
733
+ return (n === "quarter" ? a.add({ months: 3 * t }) : n === "week" ? a.add({ weeks: t }) : a.add({ [`${n}s`]: t })).toZonedDateTime(e.timeZoneId, { disambiguation: re });
734
+ }
735
+ function _t(e, t, n, a) {
736
+ const i = $(e.start, -t, n);
737
+ if (!a.toDate && ye(e)) return { start: i, endExclusive: $(e.endExclusive, -t, n) };
738
+ const r = e.endExclusive.subtract({ milliseconds: 1 });
739
+ return { start: i, endExclusive: $(r, -t, n).add({ milliseconds: 1 }) };
740
+ }
741
+ function Tt(e, t, n) {
742
+ if (ye(t) || z(e) <= z(t)) return e;
743
+ const a = n.elapsed ? e.start.add({ milliseconds: z(t) }) : e.start.toPlainDateTime().add(et(t)).toZonedDateTime(e.start.timeZoneId, { disambiguation: re });
744
+ return Te.ZonedDateTime.compare(e.endExclusive, a) > 0 ? { ...e, endExclusive: a } : e;
745
+ }
746
+ const he = "click-reach:";
747
+ function Dt(e, t) {
687
748
  const n = t.source.kind === "semantic" ? t.source.datasetName : t.source.tableName;
688
- return `${le}${e}:${n}.${t.name}`;
749
+ return `${he}${e}:${n}.${t.name}`;
689
750
  }
690
- function dt(e) {
691
- return typeof e == "string" && e.startsWith(le);
751
+ function At(e) {
752
+ return typeof e == "string" && e.startsWith(he);
692
753
  }
693
- function ze(e, t) {
694
- return _e({ ...e, role: t });
754
+ function tt(e, t) {
755
+ return Pe({ ...e, role: t });
695
756
  }
696
- function ut(e, t) {
757
+ function Et(e, t) {
697
758
  if (t.id) {
698
759
  const n = [];
699
760
  e.forEach(
700
- ({ fields: a }, r) => a.forEach((o, s) => {
761
+ ({ fields: i }, r) => i.forEach((o, s) => {
701
762
  o.id === t.id && n.push({ group: r, index: s });
702
763
  })
703
764
  );
704
- const i = t.alias ? n.find(
705
- ({ group: a, index: r }) => ze(e[a].fields[r], e[a].role) === t.alias
765
+ const a = t.alias ? n.find(
766
+ ({ group: i, index: r }) => tt(e[i].fields[r], e[i].role) === t.alias
706
767
  ) : void 0;
707
- if (i) return i;
768
+ if (a) return a;
708
769
  if (n.length === 1) return n[0];
709
770
  }
710
771
  for (let n = 0; n < e.length; n += 1) {
711
- const i = e[n].fields.findIndex(
712
- (a) => a.name === t.name && a.entityName === t.entityName && (a.alias === t.alias || !t.alias)
772
+ const a = e[n].fields.findIndex(
773
+ (i) => i.name === t.name && i.entityName === t.entityName && (i.alias === t.alias || !t.alias)
713
774
  );
714
- if (i !== -1) return { group: n, index: i };
775
+ if (a !== -1) return { group: n, index: a };
715
776
  }
716
777
  }
717
- function de(e, t) {
718
- const n = e.split(".").map((s) => s.trim()), i = t.split(".").map((s) => s.trim());
719
- if (n.length === 0 || i.length === 0 || n.some((s) => !s) || i.some((s) => !s))
778
+ function pe(e, t) {
779
+ const n = e.split(".").map((s) => s.trim()), a = t.split(".").map((s) => s.trim());
780
+ if (n.length === 0 || a.length === 0 || n.some((s) => !s) || a.some((s) => !s))
720
781
  return !1;
721
- const [a, r] = n.length <= i.length ? [n, i] : [i, n], o = r.length - a.length;
722
- return a.every((s, l) => s === r[l + o]);
782
+ const [i, r] = n.length <= a.length ? [n, a] : [a, n], o = r.length - i.length;
783
+ return i.every((s, l) => s === r[l + o]);
723
784
  }
724
- function we(e, t) {
725
- const n = e.split("."), i = t.split("."), a = n.pop(), r = i.pop();
726
- return !!(a && a === r && n.length > 0 && i.length > 0 && de(
785
+ function nt(e, t) {
786
+ const n = e.split("."), a = t.split("."), i = n.pop(), r = a.pop();
787
+ return !!(i && i === r && n.length > 0 && a.length > 0 && pe(
727
788
  n.join("."),
728
- i.join(".")
789
+ a.join(".")
729
790
  ));
730
791
  }
731
- function Qe(e) {
732
- const t = e.map((i) => i.trim()).filter(Boolean);
792
+ function at(e) {
793
+ const t = e.map((a) => a.trim()).filter(Boolean);
733
794
  if (t.every(
734
- (i, a) => t.slice(a + 1).every(
735
- (r) => de(i, r)
795
+ (a, i) => t.slice(i + 1).every(
796
+ (r) => pe(a, r)
736
797
  )
737
798
  ))
738
799
  return [...t].sort(
739
- (i, a) => a.split(".").length - i.split(".").length
800
+ (a, i) => i.split(".").length - a.split(".").length
740
801
  )[0];
741
802
  }
742
803
  function v(e) {
743
804
  return typeof e == "object" && e !== null && !Array.isArray(e);
744
805
  }
745
- function ee(e) {
806
+ function ie(e) {
746
807
  if (typeof e != "string") return "";
747
808
  const t = e.split(".").map((n) => n.trim());
748
809
  return t.length > 1 && t.every(Boolean) ? t.join(".") : "";
749
810
  }
750
- function W(e) {
811
+ function G(e) {
751
812
  if (typeof e != "string") return "";
752
813
  const t = e.split(".").map((n) => n.trim());
753
814
  return t.length > 0 && t.every(Boolean) ? t.join(".") : "";
@@ -755,104 +816,104 @@ function W(e) {
755
816
  function y(e) {
756
817
  return typeof e == "string" ? e.trim() : "";
757
818
  }
758
- function We(e, t) {
819
+ function it(e, t) {
759
820
  return e.every(
760
- (n, i) => e.slice(i + 1).every((a) => t(n, a))
821
+ (n, a) => e.slice(a + 1).every((i) => t(n, i))
761
822
  );
762
823
  }
763
- function Ue(e, t) {
764
- const n = y(e.id), i = y(e.name), a = y(t.entityId), r = y(t.entityName);
765
- return !i || !a && !r ? !1 : (!a || a === n || a === i) && (!r || r === i);
824
+ function st(e, t) {
825
+ const n = y(e.id), a = y(e.name), i = y(t.entityId), r = y(t.entityName);
826
+ return !a || !i && !r ? !1 : (!i || i === n || i === a) && (!r || r === a);
766
827
  }
767
- function Ke(e) {
768
- const t = v(e.semanticContext) ? e.semanticContext : void 0, n = v(e.fieldMeta) ? e.fieldMeta : void 0, i = y(t == null ? void 0 : t.semanticDomainId), a = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(
828
+ function rt(e) {
829
+ const t = v(e.semanticContext) ? e.semanticContext : void 0, n = v(e.fieldMeta) ? e.fieldMeta : void 0, a = y(t == null ? void 0 : t.semanticDomainId), i = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(
769
830
  (h) => v(h) && h.type === "dataset"
770
831
  ) : [];
771
- if (!!!(i || a.length > 0 || (n == null ? void 0 : n.entityType) === "dataset")) return;
772
- if (!i)
832
+ if (!!!(a || i.length > 0 || (n == null ? void 0 : n.entityType) === "dataset")) return;
833
+ if (!a)
773
834
  return { status: "unresolved", reason: "incomplete_source_identity" };
774
- const o = y(n == null ? void 0 : n.entityId), s = y(n == null ? void 0 : n.entityName), l = !!(o || s), c = l ? a.filter(
775
- (h) => Ue(h, {
835
+ const o = y(n == null ? void 0 : n.entityId), s = y(n == null ? void 0 : n.entityName), l = !!(o || s), c = l ? i.filter(
836
+ (h) => st(h, {
776
837
  entityId: o,
777
838
  entityName: s
778
839
  })
779
- ) : a;
840
+ ) : i;
780
841
  if (c.length > 1)
781
842
  return { status: "unresolved", reason: "incomplete_source_identity" };
782
- if (l && a.length > 0 && c.length === 0)
843
+ if (l && i.length > 0 && c.length === 0)
783
844
  return { status: "unresolved", reason: "divergent_source_identity" };
784
- const d = c[0], m = y(d == null ? void 0 : d.domainId), g = y(d == null ? void 0 : d.id), N = y(d == null ? void 0 : d.name);
785
- if (m && m !== i)
845
+ const d = c[0], m = y(d == null ? void 0 : d.domainId), g = y(d == null ? void 0 : d.id), k = y(d == null ? void 0 : d.name);
846
+ if (m && m !== a)
786
847
  return { status: "unresolved", reason: "divergent_source_identity" };
787
- const b = g, k = N || s;
788
- return k ? {
848
+ const b = g, I = k || s;
849
+ return I ? {
789
850
  status: "resolved",
790
851
  source: {
791
852
  kind: "semantic",
792
- domainId: i,
793
- datasetName: k,
853
+ domainId: a,
854
+ datasetName: I,
794
855
  ...b ? { datasetId: b } : {}
795
856
  }
796
857
  } : { status: "unresolved", reason: "incomplete_source_identity" };
797
858
  }
798
- function Ge(e, t) {
799
- const n = y(e.connectionId), i = v(e.semanticContext) ? e.semanticContext : void 0, a = y(i == null ? void 0 : i.connectionId);
800
- if (n && a && n !== a)
859
+ function ot(e, t) {
860
+ const n = y(e.connectionId), a = v(e.semanticContext) ? e.semanticContext : void 0, i = y(a == null ? void 0 : a.connectionId);
861
+ if (n && i && n !== i)
801
862
  return { status: "unresolved", reason: "divergent_source_identity" };
802
- const r = n || a, o = v(e.fieldMeta) ? e.fieldMeta : void 0, s = t.split(".").slice(0, -1).join("."), l = W(e.qualifiedTableName), c = W(
863
+ const r = n || i, o = v(e.fieldMeta) ? e.fieldMeta : void 0, s = t.split(".").slice(0, -1).join("."), l = G(e.qualifiedTableName), c = G(
803
864
  o == null ? void 0 : o.qualifiedEntityName
804
865
  ), d = [
805
866
  l,
806
867
  c,
807
868
  s
808
- ].filter(Boolean), m = Qe(d);
869
+ ].filter(Boolean), m = at(d);
809
870
  return !m && d.length > 0 ? { status: "unresolved", reason: "divergent_source_identity" } : !r || !m ? { status: "unresolved", reason: "incomplete_source_identity" } : {
810
871
  status: "resolved",
811
872
  source: { kind: "physical", connectionId: r, tableName: m }
812
873
  };
813
874
  }
814
- function Ve(e, t) {
815
- const n = v(e.fieldMeta) ? e.fieldMeta : void 0, i = typeof (n == null ? void 0 : n.qualifiedFieldName) == "string" ? n.qualifiedFieldName.trim() : "", a = ee(
875
+ function ct(e, t) {
876
+ const n = v(e.fieldMeta) ? e.fieldMeta : void 0, a = typeof (n == null ? void 0 : n.qualifiedFieldName) == "string" ? n.qualifiedFieldName.trim() : "", i = ie(
816
877
  n == null ? void 0 : n.qualifiedFieldName
817
- ), r = typeof e.column == "string" ? e.column.trim() : "", o = ee(r), s = typeof e.qualifiedTableName == "string" ? e.qualifiedTableName.trim() : "", l = W(
878
+ ), r = typeof e.column == "string" ? e.column.trim() : "", o = ie(r), s = typeof e.qualifiedTableName == "string" ? e.qualifiedTableName.trim() : "", l = G(
818
879
  e.qualifiedTableName
819
880
  );
820
- if (i && !a || t && s && !l || r.includes(".") && !o)
881
+ if (a && !i || t && s && !l || r.includes(".") && !o)
821
882
  return { status: "unresolved", reason: "incomplete_field_identity" };
822
883
  const c = o.split("."), d = o ? c[c.length - 1] : r, m = t && l && d ? `${l}.${d}` : "", g = [
823
- a,
884
+ i,
824
885
  o,
825
886
  m
826
887
  ].filter(Boolean);
827
- if (!We(
888
+ if (!it(
828
889
  g,
829
- we
890
+ nt
830
891
  ))
831
892
  return { status: "unresolved", reason: "divergent_field_identity" };
832
- const N = o || a || m;
833
- return N ? { status: "resolved", qualifiedFieldName: N } : { status: "unresolved", reason: "incomplete_field_identity" };
893
+ const k = o || i || m;
894
+ return k ? { status: "resolved", qualifiedFieldName: k } : { status: "unresolved", reason: "incomplete_field_identity" };
834
895
  }
835
- function Je(e) {
896
+ function lt(e) {
836
897
  if (!v(e))
837
898
  return { status: "ineligible", reason: "invalid_input" };
838
899
  if (e.kind === "global-date")
839
900
  return { status: "eligible", kind: "global_date" };
840
- const t = Q(e.dataType);
901
+ const t = K(e.dataType);
841
902
  if (t !== "date" && t !== "datetime")
842
903
  return { status: "ineligible", reason: "non_date_filter" };
843
- const n = v(e.fieldMeta) ? e.fieldMeta : void 0, i = Q(
904
+ const n = v(e.fieldMeta) ? e.fieldMeta : void 0, a = K(
844
905
  n == null ? void 0 : n.dataType
845
906
  );
846
- if ((n == null ? void 0 : n.dataType) !== void 0 && i !== "date" && i !== "datetime")
907
+ if ((n == null ? void 0 : n.dataType) !== void 0 && a !== "date" && a !== "datetime")
847
908
  return { status: "ineligible", reason: "non_date_filter" };
848
909
  if (e.customFilterPreferences)
849
910
  return { status: "ineligible", reason: "custom_filter" };
850
911
  if (e.targetColumns !== void 0 && (!Array.isArray(e.targetColumns) || e.targetColumns.length > 0))
851
912
  return { status: "ineligible", reason: "multi_target_filter" };
852
- const a = Ke(e), r = Ve(e, a === void 0);
913
+ const i = rt(e), r = ct(e, i === void 0);
853
914
  if (r.status === "unresolved")
854
915
  return { status: "ineligible", reason: r.reason };
855
- const o = a || Ge(e, r.qualifiedFieldName);
916
+ const o = i || ot(e, r.qualifiedFieldName);
856
917
  return o.status === "resolved" ? {
857
918
  status: "eligible",
858
919
  kind: "field_date",
@@ -860,114 +921,114 @@ function Je(e) {
860
921
  source: o.source
861
922
  } : { status: "ineligible", reason: o.reason };
862
923
  }
863
- function Xe(e) {
924
+ function dt(e) {
864
925
  if (!v(e) || e.kind !== "filter" || !v(e.filter))
865
926
  return { status: "ineligible", reason: "invalid_input" };
866
- const t = Je(
927
+ const t = lt(
867
928
  e.filter
868
929
  );
869
930
  return t.status === "ineligible" ? t : t.kind === "field_date" && v(e.compatibility) && e.compatibility.source === "cardInlineFilter" ? { status: "ineligible", reason: "card_inline_filter" } : t;
870
931
  }
871
- function ft(e) {
872
- return Xe(e).status === "eligible";
932
+ function qt(e) {
933
+ return dt(e).status === "eligible";
873
934
  }
874
- function mt(e) {
935
+ function xt(e) {
875
936
  return `compat-filter:${e}`;
876
937
  }
877
- function bt(e) {
938
+ function Bt(e) {
878
939
  return `compat-control:${e}`;
879
940
  }
880
- function gt(e, t) {
941
+ function Ft(e, t) {
881
942
  return `compat-inline-filter:${e}:${t}`;
882
943
  }
883
- function yt(e, t) {
944
+ function Lt(e, t) {
884
945
  return `compat-card-control:${e}:${t}`;
885
946
  }
886
- function Ye(e) {
887
- var i;
947
+ function ut(e) {
948
+ var a;
888
949
  if (!e) return !1;
889
950
  if (typeof e.aggregate == "string" || e.isPreAggregated) return !0;
890
951
  const t = typeof e.expression == "string" ? e.expression : "";
891
952
  if (!t) return !1;
892
- if (Se(t).calls.length > 0) return !0;
893
- const n = (i = e.calculatedFormula) == null ? void 0 : i.inputFields;
894
- return Array.isArray(n) && n.some((a) => {
895
- const r = String((a == null ? void 0 : a.role) || "").toLowerCase(), o = String((a == null ? void 0 : a.aggregate) || "").trim();
953
+ if (He(t).calls.length > 0) return !0;
954
+ const n = (a = e.calculatedFormula) == null ? void 0 : a.inputFields;
955
+ return Array.isArray(n) && n.some((i) => {
956
+ const r = String((i == null ? void 0 : i.role) || "").toLowerCase(), o = String((i == null ? void 0 : i.aggregate) || "").trim();
896
957
  return r === "metric" && o.length > 0;
897
958
  });
898
959
  }
899
- function ht(e) {
900
- return !!((e == null ? void 0 : e.role) === "metric" && (Ie(e) || Ye(e)));
960
+ function Pt(e) {
961
+ return !!((e == null ? void 0 : e.role) === "metric" && (Be(e) || ut(e)));
901
962
  }
902
- const ue = "col:";
903
- function pt(e) {
904
- return `${ue}${e}`;
963
+ const ve = "col:";
964
+ function Ht(e) {
965
+ return `${ve}${e}`;
905
966
  }
906
- function vt(e) {
907
- return typeof e == "string" && e.startsWith(ue);
967
+ function Mt(e) {
968
+ return typeof e == "string" && e.startsWith(ve);
908
969
  }
909
- function fe(e, t) {
970
+ function ke(e, t) {
910
971
  if (e) return e;
911
- const n = t === void 0 ? "unknown" : Q(t);
972
+ const n = t === void 0 ? "unknown" : K(t);
912
973
  return n === "number" || n === "unknown" ? "SUM" : "COUNT";
913
974
  }
914
- function Ze(e) {
915
- const t = e.aggregate === fe(e.semanticAggregate, e.dataType);
975
+ function ft(e) {
976
+ const t = e.aggregate === ke(e.semanticAggregate, e.dataType);
916
977
  return {
917
978
  effectiveAggregate: e.aggregate,
918
979
  aggregateSource: t ? e.semanticAggregate ? "semantic_model" : "default_sum" : "caller_override"
919
980
  };
920
981
  }
921
- function et(e, t, n) {
922
- const i = e.effectiveAggregate !== void 0 || e.aggregateSource !== void 0;
982
+ function mt(e, t, n) {
983
+ const a = e.effectiveAggregate !== void 0 || e.aggregateSource !== void 0;
923
984
  return {
924
985
  aggregate: t,
925
986
  aggregateOrigin: n,
926
- ...i ? Ze({ aggregate: t, semanticAggregate: e.semanticAggregate, dataType: e.dataType }) : {}
987
+ ...a ? ft({ aggregate: t, semanticAggregate: e.semanticAggregate, dataType: e.dataType }) : {}
927
988
  };
928
989
  }
929
- function Nt(e, t, n) {
930
- return { ...e, ...et(e, t, n) };
990
+ function Ot(e, t, n) {
991
+ return { ...e, ...mt(e, t, n) };
931
992
  }
932
- function kt(e) {
993
+ function Rt(e) {
933
994
  return e.aggregate ?? e.effectiveAggregate;
934
995
  }
935
- function It(e) {
996
+ function jt(e) {
936
997
  if (!e.aggregate) return !1;
937
998
  if (e.aggregateOrigin === "explicit" || e.aggregateSource === "caller_override") return !0;
938
999
  if (e.aggregateSource) {
939
- const t = e.aggregateSource === "default_sum" ? fe(void 0, e.dataType) : e.semanticAggregate ?? e.effectiveAggregate;
1000
+ const t = e.aggregateSource === "default_sum" ? ke(void 0, e.dataType) : e.semanticAggregate ?? e.effectiveAggregate;
940
1001
  return t !== void 0 && e.aggregate !== t;
941
1002
  }
942
1003
  return e.aggregateOrigin !== "default";
943
1004
  }
944
- const Ct = ["label", "labelOrigin", "derivedLabel"];
945
- function _t(e) {
1005
+ const zt = ["label", "labelOrigin", "derivedLabel"];
1006
+ function $t(e) {
946
1007
  return { label: e, labelOrigin: "override", derivedLabel: void 0 };
947
1008
  }
948
- function St(e, t) {
949
- const { derivedLabel: n, ...i } = e;
950
- return { ...i, label: t, labelOrigin: "override" };
1009
+ function Wt(e, t) {
1010
+ const { derivedLabel: n, ...a } = e;
1011
+ return { ...a, label: t, labelOrigin: "override" };
951
1012
  }
952
- function At(e, t) {
1013
+ function Qt(e, t) {
953
1014
  return e.labelOrigin === "override" ? {} : { label: t, labelOrigin: "semantic" };
954
1015
  }
955
- function Tt(e) {
1016
+ function Zt(e) {
956
1017
  if (e.groupedDate !== void 0) return { target: e.groupedDate, direction: "asc" };
957
1018
  if (!(!e.grouped || e.measures.length === 0))
958
1019
  return { target: e.primaryMeasure ?? e.measures[0], direction: "desc" };
959
1020
  }
960
- const Dt = /* @__PURE__ */ new Set([
1021
+ const Ut = /* @__PURE__ */ new Set([
961
1022
  "contains",
962
1023
  "startsWith",
963
1024
  "endsWith",
964
1025
  "like",
965
1026
  "not like"
966
1027
  ]);
967
- function me(e) {
1028
+ function Ie(e) {
968
1029
  return e.includes("%") || e.includes("_");
969
1030
  }
970
- function tt(e, t) {
1031
+ function bt(e, t) {
971
1032
  switch (e) {
972
1033
  case "contains":
973
1034
  return { pattern: `%${t}%`, negate: !1 };
@@ -981,40 +1042,40 @@ function tt(e, t) {
981
1042
  return { pattern: t, negate: !0 };
982
1043
  }
983
1044
  }
984
- function nt(e) {
985
- return me(e) ? e : `%${e}%`;
1045
+ function gt(e) {
1046
+ return Ie(e) ? e : `%${e}%`;
986
1047
  }
987
- function Et(e, t) {
988
- const { pattern: n, negate: i } = tt(e, t), a = n.length > 2 && n.startsWith("%") && n.endsWith("%") ? n.slice(1, -1) : void 0, r = a !== void 0 && !me(a) ? a : n;
989
- if (nt(r) === n)
990
- return { operator: i ? "not_contains" : "contains", value: r };
1048
+ function Kt(e, t) {
1049
+ const { pattern: n, negate: a } = bt(e, t), i = n.length > 2 && n.startsWith("%") && n.endsWith("%") ? n.slice(1, -1) : void 0, r = i !== void 0 && !Ie(i) ? i : n;
1050
+ if (gt(r) === n)
1051
+ return { operator: a ? "not_contains" : "contains", value: r };
991
1052
  }
992
- function qt(e) {
993
- const { operation: t, values: n, temporalPrecision: i } = e;
994
- if (t !== "=" && t !== "!=" || i === "minute")
1053
+ function Gt(e) {
1054
+ const { operation: t, values: n, temporalPrecision: a } = e;
1055
+ if (t !== "=" && t !== "!=" || a === "minute")
995
1056
  return null;
996
- const a = Array.isArray(n) ? n : [n];
997
- if (a.length !== 1 || typeof a[0] != "string") return null;
998
- const r = a[0].trim();
999
- return pe(r) ? { operation: t, day: r } : null;
1057
+ const i = Array.isArray(n) ? n : [n];
1058
+ if (i.length !== 1 || typeof i[0] != "string") return null;
1059
+ const r = i[0].trim();
1060
+ return Ae(r) ? { operation: t, day: r } : null;
1000
1061
  }
1001
- function be(e) {
1062
+ function Ne(e) {
1002
1063
  const { label: t, ...n } = e;
1003
1064
  return {
1004
- dataset: Ce(n),
1065
+ dataset: Fe(n),
1005
1066
  ...e.kind === "physical" ? { dialect: e.dialect, connectionType: e.connectionType } : {}
1006
1067
  };
1007
1068
  }
1008
- function ge(e) {
1009
- const { label: t, source: n, ...i } = e;
1010
- return { ...i, source: n && be(n) };
1069
+ function Ce(e) {
1070
+ const { label: t, source: n, ...a } = e;
1071
+ return { ...a, source: n && Ne(n) };
1011
1072
  }
1012
- function V(e) {
1073
+ function Y(e) {
1013
1074
  const {
1014
1075
  label: t,
1015
1076
  format: n,
1016
- description: i,
1017
- tags: a,
1077
+ description: a,
1078
+ tags: i,
1018
1079
  inputs: r,
1019
1080
  ...o
1020
1081
  } = e;
@@ -1023,71 +1084,71 @@ function V(e) {
1023
1084
  inputs: Object.fromEntries(
1024
1085
  Object.entries(r).map(([s, l]) => [
1025
1086
  s,
1026
- { ...l, field: ge(l.field) }
1087
+ { ...l, field: Ce(l.field) }
1027
1088
  ])
1028
1089
  )
1029
1090
  };
1030
1091
  }
1031
- function $(e) {
1092
+ function W(e) {
1032
1093
  const { derivedField: t, ...n } = e;
1033
1094
  return {
1034
- ...ge(n),
1035
- derivedField: t && V(t)
1095
+ ...Ce(n),
1096
+ derivedField: t && Y(t)
1036
1097
  };
1037
1098
  }
1038
- function x(e) {
1099
+ function P(e) {
1039
1100
  const {
1040
1101
  label: t,
1041
1102
  format: n,
1042
- description: i,
1043
- semanticTemporalPresentation: a,
1103
+ description: a,
1104
+ semanticTemporalPresentation: i,
1044
1105
  derivedField: r,
1045
1106
  calculatedFormula: o,
1046
1107
  ...s
1047
1108
  } = e;
1048
1109
  return {
1049
1110
  ...s,
1050
- semanticTemporalPresentation: a && {
1051
- granularity: a.granularity
1111
+ semanticTemporalPresentation: i && {
1112
+ granularity: i.granularity
1052
1113
  },
1053
- derivedField: r && V(r),
1114
+ derivedField: r && Y(r),
1054
1115
  calculatedFormula: o && {
1055
1116
  ...o,
1056
- inputFields: o.inputFields.map(x)
1117
+ inputFields: o.inputFields.map(P)
1057
1118
  }
1058
1119
  };
1059
1120
  }
1060
- function ye(e) {
1121
+ function Se(e) {
1061
1122
  return {
1062
1123
  ...e,
1063
1124
  conditions: e.conditions.map(
1064
- ({ label: t, field: n, ...i }) => ({
1065
- ...i,
1066
- field: x(n)
1125
+ ({ label: t, field: n, ...a }) => ({
1126
+ ...a,
1127
+ field: P(n)
1067
1128
  })
1068
1129
  ),
1069
- groups: e.groups.map(ye)
1130
+ groups: e.groups.map(Se)
1070
1131
  };
1071
1132
  }
1072
- function Ft(e) {
1133
+ function Vt(e) {
1073
1134
  return {
1074
1135
  ...e,
1075
- source: be(e.source),
1136
+ source: Ne(e.source),
1076
1137
  rows: e.rows.map((t) => ({
1077
1138
  ...t,
1078
- field: $(t.field)
1139
+ field: W(t.field)
1079
1140
  })),
1080
1141
  columns: e.columns.map((t) => ({
1081
1142
  ...t,
1082
- field: $(t.field)
1143
+ field: W(t.field)
1083
1144
  })),
1084
1145
  measures: e.measures.map(
1085
- (t) => t.kind === "aggregate" ? { ...t, field: $(t.field) } : {
1146
+ (t) => t.kind === "aggregate" ? { ...t, field: W(t.field) } : {
1086
1147
  ...t,
1087
- definition: V(t.definition)
1148
+ definition: Y(t.definition)
1088
1149
  }
1089
1150
  ),
1090
- filters: e.filters && ye(e.filters),
1151
+ filters: e.filters && Se(e.filters),
1091
1152
  joinPlan: e.joinPlan && {
1092
1153
  ...e.joinPlan,
1093
1154
  // relationshipName participates in governed relationship resolution.
@@ -1095,68 +1156,78 @@ function Ft(e) {
1095
1156
  ...t,
1096
1157
  joinKeyGroups: t.joinKeyGroups.map((n) => ({
1097
1158
  ...n,
1098
- keys: n.keys.map((i) => ({
1099
- ...i,
1100
- source: x(i.source),
1101
- target: x(i.target)
1159
+ keys: n.keys.map((a) => ({
1160
+ ...a,
1161
+ source: P(a.source),
1162
+ target: P(a.target)
1102
1163
  }))
1103
1164
  }))
1104
1165
  }))
1105
1166
  },
1106
1167
  // Sort scopes are keyed overrides, unlike ordered axes/calculation inputs.
1107
1168
  sorts: [...e.sorts].sort((t, n) => {
1108
- const i = X(t), a = X(n);
1109
- return i < a ? -1 : i > a ? 1 : 0;
1169
+ const a = ee(t), i = ee(n);
1170
+ return a < i ? -1 : a > i ? 1 : 0;
1110
1171
  })
1111
1172
  };
1112
1173
  }
1113
1174
  export {
1114
- vt as A,
1115
- Ae as B,
1116
- fe as C,
1117
- Ze as D,
1118
- Nt as E,
1119
- kt as F,
1120
- It as G,
1121
- Ct as H,
1122
- _t as I,
1123
- St as J,
1124
- Tt as K,
1125
- me as L,
1126
- tt as M,
1127
- nt as N,
1128
- Et as O,
1129
- qt as P,
1130
- de as Q,
1131
- Y as R,
1132
- Dt as S,
1133
- Qe as T,
1134
- V as U,
1135
- we as V,
1136
- Ft as a,
1137
- G as b,
1138
- rt as c,
1139
- se as d,
1140
- De as e,
1141
- ce as f,
1142
- At as g,
1143
- Me as h,
1144
- dt as i,
1145
- ct as j,
1146
- lt as k,
1147
- ut as l,
1148
- et as m,
1149
- Ue as n,
1150
- Je as o,
1151
- Xe as p,
1152
- ft as q,
1153
- ae as r,
1154
- ze as s,
1155
- mt as t,
1156
- bt as u,
1157
- gt as v,
1158
- yt as w,
1159
- Ye as x,
1160
- ht as y,
1161
- pt as z
1175
+ Gt as $,
1176
+ lt as A,
1177
+ dt as B,
1178
+ qt as C,
1179
+ xt as D,
1180
+ Bt as E,
1181
+ Ft as F,
1182
+ Lt as G,
1183
+ ut as H,
1184
+ Pt as I,
1185
+ Ht as J,
1186
+ Mt as K,
1187
+ Me as L,
1188
+ ke as M,
1189
+ ft as N,
1190
+ Ot as O,
1191
+ Rt as P,
1192
+ jt as Q,
1193
+ te as R,
1194
+ zt as S,
1195
+ $t as T,
1196
+ Wt as U,
1197
+ Zt as V,
1198
+ Ut as W,
1199
+ Ie as X,
1200
+ bt as Y,
1201
+ gt as Z,
1202
+ Kt as _,
1203
+ Vt as a,
1204
+ pe as a0,
1205
+ at as a1,
1206
+ Y as a2,
1207
+ nt as a3,
1208
+ J as b,
1209
+ kt as c,
1210
+ de as d,
1211
+ Re as e,
1212
+ me as f,
1213
+ Qt as g,
1214
+ Xe as h,
1215
+ At as i,
1216
+ It as j,
1217
+ Nt as k,
1218
+ Ct as l,
1219
+ mt as m,
1220
+ ye as n,
1221
+ et as o,
1222
+ z as p,
1223
+ $ as q,
1224
+ le as r,
1225
+ _t as s,
1226
+ Tt as t,
1227
+ Dt as u,
1228
+ tt as v,
1229
+ St as w,
1230
+ Et as x,
1231
+ st as y,
1232
+ we as z
1162
1233
  };