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,24 +1,27 @@
1
- import { jsxs as d, jsx as r, Fragment as de } from "react/jsx-runtime";
2
- import b from "react";
3
- import { c as ee, P as ue, a as pe, B as C, b as ze, d as be, C as De, R as ge, L as ce, X as je, S as ie, e as Ie, T as Je, f as Le, g as L, h as $e, i as $, j as _e, k as Ue, l as Ve, m as Me, n as T, o as X, p as Y, q, I as fe, r as Z, s as K, t as me, u as he, v as ke, w as xe, x as ye, y as Ge } from "../chunks/code-editor-BsxHzm9u.js";
4
- import { A as We, p as He } from "../chunks/color-CJvdlFM_.js";
5
- import { c as Q } from "../chunks/_commonjsHelpers-Bid1ZNYj.js";
1
+ import { jsxs as d, jsx as r, Fragment as ue } from "react/jsx-runtime";
2
+ import g, { useState as pe } from "react";
3
+ import { c as de, P as be, N as B, S as M, a as Ye, b as We, d as Ce, e as ye, f as Ne, B as S, g as qe, h as Se, C as Ke, R as we, L as fe, X as Xe, i as me, j as Ze, T as Qe, k as er, l as V, m as rr, n as G, o as or, p as ar, q as nr, r as tr, s as E, t as Q, u as ee, v as re, I as Fe, w as oe, x as ae, y as Pe, z as Oe, A as Te, D as Be, E as Re } from "../chunks/style-sheet-parts-C7qGZuH1.js";
4
+ import { v as dr, A as ne, d as cr, p as sr } from "../chunks/schema-C9NPiIru.js";
5
+ import { S as j, C as lr, a as ge, c as te } from "../chunks/pickers-DkqmtnTL.js";
6
6
  import "../chunks/validators-B8fpdinG.js";
7
7
  import "../chunks/matrix-operation-contract-DCVinw1o.js";
8
8
  import "../chunks/analytics-base-schemas-BaIQrEzX.js";
9
9
  import "../value-format-preferences/index.js";
10
- import { r as Xe, v as Ye, A as qe } from "../chunks/index-CLIro-EG.js";
11
- import { P as _ } from "../chunks/palette-NjHOE_6B.js";
12
- import { U as Ze } from "../chunks/upload-BRW4Mwrd.js";
13
- import { S as Ke } from "../chunks/save-C6VmEJTA.js";
14
- import { L as Qe } from "../chunks/layout-grid-BIcoFfdS.js";
10
+ import { e as ir } from "../chunks/brand-B4BdpAB_.js";
11
+ import { b as ur, D as pr } from "../chunks/edit-Bpdh_P_a.js";
12
+ import { n as Ee } from "../chunks/index-BVKzKl5d.js";
13
+ import { b as br } from "../chunks/resolver-DG_tfEpt.js";
14
+ import { P as H } from "../chunks/palette-a5FCZKFI.js";
15
+ import { U as fr } from "../chunks/upload-CiGNKJ_0.js";
16
+ import { S as mr } from "../chunks/save-D985VvYp.js";
17
+ import { L as gr } from "../chunks/layout-grid-8rR-LPTk.js";
15
18
  /**
16
19
  * @license lucide-react v0.453.0 - ISC
17
20
  *
18
21
  * This source code is licensed under the ISC license.
19
22
  * See the LICENSE file in the root directory of this source tree.
20
23
  */
21
- const er = ee("Ban", [
24
+ const hr = de("Ban", [
22
25
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
23
26
  ["path", { d: "m4.9 4.9 14.2 14.2", key: "1m5liu" }]
24
27
  ]);
@@ -28,7 +31,7 @@ const er = ee("Ban", [
28
31
  * This source code is licensed under the ISC license.
29
32
  * See the LICENSE file in the root directory of this source tree.
30
33
  */
31
- const rr = ee("Clipboard", [
34
+ const xr = de("Clipboard", [
32
35
  ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
33
36
  [
34
37
  "path",
@@ -44,7 +47,7 @@ const rr = ee("Clipboard", [
44
47
  * This source code is licensed under the ISC license.
45
48
  * See the LICENSE file in the root directory of this source tree.
46
49
  */
47
- const or = ee("Pipette", [
50
+ const vr = de("Pipette", [
48
51
  ["path", { d: "m2 22 1-1h3l9-9", key: "1sre89" }],
49
52
  ["path", { d: "M3 21v-3l9-9", key: "hpe2y6" }],
50
53
  [
@@ -54,7 +57,140 @@ const or = ee("Pipette", [
54
57
  key: "196du1"
55
58
  }
56
59
  ]
57
- ]), Ce = [
60
+ ]), kr = [
61
+ { value: "none", label: "None" },
62
+ { value: "compact", label: "Compact" },
63
+ { value: "default", label: "Default" },
64
+ { value: "roomy", label: "Roomy" }
65
+ ], he = [
66
+ { value: "outlined", label: "Outlined", note: "A border on a muted canvas" },
67
+ { value: "raised", label: "Raised", note: "A shadow and no border on a muted canvas" },
68
+ { value: "open", label: "Open", note: "No border or shadow on a plain canvas" }
69
+ ], Cr = [
70
+ { value: "square", label: "Square" },
71
+ { value: "subtle", label: "Subtle" },
72
+ { value: "rounded", label: "Rounded" },
73
+ { value: "round", label: "Round" }
74
+ ];
75
+ function yr({
76
+ spec: e,
77
+ mode: a,
78
+ onEdit: n
79
+ }) {
80
+ var F;
81
+ const c = ur({ organizationAppearance: e }, a), s = c.authored, [f, h] = pe(null), [x, v] = pe(!1), b = (l) => h(n(l)), i = (l) => pr[l], p = s.canvas === "muted" ? "muted" : s.canvas === "background" ? "background" : "color", y = (l) => ({ [a]: l });
82
+ return /* @__PURE__ */ d("div", { className: "-mx-4", children: [
83
+ /* @__PURE__ */ r(
84
+ be,
85
+ {
86
+ label: "Spacing",
87
+ options: kr.map((l) => ({
88
+ ...l,
89
+ title: `${j[l.value]} px between cards and around them`,
90
+ preview: { ...s, spacing: j[l.value], canvasPadding: j[l.value] }
91
+ })),
92
+ lit: c.pickers.spacing,
93
+ note: "Card sizes never change with spacing.",
94
+ changed: c.source.spacing === "organization" || c.source.canvasPadding === "organization",
95
+ resetTitle: `Back to the default: ${j.default} px`,
96
+ onPick: (l) => b({ spacing: l }),
97
+ onReset: () => b({ reset: ["spacing", "canvasPadding"] }),
98
+ children: /* @__PURE__ */ d("div", { className: "mt-2 flex items-center gap-1.5", children: [
99
+ /* @__PURE__ */ r("span", { className: "text-[11px] text-muted-foreground", children: "Gap" }),
100
+ /* @__PURE__ */ r(B, { value: s.spacing, ...i("spacing"), onChange: (l) => b({ spacing: l }) }),
101
+ /* @__PURE__ */ r("span", { className: "ml-2 text-[11px] text-muted-foreground", children: "Canvas padding" }),
102
+ /* @__PURE__ */ r(B, { value: s.canvasPadding, ...i("canvasPadding"), onChange: (l) => b({ canvasPadding: l }) })
103
+ ] })
104
+ }
105
+ ),
106
+ /* @__PURE__ */ r(
107
+ be,
108
+ {
109
+ label: "Cards",
110
+ options: he.map((l) => ({ value: l.value, label: l.label, title: l.note, preview: { ...s, ...lr[l.value] } })),
111
+ lit: c.pickers.cards,
112
+ note: ((F = he.find((l) => l.value === c.pickers.cards)) == null ? void 0 : F.note) ?? "Your own mix of border, shadow and canvas",
113
+ changed: ["cardBorder", "cardShadow", "canvas"].some((l) => c.source[l] === "organization"),
114
+ resetTitle: "Back to the default cards",
115
+ onPick: (l) => b({ cards: l }),
116
+ onReset: () => b({ reset: ["cards"] })
117
+ }
118
+ ),
119
+ /* @__PURE__ */ d("div", { className: "grid gap-2 px-4 pb-3", children: [
120
+ /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2", children: [
121
+ /* @__PURE__ */ d("span", { className: "w-24 text-[12px] text-muted-foreground", children: [
122
+ "Canvas (",
123
+ a,
124
+ ")"
125
+ ] }),
126
+ /* @__PURE__ */ r(
127
+ M,
128
+ {
129
+ label: "Canvas background",
130
+ value: p,
131
+ onChange: (l) => b({ canvas: y(l === "color" ? a === "dark" ? "#111318" : "#f4f6f8" : l) }),
132
+ options: [
133
+ { value: "muted", label: "Muted" },
134
+ { value: "background", label: "Plain" },
135
+ { value: "color", label: "Custom" }
136
+ ]
137
+ }
138
+ ),
139
+ p === "color" ? /* @__PURE__ */ r(Ye, { color: We(s.canvas), label: "Canvas color", onChange: (l) => b({ canvas: y(l) }) }) : null
140
+ ] }),
141
+ /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2", children: [
142
+ /* @__PURE__ */ r("span", { className: "w-24 text-[12px] text-muted-foreground", children: "Corners" }),
143
+ /* @__PURE__ */ r(
144
+ M,
145
+ {
146
+ label: "Corners",
147
+ value: c.pickers.corners,
148
+ onChange: (l) => b({ corners: l }),
149
+ options: Cr.map((l) => ({
150
+ ...l,
151
+ title: `Cards ${ge[l.value].cardCorners} px, controls ${ge[l.value].controlCorners} px`
152
+ }))
153
+ }
154
+ ),
155
+ /* @__PURE__ */ r("button", { type: "button", className: "text-[11px] text-foreground underline-offset-2 hover:underline", onClick: () => v(!x), children: x || !c.pickers.corners ? "Hide" : "Set separately" })
156
+ ] }),
157
+ x || !c.pickers.corners ? /* @__PURE__ */ d("div", { className: "flex items-center gap-1.5 pl-[104px]", children: [
158
+ /* @__PURE__ */ r("span", { className: "text-[11px] text-muted-foreground", children: "Cards" }),
159
+ /* @__PURE__ */ r(B, { value: s.cardCorners, ...i("cardCorners"), onChange: (l) => b({ corners: { cards: l } }) }),
160
+ /* @__PURE__ */ r("span", { className: "ml-1 text-[11px] text-muted-foreground", children: "Controls" }),
161
+ /* @__PURE__ */ r(B, { value: s.controlCorners, ...i("controlCorners"), onChange: (l) => b({ corners: { controls: l } }) })
162
+ ] }) : null,
163
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
164
+ /* @__PURE__ */ r("span", { className: "w-24 text-[12px] text-muted-foreground", children: "Card border" }),
165
+ /* @__PURE__ */ r(Ce, { checked: s.cardBorder === "on", onCheckedChange: (l) => b({ border: l ? "on" : "off" }), "aria-label": "Card border" }),
166
+ /* @__PURE__ */ r("span", { className: "ml-4 w-20 text-[12px] text-muted-foreground", children: "Shadow" }),
167
+ /* @__PURE__ */ r(
168
+ M,
169
+ {
170
+ label: "Card shadow",
171
+ value: s.cardShadow === "custom" ? null : s.cardShadow,
172
+ onChange: (l) => b({ shadow: l }),
173
+ options: [
174
+ { value: "none", label: "None" },
175
+ { value: "subtle", label: "Subtle" },
176
+ { value: "raised", label: "Raised" }
177
+ ]
178
+ }
179
+ )
180
+ ] }),
181
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
182
+ /* @__PURE__ */ r("span", { className: "w-24 text-[12px] text-muted-foreground", children: "Bar corners" }),
183
+ /* @__PURE__ */ r(B, { value: s.barCorners, ...i("barCorners"), onChange: (l) => b({ barCorners: l }) })
184
+ ] }),
185
+ f ? /* @__PURE__ */ d("p", { role: "alert", className: "text-[12px] text-destructive", children: [
186
+ f.message,
187
+ " ",
188
+ f.fix
189
+ ] }) : null
190
+ ] })
191
+ ] });
192
+ }
193
+ const Ae = [
58
194
  {
59
195
  id: "semaphor",
60
196
  name: "Semaphor",
@@ -209,15 +345,15 @@ const or = ee("Pipette", [
209
345
  }
210
346
  }
211
347
  ];
212
- function D(e) {
213
- const a = Xe({
214
- organizationAppearance: e ?? void 0
348
+ function R(e) {
349
+ const a = br({
350
+ organizationAppearance: e ? Ee(e).spec : void 0
215
351
  });
216
- return ar(
217
- tr(re(a))
352
+ return Nr(
353
+ ze(J(a))
218
354
  );
219
355
  }
220
- function ar(e) {
356
+ function Nr(e) {
221
357
  var a;
222
358
  for (const n of Object.values(e.schemes)) {
223
359
  const c = (a = n.components.table) == null ? void 0 : a.row;
@@ -225,12 +361,12 @@ function ar(e) {
225
361
  }
226
362
  return e;
227
363
  }
228
- function j(e) {
229
- const a = re({
230
- version: qe,
364
+ function $(e) {
365
+ const a = J({
366
+ version: ne,
231
367
  mode: e.mode,
232
368
  schemes: e.schemes
233
- }), n = Ye(a);
369
+ }), n = dr(a);
234
370
  if (!n.success) {
235
371
  const c = n.issues[0];
236
372
  throw new Error(
@@ -239,17 +375,39 @@ function j(e) {
239
375
  }
240
376
  return n.value;
241
377
  }
242
- function nr(e, a) {
243
- const n = Ce.find((i) => i.id === a);
378
+ function xe(e) {
379
+ var n, c;
380
+ const a = $(e);
381
+ for (const s of ["light", "dark"]) {
382
+ const f = (n = a.schemes) == null ? void 0 : n[s];
383
+ if (!(f != null && f.components)) continue;
384
+ const h = ze(
385
+ J({ version: ne, mode: e.mode, schemes: { light: { tokens: f.tokens, components: {} }, dark: { tokens: f.tokens, components: {} } } })
386
+ ).schemes[s].components;
387
+ for (const x of Sr) {
388
+ const v = f.components[x];
389
+ if (v)
390
+ for (const b of wr[x])
391
+ v[b] !== void 0 && v[b] === ((c = h[x]) == null ? void 0 : c[b]) && delete v[b];
392
+ }
393
+ }
394
+ return Ee(a).spec ?? { version: ne, mode: e.mode };
395
+ }
396
+ const Sr = ["dashboard", "card"], wr = {
397
+ dashboard: ["foreground", "borderColor"],
398
+ card: ["background", "foreground", "borderColor"]
399
+ };
400
+ function Fr(e, a) {
401
+ const n = Ae.find((s) => s.id === a);
244
402
  if (!n)
245
403
  return e;
246
- const c = re(e);
247
- return se(c.schemes.light, n.light), se(c.schemes.dark, n.dark), c;
404
+ const c = J(e);
405
+ return ve(c.schemes.light, n.light), ve(c.schemes.dark, n.dark), c;
248
406
  }
249
- function se(e, a) {
407
+ function ve(e, a) {
250
408
  e.tokens.color.background = a.background, e.tokens.color.foreground = a.foreground, e.tokens.color.muted = a.muted, e.tokens.color.mutedForeground = a.mutedForeground, e.tokens.color.border = a.border, e.tokens.color.input = a.border, e.tokens.color.primary = a.primary, e.tokens.color.primaryForeground = a.primaryForeground, e.tokens.color.accent = a.accent, e.tokens.color.accentForeground = a.accentForeground, e.tokens.color.selection = a.selection, e.tokens.color.card = a.card, e.tokens.color.cardForeground = a.cardForeground, e.components.dashboard.background = a.background, e.components.dashboard.foreground = a.foreground, e.components.dashboard.borderColor = a.border, e.components.card.background = a.card, e.components.card.foreground = a.cardForeground, e.components.card.borderColor = a.border, e.components.interactive.toolbarBackground = a.background, e.components.interactive.background = a.card, e.components.interactive.foreground = a.foreground, e.components.interactive.borderColor = a.border, e.components.chart.palette = [...a.chartPalette], e.components.chart.background = a.card, e.components.chart.foreground = a.foreground, e.components.chart.gridColor = a.border, e.components.chart.axisColor = a.mutedForeground, e.components.table.container.background = a.card, e.components.table.container.borderColor = a.border, e.components.table.header.background = a.muted, e.components.table.header.foreground = a.mutedForeground, e.components.table.header.dividerColor = a.border, e.components.table.row.dividerColor = a.border, e.components.table.row.zebraBackground = a.muted, e.components.table.pagination.background = a.card, e.components.table.pagination.foreground = a.foreground, e.components.table.pagination.borderColor = a.border;
251
409
  }
252
- function U(e, a, n) {
410
+ function Y(e, a, n) {
253
411
  switch (e.tokens.color[a] = n, a) {
254
412
  case "background":
255
413
  e.components.dashboard.background = n, e.components.interactive.toolbarBackground = n;
@@ -277,22 +435,16 @@ function U(e, a, n) {
277
435
  break;
278
436
  }
279
437
  }
280
- function V(e, a, n) {
438
+ function Pr(e, a, n) {
281
439
  switch (e.tokens.radius[a] = n, a) {
282
- case "control":
283
- e.components.interactive.borderRadius = n, e.components.pagination.borderRadius = n;
284
- break;
285
- case "card":
286
- e.components.card.borderRadius = n;
287
- break;
288
440
  case "table":
289
441
  e.components.table.container.borderRadius = n;
290
442
  break;
291
443
  }
292
444
  }
293
- function tr(e) {
445
+ function ze(e) {
294
446
  for (const a of ["light", "dark"]) {
295
- const n = e.schemes[a], c = n.tokens, i = c.color, f = {
447
+ const n = e.schemes[a], c = n.tokens, s = c.color, f = {
296
448
  fontFamily: "",
297
449
  headingFontFamily: "",
298
450
  monoFontFamily: "",
@@ -300,14 +452,14 @@ function tr(e) {
300
452
  density: "comfortable"
301
453
  };
302
454
  c.typography = { ...f, ...c.typography };
303
- const g = {
455
+ const h = {
304
456
  control: 5,
305
457
  card: 5,
306
458
  table: 5,
307
459
  badge: 999
308
460
  };
309
- c.radius = { ...g, ...c.radius };
310
- const y = {
461
+ c.radius = { ...h, ...c.radius };
462
+ const x = {
311
463
  dashboardPadding: 16,
312
464
  gridGap: 12,
313
465
  cardPadding: 16,
@@ -315,66 +467,67 @@ function tr(e) {
315
467
  tableCellX: 12,
316
468
  tableCellY: 8
317
469
  };
318
- c.spacing = { ...y, ...c.spacing };
319
- const x = {
470
+ c.spacing = { ...x, ...c.spacing };
471
+ const v = {
320
472
  card: "none",
321
473
  popover: "0 12px 32px rgba(15, 23, 42, 0.14)",
322
474
  focusRing: "0 0 0 2px rgba(37, 99, 235, 0.35)"
323
475
  };
324
- c.shadow = { ...x, ...c.shadow };
325
- const w = {
476
+ c.shadow = { ...v, ...c.shadow };
477
+ const b = {
326
478
  dashboard: {
327
- background: i.background,
328
- foreground: i.foreground,
329
- borderColor: i.border,
330
- padding: c.spacing.dashboardPadding
479
+ background: s.background,
480
+ foreground: s.foreground,
481
+ borderColor: s.border
331
482
  },
332
483
  card: {
333
- background: i.card,
334
- foreground: i.cardForeground,
335
- borderColor: i.border,
336
- borderRadius: c.radius.card,
337
- padding: c.spacing.cardPadding,
338
- shadow: c.shadow.card
484
+ background: s.card,
485
+ foreground: s.cardForeground,
486
+ borderColor: s.border
339
487
  },
340
488
  interactive: {
341
- toolbarBackground: i.background,
342
- background: i.card,
343
- foreground: i.foreground,
344
- borderColor: i.border,
345
- borderRadius: c.radius.control
489
+ toolbarBackground: s.background,
490
+ background: s.card,
491
+ foreground: s.foreground,
492
+ borderColor: s.border
346
493
  },
347
494
  chart: {
348
495
  palette: [],
349
- background: i.card,
350
- foreground: i.foreground,
351
- gridColor: i.border,
352
- axisColor: i.mutedForeground
496
+ background: s.card,
497
+ foreground: s.foreground,
498
+ gridColor: s.border,
499
+ axisColor: s.mutedForeground,
500
+ barRadius: 0
353
501
  },
354
- table: le(i, c),
502
+ table: ke(s, c),
355
503
  pagination: {
356
- background: i.card,
357
- foreground: i.foreground,
358
- borderColor: i.border,
359
- borderRadius: c.radius.control
504
+ background: s.card,
505
+ foreground: s.foreground,
506
+ borderColor: s.border
360
507
  }
361
508
  };
362
- n.components = { ...w, ...n.components };
363
- const p = {
509
+ n.components = Object.fromEntries(
510
+ Object.entries({ ...b, ...n.components }).map(([p, y]) => [
511
+ p,
512
+ { ...b[p], ...y }
513
+ ])
514
+ );
515
+ const i = {
364
516
  palette: [],
365
- background: i.card,
366
- foreground: i.foreground,
367
- gridColor: i.border,
368
- axisColor: i.mutedForeground
517
+ background: s.card,
518
+ foreground: s.foreground,
519
+ gridColor: s.border,
520
+ axisColor: s.mutedForeground,
521
+ barRadius: 2
369
522
  };
370
- n.components.chart = { ...p, ...n.components.chart }, n.components.table = {
371
- ...le(i, c),
523
+ n.components.chart = { ...i, ...n.components.chart }, n.components.table = {
524
+ ...ke(s, c),
372
525
  ...n.components.table
373
526
  };
374
527
  }
375
528
  return e;
376
529
  }
377
- function le(e, a) {
530
+ function ke(e, a) {
378
531
  return {
379
532
  density: a.typography.density,
380
533
  container: {
@@ -422,10 +575,10 @@ function le(e, a) {
422
575
  }
423
576
  };
424
577
  }
425
- function re(e) {
578
+ function J(e) {
426
579
  return JSON.parse(JSON.stringify(e));
427
580
  }
428
- const dr = [
581
+ const Or = [
429
582
  ["background", "Canvas"],
430
583
  ["foreground", "Text"],
431
584
  ["card", "Card"],
@@ -441,7 +594,7 @@ const dr = [
441
594
  ["negative", "Negative"],
442
595
  ["warning", "Warning"],
443
596
  ["info", "Info"]
444
- ], cr = [0, 1, 2, 3, 4, 5], M = We, ir = [
597
+ ], W = cr, Tr = [
445
598
  "#ffffff",
446
599
  "#f8fafc",
447
600
  "#f4f4f5",
@@ -455,146 +608,157 @@ const dr = [
455
608
  "#dc2626",
456
609
  "#7c3aed"
457
610
  ];
458
- function Tr({
611
+ function Zr({
459
612
  appearance: e,
460
613
  previewTitle: a,
461
614
  isLoading: n = !1,
462
615
  isSaving: c = !1,
463
- error: i = null,
616
+ error: s = null,
464
617
  className: f,
465
- onDraftChange: g,
466
- onSave: y,
467
- onClearConfig: x,
468
- onCancel: w
618
+ onDraftChange: h,
619
+ onSave: x,
620
+ onClearConfig: v,
621
+ onCancel: b
469
622
  }) {
470
- const [p, u] = b.useState(null), [B, O] = b.useState("light"), [ve, R] = b.useState(!1), [Ne, F] = b.useState(
623
+ const [i, p] = g.useState(null), [y, F] = g.useState("light"), [l, A] = g.useState(!1), [De, O] = g.useState(
471
624
  "idle"
472
- ), [oe, we] = b.useState(!1), [A, I] = b.useState(""), [E, m] = b.useState(null), ae = b.useRef(null), z = b.useRef(g), P = b.useRef(!1);
473
- b.useEffect(() => {
474
- z.current = g;
475
- }, [g]), b.useEffect(() => {
625
+ ), [ce, Ie] = g.useState(!1), [z, U] = g.useState(""), [D, C] = g.useState(null), se = g.useRef(null), I = g.useRef(h), T = g.useRef(!1);
626
+ g.useEffect(() => {
627
+ I.current = h;
628
+ }, [h]), g.useEffect(() => {
476
629
  if (e === void 0) {
477
- P.current = !0, u(null);
630
+ T.current = !0, p(null);
478
631
  return;
479
632
  }
480
- const o = D(e);
481
- P.current = !0, u(o), O("light"), m(null);
482
- }, [e]), b.useEffect(() => {
633
+ const o = R(e);
634
+ T.current = !0, p(o), F("light"), C(null);
635
+ }, [e]), g.useEffect(() => {
483
636
  var o;
484
- if (p) {
485
- if (P.current) {
486
- P.current = !1;
637
+ if (i) {
638
+ if (T.current) {
639
+ T.current = !1;
487
640
  return;
488
641
  }
489
642
  try {
490
- const t = j(p);
491
- (o = z.current) == null || o.call(z, t), m(null);
643
+ const t = $(i);
644
+ (o = I.current) == null || o.call(I, t), C(null);
492
645
  } catch (t) {
493
- m(
646
+ C(
494
647
  t instanceof Error ? t.message : "Appearance is invalid"
495
648
  );
496
649
  }
497
650
  }
498
- }, [p]);
499
- const s = p == null ? void 0 : p.schemes[B], J = c || ve, Se = b.useMemo(
500
- () => s ? ur(s.tokens.radius.control) : void 0,
501
- [s]
502
- ), Fe = (o) => {
503
- u((t) => {
651
+ }, [i]);
652
+ const u = i == null ? void 0 : i.schemes[y], L = c || l, _e = g.useMemo(
653
+ () => u ? Er(u.tokens.radius.control) : void 0,
654
+ [u]
655
+ ), je = (o) => {
656
+ p((t) => {
504
657
  if (!t) return t;
505
- const h = pr(t);
506
- return o(h), h;
658
+ const k = Ar(t);
659
+ return o(k), k;
507
660
  });
508
- }, l = (o) => {
509
- Fe((t) => {
510
- o(t.schemes[B]);
661
+ }, m = (o) => {
662
+ je((t) => {
663
+ o(t.schemes[y]);
511
664
  });
512
- }, Pe = async () => {
513
- if (!p || !y) return;
665
+ }, _ = g.useMemo(() => {
666
+ if (!i) return null;
667
+ try {
668
+ return xe(i);
669
+ } catch {
670
+ return null;
671
+ }
672
+ }, [i]), $e = (o) => {
673
+ if (!_) return null;
674
+ const t = ir({ spec: _, edit: o, mode: y });
675
+ return t.ok ? (p(R(t.spec)), null) : t.refusal;
676
+ }, Je = async () => {
677
+ if (!i || !x) return;
514
678
  let o;
515
679
  try {
516
- o = j(p);
680
+ o = xe(i);
517
681
  } catch (t) {
518
- m(
682
+ C(
519
683
  t instanceof Error ? t.message : "Appearance is invalid"
520
684
  );
521
685
  return;
522
686
  }
523
- R(!0);
687
+ A(!0);
524
688
  try {
525
- await y(o);
689
+ await x(o);
526
690
  } finally {
527
- R(!1);
691
+ A(!1);
528
692
  }
529
- }, Te = () => {
530
- const o = D(null);
531
- F("idle"), u(o);
532
- }, Be = async () => {
533
- if (x) {
534
- R(!0), m(null), F("idle");
693
+ }, Ue = () => {
694
+ const o = R(null);
695
+ O("idle"), p(o);
696
+ }, Le = async () => {
697
+ if (v) {
698
+ A(!0), C(null), O("idle");
535
699
  try {
536
- await x(), P.current = !0, u(D(null)), O("light");
700
+ await v(), T.current = !0, p(R(null)), F("light");
537
701
  } catch (o) {
538
- m(
702
+ C(
539
703
  o instanceof Error ? o.message : "Unable to clear organization appearance"
540
704
  );
541
705
  } finally {
542
- R(!1);
706
+ A(!1);
543
707
  }
544
708
  }
545
- }, ne = b.useCallback(() => p ? JSON.stringify(j(p), null, 2) : "", [p]), Oe = (o) => {
546
- if (we(o), o)
709
+ }, le = g.useCallback(() => i ? JSON.stringify($(i), null, 2) : "", [i]), Me = (o) => {
710
+ if (Ie(o), o)
547
711
  try {
548
- I(ne()), m(null);
712
+ U(le()), C(null);
549
713
  } catch (t) {
550
- m(
714
+ C(
551
715
  t instanceof Error ? t.message : "Appearance is invalid"
552
716
  );
553
717
  }
554
- }, Re = async () => {
555
- if (p)
718
+ }, Ve = async () => {
719
+ if (i)
556
720
  try {
557
- const o = oe && A ? A : ne();
558
- await navigator.clipboard.writeText(o), m(null), F("copied");
721
+ const o = ce && z ? z : le();
722
+ await navigator.clipboard.writeText(o), C(null), O("copied");
559
723
  } catch (o) {
560
- m(
724
+ C(
561
725
  o instanceof Error ? o.message : "Unable to copy brand spec"
562
726
  );
563
727
  }
564
- }, te = (o) => {
565
- const t = JSON.parse(o), h = D(t), S = j(h);
566
- F("idle"), O("light"), u(h), I(JSON.stringify(S, null, 2));
567
- }, Ae = () => {
728
+ }, ie = (o) => {
729
+ const t = JSON.parse(o), k = R(t), w = $(k);
730
+ O("idle"), F("light"), p(k), U(JSON.stringify(w, null, 2));
731
+ }, Ge = () => {
568
732
  try {
569
- te(A);
733
+ ie(z);
570
734
  } catch (o) {
571
- m(
735
+ C(
572
736
  o instanceof Error ? o.message : "Brand spec must be valid JSON"
573
737
  );
574
738
  }
575
- }, Ee = async (o) => {
576
- var h;
577
- const t = (h = o.target.files) == null ? void 0 : h[0];
739
+ }, He = async (o) => {
740
+ var k;
741
+ const t = (k = o.target.files) == null ? void 0 : k[0];
578
742
  if (o.target.value = "", !!t)
579
743
  try {
580
- te(await br(t));
581
- } catch (S) {
582
- m(
583
- S instanceof Error ? S.message : "Uploaded file must be a valid brand spec"
744
+ ie(await zr(t));
745
+ } catch (w) {
746
+ C(
747
+ w instanceof Error ? w.message : "Uploaded file must be a valid brand spec"
584
748
  );
585
749
  }
586
750
  };
587
751
  return /* @__PURE__ */ d(
588
752
  "div",
589
753
  {
590
- className: Q(
754
+ className: te(
591
755
  "flex min-h-0 flex-1 flex-col bg-background text-foreground",
592
756
  f
593
757
  ),
594
- style: Se,
758
+ style: _e,
595
759
  children: [
596
760
  /* @__PURE__ */ d("header", { className: "flex h-11 shrink-0 items-start gap-3 border-b border-border/60 px-4 pt-2", children: [
597
- /* @__PURE__ */ r("div", { className: "mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-control border border-border/70", children: /* @__PURE__ */ r(_, { className: "h-3.5 w-3.5" }) }),
761
+ /* @__PURE__ */ r("div", { className: "mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-control border border-border/70", children: /* @__PURE__ */ r(H, { className: "h-3.5 w-3.5" }) }),
598
762
  /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
599
763
  /* @__PURE__ */ r("h2", { className: "truncate text-[13px] font-semibold leading-tight", children: "Brand Studio" }),
600
764
  /* @__PURE__ */ d("p", { className: "truncate text-[11px] leading-tight text-muted-foreground", children: [
@@ -603,17 +767,17 @@ function Tr({
603
767
  ] })
604
768
  ] }),
605
769
  /* @__PURE__ */ d(
606
- ue,
770
+ ye,
607
771
  {
608
- open: oe,
609
- onOpenChange: Oe,
772
+ open: ce,
773
+ onOpenChange: Me,
610
774
  children: [
611
- /* @__PURE__ */ r(pe, { asChild: !0, children: /* @__PURE__ */ d(C, { type: "button", size: "xs", variant: "ghost", disabled: !p, children: [
612
- /* @__PURE__ */ r(ze, { className: "h-3.5 w-3.5" }),
775
+ /* @__PURE__ */ r(Ne, { asChild: !0, children: /* @__PURE__ */ d(S, { type: "button", size: "xs", variant: "ghost", disabled: !i, children: [
776
+ /* @__PURE__ */ r(qe, { className: "h-3.5 w-3.5" }),
613
777
  "Brand Spec"
614
778
  ] }) }),
615
779
  /* @__PURE__ */ d(
616
- be,
780
+ Se,
617
781
  {
618
782
  align: "end",
619
783
  sideOffset: 6,
@@ -626,44 +790,44 @@ function Tr({
626
790
  ] }),
627
791
  /* @__PURE__ */ d("div", { className: "flex shrink-0 items-center gap-1", children: [
628
792
  /* @__PURE__ */ d(
629
- C,
793
+ S,
630
794
  {
631
795
  type: "button",
632
796
  size: "xs",
633
797
  variant: "ghost",
634
- onClick: Re,
798
+ onClick: Ve,
635
799
  children: [
636
- /* @__PURE__ */ r(rr, { className: "h-3.5 w-3.5" }),
637
- Ne === "copied" ? "Copied" : "Copy"
800
+ /* @__PURE__ */ r(xr, { className: "h-3.5 w-3.5" }),
801
+ De === "copied" ? "Copied" : "Copy"
638
802
  ]
639
803
  }
640
804
  ),
641
805
  /* @__PURE__ */ d(
642
- C,
806
+ S,
643
807
  {
644
808
  type: "button",
645
809
  size: "xs",
646
810
  variant: "ghost",
647
811
  onClick: () => {
648
812
  var o;
649
- return (o = ae.current) == null ? void 0 : o.click();
813
+ return (o = se.current) == null ? void 0 : o.click();
650
814
  },
651
815
  children: [
652
- /* @__PURE__ */ r(Ze, { className: "h-3.5 w-3.5" }),
816
+ /* @__PURE__ */ r(fr, { className: "h-3.5 w-3.5" }),
653
817
  "Upload"
654
818
  ]
655
819
  }
656
820
  ),
657
- /* @__PURE__ */ r(C, { type: "button", size: "xs", onClick: Ae, children: "Apply" })
821
+ /* @__PURE__ */ r(S, { type: "button", size: "xs", onClick: Ge, children: "Apply" })
658
822
  ] })
659
823
  ] }),
660
824
  /* @__PURE__ */ r("div", { className: "h-[320px] overflow-hidden rounded-control border border-input", children: /* @__PURE__ */ r(
661
- De,
825
+ Ke,
662
826
  {
663
827
  ariaLabel: "Brand spec",
664
- value: A,
828
+ value: z,
665
829
  onValueChange: (o) => {
666
- I(o), F("idle");
830
+ U(o), O("idle");
667
831
  },
668
832
  language: "json",
669
833
  embedded: !0,
@@ -680,111 +844,111 @@ function Tr({
680
844
  /* @__PURE__ */ r(
681
845
  "input",
682
846
  {
683
- ref: ae,
847
+ ref: se,
684
848
  "aria-label": "Upload brand spec",
685
849
  type: "file",
686
850
  accept: "application/json,.json",
687
851
  className: "sr-only",
688
- onChange: Ee
852
+ onChange: He
689
853
  }
690
854
  ),
691
855
  /* @__PURE__ */ d(
692
- C,
856
+ S,
693
857
  {
694
858
  type: "button",
695
859
  size: "xs",
696
860
  variant: "ghost",
697
- onClick: Te,
698
- disabled: !p,
861
+ onClick: Ue,
862
+ disabled: !i,
699
863
  children: [
700
- /* @__PURE__ */ r(ge, { className: "h-3.5 w-3.5" }),
864
+ /* @__PURE__ */ r(we, { className: "h-3.5 w-3.5" }),
701
865
  "Reset"
702
866
  ]
703
867
  }
704
868
  ),
705
- x && /* @__PURE__ */ d(
706
- C,
869
+ v && /* @__PURE__ */ d(
870
+ S,
707
871
  {
708
872
  type: "button",
709
873
  size: "xs",
710
874
  variant: "ghost",
711
- onClick: Be,
712
- disabled: J,
875
+ onClick: Le,
876
+ disabled: L,
713
877
  children: [
714
- /* @__PURE__ */ r(er, { className: "h-3.5 w-3.5" }),
878
+ /* @__PURE__ */ r(hr, { className: "h-3.5 w-3.5" }),
715
879
  "No config"
716
880
  ]
717
881
  }
718
882
  ),
719
883
  /* @__PURE__ */ d(
720
- C,
884
+ S,
721
885
  {
722
886
  type: "button",
723
887
  size: "xs",
724
- onClick: Pe,
725
- disabled: !p || J || !!E || !y,
888
+ onClick: Je,
889
+ disabled: !i || L || !!D || !x,
726
890
  children: [
727
- J ? /* @__PURE__ */ r(ce, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(Ke, { className: "h-3.5 w-3.5" }),
891
+ L ? /* @__PURE__ */ r(fe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(mr, { className: "h-3.5 w-3.5" }),
728
892
  "Save"
729
893
  ]
730
894
  }
731
895
  ),
732
- w && /* @__PURE__ */ r(
896
+ b && /* @__PURE__ */ r(
733
897
  "button",
734
898
  {
735
899
  type: "button",
736
900
  "aria-label": "Close Brand Studio",
737
901
  className: "flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",
738
- onClick: w,
739
- children: /* @__PURE__ */ r(je, { className: "h-3.5 w-3.5" })
902
+ onClick: b,
903
+ children: /* @__PURE__ */ r(Xe, { className: "h-3.5 w-3.5" })
740
904
  }
741
905
  )
742
906
  ] }),
743
907
  /* @__PURE__ */ d("div", { className: "flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2", children: [
744
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2 text-[12px] text-muted-foreground", children: E ? /* @__PURE__ */ d(de, { children: [
745
- /* @__PURE__ */ r(ie, { className: "h-3.5 w-3.5 text-destructive" }),
908
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2 text-[12px] text-muted-foreground", children: D ? /* @__PURE__ */ d(ue, { children: [
909
+ /* @__PURE__ */ r(me, { className: "h-3.5 w-3.5 text-destructive" }),
746
910
  "Preview keeps the last valid draft"
747
- ] }) : /* @__PURE__ */ d(de, { children: [
748
- /* @__PURE__ */ r(Ie, { className: "h-3.5 w-3.5 text-emerald-500" }),
911
+ ] }) : /* @__PURE__ */ d(ue, { children: [
912
+ /* @__PURE__ */ r(Ze, { className: "h-3.5 w-3.5 text-emerald-500" }),
749
913
  "Draft is applied to the live dashboard preview"
750
914
  ] }) }),
751
915
  /* @__PURE__ */ r("div", { className: "inline-flex h-7 items-center overflow-hidden rounded-control border border-border/70", children: ["light", "dark"].map((o) => /* @__PURE__ */ r(
752
916
  "button",
753
917
  {
754
918
  type: "button",
755
- className: Q(
919
+ className: te(
756
920
  "h-full px-2.5 text-[12px] capitalize transition-colors",
757
- B === o ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground"
921
+ y === o ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground"
758
922
  ),
759
- onClick: () => O(o),
923
+ onClick: () => F(o),
760
924
  children: o
761
925
  },
762
926
  o
763
927
  )) })
764
928
  ] }),
765
- E && /* @__PURE__ */ r("div", { className: "border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive", children: E }),
766
- n ? /* @__PURE__ */ r("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ r(ce, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : i ? /* @__PURE__ */ r("div", { className: "p-4 text-[13px] text-muted-foreground", children: i }) : p && s ? /* @__PURE__ */ d(Je, { defaultValue: "style", className: "flex min-h-0 flex-1 flex-col", children: [
767
- /* @__PURE__ */ r("div", { className: "shrink-0 px-4 pt-3", children: /* @__PURE__ */ d(Le, { variant: "underline", className: "w-full gap-5", children: [
768
- /* @__PURE__ */ r(L, { value: "style", children: "Style" }),
769
- /* @__PURE__ */ r(L, { value: "surfaces", children: "Surfaces" }),
770
- /* @__PURE__ */ r(L, { value: "data", children: "Data" })
929
+ D && /* @__PURE__ */ r("div", { className: "border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive", children: D }),
930
+ n ? /* @__PURE__ */ r("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ r(fe, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : s ? /* @__PURE__ */ r("div", { className: "p-4 text-[13px] text-muted-foreground", children: s }) : i && u ? /* @__PURE__ */ d(Qe, { defaultValue: "style", className: "flex min-h-0 flex-1 flex-col", children: [
931
+ /* @__PURE__ */ r("div", { className: "shrink-0 px-4 pt-3", children: /* @__PURE__ */ d(er, { variant: "underline", className: "w-full gap-5", children: [
932
+ /* @__PURE__ */ r(V, { value: "style", children: "Style" }),
933
+ /* @__PURE__ */ r(V, { value: "surfaces", children: "Surfaces" }),
934
+ /* @__PURE__ */ r(V, { value: "data", children: "Data" })
771
935
  ] }) }),
772
- /* @__PURE__ */ d($e, { className: "min-h-0 flex-1", children: [
773
- /* @__PURE__ */ d($, { value: "style", className: "m-0 p-4", children: [
936
+ /* @__PURE__ */ d(rr, { className: "min-h-0 flex-1", children: [
937
+ /* @__PURE__ */ d(G, { value: "style", className: "m-0 p-4", children: [
774
938
  /* @__PURE__ */ r(
775
- v,
939
+ P,
776
940
  {
777
- icon: _,
941
+ icon: H,
778
942
  title: "Presets",
779
943
  description: "Start from a full light and dark appearance.",
780
- children: /* @__PURE__ */ r("div", { className: "grid grid-cols-1 gap-2", children: Ce.map((o) => /* @__PURE__ */ d(
944
+ children: /* @__PURE__ */ r("div", { className: "grid grid-cols-1 gap-2", children: Ae.map((o) => /* @__PURE__ */ d(
781
945
  "button",
782
946
  {
783
947
  type: "button",
784
948
  className: "flex items-center gap-3 rounded-control border border-border/70 px-3 py-2 text-left hover:bg-muted/60",
785
949
  onClick: () => {
786
- const t = nr(p, o.id);
787
- u(t);
950
+ const t = Fr(i, o.id);
951
+ p(t);
788
952
  },
789
953
  children: [
790
954
  /* @__PURE__ */ d("div", { className: "flex h-7 w-10 overflow-hidden rounded-control border border-border/70", children: [
@@ -814,18 +978,18 @@ function Tr({
814
978
  }
815
979
  ),
816
980
  /* @__PURE__ */ r(
817
- v,
981
+ P,
818
982
  {
819
- icon: _,
983
+ icon: H,
820
984
  title: "Color",
821
- description: `Editing the ${B} scheme.`,
822
- children: /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-2", children: dr.map(([o, t]) => /* @__PURE__ */ r(
823
- k,
985
+ description: `Editing the ${y} scheme.`,
986
+ children: /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-2", children: Or.map(([o, t]) => /* @__PURE__ */ r(
987
+ N,
824
988
  {
825
989
  label: t,
826
- value: s.tokens.color[o],
827
- onChange: (h) => l((S) => {
828
- U(S, o, h);
990
+ value: u.tokens.color[o],
991
+ onChange: (k) => m((w) => {
992
+ Y(w, o, k);
829
993
  })
830
994
  },
831
995
  o
@@ -833,45 +997,45 @@ function Tr({
833
997
  }
834
998
  ),
835
999
  /* @__PURE__ */ d(
836
- v,
1000
+ P,
837
1001
  {
838
- icon: _e,
1002
+ icon: or,
839
1003
  title: "Typography",
840
1004
  description: "Fonts and density used by dashboard and workflow chrome.",
841
1005
  children: [
842
1006
  /* @__PURE__ */ r(
843
- sr,
1007
+ Br,
844
1008
  {
845
- value: s.tokens.typography.fontFamily,
846
- onChange: (o) => l((t) => {
1009
+ value: u.tokens.typography.fontFamily,
1010
+ onChange: (o) => m((t) => {
847
1011
  t.tokens.typography.fontFamily = o, t.tokens.typography.headingFontFamily = o;
848
1012
  })
849
1013
  }
850
1014
  ),
851
1015
  /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
852
1016
  /* @__PURE__ */ r(
853
- N,
1017
+ K,
854
1018
  {
855
1019
  label: "Base size",
856
- value: s.tokens.typography.baseFontSize,
1020
+ value: u.tokens.typography.baseFontSize,
857
1021
  min: 11,
858
1022
  max: 18,
859
- onChange: (o) => l((t) => {
1023
+ onChange: (o) => m((t) => {
860
1024
  t.tokens.typography.baseFontSize = o;
861
1025
  })
862
1026
  }
863
1027
  ),
864
1028
  /* @__PURE__ */ r(
865
- W,
1029
+ X,
866
1030
  {
867
1031
  label: "Density",
868
- value: s.tokens.typography.density,
1032
+ value: u.tokens.typography.density,
869
1033
  options: [
870
1034
  ["compact", "Compact"],
871
1035
  ["comfortable", "Comfortable"],
872
1036
  ["spacious", "Spacious"]
873
1037
  ],
874
- onChange: (o) => l((t) => {
1038
+ onChange: (o) => m((t) => {
875
1039
  t.tokens.typography.density = o, t.components.table.density = t.tokens.typography.density;
876
1040
  })
877
1041
  }
@@ -881,92 +1045,39 @@ function Tr({
881
1045
  }
882
1046
  )
883
1047
  ] }),
884
- /* @__PURE__ */ d($, { value: "surfaces", className: "m-0 p-4", children: [
1048
+ /* @__PURE__ */ d(G, { value: "surfaces", className: "m-0 p-4", children: [
885
1049
  /* @__PURE__ */ d(
886
- v,
1050
+ P,
887
1051
  {
888
- icon: Qe,
1052
+ icon: gr,
889
1053
  title: "Layout",
890
1054
  description: "Canvas, grid, and card rhythm for embedded dashboards.",
891
1055
  children: [
1056
+ _ ? /* @__PURE__ */ r(yr, { spec: _, mode: y, onEdit: $e }) : null,
892
1057
  /* @__PURE__ */ d("div", { className: "grid grid-cols-3 gap-2", children: [
893
1058
  /* @__PURE__ */ r(
894
- N,
895
- {
896
- label: "Canvas pad",
897
- tooltip: "Outer padding around the dashboard canvas before cards begin.",
898
- value: s.tokens.spacing.dashboardPadding,
899
- min: 0,
900
- max: 48,
901
- onChange: (o) => l((t) => {
902
- t.tokens.spacing.dashboardPadding = o, t.components.dashboard.padding = o;
903
- })
904
- }
905
- ),
906
- /* @__PURE__ */ r(
907
- N,
908
- {
909
- label: "Grid gap",
910
- tooltip: "Spacing between dashboard cards in the grid.",
911
- value: s.tokens.spacing.gridGap,
912
- min: 0,
913
- max: 32,
914
- onChange: (o) => l((t) => {
915
- t.tokens.spacing.gridGap = o;
916
- })
917
- }
918
- ),
919
- /* @__PURE__ */ r(
920
- N,
1059
+ K,
921
1060
  {
922
1061
  label: "Card pad",
923
1062
  tooltip: "Inner padding inside card/widget frames around titles, controls, and visual content.",
924
- value: s.tokens.spacing.cardPadding,
1063
+ value: u.tokens.spacing.cardPadding,
925
1064
  min: 0,
926
1065
  max: 32,
927
- onChange: (o) => l((t) => {
928
- t.tokens.spacing.cardPadding = o, t.components.card.padding = o;
929
- })
930
- }
931
- )
932
- ] }),
933
- /* @__PURE__ */ d("div", { className: "grid grid-cols-3 gap-2", children: [
934
- /* @__PURE__ */ r(
935
- N,
936
- {
937
- label: "Control radius",
938
- tooltip: "Corner radius for buttons, inputs, selects, checkboxes, segmented controls, and similar interactive controls.",
939
- value: s.tokens.radius.control,
940
- min: 0,
941
- max: 12,
942
- onChange: (o) => l((t) => {
943
- V(t, "control", o);
1066
+ onChange: (o) => m((t) => {
1067
+ t.tokens.spacing.cardPadding = o;
944
1068
  })
945
1069
  }
946
1070
  ),
947
1071
  /* @__PURE__ */ r(
948
- N,
949
- {
950
- label: "Card/widget radius",
951
- tooltip: "Corner radius for dashboard card frames and widget containers.",
952
- value: s.tokens.radius.card,
953
- min: 0,
954
- max: 12,
955
- onChange: (o) => l((t) => {
956
- V(t, "card", o);
957
- })
958
- }
959
- ),
960
- /* @__PURE__ */ r(
961
- N,
1072
+ K,
962
1073
  {
963
1074
  label: "Table radius",
964
1075
  tooltip: "Corner radius for table containers, table chrome, and table pagination surfaces.",
965
- value: s.tokens.radius.table,
1076
+ value: u.tokens.radius.table,
966
1077
  min: 0,
967
1078
  max: 12,
968
- onChange: (o) => l((t) => {
969
- V(t, "table", o);
1079
+ onChange: (o) => m((t) => {
1080
+ Pr(t, "table", o);
970
1081
  })
971
1082
  }
972
1083
  )
@@ -975,53 +1086,53 @@ function Tr({
975
1086
  }
976
1087
  ),
977
1088
  /* @__PURE__ */ r(
978
- v,
1089
+ P,
979
1090
  {
980
- icon: ie,
1091
+ icon: me,
981
1092
  title: "Filters and Controls",
982
1093
  description: "Dashboard filter/control toolbar, chip states, menus, and settings panels.",
983
1094
  children: /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
984
1095
  /* @__PURE__ */ r(
985
- k,
1096
+ N,
986
1097
  {
987
1098
  label: "Toolbar background",
988
1099
  tooltip: "Background color for the dashboard filter/control toolbar strip. This is separate from chip state colors.",
989
- value: s.components.interactive.toolbarBackground || s.tokens.color.background,
990
- onChange: (o) => l((t) => {
1100
+ value: u.components.interactive.toolbarBackground || u.tokens.color.background,
1101
+ onChange: (o) => m((t) => {
991
1102
  t.components.interactive.toolbarBackground = o;
992
1103
  })
993
1104
  }
994
1105
  ),
995
1106
  /* @__PURE__ */ r(
996
- k,
1107
+ N,
997
1108
  {
998
1109
  label: "Default state",
999
1110
  tooltip: "Unselected filter/control chips plus the base surface for their menus, dialogs, and pagination fallback.",
1000
- value: s.components.interactive.background || s.tokens.color.card,
1001
- onChange: (o) => l((t) => {
1111
+ value: u.components.interactive.background || u.tokens.color.card,
1112
+ onChange: (o) => m((t) => {
1002
1113
  t.components.interactive.background = o, t.components.pagination.background = o;
1003
1114
  })
1004
1115
  }
1005
1116
  ),
1006
1117
  /* @__PURE__ */ r(
1007
- k,
1118
+ N,
1008
1119
  {
1009
1120
  label: "Border",
1010
1121
  tooltip: "Border color for filter/control chips, runtime inputs, settings panels, and related popover chrome.",
1011
- value: s.components.interactive.borderColor || s.tokens.color.border,
1012
- onChange: (o) => l((t) => {
1122
+ value: u.components.interactive.borderColor || u.tokens.color.border,
1123
+ onChange: (o) => m((t) => {
1013
1124
  t.components.interactive.borderColor = o, t.components.pagination.borderColor = o;
1014
1125
  })
1015
1126
  }
1016
1127
  ),
1017
1128
  /* @__PURE__ */ r(
1018
- k,
1129
+ N,
1019
1130
  {
1020
1131
  label: "Selected state",
1021
1132
  tooltip: "Selected filter/control chips and hover feedback. This keeps a lighter default state and a stronger selected state.",
1022
- value: s.tokens.color.accent,
1023
- onChange: (o) => l((t) => {
1024
- U(t, "accent", o);
1133
+ value: u.tokens.color.accent,
1134
+ onChange: (o) => m((t) => {
1135
+ Y(t, "accent", o);
1025
1136
  })
1026
1137
  }
1027
1138
  )
@@ -1029,42 +1140,68 @@ function Tr({
1029
1140
  }
1030
1141
  )
1031
1142
  ] }),
1032
- /* @__PURE__ */ d($, { value: "data", className: "m-0 p-4", children: [
1143
+ /* @__PURE__ */ d(G, { value: "data", className: "m-0 p-4", children: [
1033
1144
  /* @__PURE__ */ d(
1034
- v,
1145
+ P,
1035
1146
  {
1036
- icon: Ue,
1147
+ icon: ar,
1037
1148
  title: "Charts",
1038
1149
  description: "Palette and semantic chart text/grid colors.",
1039
1150
  children: [
1040
- /* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children: cr.map((o) => /* @__PURE__ */ r(
1041
- k,
1151
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2", children: u.components.chart.palette.map((o, t) => /* @__PURE__ */ d("div", { className: "flex items-end gap-1", children: [
1152
+ /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ r(
1153
+ N,
1154
+ {
1155
+ label: `Series ${t + 1}`,
1156
+ value: o || "#000000",
1157
+ onChange: (k) => m((w) => {
1158
+ w.components.chart.palette[t] = k;
1159
+ })
1160
+ }
1161
+ ) }),
1162
+ u.components.chart.palette.length > 1 ? /* @__PURE__ */ r(
1163
+ S,
1164
+ {
1165
+ size: "xs",
1166
+ variant: "ghost",
1167
+ "aria-label": `Remove series ${t + 1} color`,
1168
+ className: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground",
1169
+ onClick: () => m((k) => {
1170
+ k.components.chart.palette.splice(t, 1);
1171
+ }),
1172
+ children: "×"
1173
+ }
1174
+ ) : null
1175
+ ] }, t)) }),
1176
+ u.components.chart.palette.length < 12 ? /* @__PURE__ */ r(
1177
+ S,
1042
1178
  {
1043
- label: `Series ${o + 1}`,
1044
- value: s.components.chart.palette[o] || "#000000",
1045
- onChange: (t) => l((h) => {
1046
- h.components.chart.palette[o] = t;
1047
- })
1048
- },
1049
- o
1050
- )) }),
1179
+ size: "xs",
1180
+ variant: "outline",
1181
+ className: "w-fit",
1182
+ onClick: () => m((o) => {
1183
+ o.components.chart.palette.push("#64748b");
1184
+ }),
1185
+ children: "Add a color"
1186
+ }
1187
+ ) : null,
1051
1188
  /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1052
1189
  /* @__PURE__ */ r(
1053
- k,
1190
+ N,
1054
1191
  {
1055
1192
  label: "Grid",
1056
- value: s.components.chart.gridColor,
1057
- onChange: (o) => l((t) => {
1193
+ value: u.components.chart.gridColor,
1194
+ onChange: (o) => m((t) => {
1058
1195
  t.components.chart.gridColor = o;
1059
1196
  })
1060
1197
  }
1061
1198
  ),
1062
1199
  /* @__PURE__ */ r(
1063
- k,
1200
+ N,
1064
1201
  {
1065
1202
  label: "Axis",
1066
- value: s.components.chart.axisColor,
1067
- onChange: (o) => l((t) => {
1203
+ value: u.components.chart.axisColor,
1204
+ onChange: (o) => m((t) => {
1068
1205
  t.components.chart.axisColor = o;
1069
1206
  })
1070
1207
  }
@@ -1074,38 +1211,38 @@ function Tr({
1074
1211
  }
1075
1212
  ),
1076
1213
  /* @__PURE__ */ d(
1077
- v,
1214
+ P,
1078
1215
  {
1079
- icon: Ve,
1216
+ icon: nr,
1080
1217
  title: "Tables",
1081
1218
  description: "All tables share this appearance.",
1082
1219
  children: [
1083
1220
  /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1084
1221
  /* @__PURE__ */ r(
1085
- W,
1222
+ X,
1086
1223
  {
1087
1224
  label: "Density",
1088
- value: s.components.table.density,
1225
+ value: u.components.table.density,
1089
1226
  options: [
1090
1227
  ["compact", "Compact"],
1091
1228
  ["comfortable", "Comfortable"],
1092
1229
  ["spacious", "Spacious"]
1093
1230
  ],
1094
- onChange: (o) => l((t) => {
1231
+ onChange: (o) => m((t) => {
1095
1232
  t.components.table.density = o;
1096
1233
  })
1097
1234
  }
1098
1235
  ),
1099
1236
  /* @__PURE__ */ r(
1100
- W,
1237
+ X,
1101
1238
  {
1102
1239
  label: "Cell wrap",
1103
- value: s.components.table.cell.wrap,
1240
+ value: u.components.table.cell.wrap,
1104
1241
  options: [
1105
1242
  ["nowrap", "No wrap"],
1106
1243
  ["wrap", "Wrap"]
1107
1244
  ],
1108
- onChange: (o) => l((t) => {
1245
+ onChange: (o) => m((t) => {
1109
1246
  t.components.table.cell.wrap = o;
1110
1247
  })
1111
1248
  }
@@ -1113,62 +1250,62 @@ function Tr({
1113
1250
  ] }),
1114
1251
  /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1115
1252
  /* @__PURE__ */ r(
1116
- k,
1253
+ N,
1117
1254
  {
1118
1255
  label: "Header",
1119
- value: s.components.table.header.background,
1120
- onChange: (o) => l((t) => {
1256
+ value: u.components.table.header.background,
1257
+ onChange: (o) => m((t) => {
1121
1258
  t.components.table.header.background = o;
1122
1259
  })
1123
1260
  }
1124
1261
  ),
1125
1262
  /* @__PURE__ */ r(
1126
- k,
1263
+ N,
1127
1264
  {
1128
1265
  label: "Divider",
1129
- value: s.components.table.row.dividerColor,
1130
- onChange: (o) => l((t) => {
1266
+ value: u.components.table.row.dividerColor,
1267
+ onChange: (o) => m((t) => {
1131
1268
  t.components.table.row.dividerColor = o, t.components.table.header.dividerColor = o;
1132
1269
  })
1133
1270
  }
1134
1271
  ),
1135
1272
  /* @__PURE__ */ r(
1136
- k,
1273
+ N,
1137
1274
  {
1138
1275
  label: "Selection",
1139
- value: s.tokens.color.selection,
1140
- onChange: (o) => l((t) => {
1141
- U(t, "selection", o);
1276
+ value: u.tokens.color.selection,
1277
+ onChange: (o) => m((t) => {
1278
+ Y(t, "selection", o);
1142
1279
  })
1143
1280
  }
1144
1281
  )
1145
1282
  ] }),
1146
1283
  /* @__PURE__ */ r(
1147
- H,
1284
+ Z,
1148
1285
  {
1149
1286
  label: "Zebra rows",
1150
- checked: s.components.table.row.zebra,
1151
- onCheckedChange: (o) => l((t) => {
1287
+ checked: u.components.table.row.zebra,
1288
+ onCheckedChange: (o) => m((t) => {
1152
1289
  t.components.table.row.zebra = o;
1153
1290
  })
1154
1291
  }
1155
1292
  ),
1156
1293
  /* @__PURE__ */ r(
1157
- H,
1294
+ Z,
1158
1295
  {
1159
1296
  label: "Sticky headers",
1160
- checked: s.components.table.header.sticky,
1161
- onCheckedChange: (o) => l((t) => {
1297
+ checked: u.components.table.header.sticky,
1298
+ onCheckedChange: (o) => m((t) => {
1162
1299
  t.components.table.header.sticky = o;
1163
1300
  })
1164
1301
  }
1165
1302
  ),
1166
1303
  /* @__PURE__ */ r(
1167
- H,
1304
+ Z,
1168
1305
  {
1169
1306
  label: "Uppercase headers",
1170
- checked: s.components.table.header.uppercase,
1171
- onCheckedChange: (o) => l((t) => {
1307
+ checked: u.components.table.header.uppercase,
1308
+ onCheckedChange: (o) => m((t) => {
1172
1309
  t.components.table.header.uppercase = o;
1173
1310
  })
1174
1311
  }
@@ -1183,7 +1320,7 @@ function Tr({
1183
1320
  }
1184
1321
  );
1185
1322
  }
1186
- function v({
1323
+ function P({
1187
1324
  icon: e,
1188
1325
  title: a,
1189
1326
  description: n,
@@ -1198,31 +1335,31 @@ function v({
1198
1335
  ] })
1199
1336
  ] }),
1200
1337
  /* @__PURE__ */ r("div", { className: "space-y-2", children: c }),
1201
- /* @__PURE__ */ r(Me, { className: "mt-5 bg-border/60" })
1338
+ /* @__PURE__ */ r(tr, { className: "mt-5 bg-border/60" })
1202
1339
  ] });
1203
1340
  }
1204
- function sr({
1341
+ function Br({
1205
1342
  value: e,
1206
1343
  onChange: a
1207
1344
  }) {
1208
1345
  var c;
1209
- const n = (c = M.find((i) => i.value === e)) == null ? void 0 : c.id;
1346
+ const n = (c = W.find((s) => s.value === e)) == null ? void 0 : c.id;
1210
1347
  return /* @__PURE__ */ d("div", { children: [
1211
- /* @__PURE__ */ r(T, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: "Font family" }),
1348
+ /* @__PURE__ */ r(E, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: "Font family" }),
1212
1349
  /* @__PURE__ */ d("div", { className: "grid grid-cols-[minmax(0,1fr)_150px] gap-2", children: [
1213
1350
  /* @__PURE__ */ d(
1214
- me,
1351
+ Pe,
1215
1352
  {
1216
1353
  value: n,
1217
- onValueChange: (i) => {
1218
- const f = M.find(
1219
- (g) => g.id === i
1354
+ onValueChange: (s) => {
1355
+ const f = W.find(
1356
+ (h) => h.id === s
1220
1357
  );
1221
1358
  f && a(f.value);
1222
1359
  },
1223
1360
  children: [
1224
- /* @__PURE__ */ r(he, { size: "xs", "aria-label": "Font family preset", children: /* @__PURE__ */ r(ke, { placeholder: "Select font" }) }),
1225
- /* @__PURE__ */ r(xe, { children: M.map((i) => /* @__PURE__ */ r(ye, { value: i.id, children: i.label }, i.id)) })
1361
+ /* @__PURE__ */ r(Oe, { size: "xs", "aria-label": "Font family preset", children: /* @__PURE__ */ r(Te, { placeholder: "Select font" }) }),
1362
+ /* @__PURE__ */ r(Be, { children: W.map((s) => /* @__PURE__ */ r(Re, { value: s.id, children: s.label }, s.id)) })
1226
1363
  ]
1227
1364
  }
1228
1365
  ),
@@ -1237,34 +1374,34 @@ function sr({
1237
1374
  ] })
1238
1375
  ] });
1239
1376
  }
1240
- function k({
1377
+ function N({
1241
1378
  label: e,
1242
1379
  tooltip: a,
1243
1380
  value: n,
1244
1381
  onChange: c
1245
1382
  }) {
1246
- const [i, f] = b.useState(!1), [g, y] = b.useState(n), x = lr(n), w = n !== g, p = (u) => {
1247
- f(u), u && y(n);
1383
+ const [s, f] = g.useState(!1), [h, x] = g.useState(n), v = Rr(n), b = n !== h, i = (p) => {
1384
+ f(p), p && x(n);
1248
1385
  };
1249
1386
  return /* @__PURE__ */ d("div", { className: "block", children: [
1250
1387
  /* @__PURE__ */ d("div", { className: "mb-1 flex items-center gap-1", children: [
1251
- /* @__PURE__ */ r(T, { className: "text-[11px] font-normal text-muted-foreground", children: e }),
1252
- a ? /* @__PURE__ */ r(X, { children: /* @__PURE__ */ d(Y, { children: [
1253
- /* @__PURE__ */ r(q, { asChild: !0, children: /* @__PURE__ */ r(
1388
+ /* @__PURE__ */ r(E, { className: "text-[11px] font-normal text-muted-foreground", children: e }),
1389
+ a ? /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ d(ee, { children: [
1390
+ /* @__PURE__ */ r(re, { asChild: !0, children: /* @__PURE__ */ r(
1254
1391
  "button",
1255
1392
  {
1256
1393
  type: "button",
1257
1394
  "aria-label": `${e} details`,
1258
1395
  className: "inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",
1259
- children: /* @__PURE__ */ r(fe, { className: "h-3 w-3" })
1396
+ children: /* @__PURE__ */ r(Fe, { className: "h-3 w-3" })
1260
1397
  }
1261
1398
  ) }),
1262
- /* @__PURE__ */ r(Z, { side: "top", className: "max-w-64", children: a })
1399
+ /* @__PURE__ */ r(oe, { side: "top", className: "max-w-64", children: a })
1263
1400
  ] }) }) : null
1264
1401
  ] }),
1265
1402
  /* @__PURE__ */ d("div", { className: "flex h-7 items-center overflow-hidden rounded-control border border-input bg-background", children: [
1266
- /* @__PURE__ */ d(ue, { open: i, onOpenChange: p, children: [
1267
- /* @__PURE__ */ r(pe, { asChild: !0, children: /* @__PURE__ */ r(
1403
+ /* @__PURE__ */ d(ye, { open: s, onOpenChange: i, children: [
1404
+ /* @__PURE__ */ r(Ne, { asChild: !0, children: /* @__PURE__ */ r(
1268
1405
  "button",
1269
1406
  {
1270
1407
  type: "button",
@@ -1275,7 +1412,7 @@ function k({
1275
1412
  }
1276
1413
  ) }),
1277
1414
  /* @__PURE__ */ d(
1278
- be,
1415
+ Se,
1279
1416
  {
1280
1417
  align: "start",
1281
1418
  sideOffset: 6,
@@ -1293,176 +1430,177 @@ function k({
1293
1430
  {
1294
1431
  "aria-label": `${e} native color picker`,
1295
1432
  type: "color",
1296
- value: x,
1297
- onChange: (u) => c(u.target.value),
1433
+ value: v,
1434
+ onChange: (p) => c(p.target.value),
1298
1435
  className: "absolute inset-0 h-full w-full cursor-pointer opacity-0"
1299
1436
  }
1300
1437
  ),
1301
- /* @__PURE__ */ r("span", { className: "rounded-control bg-black/45 p-1 text-white shadow-sm", children: /* @__PURE__ */ r(or, { className: "h-3.5 w-3.5" }) })
1438
+ /* @__PURE__ */ r("span", { className: "rounded-control bg-black/45 p-1 text-white shadow-sm", children: /* @__PURE__ */ r(vr, { className: "h-3.5 w-3.5" }) })
1302
1439
  ]
1303
1440
  }
1304
1441
  ),
1305
1442
  /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
1306
1443
  /* @__PURE__ */ d("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
1307
- /* @__PURE__ */ r(T, { className: "block text-[11px] font-normal text-muted-foreground", children: "Color value" }),
1308
- /* @__PURE__ */ r(X, { children: /* @__PURE__ */ d(Y, { children: [
1309
- /* @__PURE__ */ r(q, { asChild: !0, children: /* @__PURE__ */ r(
1444
+ /* @__PURE__ */ r(E, { className: "block text-[11px] font-normal text-muted-foreground", children: "Color value" }),
1445
+ /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ d(ee, { children: [
1446
+ /* @__PURE__ */ r(re, { asChild: !0, children: /* @__PURE__ */ r(
1310
1447
  "button",
1311
1448
  {
1312
1449
  type: "button",
1313
1450
  "aria-label": `Reset ${e} color to previous value`,
1314
- disabled: !w,
1451
+ disabled: !b,
1315
1452
  className: "inline-flex h-5 w-5 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",
1316
- onClick: () => c(g),
1317
- children: /* @__PURE__ */ r(ge, { className: "h-3 w-3" })
1453
+ onClick: () => c(h),
1454
+ children: /* @__PURE__ */ r(we, { className: "h-3 w-3" })
1318
1455
  }
1319
1456
  ) }),
1320
- /* @__PURE__ */ r(Z, { side: "top", children: "Reset to previous value" })
1457
+ /* @__PURE__ */ r(oe, { side: "top", children: "Reset to previous value" })
1321
1458
  ] }) })
1322
1459
  ] }),
1323
1460
  /* @__PURE__ */ r(
1324
- K,
1461
+ ae,
1325
1462
  {
1326
1463
  size: "xs",
1327
1464
  "aria-label": `${e} popover color value`,
1328
1465
  value: n,
1329
- onChange: (u) => c(u.target.value),
1466
+ onChange: (p) => c(p.target.value),
1330
1467
  className: "font-mono"
1331
1468
  }
1332
1469
  )
1333
1470
  ] })
1334
1471
  ] }),
1335
- /* @__PURE__ */ r("div", { className: "mt-2 grid grid-cols-6 gap-1", children: ir.map((u) => /* @__PURE__ */ r(
1472
+ /* @__PURE__ */ r("div", { className: "mt-2 grid grid-cols-6 gap-1", children: Tr.map((p) => /* @__PURE__ */ r(
1336
1473
  "button",
1337
1474
  {
1338
1475
  type: "button",
1339
- "aria-label": `Set ${e} to ${u}`,
1340
- className: Q(
1476
+ "aria-label": `Set ${e} to ${p}`,
1477
+ className: te(
1341
1478
  "h-6 rounded-control border border-border/70 shadow-sm",
1342
- n.toLowerCase() === u && "ring-2 ring-ring"
1479
+ n.toLowerCase() === p && "ring-2 ring-ring"
1343
1480
  ),
1344
- style: { backgroundColor: u },
1345
- onClick: () => c(u)
1481
+ style: { backgroundColor: p },
1482
+ onClick: () => c(p)
1346
1483
  },
1347
- u
1484
+ p
1348
1485
  )) })
1349
1486
  ]
1350
1487
  }
1351
1488
  )
1352
1489
  ] }),
1353
1490
  /* @__PURE__ */ r(
1354
- K,
1491
+ ae,
1355
1492
  {
1356
1493
  size: "xs",
1357
1494
  "aria-label": `${e} color value`,
1358
1495
  value: n,
1359
- onChange: (u) => c(u.target.value),
1496
+ onChange: (p) => c(p.target.value),
1360
1497
  className: "h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"
1361
1498
  }
1362
1499
  )
1363
1500
  ] })
1364
1501
  ] });
1365
1502
  }
1366
- function lr(e) {
1367
- const a = He(e);
1368
- return a ? `#${G(a.r)}${G(a.g)}${G(a.b)}` : "#000000";
1503
+ function Rr(e) {
1504
+ const a = sr(e);
1505
+ return a ? `#${q(a.r)}${q(a.g)}${q(a.b)}` : "#000000";
1369
1506
  }
1370
- function G(e) {
1507
+ function q(e) {
1371
1508
  return Math.round(e).toString(16).padStart(2, "0");
1372
1509
  }
1373
- function N({
1510
+ function K({
1374
1511
  label: e,
1375
1512
  tooltip: a,
1376
1513
  value: n,
1377
1514
  min: c,
1378
- max: i,
1515
+ max: s,
1379
1516
  onChange: f
1380
1517
  }) {
1381
- const g = b.useId();
1518
+ const h = g.useId();
1382
1519
  return /* @__PURE__ */ d("div", { className: "block", children: [
1383
1520
  /* @__PURE__ */ d("div", { className: "mb-1 flex items-center gap-1", children: [
1384
1521
  /* @__PURE__ */ r(
1385
- T,
1522
+ E,
1386
1523
  {
1387
- htmlFor: g,
1524
+ htmlFor: h,
1388
1525
  className: "text-[11px] font-normal text-muted-foreground",
1389
1526
  children: e
1390
1527
  }
1391
1528
  ),
1392
- a ? /* @__PURE__ */ r(X, { children: /* @__PURE__ */ d(Y, { children: [
1393
- /* @__PURE__ */ r(q, { asChild: !0, children: /* @__PURE__ */ r(
1529
+ a ? /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ d(ee, { children: [
1530
+ /* @__PURE__ */ r(re, { asChild: !0, children: /* @__PURE__ */ r(
1394
1531
  "button",
1395
1532
  {
1396
1533
  type: "button",
1397
1534
  "aria-label": `${e} details`,
1398
1535
  className: "inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",
1399
- children: /* @__PURE__ */ r(fe, { className: "h-3 w-3" })
1536
+ children: /* @__PURE__ */ r(Fe, { className: "h-3 w-3" })
1400
1537
  }
1401
1538
  ) }),
1402
- /* @__PURE__ */ r(Z, { side: "top", className: "max-w-56", children: a })
1539
+ /* @__PURE__ */ r(oe, { side: "top", className: "max-w-56", children: a })
1403
1540
  ] }) }) : null
1404
1541
  ] }),
1405
1542
  /* @__PURE__ */ r(
1406
- K,
1543
+ ae,
1407
1544
  {
1408
- id: g,
1545
+ id: h,
1409
1546
  size: "xs",
1410
1547
  type: "number",
1411
1548
  min: c,
1412
- max: i,
1549
+ max: s,
1413
1550
  value: n,
1414
- onChange: (y) => {
1415
- const x = Number(y.target.value);
1416
- Number.isNaN(x) || f(x);
1551
+ onChange: (x) => {
1552
+ const v = Number(x.target.value);
1553
+ Number.isNaN(v) || f(v);
1417
1554
  }
1418
1555
  }
1419
1556
  )
1420
1557
  ] });
1421
1558
  }
1422
- function W({
1559
+ function X({
1423
1560
  label: e,
1424
1561
  value: a,
1425
1562
  options: n,
1426
1563
  onChange: c
1427
1564
  }) {
1428
1565
  return /* @__PURE__ */ d("div", { children: [
1429
- /* @__PURE__ */ r(T, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: e }),
1430
- /* @__PURE__ */ d(me, { value: a, onValueChange: c, children: [
1431
- /* @__PURE__ */ r(he, { size: "xs", children: /* @__PURE__ */ r(ke, {}) }),
1432
- /* @__PURE__ */ r(xe, { children: n.map(([i, f]) => /* @__PURE__ */ r(ye, { value: i, children: f }, i)) })
1566
+ /* @__PURE__ */ r(E, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: e }),
1567
+ /* @__PURE__ */ d(Pe, { value: a, onValueChange: c, children: [
1568
+ /* @__PURE__ */ r(Oe, { size: "xs", children: /* @__PURE__ */ r(Te, {}) }),
1569
+ /* @__PURE__ */ r(Be, { children: n.map(([s, f]) => /* @__PURE__ */ r(Re, { value: s, children: f }, s)) })
1433
1570
  ] })
1434
1571
  ] });
1435
1572
  }
1436
- function H({
1573
+ function Z({
1437
1574
  label: e,
1438
1575
  checked: a,
1439
1576
  onCheckedChange: n
1440
1577
  }) {
1441
1578
  return /* @__PURE__ */ d("div", { className: "flex h-8 items-center justify-between rounded-control border border-border/60 px-2", children: [
1442
1579
  /* @__PURE__ */ r("span", { className: "text-[12px]", children: e }),
1443
- /* @__PURE__ */ r(Ge, { size: "xs", checked: a, onCheckedChange: n })
1580
+ /* @__PURE__ */ r(Ce, { size: "xs", checked: a, onCheckedChange: n })
1444
1581
  ] });
1445
1582
  }
1446
- function ur(e) {
1583
+ function Er(e) {
1447
1584
  const a = `${Number((e / 16).toFixed(4))}rem`;
1448
1585
  return {
1449
1586
  "--semaphor-radius": a,
1450
1587
  "--semaphor-control-radius": a
1451
1588
  };
1452
1589
  }
1453
- function pr(e) {
1590
+ function Ar(e) {
1454
1591
  return JSON.parse(JSON.stringify(e));
1455
1592
  }
1456
- function br(e) {
1593
+ function zr(e) {
1457
1594
  return typeof e.text == "function" ? e.text() : new Promise((a, n) => {
1458
1595
  const c = new FileReader();
1459
1596
  c.onload = () => a(String(c.result ?? "")), c.onerror = () => n(c.error ?? new Error("Unable to read file")), c.readAsText(e);
1460
1597
  });
1461
1598
  }
1462
1599
  export {
1463
- Ce as BRAND_STUDIO_PRESETS,
1464
- Tr as BrandStudioEditor,
1465
- nr as applyBrandStudioPreset,
1466
- j as buildAppearanceSpecFromDraft,
1467
- D as createBrandStudioDraft
1600
+ Ae as BRAND_STUDIO_PRESETS,
1601
+ Zr as BrandStudioEditor,
1602
+ Fr as applyBrandStudioPreset,
1603
+ xe as brandStudioSaveSpec,
1604
+ $ as buildAppearanceSpecFromDraft,
1605
+ R as createBrandStudioDraft
1468
1606
  };