react-semaphor 0.1.569 → 0.1.570

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 (112) hide show
  1. package/dist/appearance/index.js +6 -3
  2. package/dist/appearance-runtime/index.js +1 -1
  3. package/dist/assistant-context/index.js +1 -1
  4. package/dist/brand-studio/index.js +570 -432
  5. package/dist/briefings/index.js +2 -2
  6. package/dist/chunks/appearance-context-BwBp25ZG.js +162 -0
  7. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +80 -0
  8. package/dist/chunks/assistant-chat-B-Ddyy8b.js +5940 -0
  9. package/dist/chunks/{bookmark-impact-Czg6FGt5.js → bookmark-impact-DCYD-6Fr.js} +1 -1
  10. package/dist/chunks/brand-B4BdpAB_.js +54 -0
  11. package/dist/chunks/{card-filter-builder-BS982X7x.js → card-filter-builder-0VvKmRst.js} +72 -72
  12. package/dist/chunks/{comparison-window-caption-lLTgzOkM.js → comparison-window-caption-PtcDWvkN.js} +2 -2
  13. package/dist/chunks/{dashboard-BiYSbxZv.js → dashboard-DxGIr1vZ.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-Bdj7luOr.js → dashboard-briefing-launcher-B-quOOOQ.js} +183 -182
  15. package/dist/chunks/{dashboard-controls-TViDsnb8.js → dashboard-controls-Caodx80b.js} +285 -280
  16. package/dist/chunks/{dashboard-json-Dg9dQd9U.js → dashboard-json-Ct-AGDHF.js} +3 -3
  17. package/dist/chunks/{dates-BsPrWZIP.js → dates-B9mL8BHE.js} +13 -12
  18. package/dist/chunks/edit-Bpdh_P_a.js +226 -0
  19. package/dist/chunks/{edit-dashboard-visual-C6hoIeEJ.js → edit-dashboard-visual-DeDTuYB5.js} +2256 -2268
  20. package/dist/chunks/{filter-reach-copy-hcQ4os0u.js → filter-reach-copy-BSY33ro5.js} +1425 -1282
  21. package/dist/chunks/{filter-value-text-CVxEEDVl.js → filter-value-text-DvvSNlho.js} +1 -1
  22. package/dist/chunks/index-BVKzKl5d.js +90 -0
  23. package/dist/chunks/{index-RNaTnE3m.js → index-CV_Kzou0.js} +233 -223
  24. package/dist/chunks/{index-G4q89J6O.js → index-y3HUzRNk.js} +61 -60
  25. package/dist/chunks/{layout-grid-BIcoFfdS.js → layout-grid-8rR-LPTk.js} +1 -1
  26. package/dist/chunks/{list-filter-C6tYkHyv.js → list-filter-C1-uTgjR.js} +1 -1
  27. package/dist/chunks/paintbrush-aR17Z3C9.js +27 -0
  28. package/dist/chunks/{palette-NjHOE_6B.js → palette-a5FCZKFI.js} +1 -1
  29. package/dist/chunks/{_commonjsHelpers-Bid1ZNYj.js → pickers-DkqmtnTL.js} +179 -166
  30. package/dist/chunks/{pivot-result-contract-expectations-DkmueDTW.js → pivot-result-contract-expectations-C-HnUKYe.js} +1 -1
  31. package/dist/chunks/{report-preferences-dialog-Xc8_GFju.js → report-preferences-dialog-Yvhv3WX2.js} +79 -79
  32. package/dist/chunks/{resolve-dashboard-input-context-KqvcLcTM.js → resolve-dashboard-input-context-Lkbwycwe.js} +5179 -5391
  33. package/dist/chunks/resolver-DG_tfEpt.js +156 -0
  34. package/dist/chunks/{save-C6VmEJTA.js → save-D985VvYp.js} +1 -1
  35. package/dist/chunks/{saved-dashboard-context-BeXXyoD4.js → saved-dashboard-context-DC_TEd6y.js} +3 -3
  36. package/dist/chunks/schema-C9NPiIru.js +2568 -0
  37. package/dist/chunks/{semaphor-ready-indicator-BNkaANsG.js → semaphor-ready-indicator-ByFvqHEO.js} +33935 -34031
  38. package/dist/chunks/{shelf-drop-preview-context-C_issPBA.js → shelf-drop-preview-context-CjoVaK6J.js} +50 -50
  39. package/dist/chunks/{stored-dashboard-B6_StAty.js → stored-dashboard-C0hekXiI.js} +189 -188
  40. package/dist/chunks/{code-editor-BsxHzm9u.js → style-sheet-parts-C7qGZuH1.js} +2400 -2036
  41. package/dist/chunks/{table-export-sheet-BWP2joD1.js → table-export-sheet-CP8zSOhj.js} +1 -1
  42. package/dist/chunks/{temporal-input-presentation-scSWQXAB.js → temporal-input-presentation-CqbJjIuu.js} +14 -14
  43. package/dist/chunks/{upload-BRW4Mwrd.js → upload-CiGNKJ_0.js} +1 -1
  44. package/dist/chunks/{variable-draft-BQ3OMjvy.js → variable-draft-9-huI1h4.js} +2 -2
  45. package/dist/dashboard/index.js +1 -1
  46. package/dist/dashboard-authoring/index.js +1911 -1859
  47. package/dist/format-utils/index.js +8 -8
  48. package/dist/index.js +332 -335
  49. package/dist/layouts/index.js +1 -1
  50. package/dist/style.css +1 -1
  51. package/dist/surfboard/index.js +1 -1
  52. package/dist/types/appearance/index.d.ts +1 -0
  53. package/dist/types/brand-studio/brand-studio-draft.d.ts +7 -0
  54. package/dist/types/brand-studio/index.d.ts +1 -1
  55. package/dist/types/components/briefings/briefing-author/run-model.d.ts +1 -2
  56. package/dist/types/components/providers/appearance-runtime-provider.d.ts +4 -1
  57. package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -2
  58. package/dist/types/components/sharing-and-management/utils/types.d.ts +0 -72
  59. package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +0 -1
  60. package/dist/types/components/visual/data-table/types/data-table.d.ts +0 -9
  61. package/dist/types/components/visual/data-table/utils/pagination-utils.d.ts +0 -19
  62. package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -1
  63. package/dist/types/lib/appearance/aliases.d.ts +42 -0
  64. package/dist/types/lib/appearance/compiler.d.ts +6 -0
  65. package/dist/types/lib/appearance/defaults.d.ts +6 -0
  66. package/dist/types/lib/appearance/index.d.ts +2 -0
  67. package/dist/types/lib/appearance/normalize-organization.d.ts +17 -0
  68. package/dist/types/lib/appearance/resolver.d.ts +2 -2
  69. package/dist/types/lib/appearance/types.d.ts +38 -1
  70. package/dist/types/lib/charts/types.d.ts +6 -2
  71. package/dist/types/lib/dashboard/semantic-dataset-references.d.ts +0 -1
  72. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +0 -2
  73. package/dist/types/lib/dashboard-variables/types.d.ts +1 -6
  74. package/dist/types/lib/download-pdf.d.ts +0 -1
  75. package/dist/types/lib/hooks/use-dashboard.d.ts +3 -4
  76. package/dist/types/lib/stores/dashboard-store.d.ts +15 -6
  77. package/dist/types/lib/stores/editor-store.d.ts +0 -1
  78. package/dist/types/lib/stores/table-actions.d.ts +0 -1
  79. package/dist/types/lib/table-formatting/table-formatting-css.d.ts +0 -5
  80. package/dist/types/lib/types/common-types.d.ts +3 -2
  81. package/dist/types/lib/types/summary-types.d.ts +0 -5
  82. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +4 -4
  83. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +10 -10
  84. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +68 -68
  85. package/dist/types/shared/assistant-protocol/context.d.ts +18 -18
  86. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +212 -42
  87. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +4 -1
  88. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +9 -0
  89. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +30 -30
  90. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +4 -4
  91. package/dist/types/shared/dashboard-authoring/dashboard-style/bounds.d.ts +17 -0
  92. package/dist/types/shared/dashboard-authoring/dashboard-style/brand.d.ts +20 -0
  93. package/dist/types/shared/dashboard-authoring/dashboard-style/edit-words.d.ts +7 -0
  94. package/dist/types/shared/dashboard-authoring/dashboard-style/edit.d.ts +19 -0
  95. package/dist/types/shared/dashboard-authoring/dashboard-style/index.d.ts +15 -0
  96. package/dist/types/shared/dashboard-authoring/dashboard-style/layers.d.ts +19 -0
  97. package/dist/types/shared/dashboard-authoring/dashboard-style/legacy.d.ts +21 -0
  98. package/dist/types/shared/dashboard-authoring/dashboard-style/parse.d.ts +18 -0
  99. package/dist/types/shared/dashboard-authoring/dashboard-style/pickers.d.ts +12 -0
  100. package/dist/types/shared/dashboard-authoring/dashboard-style/types.d.ts +122 -0
  101. package/dist/types/shared/dashboard-authoring/dashboard-style/view.d.ts +10 -0
  102. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  103. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +11 -0
  104. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +20 -0
  105. package/dist/types/shared/format-utils/matrix-continuation.d.ts +7 -7
  106. package/package.json +6 -3
  107. package/dist/chunks/appearance-context-DEYtWinQ.js +0 -126
  108. package/dist/chunks/appearance-runtime-provider-B-M8gwlZ.js +0 -81
  109. package/dist/chunks/assistant-chat-Dzf2Mbph.js +0 -8847
  110. package/dist/chunks/color-CJvdlFM_.js +0 -2162
  111. package/dist/chunks/index-CLIro-EG.js +0 -425
  112. package/dist/types/components/sharing-and-management/utils/group-types.d.ts +0 -105
@@ -1,8 +1,8 @@
1
1
  import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
2
  import { useMemo as u, useState as f, useRef as b, useEffect as p } from "react";
3
- import { u as o } from "./semaphor-ready-indicator-BNkaANsG.js";
4
- import { B as S, X as N, C as D } from "./code-editor-BsxHzm9u.js";
5
- import { c as J } from "./_commonjsHelpers-Bid1ZNYj.js";
3
+ import { u as o } from "./semaphor-ready-indicator-ByFvqHEO.js";
4
+ import { B as S, X as N, C as D } from "./style-sheet-parts-C7qGZuH1.js";
5
+ import { c as J } from "./pickers-DkqmtnTL.js";
6
6
  import "./validators-B8fpdinG.js";
7
7
  import "./matrix-operation-contract-DCVinw1o.js";
8
8
  import "./analytics-base-schemas-BaIQrEzX.js";
@@ -1,16 +1,17 @@
1
- import { h as D, d as F, r as b, a as f, e as g } from "./resolve-dashboard-input-context-KqvcLcTM.js";
2
- import { d as h } from "./filter-reach-copy-hcQ4os0u.js";
1
+ import { h as D, d as F, r as b, a as f, e as g } from "./resolve-dashboard-input-context-Lkbwycwe.js";
2
+ import { d as h } from "./filter-reach-copy-BSY33ro5.js";
3
3
  import "./validators-B8fpdinG.js";
4
4
  import "./matrix-operation-contract-DCVinw1o.js";
5
5
  import "./analytics-base-schemas-BaIQrEzX.js";
6
6
  import "zod";
7
- import "./temporal-input-presentation-scSWQXAB.js";
7
+ import "./temporal-input-presentation-CqbJjIuu.js";
8
8
  import "../value-format-preferences/index.js";
9
9
  import { A as y } from "./bookmark-state-CflS88gq.js";
10
- import "./index-RNaTnE3m.js";
10
+ import "./schema-C9NPiIru.js";
11
+ import "./index-CV_Kzou0.js";
11
12
  import "./context-R31TSL5V.js";
12
- import { p as C, r as N } from "./stored-dashboard-B6_StAty.js";
13
- import { g as q } from "./saved-dashboard-context-BeXXyoD4.js";
13
+ import { p as C, r as N } from "./stored-dashboard-C0hekXiI.js";
14
+ import { g as q } from "./saved-dashboard-context-DC_TEd6y.js";
14
15
  function T(n, e) {
15
16
  var s;
16
17
  if (e.status === "blocked" || (s = n.sql) != null && s.trim()) return !1;
@@ -21,7 +22,7 @@ function T(n, e) {
21
22
  );
22
23
  return e.cardFilterValues.some((t) => {
23
24
  const a = e.queryFilterDefinitions.find(
24
- (d) => d.id === t.filterId
25
+ (o) => o.id === t.filterId
25
26
  );
26
27
  if (!D(t)) return !1;
27
28
  if (!(i.has(t.filterId) || (a == null ? void 0 : a.kind) === "global-date"))
@@ -45,7 +46,7 @@ function w(n, e, i) {
45
46
  const s = e.qualifiedFieldName, t = e.qualifiedEntityName, a = t && e.name ? `${t}.${e.name}` : s;
46
47
  return n.some((r) => {
47
48
  if (!(f(r.dataType || "") === "date")) return !1;
48
- const d = h(r, i), o = d.split("."), u = o[o.length - 1] || d, p = o.length > 1 ? o.slice(0, -1).join(".") : void 0, c = r.qualifiedTableName || p, m = c ? `${c}.${u}` : void 0;
49
+ const o = h(r, i), d = o.split("."), u = d[d.length - 1] || o, p = d.length > 1 ? d.slice(0, -1).join(".") : void 0, c = r.qualifiedTableName || p, m = c ? `${c}.${u}` : void 0;
49
50
  return s ? m ? m === a || m.endsWith(`.${s}`) : u === e.name : m ? m === a : u === e.name;
50
51
  });
51
52
  }
@@ -60,8 +61,8 @@ function P(n, e) {
60
61
  return t ? s(t) : !1;
61
62
  }
62
63
  function v(n, e) {
63
- var l, d;
64
- const i = (d = (l = n.config) == null ? void 0 : l.groupByColumns) == null ? void 0 : d.find((o) => f(o.dataType || "") === "date"), s = e.resolvedPrimaryDateField, t = i ? { id: i.id, name: i.name, label: i.label || i.name, qualifiedFieldName: i.qualifiedFieldName } : s ? { name: s.name, label: s.name, qualifiedFieldName: s.qualifiedFieldName } : void 0;
64
+ var l, o;
65
+ const i = (o = (l = n.config) == null ? void 0 : l.groupByColumns) == null ? void 0 : o.find((d) => f(d.dataType || "") === "date"), s = e.resolvedPrimaryDateField, t = i ? { id: i.id, name: i.name, label: i.label || i.name, qualifiedFieldName: i.qualifiedFieldName } : s ? { name: s.name, label: s.name, qualifiedFieldName: s.qualifiedFieldName } : void 0;
65
66
  if (!t) return { comparisonDate: null, dateWindow: e.status === "ready" ? "none" : "unknown" };
66
67
  const a = { name: t.name, label: t.label };
67
68
  if (P(n, t)) return { comparisonDate: a, dateWindow: "applies" };
@@ -69,7 +70,7 @@ function v(n, e) {
69
70
  const r = T(n, { status: "ready", ...e.compiledFilters });
70
71
  return { comparisonDate: a, dateWindow: r ? "applies" : "none" };
71
72
  }
72
- function j(n) {
73
+ function z(n) {
73
74
  const e = C(n.dashboard), i = y(e).find((r) => r.cardId === n.cardId);
74
75
  if (!i || i.kind === "documentSectionCard") return { comparisonDate: null, dateWindow: "unknown" };
75
76
  const { runtimeValues: s, transientContexts: t } = N({ dashboard: e, capture: {}, calendar: n.calendar }), a = q({
@@ -86,6 +87,6 @@ function j(n) {
86
87
  );
87
88
  }
88
89
  export {
89
- j as a,
90
+ z as a,
90
91
  v as r
91
92
  };
@@ -0,0 +1,226 @@
1
+ import { b as v, D as g, s as B, r as N, a as j, n as U } from "./resolver-DG_tfEpt.js";
2
+ import { S as b, C as p, a as f } from "./pickers-DkqmtnTL.js";
3
+ const w = {
4
+ spacing: { min: 0, max: 24, label: "Spacing" },
5
+ canvasPadding: { min: 0, max: 48, label: "Canvas padding" },
6
+ cardCorners: { min: 0, max: 24, label: "Card corners" },
7
+ controlCorners: { min: 0, max: 12, label: "Control corners" },
8
+ barCorners: { min: 0, max: 24, label: "Bar corners" }
9
+ }, d = { min: 1, max: 12 };
10
+ function _(o) {
11
+ const { min: e, max: s, label: r } = w[o];
12
+ return `${r} ${r.endsWith("s") ? "are" : "is"} ${e} to ${s} px`;
13
+ }
14
+ function Z(o) {
15
+ return o in w;
16
+ }
17
+ const M = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
18
+ function y(o) {
19
+ return typeof o == "string" && M.test(o);
20
+ }
21
+ const H = ["none", "subtle", "raised"], L = /* @__PURE__ */ new Set(["canvas", "chartColors"]);
22
+ function rr(o, e) {
23
+ const s = l(v(o), e), r = l(v({ ...o, tokenAppearance: null, reactAppearance: null }), e), n = l(v({ defaults: o.defaults, organizationAppearance: o.organizationAppearance }), e), a = Object.fromEntries(g.map((i) => [i, z(o, i, e)])), c = o.dashboardStyle ?? {}, t = g.filter((i) => B(c, i, e) !== void 0), C = g.reduce((i, k) => {
24
+ if (!L.has(k)) return i + (c[k] !== void 0 ? 1 : 0);
25
+ const A = c[k];
26
+ return i + (A ? Object.values(A).filter((T) => T !== void 0).length : 0);
27
+ }, 0);
28
+ return {
29
+ mode: e,
30
+ shows: s,
31
+ authored: r,
32
+ inherited: n,
33
+ source: a,
34
+ hostSet: g.filter((i) => a[i] === "token" || a[i] === "react"),
35
+ changed: t,
36
+ changeCount: C,
37
+ pickers: F(r)
38
+ };
39
+ }
40
+ function l(o, e) {
41
+ const s = o.schemes[e], r = (a) => N(s, j[a]), n = r("cardShadow");
42
+ return {
43
+ spacing: r("spacing"),
44
+ canvasPadding: r("canvasPadding"),
45
+ canvas: r("canvas"),
46
+ cardBorder: r("cardBorder") === 0 ? "off" : "on",
47
+ cardShadow: H.includes(n) ? n : "custom",
48
+ cardCorners: r("cardCorners"),
49
+ controlCorners: r("controlCorners"),
50
+ chartColors: [...r("chartColors") ?? []],
51
+ barCorners: r("barCorners")
52
+ };
53
+ }
54
+ function z(o, e, s) {
55
+ const r = (n) => {
56
+ var a, c;
57
+ return N((c = (a = U(n)) == null ? void 0 : a.schemes) == null ? void 0 : c[s], j[e]) !== void 0;
58
+ };
59
+ return r(o.reactAppearance) ? "react" : r(o.tokenAppearance) ? "token" : o.dashboardStyle && B(o.dashboardStyle, e, s) !== void 0 ? "dashboard" : r(o.organizationAppearance) ? "organization" : "defaults";
60
+ }
61
+ function F(o) {
62
+ const e = Object.keys(b).find((n) => b[n] === o.spacing) ?? null, s = Object.keys(p).find((n) => {
63
+ const a = p[n];
64
+ return a.cardBorder === o.cardBorder && a.cardShadow === o.cardShadow && a.canvas === o.canvas;
65
+ }) ?? null, r = Object.keys(f).find(
66
+ (n) => f[n].cardCorners === o.cardCorners && f[n].controlCorners === o.controlCorners
67
+ ) ?? null;
68
+ return { spacing: e, cards: s, corners: r };
69
+ }
70
+ const I = { muted: "muted", background: "plain" }, G = {
71
+ none: "Removes card shadows",
72
+ subtle: "Gives cards a subtle shadow",
73
+ raised: "Gives cards a raised shadow"
74
+ }, W = {
75
+ outlined: "Shows cards outlined, with a border and no shadow",
76
+ raised: "Shows cards raised, with no border",
77
+ open: "Shows cards open, on a plain canvas"
78
+ };
79
+ function q(o) {
80
+ const { edit: e, before: s, after: r } = o;
81
+ if (e.reset === "all" && Object.keys(e).length === 1)
82
+ return h(s, r) ? [] : [o.resetAll ?? "Resets the dashboard's style to the brand"];
83
+ const n = [], a = (t) => !h(s.light[t], r.light[t]) || !h(s.dark[t], r.dark[t]);
84
+ a("spacing") && n.push(r.light.spacing === 0 ? "Removes the gap between cards" : `Sets the gap between cards to ${r.light.spacing} px`), a("canvasPadding") && n.push(`Sets the canvas padding to ${r.light.canvasPadding} px`);
85
+ const c = e.cards && !a("cardBorder") && !a("cardShadow") && !a("canvas") ? void 0 : e.cards;
86
+ if (c && p[c] ? n.push(W[c]) : (a("cardBorder") && n.push(r.light.cardBorder === "on" ? "Shows card borders" : "Hides card borders"), a("cardShadow") && n.push(G[r.light.cardShadow] ?? "Changes the card shadow"), a("canvas") && n.push($("Sets the canvas to", s, r, "canvas", (t) => I[t] ?? t))), a("cardCorners") || a("controlCorners")) {
87
+ const { cardCorners: t, controlCorners: C } = r.light;
88
+ n.push(t === 0 && C === 0 ? "Squares corners" : `Rounds corners (cards ${t} px, controls ${C} px)`);
89
+ }
90
+ return a("chartColors") && n.push($("Sets chart colors to", s, r, "chartColors", (t) => `${t.length} ${t.length === 1 ? "color" : "colors"}`)), a("barCorners") && n.push(r.light.barCorners === 0 ? "Squares bar corners" : `Rounds bar corners to ${r.light.barCorners} px`), n;
91
+ }
92
+ function $(o, e, s, r, n) {
93
+ const a = !h(e.light[r], s.light[r]), c = !h(e.dark[r], s.dark[r]);
94
+ return a && c && h(s.light[r], s.dark[r]) ? `${o} ${n(s.light[r])}` : a && c ? `${o} ${n(s.light[r])} in light mode and ${n(s.dark[r])} in dark mode` : a ? `${o} ${n(s.light[r])} in light mode` : `${o} ${n(s.dark[r])} in dark mode`;
95
+ }
96
+ function h(o, e) {
97
+ return JSON.stringify(o) === JSON.stringify(e);
98
+ }
99
+ const u = ["light", "dark"], O = ["reset", "spacing", "canvasPadding", "cards", "canvas", "border", "shadow", "corners", "chartColors", "barCorners"], E = ["spacing", "canvasPadding", "canvas", "cards", "border", "shadow", "corners", "chartColors", "barCorners"], J = /* @__PURE__ */ new Set(["canvas", "chartColors"]);
100
+ function or(o) {
101
+ const e = Y(o.edit);
102
+ if (e) return { ok: !1, refusal: e };
103
+ const s = V(o.style ?? {}, o.edit, o.mode), r = { defaults: o.layers.defaults, organizationAppearance: o.layers.organizationAppearance }, n = K(s, r), a = R({ ...r, dashboardStyle: o.style }), c = R({ ...r, dashboardStyle: n });
104
+ return { ok: !0, style: n, sentences: q({ edit: o.edit, before: a, after: c }) };
105
+ }
106
+ function Y(o) {
107
+ if ((x(o) ? Object.entries(o).filter(([s, r]) => r !== void 0 && !(s === "reset" && Array.isArray(r) && r.length === 0)) : []).length === 0)
108
+ return { field: "edit", code: "empty_edit", message: "The style edit changes nothing.", fix: 'Name a setting to change, like spacing: "roomy" or cards: "raised".' };
109
+ for (const [s, r] of Object.entries(o))
110
+ if (r !== void 0 && !O.includes(s))
111
+ return { field: s, code: "unknown_field", message: `${s} is not a dashboard style setting.`, fix: `Use one of ${O.join(", ")}.` };
112
+ if (o.reset !== void 0 && o.reset !== "all" && !(Array.isArray(o.reset) && o.reset.every((s) => E.includes(s))))
113
+ return { field: "reset", code: "invalid_value", message: 'Reset takes "all" or a list of settings.', fix: `Use "all" or some of ${E.join(", ")}.` };
114
+ if (o.spacing !== void 0 && !(typeof o.spacing == "string" && o.spacing in b)) {
115
+ const s = m("spacing", o.spacing);
116
+ if (s) return { ...s, fix: `${s.fix} Or name a step: none, compact, default or roomy.` };
117
+ }
118
+ for (const s of ["canvasPadding", "barCorners"]) {
119
+ const r = o[s] !== void 0 ? m(s, o[s]) : void 0;
120
+ if (r) return r;
121
+ }
122
+ if (o.cards !== void 0 && !(o.cards in p))
123
+ return { field: "cards", code: "invalid_value", message: "Cards are outlined, raised or open.", fix: "Use outlined, raised or open." };
124
+ if (o.border !== void 0 && o.border !== "on" && o.border !== "off")
125
+ return { field: "border", code: "invalid_value", message: "Card border is on or off.", fix: "Use on or off." };
126
+ if (o.shadow !== void 0 && !["none", "subtle", "raised"].includes(o.shadow))
127
+ return { field: "shadow", code: "invalid_value", message: "Card shadow is none, subtle or raised.", fix: "Use none, subtle or raised." };
128
+ if (o.corners !== void 0)
129
+ if (typeof o.corners == "string") {
130
+ if (!(o.corners in f))
131
+ return { field: "corners", code: "invalid_value", message: "Corners are square, subtle, rounded or round.", fix: "Use square, subtle, rounded or round, or give cards and controls in px." };
132
+ } else {
133
+ if (!x(o.corners) || o.corners.cards === void 0 && o.corners.controls === void 0)
134
+ return { field: "corners", code: "invalid_value", message: "Corners take a step or px for cards and controls.", fix: "Use a step like rounded, or { cards: 10, controls: 6 }." };
135
+ {
136
+ const s = o.corners.cards !== void 0 ? m("cardCorners", o.corners.cards) : void 0;
137
+ if (s) return s;
138
+ const r = o.corners.controls !== void 0 ? m("controlCorners", o.corners.controls) : void 0;
139
+ if (r) return r;
140
+ }
141
+ }
142
+ if (o.canvas !== void 0)
143
+ for (const [s, r] of S(o.canvas)) {
144
+ if (s === void 0) return { field: "canvas", code: "unknown_field", message: "The canvas holds light and dark values only.", fix: "Give one fill, or { light, dark }." };
145
+ if (r !== "muted" && r !== "background" && !y(r))
146
+ return { field: s === "both" ? "canvas" : `canvas.${s}`, code: "invalid_colour", message: "The canvas is muted, background or a hex colour.", fix: "Use muted, background or a hex colour like #f4f4f5." };
147
+ }
148
+ if (o.chartColors !== void 0)
149
+ for (const [s, r] of S(o.chartColors)) {
150
+ const n = s === "both" ? "chartColors" : `chartColors.${s}`;
151
+ if (s === void 0) return { field: "chartColors", code: "unknown_field", message: "Chart colors hold light and dark lists only.", fix: "Give one list, or { light, dark }." };
152
+ if (!Array.isArray(r) || r.length < d.min || r.length > d.max)
153
+ return { field: n, code: "palette_size", message: `Chart colors take ${d.min} to ${d.max} colours.`, fix: `Chart colors take ${d.min} to ${d.max} hex colours, like #2563eb.` };
154
+ if (!r.every(y))
155
+ return { field: n, code: "invalid_colour", message: "Chart colors are hex colours.", fix: `Chart colors take ${d.min} to ${d.max} hex colours, like #2563eb.` };
156
+ }
157
+ }
158
+ function V(o, e, s) {
159
+ let r = e.reset === "all" ? {} : structuredClone(o);
160
+ if (Array.isArray(e.reset))
161
+ for (const n of e.reset)
162
+ n === "spacing" && delete r.spacing, n === "canvasPadding" && delete r.canvasPadding, (n === "canvas" || n === "cards") && (r = P(r, "canvas", s)), (n === "border" || n === "cards") && delete r.cardBorder, (n === "shadow" || n === "cards") && delete r.cardShadow, n === "corners" && (delete r.cardCorners, delete r.controlCorners), n === "chartColors" && (r = P(r, "chartColors", s)), n === "barCorners" && delete r.barCorners;
163
+ if (typeof e.spacing == "string" ? (r.spacing = b[e.spacing], r.canvasPadding = b[e.spacing]) : typeof e.spacing == "number" && (r.spacing = e.spacing), e.cards) {
164
+ const n = p[e.cards];
165
+ r.cardBorder = n.cardBorder, r.cardShadow = n.cardShadow, r.canvas = { light: n.canvas, dark: n.canvas };
166
+ }
167
+ if (typeof e.corners == "string" ? (r.cardCorners = f[e.corners].cardCorners, r.controlCorners = f[e.corners].controlCorners) : e.corners && (e.corners.cards !== void 0 && (r.cardCorners = e.corners.cards), e.corners.controls !== void 0 && (r.controlCorners = e.corners.controls)), e.canvasPadding !== void 0 && (r.canvasPadding = e.canvasPadding), e.border !== void 0 && (r.cardBorder = e.border), e.shadow !== void 0 && (r.cardShadow = e.shadow), e.barCorners !== void 0 && (r.barCorners = e.barCorners), e.canvas !== void 0)
168
+ for (const [n, a] of S(e.canvas))
169
+ for (const c of n === "both" ? u : [n])
170
+ r.canvas = { ...r.canvas, [c]: y(a) ? a.toLowerCase() : a };
171
+ if (e.chartColors !== void 0)
172
+ for (const [n, a] of S(e.chartColors))
173
+ for (const c of n === "both" ? u : [n])
174
+ r.chartColors = { ...r.chartColors, [c]: a.map((t) => t.toLowerCase()) };
175
+ return r;
176
+ }
177
+ function K(o, e) {
178
+ const s = v(e), r = { light: l(s, "light"), dark: l(s, "dark") }, n = { ...o };
179
+ for (const a of g)
180
+ if (n[a] !== void 0)
181
+ if (J.has(a)) {
182
+ const c = { ...n[a] };
183
+ for (const t of u)
184
+ c[t] !== void 0 && D(c[t], r[t][a]) && delete c[t];
185
+ Object.keys(c).length > 0 ? n[a] = c : delete n[a];
186
+ } else u.every((c) => D(n[a], r[c][a])) && delete n[a];
187
+ return Object.keys(n).length > 0 ? n : void 0;
188
+ }
189
+ function R(o) {
190
+ const e = v(o);
191
+ return { light: l(e, "light"), dark: l(e, "dark") };
192
+ }
193
+ function m(o, e) {
194
+ const { min: s, max: r } = w[o];
195
+ if (typeof e == "number" && Number.isInteger(e) && e >= s && e <= r) return;
196
+ const n = typeof e != "number" || !Number.isFinite(e) ? "invalid_value" : Number.isInteger(e) ? "out_of_range" : "not_integer";
197
+ return { field: o, code: n, message: `${_(o)}.`, fix: `${_(o)}; use ${r} for the most.` };
198
+ }
199
+ function S(o) {
200
+ return x(o) ? Object.entries(o).filter(([, e]) => e !== void 0).map(([e, s]) => [u.includes(e) ? e : void 0, s]) : [["both", o]];
201
+ }
202
+ function P(o, e, s) {
203
+ const r = { ...o[e] };
204
+ for (const a of s ? [s] : u) delete r[a];
205
+ const n = { ...o };
206
+ return Object.keys(r).length > 0 ? n[e] = r : delete n[e], n;
207
+ }
208
+ function D(o, e) {
209
+ return JSON.stringify(o) === JSON.stringify(e);
210
+ }
211
+ function x(o) {
212
+ return typeof o == "object" && o !== null && !Array.isArray(o);
213
+ }
214
+ export {
215
+ d as C,
216
+ w as D,
217
+ V as a,
218
+ rr as b,
219
+ Y as c,
220
+ q as d,
221
+ or as e,
222
+ _ as f,
223
+ y as g,
224
+ Z as i,
225
+ l as r
226
+ };