react-semaphor 0.1.601 → 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 (123) 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-BE0XXzZP.js → assistant-chat-B6hNQI1t.js} +146 -146
  9. package/dist/chunks/{bookmark-impact-DXDAN5AY.js → bookmark-impact-Ba2PLcGp.js} +3 -3
  10. package/dist/chunks/{bookmark-state-BMyB3Tb6.js → bookmark-state-n7AaNzR_.js} +517 -516
  11. package/dist/chunks/{card-filter-builder-CE0-YVN5.js → card-filter-builder-Y22HizVx.js} +474 -474
  12. package/dist/chunks/{comparison-window-caption-Dxj2CHOa.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-mJKPFRbb.js → dashboard-BghI99oY.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CntwKyiZ.js → dashboard-briefing-launcher-DtBAnGiH.js} +725 -716
  16. package/dist/chunks/{dashboard-controls-XO089DMg.js → dashboard-controls-CtFXlyjV.js} +53 -53
  17. package/dist/chunks/{dashboard-json-CQRiydUv.js → dashboard-json-DfGBUtCd.js} +5 -5
  18. package/dist/chunks/dates-BnrXF4bb.js +185 -0
  19. package/dist/chunks/{edit-dashboard-visual-f-Dm-BLR.js → edit-dashboard-visual-oxt3x1wb.js} +8081 -8268
  20. package/dist/chunks/{filter-line-CKNMyNTQ.js → filter-line-Cy5YYqRL.js} +27 -27
  21. package/dist/chunks/{filter-reach-copy-B8GGyVuR.js → filter-reach-copy-CE_ZX147.js} +1786 -2214
  22. package/dist/chunks/{filter-value-text-CRtKecI5.js → filter-value-text-fWvSDwkl.js} +11 -11
  23. package/dist/chunks/{index-DoPApnxg.js → index-D5rxbtS4.js} +24 -24
  24. package/dist/chunks/{layout-grid-CiSCZdIr.js → layout-grid-9LndRoLa.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-myf3D3Qx.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-C1SuOHLZ.js → matrix-operation-contract-DPBj69D8.js} +518 -514
  28. package/dist/chunks/{metric-comparison-Cm0G893W.js → metric-comparison-B0FR-Q8I.js} +184 -125
  29. package/dist/chunks/{paintbrush-DQIwqlck.js → paintbrush-58FQYY-y.js} +1 -1
  30. package/dist/chunks/{palette-Cun747Rg.js → palette-Be62Tkoa.js} +1 -1
  31. package/dist/chunks/{pivot-result-contract-expectations-C1Dyx8du.js → pivot-result-contract-expectations-BYqAmG9n.js} +1236 -1190
  32. package/dist/chunks/{pivot-result-identity-CBS-ssEp.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-SDZEcG2x.js → report-preferences-dialog-uJp9GBTM.js} +219 -205
  35. package/dist/chunks/{report-runtime-context-BbedQdtc.js → report-runtime-context-c77_KF9v.js} +2 -2
  36. package/dist/chunks/{resolve-dashboard-input-context-DRBS0eRa.js → resolve-dashboard-input-context-Rtl1ffmE.js} +8808 -7291
  37. package/dist/chunks/{save-Dj5bjm7P.js → save-C5A0JnEV.js} +1 -1
  38. package/dist/chunks/{saved-dashboard-context-DWVlJcsa.js → saved-dashboard-context-tcyTU8jm.js} +199 -213
  39. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +150 -0
  40. package/dist/chunks/{semaphor-ready-indicator-OFOoAY-A.js → semaphor-ready-indicator-FBvunj6S.js} +37894 -35726
  41. package/dist/chunks/{shelf-drop-preview-context-2swWypXu.js → shelf-drop-preview-context-QKStrcK9.js} +54 -54
  42. package/dist/chunks/{stored-dashboard-NtOuEX6a.js → stored-dashboard-CHozcAY9.js} +770 -743
  43. package/dist/chunks/{style-sheet-parts-Qv4UcLAo.js → style-sheet-parts-CDCG-8Ej.js} +258 -251
  44. package/dist/chunks/{table-export-sheet-Do7ZB0_F.js → table-export-sheet-ZFIvs6Sj.js} +1 -1
  45. package/dist/chunks/{token-types-Dy_aXO-U.js → token-types-XbM6QByy.js} +1 -1
  46. package/dist/chunks/{upload-Bq-puSVy.js → upload-H15d7uHK.js} +1 -1
  47. package/dist/chunks/{validators-C7DFk3QK.js → validators-Baf3VIf5.js} +5 -5
  48. package/dist/chunks/{variable-draft-Cy03qnEi.js → variable-draft-C2y8Jp6Z.js} +27 -28
  49. package/dist/dashboard/index.js +2 -2
  50. package/dist/dashboard-authoring/index.js +3392 -2761
  51. package/dist/format-utils/index.js +205 -204
  52. package/dist/index.js +73 -75
  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/dashboard/dashboard-web-component.d.ts +7 -0
  57. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
  58. package/dist/types/index.js +5 -5
  59. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +1 -1
  60. package/dist/types/lib/document/document-edits.d.ts +0 -4
  61. package/dist/types/lib/query-context/assemble-card-query.d.ts +6 -1
  62. package/dist/types/lib/stores/dashboard-store.d.ts +30 -1
  63. package/dist/types/lib/types/common-types.d.ts +0 -2
  64. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  65. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +15 -0
  66. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  67. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  68. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  69. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  70. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  71. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  72. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  73. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  74. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  75. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  76. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  77. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +52 -0
  78. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +129 -0
  79. package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts +46 -0
  80. package/dist/types/shared/dashboard-authoring/calculations/tokens.d.ts +36 -0
  81. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  82. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  83. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  84. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  85. package/dist/types/shared/dashboard-authoring/changes/calculation-change.d.ts +399 -0
  86. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +165 -360
  87. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +23 -2
  88. package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +143 -266
  89. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +2 -0
  90. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +46 -0
  91. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  92. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  93. package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
  94. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  95. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  96. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  97. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  98. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  99. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  100. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  101. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  102. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  103. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +158 -0
  104. package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +71 -0
  105. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +17 -6
  106. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -0
  107. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +3 -0
  108. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  109. package/dist/types/shared/format-utils/index.d.ts +1 -0
  110. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  111. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  112. package/dist/types/shared/temporal/index.d.ts +2 -0
  113. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  114. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  115. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  116. package/dist/types/shared/usage-events/details.d.ts +2 -2
  117. package/dist/types/shared/usage-events/envelope.d.ts +2 -2
  118. package/dist/usage-events/index.js +1 -1
  119. package/package.json +3 -2
  120. package/dist/chunks/dates-B-Urp5OD.js +0 -164
  121. package/dist/chunks/matrix-member-presentation-g0c_NpDW.js +0 -258
  122. package/dist/chunks/raw-temporal-value-DN_l-Tss.js +0 -454
  123. package/dist/chunks/selection-filter-compiler-DmAr7yqC.js +0 -131
@@ -0,0 +1,391 @@
1
+ import { $ as z, F as C } from "./raw-temporal-value-Dg_MTFF7.js";
2
+ import { w as B, q as b, t as M, l as I, L as N, z as y, p as T, s as F, o as L } from "./matrix-analytical-definition-CCp48UCw.js";
3
+ import { b as V } from "./metric-comparison-B0FR-Q8I.js";
4
+ import { m as S } from "./validators-Baf3VIf5.js";
5
+ function U(e) {
6
+ const t = j(e);
7
+ return O(t) ? t : void 0;
8
+ }
9
+ function j(e) {
10
+ if (typeof e != "string" || e.trim().length === 0)
11
+ return;
12
+ const t = e.trim().toLowerCase();
13
+ switch (t) {
14
+ case "=":
15
+ return "=";
16
+ case "!=":
17
+ return "!=";
18
+ case "in":
19
+ return "in";
20
+ case "not_in":
21
+ return "not_in";
22
+ case "contains":
23
+ return "contains";
24
+ case "not_contains":
25
+ return "not_contains";
26
+ case "between":
27
+ return "between";
28
+ case "not_between":
29
+ return "not_between";
30
+ case ">":
31
+ case ">=":
32
+ case "<":
33
+ case "<=":
34
+ return t;
35
+ case "is_null":
36
+ return "is_null";
37
+ case "is_not_null":
38
+ return "is_not_null";
39
+ default:
40
+ return q(e) ? e : void 0;
41
+ }
42
+ }
43
+ function O(e) {
44
+ return e === "=" || e === "!=" || e === "in" || e === "not_in" || e === "contains" || e === "not_contains" || e === "between" || e === "not_between" || e === ">" || e === ">=" || e === "<" || e === "<=";
45
+ }
46
+ function q(e) {
47
+ return O(e) || e === "not_contains" || e === "is_null" || e === "is_not_null";
48
+ }
49
+ function fe(e) {
50
+ switch (e) {
51
+ case "not in":
52
+ return "not_in";
53
+ case "like":
54
+ return "contains";
55
+ case "not like":
56
+ return "not_contains";
57
+ case "not between":
58
+ return "not_between";
59
+ case "is null":
60
+ case "is not null":
61
+ return;
62
+ default:
63
+ return U(e);
64
+ }
65
+ }
66
+ const K = [
67
+ "=",
68
+ "!=",
69
+ ">",
70
+ "<",
71
+ ">=",
72
+ "<=",
73
+ "like",
74
+ "not like",
75
+ "between",
76
+ "not between",
77
+ "in",
78
+ "not in",
79
+ "is null",
80
+ "is not null"
81
+ ], Y = /* @__PURE__ */ new Set(["string", "number", "date", "boolean"]);
82
+ function G(e) {
83
+ return typeof e == "string" && K.includes(e);
84
+ }
85
+ function $(e, t) {
86
+ switch (e) {
87
+ case "is null":
88
+ case "is not null":
89
+ return t.length === 0;
90
+ case "between":
91
+ case "not between":
92
+ return t.length === 2;
93
+ case "in":
94
+ case "not in":
95
+ return t.length >= 1;
96
+ default:
97
+ return t.length === 1;
98
+ }
99
+ }
100
+ function H(e) {
101
+ if (!e || typeof e != "object" || Array.isArray(e))
102
+ return;
103
+ const t = e, n = {};
104
+ for (const r of Z)
105
+ t[r] !== void 0 && (n[r] = t[r]);
106
+ return n;
107
+ }
108
+ const Z = [
109
+ "operation",
110
+ "values",
111
+ "valueType",
112
+ "temporalBucket",
113
+ "relativeMeta",
114
+ "temporalPrecision"
115
+ ];
116
+ function J(e) {
117
+ const t = H(e);
118
+ if (!t) return;
119
+ const { operation: n, values: r } = t;
120
+ if (!G(n) || !Array.isArray(r) || !$(n, r)) return;
121
+ const s = typeof t.valueType == "string" && Y.has(t.valueType) ? t.valueType : void 0;
122
+ return {
123
+ operation: n,
124
+ values: r,
125
+ ...s ? { valueType: s } : {},
126
+ ...t.temporalBucket !== void 0 ? { temporalBucket: t.temporalBucket } : {},
127
+ ...t.relativeMeta !== void 0 ? { relativeMeta: t.relativeMeta } : {},
128
+ ...t.temporalPrecision !== void 0 ? { temporalPrecision: t.temporalPrecision } : {}
129
+ };
130
+ }
131
+ function me(e) {
132
+ const t = J(e);
133
+ if (!t)
134
+ throw new Error(
135
+ `Filter operation "${String(e.operation)}" cannot be expressed as predicate semantics.`
136
+ );
137
+ return t;
138
+ }
139
+ function we(e) {
140
+ return e.operation === "is null" || e.operation === "is not null";
141
+ }
142
+ function Q(e, t, n) {
143
+ const r = new Date(e.startInclusive), s = new Date(e.endExclusive);
144
+ if (!Number.isFinite(r.valueOf()) || !Number.isFinite(s.valueOf()) || r >= s) return null;
145
+ try {
146
+ return I({ start: r, endExclusive: s, zone: e.timezone, column: t, basis: n });
147
+ } catch {
148
+ return null;
149
+ }
150
+ }
151
+ function v(e, t) {
152
+ switch (e) {
153
+ case "day":
154
+ return { amount: -t, unit: "day" };
155
+ case "week":
156
+ return { amount: -7 * t, unit: "day" };
157
+ case "month":
158
+ return { amount: -t, unit: "month" };
159
+ case "quarter":
160
+ return { amount: -3 * t, unit: "month" };
161
+ case "year":
162
+ return { amount: -12 * t, unit: "month" };
163
+ }
164
+ }
165
+ function k(e, t, n, r) {
166
+ return { ...F(e, t, n, { toDate: r }), step: v(n, t) };
167
+ }
168
+ function D(e, t, n) {
169
+ const r = n * t;
170
+ return {
171
+ start: e.start.subtract({ milliseconds: r }),
172
+ endExclusive: e.endExclusive.subtract({ milliseconds: r }),
173
+ step: { amount: -Math.round(r / 1e3), unit: "second" }
174
+ };
175
+ }
176
+ function X(e) {
177
+ const t = L(e), n = t.hours || t.minutes || t.seconds || t.milliseconds;
178
+ return Math.max(1, t.days + (n ? 1 : 0));
179
+ }
180
+ const ee = 24 * 60 * 60 * 1e3;
181
+ function te(e) {
182
+ if (e.originalPeriod) return k(e.current, e.offset, e.originalPeriod, e.cut);
183
+ const t = T(e.whole);
184
+ return t < ee || !e.current.start.equals(e.current.start.startOfDay()) ? D(e.current, e.offset, t) : k(e.current, X(e.whole) * e.offset, "day", e.cut);
185
+ }
186
+ function ne(e) {
187
+ if (e.basis.kind === "elapsed") return D(e.current, e.offset, T(e.whole));
188
+ const t = k(e.current, e.basis.n * e.offset, e.basis.unit, e.basis.toDate || e.cut);
189
+ return t.endExclusive.epochMilliseconds > e.current.start.epochMilliseconds ? { ...t, endExclusive: e.current.start } : t;
190
+ }
191
+ function re(e, t) {
192
+ const n = 364 * t;
193
+ return {
194
+ start: b(e.start, -n, "day"),
195
+ endExclusive: b(e.endExclusive, -n, "day"),
196
+ step: { amount: -n, unit: "day" }
197
+ };
198
+ }
199
+ const _ = (e) => ({
200
+ tz: e.timezone,
201
+ weekStart: e.weekStart,
202
+ ...e.fiscalCalendar ? { fiscalCalendar: e.fiscalCalendar } : {}
203
+ });
204
+ function se(e) {
205
+ const { start: t, end: n } = N(
206
+ e.basis.window,
207
+ { calendar: _(e.calendar), now: e.referenceTime },
208
+ { spansBack: e.offset }
209
+ ), r = e.basis.window, s = r.kind === "periods" ? (r.to - r.from + 1) * e.offset : e.offset, a = r.kind === "periods" ? r.unit : "day";
210
+ return {
211
+ start: y(t, e.calendar.timezone),
212
+ endExclusive: y(C(n), e.calendar.timezone),
213
+ step: v(a, s)
214
+ };
215
+ }
216
+ function oe(e, t) {
217
+ if (e.basis.kind !== "calendar") return;
218
+ const n = e.basis.window;
219
+ if (n.kind !== "periods" || !n.toDate || typeof n.anchor == "object") return;
220
+ const { toDate: r, ...s } = n, { start: a, end: c } = N(
221
+ { ...s, anchor: "now" },
222
+ { calendar: _(t), now: new Date(e.endExclusive.epochMilliseconds - 1) }
223
+ );
224
+ return a.getTime() === e.start.epochMilliseconds ? { start: y(a, t.timezone), endExclusive: y(C(c), t.timezone) } : void 0;
225
+ }
226
+ const P = (e) => ({
227
+ startInclusive: new Date(e.start.epochMilliseconds).toISOString(),
228
+ endExclusive: new Date(e.endExclusive.epochMilliseconds).toISOString(),
229
+ timezone: e.start.timeZoneId
230
+ });
231
+ function he(e) {
232
+ if (!e.currentWindow)
233
+ return { status: "unavailable", reason: "finite_current_window_required" };
234
+ const t = Q(e.currentWindow, e.column, e.basis);
235
+ if (!t || !Number.isFinite(e.referenceTime.getTime()))
236
+ return { status: "unavailable", reason: "temporal_binding_invalid" };
237
+ const n = { timezone: e.currentWindow.timezone, weekStart: e.weekStart, fiscalCalendar: e.fiscalCalendar }, r = z(
238
+ new Date(t.start.epochMilliseconds),
239
+ new Date(t.endExclusive.epochMilliseconds),
240
+ _(n)
241
+ ), s = B(t, e.referenceTime);
242
+ if (!s)
243
+ return { status: "unavailable", reason: "current_window_not_started" };
244
+ const a = e.basis, c = oe(t, n) ?? t, o = s.endExclusive.epochMilliseconds < t.endExclusive.epochMilliseconds, i = V(e.spec), l = i.offset ?? 1, m = i.unit === "year" && !i.matchWeekdays;
245
+ if (m && r === "day") {
246
+ const f = s.start;
247
+ if (f.month === 2 && f.day === 29 && b(f, -l, "year").day !== 29)
248
+ return { status: "unavailable", reason: "insufficient_history" };
249
+ }
250
+ const u = i.unit === "period" ? void 0 : i.unit, w = (f, p, W) => f === "year" && i.matchWeekdays ? re(p, l) : m ? (
251
+ // A step by years shifts both ends by years and gives the same answer for an anchored window (AO-D6).
252
+ {
253
+ start: b(p.start, -l, "year"),
254
+ endExclusive: b(p.endExclusive, -l, "year"),
255
+ step: v("year", l)
256
+ }
257
+ ) : (
258
+ // A calendar unit back: whole months stay whole, any other window moves its last included instant (K6).
259
+ k(p, l, f, W)
260
+ ), g = u ? w(u, s, o) : a.kind === "anchored" ? se({ basis: a, referenceTime: e.referenceTime, offset: l, calendar: n }) : a.kind === "calendar" || a.kind === "elapsed" ? ne({ basis: a, current: s, whole: c, cut: o, offset: l }) : te({ current: s, whole: c, originalPeriod: r, cut: o, offset: l }), x = a.kind === "elapsed";
261
+ if (u && M(w(u, c, !1), c, { elapsed: x }).endExclusive.epochMilliseconds > t.start.epochMilliseconds)
262
+ return { status: "unavailable", reason: "overlaps_current_window" };
263
+ const E = M(g, s, { elapsed: x });
264
+ return {
265
+ status: "resolved",
266
+ currentWindow: P(s),
267
+ comparisonWindow: P(E),
268
+ step: E.step
269
+ };
270
+ }
271
+ const A = "numeric_range", be = 32, ie = (e) => typeof e == "number" && Number.isFinite(e), h = (e) => {
272
+ if (ie(e)) return e;
273
+ if (typeof e == "string" && e.trim() !== "") {
274
+ const t = Number(e);
275
+ return Number.isFinite(t) ? t : null;
276
+ }
277
+ return null;
278
+ };
279
+ function pe(e) {
280
+ if (!e || typeof e != "object") return;
281
+ const t = e;
282
+ if (t.kind !== A) return;
283
+ const n = h(t.min), r = h(t.max), s = h(t.emptyRows) ?? 0, a = t.bucketing === "value" ? "value" : "width", c = h(t.bucketWidth) ?? 0, o = Array.isArray(t.buckets) ? t.buckets.map((i) => Math.max(0, h(i) ?? 0)) : [];
284
+ if (n === null == (r === null) && !(n !== null && r !== null && n > r) && !(o.length > 0 && !(c > 0)))
285
+ return { kind: A, min: n, max: r, emptyRows: s, bucketing: a, buckets: o, bucketWidth: c };
286
+ }
287
+ function R(e) {
288
+ return e.buckets.reduce((t, n) => t + n, 0);
289
+ }
290
+ function ye(e, t) {
291
+ const n = e.min ?? 0;
292
+ return { from: n + t * e.bucketWidth, to: n + (t + 1) * e.bucketWidth };
293
+ }
294
+ function d(e, t, n) {
295
+ const r = R(e);
296
+ if (e.min === null || e.max === null || e.buckets.length === 0)
297
+ return e.min === null ? { rows: 0, exact: !0 } : { rows: (n ? t >= e.min : t > e.min) ? r : 0, exact: !0 };
298
+ if (e.bucketing === "value") {
299
+ let i = 0;
300
+ return e.buckets.forEach((l, m) => {
301
+ const u = e.min + m;
302
+ (n ? u <= t : u < t) && (i += l);
303
+ }), { rows: i, exact: !0 };
304
+ }
305
+ if (t <= e.min) return { rows: 0, exact: !(n && t === e.min) };
306
+ if (t >= e.max) return { rows: r, exact: n || t > e.max };
307
+ const s = (t - e.min) / e.bucketWidth, a = Math.floor(s);
308
+ let c = 0;
309
+ for (let i = 0; i < a; i += 1) c += e.buckets[i] ?? 0;
310
+ const o = s - a;
311
+ return c += (e.buckets[a] ?? 0) * o, { rows: c, exact: o === 0 && !n };
312
+ }
313
+ function ke(e, t, n) {
314
+ const r = R(e), s = (o, ...i) => ({
315
+ rows: Math.round(Math.max(0, Math.min(r, o))),
316
+ exact: i.every(Boolean)
317
+ }), [a, c] = n;
318
+ switch (t) {
319
+ case "is null":
320
+ return { rows: e.emptyRows, exact: !0 };
321
+ case "is not null":
322
+ return { rows: r, exact: !0 };
323
+ case ">=": {
324
+ const o = d(e, a, !1);
325
+ return s(r - o.rows, o.exact);
326
+ }
327
+ case ">": {
328
+ const o = d(e, a, !0);
329
+ return s(r - o.rows, o.exact);
330
+ }
331
+ case "<=": {
332
+ const o = d(e, a, !0);
333
+ return s(o.rows, o.exact);
334
+ }
335
+ case "<": {
336
+ const o = d(e, a, !1);
337
+ return s(o.rows, o.exact);
338
+ }
339
+ case "between":
340
+ case "not between": {
341
+ const o = d(e, c, !0), i = d(e, a, !1), l = o.rows - i.rows;
342
+ return s(t === "between" ? l : r - l, o.exact, i.exact);
343
+ }
344
+ case "=":
345
+ case "!=": {
346
+ if (e.bucketing !== "value" && e.buckets.length > 0) return null;
347
+ const o = d(e, a, !0).rows - d(e, a, !1).rows;
348
+ return s(t === "=" ? o : r - o, !0);
349
+ }
350
+ default:
351
+ return null;
352
+ }
353
+ }
354
+ function ae(e, t) {
355
+ var r;
356
+ if (t === null) return !0;
357
+ if (t.overrides.length === 0) return e.length <= t.depth;
358
+ const n = S(e);
359
+ return ((r = t.overrides.find((s) => s.path.length === e.length && S(s.path) === n)) == null ? void 0 : r.expanded) ?? e.length <= t.depth;
360
+ }
361
+ function ve(e) {
362
+ var w;
363
+ const { path: t, levelCount: n, expansion: r, total: s, axis: a } = e, c = t.length >= n || ((w = t[t.length - 1]) == null ? void 0 : w.member.kind) === "others", o = !c && !e.childrenEmpty, i = o && ae(t, r), l = a === "rows" && e.rowLayout !== "tabular", m = i && !!e.skipRedundant && !!e.singleChild, u = !!(s != null && s.visible) && !m;
364
+ return {
365
+ expandable: o,
366
+ expanded: i,
367
+ memberVisible: l || !i,
368
+ valueVisible: c || u && (!i || s.position === "before"),
369
+ subtotalBefore: !l && i && u && s.position === "before",
370
+ subtotalAfter: i && u && s.position === "after"
371
+ };
372
+ }
373
+ export {
374
+ K as N,
375
+ j as a,
376
+ J as b,
377
+ me as c,
378
+ he as d,
379
+ A as e,
380
+ be as f,
381
+ R as g,
382
+ ye as h,
383
+ we as i,
384
+ ke as j,
385
+ ae as k,
386
+ ve as l,
387
+ U as n,
388
+ H as p,
389
+ pe as r,
390
+ fe as t
391
+ };