react-semaphor 0.1.559 → 0.1.561

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 (168) hide show
  1. package/dist/analytics-protocol/index.js +389 -378
  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 +9 -9
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/analytics-base-schemas-CB3oFAXk.js +658 -0
  7. package/dist/chunks/{assistant-chat-B_4bVE6I.js → assistant-chat-DiVHY3Hw.js} +209 -211
  8. package/dist/chunks/bookmark-impact-CR09dpkn.js +75 -0
  9. package/dist/chunks/bookmark-state-BusLpkb7.js +743 -0
  10. package/dist/chunks/{braces-Rdxa3H-s.js → braces-u8VorWJc.js} +1 -1
  11. package/dist/chunks/{comparison-window-caption-CKzQ5LcF.js → comparison-window-caption-DDsIWJYT.js} +201 -201
  12. package/dist/chunks/{context-DVy4HOU0.js → context-TUjw9eqr.js} +1 -1
  13. package/dist/chunks/{custom-visual-inputs-zVa9wX_o.js → custom-visual-inputs-DfolidZ9.js} +1 -1
  14. package/dist/chunks/{dashboard-BziwOVpZ.js → dashboard-BRdZBPqr.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CbeNR-YI.js → dashboard-briefing-launcher-CgvTLndW.js} +1163 -1178
  16. package/dist/chunks/{dashboard-controls-RD6UJs1r.js → dashboard-controls-B4vfSzTF.js} +877 -941
  17. package/dist/chunks/{dashboard-json-DGpv17vL.js → dashboard-json-Y3MF59g7.js} +5 -5
  18. package/dist/chunks/document-dashboard-inputs-CvBbFTUA.js +1718 -0
  19. package/dist/chunks/{edit-dashboard-visual-AQ2pQkFp.js → edit-dashboard-visual-DwjZcxj-.js} +9080 -9354
  20. package/dist/chunks/filter-reach-copy-bijwf_-b.js +3596 -0
  21. package/dist/chunks/{filter-value-text-B4l-xqJT.js → filter-value-text-DFnhwuEW.js} +3 -3
  22. package/dist/chunks/global-date-filter-utils-BXgCpvQM.js +15142 -0
  23. package/dist/chunks/{index-B1Xr7W24.js → index-ClwbY3BL.js} +648 -674
  24. package/dist/chunks/{layout-grid-Bbz3zKif.js → layout-grid-CtvCBfOm.js} +1 -1
  25. package/dist/chunks/{list-filter-3sbH0Uy1.js → list-filter-BklYgciR.js} +1 -1
  26. package/dist/chunks/{matrix-analytical-definition-CEe3PGEo.js → matrix-analytical-definition-pU51-JmY.js} +4 -4
  27. package/dist/chunks/{matrix-card-BRNGb1C4.js → matrix-card-CUorIB7Q.js} +3 -3
  28. package/dist/chunks/{matrix-member-presentation-CEegvTqg.js → matrix-member-presentation-Df5UgCGN.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-COxrfQTS.js → matrix-operation-contract-BSiGEXVC.js} +221 -214
  30. package/dist/chunks/{metric-comparison-DQx-uX__.js → metric-comparison-95aC0uEO.js} +6 -6
  31. package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-B5wQhg5G.js} +1 -1
  32. package/dist/chunks/{palette-DMJtp3Vn.js → palette-DTnMhipt.js} +1 -1
  33. package/dist/chunks/pivot-result-contract-expectations-Bo-86vwS.js +56 -0
  34. package/dist/chunks/{pivot-result-identity-CAj8SiRL.js → pivot-result-identity-olvXJoB9.js} +1 -1
  35. package/dist/chunks/{report-preferences-dialog-0sc8B1lh.js → report-preferences-dialog-C2YUIwKG.js} +55 -55
  36. package/dist/chunks/{report-runtime-context-bYoExeWr.js → report-runtime-context-DoIUr3MP.js} +2 -2
  37. package/dist/chunks/resolve-dashboard-input-context-q_iiNXE1.js +6503 -0
  38. package/dist/chunks/{save-DSb1jTtG.js → save-DH4RyrnG.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-BQWM3ldX.js → saved-dashboard-context-8jqfI7hI.js} +59 -59
  40. package/dist/chunks/{selection-reducer-DSzMWb4x.js → selection-reducer-CV7K4FI6.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-Bz14Oma5.js → semaphor-ready-indicator-E2XWyibu.js} +40105 -41658
  42. package/dist/chunks/{shelf-drop-preview-context-DBHAkgch.js → shelf-drop-preview-context-C29EUzDp.js} +570 -570
  43. package/dist/chunks/{source-entity-resolution-BOrmNCEM.js → source-entity-resolution-BXI3nQ5Z.js} +1 -1
  44. package/dist/chunks/{switch-Dq8XPFpT.js → switch-balDSHc7.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-C_RvEUyO.js → table-export-sheet-CK8tvh4d.js} +1 -1
  46. package/dist/chunks/temporal-input-presentation-B77JsAzU.js +5002 -0
  47. package/dist/chunks/{token-types-LCYMJ3pa.js → token-types-DhYH5YKb.js} +1 -1
  48. package/dist/chunks/{upload-Dr_WAxHQ.js → upload-Ufj8vjyn.js} +1 -1
  49. package/dist/chunks/{use-create-flow-overlay-state-BK3YFkfc.js → use-create-flow-overlay-state-9WsnzEO5.js} +6 -6
  50. package/dist/chunks/{validators-C87JPd-_.js → validators-BtaCFIEB.js} +1206 -1579
  51. package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-CGLVI40Q.js} +1 -1
  52. package/dist/dashboard/index.js +2 -2
  53. package/dist/dashboard-authoring/index.js +2713 -1459
  54. package/dist/data-app-sdk/index.js +20 -20
  55. package/dist/data-app-sdk-adapters/index.js +3 -3
  56. package/dist/data-app-sdk-validation/index.js +10 -10
  57. package/dist/format-utils/index.js +262 -256
  58. package/dist/index.js +214 -215
  59. package/dist/report-runtime-context/index.js +2 -2
  60. package/dist/style.css +1 -1
  61. package/dist/surfboard/index.js +2 -2
  62. package/dist/types/components/dashboard/summary-number-formatter.d.ts +6 -0
  63. package/dist/types/components/editor/editor-aside/utils.d.ts +1 -1
  64. package/dist/types/components/visual/data-table/types/data-table.d.ts +5 -20
  65. package/dist/types/index.js +50 -51
  66. package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
  67. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
  68. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
  69. package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
  70. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
  71. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  72. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
  73. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  74. package/dist/types/lib/stores/editor-store.d.ts +48 -10
  75. package/dist/types/lib/stores/table-actions.d.ts +9 -5
  76. package/dist/types/lib/table-formatting/index.d.ts +0 -2
  77. package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
  78. package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
  79. package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
  80. package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
  81. package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
  82. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
  83. package/dist/types/lib/types/common-types.d.ts +40 -47
  84. package/dist/types/lib/types/explorer-types.d.ts +11 -43
  85. package/dist/types/lib/utils/card-config-utils.d.ts +8 -0
  86. package/dist/types/lib/utils/card-definition.d.ts +9 -187
  87. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +169 -513
  88. package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
  89. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
  90. package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
  91. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
  92. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
  93. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
  94. package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
  95. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
  96. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
  97. package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
  98. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
  99. package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
  100. package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
  101. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
  102. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
  103. package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
  104. package/dist/types/shared/dashboard-authoring/card-settings/apply-card-settings.d.ts +11 -0
  105. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +52 -0
  106. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
  107. package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
  108. package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
  109. package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
  110. package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
  111. package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
  112. package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
  113. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +15 -0
  114. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +102 -0
  115. package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
  117. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
  118. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +40 -0
  119. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +28 -0
  120. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  121. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
  122. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +555 -38
  123. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +27 -8
  124. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +25 -1
  125. package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
  126. package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
  127. package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
  128. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +7 -0
  129. package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
  130. package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
  131. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
  132. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
  133. package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
  134. package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
  135. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
  136. package/dist/types/shared/dashboard-authoring/index.d.ts +8 -0
  137. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
  138. package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
  139. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
  140. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +21 -1
  141. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +10 -4
  142. package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
  143. package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
  144. package/dist/types/shared/dashboard-viewer/bookmark-impact.d.ts +33 -0
  145. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +13 -2
  146. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
  147. package/dist/types/shared/format-utils/index.d.ts +2 -0
  148. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
  149. package/dist/types/shared/format-utils/raw-temporal.d.ts +31 -1
  150. package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
  151. package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
  152. package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
  153. package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
  154. package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
  155. package/package.json +2 -2
  156. package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
  157. package/dist/chunks/bookmark-state-ssqrs5oP.js +0 -111
  158. package/dist/chunks/document-dashboard-inputs-ChVkcBuu.js +0 -3010
  159. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
  160. package/dist/chunks/filter-reach-copy-B5Y7FHzg.js +0 -3411
  161. package/dist/chunks/global-date-filter-utils-DBzEOX9M.js +0 -12222
  162. package/dist/chunks/pivot-result-contract-expectations-DOYhqeZb.js +0 -1926
  163. package/dist/chunks/raw-temporal-presentation-BmT7z6NH.js +0 -584
  164. package/dist/chunks/resolve-dashboard-input-context-B_C_VAJH.js +0 -5520
  165. package/dist/chunks/table-settings-DXj_zXwS.js +0 -637
  166. package/dist/chunks/temporal-input-presentation-AhLSkGPf.js +0 -2939
  167. package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
  168. package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
@@ -1,1926 +0,0 @@
1
- var we = Object.defineProperty;
2
- var be = (e, t, n) => t in e ? we(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var U = (e, t, n) => be(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { aW as Me, t as B, aj as pe, _ as xe } from "./validators-C87JPd-_.js";
5
- import "./matrix-operation-contract-COxrfQTS.js";
6
- import { j as De } from "./analytics-base-schemas-BUFUoO6G.js";
7
- import "zod";
8
- import { ao as Oe, ap as oe, ak as $, al as C, aq as ue, ar as ce, as as Te, l as ve, i as q, a1 as Pe, a3 as le, p as Se, r as ke, H as We, k as Ce, n as Fe } from "./temporal-input-presentation-AhLSkGPf.js";
9
- import { r as Ne } from "./metric-comparison-DQx-uX__.js";
10
- function m(e) {
11
- const t = Object.prototype.toString.call(e);
12
- return e instanceof Date || typeof e == "object" && t === "[object Date]" ? new e.constructor(+e) : typeof e == "number" || t === "[object Number]" || typeof e == "string" || t === "[object String]" ? new Date(e) : /* @__PURE__ */ new Date(NaN);
13
- }
14
- function p(e, t) {
15
- return e instanceof Date ? new e.constructor(t) : new Date(t);
16
- }
17
- let Ye = {};
18
- function P() {
19
- return Ye;
20
- }
21
- function W(e, t) {
22
- var o, l, f, u;
23
- const n = P(), r = (t == null ? void 0 : t.weekStartsOn) ?? ((l = (o = t == null ? void 0 : t.locale) == null ? void 0 : o.options) == null ? void 0 : l.weekStartsOn) ?? n.weekStartsOn ?? ((u = (f = n.locale) == null ? void 0 : f.options) == null ? void 0 : u.weekStartsOn) ?? 0, a = m(e), i = a.getDay(), s = (i < r ? 7 : 0) + i - r;
24
- return a.setDate(a.getDate() - s), a.setHours(0, 0, 0, 0), a;
25
- }
26
- function Y(e) {
27
- return W(e, { weekStartsOn: 1 });
28
- }
29
- function fe(e) {
30
- const t = m(e), n = t.getFullYear(), r = p(e, 0);
31
- r.setFullYear(n + 1, 0, 4), r.setHours(0, 0, 0, 0);
32
- const a = Y(r), i = p(e, 0);
33
- i.setFullYear(n, 0, 4), i.setHours(0, 0, 0, 0);
34
- const s = Y(i);
35
- return t.getTime() >= a.getTime() ? n + 1 : t.getTime() >= s.getTime() ? n : n - 1;
36
- }
37
- function V(e) {
38
- const t = m(e);
39
- return t.setHours(0, 0, 0, 0), t;
40
- }
41
- function E(e) {
42
- const t = m(e), n = new Date(
43
- Date.UTC(
44
- t.getFullYear(),
45
- t.getMonth(),
46
- t.getDate(),
47
- t.getHours(),
48
- t.getMinutes(),
49
- t.getSeconds(),
50
- t.getMilliseconds()
51
- )
52
- );
53
- return n.setUTCFullYear(t.getFullYear()), +e - +n;
54
- }
55
- function Ee(e, t) {
56
- const n = V(e), r = V(t), a = +n - E(n), i = +r - E(r);
57
- return Math.round((a - i) / Oe);
58
- }
59
- function Le(e) {
60
- const t = fe(e), n = p(e, 0);
61
- return n.setFullYear(t, 0, 4), n.setHours(0, 0, 0, 0), Y(n);
62
- }
63
- function F(e, t) {
64
- const n = m(e), r = m(t), a = n.getTime() - r.getTime();
65
- return a < 0 ? -1 : a > 0 ? 1 : a;
66
- }
67
- function _e(e) {
68
- return p(e, Date.now());
69
- }
70
- function ze(e) {
71
- return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
72
- }
73
- function Xe(e) {
74
- if (!ze(e) && typeof e != "number")
75
- return !1;
76
- const t = m(e);
77
- return !isNaN(Number(t));
78
- }
79
- function Ie(e, t) {
80
- const n = m(e), r = m(t), a = n.getFullYear() - r.getFullYear(), i = n.getMonth() - r.getMonth();
81
- return a * 12 + i;
82
- }
83
- function qe(e) {
84
- return (t) => {
85
- const r = (e ? Math[e] : Math.trunc)(t);
86
- return r === 0 ? 0 : r;
87
- };
88
- }
89
- function He(e, t) {
90
- return +m(e) - +m(t);
91
- }
92
- function Re(e) {
93
- const t = m(e);
94
- return t.setHours(23, 59, 59, 999), t;
95
- }
96
- function Ae(e) {
97
- const t = m(e), n = t.getMonth();
98
- return t.setFullYear(t.getFullYear(), n + 1, 0), t.setHours(23, 59, 59, 999), t;
99
- }
100
- function je(e) {
101
- const t = m(e);
102
- return +Re(t) == +Ae(t);
103
- }
104
- function Ue(e, t) {
105
- const n = m(e), r = m(t), a = F(n, r), i = Math.abs(
106
- Ie(n, r)
107
- );
108
- let s;
109
- if (i < 1)
110
- s = 0;
111
- else {
112
- n.getMonth() === 1 && n.getDate() > 27 && n.setDate(30), n.setMonth(n.getMonth() - a * i);
113
- let o = F(n, r) === -a;
114
- je(m(e)) && i === 1 && F(e, r) === 1 && (o = !1), s = a * (i - Number(o));
115
- }
116
- return s === 0 ? 0 : s;
117
- }
118
- function Be(e, t, n) {
119
- const r = He(e, t) / 1e3;
120
- return qe(n == null ? void 0 : n.roundingMethod)(r);
121
- }
122
- function $e(e) {
123
- const t = m(e), n = p(e, 0);
124
- return n.setFullYear(t.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
125
- }
126
- const Ve = {
127
- lessThanXSeconds: {
128
- one: "less than a second",
129
- other: "less than {{count}} seconds"
130
- },
131
- xSeconds: {
132
- one: "1 second",
133
- other: "{{count}} seconds"
134
- },
135
- halfAMinute: "half a minute",
136
- lessThanXMinutes: {
137
- one: "less than a minute",
138
- other: "less than {{count}} minutes"
139
- },
140
- xMinutes: {
141
- one: "1 minute",
142
- other: "{{count}} minutes"
143
- },
144
- aboutXHours: {
145
- one: "about 1 hour",
146
- other: "about {{count}} hours"
147
- },
148
- xHours: {
149
- one: "1 hour",
150
- other: "{{count}} hours"
151
- },
152
- xDays: {
153
- one: "1 day",
154
- other: "{{count}} days"
155
- },
156
- aboutXWeeks: {
157
- one: "about 1 week",
158
- other: "about {{count}} weeks"
159
- },
160
- xWeeks: {
161
- one: "1 week",
162
- other: "{{count}} weeks"
163
- },
164
- aboutXMonths: {
165
- one: "about 1 month",
166
- other: "about {{count}} months"
167
- },
168
- xMonths: {
169
- one: "1 month",
170
- other: "{{count}} months"
171
- },
172
- aboutXYears: {
173
- one: "about 1 year",
174
- other: "about {{count}} years"
175
- },
176
- xYears: {
177
- one: "1 year",
178
- other: "{{count}} years"
179
- },
180
- overXYears: {
181
- one: "over 1 year",
182
- other: "over {{count}} years"
183
- },
184
- almostXYears: {
185
- one: "almost 1 year",
186
- other: "almost {{count}} years"
187
- }
188
- }, Ze = (e, t, n) => {
189
- let r;
190
- const a = Ve[e];
191
- return typeof a == "string" ? r = a : t === 1 ? r = a.one : r = a.other.replace("{{count}}", t.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
192
- };
193
- function z(e) {
194
- return (t = {}) => {
195
- const n = t.width ? String(t.width) : e.defaultWidth;
196
- return e.formats[n] || e.formats[e.defaultWidth];
197
- };
198
- }
199
- const Ge = {
200
- full: "EEEE, MMMM do, y",
201
- long: "MMMM do, y",
202
- medium: "MMM d, y",
203
- short: "MM/dd/yyyy"
204
- }, Qe = {
205
- full: "h:mm:ss a zzzz",
206
- long: "h:mm:ss a z",
207
- medium: "h:mm:ss a",
208
- short: "h:mm a"
209
- }, Je = {
210
- full: "{{date}} 'at' {{time}}",
211
- long: "{{date}} 'at' {{time}}",
212
- medium: "{{date}}, {{time}}",
213
- short: "{{date}}, {{time}}"
214
- }, Ke = {
215
- date: z({
216
- formats: Ge,
217
- defaultWidth: "full"
218
- }),
219
- time: z({
220
- formats: Qe,
221
- defaultWidth: "full"
222
- }),
223
- dateTime: z({
224
- formats: Je,
225
- defaultWidth: "full"
226
- })
227
- }, et = {
228
- lastWeek: "'last' eeee 'at' p",
229
- yesterday: "'yesterday at' p",
230
- today: "'today at' p",
231
- tomorrow: "'tomorrow at' p",
232
- nextWeek: "eeee 'at' p",
233
- other: "P"
234
- }, tt = (e, t, n, r) => et[e];
235
- function S(e) {
236
- return (t, n) => {
237
- const r = n != null && n.context ? String(n.context) : "standalone";
238
- let a;
239
- if (r === "formatting" && e.formattingValues) {
240
- const s = e.defaultFormattingWidth || e.defaultWidth, o = n != null && n.width ? String(n.width) : s;
241
- a = e.formattingValues[o] || e.formattingValues[s];
242
- } else {
243
- const s = e.defaultWidth, o = n != null && n.width ? String(n.width) : e.defaultWidth;
244
- a = e.values[o] || e.values[s];
245
- }
246
- const i = e.argumentCallback ? e.argumentCallback(t) : t;
247
- return a[i];
248
- };
249
- }
250
- const nt = {
251
- narrow: ["B", "A"],
252
- abbreviated: ["BC", "AD"],
253
- wide: ["Before Christ", "Anno Domini"]
254
- }, rt = {
255
- narrow: ["1", "2", "3", "4"],
256
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
257
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
258
- }, at = {
259
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
260
- abbreviated: [
261
- "Jan",
262
- "Feb",
263
- "Mar",
264
- "Apr",
265
- "May",
266
- "Jun",
267
- "Jul",
268
- "Aug",
269
- "Sep",
270
- "Oct",
271
- "Nov",
272
- "Dec"
273
- ],
274
- wide: [
275
- "January",
276
- "February",
277
- "March",
278
- "April",
279
- "May",
280
- "June",
281
- "July",
282
- "August",
283
- "September",
284
- "October",
285
- "November",
286
- "December"
287
- ]
288
- }, it = {
289
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
290
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
291
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
292
- wide: [
293
- "Sunday",
294
- "Monday",
295
- "Tuesday",
296
- "Wednesday",
297
- "Thursday",
298
- "Friday",
299
- "Saturday"
300
- ]
301
- }, st = {
302
- narrow: {
303
- am: "a",
304
- pm: "p",
305
- midnight: "mi",
306
- noon: "n",
307
- morning: "morning",
308
- afternoon: "afternoon",
309
- evening: "evening",
310
- night: "night"
311
- },
312
- abbreviated: {
313
- am: "AM",
314
- pm: "PM",
315
- midnight: "midnight",
316
- noon: "noon",
317
- morning: "morning",
318
- afternoon: "afternoon",
319
- evening: "evening",
320
- night: "night"
321
- },
322
- wide: {
323
- am: "a.m.",
324
- pm: "p.m.",
325
- midnight: "midnight",
326
- noon: "noon",
327
- morning: "morning",
328
- afternoon: "afternoon",
329
- evening: "evening",
330
- night: "night"
331
- }
332
- }, ot = {
333
- narrow: {
334
- am: "a",
335
- pm: "p",
336
- midnight: "mi",
337
- noon: "n",
338
- morning: "in the morning",
339
- afternoon: "in the afternoon",
340
- evening: "in the evening",
341
- night: "at night"
342
- },
343
- abbreviated: {
344
- am: "AM",
345
- pm: "PM",
346
- midnight: "midnight",
347
- noon: "noon",
348
- morning: "in the morning",
349
- afternoon: "in the afternoon",
350
- evening: "in the evening",
351
- night: "at night"
352
- },
353
- wide: {
354
- am: "a.m.",
355
- pm: "p.m.",
356
- midnight: "midnight",
357
- noon: "noon",
358
- morning: "in the morning",
359
- afternoon: "in the afternoon",
360
- evening: "in the evening",
361
- night: "at night"
362
- }
363
- }, ut = (e, t) => {
364
- const n = Number(e), r = n % 100;
365
- if (r > 20 || r < 10)
366
- switch (r % 10) {
367
- case 1:
368
- return n + "st";
369
- case 2:
370
- return n + "nd";
371
- case 3:
372
- return n + "rd";
373
- }
374
- return n + "th";
375
- }, ct = {
376
- ordinalNumber: ut,
377
- era: S({
378
- values: nt,
379
- defaultWidth: "wide"
380
- }),
381
- quarter: S({
382
- values: rt,
383
- defaultWidth: "wide",
384
- argumentCallback: (e) => e - 1
385
- }),
386
- month: S({
387
- values: at,
388
- defaultWidth: "wide"
389
- }),
390
- day: S({
391
- values: it,
392
- defaultWidth: "wide"
393
- }),
394
- dayPeriod: S({
395
- values: st,
396
- defaultWidth: "wide",
397
- formattingValues: ot,
398
- defaultFormattingWidth: "wide"
399
- })
400
- };
401
- function k(e) {
402
- return (t, n = {}) => {
403
- const r = n.width, a = r && e.matchPatterns[r] || e.matchPatterns[e.defaultMatchWidth], i = t.match(a);
404
- if (!i)
405
- return null;
406
- const s = i[0], o = r && e.parsePatterns[r] || e.parsePatterns[e.defaultParseWidth], l = Array.isArray(o) ? ft(o, (g) => g.test(s)) : (
407
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
408
- lt(o, (g) => g.test(s))
409
- );
410
- let f;
411
- f = e.valueCallback ? e.valueCallback(l) : l, f = n.valueCallback ? (
412
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
413
- n.valueCallback(f)
414
- ) : f;
415
- const u = t.slice(s.length);
416
- return { value: f, rest: u };
417
- };
418
- }
419
- function lt(e, t) {
420
- for (const n in e)
421
- if (Object.prototype.hasOwnProperty.call(e, n) && t(e[n]))
422
- return n;
423
- }
424
- function ft(e, t) {
425
- for (let n = 0; n < e.length; n++)
426
- if (t(e[n]))
427
- return n;
428
- }
429
- function dt(e) {
430
- return (t, n = {}) => {
431
- const r = t.match(e.matchPattern);
432
- if (!r) return null;
433
- const a = r[0], i = t.match(e.parsePattern);
434
- if (!i) return null;
435
- let s = e.valueCallback ? e.valueCallback(i[0]) : i[0];
436
- s = n.valueCallback ? n.valueCallback(s) : s;
437
- const o = t.slice(a.length);
438
- return { value: s, rest: o };
439
- };
440
- }
441
- const mt = /^(\d+)(th|st|nd|rd)?/i, ht = /\d+/i, gt = {
442
- narrow: /^(b|a)/i,
443
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
444
- wide: /^(before christ|before common era|anno domini|common era)/i
445
- }, yt = {
446
- any: [/^b/i, /^(a|c)/i]
447
- }, wt = {
448
- narrow: /^[1234]/i,
449
- abbreviated: /^q[1234]/i,
450
- wide: /^[1234](th|st|nd|rd)? quarter/i
451
- }, bt = {
452
- any: [/1/i, /2/i, /3/i, /4/i]
453
- }, Mt = {
454
- narrow: /^[jfmasond]/i,
455
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
456
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
457
- }, pt = {
458
- narrow: [
459
- /^j/i,
460
- /^f/i,
461
- /^m/i,
462
- /^a/i,
463
- /^m/i,
464
- /^j/i,
465
- /^j/i,
466
- /^a/i,
467
- /^s/i,
468
- /^o/i,
469
- /^n/i,
470
- /^d/i
471
- ],
472
- any: [
473
- /^ja/i,
474
- /^f/i,
475
- /^mar/i,
476
- /^ap/i,
477
- /^may/i,
478
- /^jun/i,
479
- /^jul/i,
480
- /^au/i,
481
- /^s/i,
482
- /^o/i,
483
- /^n/i,
484
- /^d/i
485
- ]
486
- }, xt = {
487
- narrow: /^[smtwf]/i,
488
- short: /^(su|mo|tu|we|th|fr|sa)/i,
489
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
490
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
491
- }, Dt = {
492
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
493
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
494
- }, Ot = {
495
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
496
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
497
- }, Tt = {
498
- any: {
499
- am: /^a/i,
500
- pm: /^p/i,
501
- midnight: /^mi/i,
502
- noon: /^no/i,
503
- morning: /morning/i,
504
- afternoon: /afternoon/i,
505
- evening: /evening/i,
506
- night: /night/i
507
- }
508
- }, vt = {
509
- ordinalNumber: dt({
510
- matchPattern: mt,
511
- parsePattern: ht,
512
- valueCallback: (e) => parseInt(e, 10)
513
- }),
514
- era: k({
515
- matchPatterns: gt,
516
- defaultMatchWidth: "wide",
517
- parsePatterns: yt,
518
- defaultParseWidth: "any"
519
- }),
520
- quarter: k({
521
- matchPatterns: wt,
522
- defaultMatchWidth: "wide",
523
- parsePatterns: bt,
524
- defaultParseWidth: "any",
525
- valueCallback: (e) => e + 1
526
- }),
527
- month: k({
528
- matchPatterns: Mt,
529
- defaultMatchWidth: "wide",
530
- parsePatterns: pt,
531
- defaultParseWidth: "any"
532
- }),
533
- day: k({
534
- matchPatterns: xt,
535
- defaultMatchWidth: "wide",
536
- parsePatterns: Dt,
537
- defaultParseWidth: "any"
538
- }),
539
- dayPeriod: k({
540
- matchPatterns: Ot,
541
- defaultMatchWidth: "any",
542
- parsePatterns: Tt,
543
- defaultParseWidth: "any"
544
- })
545
- }, de = {
546
- code: "en-US",
547
- formatDistance: Ze,
548
- formatLong: Ke,
549
- formatRelative: tt,
550
- localize: ct,
551
- match: vt,
552
- options: {
553
- weekStartsOn: 0,
554
- firstWeekContainsDate: 1
555
- }
556
- };
557
- function Pt(e) {
558
- const t = m(e);
559
- return Ee(t, $e(t)) + 1;
560
- }
561
- function St(e) {
562
- const t = m(e), n = +Y(t) - +Le(t);
563
- return Math.round(n / oe) + 1;
564
- }
565
- function me(e, t) {
566
- var u, g, c, h;
567
- const n = m(e), r = n.getFullYear(), a = P(), i = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((g = (u = t == null ? void 0 : t.locale) == null ? void 0 : u.options) == null ? void 0 : g.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((h = (c = a.locale) == null ? void 0 : c.options) == null ? void 0 : h.firstWeekContainsDate) ?? 1, s = p(e, 0);
568
- s.setFullYear(r + 1, 0, i), s.setHours(0, 0, 0, 0);
569
- const o = W(s, t), l = p(e, 0);
570
- l.setFullYear(r, 0, i), l.setHours(0, 0, 0, 0);
571
- const f = W(l, t);
572
- return n.getTime() >= o.getTime() ? r + 1 : n.getTime() >= f.getTime() ? r : r - 1;
573
- }
574
- function kt(e, t) {
575
- var o, l, f, u;
576
- const n = P(), r = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((l = (o = t == null ? void 0 : t.locale) == null ? void 0 : o.options) == null ? void 0 : l.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((u = (f = n.locale) == null ? void 0 : f.options) == null ? void 0 : u.firstWeekContainsDate) ?? 1, a = me(e, t), i = p(e, 0);
577
- return i.setFullYear(a, 0, r), i.setHours(0, 0, 0, 0), W(i, t);
578
- }
579
- function Wt(e, t) {
580
- const n = m(e), r = +W(n, t) - +kt(n, t);
581
- return Math.round(r / oe) + 1;
582
- }
583
- function d(e, t) {
584
- const n = e < 0 ? "-" : "", r = Math.abs(e).toString().padStart(t, "0");
585
- return n + r;
586
- }
587
- const M = {
588
- // Year
589
- y(e, t) {
590
- const n = e.getFullYear(), r = n > 0 ? n : 1 - n;
591
- return d(t === "yy" ? r % 100 : r, t.length);
592
- },
593
- // Month
594
- M(e, t) {
595
- const n = e.getMonth();
596
- return t === "M" ? String(n + 1) : d(n + 1, 2);
597
- },
598
- // Day of the month
599
- d(e, t) {
600
- return d(e.getDate(), t.length);
601
- },
602
- // AM or PM
603
- a(e, t) {
604
- const n = e.getHours() / 12 >= 1 ? "pm" : "am";
605
- switch (t) {
606
- case "a":
607
- case "aa":
608
- return n.toUpperCase();
609
- case "aaa":
610
- return n;
611
- case "aaaaa":
612
- return n[0];
613
- case "aaaa":
614
- default:
615
- return n === "am" ? "a.m." : "p.m.";
616
- }
617
- },
618
- // Hour [1-12]
619
- h(e, t) {
620
- return d(e.getHours() % 12 || 12, t.length);
621
- },
622
- // Hour [0-23]
623
- H(e, t) {
624
- return d(e.getHours(), t.length);
625
- },
626
- // Minute
627
- m(e, t) {
628
- return d(e.getMinutes(), t.length);
629
- },
630
- // Second
631
- s(e, t) {
632
- return d(e.getSeconds(), t.length);
633
- },
634
- // Fraction of second
635
- S(e, t) {
636
- const n = t.length, r = e.getMilliseconds(), a = Math.trunc(
637
- r * Math.pow(10, n - 3)
638
- );
639
- return d(a, t.length);
640
- }
641
- }, T = {
642
- midnight: "midnight",
643
- noon: "noon",
644
- morning: "morning",
645
- afternoon: "afternoon",
646
- evening: "evening",
647
- night: "night"
648
- }, Z = {
649
- // Era
650
- G: function(e, t, n) {
651
- const r = e.getFullYear() > 0 ? 1 : 0;
652
- switch (t) {
653
- case "G":
654
- case "GG":
655
- case "GGG":
656
- return n.era(r, { width: "abbreviated" });
657
- case "GGGGG":
658
- return n.era(r, { width: "narrow" });
659
- case "GGGG":
660
- default:
661
- return n.era(r, { width: "wide" });
662
- }
663
- },
664
- // Year
665
- y: function(e, t, n) {
666
- if (t === "yo") {
667
- const r = e.getFullYear(), a = r > 0 ? r : 1 - r;
668
- return n.ordinalNumber(a, { unit: "year" });
669
- }
670
- return M.y(e, t);
671
- },
672
- // Local week-numbering year
673
- Y: function(e, t, n, r) {
674
- const a = me(e, r), i = a > 0 ? a : 1 - a;
675
- if (t === "YY") {
676
- const s = i % 100;
677
- return d(s, 2);
678
- }
679
- return t === "Yo" ? n.ordinalNumber(i, { unit: "year" }) : d(i, t.length);
680
- },
681
- // ISO week-numbering year
682
- R: function(e, t) {
683
- const n = fe(e);
684
- return d(n, t.length);
685
- },
686
- // Extended year. This is a single number designating the year of this calendar system.
687
- // The main difference between `y` and `u` localizers are B.C. years:
688
- // | Year | `y` | `u` |
689
- // |------|-----|-----|
690
- // | AC 1 | 1 | 1 |
691
- // | BC 1 | 1 | 0 |
692
- // | BC 2 | 2 | -1 |
693
- // Also `yy` always returns the last two digits of a year,
694
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
695
- u: function(e, t) {
696
- const n = e.getFullYear();
697
- return d(n, t.length);
698
- },
699
- // Quarter
700
- Q: function(e, t, n) {
701
- const r = Math.ceil((e.getMonth() + 1) / 3);
702
- switch (t) {
703
- case "Q":
704
- return String(r);
705
- case "QQ":
706
- return d(r, 2);
707
- case "Qo":
708
- return n.ordinalNumber(r, { unit: "quarter" });
709
- case "QQQ":
710
- return n.quarter(r, {
711
- width: "abbreviated",
712
- context: "formatting"
713
- });
714
- case "QQQQQ":
715
- return n.quarter(r, {
716
- width: "narrow",
717
- context: "formatting"
718
- });
719
- case "QQQQ":
720
- default:
721
- return n.quarter(r, {
722
- width: "wide",
723
- context: "formatting"
724
- });
725
- }
726
- },
727
- // Stand-alone quarter
728
- q: function(e, t, n) {
729
- const r = Math.ceil((e.getMonth() + 1) / 3);
730
- switch (t) {
731
- case "q":
732
- return String(r);
733
- case "qq":
734
- return d(r, 2);
735
- case "qo":
736
- return n.ordinalNumber(r, { unit: "quarter" });
737
- case "qqq":
738
- return n.quarter(r, {
739
- width: "abbreviated",
740
- context: "standalone"
741
- });
742
- case "qqqqq":
743
- return n.quarter(r, {
744
- width: "narrow",
745
- context: "standalone"
746
- });
747
- case "qqqq":
748
- default:
749
- return n.quarter(r, {
750
- width: "wide",
751
- context: "standalone"
752
- });
753
- }
754
- },
755
- // Month
756
- M: function(e, t, n) {
757
- const r = e.getMonth();
758
- switch (t) {
759
- case "M":
760
- case "MM":
761
- return M.M(e, t);
762
- case "Mo":
763
- return n.ordinalNumber(r + 1, { unit: "month" });
764
- case "MMM":
765
- return n.month(r, {
766
- width: "abbreviated",
767
- context: "formatting"
768
- });
769
- case "MMMMM":
770
- return n.month(r, {
771
- width: "narrow",
772
- context: "formatting"
773
- });
774
- case "MMMM":
775
- default:
776
- return n.month(r, { width: "wide", context: "formatting" });
777
- }
778
- },
779
- // Stand-alone month
780
- L: function(e, t, n) {
781
- const r = e.getMonth();
782
- switch (t) {
783
- case "L":
784
- return String(r + 1);
785
- case "LL":
786
- return d(r + 1, 2);
787
- case "Lo":
788
- return n.ordinalNumber(r + 1, { unit: "month" });
789
- case "LLL":
790
- return n.month(r, {
791
- width: "abbreviated",
792
- context: "standalone"
793
- });
794
- case "LLLLL":
795
- return n.month(r, {
796
- width: "narrow",
797
- context: "standalone"
798
- });
799
- case "LLLL":
800
- default:
801
- return n.month(r, { width: "wide", context: "standalone" });
802
- }
803
- },
804
- // Local week of year
805
- w: function(e, t, n, r) {
806
- const a = Wt(e, r);
807
- return t === "wo" ? n.ordinalNumber(a, { unit: "week" }) : d(a, t.length);
808
- },
809
- // ISO week of year
810
- I: function(e, t, n) {
811
- const r = St(e);
812
- return t === "Io" ? n.ordinalNumber(r, { unit: "week" }) : d(r, t.length);
813
- },
814
- // Day of the month
815
- d: function(e, t, n) {
816
- return t === "do" ? n.ordinalNumber(e.getDate(), { unit: "date" }) : M.d(e, t);
817
- },
818
- // Day of year
819
- D: function(e, t, n) {
820
- const r = Pt(e);
821
- return t === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : d(r, t.length);
822
- },
823
- // Day of week
824
- E: function(e, t, n) {
825
- const r = e.getDay();
826
- switch (t) {
827
- case "E":
828
- case "EE":
829
- case "EEE":
830
- return n.day(r, {
831
- width: "abbreviated",
832
- context: "formatting"
833
- });
834
- case "EEEEE":
835
- return n.day(r, {
836
- width: "narrow",
837
- context: "formatting"
838
- });
839
- case "EEEEEE":
840
- return n.day(r, {
841
- width: "short",
842
- context: "formatting"
843
- });
844
- case "EEEE":
845
- default:
846
- return n.day(r, {
847
- width: "wide",
848
- context: "formatting"
849
- });
850
- }
851
- },
852
- // Local day of week
853
- e: function(e, t, n, r) {
854
- const a = e.getDay(), i = (a - r.weekStartsOn + 8) % 7 || 7;
855
- switch (t) {
856
- case "e":
857
- return String(i);
858
- case "ee":
859
- return d(i, 2);
860
- case "eo":
861
- return n.ordinalNumber(i, { unit: "day" });
862
- case "eee":
863
- return n.day(a, {
864
- width: "abbreviated",
865
- context: "formatting"
866
- });
867
- case "eeeee":
868
- return n.day(a, {
869
- width: "narrow",
870
- context: "formatting"
871
- });
872
- case "eeeeee":
873
- return n.day(a, {
874
- width: "short",
875
- context: "formatting"
876
- });
877
- case "eeee":
878
- default:
879
- return n.day(a, {
880
- width: "wide",
881
- context: "formatting"
882
- });
883
- }
884
- },
885
- // Stand-alone local day of week
886
- c: function(e, t, n, r) {
887
- const a = e.getDay(), i = (a - r.weekStartsOn + 8) % 7 || 7;
888
- switch (t) {
889
- case "c":
890
- return String(i);
891
- case "cc":
892
- return d(i, t.length);
893
- case "co":
894
- return n.ordinalNumber(i, { unit: "day" });
895
- case "ccc":
896
- return n.day(a, {
897
- width: "abbreviated",
898
- context: "standalone"
899
- });
900
- case "ccccc":
901
- return n.day(a, {
902
- width: "narrow",
903
- context: "standalone"
904
- });
905
- case "cccccc":
906
- return n.day(a, {
907
- width: "short",
908
- context: "standalone"
909
- });
910
- case "cccc":
911
- default:
912
- return n.day(a, {
913
- width: "wide",
914
- context: "standalone"
915
- });
916
- }
917
- },
918
- // ISO day of week
919
- i: function(e, t, n) {
920
- const r = e.getDay(), a = r === 0 ? 7 : r;
921
- switch (t) {
922
- case "i":
923
- return String(a);
924
- case "ii":
925
- return d(a, t.length);
926
- case "io":
927
- return n.ordinalNumber(a, { unit: "day" });
928
- case "iii":
929
- return n.day(r, {
930
- width: "abbreviated",
931
- context: "formatting"
932
- });
933
- case "iiiii":
934
- return n.day(r, {
935
- width: "narrow",
936
- context: "formatting"
937
- });
938
- case "iiiiii":
939
- return n.day(r, {
940
- width: "short",
941
- context: "formatting"
942
- });
943
- case "iiii":
944
- default:
945
- return n.day(r, {
946
- width: "wide",
947
- context: "formatting"
948
- });
949
- }
950
- },
951
- // AM or PM
952
- a: function(e, t, n) {
953
- const a = e.getHours() / 12 >= 1 ? "pm" : "am";
954
- switch (t) {
955
- case "a":
956
- case "aa":
957
- return n.dayPeriod(a, {
958
- width: "abbreviated",
959
- context: "formatting"
960
- });
961
- case "aaa":
962
- return n.dayPeriod(a, {
963
- width: "abbreviated",
964
- context: "formatting"
965
- }).toLowerCase();
966
- case "aaaaa":
967
- return n.dayPeriod(a, {
968
- width: "narrow",
969
- context: "formatting"
970
- });
971
- case "aaaa":
972
- default:
973
- return n.dayPeriod(a, {
974
- width: "wide",
975
- context: "formatting"
976
- });
977
- }
978
- },
979
- // AM, PM, midnight, noon
980
- b: function(e, t, n) {
981
- const r = e.getHours();
982
- let a;
983
- switch (r === 12 ? a = T.noon : r === 0 ? a = T.midnight : a = r / 12 >= 1 ? "pm" : "am", t) {
984
- case "b":
985
- case "bb":
986
- return n.dayPeriod(a, {
987
- width: "abbreviated",
988
- context: "formatting"
989
- });
990
- case "bbb":
991
- return n.dayPeriod(a, {
992
- width: "abbreviated",
993
- context: "formatting"
994
- }).toLowerCase();
995
- case "bbbbb":
996
- return n.dayPeriod(a, {
997
- width: "narrow",
998
- context: "formatting"
999
- });
1000
- case "bbbb":
1001
- default:
1002
- return n.dayPeriod(a, {
1003
- width: "wide",
1004
- context: "formatting"
1005
- });
1006
- }
1007
- },
1008
- // in the morning, in the afternoon, in the evening, at night
1009
- B: function(e, t, n) {
1010
- const r = e.getHours();
1011
- let a;
1012
- switch (r >= 17 ? a = T.evening : r >= 12 ? a = T.afternoon : r >= 4 ? a = T.morning : a = T.night, t) {
1013
- case "B":
1014
- case "BB":
1015
- case "BBB":
1016
- return n.dayPeriod(a, {
1017
- width: "abbreviated",
1018
- context: "formatting"
1019
- });
1020
- case "BBBBB":
1021
- return n.dayPeriod(a, {
1022
- width: "narrow",
1023
- context: "formatting"
1024
- });
1025
- case "BBBB":
1026
- default:
1027
- return n.dayPeriod(a, {
1028
- width: "wide",
1029
- context: "formatting"
1030
- });
1031
- }
1032
- },
1033
- // Hour [1-12]
1034
- h: function(e, t, n) {
1035
- if (t === "ho") {
1036
- let r = e.getHours() % 12;
1037
- return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
1038
- }
1039
- return M.h(e, t);
1040
- },
1041
- // Hour [0-23]
1042
- H: function(e, t, n) {
1043
- return t === "Ho" ? n.ordinalNumber(e.getHours(), { unit: "hour" }) : M.H(e, t);
1044
- },
1045
- // Hour [0-11]
1046
- K: function(e, t, n) {
1047
- const r = e.getHours() % 12;
1048
- return t === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : d(r, t.length);
1049
- },
1050
- // Hour [1-24]
1051
- k: function(e, t, n) {
1052
- let r = e.getHours();
1053
- return r === 0 && (r = 24), t === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : d(r, t.length);
1054
- },
1055
- // Minute
1056
- m: function(e, t, n) {
1057
- return t === "mo" ? n.ordinalNumber(e.getMinutes(), { unit: "minute" }) : M.m(e, t);
1058
- },
1059
- // Second
1060
- s: function(e, t, n) {
1061
- return t === "so" ? n.ordinalNumber(e.getSeconds(), { unit: "second" }) : M.s(e, t);
1062
- },
1063
- // Fraction of second
1064
- S: function(e, t) {
1065
- return M.S(e, t);
1066
- },
1067
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1068
- X: function(e, t, n) {
1069
- const r = e.getTimezoneOffset();
1070
- if (r === 0)
1071
- return "Z";
1072
- switch (t) {
1073
- case "X":
1074
- return Q(r);
1075
- case "XXXX":
1076
- case "XX":
1077
- return D(r);
1078
- case "XXXXX":
1079
- case "XXX":
1080
- default:
1081
- return D(r, ":");
1082
- }
1083
- },
1084
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1085
- x: function(e, t, n) {
1086
- const r = e.getTimezoneOffset();
1087
- switch (t) {
1088
- case "x":
1089
- return Q(r);
1090
- case "xxxx":
1091
- case "xx":
1092
- return D(r);
1093
- case "xxxxx":
1094
- case "xxx":
1095
- default:
1096
- return D(r, ":");
1097
- }
1098
- },
1099
- // Timezone (GMT)
1100
- O: function(e, t, n) {
1101
- const r = e.getTimezoneOffset();
1102
- switch (t) {
1103
- case "O":
1104
- case "OO":
1105
- case "OOO":
1106
- return "GMT" + G(r, ":");
1107
- case "OOOO":
1108
- default:
1109
- return "GMT" + D(r, ":");
1110
- }
1111
- },
1112
- // Timezone (specific non-location)
1113
- z: function(e, t, n) {
1114
- const r = e.getTimezoneOffset();
1115
- switch (t) {
1116
- case "z":
1117
- case "zz":
1118
- case "zzz":
1119
- return "GMT" + G(r, ":");
1120
- case "zzzz":
1121
- default:
1122
- return "GMT" + D(r, ":");
1123
- }
1124
- },
1125
- // Seconds timestamp
1126
- t: function(e, t, n) {
1127
- const r = Math.trunc(e.getTime() / 1e3);
1128
- return d(r, t.length);
1129
- },
1130
- // Milliseconds timestamp
1131
- T: function(e, t, n) {
1132
- const r = e.getTime();
1133
- return d(r, t.length);
1134
- }
1135
- };
1136
- function G(e, t = "") {
1137
- const n = e > 0 ? "-" : "+", r = Math.abs(e), a = Math.trunc(r / 60), i = r % 60;
1138
- return i === 0 ? n + String(a) : n + String(a) + t + d(i, 2);
1139
- }
1140
- function Q(e, t) {
1141
- return e % 60 === 0 ? (e > 0 ? "-" : "+") + d(Math.abs(e) / 60, 2) : D(e, t);
1142
- }
1143
- function D(e, t = "") {
1144
- const n = e > 0 ? "-" : "+", r = Math.abs(e), a = d(Math.trunc(r / 60), 2), i = d(r % 60, 2);
1145
- return n + a + t + i;
1146
- }
1147
- const J = (e, t) => {
1148
- switch (e) {
1149
- case "P":
1150
- return t.date({ width: "short" });
1151
- case "PP":
1152
- return t.date({ width: "medium" });
1153
- case "PPP":
1154
- return t.date({ width: "long" });
1155
- case "PPPP":
1156
- default:
1157
- return t.date({ width: "full" });
1158
- }
1159
- }, he = (e, t) => {
1160
- switch (e) {
1161
- case "p":
1162
- return t.time({ width: "short" });
1163
- case "pp":
1164
- return t.time({ width: "medium" });
1165
- case "ppp":
1166
- return t.time({ width: "long" });
1167
- case "pppp":
1168
- default:
1169
- return t.time({ width: "full" });
1170
- }
1171
- }, Ct = (e, t) => {
1172
- const n = e.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
1173
- if (!a)
1174
- return J(e, t);
1175
- let i;
1176
- switch (r) {
1177
- case "P":
1178
- i = t.dateTime({ width: "short" });
1179
- break;
1180
- case "PP":
1181
- i = t.dateTime({ width: "medium" });
1182
- break;
1183
- case "PPP":
1184
- i = t.dateTime({ width: "long" });
1185
- break;
1186
- case "PPPP":
1187
- default:
1188
- i = t.dateTime({ width: "full" });
1189
- break;
1190
- }
1191
- return i.replace("{{date}}", J(r, t)).replace("{{time}}", he(a, t));
1192
- }, Ft = {
1193
- p: he,
1194
- P: Ct
1195
- }, Nt = /^D+$/, Yt = /^Y+$/, Et = ["D", "DD", "YY", "YYYY"];
1196
- function Lt(e) {
1197
- return Nt.test(e);
1198
- }
1199
- function _t(e) {
1200
- return Yt.test(e);
1201
- }
1202
- function zt(e, t, n) {
1203
- const r = Xt(e, t, n);
1204
- if (console.warn(r), Et.includes(e)) throw new RangeError(r);
1205
- }
1206
- function Xt(e, t, n) {
1207
- const r = e[0] === "Y" ? "years" : "days of the month";
1208
- return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
1209
- }
1210
- const It = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, qt = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Ht = /^'([^]*?)'?$/, Rt = /''/g, At = /[a-zA-Z]/;
1211
- function H(e, t, n) {
1212
- var u, g, c, h, y, O, A, j;
1213
- const r = P(), a = (n == null ? void 0 : n.locale) ?? r.locale ?? de, i = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((g = (u = n == null ? void 0 : n.locale) == null ? void 0 : u.options) == null ? void 0 : g.firstWeekContainsDate) ?? r.firstWeekContainsDate ?? ((h = (c = r.locale) == null ? void 0 : c.options) == null ? void 0 : h.firstWeekContainsDate) ?? 1, s = (n == null ? void 0 : n.weekStartsOn) ?? ((O = (y = n == null ? void 0 : n.locale) == null ? void 0 : y.options) == null ? void 0 : O.weekStartsOn) ?? r.weekStartsOn ?? ((j = (A = r.locale) == null ? void 0 : A.options) == null ? void 0 : j.weekStartsOn) ?? 0, o = m(e);
1214
- if (!Xe(o))
1215
- throw new RangeError("Invalid time value");
1216
- let l = t.match(qt).map((b) => {
1217
- const w = b[0];
1218
- if (w === "p" || w === "P") {
1219
- const _ = Ft[w];
1220
- return _(b, a.formatLong);
1221
- }
1222
- return b;
1223
- }).join("").match(It).map((b) => {
1224
- if (b === "''")
1225
- return { isToken: !1, value: "'" };
1226
- const w = b[0];
1227
- if (w === "'")
1228
- return { isToken: !1, value: jt(b) };
1229
- if (Z[w])
1230
- return { isToken: !0, value: b };
1231
- if (w.match(At))
1232
- throw new RangeError(
1233
- "Format string contains an unescaped latin alphabet character `" + w + "`"
1234
- );
1235
- return { isToken: !1, value: b };
1236
- });
1237
- a.localize.preprocessor && (l = a.localize.preprocessor(o, l));
1238
- const f = {
1239
- firstWeekContainsDate: i,
1240
- weekStartsOn: s,
1241
- locale: a
1242
- };
1243
- return l.map((b) => {
1244
- if (!b.isToken) return b.value;
1245
- const w = b.value;
1246
- (!(n != null && n.useAdditionalWeekYearTokens) && _t(w) || !(n != null && n.useAdditionalDayOfYearTokens) && Lt(w)) && zt(w, t, String(e));
1247
- const _ = Z[w[0]];
1248
- return _(o, w, a.localize, f);
1249
- }).join("");
1250
- }
1251
- function jt(e) {
1252
- const t = e.match(Ht);
1253
- return t ? t[1].replace(Rt, "'") : e;
1254
- }
1255
- function Ut(e, t, n) {
1256
- const r = P(), a = (n == null ? void 0 : n.locale) ?? r.locale ?? de, i = 2520, s = F(e, t);
1257
- if (isNaN(s))
1258
- throw new RangeError("Invalid time value");
1259
- const o = Object.assign({}, n, {
1260
- addSuffix: n == null ? void 0 : n.addSuffix,
1261
- comparison: s
1262
- });
1263
- let l, f;
1264
- s > 0 ? (l = m(t), f = m(e)) : (l = m(e), f = m(t));
1265
- const u = Be(f, l), g = (E(f) - E(l)) / 1e3, c = Math.round((u - g) / 60);
1266
- let h;
1267
- if (c < 2)
1268
- return n != null && n.includeSeconds ? u < 5 ? a.formatDistance("lessThanXSeconds", 5, o) : u < 10 ? a.formatDistance("lessThanXSeconds", 10, o) : u < 20 ? a.formatDistance("lessThanXSeconds", 20, o) : u < 40 ? a.formatDistance("halfAMinute", 0, o) : u < 60 ? a.formatDistance("lessThanXMinutes", 1, o) : a.formatDistance("xMinutes", 1, o) : c === 0 ? a.formatDistance("lessThanXMinutes", 1, o) : a.formatDistance("xMinutes", c, o);
1269
- if (c < 45)
1270
- return a.formatDistance("xMinutes", c, o);
1271
- if (c < 90)
1272
- return a.formatDistance("aboutXHours", 1, o);
1273
- if (c < $) {
1274
- const y = Math.round(c / 60);
1275
- return a.formatDistance("aboutXHours", y, o);
1276
- } else {
1277
- if (c < i)
1278
- return a.formatDistance("xDays", 1, o);
1279
- if (c < C) {
1280
- const y = Math.round(c / $);
1281
- return a.formatDistance("xDays", y, o);
1282
- } else if (c < C * 2)
1283
- return h = Math.round(c / C), a.formatDistance("aboutXMonths", h, o);
1284
- }
1285
- if (h = Ue(f, l), h < 12) {
1286
- const y = Math.round(c / C);
1287
- return a.formatDistance("xMonths", y, o);
1288
- } else {
1289
- const y = h % 12, O = Math.trunc(h / 12);
1290
- return y < 3 ? a.formatDistance("aboutXYears", O, o) : y < 9 ? a.formatDistance("overXYears", O, o) : a.formatDistance("almostXYears", O + 1, o);
1291
- }
1292
- }
1293
- function Bt(e, t) {
1294
- return Ut(e, _e(e), t);
1295
- }
1296
- function $t() {
1297
- return Object.assign({}, P());
1298
- }
1299
- function K(e, t, n) {
1300
- const r = $t(), a = Gt(e, n.timeZone, n.locale ?? r.locale);
1301
- return "formatToParts" in a ? Vt(a, t) : Zt(a, t);
1302
- }
1303
- function Vt(e, t) {
1304
- const n = e.formatToParts(t);
1305
- for (let r = n.length - 1; r >= 0; --r)
1306
- if (n[r].type === "timeZoneName")
1307
- return n[r].value;
1308
- }
1309
- function Zt(e, t) {
1310
- const n = e.format(t).replace(/\u200E/g, ""), r = / [\w-+ ]+$/.exec(n);
1311
- return r ? r[0].substr(1) : "";
1312
- }
1313
- function Gt(e, t, n) {
1314
- return new Intl.DateTimeFormat(n ? [n.code, "en-US"] : void 0, {
1315
- timeZone: t,
1316
- timeZoneName: e
1317
- });
1318
- }
1319
- const Qt = 60 * 1e3, Jt = {
1320
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1321
- X: function(e, t, n) {
1322
- const r = X(n.timeZone, e);
1323
- if (r === 0)
1324
- return "Z";
1325
- switch (t) {
1326
- case "X":
1327
- return ee(r);
1328
- case "XXXX":
1329
- case "XX":
1330
- return v(r);
1331
- case "XXXXX":
1332
- case "XXX":
1333
- default:
1334
- return v(r, ":");
1335
- }
1336
- },
1337
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1338
- x: function(e, t, n) {
1339
- const r = X(n.timeZone, e);
1340
- switch (t) {
1341
- case "x":
1342
- return ee(r);
1343
- case "xxxx":
1344
- case "xx":
1345
- return v(r);
1346
- case "xxxxx":
1347
- case "xxx":
1348
- default:
1349
- return v(r, ":");
1350
- }
1351
- },
1352
- // Timezone (GMT)
1353
- O: function(e, t, n) {
1354
- const r = X(n.timeZone, e);
1355
- switch (t) {
1356
- case "O":
1357
- case "OO":
1358
- case "OOO":
1359
- return "GMT" + Kt(r, ":");
1360
- case "OOOO":
1361
- default:
1362
- return "GMT" + v(r, ":");
1363
- }
1364
- },
1365
- // Timezone (specific non-location)
1366
- z: function(e, t, n) {
1367
- switch (t) {
1368
- case "z":
1369
- case "zz":
1370
- case "zzz":
1371
- return K("short", e, n);
1372
- case "zzzz":
1373
- default:
1374
- return K("long", e, n);
1375
- }
1376
- }
1377
- };
1378
- function X(e, t) {
1379
- const n = e ? ue(e, t, !0) / Qt : (t == null ? void 0 : t.getTimezoneOffset()) ?? 0;
1380
- if (Number.isNaN(n))
1381
- throw new RangeError("Invalid time zone specified: " + e);
1382
- return n;
1383
- }
1384
- function L(e, t) {
1385
- const n = e < 0 ? "-" : "";
1386
- let r = Math.abs(e).toString();
1387
- for (; r.length < t; )
1388
- r = "0" + r;
1389
- return n + r;
1390
- }
1391
- function v(e, t = "") {
1392
- const n = e > 0 ? "-" : "+", r = Math.abs(e), a = L(Math.floor(r / 60), 2), i = L(Math.floor(r % 60), 2);
1393
- return n + a + t + i;
1394
- }
1395
- function ee(e, t) {
1396
- return e % 60 === 0 ? (e > 0 ? "-" : "+") + L(Math.abs(e) / 60, 2) : v(e, t);
1397
- }
1398
- function Kt(e, t = "") {
1399
- const n = e > 0 ? "-" : "+", r = Math.abs(e), a = Math.floor(r / 60), i = r % 60;
1400
- return i === 0 ? n + String(a) : n + String(a) + t + L(i, 2);
1401
- }
1402
- const en = /([xXOz]+)|''|'(''|[^'])+('|$)/g;
1403
- function tn(e, t, n = {}) {
1404
- t = String(t);
1405
- const r = t.match(en);
1406
- if (r) {
1407
- const a = ce(n.originalDate || e, n);
1408
- t = r.reduce(function(i, s) {
1409
- if (s[0] === "'")
1410
- return i;
1411
- const o = i.indexOf(s), l = i[o - 1] === "'", f = i.replace(s, "'" + Jt[s[0]](a, s, n) + "'");
1412
- return l ? f.substring(0, o - 1) + f.substring(o + 1) : f;
1413
- }, t);
1414
- }
1415
- return H(e, t, n);
1416
- }
1417
- function nn(e, t, n) {
1418
- e = ce(e, n);
1419
- const r = ue(t, e, !0), a = new Date(e.getTime() - r), i = /* @__PURE__ */ new Date(0);
1420
- return i.setFullYear(a.getUTCFullYear(), a.getUTCMonth(), a.getUTCDate()), i.setHours(a.getUTCHours(), a.getUTCMinutes(), a.getUTCSeconds(), a.getUTCMilliseconds()), i;
1421
- }
1422
- function ge(e, t, n, r) {
1423
- return r = {
1424
- ...r,
1425
- timeZone: t,
1426
- originalDate: e
1427
- }, tn(nn(e, t, { timeZone: r.timeZone }), n, r);
1428
- }
1429
- function vn(e, t) {
1430
- return e && e !== "auto" ? e : t;
1431
- }
1432
- function Pn(e, t = /* @__PURE__ */ new Date()) {
1433
- try {
1434
- const n = {
1435
- timeZone: e,
1436
- timeZoneName: "short"
1437
- }, a = new Intl.DateTimeFormat("en-US", n).formatToParts(t).find((i) => i.type === "timeZoneName");
1438
- return (a == null ? void 0 : a.value) || e;
1439
- } catch {
1440
- return e;
1441
- }
1442
- }
1443
- function Sn(e) {
1444
- try {
1445
- const t = {
1446
- timeZone: e,
1447
- timeZoneName: "long"
1448
- }, r = new Intl.DateTimeFormat("en-US", t).formatToParts(
1449
- /* @__PURE__ */ new Date()
1450
- ).find((a) => a.type === "timeZoneName");
1451
- return (r == null ? void 0 : r.value) || e;
1452
- } catch {
1453
- return e;
1454
- }
1455
- }
1456
- function R(e, t = "auto") {
1457
- if (!e)
1458
- return /* @__PURE__ */ new Date(NaN);
1459
- const n = e.endsWith("Z"), r = /[+-]\d{2}:?\d{2}$/.test(e), a = /\([A-Z]{3,4}\)$/.test(e);
1460
- if (t === "auto")
1461
- return n || r || a ? new Date(e) : /* @__PURE__ */ new Date(e + "Z");
1462
- if (t === "local") {
1463
- if (n || r) {
1464
- const i = e.replace(/Z$/, "").replace(/[+-]\d{2}:?\d{2}$/, "");
1465
- return new Date(i);
1466
- }
1467
- return new Date(e);
1468
- } else return t === "UTC" ? n ? new Date(e) : r ? new Date(e) : /* @__PURE__ */ new Date(e + "Z") : n || r || a ? new Date(e) : Te(e, t);
1469
- }
1470
- const rn = "MM/dd/yyyy", an = (e, t, n, r = "auto") => {
1471
- if (!e)
1472
- return "";
1473
- try {
1474
- const a = R(e, r);
1475
- if (isNaN(a.getTime()))
1476
- return e;
1477
- const s = (t && t.trim() ? t : rn).replace(/LLLL/g, "MMMM").replace(/LLL/g, "MMM");
1478
- return n && n !== "auto" ? ge(a, n, s) : H(a, s);
1479
- } catch (a) {
1480
- return console.error("Date formatting error:", a), e;
1481
- }
1482
- };
1483
- function kn(e, t, n = "auto") {
1484
- if (e)
1485
- try {
1486
- const r = R(e, n);
1487
- if (isNaN(r.getTime())) return;
1488
- const a = "yyyy M d H m s", i = t && t !== "auto" ? ge(r, t, a) : H(r, a), [s, o, l, f, u, g] = i.split(" ").map(Number);
1489
- return { year: s, month: o, day: l, hour: f, minute: u, second: g };
1490
- } catch {
1491
- return;
1492
- }
1493
- }
1494
- const sn = (e, t = "auto") => {
1495
- if (!e)
1496
- return "";
1497
- try {
1498
- const n = R(e, t);
1499
- return isNaN(n.getTime()) ? e : Bt(n, { addSuffix: !0 });
1500
- } catch (n) {
1501
- return console.error("Relative time formatting error:", n), e;
1502
- }
1503
- };
1504
- function on(e, t, n, r) {
1505
- const a = e instanceof Date ? e.toISOString() : String(e), i = (r == null ? void 0 : r.browserTimezone) || n, s = (r == null ? void 0 : r.isSqlCard) ?? !1;
1506
- if (t != null && t.useRelativeTime)
1507
- return sn(
1508
- a,
1509
- (t == null ? void 0 : t.sourceTimezone) || "auto"
1510
- );
1511
- const o = t != null && t.useCustomFormat && (t != null && t.customFormat) ? t.customFormat : (t == null ? void 0 : t.format) || "MM/dd/yyyy";
1512
- return an(
1513
- a,
1514
- o,
1515
- t != null && t.timezone && (t == null ? void 0 : t.timezone) !== "auto" ? t.timezone : s ? i : n,
1516
- (t == null ? void 0 : t.sourceTimezone) || "auto"
1517
- );
1518
- }
1519
- function ye(e, t, n) {
1520
- var s, o;
1521
- if (e == null)
1522
- return e === null ? ((s = n.absence) == null ? void 0 : s.nullText) ?? "" : ((o = n.absence) == null ? void 0 : o.emptyText) ?? "";
1523
- const r = Me(e) ? e : void 0, a = r ? r.value : e, i = r ?? (typeof e == "number" ? e : void 0);
1524
- if (!n.useFormattedValues || !t)
1525
- return String(a);
1526
- switch (t.type) {
1527
- case "number":
1528
- return i !== void 0 ? ve(
1529
- i,
1530
- t.numberFormat,
1531
- n.locale
1532
- ) : String(a);
1533
- case "date":
1534
- return on(
1535
- a,
1536
- t.dateFormat,
1537
- n.timezone,
1538
- {
1539
- browserTimezone: n.browserTimezone,
1540
- isSqlCard: n.isSqlCard
1541
- }
1542
- );
1543
- case "progress":
1544
- return i !== void 0 ? `${a}%` : String(a);
1545
- case "badge":
1546
- case "link":
1547
- case "text":
1548
- case "none":
1549
- default:
1550
- return String(a);
1551
- }
1552
- }
1553
- function Wn(e, t) {
1554
- return t.visibleColumns.map((n) => {
1555
- const r = e[n], a = t.columnSettings[n];
1556
- return ye(r, a, {
1557
- useFormattedValues: t.useFormattedValues,
1558
- timezone: t.timezone,
1559
- locale: t.locale
1560
- });
1561
- });
1562
- }
1563
- const un = "en-US", te = [
1564
- "compact",
1565
- "maximumFractionDigits",
1566
- "minimumFractionDigits",
1567
- "negativeStyle",
1568
- "type",
1569
- "useGrouping"
1570
- ];
1571
- function cn(e) {
1572
- if (e.type !== "currency" || Object.prototype.hasOwnProperty.call(e, "currency") || Object.prototype.hasOwnProperty.call(e, "locale"))
1573
- return !1;
1574
- const t = Object.keys(e).sort();
1575
- return t.length === te.length && te.every(
1576
- (n, r) => t[r] === n
1577
- ) && typeof e.minimumFractionDigits == "number" && typeof e.maximumFractionDigits == "number" && e.useGrouping === !0 && e.negativeStyle === "minus" && typeof e.compact == "boolean";
1578
- }
1579
- function ne(e) {
1580
- if (typeof e != "string")
1581
- return;
1582
- const t = e.trim();
1583
- if (!(!t || t.toLowerCase() === "none"))
1584
- return t;
1585
- }
1586
- function N(e) {
1587
- if (!(typeof e != "number" || !Number.isFinite(e)))
1588
- return Math.max(0, Math.min(10, Math.trunc(e)));
1589
- }
1590
- function ln(e) {
1591
- return e === "currency" ? 2 : e === "percent" ? 1 : e === "scientific" ? 2 : 0;
1592
- }
1593
- function fn(e, t, n) {
1594
- const r = N(t.minimumFractionDigits), a = N(t.maximumFractionDigits);
1595
- if (typeof r == "number" || typeof a == "number") {
1596
- const o = r ?? 0, l = a ?? Math.max(o, 2);
1597
- return {
1598
- minimumFractionDigits: Math.min(o, l),
1599
- maximumFractionDigits: Math.max(o, l)
1600
- };
1601
- }
1602
- const i = N(t.decimals);
1603
- if (typeof i == "number")
1604
- return {
1605
- minimumFractionDigits: i,
1606
- maximumFractionDigits: i
1607
- };
1608
- if (n != null && n.preserveOmittedProperties)
1609
- return {};
1610
- const s = ln(e);
1611
- return {
1612
- minimumFractionDigits: s,
1613
- maximumFractionDigits: s
1614
- };
1615
- }
1616
- function dn(e, t) {
1617
- if (!(typeof t != "string" || e === "percent" && t === "%"))
1618
- return t;
1619
- }
1620
- function re(e) {
1621
- const t = ne(e.locale), n = ne(e.currency), r = dn(e.type, e.suffix);
1622
- return {
1623
- ...e,
1624
- ...t !== e.locale ? { locale: t } : {},
1625
- ...n !== e.currency ? { currency: n } : {},
1626
- ...r !== e.suffix ? { suffix: r } : {}
1627
- };
1628
- }
1629
- function x(e, t, n) {
1630
- const r = { ...t, type: e };
1631
- if ((n == null ? void 0 : n.numericInput) === "canonical" && q(r))
1632
- return re(r);
1633
- const a = fn(e, t, n), i = typeof t.prefix == "string" ? t.prefix : void 0, s = {
1634
- type: e,
1635
- locale: t.locale,
1636
- minimumFractionDigits: a.minimumFractionDigits,
1637
- maximumFractionDigits: a.maximumFractionDigits,
1638
- useGrouping: typeof t.useGrouping == "boolean" ? t.useGrouping : typeof t.thousandsSeparator == "boolean" ? t.thousandsSeparator : !0,
1639
- prefix: i,
1640
- suffix: t.suffix,
1641
- negativeStyle: t.negativeStyle || "minus",
1642
- compact: !!t.compact,
1643
- scale: typeof t.scale == "number" ? t.scale : void 0
1644
- };
1645
- return e === "currency" && t.currency && (s.currency = t.currency), e === "percent" && (s.percentValueMode = t.percentValueMode || "fraction"), re(s);
1646
- }
1647
- function ae(e) {
1648
- return {
1649
- type: "date",
1650
- locale: e.locale || un,
1651
- pattern: e.pattern,
1652
- relative: !!e.relative,
1653
- timezone: e.timezone,
1654
- sourceTimezone: e.sourceTimezone,
1655
- prefix: e.prefix,
1656
- suffix: e.suffix
1657
- };
1658
- }
1659
- function I(e) {
1660
- return e === "millisecond" || e === "second" || e === "minute" || e === "hour" || e === "day";
1661
- }
1662
- function ie(e) {
1663
- const t = N(e.maxUnits);
1664
- return {
1665
- type: "duration",
1666
- inputUnit: I(e.inputUnit) ? e.inputUnit : "second",
1667
- outputStyle: e.outputStyle === "digital" || e.outputStyle === "long" ? e.outputStyle : "compact",
1668
- largestUnit: I(e.largestUnit) ? e.largestUnit : void 0,
1669
- smallestUnit: I(e.smallestUnit) ? e.smallestUnit : "second",
1670
- maxUnits: t,
1671
- prefix: e.prefix,
1672
- suffix: e.suffix,
1673
- negativeStyle: e.negativeStyle || "minus"
1674
- };
1675
- }
1676
- function se(e) {
1677
- return {
1678
- type: "string",
1679
- prefix: e.prefix,
1680
- suffix: e.suffix
1681
- };
1682
- }
1683
- function mn(e, t) {
1684
- if (!e)
1685
- return;
1686
- if (typeof e == "string") {
1687
- const r = e.trim().toLowerCase();
1688
- return r === "currency" ? x(
1689
- "currency",
1690
- { type: "currency" },
1691
- t
1692
- ) : r === "percentage" || r === "percent" ? x(
1693
- "percent",
1694
- {
1695
- type: "percentage",
1696
- percentValueMode: "fraction"
1697
- },
1698
- t
1699
- ) : r === "scientific" ? x(
1700
- "scientific",
1701
- { type: "scientific" },
1702
- t
1703
- ) : r === "date" ? ae({}) : r === "duration" ? ie({}) : r === "string" ? se({}) : r === "number" ? x(
1704
- "number",
1705
- { type: "number" },
1706
- t
1707
- ) : void 0;
1708
- }
1709
- if ("type" in e && e.type === "temporal_bucket") {
1710
- const r = De.safeParse(e);
1711
- return r.success ? r.data : void 0;
1712
- }
1713
- const n = e;
1714
- if ((t == null ? void 0 : t.numericInput) === "canonical") {
1715
- const r = n.type === "percentage" ? { ...n, type: "percent" } : n;
1716
- if (q(r))
1717
- return x(r.type, r, t);
1718
- }
1719
- if (n.type === "percentage")
1720
- return x(
1721
- "percent",
1722
- {
1723
- ...n,
1724
- percentValueMode: n.percentValueMode || "fraction"
1725
- },
1726
- t
1727
- );
1728
- if (n.type === "number" || n.type === "currency" || n.type === "percent" || n.type === "scientific") {
1729
- const r = x(
1730
- n.type,
1731
- n,
1732
- t
1733
- );
1734
- return cn(n) ? { ...r, currency: "USD" } : r;
1735
- }
1736
- if (n.type === "date")
1737
- return ae(n);
1738
- if (n.type === "duration")
1739
- return ie(n);
1740
- if (n.type === "string")
1741
- return se(n);
1742
- }
1743
- function hn(e, t) {
1744
- var a;
1745
- const n = e[e.length - 1];
1746
- if (!n) return "";
1747
- if (n.member.kind === "others") return "Others";
1748
- const r = n.member.value;
1749
- return r === null ? "(Blank)" : ((a = t == null ? void 0 : t.get(n.levelId)) == null ? void 0 : a(r)) ?? (typeof r == "object" ? r.value : String(r));
1750
- }
1751
- function gn(e, t, n) {
1752
- return e === "grand_total" ? n ?? "Grand Total" : e === "subtotal" ? (n == null ? void 0 : n.split(xe).join(t)) ?? `${t} Total` : t;
1753
- }
1754
- function Cn(e, t, n, r) {
1755
- var s;
1756
- const a = e[e.length - 1], i = t === "grand_total" ? n.grand.label : a ? (s = n.levels[a.levelId]) == null ? void 0 : s.label : void 0;
1757
- return gn(t, hn(e, r), i);
1758
- }
1759
- function Fn(e, t, n) {
1760
- return e.kind === "value" ? (t == null ? void 0 : t(e.value)) ?? "" : e.kind === "null" ? n.nullText : n.emptyText;
1761
- }
1762
- function Nn(e) {
1763
- const { path: t, previousPath: n, role: r, repeatLabels: a, levelCount: i } = e;
1764
- return Array.from({ length: i }, (s, o) => {
1765
- const l = t.slice(0, o + 1), f = r === "grand_total" ? o === 0 : r === "subtotal" && o === t.length - 1, u = n && n.length > o && B(n.slice(0, o + 1)) === B(l);
1766
- return {
1767
- path: l,
1768
- total: f,
1769
- visible: f || t.length > o && (a || !u || o === t.length - 1)
1770
- };
1771
- });
1772
- }
1773
- function yn(e, t) {
1774
- return mn(e ?? t, {
1775
- preserveOmittedProperties: !0,
1776
- numericInput: "canonical"
1777
- });
1778
- }
1779
- function Yn(e, t, n) {
1780
- const r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), i = (s, o) => {
1781
- const l = (o === "levels" ? t.levelFormats : t.measureFormats)[s.id], f = s.semanticFormat, u = yn(l, f);
1782
- o === "measures" && r.set(s.id, {
1783
- isNumeric: pe(s.column.dataType) === "number",
1784
- // Use normalized affixes: a redundant percent suffix is already removed.
1785
- hasTextAffixes: !!u && !!("prefix" in u && u.prefix || "suffix" in u && u.suffix)
1786
- });
1787
- const g = (c) => ye(c, void 0, {
1788
- useFormattedValues: !0,
1789
- timezone: n.calendar.tz,
1790
- locale: n.valueFormat.locale,
1791
- absence: t.absence
1792
- });
1793
- if (s.column.temporalBucket) {
1794
- const c = s.column.temporalBucket, h = Pe({
1795
- metadata: c,
1796
- cardFormat: (l == null ? void 0 : l.type) === "temporal_bucket" ? l : void 0,
1797
- semanticFormat: (f == null ? void 0 : f.type) === "temporal_bucket" ? { granularity: c.granularity, format: f } : void 0,
1798
- locale: n.valueFormat.locale,
1799
- styles: { dateStyle: n.valueFormat.dateStyle, dateTime: n.valueFormat.dateTime }
1800
- });
1801
- return (y) => typeof y == "string" ? le({ value: y, metadata: c, format: h.format }) : g(y);
1802
- }
1803
- if (s.column.rawTemporal) {
1804
- const c = Se({
1805
- metadata: s.column.rawTemporal,
1806
- format: ke({
1807
- format: (u == null ? void 0 : u.type) === "date" ? {
1808
- type: "raw_temporal",
1809
- timezone: u.timezone,
1810
- sourceTimezone: u.sourceTimezone,
1811
- presentation: u.pattern ? {
1812
- mode: "pattern",
1813
- dialect: "semaphor_tokens",
1814
- pattern: u.pattern
1815
- } : { mode: "auto" }
1816
- } : void 0,
1817
- preferences: n.valueFormat,
1818
- calendar: n.calendar
1819
- })
1820
- });
1821
- return (h) => {
1822
- if (typeof h != "string") return g(h);
1823
- const y = c(h);
1824
- return y.ok ? y.text : g(h);
1825
- };
1826
- }
1827
- if (q(u)) {
1828
- const c = We(u, n.valueFormat);
1829
- return o === "measures" && a.set(s.id, c), (h) => typeof h == "number" || typeof h == "object" && h !== null ? Ce(h, c) : g(h);
1830
- }
1831
- return (u == null ? void 0 : u.type) === "duration" && o === "measures" && a.set(s.id, u), (u == null ? void 0 : u.type) === "duration" ? (c) => typeof c == "number" || typeof c == "string" || typeof c == "object" && c !== null ? Fe(
1832
- typeof c == "object" ? c.value : c,
1833
- u
1834
- ) : g(c) : (u == null ? void 0 : u.type) === "string" ? (c) => c === null ? g(c) : `${u.prefix ?? ""}${g(c)}${u.suffix ?? ""}` : g;
1835
- };
1836
- return {
1837
- levels: new Map(
1838
- e.levels.map((s) => [s.id, i(s, "levels")])
1839
- ),
1840
- measures: new Map(
1841
- e.measures.map((s) => [s.id, i(s, "measures")])
1842
- ),
1843
- measureSemantics: r,
1844
- measureFormats: a,
1845
- absence: t.absence
1846
- };
1847
- }
1848
- class wn extends Error {
1849
- constructor(n, r) {
1850
- super(`${n}: ${r}`);
1851
- U(this, "deliveryBlocking", !0);
1852
- this.code = n, this.name = "PivotHeaderPresentationError";
1853
- }
1854
- }
1855
- function En(e) {
1856
- var a;
1857
- const t = e.mode ?? "formatted", n = e.members.map((i) => {
1858
- var o;
1859
- if (t === "canonical" || !i.temporalBucket)
1860
- return i.value === null ? "" : String(i.value);
1861
- const s = (o = e.resolveTemporalFormat) == null ? void 0 : o.call(e, i.fieldId);
1862
- if (!s)
1863
- throw new wn(
1864
- "missing_resolved_temporal_format",
1865
- `Missing resolved temporal presentation for pivot field "${i.fieldId}"`
1866
- );
1867
- return le({
1868
- value: i.value,
1869
- metadata: i.temporalBucket,
1870
- format: s
1871
- });
1872
- }), r = ((a = e.metricLabel) == null ? void 0 : a.trim()) || void 0;
1873
- return {
1874
- memberLabels: n,
1875
- ...r ? { metricLabel: r } : {},
1876
- flattenedLabel: [
1877
- ...n,
1878
- ...r ? [r] : []
1879
- ].join(" / ")
1880
- };
1881
- }
1882
- function Ln(e) {
1883
- const t = /* @__PURE__ */ new Map();
1884
- return e.forEach((n) => {
1885
- n.id && t.set(n.id, (t.get(n.id) ?? 0) + 1);
1886
- }), e.flatMap(
1887
- (n) => n.id && (t.get(n.id) ?? 0) > 1 ? [Ne(n)] : []
1888
- );
1889
- }
1890
- export {
1891
- _e as A,
1892
- ae as B,
1893
- ie as C,
1894
- x as D,
1895
- un as E,
1896
- ne as F,
1897
- yn as G,
1898
- gn as H,
1899
- wn as P,
1900
- an as a,
1901
- sn as b,
1902
- Sn as c,
1903
- kn as d,
1904
- ye as e,
1905
- mn as f,
1906
- Pn as g,
1907
- Wn as h,
1908
- Yn as i,
1909
- En as j,
1910
- Ln as k,
1911
- Cn as l,
1912
- hn as m,
1913
- Nn as n,
1914
- Fn as o,
1915
- R as p,
1916
- ge as q,
1917
- vn as r,
1918
- H as s,
1919
- Ut as t,
1920
- P as u,
1921
- de as v,
1922
- F as w,
1923
- m as x,
1924
- qe as y,
1925
- E as z
1926
- };