react-semaphor 0.1.537 → 0.1.539

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 (174) hide show
  1. package/dist/analytics-protocol/index.js +352 -341
  2. package/dist/assistant-context/index.js +10 -0
  3. package/dist/assistant-protocol/index.js +104 -0
  4. package/dist/brand-studio/index.js +35 -31
  5. package/dist/briefings/index.js +46 -45
  6. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
  7. package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
  8. package/dist/chunks/aggregate-table-row-presentation-BjK9YfMI.js +979 -0
  9. package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
  10. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
  11. package/dist/chunks/assistant-chat-DgiSuFT4.js +8083 -0
  12. package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
  13. package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
  14. package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
  15. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
  16. package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
  17. package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
  18. package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
  19. package/dist/chunks/context-HD9usB1P.js +349 -0
  20. package/dist/chunks/conversation-sQiWYUOb.js +16 -0
  21. package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
  22. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
  23. package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bl3gCeBR.js} +580 -556
  24. package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-0EX0HiJt.js} +683 -686
  25. package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
  26. package/dist/chunks/dashboard-json-6X_2BDiL.js +69 -0
  27. package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-y5BwcvzT.js} +1 -1
  28. package/dist/chunks/document-dashboard-inputs-BrYYlRVo.js +10678 -0
  29. package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
  30. package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-Bzchfgga.js} +4744 -4746
  31. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
  32. package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
  33. package/dist/chunks/index-CqMiAkay.js +3164 -0
  34. package/dist/chunks/index-CuHybtft.js +51 -0
  35. package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
  36. package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
  37. package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
  38. package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
  39. package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-DQ8avoIQ.js} +648 -457
  40. package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
  41. package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
  42. package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
  43. package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
  44. package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
  45. package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
  46. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
  47. package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
  48. package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
  49. package/dist/chunks/report-preferences-dialog-CWhSbc5_.js +1808 -0
  50. package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
  51. package/dist/chunks/save-CfJpQQ68.js +21 -0
  52. package/dist/chunks/saved-dashboard-context-Dqve2jlB.js +566 -0
  53. package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
  54. package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-ldcwmLoY.js} +65803 -62954
  55. package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-BWxunXTq.js} +199 -196
  56. package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
  57. package/dist/chunks/switch-CvItuC1Q.js +8199 -0
  58. package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
  59. package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
  60. package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
  61. package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
  62. package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-RHgzVfcz.js} +331 -339
  63. package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
  64. package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
  65. package/dist/chunks/x-4f5U2XwU.js +100 -0
  66. package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
  67. package/dist/dashboard/index.js +2 -2
  68. package/dist/dashboard-authoring/index.js +823 -661
  69. package/dist/data-app-sdk/index.js +32 -30
  70. package/dist/data-app-sdk-adapters/index.js +23 -22
  71. package/dist/data-app-sdk-validation/index.js +23 -22
  72. package/dist/format-utils/index.js +173 -168
  73. package/dist/index.js +267 -258
  74. package/dist/layouts/index.js +236 -24
  75. package/dist/report-runtime-context/index.js +2 -2
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +2 -2
  78. package/dist/types/assistant-context.d.ts +2 -0
  79. package/dist/types/assistant-protocol.d.ts +2 -0
  80. package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
  81. package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
  82. package/dist/types/components/assistant/assistant-store.d.ts +52 -0
  83. package/dist/types/components/assistant/use-assistant.d.ts +38 -0
  84. package/dist/types/components/index.d.ts +5 -1
  85. package/dist/types/components/surfboard/filter/types.d.ts +5 -2
  86. package/dist/types/index.js +50 -51
  87. package/dist/types/lib/api/invalidate-token.d.ts +7 -0
  88. package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
  89. package/dist/types/lib/charts/types.d.ts +7 -0
  90. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
  91. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
  92. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
  93. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
  94. package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
  95. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
  96. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
  97. package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
  98. package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
  99. package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
  100. package/dist/types/lib/hooks/use-filter-option-browse.d.ts +5 -0
  101. package/dist/types/lib/hooks/use-text-filter.d.ts +9 -0
  102. package/dist/types/lib/print/print-inputs.d.ts +4 -2
  103. package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
  104. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
  105. package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
  106. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  107. package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
  108. package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
  109. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
  110. package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
  111. package/dist/types/lib/stores/editor-store.d.ts +4 -2
  112. package/dist/types/lib/types/token-types.d.ts +11 -0
  113. package/dist/types/lib/utils/card-type-change.d.ts +30 -0
  114. package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
  115. package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
  116. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
  117. package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
  118. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
  119. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  120. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
  121. package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
  122. package/dist/types/shared/assistant-context/index.d.ts +9 -0
  123. package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
  124. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
  125. package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
  126. package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
  127. package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
  128. package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
  129. package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
  130. package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
  131. package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
  132. package/dist/types/shared/assistant-protocol/parts.d.ts +140 -0
  133. package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
  134. package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
  135. package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
  136. package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
  137. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
  138. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
  139. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  140. package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
  141. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
  142. package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
  143. package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
  144. package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
  145. package/dist/types/shared/format-utils/index.d.ts +3 -0
  146. package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
  147. package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
  148. package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
  149. package/dist/types/shared/layouts/index.d.ts +1 -0
  150. package/package.json +12 -2
  151. package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
  152. package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
  153. package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
  154. package/dist/chunks/constants-DNWVy8Y3.js +0 -9
  155. package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
  156. package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
  157. package/dist/chunks/index-DTcTAGGM.js +0 -4101
  158. package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
  159. package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
  160. package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
  161. package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
  162. package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
  163. package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
  164. package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
  165. package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
  166. package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
  167. package/dist/chunks/save-kO6cIaob.js +0 -34
  168. package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
  169. package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
  170. package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
  171. package/dist/chunks/x-CXDkqdur.js +0 -149
  172. package/dist/types/lib/class-utils.d.ts +0 -2
  173. package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
  174. package/dist/types/lib/utils.d.ts +0 -51
@@ -1,537 +0,0 @@
1
- import { K as C, M as O } from "./validators-DMSH81OM.js";
2
- import { canonicalizeSupportedLocale as E, canonicalizeSupportedCurrencyCode as h } from "../value-format-preferences/index.js";
3
- import { d as _ } from "./temporal-bucket-DlFuhCnT.js";
4
- const U = [
5
- "day",
6
- "hour",
7
- "minute",
8
- "second",
9
- "millisecond"
10
- ], D = {
11
- day: 864e5,
12
- hour: 36e5,
13
- minute: 6e4,
14
- second: 1e3,
15
- millisecond: 1
16
- }, T = {
17
- day: "d",
18
- hour: "hr",
19
- minute: "min",
20
- second: "s",
21
- millisecond: "ms"
22
- }, b = {
23
- day: ["day", "days"],
24
- hour: ["hour", "hours"],
25
- minute: ["minute", "minutes"],
26
- second: ["second", "seconds"],
27
- millisecond: ["millisecond", "milliseconds"]
28
- };
29
- function j(i) {
30
- return i === "day" || i === "hour" || i === "minute" || i === "second" || i === "millisecond";
31
- }
32
- function k(i, e) {
33
- return j(i) ? i : e;
34
- }
35
- function M(i, e) {
36
- return U.indexOf(k(i, e));
37
- }
38
- function A(i, e) {
39
- const c = M(i, "day"), r = M(e, "second"), n = Math.min(c, r), t = Math.max(c, r);
40
- return U.slice(n, t + 1);
41
- }
42
- function K(i, e) {
43
- return i * D[k(e, "second")];
44
- }
45
- function W(i, e) {
46
- const c = A(e.largestUnit, e.smallestUnit), r = c[c.length - 1], n = D[r];
47
- let t = Math.round(i / n) * n;
48
- return c.map((a) => {
49
- const u = D[a], s = Math.floor(t / u);
50
- return t -= s * u, { unit: a, value: s };
51
- });
52
- }
53
- function q(i, e) {
54
- const c = i.filter((t) => t.value !== 0), r = c.length > 0 ? c : [i[i.length - 1]], n = typeof e == "number" && Number.isFinite(e) ? Math.max(1, Math.trunc(e)) : r.length;
55
- return r.slice(0, n).map((t) => `${t.value}${T[t.unit]}`).join(" ");
56
- }
57
- function Z(i, e) {
58
- const c = i.filter((t) => t.value !== 0), r = c.length > 0 ? c : [i[i.length - 1]], n = typeof e == "number" && Number.isFinite(e) ? Math.max(1, Math.trunc(e)) : r.length;
59
- return r.slice(0, n).map((t) => {
60
- const [a, u] = b[t.unit];
61
- return `${t.value} ${t.value === 1 ? a : u}`;
62
- }).join(" ");
63
- }
64
- function z(i) {
65
- const e = i.some(
66
- (s) => s.unit === "day" && s.value !== 0
67
- ), c = i.some((s) => s.unit === "millisecond"), r = i.findIndex((s) => s.value !== 0), n = Math.max(0, i.length - 2), t = e ? 0 : r === -1 ? n : Math.min(r, n), a = r === -1 ? i.slice(n) : i.slice(t);
68
- if (a.length === 0)
69
- return "0";
70
- const u = a.map((s, l) => s.unit === "millisecond" ? String(s.value).padStart(3, "0") : l === 0 ? String(s.value) : String(s.value).padStart(2, "0")).join(":");
71
- return c ? u.replace(/:(\d{3})$/, ".$1") : u;
72
- }
73
- function J(i, e, c) {
74
- const r = `${c.prefix || ""}${i}${c.suffix || ""}`;
75
- return e ? c.negativeInParentheses ? `(${r})` : `-${r}` : r;
76
- }
77
- function Y(i, e = {}) {
78
- if (i == null)
79
- return "";
80
- const c = typeof i == "number" ? i : typeof i == "string" && i.trim() ? Number(i) : NaN;
81
- if (!Number.isFinite(c))
82
- return "";
83
- const r = e.inputUnit || "second", n = e.outputStyle === "digital" || e.outputStyle === "long" ? e.outputStyle : "compact", t = c < 0, a = Math.abs(K(c, r)), u = W(a, e), s = n === "digital" ? z(u) : n === "long" ? Z(u, e.maxUnits) : q(u, e.maxUnits);
84
- return J(s, t, e);
85
- }
86
- function G(i, e) {
87
- return Y(
88
- i !== null && typeof i == "object" ? i.value : i,
89
- {
90
- inputUnit: e.inputUnit,
91
- outputStyle: e.outputStyle,
92
- largestUnit: e.largestUnit,
93
- smallestUnit: e.smallestUnit,
94
- maxUnits: e.maxUnits,
95
- prefix: e.prefix,
96
- suffix: e.suffix,
97
- negativeInParentheses: e.negativeStyle === "parentheses"
98
- }
99
- );
100
- }
101
- let $;
102
- function F(i, e) {
103
- const c = i.format;
104
- return c(e);
105
- }
106
- function H(i, e) {
107
- if ($ ?? ($ = F(
108
- new Intl.NumberFormat("en-US", { useGrouping: !1, maximumFractionDigits: 6 }),
109
- "9007199254740993.000009"
110
- ) === "9007199254740993.000009"), !$)
111
- throw new RangeError("This runtime cannot format exact decimal strings.");
112
- const c = Number(i);
113
- if (!Number.isFinite(c) || c === 0 && i !== "0")
114
- throw new RangeError("Exact value is outside the Intl formatting range; use raw text.");
115
- return F(e, i);
116
- }
117
- function x(i) {
118
- return typeof i == "number" ? i < 0 : i.value.startsWith("-");
119
- }
120
- function d(i) {
121
- return typeof i == "number" ? Math.abs(i) : x(i) ? { ...i, value: i.value.slice(1) } : i;
122
- }
123
- function V(i, e) {
124
- return typeof i == "number" ? i * e : {
125
- kind: "exact_number",
126
- type: "decimal",
127
- value: C(i.value, e)
128
- };
129
- }
130
- function y(i, e) {
131
- return e === 0 ? i : typeof i == "number" ? i / 10 ** e : {
132
- kind: "exact_number",
133
- type: "decimal",
134
- value: C(i.value, `1e-${e}`)
135
- };
136
- }
137
- function f(i, e) {
138
- return typeof i == "number" ? e.format(i) : H(i.value, e);
139
- }
140
- function I(i) {
141
- if (!i) return !1;
142
- const e = i.toLowerCase().replace("_", "-");
143
- return e === "en-in" || e.startsWith("en-in-");
144
- }
145
- function P(i, e) {
146
- const c = d(i), r = (n) => typeof c == "number" ? c >= n : O(c.value, String(n)) >= 0;
147
- return r(1e12) ? { power: 12, suffix: "T" } : r(1e9) ? { power: 9, suffix: "B" } : I(e) && r(1e7) ? { power: 7, suffix: "Cr" } : r(1e6) ? { power: 6, suffix: "M" } : I(e) && r(1e5) ? { power: 5, suffix: "L" } : r(1e3) ? { power: 3, suffix: "K" } : { power: 0, suffix: "" };
148
- }
149
- function S(i, e) {
150
- try {
151
- const c = g(e);
152
- return P(i, c);
153
- } catch {
154
- return P(i, "en-US");
155
- }
156
- }
157
- function Q(i) {
158
- try {
159
- return new Intl.NumberFormat(i), !0;
160
- } catch {
161
- return !1;
162
- }
163
- }
164
- function g(i) {
165
- return i && Q(i) ? i : "en-US";
166
- }
167
- function v(i, e) {
168
- if (i == null || Number.isNaN(i))
169
- return "";
170
- const c = g(e == null ? void 0 : e.locale);
171
- let r = i;
172
- if (e != null && e.multiplyBy && (r = V(r, e.multiplyBy)), e != null && e.useSuffix) {
173
- const { power: t, suffix: a } = S(r, c);
174
- r = y(r, t);
175
- const u = f(r, new Intl.NumberFormat(c, {
176
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
177
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
178
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
179
- }));
180
- return `${(e == null ? void 0 : e.prefix) ?? ""}${u}${a}${(e == null ? void 0 : e.suffix) ?? ""}`;
181
- }
182
- const n = f(r, new Intl.NumberFormat(c, {
183
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
184
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
185
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
186
- }));
187
- if (e != null && e.negativeInParentheses && x(r)) {
188
- const t = n.replace("-", "");
189
- return `(${(e == null ? void 0 : e.prefix) ?? ""}${t}${(e == null ? void 0 : e.suffix) ?? ""})`;
190
- }
191
- return `${(e == null ? void 0 : e.prefix) ?? ""}${n}${(e == null ? void 0 : e.suffix) ?? ""}`;
192
- }
193
- function o(i, e) {
194
- if (i == null || Number.isNaN(i))
195
- return "";
196
- const c = g(e == null ? void 0 : e.locale), r = (e == null ? void 0 : e.currency) || "USD", n = x(i), t = !!(e != null && e.negativeInParentheses && n), a = t ? d(i) : i;
197
- try {
198
- if (e != null && e.useSuffix) {
199
- const { power: s, suffix: l } = S(a, c), m = y(a, s), w = `${f(m, new Intl.NumberFormat(c, {
200
- style: "currency",
201
- currency: r,
202
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
203
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
204
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
205
- }))}${l}`;
206
- return t ? `(${w})` : w;
207
- }
208
- const u = f(a, new Intl.NumberFormat(c, {
209
- style: "currency",
210
- currency: r,
211
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
212
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
213
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
214
- }));
215
- return t ? `(${u})` : u;
216
- } catch {
217
- const u = d(i), s = e != null && e.useSuffix ? S(u, c) : { power: 0, suffix: "" }, l = v(
218
- y(u, s.power),
219
- {
220
- locale: c,
221
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
222
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
223
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
224
- }
225
- ), m = `${r} ${l}${s.suffix}`;
226
- return n ? e != null && e.negativeInParentheses ? `(${m})` : `-${m}` : m;
227
- }
228
- }
229
- function L(i, e) {
230
- if (i == null || Number.isNaN(i))
231
- return "";
232
- const c = g(e == null ? void 0 : e.locale), n = (e == null ? void 0 : e.alreadyPercent) ?? (e == null ? void 0 : e.percentValueMode) === "whole" ? y(i, 2) : i;
233
- return f(n, new Intl.NumberFormat(c, {
234
- style: "percent",
235
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
236
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
237
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
238
- }));
239
- }
240
- function R(i, e) {
241
- if (i == null || Number.isNaN(i))
242
- return "";
243
- const c = g(e == null ? void 0 : e.locale);
244
- return f(i, new Intl.NumberFormat(c, {
245
- notation: "scientific",
246
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
247
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
248
- }));
249
- }
250
- function B(i, e) {
251
- if (i == null || Number.isNaN(i))
252
- return "";
253
- const c = e.scale === void 0 ? i : V(i, e.scale), r = e.negativeStyle === "parentheses" && x(c), n = r ? d(c) : c, t = {
254
- style: e.type === "number" ? "decimal" : e.type,
255
- locale: e.locale,
256
- currency: e.currency,
257
- minimumFractionDigits: e.minimumFractionDigits,
258
- maximumFractionDigits: e.maximumFractionDigits,
259
- useGrouping: e.useGrouping,
260
- percentValueMode: e.percentValueMode,
261
- useSuffix: e.compact
262
- };
263
- let a;
264
- switch (e.type) {
265
- case "currency":
266
- a = o(n, t);
267
- break;
268
- case "percent":
269
- a = L(n, t);
270
- break;
271
- case "scientific":
272
- a = R(n, t);
273
- break;
274
- default:
275
- a = v(n, t);
276
- break;
277
- }
278
- const u = `${e.prefix ?? ""}${a}${e.suffix ?? ""}`;
279
- return r ? `(${u})` : u;
280
- }
281
- function ne(i, e) {
282
- return e.type === "duration" ? i == null ? "" : G(i, e) : B(i, e);
283
- }
284
- function ae(i, e, c = "en-US") {
285
- if (i == null || typeof i == "number" && isNaN(i))
286
- return "";
287
- if ((e == null ? void 0 : e.style) === "duration")
288
- return G(i, {
289
- ...e.duration,
290
- prefix: e.prefix,
291
- suffix: e.suffix,
292
- negativeStyle: e.negativeStyle
293
- });
294
- const r = g((e == null ? void 0 : e.locale) || c), n = (e == null ? void 0 : e.style) || "decimal", t = n === "decimal" ? "number" : n;
295
- return t === "currency" && new Intl.NumberFormat(r, {
296
- style: "currency",
297
- currency: (e == null ? void 0 : e.currency) || "USD"
298
- }), B(i, {
299
- type: t,
300
- locale: r,
301
- currency: t === "currency" ? (e == null ? void 0 : e.currency) || "USD" : void 0,
302
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
303
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
304
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0,
305
- percentValueMode: t === "percent" ? (e == null ? void 0 : e.percentValueMode) ?? "whole" : void 0,
306
- scale: e == null ? void 0 : e.scale,
307
- compact: e == null ? void 0 : e.compact,
308
- negativeStyle: e == null ? void 0 : e.negativeStyle,
309
- prefix: e == null ? void 0 : e.prefix,
310
- suffix: e == null ? void 0 : e.suffix
311
- });
312
- }
313
- function ue(i, e, c) {
314
- const r = {
315
- style: e === "currency" ? "currency" : e === "percent" ? "percent" : "decimal",
316
- locale: c == null ? void 0 : c.locale,
317
- currency: c == null ? void 0 : c.currency,
318
- minimumFractionDigits: c == null ? void 0 : c.decimalPlaces,
319
- maximumFractionDigits: c == null ? void 0 : c.decimalPlaces,
320
- useSuffix: c == null ? void 0 : c.useSuffix,
321
- prefix: c == null ? void 0 : c.prefix,
322
- suffix: c == null ? void 0 : c.suffix,
323
- negativeInParentheses: c == null ? void 0 : c.negativeInParentheses,
324
- multiplyBy: c == null ? void 0 : c.multiplyBy
325
- };
326
- switch (e) {
327
- case "currency":
328
- return o(i, r);
329
- case "percent":
330
- return L(i, r);
331
- case "scientific":
332
- return R(i, r);
333
- default:
334
- return v(i, r);
335
- }
336
- }
337
- const X = [
338
- "type",
339
- "locale",
340
- "minimumFractionDigits",
341
- "maximumFractionDigits",
342
- "useGrouping",
343
- "prefix",
344
- "suffix",
345
- "negativeStyle",
346
- "compact",
347
- "scale",
348
- "currency",
349
- "percentValueMode"
350
- ];
351
- function p(i) {
352
- if (!_(i))
353
- return {
354
- ok: !1,
355
- issues: [{ path: "$", message: "Numeric format must be an object." }]
356
- };
357
- const e = [], c = new Set(X);
358
- Object.keys(i).filter((t) => !c.has(t)).forEach(
359
- (t) => e.push({ path: t, message: `Unknown property "${t}".` })
360
- ), i.type !== "number" && i.type !== "currency" && i.type !== "percent" && i.type !== "scientific" && e.push({
361
- path: "type",
362
- message: "Expected number, currency, percent, or scientific."
363
- });
364
- const r = i.locale === void 0 ? void 0 : E(i.locale);
365
- i.locale !== void 0 && !r && e.push({ path: "locale", message: "Expected a supported BCP 47 locale." });
366
- const n = i.currency === void 0 ? void 0 : h(i.currency);
367
- i.currency !== void 0 && !n && e.push({
368
- path: "currency",
369
- message: "Expected a supported ISO 4217 currency code."
370
- });
371
- for (const t of ["minimumFractionDigits", "maximumFractionDigits"]) {
372
- const a = i[t];
373
- a !== void 0 && (!Number.isInteger(a) || typeof a != "number" || a < 0 || a > 20) && e.push({
374
- path: t,
375
- message: "Expected an integer from 0 to 20."
376
- });
377
- }
378
- typeof i.minimumFractionDigits == "number" && typeof i.maximumFractionDigits == "number" && i.minimumFractionDigits > i.maximumFractionDigits && e.push({
379
- path: "maximumFractionDigits",
380
- message: "Must be greater than or equal to minimumFractionDigits."
381
- });
382
- for (const t of ["useGrouping", "compact"])
383
- i[t] !== void 0 && typeof i[t] != "boolean" && e.push({ path: t, message: "Expected a boolean." });
384
- for (const t of ["prefix", "suffix"])
385
- i[t] !== void 0 && typeof i[t] != "string" && e.push({ path: t, message: "Expected a string." });
386
- return i.negativeStyle !== void 0 && i.negativeStyle !== "minus" && i.negativeStyle !== "parentheses" && e.push({
387
- path: "negativeStyle",
388
- message: "Expected minus or parentheses."
389
- }), i.percentValueMode !== void 0 && i.percentValueMode !== "fraction" && i.percentValueMode !== "whole" && e.push({
390
- path: "percentValueMode",
391
- message: "Expected fraction or whole."
392
- }), i.scale !== void 0 && (typeof i.scale != "number" || !Number.isFinite(i.scale)) && e.push({ path: "scale", message: "Expected a finite number." }), e.length > 0 ? { ok: !1, issues: e } : {
393
- ok: !0,
394
- value: {
395
- type: i.type,
396
- ...r ? { locale: r } : {},
397
- ...i.minimumFractionDigits !== void 0 ? { minimumFractionDigits: i.minimumFractionDigits } : {},
398
- ...i.maximumFractionDigits !== void 0 ? { maximumFractionDigits: i.maximumFractionDigits } : {},
399
- ...i.useGrouping !== void 0 ? { useGrouping: i.useGrouping } : {},
400
- ...i.prefix !== void 0 ? { prefix: i.prefix } : {},
401
- ...i.suffix !== void 0 ? { suffix: i.suffix } : {},
402
- ...i.negativeStyle !== void 0 ? {
403
- negativeStyle: i.negativeStyle
404
- } : {},
405
- ...i.compact !== void 0 ? { compact: i.compact } : {},
406
- ...i.scale !== void 0 ? { scale: i.scale } : {},
407
- ...n ? { currency: n } : {},
408
- ...i.percentValueMode !== void 0 ? {
409
- percentValueMode: i.percentValueMode
410
- } : {}
411
- }
412
- };
413
- }
414
- function se(i) {
415
- const e = p(i);
416
- if (!e.ok)
417
- return e;
418
- const c = [];
419
- return e.value.locale || c.push({
420
- path: "locale",
421
- message: "Resolved numeric formats require an explicit locale."
422
- }), e.value.minimumFractionDigits === void 0 && c.push({
423
- path: "minimumFractionDigits",
424
- message: "Resolved numeric formats require minimumFractionDigits."
425
- }), e.value.maximumFractionDigits === void 0 && c.push({
426
- path: "maximumFractionDigits",
427
- message: "Resolved numeric formats require maximumFractionDigits."
428
- }), e.value.type === "currency" && !e.value.currency && c.push({
429
- path: "currency",
430
- message: "Resolved currency formats require an explicit currency."
431
- }), c.length > 0 ? { ok: !1, issues: c } : e;
432
- }
433
- function me(i) {
434
- var r;
435
- const e = /* @__PURE__ */ new Set();
436
- if (i.snapshot.resolvedFormats.forEach((n, t) => {
437
- if (n.format.type !== "temporal_bucket") {
438
- if (n.scope.attachmentIndex !== void 0)
439
- throw new Error(
440
- `resolvedFormats.${t}.scope.attachmentIndex is not valid for a card export`
441
- );
442
- if (n.scope.dashboardId !== i.expectedScope.dashboardId || n.scope.cardId !== i.expectedScope.cardId)
443
- throw new Error(
444
- `resolvedFormats.${t}.scope must match the executing dashboard/card`
445
- );
446
- if (n.target.kind !== "column")
447
- throw new Error(
448
- `resolvedFormats.${t}.target must identify an export column`
449
- );
450
- if (e.has(n.target.columnKey))
451
- throw new Error(
452
- `resolvedFormats.${t} duplicates export column "${n.target.columnKey}"`
453
- );
454
- e.add(n.target.columnKey);
455
- }
456
- }), !i.useFormattedValues)
457
- return;
458
- if (!((r = i.visibleColumns) != null && r.length))
459
- throw new Error(
460
- "visibleColumns must identify every formatted export column"
461
- );
462
- const c = i.visibleColumns.find(
463
- (n) => !e.has(n)
464
- );
465
- if (c)
466
- throw new Error(
467
- `resolvedFormats is missing visible export column "${c}"`
468
- );
469
- }
470
- function ee(i, e) {
471
- const c = new Intl.NumberFormat(i, {
472
- style: "currency",
473
- currency: e
474
- }).resolvedOptions();
475
- return {
476
- minimumFractionDigits: c.minimumFractionDigits,
477
- maximumFractionDigits: c.maximumFractionDigits
478
- };
479
- }
480
- function ie(i) {
481
- if (i.minimumFractionDigits !== void 0 || i.maximumFractionDigits !== void 0) {
482
- const c = i.minimumFractionDigits ?? 0;
483
- return {
484
- minimumFractionDigits: c,
485
- maximumFractionDigits: i.maximumFractionDigits ?? Math.max(c, 2)
486
- };
487
- }
488
- const e = i.type === "percent" ? 1 : i.type === "scientific" ? 2 : 0;
489
- return {
490
- minimumFractionDigits: e,
491
- maximumFractionDigits: e
492
- };
493
- }
494
- function le(i, e, c) {
495
- const r = E(i.locale) ?? e.locale, n = i.type === "number" || i.type === "currency" ? h(c) : void 0;
496
- if (!(i.type === "currency" || n !== void 0))
497
- return {
498
- ...i,
499
- locale: r,
500
- ...ie(i)
501
- };
502
- const a = n ?? h(i.currency) ?? e.defaultCurrency, u = ee(
503
- r,
504
- a
505
- ), s = u.minimumFractionDigits ?? 0, l = u.maximumFractionDigits ?? s, m = i.minimumFractionDigits ?? Math.min(
506
- s,
507
- i.maximumFractionDigits ?? s
508
- ), N = i.maximumFractionDigits ?? Math.max(
509
- m,
510
- l
511
- );
512
- return {
513
- ...i,
514
- type: "currency",
515
- locale: r,
516
- currency: a,
517
- minimumFractionDigits: m,
518
- maximumFractionDigits: N
519
- };
520
- }
521
- export {
522
- v as a,
523
- o as b,
524
- L as c,
525
- R as d,
526
- B as e,
527
- ne as f,
528
- ae as g,
529
- ue as h,
530
- Y as i,
531
- G as j,
532
- se as k,
533
- le as l,
534
- p,
535
- ee as r,
536
- me as v
537
- };