react-semaphor 0.1.560 → 0.1.562

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 +450 -423
  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-CHLxsPfX.js → analytics-base-schemas-BaIQrEzX.js} +221 -188
  7. package/dist/chunks/{assistant-chat-Bu2fFm_I.js → assistant-chat-R_yT8xH4.js} +116 -117
  8. package/dist/chunks/bookmark-impact-D4Kl4amw.js +75 -0
  9. package/dist/chunks/bookmark-state-CWeoGbrx.js +743 -0
  10. package/dist/chunks/{braces-Da41xfUd.js → braces-DzgoQC64.js} +1 -1
  11. package/dist/chunks/{comparison-window-caption-4FNkMrzE.js → comparison-window-caption-D1EUXzaR.js} +550 -425
  12. package/dist/chunks/{context-BgPDzLHZ.js → context-R31TSL5V.js} +1 -1
  13. package/dist/chunks/{dashboard-_MeBuy67.js → dashboard-Bp1y5oun.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-CEi4Pr_v.js → dashboard-briefing-launcher-S5FB3aUW.js} +236 -236
  15. package/dist/chunks/dashboard-controls-CfC_6Ztn.js +2277 -0
  16. package/dist/chunks/{dashboard-json-B1mU_OMa.js → dashboard-json-gYZT7ZQY.js} +5 -5
  17. package/dist/chunks/dates-DFY7Gfss.js +91 -0
  18. package/dist/chunks/{edit-dashboard-visual-0CJN31Y3.js → edit-dashboard-visual-u7OI_g8Q.js} +7119 -7198
  19. package/dist/chunks/filter-reach-copy-CvV7W5dd.js +3965 -0
  20. package/dist/chunks/{filter-value-text-CRC-K_l_.js → filter-value-text-CPwFkrMz.js} +11 -10
  21. package/dist/chunks/global-date-filter-utils-N1kcsOFE.js +16722 -0
  22. package/dist/chunks/{index-DtHidOPV.js → index-CNGkfUp4.js} +269 -264
  23. package/dist/chunks/{layout-grid-BvsH4RY2.js → layout-grid-BM65viQh.js} +1 -1
  24. package/dist/chunks/{list-filter-Dg0otx5E.js → list-filter-BoeLBfL3.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-CM18W8w6.js → matrix-analytical-definition-hEucouWM.js} +4 -4
  26. package/dist/chunks/{matrix-card-HPskLaPy.js → matrix-card-CCh9JjP1.js} +3 -3
  27. package/dist/chunks/{matrix-member-presentation-Bbrfrke4.js → matrix-member-presentation-DsAUbuoL.js} +1 -1
  28. package/dist/chunks/{matrix-operation-contract-WPv4R-H_.js → matrix-operation-contract-DsLdFdSa.js} +365 -349
  29. package/dist/chunks/{metric-comparison-ljMKYZKa.js → metric-comparison-Bnso1cm1.js} +6 -6
  30. package/dist/chunks/{model-change-Ccn1zaxl.js → model-change-T1cRkh3m.js} +1 -1
  31. package/dist/chunks/{palette-Bsh376zO.js → palette-p1XSJFgB.js} +1 -1
  32. package/dist/chunks/pivot-result-contract-expectations-B53jqszr.js +56 -0
  33. package/dist/chunks/{pivot-result-identity-vS9TSh4f.js → pivot-result-identity-Dq5jm-EC.js} +1 -1
  34. package/dist/chunks/{zoned-wall-clock-B1n_WjW3.js → raw-temporal-value-Bqz8wc7L.js} +97 -46
  35. package/dist/chunks/{report-preferences-dialog-BV8L0SeS.js → report-preferences-dialog-C4RAR8u5.js} +68 -63
  36. package/dist/chunks/{report-runtime-context-BZQh9ywy.js → report-runtime-context-BITkNSDa.js} +2 -2
  37. package/dist/chunks/resolve-dashboard-input-context-DaDrZGuA.js +8214 -0
  38. package/dist/chunks/{save-B5EAsgQF.js → save-CHV1B1fL.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-n2Wn11cV.js → saved-dashboard-context-DFYBrE6O.js} +93 -94
  40. package/dist/chunks/{selection-filter-compiler-BKXmyLrS.js → selection-filter-compiler-CUDRnUxc.js} +19 -18
  41. package/dist/chunks/{selection-reducer-D0YnaAD9.js → selection-reducer-Bz5aywT4.js} +1 -1
  42. package/dist/chunks/{semaphor-ready-indicator-XLBLOJ2V.js → semaphor-ready-indicator-Cfuafnem.js} +38188 -40344
  43. package/dist/chunks/{shelf-drop-preview-context-DHMa54a-.js → shelf-drop-preview-context-BR2GEYog.js} +81 -82
  44. package/dist/chunks/{source-entity-resolution-dUG5VWRm.js → source-entity-resolution-DdDVXFB8.js} +6 -6
  45. package/dist/chunks/{switch-ByxH4M7t.js → switch-BW4yXSYs.js} +3 -3
  46. package/dist/chunks/{table-export-sheet-C_GdeTYU.js → table-export-sheet-bSXxGn-v.js} +1 -1
  47. package/dist/chunks/temporal-input-presentation-sk9gqLi6.js +4960 -0
  48. package/dist/chunks/{token-types-CQtXUVMy.js → token-types-BUK06hU2.js} +1 -1
  49. package/dist/chunks/{upload-wbR-NVzq.js → upload-BnmuyPqW.js} +1 -1
  50. package/dist/chunks/{use-create-flow-overlay-state-CEBaLOKC.js → use-create-flow-overlay-state-DyzhWvRJ.js} +6 -6
  51. package/dist/chunks/{validators-CXTneCA4.js → validators-BIM0FE31.js} +774 -895
  52. package/dist/dashboard/index.js +2 -2
  53. package/dist/dashboard-authoring/index.js +2477 -2685
  54. package/dist/data-app-sdk/index.js +30 -30
  55. package/dist/data-app-sdk-adapters/index.js +3 -3
  56. package/dist/data-app-sdk-validation/index.js +25 -25
  57. package/dist/format-utils/index.js +274 -267
  58. package/dist/index.js +59 -59
  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/briefings/attachment-outcomes.d.ts +1 -1
  63. package/dist/types/components/dashboard/dashboard-create-dialog.d.ts +23 -0
  64. package/dist/types/components/dashboard/summary-number-formatter.d.ts +6 -0
  65. package/dist/types/components/index.d.ts +1 -2
  66. package/dist/types/components/surfboard/filter/types.d.ts +3 -1
  67. package/dist/types/index.js +50 -51
  68. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
  69. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +59 -2
  70. package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +5 -0
  71. package/dist/types/lib/interactions/get-click-context-from-table.d.ts +45 -0
  72. package/dist/types/lib/print/print-inputs.d.ts +2 -1
  73. package/dist/types/lib/query-context/assemble-card-query.d.ts +2 -0
  74. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -0
  75. package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
  76. package/dist/types/lib/stores/editor-store.d.ts +9 -1
  77. package/dist/types/lib/stores/table-actions.d.ts +0 -2
  78. package/dist/types/lib/types/common-types.d.ts +6 -0
  79. package/dist/types/lib/types/explorer-types.d.ts +7 -1
  80. package/dist/types/lib/types/interaction-types.d.ts +3 -1
  81. package/dist/types/lib/types/token-types.d.ts +0 -1
  82. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +13 -1
  83. package/dist/types/shared/analytics-protocol/contracts.d.ts +9 -40
  84. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
  85. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +12 -2
  86. package/dist/types/shared/analytics-protocol/validators.d.ts +1 -2
  87. package/dist/types/shared/assistant-protocol/context.d.ts +8 -8
  88. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +7 -1
  89. package/dist/types/shared/dashboard-authoring/card-settings/apply-card-settings.d.ts +11 -0
  90. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +76 -0
  91. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
  92. package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
  93. package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
  94. package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
  95. package/dist/types/shared/dashboard-authoring/card-settings/column-polarity-write.d.ts +5 -0
  96. package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
  97. package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
  98. package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
  99. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +17 -0
  100. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +117 -0
  101. package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
  102. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
  103. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
  104. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +51 -0
  105. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +30 -0
  106. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  107. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
  108. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +3402 -4313
  109. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +49 -8
  110. package/dist/types/shared/dashboard-authoring/changes/field-ref.d.ts +91 -0
  111. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +7 -0
  112. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +52 -2
  113. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-create.d.ts +26 -0
  114. package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +2 -1
  115. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +1 -8
  116. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +20 -20
  117. package/dist/types/shared/dashboard-authoring/detail-date-presentation.d.ts +9 -0
  118. package/dist/types/shared/dashboard-authoring/index.d.ts +11 -6
  119. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
  120. package/dist/types/shared/dashboard-authoring/measure-calculations/apply.d.ts +8 -0
  121. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +16 -0
  122. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +41 -0
  123. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +17 -0
  124. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +63 -0
  125. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +16 -0
  126. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +79 -0
  127. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +934 -0
  128. package/dist/types/shared/dashboard-authoring/measure-calculations/sentences.d.ts +4 -0
  129. package/dist/types/shared/dashboard-authoring/measure-calculations/set.d.ts +11 -0
  130. package/dist/types/shared/dashboard-authoring/measure-calculations/transform.d.ts +63 -0
  131. package/dist/types/shared/dashboard-authoring/measure-calculations/window-transforms.d.ts +60 -0
  132. package/dist/types/shared/dashboard-authoring/new-card.d.ts +12 -1
  133. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +2 -1
  134. package/dist/types/shared/dashboard-authoring/operations/operation-sentences.d.ts +46 -0
  135. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +73 -3
  136. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -3
  137. package/dist/types/shared/dashboard-authoring/text-card-words/blocks.d.ts +58 -0
  138. package/dist/types/shared/dashboard-authoring/text-card-words/index.d.ts +55 -0
  139. package/dist/types/shared/dashboard-authoring/text-card-words/rich-content.d.ts +18 -0
  140. package/dist/types/shared/dashboard-viewer/bookmark-impact.d.ts +33 -0
  141. package/dist/types/shared/format-utils/document-print.d.ts +82 -0
  142. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +8 -1
  143. package/dist/types/shared/format-utils/index.d.ts +1 -0
  144. package/dist/types/shared/format-utils/raw-temporal.d.ts +18 -7
  145. package/dist/types/shared/temporal/index.d.ts +1 -0
  146. package/dist/types/shared/temporal/raw-temporal-equality.d.ts +19 -0
  147. package/dist/types/shared/temporal/raw-temporal-value.d.ts +29 -0
  148. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +6 -0
  149. package/package.json +2 -2
  150. package/dist/chunks/bookmark-state-BFY9oNmr.js +0 -111
  151. package/dist/chunks/custom-visual-inputs-Dz-enUNR.js +0 -292
  152. package/dist/chunks/dashboard-controls-Bi7fyG-4.js +0 -2339
  153. package/dist/chunks/document-dashboard-inputs-CkWfDB8c.js +0 -3010
  154. package/dist/chunks/filter-reach-copy-BF4w4kI2.js +0 -3738
  155. package/dist/chunks/global-date-filter-utils-D8365uPH.js +0 -12889
  156. package/dist/chunks/pivot-result-contract-expectations-Bl5suy4-.js +0 -1832
  157. package/dist/chunks/raw-temporal-presentation-BHm7s-hz.js +0 -540
  158. package/dist/chunks/resolve-dashboard-input-context-CAMiWvyR.js +0 -5280
  159. package/dist/chunks/table-settings-Imz0FgWi.js +0 -637
  160. package/dist/chunks/temporal-input-presentation-uvNK_tM0.js +0 -3228
  161. package/dist/types/components/dashboard/ai-dashboard-create-dialog.d.ts +0 -38
  162. package/dist/types/components/dashboard/dashboard-create-template.d.ts +0 -10
  163. package/dist/types/lib/hooks/use-dashboard-authoring.d.ts +0 -49
  164. package/dist/types/shared/dashboard-authoring/artifact-compiler.d.ts +0 -6
  165. package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -106
  166. package/dist/types/shared/dashboard-authoring/protocol-adapter.d.ts +0 -7
  167. package/dist/types/shared/dashboard-authoring/source-matching.d.ts +0 -34
  168. package/dist/types/shared/dashboard-authoring/validators.d.ts +0 -2
@@ -1,5 +1,5 @@
1
- import { T as m, a as g, b as C } from "./analytics-base-schemas-CHLxsPfX.js";
2
- import { r as k } from "./validators-CXTneCA4.js";
1
+ import { T as m, a as g, b as C } from "./analytics-base-schemas-BaIQrEzX.js";
2
+ import { r as k } from "./validators-BIM0FE31.js";
3
3
  function w(e) {
4
4
  const r = C.safeParse(e);
5
5
  return r.success ? { ok: !0, value: r.data } : {
@@ -482,10 +482,10 @@ function B(e) {
482
482
  export {
483
483
  A as C,
484
484
  h as D,
485
- T as a,
486
- N as b,
487
- _ as c,
488
- E as d,
485
+ N as a,
486
+ _ as b,
487
+ E as c,
488
+ T as d,
489
489
  O as e,
490
490
  L as f,
491
491
  P as g,
@@ -1,4 +1,4 @@
1
- import { A as c, h as k, m as f } from "./context-BgPDzLHZ.js";
1
+ import { A as c, h as k, m as f } from "./context-R31TSL5V.js";
2
2
  function g(e, t) {
3
3
  return e.role === t.role && e.name === t.name && e.aggregate === t.aggregate && e.granularity === t.granularity;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { c } from "./switch-ByxH4M7t.js";
1
+ import { c } from "./switch-BW4yXSYs.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -0,0 +1,56 @@
1
+ var c = Object.defineProperty;
2
+ var d = (r, e, t) => e in r ? c(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var l = (r, e, t) => d(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { ac as u } from "./temporal-input-presentation-sk9gqLi6.js";
5
+ import "./validators-BIM0FE31.js";
6
+ import "./matrix-operation-contract-DsLdFdSa.js";
7
+ import { r as v } from "./metric-comparison-Bnso1cm1.js";
8
+ import "./analytics-base-schemas-BaIQrEzX.js";
9
+ import "zod";
10
+ class m extends Error {
11
+ constructor(t, a) {
12
+ super(`${t}: ${a}`);
13
+ l(this, "deliveryBlocking", !0);
14
+ this.code = t, this.name = "PivotHeaderPresentationError";
15
+ }
16
+ }
17
+ function k(r) {
18
+ var i;
19
+ const e = r.mode ?? "formatted", t = r.members.map((o) => {
20
+ var n;
21
+ if (e === "canonical" || !o.temporalBucket)
22
+ return o.value === null ? "" : String(o.value);
23
+ const s = (n = r.resolveTemporalFormat) == null ? void 0 : n.call(r, o.fieldId);
24
+ if (!s)
25
+ throw new m(
26
+ "missing_resolved_temporal_format",
27
+ `Missing resolved temporal presentation for pivot field "${o.fieldId}"`
28
+ );
29
+ return u({
30
+ value: o.value,
31
+ metadata: o.temporalBucket,
32
+ format: s
33
+ });
34
+ }), a = ((i = r.metricLabel) == null ? void 0 : i.trim()) || void 0;
35
+ return {
36
+ memberLabels: t,
37
+ ...a ? { metricLabel: a } : {},
38
+ flattenedLabel: [
39
+ ...t,
40
+ ...a ? [a] : []
41
+ ].join(" / ")
42
+ };
43
+ }
44
+ function B(r) {
45
+ const e = /* @__PURE__ */ new Map();
46
+ return r.forEach((t) => {
47
+ t.id && e.set(t.id, (e.get(t.id) ?? 0) + 1);
48
+ }), r.flatMap(
49
+ (t) => t.id && (e.get(t.id) ?? 0) > 1 ? [v(t)] : []
50
+ );
51
+ }
52
+ export {
53
+ m as P,
54
+ B as d,
55
+ k as p
56
+ };
@@ -1,7 +1,7 @@
1
1
  var y = Object.defineProperty;
2
2
  var c = (i, t, e) => t in i ? y(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
3
  var a = (i, t, e) => c(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { v as u } from "./metric-comparison-ljMKYZKa.js";
4
+ import { v as u } from "./metric-comparison-Bnso1cm1.js";
5
5
  class l extends Error {
6
6
  constructor(e) {
7
7
  super(`missing_pivot_member_identity: ${e}`);
@@ -1,22 +1,22 @@
1
- var w = Object.defineProperty;
2
- var L = (t, e, r) => e in t ? w(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var m = (t, e, r) => L(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { R as v } from "./analytics-base-schemas-CHLxsPfX.js";
1
+ var b = Object.defineProperty;
2
+ var _ = (t, e, r) => e in t ? b(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var f = (t, e, r) => _(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { R as v } from "./analytics-base-schemas-BaIQrEzX.js";
5
5
  class s extends Error {
6
6
  constructor(r) {
7
7
  super(r);
8
- m(this, "code");
8
+ f(this, "code");
9
9
  this.name = "RawTemporalMetadataContractError", this.code = v.invalidMetadata;
10
10
  }
11
11
  }
12
- function T(t) {
12
+ function R(t) {
13
13
  if (t === null || typeof t != "object" || Array.isArray(t))
14
14
  return !1;
15
15
  const e = Object.getPrototypeOf(t);
16
16
  return e === null || e === Object.prototype;
17
17
  }
18
- function b(t) {
19
- if (!T(t))
18
+ function g(t) {
19
+ if (!R(t))
20
20
  throw new s(
21
21
  "Raw temporal metadata must be an object."
22
22
  );
@@ -38,7 +38,7 @@ function b(t) {
38
38
  valueKind: t.valueKind
39
39
  };
40
40
  }
41
- function O(t, e) {
41
+ function S(t, e) {
42
42
  if (!t.rawTemporal) {
43
43
  if (e.metadataRequired)
44
44
  throw new s(
@@ -50,22 +50,22 @@ function O(t, e) {
50
50
  throw new s(
51
51
  "A result column cannot carry both raw and grouped temporal metadata."
52
52
  );
53
- const r = b(t.rawTemporal), o = r.valueKind === "date" ? "date" : "datetime";
54
- if (t.dataType !== o)
53
+ const r = g(t.rawTemporal), n = r.valueKind === "date" ? "date" : "datetime";
54
+ if (t.dataType !== n)
55
55
  throw new s(
56
- `${r.valueKind} raw temporal values require dataType ${o}.`
56
+ `${r.valueKind} raw temporal values require dataType ${n}.`
57
57
  );
58
58
  return r;
59
59
  }
60
- function R(t) {
60
+ function $(t) {
61
61
  if (!t) return null;
62
- for (const [e, r] of Object.entries(_))
62
+ for (const [e, r] of Object.entries(C))
63
63
  if (k(r, t))
64
64
  return e;
65
65
  return null;
66
66
  }
67
67
  const l = (t, e) => Math.abs(t) === 1 ? e : `${e}s`;
68
- function y(t, e) {
68
+ function p(t, e) {
69
69
  if (t === 0)
70
70
  return e === "day" ? "today" : `this ${e}`;
71
71
  if (t === -1)
@@ -75,18 +75,18 @@ function y(t, e) {
75
75
  const r = Math.abs(t);
76
76
  return t < 0 ? `${r} ${l(r, e)} ago` : `${r} ${l(r, e)} ahead`;
77
77
  }
78
- const g = (t) => t.charAt(0).toUpperCase() + t.slice(1);
79
- function f(t, e) {
80
- return g(y(t, e));
78
+ const N = (t) => t.charAt(0).toUpperCase() + t.slice(1);
79
+ function h(t, e) {
80
+ return N(p(t, e));
81
81
  }
82
- function $(t) {
82
+ function A(t) {
83
83
  if (!t) return null;
84
84
  if (t.mode === "last" && t.relativeTo === "latest_data") {
85
- const { relativeTo: r, ...o } = t, a = $(o);
85
+ const { relativeTo: r, ...n } = t, a = A(n);
86
86
  return a ? `${a} of data` : null;
87
87
  }
88
- const e = R(t);
89
- return e || (t.mode === "this" ? t.boundary === "first_day" ? "First day of the month" : t.boundary === "last_day" ? "Last day of the month" : `This ${t.unit}${t.toDate ? " to date" : ""}` : t.mode === "previous" ? `Last ${t.unit}` : t.mode === "last" ? `Last ${t.n} ${l(t.n, t.unit)}` : t.mode === "between" ? t.from === t.to ? f(t.from, t.unit) : `${f(t.from, t.unit)} to ${y(
88
+ const e = $(t);
89
+ return e || (t.mode === "this" ? t.boundary === "first_day" ? "First day of the month" : t.boundary === "last_day" ? "Last day of the month" : `This ${t.unit}${t.toDate ? " to date" : ""}` : t.mode === "previous" ? `Last ${t.unit}` : t.mode === "last" ? `Last ${t.n} ${l(t.n, t.unit)}` : t.mode === "between" ? t.from === t.to ? h(t.from, t.unit) : `${h(t.from, t.unit)} to ${p(
90
90
  t.to,
91
91
  t.unit
92
92
  )}` : null);
@@ -94,7 +94,7 @@ function $(t) {
94
94
  function k(t, e) {
95
95
  return !(t.mode !== e.mode || t.unit !== e.unit || t.mode === "last" && e.mode === "last" && (t.n !== e.n || !!t.complete != !!e.complete || t.relativeTo !== e.relativeTo) || t.mode === "this" && e.mode === "this" && (!!t.toDate != !!e.toDate || t.boundary !== e.boundary) || t.mode === "between" && e.mode === "between" && (t.from !== e.from || t.to !== e.to));
96
96
  }
97
- const _ = {
97
+ const C = {
98
98
  // Sub-day presets
99
99
  "Last 30 minutes": { mode: "last", n: 30, unit: "minute" },
100
100
  "Last 1 hour": { mode: "last", n: 1, unit: "hour" },
@@ -135,9 +135,9 @@ const _ = {
135
135
  // Year presets
136
136
  "This year": { mode: "this", unit: "year" },
137
137
  "Last year": { mode: "previous", unit: "year" }
138
- }, c = /* @__PURE__ */ new Map();
139
- function C(t, e) {
140
- let r = c.get(e);
138
+ }, y = /* @__PURE__ */ new Map();
139
+ function D(t, e) {
140
+ let r = y.get(e);
141
141
  r || (r = new Intl.DateTimeFormat("en-CA", {
142
142
  calendar: "gregory",
143
143
  numberingSystem: "latn",
@@ -149,10 +149,10 @@ function C(t, e) {
149
149
  minute: "2-digit",
150
150
  second: "2-digit",
151
151
  hourCycle: "h23"
152
- }), c.set(e, r));
153
- const o = r.formatToParts(t), a = (i) => {
154
- var n;
155
- return Number((n = o.find((u) => u.type === i)) == null ? void 0 : n.value);
152
+ }), y.set(e, r));
153
+ const n = r.formatToParts(t), a = (o) => {
154
+ var i;
155
+ return Number((i = n.find((d) => d.type === o)) == null ? void 0 : i.value);
156
156
  };
157
157
  return {
158
158
  year: a("year"),
@@ -163,29 +163,80 @@ function C(t, e) {
163
163
  second: a("second")
164
164
  };
165
165
  }
166
- function p(t) {
166
+ function c(t) {
167
167
  const e = /* @__PURE__ */ new Date(0);
168
168
  return e.setUTCFullYear(t.year, t.month - 1, t.day), e.setUTCHours(t.hour, t.minute, t.second, t.millisecond ?? 0), e.getTime();
169
169
  }
170
- function d(t, e) {
170
+ function u(t, e) {
171
171
  const r = t - (t % 1e3 + 1e3) % 1e3;
172
- return p(C(new Date(r), e)) - r;
172
+ return c(D(new Date(r), e)) - r;
173
+ }
174
+ const m = 864e5;
175
+ function j(t, e) {
176
+ const r = M(t, e);
177
+ if (r.length) return r[0];
178
+ const n = c(t);
179
+ return new Date(n - u(n - m, e));
180
+ }
181
+ function M(t, e) {
182
+ const r = c(t), n = u(r - m, e), a = u(r + m, e);
183
+ return [.../* @__PURE__ */ new Set([n, a])].map((o) => r - o).filter((o) => u(o, e) === r - o).sort((o, i) => o - i).map((o) => new Date(o));
184
+ }
185
+ const w = /^(\d{4})-(\d{2})-(\d{2})$/, T = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?$/, L = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/;
186
+ function F(t) {
187
+ if (w.test(t)) return "date";
188
+ if (L.test(t)) return "instant";
189
+ if (T.test(t)) return "wall_datetime";
173
190
  }
174
- const h = 864e5;
175
- function A(t, e) {
176
- const r = p(t), o = d(r - h, e), a = d(r + h, e), i = [.../* @__PURE__ */ new Set([o, a])].map((n) => r - n).filter((n) => d(n, e) === r - n).sort((n, u) => n - u);
177
- return new Date(i.length ? i[0] : r - o);
191
+ function E(t) {
192
+ return t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0);
193
+ }
194
+ function O(t, e) {
195
+ return e === 2 ? E(t) ? 29 : 28 : [4, 6, 9, 11].includes(e) ? 30 : 31;
196
+ }
197
+ function K(t) {
198
+ return t.year >= 1 && t.year <= 9999 && t.month >= 1 && t.month <= 12 && t.day >= 1 && t.day <= O(t.year, t.month) && t.hour >= 0 && t.hour <= 23 && t.minute >= 0 && t.minute <= 59 && t.second >= 0 && t.second <= 59;
199
+ }
200
+ function q(t) {
201
+ return {
202
+ year: Number(t[1]),
203
+ month: Number(t[2]),
204
+ day: Number(t[3]),
205
+ hour: Number(t[4] ?? 0),
206
+ minute: Number(t[5] ?? 0),
207
+ second: Number(t[6] ?? 0),
208
+ fraction: t[7] ?? ""
209
+ };
210
+ }
211
+ function W(t, e) {
212
+ const r = e === "date" ? t.match(w) : e === "wall_datetime" ? t.match(T) : t.match(L);
213
+ if (!r) return { status: "invalid_shape" };
214
+ const n = q(r);
215
+ if (!K(n)) return { status: "out_of_range" };
216
+ if (e === "instant") {
217
+ const a = r[8];
218
+ if (a && a !== "Z") {
219
+ const [i, d] = a.slice(1).split(":").map(Number);
220
+ if (i > 23 || d > 59) return { status: "out_of_range" };
221
+ }
222
+ const o = new Date(t.replace(" ", "T"));
223
+ return Number.isNaN(o.getTime()) ? { status: "out_of_range" } : { status: "valid", fields: n, instant: o };
224
+ }
225
+ return { status: "valid", fields: n };
178
226
  }
179
227
  export {
180
228
  s as R,
181
- f as a,
182
- _ as b,
183
- A as c,
184
- R as f,
185
- $ as g,
186
- b as p,
229
+ W as a,
230
+ h as b,
231
+ F as c,
232
+ C as d,
233
+ D as e,
234
+ $ as f,
235
+ A as g,
236
+ j as h,
237
+ g as p,
187
238
  k as r,
188
- O as v,
189
- p as w,
190
- C as z
239
+ S as v,
240
+ c as w,
241
+ M as z
191
242
  };