react-semaphor 0.1.526 → 0.1.527

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 (175) hide show
  1. package/DATA_APP_SDK.md +5 -1
  2. package/dist/analytics-protocol/index.js +1179 -296
  3. package/dist/brand-studio/index.js +15 -15
  4. package/dist/briefings/index.js +50 -49
  5. package/dist/chunks/{calculated-field-identity-D1ofR4KJ.js → calculated-field-identity-DEhjPSr-.js} +66 -65
  6. package/dist/chunks/{card-config-utils-9sv4e-Vb.js → card-config-utils-BlIbwkuD.js} +68 -65
  7. package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
  8. package/dist/chunks/dashboard-JNHR0_cZ.js +14 -0
  9. package/dist/chunks/{dashboard-briefing-launcher-DXz1GhFZ.js → dashboard-briefing-launcher-D9pFByPh.js} +372 -359
  10. package/dist/chunks/{dashboard-controls-Df8qOSrs.js → dashboard-controls-CJI5ZWMq.js} +739 -686
  11. package/dist/chunks/{dashboard-json-Xldp0qww.js → dashboard-json-DLdrFry-.js} +10 -10
  12. package/dist/chunks/{edit-dashboard-visual-COHBqyic.js → edit-dashboard-visual-D5LjWle1.js} +6603 -6572
  13. package/dist/chunks/{editor-action-buttons-DahlP57T.js → editor-action-buttons-G91NQKxU.js} +266 -267
  14. package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-DeVQLIsP.js} +19 -19
  15. package/dist/chunks/{field-dependencies-v-lJNzC7.js → field-dependencies-CGYic38w.js} +1 -1
  16. package/dist/chunks/{index-CbjuruKe.js → index-BvJOYbNv.js} +755 -745
  17. package/dist/chunks/{matrix-analytical-definition-BimC4XIV.js → matrix-analytical-definition-BJyH5-99.js} +1 -1
  18. package/dist/chunks/{matrix-card-CIlz0Dnp.js → matrix-card-DY45yiUM.js} +7 -6
  19. package/dist/chunks/{matrix-control-sources-2VAzGlt8.js → matrix-control-sources-BypfLZsK.js} +11 -11
  20. package/dist/chunks/{matrix-definition-E5gXXSTZ.js → matrix-definition-Cdn3LoxW.js} +3 -3
  21. package/dist/chunks/{semantic-format-Baqp8kD_.js → matrix-formatter-BoKU3MzZ.js} +655 -511
  22. package/dist/chunks/{matrix-member-presentation-Bw7-JCrr.js → matrix-member-presentation-BBW0n1iY.js} +1 -1
  23. package/dist/chunks/matrix-operation-contract-BV02rLhu.js +809 -0
  24. package/dist/chunks/{metric-comparison-BphoJ9bq.js → metric-comparison-Crljx_XY.js} +15 -10
  25. package/dist/chunks/{numeric-presentation-VhMUHfrJ.js → numeric-presentation-LvnNY5Ma.js} +68 -68
  26. package/dist/chunks/pivot-header-presentation-D5v8uyjj.js +618 -0
  27. package/dist/chunks/{pivot-result-identity-BzUQiCEV.js → pivot-result-identity-CY__BuwI.js} +1 -1
  28. package/dist/chunks/{pivot-result-lifecycle-BFO354lk.js → pivot-result-lifecycle-BWrPhlGT.js} +259 -204
  29. package/dist/chunks/{raw-temporal-7bFbXd2a.js → raw-temporal-CdnA_OXJ.js} +10 -10
  30. package/dist/chunks/{raw-temporal-contract-BQZIJ1fn.js → raw-temporal-contract-Bc9z83t-.js} +1 -1
  31. package/dist/chunks/relative-date-DAF9J7mt.js +456 -0
  32. package/dist/chunks/{report-preferences-dialog-BcH-0lR-.js → report-preferences-dialog-D3hxu4sE.js} +131 -132
  33. package/dist/chunks/{report-runtime-context-CxIoGyNM.js → report-runtime-context-CtaGGlit.js} +1 -1
  34. package/dist/chunks/{selection-reducer-NF5C07yM.js → selection-reducer-C7Um5XN-.js} +47 -26
  35. package/dist/chunks/semantic-format-BjBMOSoo.js +192 -0
  36. package/dist/chunks/{semaphor-ready-indicator-BLRDuLr4.js → semaphor-ready-indicator-D46I_4g7.js} +49895 -46141
  37. package/dist/chunks/{slider-BYIH4icg.js → slider-B6LELqx6.js} +81 -82
  38. package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
  39. package/dist/chunks/switch-_7uBAbYx.js +24003 -0
  40. package/dist/chunks/{temporal-bucket-PcLFSYWX.js → temporal-bucket-DlFuhCnT.js} +6 -6
  41. package/dist/chunks/{temporal-bucket-contract-DTLDRzgV.js → temporal-bucket-contract-C6lUGPS3.js} +1 -1
  42. package/dist/chunks/temporal-input-presentation-DyMWCZYh.js +195 -0
  43. package/dist/chunks/{token-types-BC6RcUY8.js → token-types-UjyNz95-.js} +1 -1
  44. package/dist/chunks/{validators-CsdOtZI6.js → validators-CQcG0EPN.js} +852 -731
  45. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
  46. package/dist/dashboard/index.js +1 -1
  47. package/dist/dashboard-authoring/index.js +138 -137
  48. package/dist/data-app-sdk/index.js +12 -12
  49. package/dist/data-app-sdk-adapters/index.js +23 -22
  50. package/dist/data-app-sdk-validation/index.js +27 -26
  51. package/dist/format-utils/index.js +247 -329
  52. package/dist/index.js +165 -168
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +1 -1
  56. package/dist/types/briefings/index.d.ts +3 -0
  57. package/dist/types/components/explorer/filters/card-date-filter.d.ts +13 -5
  58. package/dist/types/components/explorer/filters/card-date-selection.d.ts +28 -0
  59. package/dist/types/components/sharing-and-management/dashboard-actions-menu.d.ts +1 -1
  60. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -1
  61. package/dist/types/components/surfboard/download-settings-dialog.d.ts +8 -0
  62. package/dist/types/components/surfboard/filter/types.d.ts +8 -29
  63. package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +5 -1
  64. package/dist/types/components/ui-custom/date-range-picker.d.ts +18 -2
  65. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -21
  66. package/dist/types/components/ui-custom/report-calendar.d.ts +18 -0
  67. package/dist/types/components/visual/aggregated-table/utils/export-utils.d.ts +3 -5
  68. package/dist/types/components/visual/data-table/data-table-toolbar.d.ts +1 -1
  69. package/dist/types/components/visual/pivot-table/utils/pivot-table-export-utils.d.ts +3 -1
  70. package/dist/types/index.js +5 -5
  71. package/dist/types/lib/api/exports-api.d.ts +3 -0
  72. package/dist/types/lib/csv-download.d.ts +9 -0
  73. package/dist/types/lib/csv-encoding-options.d.ts +6 -0
  74. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +2 -1
  75. package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +0 -1
  76. package/dist/types/lib/document/document-input-runtime.d.ts +2 -1
  77. package/dist/types/lib/export-utils.d.ts +17 -15
  78. package/dist/types/lib/hooks/explorer/use-filter-builder.d.ts +2 -2
  79. package/dist/types/lib/hooks/use-relative-date-summarizer.d.ts +7 -0
  80. package/dist/types/lib/matrix-table/matrix-application-adapter.d.ts +3 -2
  81. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  82. package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +1 -1
  83. package/dist/types/lib/matrix-table/matrix-dataset-history.d.ts +47 -0
  84. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +7 -3
  85. package/dist/types/lib/matrix-table/matrix-execution-context.d.ts +2 -0
  86. package/dist/types/lib/matrix-table/matrix-query-transport.d.ts +4 -1
  87. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +105 -4
  88. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +43 -2
  89. package/dist/types/lib/matrix-table/use-matrix.d.ts +6 -0
  90. package/dist/types/lib/query-context/build-card-query-context.d.ts +5 -1
  91. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +0 -1
  92. package/dist/types/lib/query-context/build-global-date-comparison-context.d.ts +1 -2
  93. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +1 -2
  94. package/dist/types/lib/query-context/dashboard-card-query-key.d.ts +10 -0
  95. package/dist/types/lib/query-context/query-auth-scope.d.ts +5 -0
  96. package/dist/types/lib/stores/dashboard-store.d.ts +9 -4
  97. package/dist/types/lib/temporal-filter/temporal-filter-utils.d.ts +9 -2
  98. package/dist/types/lib/types/common-types.d.ts +5 -0
  99. package/dist/types/lib/types/explorer-types.d.ts +14 -0
  100. package/dist/types/lib/types/token-types.d.ts +0 -1
  101. package/dist/types/lib/utils/card-definition.d.ts +1 -1
  102. package/dist/types/lib/utils/date-timezone-utils.d.ts +4 -46
  103. package/dist/types/lib/utils/filter-default-value-utils.d.ts +8 -2
  104. package/dist/types/lib/utils/inline-filter-utils.d.ts +3 -2
  105. package/dist/types/lib/utils/relative-date-description.d.ts +38 -0
  106. package/dist/types/shared/analytics-protocol/contracts.d.ts +10 -7
  107. package/dist/types/shared/analytics-protocol/index.d.ts +12 -1
  108. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +20 -20
  109. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +10 -10
  110. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +8 -8
  111. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +51 -5
  112. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +9 -3
  113. package/dist/types/shared/analytics-protocol/operation-temporal-state.d.ts +64 -0
  114. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +61 -0
  115. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +20 -0
  116. package/dist/types/shared/analytics-protocol/runtime-schemas.d.ts +0 -2
  117. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +314 -0
  118. package/dist/types/shared/analytics-protocol/time-window.d.ts +13 -0
  119. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +8 -4
  120. package/dist/types/shared/format-utils/exporters/csv-utils.d.ts +46 -15
  121. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -3
  122. package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +2 -1
  123. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +2 -2
  124. package/dist/types/shared/format-utils/types/format-types.d.ts +0 -42
  125. package/dist/types/shared/temporal/calendar-periods.d.ts +56 -0
  126. package/dist/types/shared/temporal/index.d.ts +5 -0
  127. package/dist/types/shared/temporal/relative-date.d.ts +21 -0
  128. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +73 -0
  129. package/dist/types/shared/temporal/time-window-periods.d.ts +21 -0
  130. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +23 -0
  131. package/package.json +1 -17
  132. package/src/data-app-sdk/README.md +6 -3
  133. package/dist/chunks/code-highlight-994tgM9v.js +0 -22265
  134. package/dist/chunks/dashboard-CsHvEtjN.js +0 -15
  135. package/dist/chunks/dashboard-date-comparison-definition-BqNhECUr.js +0 -183
  136. package/dist/chunks/matrix-formatter-WBgtebUT.js +0 -341
  137. package/dist/chunks/matrix-operation-contract-D32U2CSw.js +0 -1802
  138. package/dist/chunks/mouse-pointer-2-BZvGk45-.js +0 -19
  139. package/dist/chunks/pivot-header-presentation-CGtudHo7.js +0 -661
  140. package/dist/chunks/pre-block-Cq1RqhZX.js +0 -3987
  141. package/dist/chunks/search-CJz-QQ0Q.js +0 -24
  142. package/dist/chunks/switch-XaAACBrJ.js +0 -2234
  143. package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +0 -222
  144. package/dist/chunks/update-policy-DhAUtiC8.js +0 -913
  145. package/dist/data-app-builder/index.js +0 -3666
  146. package/dist/data-app-builder-browser-runtime/index.js +0 -8
  147. package/dist/data-app-codegen/index.js +0 -22
  148. package/dist/data-app-codegen-node/index.js +0 -1807
  149. package/dist/types/components/data-app-runtime/published-data-app-runtime.d.ts +0 -7
  150. package/dist/types/components/surfboard/json-to-csv.d.ts +0 -7
  151. package/dist/types/components/visual/data-table/utils/export-utils.d.ts +0 -31
  152. package/dist/types/data-app-builder/browser-runtime.d.ts +0 -174
  153. package/dist/types/data-app-builder/constants.d.ts +0 -14
  154. package/dist/types/data-app-builder/data-app-builder.d.ts +0 -14
  155. package/dist/types/data-app-builder/index.d.ts +0 -1
  156. package/dist/types/data-app-builder/lib/api.d.ts +0 -36
  157. package/dist/types/data-app-builder/lib/context-select.d.ts +0 -3
  158. package/dist/types/data-app-builder/lib/diagnostics.d.ts +0 -12
  159. package/dist/types/data-app-builder/lib/file-tree.d.ts +0 -2
  160. package/dist/types/data-app-builder/types.d.ts +0 -558
  161. package/dist/types/data-app-builder-browser-runtime.d.ts +0 -2
  162. package/dist/types/data-app-builder.d.ts +0 -2
  163. package/dist/types/data-app-codegen/generate-contract.d.ts +0 -26
  164. package/dist/types/data-app-codegen/generated-contract-files.d.ts +0 -7
  165. package/dist/types/data-app-codegen/generated-contract-validation.d.ts +0 -13
  166. package/dist/types/data-app-codegen/index.d.ts +0 -6
  167. package/dist/types/data-app-codegen/live-execution.d.ts +0 -42
  168. package/dist/types/data-app-codegen/node.d.ts +0 -2
  169. package/dist/types/data-app-codegen/update-policy.d.ts +0 -25
  170. package/dist/types/data-app-codegen/validation.d.ts +0 -8
  171. package/dist/types/data-app-codegen-node.d.ts +0 -2
  172. package/dist/types/data-app-codegen.d.ts +0 -2
  173. package/dist/types/shared/analytics-protocol/data-app-codegen-summary.d.ts +0 -418
  174. package/dist/types/shared/format-utils/exporters/pivot-exporter.d.ts +0 -13
  175. package/dist/types/shared/format-utils/exporters/table-exporter.d.ts +0 -10
@@ -1,19 +0,0 @@
1
- import { c as e } from "./x-CXDkqdur.js";
2
- /**
3
- * @license lucide-react v0.453.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */
8
- const a = e("MousePointer2", [
9
- [
10
- "path",
11
- {
12
- d: "M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",
13
- key: "edeuup"
14
- }
15
- ]
16
- ]);
17
- export {
18
- a as M
19
- };
@@ -1,661 +0,0 @@
1
- var U = Object.defineProperty;
2
- var j = (e, r, t) => r in e ? U(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var A = (e, r, t) => j(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { i as X } from "./raw-temporal-7bFbXd2a.js";
5
- import { g as L, i as H } from "./numeric-presentation-VhMUHfrJ.js";
6
- import { e as F, m as I, h as O, i as K, j as z } from "./matrix-formatter-WBgtebUT.js";
7
- import { al as W, b5 as k, S } from "./validators-CsdOtZI6.js";
8
- import "./matrix-operation-contract-D32U2CSw.js";
9
- import { g as D } from "./matrix-definition-E5gXXSTZ.js";
10
- import { PDF_SAFETY_LIMIT_EXCEEDED as $, getUtf8ByteLength as Y, FAST_PDF_POLICY as q } from "../pdf-export-policy/index.js";
11
- import { f as J } from "./temporal-bucket-PcLFSYWX.js";
12
- function Z(e, r, t) {
13
- const n = {
14
- ...r,
15
- locale: r.locale ?? t
16
- };
17
- if (n.type === "number")
18
- return L(e, n);
19
- const { prefix: o, suffix: s, ...a } = n;
20
- return `${o ?? ""}${L(e, {
21
- ...a,
22
- negativeStyle: n.type === "currency" ? n.negativeStyle : "minus"
23
- })}${s ?? ""}`;
24
- }
25
- function E(e, r, t) {
26
- return e === null ? { value: e, text: null } : !r || !X(r) && r.type !== "duration" ? {
27
- value: e,
28
- text: L(e, { type: "number", locale: t })
29
- } : r.type === "duration" ? {
30
- value: e,
31
- text: H(e, {
32
- inputUnit: r.inputUnit,
33
- outputStyle: r.outputStyle,
34
- largestUnit: r.largestUnit,
35
- smallestUnit: r.smallestUnit,
36
- maxUnits: r.maxUnits,
37
- prefix: r.prefix,
38
- suffix: r.suffix,
39
- negativeInParentheses: r.negativeStyle === "parentheses"
40
- })
41
- } : { value: e, text: Z(e, r, t) };
42
- }
43
- function _(e, r, t, n) {
44
- return e === null ? { value: e, text: null } : n === "percent" ? {
45
- value: e,
46
- text: L(e, {
47
- type: "percent",
48
- locale: t,
49
- minimumFractionDigits: r,
50
- maximumFractionDigits: r,
51
- percentValueMode: "fraction"
52
- })
53
- } : {
54
- value: e,
55
- text: L(e, {
56
- type: "number",
57
- locale: t,
58
- minimumFractionDigits: r,
59
- maximumFractionDigits: r,
60
- suffix: "×"
61
- })
62
- };
63
- }
64
- function R(e, r) {
65
- if (e === void 0) return r;
66
- if (!Number.isInteger(e) || e < 0 || e > 6)
67
- throw new RangeError("Comparison precision must be an integer from 0 to 6.");
68
- return e;
69
- }
70
- function Ce(e, r) {
71
- const t = {
72
- mode: r.displayMode,
73
- current: E(
74
- e.currentValue,
75
- r.metricFormat,
76
- r.locale
77
- ),
78
- comparison: E(
79
- e.comparisonValue,
80
- r.metricFormat,
81
- r.locale
82
- )
83
- };
84
- return (r.displayMode === "difference" || r.displayMode === "both") && (t.difference = E(
85
- e.delta,
86
- r.metricFormat,
87
- r.locale
88
- )), (r.displayMode === "percent_change" || r.displayMode === "both") && (t.percentChange = _(
89
- e.percentChange,
90
- R(r.precision, 1),
91
- r.locale,
92
- "percent"
93
- )), r.displayMode === "ratio" && (t.ratio = _(
94
- e.ratio,
95
- R(r.precision, 2),
96
- r.locale,
97
- "ratio"
98
- )), t;
99
- }
100
- function M(e) {
101
- const r = e.trimStart().charAt(0);
102
- return ["=", "+", "-", "@"].includes(r) || [" ", "\r", `
103
- `].includes(e.charAt(0)) ? `'${e}` : e;
104
- }
105
- function Q(e, r = ",") {
106
- if (e == null)
107
- return "";
108
- const t = String(e);
109
- return t.includes(r) || t.includes('"') || t.includes(`
110
- `) || t.includes("\r") ? `"${t.replace(/"/g, '""')}"` : t;
111
- }
112
- function ee(e, r = ",") {
113
- return e.map((t) => Q(t, r)).join(r);
114
- }
115
- function re(e, r = {}) {
116
- const { delimiter: t = ",", lineEnding: n = `
117
- ` } = r;
118
- return e.map((o) => ee(o, t)).join(n);
119
- }
120
- function ke(e, r = {}) {
121
- if (e.length === 0)
122
- return "";
123
- const {
124
- delimiter: t = ",",
125
- lineEnding: n = `
126
- `,
127
- includeHeaders: o = !0,
128
- columns: s
129
- } = r, a = s || Object.keys(e[0]), l = [];
130
- o && l.push(a);
131
- for (const m of e) {
132
- const u = a.map((d) => {
133
- const g = m[d];
134
- return g == null ? "" : String(g);
135
- });
136
- l.push(u);
137
- }
138
- return re(l, { delimiter: t, lineEnding: n });
139
- }
140
- const te = 1e4, Me = 1e6, Ie = 5e6, _e = 1024 ** 3, Re = 1024 ** 3;
141
- function Ve(e) {
142
- return e > te;
143
- }
144
- const Fe = {
145
- rowLabels: "tabular",
146
- subtotals: "after"
147
- };
148
- function Oe(e, r) {
149
- const t = r.rowLabels === "outline" ? { kind: "compact" } : e.layout.kind === "tabular" ? e.layout : { kind: "tabular", repeatLabels: !1 }, n = e.totals.rows;
150
- return {
151
- ...e,
152
- layout: t,
153
- totals: {
154
- ...e.totals,
155
- rows: {
156
- ...n,
157
- levels: Object.fromEntries(
158
- Object.entries(n.levels).map(([o, s]) => [
159
- o,
160
- { ...s, position: r.subtotals }
161
- ])
162
- )
163
- }
164
- }
165
- };
166
- }
167
- const oe = 2;
168
- function ne(e) {
169
- return typeof e == "number" ? Number.isInteger(e) : k(e) ? !e.value.includes(".") : !0;
170
- }
171
- function ae(e, r, t) {
172
- const n = e.descriptors.measures.filter(
173
- (a) => t.measureFormats[a.id] === void 0 && a.semanticFormat === void 0 && W(a.column.dataType) === "number"
174
- );
175
- if (n.length === 0) return t;
176
- const o = /* @__PURE__ */ new Set();
177
- e.columns.forEach((a, l) => {
178
- if (!(a.kind !== "measure" || o.has(a.measureId)))
179
- for (const m of r) {
180
- const u = m.values[l];
181
- if ((u == null ? void 0 : u.kind) === "value" && !ne(u.value)) {
182
- o.add(a.measureId);
183
- return;
184
- }
185
- }
186
- });
187
- const s = { ...t.measureFormats };
188
- for (const { id: a } of n) {
189
- const l = o.has(a) ? oe : 0;
190
- s[a] = {
191
- type: "number",
192
- minimumFractionDigits: l,
193
- maximumFractionDigits: l,
194
- useGrouping: !0
195
- };
196
- }
197
- return { ...t, measureFormats: s };
198
- }
199
- function P(e) {
200
- return S(e.slice(0, -1));
201
- }
202
- function se(e, r) {
203
- return r.length > e.length && S(r.slice(0, e.length)) === S(e);
204
- }
205
- function le(e) {
206
- return e.map((r, t) => {
207
- if (t === 0 || r.kind !== "layout") return !1;
208
- const n = e[t - 1];
209
- if (n.kind !== "layout") return !1;
210
- if (r.role !== "member" || se(n.rowPath, r.rowPath)) return !0;
211
- const o = e[t - 2];
212
- return n.role === "member" && (!o || o.kind !== "layout" || o.role !== "member" || P(o.rowPath) !== P(n.rowPath)) && r.rowPath.length === n.rowPath.length && P(r.rowPath) === P(n.rowPath);
213
- });
214
- }
215
- const ie = "pdf-group-continuation";
216
- function ue(e) {
217
- if (!e.previousRow || e.row.isSubtotal === !0 || e.row.isGrandTotal === !0 || e.previousRow.isSubtotal === !0 || e.previousRow.isGrandTotal === !0)
218
- return !0;
219
- for (let r = 0; r <= e.levelIndex; r++)
220
- if (e.getValue(e.row, r) !== e.getValue(e.previousRow, r))
221
- return !0;
222
- return !1;
223
- }
224
- function ce(e, r, t) {
225
- const n = F(e.descriptors, r.presentation, t), o = e.columns.map((i) => {
226
- var c;
227
- return i.kind === "measure" && ((c = n.measureSemantics.get(i.measureId)) == null ? void 0 : c.isNumeric) === !0;
228
- }), s = (i) => I([i], n.levels), a = (i, c, f) => O(i, c, r.presentation.totals[f], n.levels), l = e.columns.map((i) => {
229
- if (i.kind !== "measure") return i.label;
230
- const c = i.columnPath.map(s);
231
- return i.role !== "member" && c.push(a(i.columnPath, i.role, "columns")), [...c, i.label].join(" / ");
232
- }), m = Math.min(r.spec.columns.length, Math.max(
233
- 0,
234
- ...e.columns.map((i) => i.kind === "measure" ? i.columnPath.length + (i.role !== "member" ? 1 : 0) : 0)
235
- )), u = Array.from({ length: m + 1 }, (i, c) => e.columns.map((f) => c === m ? f.label : f.kind !== "measure" ? "" : c < f.columnPath.length ? s(f.columnPath[c]) : c === f.columnPath.length && f.role !== "member" ? a(f.columnPath, f.role, "columns") : "")), d = (i, c) => K({
236
- path: i.rowPath,
237
- role: i.kind === "layout" ? i.role : "member",
238
- levelCount: Math.max(1, r.spec.rows.length),
239
- repeatLabels: r.presentation.layout.kind !== "tabular" || r.presentation.layout.repeatLabels,
240
- previousPath: c == null ? void 0 : c.rowPath
241
- }), g = (i, c) => {
242
- if (i.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
243
- if (i.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
244
- const f = d(i, c);
245
- return e.columns.map((w, p) => {
246
- if (w.kind === "hierarchy")
247
- return `${" ".repeat(Math.max(0, i.rowPath.length - 1))}${a(i.rowPath, i.role, "rows")}`;
248
- if (w.kind === "level") {
249
- const y = r.spec.rows.findIndex((B) => B.id === w.levelId), v = f[y];
250
- return v != null && v.visible ? v.total ? a(i.rowPath, i.role, "rows") : I(v.path, n.levels) : "";
251
- }
252
- const b = i.values[p], x = n.measures.get(w.measureId);
253
- if (b.kind === "value" && !x)
254
- throw new Error("Matrix value is missing its measure descriptor.");
255
- return z(b, x, r.presentation.absence);
256
- });
257
- }, h = (i, c) => g(i, c).map((f, w) => {
258
- var y;
259
- const p = i.values[w], b = e.columns[w];
260
- return b.kind === "measure" && !((y = n.measureSemantics.get(b.measureId)) != null && y.hasTextAffixes) && p.kind === "value" && (typeof p.value == "number" || k(p.value)) ? f : M(f);
261
- });
262
- return {
263
- headers: l,
264
- headerBands: u,
265
- numericColumns: o,
266
- /** A row's cells; after `previous`, a tabular layout prints each label once. */
267
- row: (i, c) => g(i, c),
268
- /**
269
- * Level columns whose group label the row above shows, so this row
270
- * continues the group (Plan 2, 2d, C8). Only a member row after a member
271
- * row continues one: a total prints as a band, and its rules stay whole
272
- * above and below it.
273
- */
274
- continuedColumns: (i, c) => {
275
- const f = (p) => (p == null ? void 0 : p.kind) === "layout" && p.role === "member";
276
- if (!f(i) || !f(c)) return [];
277
- const w = d(i, c);
278
- return e.columns.flatMap((p, b) => {
279
- var y;
280
- if (p.kind !== "level") return [];
281
- const x = r.spec.rows.findIndex((v) => v.id === p.levelId);
282
- return x < i.rowPath.length && ((y = w[x]) == null ? void 0 : y.visible) === !1 ? [b] : [];
283
- });
284
- },
285
- csvRow: (i) => h(i),
286
- // Each committed batch starts with identifying labels. Retries are pure;
287
- // suppression never relies on mutable formatter state or an earlier worker.
288
- csvRows: (i) => i.map((c, f) => h(c, i[f - 1]))
289
- };
290
- }
291
- function De(e) {
292
- return e.columns.map((r) => M(r.label));
293
- }
294
- function $e(e) {
295
- if (e.kind !== "flat") throw new Error("Raw Matrix CSV requires flat rows.");
296
- return e.values.map((r) => r.kind !== "value" ? null : k(r.value) ? r.value.value : typeof r.value == "string" ? M(r.value) : typeof r.value == "boolean" ? String(r.value) : r.value);
297
- }
298
- function me(e) {
299
- const r = ce(e.layout, e.request, e.report), t = e.layout.columns.map((a, l) => ({
300
- index: l,
301
- columnId: `matrix:${l}`,
302
- label: r.headers[l],
303
- isNumeric: r.numericColumns[l]
304
- })), n = (a, l, m) => ({
305
- text: a,
306
- colspan: 1,
307
- rowspan: 1,
308
- columnId: t[l].columnId,
309
- isHeader: m,
310
- isNumeric: t[l].isNumeric,
311
- className: t[l].isNumeric ? "numeric" : e.layout.columns[l].kind === "hierarchy" ? "matrix-hierarchy" : ""
312
- }), o = [], s = e.layout.columns.findIndex((a) => a.kind === "measure");
313
- e.request.spec.columns.length && s >= 0 && o.push({
314
- repeatHeader: !0,
315
- headerType: "pivot-axis",
316
- headerRowIndex: 0,
317
- cells: [
318
- ...s ? [{ ...n("", 0, !0), colspan: s }] : [],
319
- {
320
- ...n(e.request.spec.columns.map((a) => D(a, e.request.presentation)).join(" / "), s, !0),
321
- colspan: e.layout.columns.length - s,
322
- isNumeric: !1,
323
- className: ""
324
- }
325
- ]
326
- });
327
- for (const [a, l] of r.headerBands.entries())
328
- o.push({
329
- repeatHeader: !0,
330
- headerType: a === r.headerBands.length - 1 ? "metrics" : "pivot-level",
331
- headerRowIndex: o.length,
332
- cells: l.map((m, u) => n(m, u, !0))
333
- });
334
- return {
335
- headers: o,
336
- rows: e.rows.map((a, l) => {
337
- const m = new Set(r.continuedColumns(a, e.rows[l - 1]));
338
- return {
339
- index: l,
340
- type: a.kind === "layout" && a.role !== "member" ? "subtotal" : "data",
341
- subtotalLevel: String(a.rowPath.length),
342
- // A tabular layout prints each label once unless it repeats them; the
343
- // blank cell continues its group, so a grid draws no rule above it.
344
- cells: r.row(a, e.rows[l - 1]).map((u, d) => m.has(d) ? { ...n(u, d, !1), className: ie } : n(u, d, !1))
345
- };
346
- }),
347
- grandTotal: null,
348
- // Totals are already in the ordered body at their authored position.
349
- metadata: {
350
- tableType: "pivot",
351
- totalRows: e.rows.length,
352
- totalColumns: t.length,
353
- rowLevels: e.layout.columns.filter((a) => a.kind !== "measure").length,
354
- pivotLevels: e.request.spec.columns.length,
355
- hasGrandTotal: !1,
356
- columnOrder: t.map((a) => a.columnId),
357
- columns: t
358
- }
359
- };
360
- }
361
- function fe(e, r, t) {
362
- const { levels: n } = F(e.descriptors, r.presentation, t), o = r.spec.columns.length > 0, s = [], a = [], l = e.columns.map((u, d) => {
363
- if (u.kind !== "measure") return null;
364
- const g = o ? `${u.role}:${S(u.columnPath)}` : `measure:${d}`;
365
- let h = s.indexOf(g);
366
- return h < 0 && (h = s.push(g) - 1, a.push(o ? O(u.columnPath, u.role, r.presentation.totals.columns, n) : u.label)), h;
367
- }), m = r.spec.columns[r.spec.columns.length - 1];
368
- return {
369
- columnGroups: l,
370
- groupLabels: a,
371
- /** What bands name their groups by: the innermost column level, or "Measures". */
372
- groupLevelLabel: m ? D(m, r.presentation) : "Measures"
373
- };
374
- }
375
- function Ne(e) {
376
- const { layout: r, rows: t, report: n } = e, o = {
377
- ...e.request,
378
- presentation: ae(r, t, e.request.presentation)
379
- }, s = me({ layout: r, rows: t, request: o, report: n }), a = le(t), l = fe(r, o, n), m = {
380
- ...s,
381
- rows: s.rows.map((u, d) => ({ ...u, keepWithPrevious: a[d] })),
382
- metadata: { ...s.metadata, ...l }
383
- };
384
- return { request: o, table: m, ...l };
385
- }
386
- class ge extends Error {
387
- constructor() {
388
- super(...arguments);
389
- A(this, "code", $);
390
- }
391
- }
392
- function V(e) {
393
- if (!e || typeof e != "object")
394
- return;
395
- const { error: r, message: t, detail: n } = e;
396
- for (const o of [r, t, n])
397
- if (typeof o == "string" && o.trim())
398
- return o.trim();
399
- }
400
- async function de(e) {
401
- const r = `PDF request failed: ${e.status} ${e.statusText}`.trim(), t = e.headers.get("content-type") || "";
402
- try {
403
- if (t.includes("application/json")) {
404
- const o = await e.json(), s = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
405
- return { message: V(o) || r, code: s };
406
- }
407
- const n = await e.text();
408
- if (!n.trim())
409
- return { message: r };
410
- try {
411
- const o = JSON.parse(n), s = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
412
- return {
413
- message: V(o) || n.trim(),
414
- code: s
415
- };
416
- } catch {
417
- return { message: n.trim() };
418
- }
419
- } catch {
420
- return { message: r };
421
- }
422
- }
423
- async function Ge(e) {
424
- if (!e.token) throw new Error("Missing auth token for PDF export");
425
- if (Y(e.serializedPayload) > q.maxRequestBytes)
426
- throw new Error("Fast-path PDF request exceeds the structured body limit");
427
- const r = await (e.fetchImpl ?? fetch)(e.url, {
428
- method: "POST",
429
- headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` },
430
- body: e.serializedPayload,
431
- signal: e.signal
432
- });
433
- if (!r.ok) {
434
- const n = await de(r);
435
- throw n.code === $ ? new ge(n.message) : new Error(n.message);
436
- }
437
- const t = await r.json();
438
- if (t != null && t.error) throw new Error(t.error);
439
- if (typeof (t == null ? void 0 : t.url) != "string" || !t.url.trim())
440
- throw new Error("Fast-path PDF response missing download URL");
441
- return t;
442
- }
443
- const pe = "__TOTAL__";
444
- function T(e) {
445
- return typeof e == "object" && e !== null && !Array.isArray(e);
446
- }
447
- function C(e) {
448
- return e === pe;
449
- }
450
- function Be(e) {
451
- const r = /* @__PURE__ */ new Map(), t = (e.groupByColumns ?? []).map((o, s) => {
452
- var u, d, g;
453
- if (!T(o))
454
- throw new Error(`Aggregate groupByColumns[${s}] is invalid`);
455
- const a = typeof o.id == "string" && o.id.length > 0 ? o.id : void 0, l = a ? (g = (d = (u = e.columnKeyMap) == null ? void 0 : u.byRole) == null ? void 0 : d.groupby) == null ? void 0 : g[a] : void 0, m = (l == null ? void 0 : l.outputKey) || (l == null ? void 0 : l.rawKey) || (typeof o.alias == "string" && o.alias.length > 0 ? o.alias : typeof o.name == "string" && o.name.length > 0 ? o.name : void 0);
456
- if (!m)
457
- throw new Error(`Aggregate groupByColumns[${s}] has no output key`);
458
- return [a, o.alias, o.name, m].forEach((h) => {
459
- typeof h == "string" && h.length > 0 && r.set(h, m);
460
- }), m;
461
- }), n = (e.rowAggregates ?? []).flatMap((o) => !T(o) || typeof o.function != "string" || typeof o.groupLevel != "string" ? [] : [
462
- {
463
- function: o.function,
464
- groupLevel: o.groupLevel === "ALL" ? "ALL" : r.get(o.groupLevel) || o.groupLevel,
465
- ...typeof o.label == "string" ? { label: o.label } : {}
466
- }
467
- ]);
468
- return { groupColumnKeys: t, rowAggregates: n };
469
- }
470
- function N(e) {
471
- return e === "SUM" ? "Total" : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
472
- }
473
- function he(e) {
474
- var t;
475
- if (e.customLabel) return e.customLabel;
476
- const r = N(e.aggregateFunction);
477
- if (e.levelValue !== void 0 && !C(e.levelValue)) {
478
- if (e.levelValue === null) {
479
- const o = (t = e.formatValue) == null ? void 0 : t.call(e, null);
480
- return o ? `Subtotal ${o}` : `Subtotal ${r}`;
481
- }
482
- const n = e.formatValue ? e.formatValue(e.levelValue) : String(e.levelValue);
483
- if (n) return `Subtotal (${n})`;
484
- }
485
- return `Subtotal ${r}`;
486
- }
487
- function we(e, r) {
488
- return r || `Grand ${N(e)}`;
489
- }
490
- function Ue(e) {
491
- const r = e.context.groupColumnKeys.indexOf(e.columnKey);
492
- if (r < 0)
493
- throw new Error(
494
- `Aggregate group column "${e.columnKey}" is unknown`
495
- );
496
- return ue({
497
- row: e.row,
498
- previousRow: e.previousRow,
499
- levelIndex: r,
500
- getValue: (t, n) => t[e.context.groupColumnKeys[n]]
501
- });
502
- }
503
- function G(e) {
504
- var n, o;
505
- const r = e.context.groupColumnKeys, t = typeof e.row.aggregate == "string" ? e.row.aggregate : "SUM";
506
- if (e.row.isGrandTotal === !0) {
507
- const s = (n = e.context.rowAggregates.find(
508
- (a) => a.groupLevel === "ALL"
509
- )) == null ? void 0 : n.label;
510
- return {
511
- kind: "grand-total",
512
- cells: r.map((a, l) => ({
513
- columnKey: a,
514
- text: l === 0 ? we(t, s) : "",
515
- placement: l === 0 ? "label" : "empty",
516
- colSpan: l === 0 ? r.length : 1
517
- }))
518
- };
519
- }
520
- if (e.row.isSubtotal === !0) {
521
- if (typeof e.row.subtotalLevel != "string")
522
- throw new Error("Aggregate subtotal row is missing subtotalLevel");
523
- const s = r.indexOf(e.row.subtotalLevel);
524
- if (s < 0)
525
- throw new Error(
526
- `Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`
527
- );
528
- const a = T(e.row.subtotalContext) ? e.row.subtotalContext : void 0, l = T(a == null ? void 0 : a.groupByValues) ? a.groupByValues : {}, m = (o = e.context.rowAggregates.find(
529
- (u) => u.groupLevel === e.row.subtotalLevel && u.function === t
530
- )) == null ? void 0 : o.label;
531
- return {
532
- kind: "subtotal",
533
- cells: r.map((u, d) => {
534
- if (d > s)
535
- return {
536
- columnKey: u,
537
- text: "",
538
- placement: "empty",
539
- colSpan: 1
540
- };
541
- if (d < s) {
542
- const g = e.row[u];
543
- return {
544
- columnKey: u,
545
- text: g === void 0 || C(g) ? "" : e.formatValue(g, u),
546
- placement: "value",
547
- colSpan: 1
548
- };
549
- }
550
- return {
551
- columnKey: u,
552
- text: he({
553
- aggregateFunction: t,
554
- customLabel: m,
555
- levelValue: l[u],
556
- formatValue: (g) => e.formatLabelValue ? e.formatLabelValue(g, u) : String(e.formatValue(g, u) ?? "")
557
- }),
558
- placement: "label",
559
- colSpan: r.length - s
560
- };
561
- })
562
- };
563
- }
564
- return {
565
- kind: "data",
566
- cells: r.map((s) => {
567
- const a = e.row[s];
568
- return {
569
- columnKey: s,
570
- text: a === void 0 || C(a) ? "" : e.formatValue(a, s),
571
- placement: "value",
572
- colSpan: 1
573
- };
574
- })
575
- };
576
- }
577
- function je(e) {
578
- const r = G(e).cells.find(
579
- (t) => t.columnKey === e.columnKey
580
- );
581
- if (!r)
582
- throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);
583
- return r.text;
584
- }
585
- function Xe(e) {
586
- return G(e).cells.map((r) => r.text);
587
- }
588
- class be extends Error {
589
- constructor(t, n) {
590
- super(`${t}: ${n}`);
591
- A(this, "deliveryBlocking", !0);
592
- this.code = t, this.name = "PivotHeaderPresentationError";
593
- }
594
- }
595
- function He(e) {
596
- var o;
597
- const r = e.mode ?? "formatted", t = e.members.map((s) => {
598
- var l;
599
- if (r === "canonical" || !s.temporalBucket)
600
- return s.value === null ? "" : String(s.value);
601
- const a = (l = e.resolveTemporalFormat) == null ? void 0 : l.call(e, s.fieldId);
602
- if (!a)
603
- throw new be(
604
- "missing_resolved_temporal_format",
605
- `Missing resolved temporal presentation for pivot field "${s.fieldId}"`
606
- );
607
- return J({
608
- value: s.value,
609
- metadata: s.temporalBucket,
610
- format: a
611
- });
612
- }), n = ((o = e.metricLabel) == null ? void 0 : o.trim()) || void 0;
613
- return {
614
- memberLabels: t,
615
- ...n ? { metricLabel: n } : {},
616
- flattenedLabel: [
617
- ...t,
618
- ...n ? [n] : []
619
- ].join(" / ")
620
- };
621
- }
622
- export {
623
- pe as A,
624
- Ue as B,
625
- G as C,
626
- te as D,
627
- je as E,
628
- Me as F,
629
- Xe as G,
630
- be as H,
631
- He as I,
632
- ue as J,
633
- Ie as M,
634
- ie as P,
635
- ee as a,
636
- re as b,
637
- _e as c,
638
- Re as d,
639
- Q as e,
640
- Ce as f,
641
- ce as g,
642
- $e as h,
643
- me as i,
644
- Ne as j,
645
- Fe as k,
646
- Oe as l,
647
- De as m,
648
- oe as n,
649
- ke as o,
650
- M as p,
651
- ae as q,
652
- Ve as r,
653
- le as s,
654
- ge as t,
655
- de as u,
656
- Ge as v,
657
- C as w,
658
- Be as x,
659
- he as y,
660
- we as z
661
- };