react-semaphor 0.1.537 → 0.1.538

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 (173) 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-Qgpv6_G8.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-BAqUIFp5.js +7966 -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-BPJo-Fnd.js → dashboard-DTDDFQsS.js} +1 -1
  24. package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bb2QUqOa.js} +764 -740
  25. package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-FpONU8QV.js} +683 -686
  26. package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
  27. package/dist/chunks/dashboard-json-DazPhBU_.js +69 -0
  28. package/dist/chunks/document-dashboard-inputs-D96rlU7S.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-CIhZodVH.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-Bgw32tb3.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-BCGs4-AE.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-BrTkjcod.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-CHHoWhil.js} +65586 -62749
  55. package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-EsayECEC.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-BqA92GkX.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-text-filter.d.ts +7 -0
  101. package/dist/types/lib/print/print-inputs.d.ts +4 -2
  102. package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
  103. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
  104. package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
  105. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  106. package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
  107. package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
  108. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
  109. package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
  110. package/dist/types/lib/stores/editor-store.d.ts +4 -2
  111. package/dist/types/lib/types/token-types.d.ts +11 -0
  112. package/dist/types/lib/utils/card-type-change.d.ts +30 -0
  113. package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
  114. package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
  115. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
  116. package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
  117. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
  118. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  119. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
  120. package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
  121. package/dist/types/shared/assistant-context/index.d.ts +9 -0
  122. package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
  123. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
  124. package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
  125. package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
  126. package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
  127. package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
  128. package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
  129. package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
  130. package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
  131. package/dist/types/shared/assistant-protocol/parts.d.ts +131 -0
  132. package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
  133. package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
  134. package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
  135. package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
  136. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
  137. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
  138. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  139. package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
  140. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
  141. package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
  142. package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
  143. package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
  144. package/dist/types/shared/format-utils/index.d.ts +3 -0
  145. package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
  146. package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
  147. package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
  148. package/dist/types/shared/layouts/index.d.ts +1 -0
  149. package/package.json +12 -2
  150. package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
  151. package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
  152. package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
  153. package/dist/chunks/constants-DNWVy8Y3.js +0 -9
  154. package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
  155. package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
  156. package/dist/chunks/index-DTcTAGGM.js +0 -4101
  157. package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
  158. package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
  159. package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
  160. package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
  161. package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
  162. package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
  163. package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
  164. package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
  165. package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
  166. package/dist/chunks/save-kO6cIaob.js +0 -34
  167. package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
  168. package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
  169. package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
  170. package/dist/chunks/x-CXDkqdur.js +0 -149
  171. package/dist/types/lib/class-utils.d.ts +0 -2
  172. package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
  173. package/dist/types/lib/utils.d.ts +0 -51
@@ -0,0 +1,51 @@
1
+ class o extends Error {
2
+ }
3
+ o.prototype.name = "InvalidTokenError";
4
+ function i(t) {
5
+ return decodeURIComponent(atob(t).replace(/(.)/g, (e, r) => {
6
+ let n = r.charCodeAt(0).toString(16).toUpperCase();
7
+ return n.length < 2 && (n = "0" + n), "%" + n;
8
+ }));
9
+ }
10
+ function s(t) {
11
+ let e = t.replace(/-/g, "+").replace(/_/g, "/");
12
+ switch (e.length % 4) {
13
+ case 0:
14
+ break;
15
+ case 2:
16
+ e += "==";
17
+ break;
18
+ case 3:
19
+ e += "=";
20
+ break;
21
+ default:
22
+ throw new Error("base64 string is not of the correct length");
23
+ }
24
+ try {
25
+ return i(e);
26
+ } catch {
27
+ return atob(e);
28
+ }
29
+ }
30
+ function d(t, e) {
31
+ if (typeof t != "string")
32
+ throw new o("Invalid token specified: must be a string");
33
+ e || (e = {});
34
+ const r = e.header === !0 ? 0 : 1, n = t.split(".")[r];
35
+ if (typeof n != "string")
36
+ throw new o(`Invalid token specified: missing part #${r + 1}`);
37
+ let c;
38
+ try {
39
+ c = s(n);
40
+ } catch (a) {
41
+ throw new o(`Invalid token specified: invalid base64 for part #${r + 1} (${a.message})`);
42
+ }
43
+ try {
44
+ return JSON.parse(c);
45
+ } catch (a) {
46
+ throw new o(`Invalid token specified: invalid json for part #${r + 1} (${a.message})`);
47
+ }
48
+ }
49
+ export {
50
+ d as j
51
+ };
@@ -0,0 +1,16 @@
1
+ import { c as t } from "./x-4f5U2XwU.js";
2
+ /**
3
+ * @license lucide-react v0.453.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */
8
+ const r = t("LayoutGrid", [
9
+ ["rect", { width: "7", height: "7", x: "3", y: "3", rx: "1", key: "1g98yp" }],
10
+ ["rect", { width: "7", height: "7", x: "14", y: "3", rx: "1", key: "6d4xhi" }],
11
+ ["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }],
12
+ ["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }]
13
+ ]);
14
+ export {
15
+ r as L
16
+ };
@@ -1,4 +1,4 @@
1
- import { o as f, q as b } from "./validators-DMSH81OM.js";
1
+ import { o as f, q as b } from "./validators-Ej1DdCXa.js";
2
2
  function m(t) {
3
3
  const { label: i, ...n } = t;
4
4
  return {
@@ -1,37 +1,38 @@
1
- import { r as a, t as s, u as f } from "./validators-DMSH81OM.js";
2
- import "./matrix-operation-contract-BKupLHXL.js";
1
+ import { r as a, t as s, u as f } from "./validators-Ej1DdCXa.js";
2
+ import "./matrix-operation-contract-B8PBF1Gd.js";
3
+ import "./analytics-base-schemas-BFAoRlkU.js";
3
4
  import "zod";
4
5
  function u(i, r = {}) {
5
- var n, o;
6
+ var n, e;
6
7
  if (i.type !== "matrixTable" || !i.config || typeof i.config != "object" || !("matrix" in i.config)) return { status: "absent" };
7
- if ((n = i.sql) != null && n.trim() || (o = i.python) != null && o.trim())
8
+ if ((n = i.sql) != null && n.trim() || (e = i.python) != null && e.trim())
8
9
  return { status: "invalid", error: new Error("A Matrix definition requires a config-only Matrix card.") };
9
10
  if ("matrixIntent" in i.config && i.config.matrixIntent !== void 0) return { status: "invalid", error: new Error("A Matrix card cannot contain two definitions.") };
10
11
  const t = (r.authoringDraft ? a : s).safeParse(i.config.matrix);
11
12
  return t.success ? { status: "ready", config: t.data } : { status: "invalid", error: t.error };
12
13
  }
13
- function l(i) {
14
+ function x(i) {
14
15
  const r = u(i);
15
16
  if (r.status === "invalid") throw r.error;
16
17
  return r.status === "ready" ? r.config : void 0;
17
18
  }
18
19
  function c(i) {
19
- const r = [], e = (t) => {
20
- r.push(t), t.derivedField && Object.values(t.derivedField.inputs).forEach((n) => e(n.field));
20
+ const r = [], o = (t) => {
21
+ r.push(t), t.derivedField && Object.values(t.derivedField.inputs).forEach((n) => o(n.field));
21
22
  };
22
- return [...i.rows, ...i.columns].forEach((t) => e(t.field)), i.measures.forEach((t) => {
23
- t.kind === "aggregate" ? e(t.field) : Object.values(t.definition.inputs).forEach((n) => e(n.field));
23
+ return [...i.rows, ...i.columns].forEach((t) => o(t.field)), i.measures.forEach((t) => {
24
+ t.kind === "aggregate" ? o(t.field) : Object.values(t.definition.inputs).forEach((n) => o(n.field));
24
25
  }), r;
25
26
  }
26
- function x(i) {
27
+ function h(i) {
27
28
  return f([
28
29
  i.source,
29
30
  ...c(i).map((r) => r.source ?? i.source)
30
31
  ]);
31
32
  }
32
33
  export {
33
- x as a,
34
+ h as a,
34
35
  u as i,
35
36
  c as m,
36
- l as r
37
+ x as r
37
38
  };
@@ -0,0 +1,206 @@
1
+ import { m as p, e as g } from "./temporal-bucket-D8JF7zKz.js";
2
+ import { x as h, r as N, y as x, o as f, t as w } from "./validators-Ej1DdCXa.js";
3
+ function A(t, e) {
4
+ const n = M(t);
5
+ let a;
6
+ if (n.date) {
7
+ const s = C(n.date, 2);
8
+ a = U(s.restDateString, s.year);
9
+ }
10
+ if (!a || isNaN(a.getTime()))
11
+ return /* @__PURE__ */ new Date(NaN);
12
+ const o = a.getTime();
13
+ let l = 0, i;
14
+ if (n.time && (l = I(n.time), isNaN(l)))
15
+ return /* @__PURE__ */ new Date(NaN);
16
+ if (n.timezone) {
17
+ if (i = y(n.timezone), isNaN(i))
18
+ return /* @__PURE__ */ new Date(NaN);
19
+ } else {
20
+ const s = new Date(o + l), c = /* @__PURE__ */ new Date(0);
21
+ return c.setFullYear(
22
+ s.getUTCFullYear(),
23
+ s.getUTCMonth(),
24
+ s.getUTCDate()
25
+ ), c.setHours(
26
+ s.getUTCHours(),
27
+ s.getUTCMinutes(),
28
+ s.getUTCSeconds(),
29
+ s.getUTCMilliseconds()
30
+ ), c;
31
+ }
32
+ return new Date(o + l + i);
33
+ }
34
+ const m = {
35
+ dateTimeDelimiter: /[T ]/,
36
+ timeZoneDelimiter: /[Z ]/i,
37
+ timezone: /([Z+-].*)$/
38
+ }, T = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, b = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, v = /^([+-])(\d{2})(?::?(\d{2}))?$/;
39
+ function M(t) {
40
+ const e = {}, r = t.split(m.dateTimeDelimiter);
41
+ let n;
42
+ if (r.length > 2)
43
+ return e;
44
+ if (/:/.test(r[0]) ? n = r[0] : (e.date = r[0], n = r[1], m.timeZoneDelimiter.test(e.date) && (e.date = t.split(m.timeZoneDelimiter)[0], n = t.substr(
45
+ e.date.length,
46
+ t.length
47
+ ))), n) {
48
+ const a = m.timezone.exec(n);
49
+ a ? (e.time = n.replace(a[1], ""), e.timezone = a[1]) : e.time = n;
50
+ }
51
+ return e;
52
+ }
53
+ function C(t, e) {
54
+ const r = new RegExp(
55
+ "^(?:(\\d{4}|[+-]\\d{" + (4 + e) + "})|(\\d{2}|[+-]\\d{" + (2 + e) + "})$)"
56
+ ), n = t.match(r);
57
+ if (!n) return { year: NaN, restDateString: "" };
58
+ const a = n[1] ? parseInt(n[1]) : null, o = n[2] ? parseInt(n[2]) : null;
59
+ return {
60
+ year: o === null ? a : o * 100,
61
+ restDateString: t.slice((n[1] || n[2]).length)
62
+ };
63
+ }
64
+ function U(t, e) {
65
+ if (e === null) return /* @__PURE__ */ new Date(NaN);
66
+ const r = t.match(T);
67
+ if (!r) return /* @__PURE__ */ new Date(NaN);
68
+ const n = !!r[4], a = u(r[1]), o = u(r[2]) - 1, l = u(r[3]), i = u(r[4]), s = u(r[5]) - 1;
69
+ if (n)
70
+ return z(e, i, s) ? S(e, i, s) : /* @__PURE__ */ new Date(NaN);
71
+ {
72
+ const c = /* @__PURE__ */ new Date(0);
73
+ return !Y(e, o, l) || !L(e, a) ? /* @__PURE__ */ new Date(NaN) : (c.setUTCFullYear(e, o, Math.max(a, l)), c);
74
+ }
75
+ }
76
+ function u(t) {
77
+ return t ? parseInt(t) : 1;
78
+ }
79
+ function I(t) {
80
+ const e = t.match(b);
81
+ if (!e) return NaN;
82
+ const r = d(e[1]), n = d(e[2]), a = d(e[3]);
83
+ return F(r, n, a) ? r * p + n * g + a * 1e3 : NaN;
84
+ }
85
+ function d(t) {
86
+ return t && parseFloat(t.replace(",", ".")) || 0;
87
+ }
88
+ function y(t) {
89
+ if (t === "Z") return 0;
90
+ const e = t.match(v);
91
+ if (!e) return 0;
92
+ const r = e[1] === "+" ? -1 : 1, n = parseInt(e[2]), a = e[3] && parseInt(e[3]) || 0;
93
+ return O(n, a) ? r * (n * p + a * g) : NaN;
94
+ }
95
+ function S(t, e, r) {
96
+ const n = /* @__PURE__ */ new Date(0);
97
+ n.setUTCFullYear(t, 0, 4);
98
+ const a = n.getUTCDay() || 7, o = (e - 1) * 7 + r + 1 - a;
99
+ return n.setUTCDate(n.getUTCDate() + o), n;
100
+ }
101
+ const k = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
102
+ function D(t) {
103
+ return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
104
+ }
105
+ function Y(t, e, r) {
106
+ return e >= 0 && e <= 11 && r >= 1 && r <= (k[e] || (D(t) ? 29 : 28));
107
+ }
108
+ function L(t, e) {
109
+ return e >= 1 && e <= (D(t) ? 366 : 365);
110
+ }
111
+ function z(t, e, r) {
112
+ return e >= 1 && e <= 53 && r >= 0 && r <= 6;
113
+ }
114
+ function F(t, e, r) {
115
+ return t === 24 ? e === 0 && r === 0 : r >= 0 && r < 60 && e >= 0 && e < 60 && t >= 0 && t < 25;
116
+ }
117
+ function O(t, e) {
118
+ return e >= 0 && e <= 59;
119
+ }
120
+ function H(t, e) {
121
+ return e.levelLabels[t.id] ?? t.field.label ?? t.field.name;
122
+ }
123
+ function E(t, e) {
124
+ return e.measureLabels[t.id] ?? (t.kind === "aggregate" ? t.field.label ?? t.field.name : t.definition.label);
125
+ }
126
+ function _(t) {
127
+ return w.parse(Z(t));
128
+ }
129
+ function Z(t) {
130
+ const e = h.parse(t), r = (n) => ({
131
+ grand: { visible: !0, position: "after" },
132
+ levels: Object.fromEntries(
133
+ n.map((a) => [
134
+ a.id,
135
+ { visible: !0, position: "before" }
136
+ ])
137
+ )
138
+ });
139
+ return N.parse({
140
+ version: 1,
141
+ spec: e,
142
+ presentation: {
143
+ layout: { kind: "compact" },
144
+ absence: { emptyText: "—", nullText: "" },
145
+ levelLabels: {},
146
+ measureLabels: {},
147
+ levelFormats: {},
148
+ measureFormats: {},
149
+ totals: { rows: r(e.rows), columns: r(e.columns) }
150
+ },
151
+ defaultView: {
152
+ rows: { depth: 0, overrides: [] },
153
+ columns: { depth: e.columns.length > 1 ? 1 : 0, overrides: [] }
154
+ }
155
+ });
156
+ }
157
+ function R(t, e) {
158
+ const r = new Map(t.map((n) => [f(n), n]));
159
+ for (const n of e ?? []) r.set(f(n), n);
160
+ return [...r.values()];
161
+ }
162
+ function j(t) {
163
+ const { spec: e, presentation: r, defaults: n, session: a } = x.parse(t), o = new Map(
164
+ R(e.sorts, a == null ? void 0 : a.sorts).map((i) => [f(i), i])
165
+ );
166
+ for (const i of ["rows", "columns"])
167
+ for (const s of e[i]) {
168
+ const c = {
169
+ axis: i,
170
+ levelId: s.id,
171
+ scope: { kind: "level" },
172
+ target: { kind: "member" },
173
+ direction: "asc",
174
+ nulls: "last"
175
+ };
176
+ o.has(f(c)) || o.set(f(c), c);
177
+ }
178
+ const l = (i, s) => ({
179
+ depth: Math.min(i.depth, Math.max(0, s - 1)),
180
+ // Leaf toggles are valid but have no effect. Collapsed ancestors retain dormant overrides.
181
+ overrides: i.overrides.filter(
182
+ (c) => c.path.length < s
183
+ )
184
+ });
185
+ return {
186
+ spec: { ...e, sorts: [...o.values()] },
187
+ presentation: r,
188
+ view: {
189
+ rows: l((a == null ? void 0 : a.rows) ?? n.rows, e.rows.length),
190
+ columns: l(
191
+ (a == null ? void 0 : a.columns) ?? n.columns,
192
+ e.columns.length
193
+ ),
194
+ sorts: (a == null ? void 0 : a.sorts) ?? []
195
+ }
196
+ };
197
+ }
198
+ export {
199
+ E as a,
200
+ Z as b,
201
+ _ as c,
202
+ H as g,
203
+ R as m,
204
+ A as p,
205
+ j as r
206
+ };