react-semaphor 0.1.603 → 0.1.604

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 (167) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1491
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +4 -1594
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-DeHEBEqG.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-BREc5WGv.js +1 -0
  11. package/dist/chunks/appearance-context-BqBZrijL.js +1 -0
  12. package/dist/chunks/appearance-runtime-provider-DmbCrOOG.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-CjYrwVDa.js +56 -0
  15. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  16. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  17. package/dist/chunks/bookmark-impact-C89zBLq3.js +1 -0
  18. package/dist/chunks/bookmark-state-69YYnRql.js +1 -0
  19. package/dist/chunks/brand-DCaZyRt6.js +1 -0
  20. package/dist/chunks/card-filter-builder-CTp6RAz1.js +17 -0
  21. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  22. package/dist/chunks/comparison-window-caption-C312mn3s.js +1 -0
  23. package/dist/chunks/context-ALdccLHw.js +2 -0
  24. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  25. package/dist/chunks/dashboard-BX28ld6s.js +1 -0
  26. package/dist/chunks/dashboard-briefing-launcher-qo7GH4EO.js +37 -0
  27. package/dist/chunks/dashboard-controls-DhRjB7MA.js +42 -0
  28. package/dist/chunks/dashboard-json-9cHzhSjC.js +1 -0
  29. package/dist/chunks/dates-D-KP8G-z.js +1 -0
  30. package/dist/chunks/edit-DEAK0UZo.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-Duq_QkB_.js +93 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-CwQrqORc.js +1 -0
  34. package/dist/chunks/filter-reach-preview-gixPFlZj.js +1 -0
  35. package/dist/chunks/filter-value-text-B3tXakhd.js +1 -0
  36. package/dist/chunks/index-B-VF1ogs.js +1 -0
  37. package/dist/chunks/index-BE1DfxNs.js +1 -0
  38. package/dist/chunks/index-DViPGDFj.js +1 -0
  39. package/dist/chunks/layout-grid-BWtlgw0T.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-CtFqWyCK.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-Q0MCJ-YK.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-D1RC1bfi.js +1 -0
  43. package/dist/chunks/metric-comparison-DEZYXROZ.js +1 -0
  44. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  45. package/dist/chunks/paintbrush-BjS3SbrH.js +6 -0
  46. package/dist/chunks/palette-BzC-CGOc.js +6 -0
  47. package/dist/chunks/pickers-DuBrUht0.js +1 -0
  48. package/dist/chunks/pivot-result-contract-expectations-DTQAgr4n.js +1 -0
  49. package/dist/chunks/pivot-result-identity-DTNCB--h.js +1 -0
  50. package/dist/chunks/raw-temporal-value-DeyEhL0S.js +1 -0
  51. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  52. package/dist/chunks/report-preferences-dialog-B_gUmCzG.js +1 -0
  53. package/dist/chunks/report-runtime-context-BWzIHCKK.js +1 -0
  54. package/dist/chunks/resolve-dashboard-input-context-B-TtRqxu.js +8 -0
  55. package/dist/chunks/resolver-AN9ChBfZ.js +1 -0
  56. package/dist/chunks/save-DdFUZcbi.js +6 -0
  57. package/dist/chunks/saved-dashboard-context-BAJ5tWiq.js +1 -0
  58. package/dist/chunks/schema-MC0cQSAb.js +4 -0
  59. package/dist/chunks/selection-filter-compiler-CCoCD25M.js +1 -0
  60. package/dist/chunks/semaphor-ready-indicator-DzjorP3t.js +999 -0
  61. package/dist/chunks/set-DuJfGkbY.js +1 -0
  62. package/dist/chunks/shelf-drop-preview-context-BlLJ5RsT.js +6 -0
  63. package/dist/chunks/stored-dashboard-Ctcpkllg.js +1 -0
  64. package/dist/chunks/style-sheet-parts-BRGt9O05.js +178 -0
  65. package/dist/chunks/table-export-sheet-rC5pKmXg.js +2 -0
  66. package/dist/chunks/token-types-Bj9iMy0w.js +1 -0
  67. package/dist/chunks/validators-CqV3Yka1.js +1 -0
  68. package/dist/chunks/variable-draft-DJrfUyhv.js +1 -0
  69. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  70. package/dist/dashboard/index.js +1 -7
  71. package/dist/dashboard-authoring/index.js +1 -4614
  72. package/dist/format-utils/index.js +1 -425
  73. package/dist/index.js +1 -554
  74. package/dist/layouts/index.js +1 -7
  75. package/dist/live-channel/index.js +1 -124
  76. package/dist/pdf-export-policy/index.js +1 -92
  77. package/dist/pdf-table-layout/index.js +1 -993
  78. package/dist/report-runtime-context/index.js +1 -9
  79. package/dist/shared/index.js +1 -6
  80. package/dist/style.css +1 -1
  81. package/dist/surfboard/index.js +1 -9
  82. package/dist/types/index.js +1 -88
  83. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  84. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  85. package/dist/types/lib/stores/explorer-actions.d.ts +7 -6
  86. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  87. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  88. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  89. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  90. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  91. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  92. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  93. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  94. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +132 -0
  95. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  96. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  97. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  98. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +115 -0
  99. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  100. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  101. package/dist/types/shared/dashboard-authoring/index.d.ts +6 -1
  102. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -0
  103. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  104. package/dist/usage-events/index.js +1 -285
  105. package/dist/value-format-preferences/index.js +1 -635
  106. package/package.json +4 -1
  107. package/dist/chunks/add-to-dashboard-CFF-wFU-.js +0 -291
  108. package/dist/chunks/analytics-base-schemas-DsUh5Q3C.js +0 -680
  109. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  110. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  111. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  112. package/dist/chunks/assistant-chat-B6hNQI1t.js +0 -6115
  113. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  114. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  115. package/dist/chunks/bookmark-impact-Ba2PLcGp.js +0 -76
  116. package/dist/chunks/bookmark-state-n7AaNzR_.js +0 -1667
  117. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  118. package/dist/chunks/card-filter-builder-Y22HizVx.js +0 -4069
  119. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  120. package/dist/chunks/comparison-window-caption-Ck2TIbnR.js +0 -741
  121. package/dist/chunks/context-UCQ7sere.js +0 -369
  122. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  123. package/dist/chunks/dashboard-BghI99oY.js +0 -14
  124. package/dist/chunks/dashboard-briefing-launcher-DtBAnGiH.js +0 -4875
  125. package/dist/chunks/dashboard-controls-CtFXlyjV.js +0 -2290
  126. package/dist/chunks/dashboard-json-DfGBUtCd.js +0 -66
  127. package/dist/chunks/dates-BnrXF4bb.js +0 -185
  128. package/dist/chunks/edit-9df1zOWe.js +0 -226
  129. package/dist/chunks/edit-dashboard-visual-oxt3x1wb.js +0 -18397
  130. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  131. package/dist/chunks/filter-line-Cy5YYqRL.js +0 -703
  132. package/dist/chunks/filter-reach-copy-CE_ZX147.js +0 -5111
  133. package/dist/chunks/filter-value-text-fWvSDwkl.js +0 -153
  134. package/dist/chunks/index-BVKzKl5d.js +0 -90
  135. package/dist/chunks/index-CV_Kzou0.js +0 -595
  136. package/dist/chunks/index-D5rxbtS4.js +0 -2795
  137. package/dist/chunks/layout-grid-9LndRoLa.js +0 -16
  138. package/dist/chunks/matrix-analytical-definition-CCp48UCw.js +0 -1233
  139. package/dist/chunks/matrix-member-presentation-zNehruXR.js +0 -391
  140. package/dist/chunks/matrix-operation-contract-DPBj69D8.js +0 -1413
  141. package/dist/chunks/metric-comparison-B0FR-Q8I.js +0 -600
  142. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  143. package/dist/chunks/paintbrush-58FQYY-y.js +0 -27
  144. package/dist/chunks/palette-Be62Tkoa.js +0 -23
  145. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  146. package/dist/chunks/pivot-result-contract-expectations-BYqAmG9n.js +0 -5092
  147. package/dist/chunks/pivot-result-identity-CAP4--iq.js +0 -77
  148. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +0 -3778
  149. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  150. package/dist/chunks/report-preferences-dialog-uJp9GBTM.js +0 -1651
  151. package/dist/chunks/report-runtime-context-c77_KF9v.js +0 -388
  152. package/dist/chunks/resolve-dashboard-input-context-Rtl1ffmE.js +0 -25324
  153. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  154. package/dist/chunks/save-C5A0JnEV.js +0 -21
  155. package/dist/chunks/saved-dashboard-context-tcyTU8jm.js +0 -618
  156. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  157. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +0 -150
  158. package/dist/chunks/semaphor-ready-indicator-FBvunj6S.js +0 -145603
  159. package/dist/chunks/shelf-drop-preview-context-QKStrcK9.js +0 -2466
  160. package/dist/chunks/stored-dashboard-CHozcAY9.js +0 -4075
  161. package/dist/chunks/style-sheet-parts-CDCG-8Ej.js +0 -8681
  162. package/dist/chunks/table-export-sheet-ZFIvs6Sj.js +0 -949
  163. package/dist/chunks/token-types-XbM6QByy.js +0 -8
  164. package/dist/chunks/upload-H15d7uHK.js +0 -15
  165. package/dist/chunks/validators-Baf3VIf5.js +0 -3686
  166. package/dist/chunks/variable-draft-C2y8Jp6Z.js +0 -242
  167. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -1,1606 +1,16 @@
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-CDCG-8Ej.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
- import "../chunks/validators-Baf3VIf5.js";
7
- import "../chunks/matrix-operation-contract-DPBj69D8.js";
8
- import "../chunks/analytics-base-schemas-DsUh5Q3C.js";
9
- import "../value-format-preferences/index.js";
10
- import { e as ir } from "../chunks/brand-BoUV0iHF.js";
11
- import { b as ur, D as pr } from "../chunks/edit-9df1zOWe.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-Be62Tkoa.js";
15
- import { U as fr } from "../chunks/upload-H15d7uHK.js";
16
- import { S as mr } from "../chunks/save-C5A0JnEV.js";
17
- import { L as gr } from "../chunks/layout-grid-9LndRoLa.js";
18
- /**
1
+ import{jsxs as d,jsx as r,Fragment as ue}from"react/jsx-runtime";import m,{useState as pe}from"react";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,U as Ke,C as Xe,R as we,L as fe,X as Ze,i as ge,j as Qe,T as er,k as rr,l as V,m as or,n as G,o as ar,p as nr,q as tr,r as dr,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-BRGt9O05.js";import{v as cr,A as ne,d as sr,p as lr}from"../chunks/schema-MC0cQSAb.js";import{S as j,C as ir,a as me,c as te}from"../chunks/pickers-DuBrUht0.js";import"../chunks/validators-CqV3Yka1.js";import"../chunks/matrix-operation-contract-D1RC1bfi.js";import"../chunks/analytics-base-schemas-BREc5WGv.js";import"../value-format-preferences/index.js";import{e as ur}from"../chunks/brand-DCaZyRt6.js";import{b as pr,D as br}from"../chunks/edit-DEAK0UZo.js";import{n as Ee}from"../chunks/index-BE1DfxNs.js";import{b as fr}from"../chunks/resolver-AN9ChBfZ.js";import{P as H}from"../chunks/palette-BzC-CGOc.js";import{S as gr}from"../chunks/save-DdFUZcbi.js";import{L as mr}from"../chunks/layout-grid-BWtlgw0T.js";/**
19
2
  * @license lucide-react v0.453.0 - ISC
20
3
  *
21
4
  * This source code is licensed under the ISC license.
22
5
  * See the LICENSE file in the root directory of this source tree.
23
- */
24
- const hr = de("Ban", [
25
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
26
- ["path", { d: "m4.9 4.9 14.2 14.2", key: "1m5liu" }]
27
- ]);
28
- /**
6
+ */const hr=de("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
29
7
  * @license lucide-react v0.453.0 - ISC
30
8
  *
31
9
  * This source code is licensed under the ISC license.
32
10
  * See the LICENSE file in the root directory of this source tree.
33
- */
34
- const xr = de("Clipboard", [
35
- ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
36
- [
37
- "path",
38
- {
39
- d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
40
- key: "116196"
41
- }
42
- ]
43
- ]);
44
- /**
11
+ */const xr=de("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/**
45
12
  * @license lucide-react v0.453.0 - ISC
46
13
  *
47
14
  * This source code is licensed under the ISC license.
48
15
  * See the LICENSE file in the root directory of this source tree.
49
- */
50
- const vr = de("Pipette", [
51
- ["path", { d: "m2 22 1-1h3l9-9", key: "1sre89" }],
52
- ["path", { d: "M3 21v-3l9-9", key: "hpe2y6" }],
53
- [
54
- "path",
55
- {
56
- d: "m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",
57
- key: "196du1"
58
- }
59
- ]
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 = [
194
- {
195
- id: "semaphor",
196
- name: "Semaphor",
197
- description: "Dense neutral system defaults for embedded analytics.",
198
- primary: "#18181b",
199
- accent: "#f4f4f5",
200
- light: {
201
- background: "#ffffff",
202
- foreground: "#18181b",
203
- muted: "#fafafa",
204
- mutedForeground: "#71717a",
205
- border: "#e4e4e7",
206
- primary: "#18181b",
207
- primaryForeground: "#ffffff",
208
- accent: "#f4f4f5",
209
- accentForeground: "#18181b",
210
- selection: "#2563eb",
211
- card: "#ffffff",
212
- cardForeground: "#18181b",
213
- chartPalette: [
214
- "#3b82f6",
215
- "#10b981",
216
- "#f59e0b",
217
- "#ef4444",
218
- "#8b5cf6",
219
- "#06b6d4"
220
- ]
221
- },
222
- dark: {
223
- background: "#09090b",
224
- foreground: "#fafafa",
225
- muted: "#18181b",
226
- mutedForeground: "#a1a1aa",
227
- border: "#27272a",
228
- primary: "#fafafa",
229
- primaryForeground: "#09090b",
230
- accent: "#27272a",
231
- accentForeground: "#fafafa",
232
- selection: "#5090f7",
233
- card: "#09090b",
234
- cardForeground: "#fafafa",
235
- chartPalette: [
236
- "#60a5fa",
237
- "#34d399",
238
- "#fbbf24",
239
- "#f87171",
240
- "#a78bfa",
241
- "#22d3ee"
242
- ]
243
- }
244
- },
245
- {
246
- id: "atlas-blue",
247
- name: "Atlas Blue",
248
- description: "Crisp enterprise blue with restrained neutral surfaces.",
249
- primary: "#2563eb",
250
- accent: "#dbeafe",
251
- light: {
252
- background: "#f8fafc",
253
- foreground: "#0f172a",
254
- muted: "#f1f5f9",
255
- mutedForeground: "#64748b",
256
- border: "#cbd5e1",
257
- primary: "#2563eb",
258
- primaryForeground: "#ffffff",
259
- accent: "#dbeafe",
260
- accentForeground: "#1e3a8a",
261
- selection: "#2563eb",
262
- card: "#ffffff",
263
- cardForeground: "#0f172a",
264
- chartPalette: [
265
- "#2563eb",
266
- "#0f766e",
267
- "#ca8a04",
268
- "#dc2626",
269
- "#7c3aed",
270
- "#0891b2"
271
- ]
272
- },
273
- dark: {
274
- background: "#020617",
275
- foreground: "#e2e8f0",
276
- muted: "#0f172a",
277
- mutedForeground: "#94a3b8",
278
- border: "#1e293b",
279
- primary: "#60a5fa",
280
- primaryForeground: "#020617",
281
- accent: "#1e3a8a",
282
- accentForeground: "#dbeafe",
283
- selection: "#60a5fa",
284
- card: "#0f172a",
285
- cardForeground: "#e2e8f0",
286
- chartPalette: [
287
- "#60a5fa",
288
- "#2dd4bf",
289
- "#facc15",
290
- "#f87171",
291
- "#a78bfa",
292
- "#22d3ee"
293
- ]
294
- }
295
- },
296
- {
297
- id: "field-green",
298
- name: "Field Green",
299
- description: "Operational green accents with quiet, readable canvases.",
300
- primary: "#047857",
301
- accent: "#d1fae5",
302
- light: {
303
- background: "#fbfdfb",
304
- foreground: "#10231d",
305
- muted: "#f1f5f3",
306
- mutedForeground: "#64746d",
307
- border: "#d7ded9",
308
- primary: "#047857",
309
- primaryForeground: "#ffffff",
310
- accent: "#d1fae5",
311
- accentForeground: "#064e3b",
312
- selection: "#047857",
313
- card: "#ffffff",
314
- cardForeground: "#10231d",
315
- chartPalette: [
316
- "#047857",
317
- "#2563eb",
318
- "#d97706",
319
- "#dc2626",
320
- "#7c3aed",
321
- "#0891b2"
322
- ]
323
- },
324
- dark: {
325
- background: "#071511",
326
- foreground: "#e7f4ef",
327
- muted: "#10231d",
328
- mutedForeground: "#92aaa1",
329
- border: "#244139",
330
- primary: "#34d399",
331
- primaryForeground: "#071511",
332
- accent: "#064e3b",
333
- accentForeground: "#d1fae5",
334
- selection: "#34d399",
335
- card: "#0b1d17",
336
- cardForeground: "#e7f4ef",
337
- chartPalette: [
338
- "#34d399",
339
- "#60a5fa",
340
- "#fbbf24",
341
- "#f87171",
342
- "#a78bfa",
343
- "#22d3ee"
344
- ]
345
- }
346
- }
347
- ];
348
- function R(e) {
349
- const a = br({
350
- organizationAppearance: e ? Ee(e).spec : void 0
351
- });
352
- return Nr(
353
- ze(J(a))
354
- );
355
- }
356
- function Nr(e) {
357
- var a;
358
- for (const n of Object.values(e.schemes)) {
359
- const c = (a = n.components.table) == null ? void 0 : a.row;
360
- c != null && c.selectedBackground && c.selectedBackground === c.hoverBackground && delete c.selectedBackground;
361
- }
362
- return e;
363
- }
364
- function $(e) {
365
- const a = J({
366
- version: ne,
367
- mode: e.mode,
368
- schemes: e.schemes
369
- }), n = dr(a);
370
- if (!n.success) {
371
- const c = n.issues[0];
372
- throw new Error(
373
- `Invalid Brand Studio appearance at ${c.path}: ${c.message}`
374
- );
375
- }
376
- return n.value;
377
- }
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);
402
- if (!n)
403
- return e;
404
- const c = J(e);
405
- return ve(c.schemes.light, n.light), ve(c.schemes.dark, n.dark), c;
406
- }
407
- function ve(e, a) {
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;
409
- }
410
- function Y(e, a, n) {
411
- switch (e.tokens.color[a] = n, a) {
412
- case "background":
413
- e.components.dashboard.background = n, e.components.interactive.toolbarBackground = n;
414
- break;
415
- case "foreground":
416
- e.components.dashboard.foreground = n, e.components.interactive.foreground = n, e.components.pagination.foreground = n, e.components.chart.foreground = n, e.components.table.pagination.foreground = n, e.components.table.subtotal.foreground = n, e.components.table.grandTotal.foreground = n;
417
- break;
418
- case "card":
419
- e.components.card.background = n, e.components.interactive.background = n, e.components.pagination.background = n, e.components.chart.background = n, e.components.table.container.background = n, e.components.table.pagination.background = n;
420
- break;
421
- case "cardForeground":
422
- e.components.card.foreground = n;
423
- break;
424
- case "muted":
425
- e.components.table.header.background = n, e.components.table.row.zebraBackground = n, e.components.table.subtotal.background = n, e.components.table.grandTotal.background = n;
426
- break;
427
- case "mutedForeground":
428
- e.components.table.header.foreground = n, e.components.chart.axisColor = n;
429
- break;
430
- case "border":
431
- e.tokens.color.input = n, e.components.dashboard.borderColor = n, e.components.card.borderColor = n, e.components.interactive.borderColor = n, e.components.pagination.borderColor = n, e.components.chart.gridColor = n, e.components.table.container.borderColor = n, e.components.table.header.dividerColor = n, e.components.table.row.dividerColor = n, e.components.table.grandTotal.borderColor = n, e.components.table.pagination.borderColor = n;
432
- break;
433
- case "accent":
434
- e.components.table.row.hoverBackground = n;
435
- break;
436
- }
437
- }
438
- function Pr(e, a, n) {
439
- switch (e.tokens.radius[a] = n, a) {
440
- case "table":
441
- e.components.table.container.borderRadius = n;
442
- break;
443
- }
444
- }
445
- function ze(e) {
446
- for (const a of ["light", "dark"]) {
447
- const n = e.schemes[a], c = n.tokens, s = c.color, f = {
448
- fontFamily: "",
449
- headingFontFamily: "",
450
- monoFontFamily: "",
451
- baseFontSize: 14,
452
- density: "comfortable"
453
- };
454
- c.typography = { ...f, ...c.typography };
455
- const h = {
456
- control: 5,
457
- card: 5,
458
- table: 5,
459
- badge: 999
460
- };
461
- c.radius = { ...h, ...c.radius };
462
- const x = {
463
- dashboardPadding: 16,
464
- gridGap: 12,
465
- cardPadding: 16,
466
- controlGap: 8,
467
- tableCellX: 12,
468
- tableCellY: 8
469
- };
470
- c.spacing = { ...x, ...c.spacing };
471
- const v = {
472
- card: "none",
473
- popover: "0 12px 32px rgba(15, 23, 42, 0.14)",
474
- focusRing: "0 0 0 2px rgba(37, 99, 235, 0.35)"
475
- };
476
- c.shadow = { ...v, ...c.shadow };
477
- const b = {
478
- dashboard: {
479
- background: s.background,
480
- foreground: s.foreground,
481
- borderColor: s.border
482
- },
483
- card: {
484
- background: s.card,
485
- foreground: s.cardForeground,
486
- borderColor: s.border
487
- },
488
- interactive: {
489
- toolbarBackground: s.background,
490
- background: s.card,
491
- foreground: s.foreground,
492
- borderColor: s.border
493
- },
494
- chart: {
495
- palette: [],
496
- background: s.card,
497
- foreground: s.foreground,
498
- gridColor: s.border,
499
- axisColor: s.mutedForeground,
500
- barRadius: 0
501
- },
502
- table: ke(s, c),
503
- pagination: {
504
- background: s.card,
505
- foreground: s.foreground,
506
- borderColor: s.border
507
- }
508
- };
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 = {
516
- palette: [],
517
- background: s.card,
518
- foreground: s.foreground,
519
- gridColor: s.border,
520
- axisColor: s.mutedForeground,
521
- barRadius: 2
522
- };
523
- n.components.chart = { ...i, ...n.components.chart }, n.components.table = {
524
- ...ke(s, c),
525
- ...n.components.table
526
- };
527
- }
528
- return e;
529
- }
530
- function ke(e, a) {
531
- return {
532
- density: a.typography.density,
533
- container: {
534
- background: e.card,
535
- borderColor: e.border,
536
- borderRadius: a.radius.table,
537
- shadow: a.shadow.card
538
- },
539
- header: {
540
- background: e.muted,
541
- foreground: e.mutedForeground,
542
- dividerColor: e.border,
543
- fontWeight: 600,
544
- uppercase: !0,
545
- sticky: !0
546
- },
547
- row: {
548
- height: 32,
549
- dividerColor: e.border,
550
- zebra: !1,
551
- zebraBackground: e.muted,
552
- hoverBackground: e.accent
553
- },
554
- cell: {
555
- paddingX: a.spacing.tableCellX,
556
- paddingY: a.spacing.tableCellY,
557
- verticalAlign: "middle",
558
- wrap: "nowrap"
559
- },
560
- subtotal: {
561
- background: e.muted,
562
- foreground: e.foreground,
563
- fontWeight: 600
564
- },
565
- grandTotal: {
566
- background: e.muted,
567
- foreground: e.foreground,
568
- fontWeight: 700,
569
- borderColor: e.border
570
- },
571
- pagination: {
572
- background: e.card,
573
- foreground: e.foreground,
574
- borderColor: e.border
575
- }
576
- };
577
- }
578
- function J(e) {
579
- return JSON.parse(JSON.stringify(e));
580
- }
581
- const Or = [
582
- ["background", "Canvas"],
583
- ["foreground", "Text"],
584
- ["card", "Card"],
585
- ["cardForeground", "Card text"],
586
- ["primary", "Primary"],
587
- ["primaryForeground", "Primary text"],
588
- ["accent", "Accent"],
589
- ["accentForeground", "Accent text"],
590
- ["muted", "Muted"],
591
- ["mutedForeground", "Muted text"],
592
- ["border", "Border"],
593
- ["positive", "Positive"],
594
- ["negative", "Negative"],
595
- ["warning", "Warning"],
596
- ["info", "Info"]
597
- ], W = cr, Tr = [
598
- "#ffffff",
599
- "#f8fafc",
600
- "#f4f4f5",
601
- "#e4e4e7",
602
- "#18181b",
603
- "#09090b",
604
- "#2563eb",
605
- "#0f766e",
606
- "#047857",
607
- "#d97706",
608
- "#dc2626",
609
- "#7c3aed"
610
- ];
611
- function Zr({
612
- appearance: e,
613
- previewTitle: a,
614
- isLoading: n = !1,
615
- isSaving: c = !1,
616
- error: s = null,
617
- className: f,
618
- onDraftChange: h,
619
- onSave: x,
620
- onClearConfig: v,
621
- onCancel: b
622
- }) {
623
- const [i, p] = g.useState(null), [y, F] = g.useState("light"), [l, A] = g.useState(!1), [De, O] = g.useState(
624
- "idle"
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(() => {
629
- if (e === void 0) {
630
- T.current = !0, p(null);
631
- return;
632
- }
633
- const o = R(e);
634
- T.current = !0, p(o), F("light"), C(null);
635
- }, [e]), g.useEffect(() => {
636
- var o;
637
- if (i) {
638
- if (T.current) {
639
- T.current = !1;
640
- return;
641
- }
642
- try {
643
- const t = $(i);
644
- (o = I.current) == null || o.call(I, t), C(null);
645
- } catch (t) {
646
- C(
647
- t instanceof Error ? t.message : "Appearance is invalid"
648
- );
649
- }
650
- }
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) => {
657
- if (!t) return t;
658
- const k = Ar(t);
659
- return o(k), k;
660
- });
661
- }, m = (o) => {
662
- je((t) => {
663
- o(t.schemes[y]);
664
- });
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;
678
- let o;
679
- try {
680
- o = xe(i);
681
- } catch (t) {
682
- C(
683
- t instanceof Error ? t.message : "Appearance is invalid"
684
- );
685
- return;
686
- }
687
- A(!0);
688
- try {
689
- await x(o);
690
- } finally {
691
- A(!1);
692
- }
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");
699
- try {
700
- await v(), T.current = !0, p(R(null)), F("light");
701
- } catch (o) {
702
- C(
703
- o instanceof Error ? o.message : "Unable to clear organization appearance"
704
- );
705
- } finally {
706
- A(!1);
707
- }
708
- }
709
- }, le = g.useCallback(() => i ? JSON.stringify($(i), null, 2) : "", [i]), Me = (o) => {
710
- if (Ie(o), o)
711
- try {
712
- U(le()), C(null);
713
- } catch (t) {
714
- C(
715
- t instanceof Error ? t.message : "Appearance is invalid"
716
- );
717
- }
718
- }, Ve = async () => {
719
- if (i)
720
- try {
721
- const o = ce && z ? z : le();
722
- await navigator.clipboard.writeText(o), C(null), O("copied");
723
- } catch (o) {
724
- C(
725
- o instanceof Error ? o.message : "Unable to copy brand spec"
726
- );
727
- }
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 = () => {
732
- try {
733
- ie(z);
734
- } catch (o) {
735
- C(
736
- o instanceof Error ? o.message : "Brand spec must be valid JSON"
737
- );
738
- }
739
- }, He = async (o) => {
740
- var k;
741
- const t = (k = o.target.files) == null ? void 0 : k[0];
742
- if (o.target.value = "", !!t)
743
- try {
744
- ie(await zr(t));
745
- } catch (w) {
746
- C(
747
- w instanceof Error ? w.message : "Uploaded file must be a valid brand spec"
748
- );
749
- }
750
- };
751
- return /* @__PURE__ */ d(
752
- "div",
753
- {
754
- className: te(
755
- "flex min-h-0 flex-1 flex-col bg-background text-foreground",
756
- f
757
- ),
758
- style: _e,
759
- children: [
760
- /* @__PURE__ */ d("header", { className: "flex h-11 shrink-0 items-start gap-3 border-b border-border/60 px-4 pt-2", children: [
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" }) }),
762
- /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
763
- /* @__PURE__ */ r("h2", { className: "truncate text-[13px] font-semibold leading-tight", children: "Brand Studio" }),
764
- /* @__PURE__ */ d("p", { className: "truncate text-[11px] leading-tight text-muted-foreground", children: [
765
- "Previewing ",
766
- a || "current dashboard"
767
- ] })
768
- ] }),
769
- /* @__PURE__ */ d(
770
- ye,
771
- {
772
- open: ce,
773
- onOpenChange: Me,
774
- children: [
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" }),
777
- "Brand Spec"
778
- ] }) }),
779
- /* @__PURE__ */ d(
780
- Se,
781
- {
782
- align: "end",
783
- sideOffset: 6,
784
- className: "z-[60] w-[min(520px,calc(100vw-24px))] rounded-control p-2",
785
- children: [
786
- /* @__PURE__ */ d("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
787
- /* @__PURE__ */ d("div", { className: "min-w-0", children: [
788
- /* @__PURE__ */ r("div", { className: "text-[12px] font-medium", children: "Brand spec" }),
789
- /* @__PURE__ */ r("div", { className: "text-[11px] text-muted-foreground", children: "Edit, apply, copy, or upload your brand spec." })
790
- ] }),
791
- /* @__PURE__ */ d("div", { className: "flex shrink-0 items-center gap-1", children: [
792
- /* @__PURE__ */ d(
793
- S,
794
- {
795
- type: "button",
796
- size: "xs",
797
- variant: "ghost",
798
- onClick: Ve,
799
- children: [
800
- /* @__PURE__ */ r(xr, { className: "h-3.5 w-3.5" }),
801
- De === "copied" ? "Copied" : "Copy"
802
- ]
803
- }
804
- ),
805
- /* @__PURE__ */ d(
806
- S,
807
- {
808
- type: "button",
809
- size: "xs",
810
- variant: "ghost",
811
- onClick: () => {
812
- var o;
813
- return (o = se.current) == null ? void 0 : o.click();
814
- },
815
- children: [
816
- /* @__PURE__ */ r(fr, { className: "h-3.5 w-3.5" }),
817
- "Upload"
818
- ]
819
- }
820
- ),
821
- /* @__PURE__ */ r(S, { type: "button", size: "xs", onClick: Ge, children: "Apply" })
822
- ] })
823
- ] }),
824
- /* @__PURE__ */ r("div", { className: "h-[320px] overflow-hidden rounded-control border border-input", children: /* @__PURE__ */ r(
825
- Ke,
826
- {
827
- ariaLabel: "Brand spec",
828
- value: z,
829
- onValueChange: (o) => {
830
- U(o), O("idle");
831
- },
832
- language: "json",
833
- embedded: !0,
834
- hideLineNumbers: !0,
835
- dense: !0
836
- }
837
- ) })
838
- ]
839
- }
840
- )
841
- ]
842
- }
843
- ),
844
- /* @__PURE__ */ r(
845
- "input",
846
- {
847
- ref: se,
848
- "aria-label": "Upload brand spec",
849
- type: "file",
850
- accept: "application/json,.json",
851
- className: "sr-only",
852
- onChange: He
853
- }
854
- ),
855
- /* @__PURE__ */ d(
856
- S,
857
- {
858
- type: "button",
859
- size: "xs",
860
- variant: "ghost",
861
- onClick: Ue,
862
- disabled: !i,
863
- children: [
864
- /* @__PURE__ */ r(we, { className: "h-3.5 w-3.5" }),
865
- "Reset"
866
- ]
867
- }
868
- ),
869
- v && /* @__PURE__ */ d(
870
- S,
871
- {
872
- type: "button",
873
- size: "xs",
874
- variant: "ghost",
875
- onClick: Le,
876
- disabled: L,
877
- children: [
878
- /* @__PURE__ */ r(hr, { className: "h-3.5 w-3.5" }),
879
- "No config"
880
- ]
881
- }
882
- ),
883
- /* @__PURE__ */ d(
884
- S,
885
- {
886
- type: "button",
887
- size: "xs",
888
- onClick: Je,
889
- disabled: !i || L || !!D || !x,
890
- children: [
891
- L ? /* @__PURE__ */ r(fe, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(mr, { className: "h-3.5 w-3.5" }),
892
- "Save"
893
- ]
894
- }
895
- ),
896
- b && /* @__PURE__ */ r(
897
- "button",
898
- {
899
- type: "button",
900
- "aria-label": "Close Brand Studio",
901
- className: "flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",
902
- onClick: b,
903
- children: /* @__PURE__ */ r(Xe, { className: "h-3.5 w-3.5" })
904
- }
905
- )
906
- ] }),
907
- /* @__PURE__ */ d("div", { className: "flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2", children: [
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" }),
910
- "Preview keeps the last valid draft"
911
- ] }) : /* @__PURE__ */ d(ue, { children: [
912
- /* @__PURE__ */ r(Ze, { className: "h-3.5 w-3.5 text-emerald-500" }),
913
- "Draft is applied to the live dashboard preview"
914
- ] }) }),
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(
916
- "button",
917
- {
918
- type: "button",
919
- className: te(
920
- "h-full px-2.5 text-[12px] capitalize transition-colors",
921
- y === o ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground"
922
- ),
923
- onClick: () => F(o),
924
- children: o
925
- },
926
- o
927
- )) })
928
- ] }),
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" })
935
- ] }) }),
936
- /* @__PURE__ */ d(rr, { className: "min-h-0 flex-1", children: [
937
- /* @__PURE__ */ d(G, { value: "style", className: "m-0 p-4", children: [
938
- /* @__PURE__ */ r(
939
- P,
940
- {
941
- icon: H,
942
- title: "Presets",
943
- description: "Start from a full light and dark appearance.",
944
- children: /* @__PURE__ */ r("div", { className: "grid grid-cols-1 gap-2", children: Ae.map((o) => /* @__PURE__ */ d(
945
- "button",
946
- {
947
- type: "button",
948
- className: "flex items-center gap-3 rounded-control border border-border/70 px-3 py-2 text-left hover:bg-muted/60",
949
- onClick: () => {
950
- const t = Fr(i, o.id);
951
- p(t);
952
- },
953
- children: [
954
- /* @__PURE__ */ d("div", { className: "flex h-7 w-10 overflow-hidden rounded-control border border-border/70", children: [
955
- /* @__PURE__ */ r(
956
- "span",
957
- {
958
- className: "h-full flex-1",
959
- style: { backgroundColor: o.primary }
960
- }
961
- ),
962
- /* @__PURE__ */ r(
963
- "span",
964
- {
965
- className: "h-full flex-1",
966
- style: { backgroundColor: o.accent }
967
- }
968
- )
969
- ] }),
970
- /* @__PURE__ */ d("span", { className: "min-w-0 flex-1", children: [
971
- /* @__PURE__ */ r("span", { className: "block text-[13px] font-medium", children: o.name }),
972
- /* @__PURE__ */ r("span", { className: "block truncate text-[12px] text-muted-foreground", children: o.description })
973
- ] })
974
- ]
975
- },
976
- o.id
977
- )) })
978
- }
979
- ),
980
- /* @__PURE__ */ r(
981
- P,
982
- {
983
- icon: H,
984
- title: "Color",
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,
988
- {
989
- label: t,
990
- value: u.tokens.color[o],
991
- onChange: (k) => m((w) => {
992
- Y(w, o, k);
993
- })
994
- },
995
- o
996
- )) })
997
- }
998
- ),
999
- /* @__PURE__ */ d(
1000
- P,
1001
- {
1002
- icon: or,
1003
- title: "Typography",
1004
- description: "Fonts and density used by dashboard and workflow chrome.",
1005
- children: [
1006
- /* @__PURE__ */ r(
1007
- Br,
1008
- {
1009
- value: u.tokens.typography.fontFamily,
1010
- onChange: (o) => m((t) => {
1011
- t.tokens.typography.fontFamily = o, t.tokens.typography.headingFontFamily = o;
1012
- })
1013
- }
1014
- ),
1015
- /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1016
- /* @__PURE__ */ r(
1017
- K,
1018
- {
1019
- label: "Base size",
1020
- value: u.tokens.typography.baseFontSize,
1021
- min: 11,
1022
- max: 18,
1023
- onChange: (o) => m((t) => {
1024
- t.tokens.typography.baseFontSize = o;
1025
- })
1026
- }
1027
- ),
1028
- /* @__PURE__ */ r(
1029
- X,
1030
- {
1031
- label: "Density",
1032
- value: u.tokens.typography.density,
1033
- options: [
1034
- ["compact", "Compact"],
1035
- ["comfortable", "Comfortable"],
1036
- ["spacious", "Spacious"]
1037
- ],
1038
- onChange: (o) => m((t) => {
1039
- t.tokens.typography.density = o, t.components.table.density = t.tokens.typography.density;
1040
- })
1041
- }
1042
- )
1043
- ] })
1044
- ]
1045
- }
1046
- )
1047
- ] }),
1048
- /* @__PURE__ */ d(G, { value: "surfaces", className: "m-0 p-4", children: [
1049
- /* @__PURE__ */ d(
1050
- P,
1051
- {
1052
- icon: gr,
1053
- title: "Layout",
1054
- description: "Canvas, grid, and card rhythm for embedded dashboards.",
1055
- children: [
1056
- _ ? /* @__PURE__ */ r(yr, { spec: _, mode: y, onEdit: $e }) : null,
1057
- /* @__PURE__ */ d("div", { className: "grid grid-cols-3 gap-2", children: [
1058
- /* @__PURE__ */ r(
1059
- K,
1060
- {
1061
- label: "Card pad",
1062
- tooltip: "Inner padding inside card/widget frames around titles, controls, and visual content.",
1063
- value: u.tokens.spacing.cardPadding,
1064
- min: 0,
1065
- max: 32,
1066
- onChange: (o) => m((t) => {
1067
- t.tokens.spacing.cardPadding = o;
1068
- })
1069
- }
1070
- ),
1071
- /* @__PURE__ */ r(
1072
- K,
1073
- {
1074
- label: "Table radius",
1075
- tooltip: "Corner radius for table containers, table chrome, and table pagination surfaces.",
1076
- value: u.tokens.radius.table,
1077
- min: 0,
1078
- max: 12,
1079
- onChange: (o) => m((t) => {
1080
- Pr(t, "table", o);
1081
- })
1082
- }
1083
- )
1084
- ] })
1085
- ]
1086
- }
1087
- ),
1088
- /* @__PURE__ */ r(
1089
- P,
1090
- {
1091
- icon: me,
1092
- title: "Filters and Controls",
1093
- description: "Dashboard filter/control toolbar, chip states, menus, and settings panels.",
1094
- children: /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1095
- /* @__PURE__ */ r(
1096
- N,
1097
- {
1098
- label: "Toolbar background",
1099
- tooltip: "Background color for the dashboard filter/control toolbar strip. This is separate from chip state colors.",
1100
- value: u.components.interactive.toolbarBackground || u.tokens.color.background,
1101
- onChange: (o) => m((t) => {
1102
- t.components.interactive.toolbarBackground = o;
1103
- })
1104
- }
1105
- ),
1106
- /* @__PURE__ */ r(
1107
- N,
1108
- {
1109
- label: "Default state",
1110
- tooltip: "Unselected filter/control chips plus the base surface for their menus, dialogs, and pagination fallback.",
1111
- value: u.components.interactive.background || u.tokens.color.card,
1112
- onChange: (o) => m((t) => {
1113
- t.components.interactive.background = o, t.components.pagination.background = o;
1114
- })
1115
- }
1116
- ),
1117
- /* @__PURE__ */ r(
1118
- N,
1119
- {
1120
- label: "Border",
1121
- tooltip: "Border color for filter/control chips, runtime inputs, settings panels, and related popover chrome.",
1122
- value: u.components.interactive.borderColor || u.tokens.color.border,
1123
- onChange: (o) => m((t) => {
1124
- t.components.interactive.borderColor = o, t.components.pagination.borderColor = o;
1125
- })
1126
- }
1127
- ),
1128
- /* @__PURE__ */ r(
1129
- N,
1130
- {
1131
- label: "Selected state",
1132
- tooltip: "Selected filter/control chips and hover feedback. This keeps a lighter default state and a stronger selected state.",
1133
- value: u.tokens.color.accent,
1134
- onChange: (o) => m((t) => {
1135
- Y(t, "accent", o);
1136
- })
1137
- }
1138
- )
1139
- ] })
1140
- }
1141
- )
1142
- ] }),
1143
- /* @__PURE__ */ d(G, { value: "data", className: "m-0 p-4", children: [
1144
- /* @__PURE__ */ d(
1145
- P,
1146
- {
1147
- icon: ar,
1148
- title: "Charts",
1149
- description: "Palette and semantic chart text/grid colors.",
1150
- children: [
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,
1178
- {
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,
1188
- /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1189
- /* @__PURE__ */ r(
1190
- N,
1191
- {
1192
- label: "Grid",
1193
- value: u.components.chart.gridColor,
1194
- onChange: (o) => m((t) => {
1195
- t.components.chart.gridColor = o;
1196
- })
1197
- }
1198
- ),
1199
- /* @__PURE__ */ r(
1200
- N,
1201
- {
1202
- label: "Axis",
1203
- value: u.components.chart.axisColor,
1204
- onChange: (o) => m((t) => {
1205
- t.components.chart.axisColor = o;
1206
- })
1207
- }
1208
- )
1209
- ] })
1210
- ]
1211
- }
1212
- ),
1213
- /* @__PURE__ */ d(
1214
- P,
1215
- {
1216
- icon: nr,
1217
- title: "Tables",
1218
- description: "All tables share this appearance.",
1219
- children: [
1220
- /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1221
- /* @__PURE__ */ r(
1222
- X,
1223
- {
1224
- label: "Density",
1225
- value: u.components.table.density,
1226
- options: [
1227
- ["compact", "Compact"],
1228
- ["comfortable", "Comfortable"],
1229
- ["spacious", "Spacious"]
1230
- ],
1231
- onChange: (o) => m((t) => {
1232
- t.components.table.density = o;
1233
- })
1234
- }
1235
- ),
1236
- /* @__PURE__ */ r(
1237
- X,
1238
- {
1239
- label: "Cell wrap",
1240
- value: u.components.table.cell.wrap,
1241
- options: [
1242
- ["nowrap", "No wrap"],
1243
- ["wrap", "Wrap"]
1244
- ],
1245
- onChange: (o) => m((t) => {
1246
- t.components.table.cell.wrap = o;
1247
- })
1248
- }
1249
- )
1250
- ] }),
1251
- /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
1252
- /* @__PURE__ */ r(
1253
- N,
1254
- {
1255
- label: "Header",
1256
- value: u.components.table.header.background,
1257
- onChange: (o) => m((t) => {
1258
- t.components.table.header.background = o;
1259
- })
1260
- }
1261
- ),
1262
- /* @__PURE__ */ r(
1263
- N,
1264
- {
1265
- label: "Divider",
1266
- value: u.components.table.row.dividerColor,
1267
- onChange: (o) => m((t) => {
1268
- t.components.table.row.dividerColor = o, t.components.table.header.dividerColor = o;
1269
- })
1270
- }
1271
- ),
1272
- /* @__PURE__ */ r(
1273
- N,
1274
- {
1275
- label: "Selection",
1276
- value: u.tokens.color.selection,
1277
- onChange: (o) => m((t) => {
1278
- Y(t, "selection", o);
1279
- })
1280
- }
1281
- )
1282
- ] }),
1283
- /* @__PURE__ */ r(
1284
- Z,
1285
- {
1286
- label: "Zebra rows",
1287
- checked: u.components.table.row.zebra,
1288
- onCheckedChange: (o) => m((t) => {
1289
- t.components.table.row.zebra = o;
1290
- })
1291
- }
1292
- ),
1293
- /* @__PURE__ */ r(
1294
- Z,
1295
- {
1296
- label: "Sticky headers",
1297
- checked: u.components.table.header.sticky,
1298
- onCheckedChange: (o) => m((t) => {
1299
- t.components.table.header.sticky = o;
1300
- })
1301
- }
1302
- ),
1303
- /* @__PURE__ */ r(
1304
- Z,
1305
- {
1306
- label: "Uppercase headers",
1307
- checked: u.components.table.header.uppercase,
1308
- onCheckedChange: (o) => m((t) => {
1309
- t.components.table.header.uppercase = o;
1310
- })
1311
- }
1312
- )
1313
- ]
1314
- }
1315
- )
1316
- ] })
1317
- ] })
1318
- ] }) : null
1319
- ]
1320
- }
1321
- );
1322
- }
1323
- function P({
1324
- icon: e,
1325
- title: a,
1326
- description: n,
1327
- children: c
1328
- }) {
1329
- return /* @__PURE__ */ d("section", { className: "mb-6 last:mb-0", children: [
1330
- /* @__PURE__ */ d("div", { className: "mb-3 flex items-start gap-2", children: [
1331
- /* @__PURE__ */ r("div", { className: "mt-0.5 flex h-5 w-5 items-center justify-center rounded-control border border-border/70", children: /* @__PURE__ */ r(e, { className: "h-3 w-3 text-muted-foreground" }) }),
1332
- /* @__PURE__ */ d("div", { className: "min-w-0", children: [
1333
- /* @__PURE__ */ r("h3", { className: "text-[13px] font-semibold", children: a }),
1334
- /* @__PURE__ */ r("p", { className: "mt-0.5 text-[12px] leading-4 text-muted-foreground", children: n })
1335
- ] })
1336
- ] }),
1337
- /* @__PURE__ */ r("div", { className: "space-y-2", children: c }),
1338
- /* @__PURE__ */ r(tr, { className: "mt-5 bg-border/60" })
1339
- ] });
1340
- }
1341
- function Br({
1342
- value: e,
1343
- onChange: a
1344
- }) {
1345
- var c;
1346
- const n = (c = W.find((s) => s.value === e)) == null ? void 0 : c.id;
1347
- return /* @__PURE__ */ d("div", { children: [
1348
- /* @__PURE__ */ r(E, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: "Font family" }),
1349
- /* @__PURE__ */ d("div", { className: "grid grid-cols-[minmax(0,1fr)_150px] gap-2", children: [
1350
- /* @__PURE__ */ d(
1351
- Pe,
1352
- {
1353
- value: n,
1354
- onValueChange: (s) => {
1355
- const f = W.find(
1356
- (h) => h.id === s
1357
- );
1358
- f && a(f.value);
1359
- },
1360
- children: [
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)) })
1363
- ]
1364
- }
1365
- ),
1366
- /* @__PURE__ */ r(
1367
- "div",
1368
- {
1369
- className: "flex h-7 items-center rounded-control border border-border/60 bg-muted/30 px-2 text-[12px]",
1370
- style: { fontFamily: e },
1371
- children: "Aa 123"
1372
- }
1373
- )
1374
- ] })
1375
- ] });
1376
- }
1377
- function N({
1378
- label: e,
1379
- tooltip: a,
1380
- value: n,
1381
- onChange: c
1382
- }) {
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);
1385
- };
1386
- return /* @__PURE__ */ d("div", { className: "block", children: [
1387
- /* @__PURE__ */ d("div", { className: "mb-1 flex items-center gap-1", children: [
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(
1391
- "button",
1392
- {
1393
- type: "button",
1394
- "aria-label": `${e} details`,
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",
1396
- children: /* @__PURE__ */ r(Fe, { className: "h-3 w-3" })
1397
- }
1398
- ) }),
1399
- /* @__PURE__ */ r(oe, { side: "top", className: "max-w-64", children: a })
1400
- ] }) }) : null
1401
- ] }),
1402
- /* @__PURE__ */ d("div", { className: "flex h-7 items-center overflow-hidden rounded-control border border-input bg-background", children: [
1403
- /* @__PURE__ */ d(ye, { open: s, onOpenChange: i, children: [
1404
- /* @__PURE__ */ r(Ne, { asChild: !0, children: /* @__PURE__ */ r(
1405
- "button",
1406
- {
1407
- type: "button",
1408
- "aria-label": `Open ${e} color picker`,
1409
- className: "ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-control border border-border/70",
1410
- style: { backgroundColor: n },
1411
- children: /* @__PURE__ */ r("span", { className: "sr-only", children: e })
1412
- }
1413
- ) }),
1414
- /* @__PURE__ */ d(
1415
- Se,
1416
- {
1417
- align: "start",
1418
- sideOffset: 6,
1419
- className: "z-[60] w-64 rounded-control p-2",
1420
- children: [
1421
- /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
1422
- /* @__PURE__ */ d(
1423
- "label",
1424
- {
1425
- className: "relative flex h-16 w-16 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-control border border-border/70",
1426
- style: { backgroundColor: n },
1427
- children: [
1428
- /* @__PURE__ */ r(
1429
- "input",
1430
- {
1431
- "aria-label": `${e} native color picker`,
1432
- type: "color",
1433
- value: v,
1434
- onChange: (p) => c(p.target.value),
1435
- className: "absolute inset-0 h-full w-full cursor-pointer opacity-0"
1436
- }
1437
- ),
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" }) })
1439
- ]
1440
- }
1441
- ),
1442
- /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
1443
- /* @__PURE__ */ d("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
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(
1447
- "button",
1448
- {
1449
- type: "button",
1450
- "aria-label": `Reset ${e} color to previous value`,
1451
- disabled: !b,
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",
1453
- onClick: () => c(h),
1454
- children: /* @__PURE__ */ r(we, { className: "h-3 w-3" })
1455
- }
1456
- ) }),
1457
- /* @__PURE__ */ r(oe, { side: "top", children: "Reset to previous value" })
1458
- ] }) })
1459
- ] }),
1460
- /* @__PURE__ */ r(
1461
- ae,
1462
- {
1463
- size: "xs",
1464
- "aria-label": `${e} popover color value`,
1465
- value: n,
1466
- onChange: (p) => c(p.target.value),
1467
- className: "font-mono"
1468
- }
1469
- )
1470
- ] })
1471
- ] }),
1472
- /* @__PURE__ */ r("div", { className: "mt-2 grid grid-cols-6 gap-1", children: Tr.map((p) => /* @__PURE__ */ r(
1473
- "button",
1474
- {
1475
- type: "button",
1476
- "aria-label": `Set ${e} to ${p}`,
1477
- className: te(
1478
- "h-6 rounded-control border border-border/70 shadow-sm",
1479
- n.toLowerCase() === p && "ring-2 ring-ring"
1480
- ),
1481
- style: { backgroundColor: p },
1482
- onClick: () => c(p)
1483
- },
1484
- p
1485
- )) })
1486
- ]
1487
- }
1488
- )
1489
- ] }),
1490
- /* @__PURE__ */ r(
1491
- ae,
1492
- {
1493
- size: "xs",
1494
- "aria-label": `${e} color value`,
1495
- value: n,
1496
- onChange: (p) => c(p.target.value),
1497
- className: "h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"
1498
- }
1499
- )
1500
- ] })
1501
- ] });
1502
- }
1503
- function Rr(e) {
1504
- const a = sr(e);
1505
- return a ? `#${q(a.r)}${q(a.g)}${q(a.b)}` : "#000000";
1506
- }
1507
- function q(e) {
1508
- return Math.round(e).toString(16).padStart(2, "0");
1509
- }
1510
- function K({
1511
- label: e,
1512
- tooltip: a,
1513
- value: n,
1514
- min: c,
1515
- max: s,
1516
- onChange: f
1517
- }) {
1518
- const h = g.useId();
1519
- return /* @__PURE__ */ d("div", { className: "block", children: [
1520
- /* @__PURE__ */ d("div", { className: "mb-1 flex items-center gap-1", children: [
1521
- /* @__PURE__ */ r(
1522
- E,
1523
- {
1524
- htmlFor: h,
1525
- className: "text-[11px] font-normal text-muted-foreground",
1526
- children: e
1527
- }
1528
- ),
1529
- a ? /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ d(ee, { children: [
1530
- /* @__PURE__ */ r(re, { asChild: !0, children: /* @__PURE__ */ r(
1531
- "button",
1532
- {
1533
- type: "button",
1534
- "aria-label": `${e} details`,
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",
1536
- children: /* @__PURE__ */ r(Fe, { className: "h-3 w-3" })
1537
- }
1538
- ) }),
1539
- /* @__PURE__ */ r(oe, { side: "top", className: "max-w-56", children: a })
1540
- ] }) }) : null
1541
- ] }),
1542
- /* @__PURE__ */ r(
1543
- ae,
1544
- {
1545
- id: h,
1546
- size: "xs",
1547
- type: "number",
1548
- min: c,
1549
- max: s,
1550
- value: n,
1551
- onChange: (x) => {
1552
- const v = Number(x.target.value);
1553
- Number.isNaN(v) || f(v);
1554
- }
1555
- }
1556
- )
1557
- ] });
1558
- }
1559
- function X({
1560
- label: e,
1561
- value: a,
1562
- options: n,
1563
- onChange: c
1564
- }) {
1565
- return /* @__PURE__ */ d("div", { children: [
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)) })
1570
- ] })
1571
- ] });
1572
- }
1573
- function Z({
1574
- label: e,
1575
- checked: a,
1576
- onCheckedChange: n
1577
- }) {
1578
- return /* @__PURE__ */ d("div", { className: "flex h-8 items-center justify-between rounded-control border border-border/60 px-2", children: [
1579
- /* @__PURE__ */ r("span", { className: "text-[12px]", children: e }),
1580
- /* @__PURE__ */ r(Ce, { size: "xs", checked: a, onCheckedChange: n })
1581
- ] });
1582
- }
1583
- function Er(e) {
1584
- const a = `${Number((e / 16).toFixed(4))}rem`;
1585
- return {
1586
- "--semaphor-radius": a,
1587
- "--semaphor-control-radius": a
1588
- };
1589
- }
1590
- function Ar(e) {
1591
- return JSON.parse(JSON.stringify(e));
1592
- }
1593
- function zr(e) {
1594
- return typeof e.text == "function" ? e.text() : new Promise((a, n) => {
1595
- const c = new FileReader();
1596
- c.onload = () => a(String(c.result ?? "")), c.onerror = () => n(c.error ?? new Error("Unable to read file")), c.readAsText(e);
1597
- });
1598
- }
1599
- export {
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
1606
- };
16
+ */const vr=de("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]),kr=[{value:"none",label:"None"},{value:"compact",label:"Compact"},{value:"default",label:"Default"},{value:"roomy",label:"Roomy"}],he=[{value:"outlined",label:"Outlined",note:"A border on a muted canvas"},{value:"raised",label:"Raised",note:"A shadow and no border on a muted canvas"},{value:"open",label:"Open",note:"No border or shadow on a plain canvas"}],Cr=[{value:"square",label:"Square"},{value:"subtle",label:"Subtle"},{value:"rounded",label:"Rounded"},{value:"round",label:"Round"}];function yr({spec:e,mode:a,onEdit:n}){var F;const c=pr({organizationAppearance:e},a),s=c.authored,[f,h]=pe(null),[x,v]=pe(!1),b=l=>h(n(l)),i=l=>br[l],p=s.canvas==="muted"?"muted":s.canvas==="background"?"background":"color",y=l=>({[a]:l});return/* @__PURE__ */d("div",{className:"-mx-4",children:[/* @__PURE__ */r(be,{label:"Spacing",options:kr.map(l=>({...l,title:`${j[l.value]} px between cards and around them`,preview:{...s,spacing:j[l.value],canvasPadding:j[l.value]}})),lit:c.pickers.spacing,note:"Card sizes never change with spacing.",changed:c.source.spacing==="organization"||c.source.canvasPadding==="organization",resetTitle:`Back to the default: ${j.default} px`,onPick:l=>b({spacing:l}),onReset:()=>b({reset:["spacing","canvasPadding"]}),children:/* @__PURE__ */d("div",{className:"mt-2 flex items-center gap-1.5",children:[/* @__PURE__ */r("span",{className:"text-[11px] text-muted-foreground",children:"Gap"}),/* @__PURE__ */r(B,{value:s.spacing,...i("spacing"),onChange:l=>b({spacing:l})}),/* @__PURE__ */r("span",{className:"ml-2 text-[11px] text-muted-foreground",children:"Canvas padding"}),/* @__PURE__ */r(B,{value:s.canvasPadding,...i("canvasPadding"),onChange:l=>b({canvasPadding:l})})]})}),/* @__PURE__ */r(be,{label:"Cards",options:he.map(l=>({value:l.value,label:l.label,title:l.note,preview:{...s,...ir[l.value]}})),lit:c.pickers.cards,note:((F=he.find(l=>l.value===c.pickers.cards))==null?void 0:F.note)??"Your own mix of border, shadow and canvas",changed:["cardBorder","cardShadow","canvas"].some(l=>c.source[l]==="organization"),resetTitle:"Back to the default cards",onPick:l=>b({cards:l}),onReset:()=>b({reset:["cards"]})}),/* @__PURE__ */d("div",{className:"grid gap-2 px-4 pb-3",children:[/* @__PURE__ */d("div",{className:"flex flex-wrap items-center gap-2",children:[/* @__PURE__ */d("span",{className:"w-24 text-[12px] text-muted-foreground",children:["Canvas (",a,")"]}),/* @__PURE__ */r(M,{label:"Canvas background",value:p,onChange:l=>b({canvas:y(l==="color"?a==="dark"?"#111318":"#f4f6f8":l)}),options:[{value:"muted",label:"Muted"},{value:"background",label:"Plain"},{value:"color",label:"Custom"}]}),p==="color"?/* @__PURE__ */r(Ye,{color:We(s.canvas),label:"Canvas color",onChange:l=>b({canvas:y(l)})}):null]}),/* @__PURE__ */d("div",{className:"flex flex-wrap items-center gap-2",children:[/* @__PURE__ */r("span",{className:"w-24 text-[12px] text-muted-foreground",children:"Corners"}),/* @__PURE__ */r(M,{label:"Corners",value:c.pickers.corners,onChange:l=>b({corners:l}),options:Cr.map(l=>({...l,title:`Cards ${me[l.value].cardCorners} px, controls ${me[l.value].controlCorners} px`}))}),/* @__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"})]}),x||!c.pickers.corners?/* @__PURE__ */d("div",{className:"flex items-center gap-1.5 pl-[104px]",children:[/* @__PURE__ */r("span",{className:"text-[11px] text-muted-foreground",children:"Cards"}),/* @__PURE__ */r(B,{value:s.cardCorners,...i("cardCorners"),onChange:l=>b({corners:{cards:l}})}),/* @__PURE__ */r("span",{className:"ml-1 text-[11px] text-muted-foreground",children:"Controls"}),/* @__PURE__ */r(B,{value:s.controlCorners,...i("controlCorners"),onChange:l=>b({corners:{controls:l}})})]}):null,/* @__PURE__ */d("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */r("span",{className:"w-24 text-[12px] text-muted-foreground",children:"Card border"}),/* @__PURE__ */r(Ce,{checked:s.cardBorder==="on",onCheckedChange:l=>b({border:l?"on":"off"}),"aria-label":"Card border"}),/* @__PURE__ */r("span",{className:"ml-4 w-20 text-[12px] text-muted-foreground",children:"Shadow"}),/* @__PURE__ */r(M,{label:"Card shadow",value:s.cardShadow==="custom"?null:s.cardShadow,onChange:l=>b({shadow:l}),options:[{value:"none",label:"None"},{value:"subtle",label:"Subtle"},{value:"raised",label:"Raised"}]})]}),/* @__PURE__ */d("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */r("span",{className:"w-24 text-[12px] text-muted-foreground",children:"Bar corners"}),/* @__PURE__ */r(B,{value:s.barCorners,...i("barCorners"),onChange:l=>b({barCorners:l})})]}),f?/* @__PURE__ */d("p",{role:"alert",className:"text-[12px] text-destructive",children:[f.message," ",f.fix]}):null]})]});}const Ae=[{id:"semaphor",name:"Semaphor",description:"Dense neutral system defaults for embedded analytics.",primary:"#18181b",accent:"#f4f4f5",light:{background:"#ffffff",foreground:"#18181b",muted:"#fafafa",mutedForeground:"#71717a",border:"#e4e4e7",primary:"#18181b",primaryForeground:"#ffffff",accent:"#f4f4f5",accentForeground:"#18181b",selection:"#2563eb",card:"#ffffff",cardForeground:"#18181b",chartPalette:["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4"]},dark:{background:"#09090b",foreground:"#fafafa",muted:"#18181b",mutedForeground:"#a1a1aa",border:"#27272a",primary:"#fafafa",primaryForeground:"#09090b",accent:"#27272a",accentForeground:"#fafafa",selection:"#5090f7",card:"#09090b",cardForeground:"#fafafa",chartPalette:["#60a5fa","#34d399","#fbbf24","#f87171","#a78bfa","#22d3ee"]}},{id:"atlas-blue",name:"Atlas Blue",description:"Crisp enterprise blue with restrained neutral surfaces.",primary:"#2563eb",accent:"#dbeafe",light:{background:"#f8fafc",foreground:"#0f172a",muted:"#f1f5f9",mutedForeground:"#64748b",border:"#cbd5e1",primary:"#2563eb",primaryForeground:"#ffffff",accent:"#dbeafe",accentForeground:"#1e3a8a",selection:"#2563eb",card:"#ffffff",cardForeground:"#0f172a",chartPalette:["#2563eb","#0f766e","#ca8a04","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#020617",foreground:"#e2e8f0",muted:"#0f172a",mutedForeground:"#94a3b8",border:"#1e293b",primary:"#60a5fa",primaryForeground:"#020617",accent:"#1e3a8a",accentForeground:"#dbeafe",selection:"#60a5fa",card:"#0f172a",cardForeground:"#e2e8f0",chartPalette:["#60a5fa","#2dd4bf","#facc15","#f87171","#a78bfa","#22d3ee"]}},{id:"field-green",name:"Field Green",description:"Operational green accents with quiet, readable canvases.",primary:"#047857",accent:"#d1fae5",light:{background:"#fbfdfb",foreground:"#10231d",muted:"#f1f5f3",mutedForeground:"#64746d",border:"#d7ded9",primary:"#047857",primaryForeground:"#ffffff",accent:"#d1fae5",accentForeground:"#064e3b",selection:"#047857",card:"#ffffff",cardForeground:"#10231d",chartPalette:["#047857","#2563eb","#d97706","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#071511",foreground:"#e7f4ef",muted:"#10231d",mutedForeground:"#92aaa1",border:"#244139",primary:"#34d399",primaryForeground:"#071511",accent:"#064e3b",accentForeground:"#d1fae5",selection:"#34d399",card:"#0b1d17",cardForeground:"#e7f4ef",chartPalette:["#34d399","#60a5fa","#fbbf24","#f87171","#a78bfa","#22d3ee"]}}];function R(e){const a=fr({organizationAppearance:e?Ee(e).spec:void 0});return Nr(ze(J(a)));}function Nr(e){var a;for(const n of Object.values(e.schemes)){const c=(a=n.components.table)==null?void 0:a.row;c!=null&&c.selectedBackground&&c.selectedBackground===c.hoverBackground&&delete c.selectedBackground;}return e;}function $(e){const a=J({version:ne,mode:e.mode,schemes:e.schemes}),n=cr(a);if(!n.success){const c=n.issues[0];throw new Error(`Invalid Brand Studio appearance at ${c.path}: ${c.message}`);}return n.value;}function xe(e){var n,c;const a=$(e);for(const s of["light","dark"]){const f=(n=a.schemes)==null?void 0:n[s];if(!(f!=null&&f.components))continue;const h=ze(J({version:ne,mode:e.mode,schemes:{light:{tokens:f.tokens,components:{}},dark:{tokens:f.tokens,components:{}}}})).schemes[s].components;for(const x of Sr){const v=f.components[x];if(v)for(const b of wr[x])v[b]!==void 0&&v[b]===((c=h[x])==null?void 0:c[b])&&delete v[b];}}return Ee(a).spec??{version:ne,mode:e.mode};}const Sr=["dashboard","card"],wr={dashboard:["foreground","borderColor"],card:["background","foreground","borderColor"]};function Fr(e,a){const n=Ae.find(s=>s.id===a);if(!n)return e;const c=J(e);return ve(c.schemes.light,n.light),ve(c.schemes.dark,n.dark),c;}function ve(e,a){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;}function Y(e,a,n){switch(e.tokens.color[a]=n,a){case"background":e.components.dashboard.background=n,e.components.interactive.toolbarBackground=n;break;case"foreground":e.components.dashboard.foreground=n,e.components.interactive.foreground=n,e.components.pagination.foreground=n,e.components.chart.foreground=n,e.components.table.pagination.foreground=n,e.components.table.subtotal.foreground=n,e.components.table.grandTotal.foreground=n;break;case"card":e.components.card.background=n,e.components.interactive.background=n,e.components.pagination.background=n,e.components.chart.background=n,e.components.table.container.background=n,e.components.table.pagination.background=n;break;case"cardForeground":e.components.card.foreground=n;break;case"muted":e.components.table.header.background=n,e.components.table.row.zebraBackground=n,e.components.table.subtotal.background=n,e.components.table.grandTotal.background=n;break;case"mutedForeground":e.components.table.header.foreground=n,e.components.chart.axisColor=n;break;case"border":e.tokens.color.input=n,e.components.dashboard.borderColor=n,e.components.card.borderColor=n,e.components.interactive.borderColor=n,e.components.pagination.borderColor=n,e.components.chart.gridColor=n,e.components.table.container.borderColor=n,e.components.table.header.dividerColor=n,e.components.table.row.dividerColor=n,e.components.table.grandTotal.borderColor=n,e.components.table.pagination.borderColor=n;break;case"accent":e.components.table.row.hoverBackground=n;break;}}function Pr(e,a,n){switch(e.tokens.radius[a]=n,a){case"table":e.components.table.container.borderRadius=n;break;}}function ze(e){for(const a of["light","dark"]){const n=e.schemes[a],c=n.tokens,s=c.color,f={fontFamily:"",headingFontFamily:"",monoFontFamily:"",baseFontSize:14,density:"comfortable"};c.typography={...f,...c.typography};const h={control:5,card:5,table:5,badge:999};c.radius={...h,...c.radius};const x={dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8};c.spacing={...x,...c.spacing};const v={card:"none",popover:"0 12px 32px rgba(15, 23, 42, 0.14)",focusRing:"0 0 0 2px rgba(37, 99, 235, 0.35)"};c.shadow={...v,...c.shadow};const b={dashboard:{background:s.background,foreground:s.foreground,borderColor:s.border},card:{background:s.card,foreground:s.cardForeground,borderColor:s.border},interactive:{toolbarBackground:s.background,background:s.card,foreground:s.foreground,borderColor:s.border},chart:{palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground,barRadius:0},table:ke(s,c),pagination:{background:s.card,foreground:s.foreground,borderColor:s.border}};n.components=Object.fromEntries(Object.entries({...b,...n.components}).map(([p,y])=>[p,{...b[p],...y}]));const i={palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground,barRadius:2};n.components.chart={...i,...n.components.chart},n.components.table={...ke(s,c),...n.components.table};}return e;}function ke(e,a){return{density:a.typography.density,container:{background:e.card,borderColor:e.border,borderRadius:a.radius.table,shadow:a.shadow.card},header:{background:e.muted,foreground:e.mutedForeground,dividerColor:e.border,fontWeight:600,uppercase:!0,sticky:!0},row:{height:32,dividerColor:e.border,zebra:!1,zebraBackground:e.muted,hoverBackground:e.accent},cell:{paddingX:a.spacing.tableCellX,paddingY:a.spacing.tableCellY,verticalAlign:"middle",wrap:"nowrap"},subtotal:{background:e.muted,foreground:e.foreground,fontWeight:600},grandTotal:{background:e.muted,foreground:e.foreground,fontWeight:700,borderColor:e.border},pagination:{background:e.card,foreground:e.foreground,borderColor:e.border}};}function J(e){return JSON.parse(JSON.stringify(e));}const Or=[["background","Canvas"],["foreground","Text"],["card","Card"],["cardForeground","Card text"],["primary","Primary"],["primaryForeground","Primary text"],["accent","Accent"],["accentForeground","Accent text"],["muted","Muted"],["mutedForeground","Muted text"],["border","Border"],["positive","Positive"],["negative","Negative"],["warning","Warning"],["info","Info"]],W=sr,Tr=["#ffffff","#f8fafc","#f4f4f5","#e4e4e7","#18181b","#09090b","#2563eb","#0f766e","#047857","#d97706","#dc2626","#7c3aed"];function Xr({appearance:e,previewTitle:a,isLoading:n=!1,isSaving:c=!1,error:s=null,className:f,onDraftChange:h,onSave:x,onClearConfig:v,onCancel:b}){const[i,p]=m.useState(null),[y,F]=m.useState("light"),[l,A]=m.useState(!1),[De,O]=m.useState("idle"),[ce,Ie]=m.useState(!1),[z,U]=m.useState(""),[D,C]=m.useState(null),se=m.useRef(null),I=m.useRef(h),T=m.useRef(!1);m.useEffect(()=>{I.current=h;},[h]),m.useEffect(()=>{if(e===void 0){T.current=!0,p(null);return;}const o=R(e);T.current=!0,p(o),F("light"),C(null);},[e]),m.useEffect(()=>{var o;if(i){if(T.current){T.current=!1;return;}try{const t=$(i);(o=I.current)==null||o.call(I,t),C(null);}catch(t){C(t instanceof Error?t.message:"Appearance is invalid");}}},[i]);const u=i==null?void 0:i.schemes[y],L=c||l,_e=m.useMemo(()=>u?Er(u.tokens.radius.control):void 0,[u]),je=o=>{p(t=>{if(!t)return t;const k=Ar(t);return o(k),k;});},g=o=>{je(t=>{o(t.schemes[y]);});},_=m.useMemo(()=>{if(!i)return null;try{return xe(i);}catch{return null;}},[i]),$e=o=>{if(!_)return null;const t=ur({spec:_,edit:o,mode:y});return t.ok?(p(R(t.spec)),null):t.refusal;},Je=async()=>{if(!i||!x)return;let o;try{o=xe(i);}catch(t){C(t instanceof Error?t.message:"Appearance is invalid");return;}A(!0);try{await x(o);}finally{A(!1);}},Ue=()=>{const o=R(null);O("idle"),p(o);},Le=async()=>{if(v){A(!0),C(null),O("idle");try{await v(),T.current=!0,p(R(null)),F("light");}catch(o){C(o instanceof Error?o.message:"Unable to clear organization appearance");}finally{A(!1);}}},le=m.useCallback(()=>i?JSON.stringify($(i),null,2):"",[i]),Me=o=>{if(Ie(o),o)try{U(le()),C(null);}catch(t){C(t instanceof Error?t.message:"Appearance is invalid");}},Ve=async()=>{if(i)try{const o=ce&&z?z:le();await navigator.clipboard.writeText(o),C(null),O("copied");}catch(o){C(o instanceof Error?o.message:"Unable to copy brand spec");}},ie=o=>{const t=JSON.parse(o),k=R(t),w=$(k);O("idle"),F("light"),p(k),U(JSON.stringify(w,null,2));},Ge=()=>{try{ie(z);}catch(o){C(o instanceof Error?o.message:"Brand spec must be valid JSON");}},He=async o=>{var k;const t=(k=o.target.files)==null?void 0:k[0];if(o.target.value="",!!t)try{ie(await zr(t));}catch(w){C(w instanceof Error?w.message:"Uploaded file must be a valid brand spec");}};return/* @__PURE__ */d("div",{className:te("flex min-h-0 flex-1 flex-col bg-background text-foreground",f),style:_e,children:[/* @__PURE__ */d("header",{className:"flex h-11 shrink-0 items-start gap-3 border-b border-border/60 px-4 pt-2",children:[/* @__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"})}),/* @__PURE__ */d("div",{className:"min-w-0 flex-1",children:[/* @__PURE__ */r("h2",{className:"truncate text-[13px] font-semibold leading-tight",children:"Brand Studio"}),/* @__PURE__ */d("p",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:["Previewing ",a||"current dashboard"]})]}),/* @__PURE__ */d(ye,{open:ce,onOpenChange:Me,children:[/* @__PURE__ */r(Ne,{asChild:!0,children:/* @__PURE__ */d(S,{type:"button",size:"xs",variant:"ghost",disabled:!i,children:[/* @__PURE__ */r(qe,{className:"h-3.5 w-3.5"}),"Brand Spec"]})}),/* @__PURE__ */d(Se,{align:"end",sideOffset:6,className:"z-[60] w-[min(520px,calc(100vw-24px))] rounded-control p-2",children:[/* @__PURE__ */d("div",{className:"mb-2 flex items-center justify-between gap-2",children:[/* @__PURE__ */d("div",{className:"min-w-0",children:[/* @__PURE__ */r("div",{className:"text-[12px] font-medium",children:"Brand spec"}),/* @__PURE__ */r("div",{className:"text-[11px] text-muted-foreground",children:"Edit, apply, copy, or upload your brand spec."})]}),/* @__PURE__ */d("div",{className:"flex shrink-0 items-center gap-1",children:[/* @__PURE__ */d(S,{type:"button",size:"xs",variant:"ghost",onClick:Ve,children:[/* @__PURE__ */r(xr,{className:"h-3.5 w-3.5"}),De==="copied"?"Copied":"Copy"]}),/* @__PURE__ */d(S,{type:"button",size:"xs",variant:"ghost",onClick:()=>{var o;return(o=se.current)==null?void 0:o.click();},children:[/* @__PURE__ */r(Ke,{className:"h-3.5 w-3.5"}),"Upload"]}),/* @__PURE__ */r(S,{type:"button",size:"xs",onClick:Ge,children:"Apply"})]})]}),/* @__PURE__ */r("div",{className:"h-[320px] overflow-hidden rounded-control border border-input",children:/* @__PURE__ */r(Xe,{ariaLabel:"Brand spec",value:z,onValueChange:o=>{U(o),O("idle");},language:"json",embedded:!0,hideLineNumbers:!0,dense:!0})})]})]}),/* @__PURE__ */r("input",{ref:se,"aria-label":"Upload brand spec",type:"file",accept:"application/json,.json",className:"sr-only",onChange:He}),/* @__PURE__ */d(S,{type:"button",size:"xs",variant:"ghost",onClick:Ue,disabled:!i,children:[/* @__PURE__ */r(we,{className:"h-3.5 w-3.5"}),"Reset"]}),v&&/* @__PURE__ */d(S,{type:"button",size:"xs",variant:"ghost",onClick:Le,disabled:L,children:[/* @__PURE__ */r(hr,{className:"h-3.5 w-3.5"}),"No config"]}),/* @__PURE__ */d(S,{type:"button",size:"xs",onClick:Je,disabled:!i||L||!!D||!x,children:[L?/* @__PURE__ */r(fe,{className:"h-3.5 w-3.5 animate-spin"}):/* @__PURE__ */r(gr,{className:"h-3.5 w-3.5"}),"Save"]}),b&&/* @__PURE__ */r("button",{type:"button","aria-label":"Close Brand Studio",className:"flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",onClick:b,children:/* @__PURE__ */r(Ze,{className:"h-3.5 w-3.5"})})]}),/* @__PURE__ */d("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[/* @__PURE__ */r("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:D?/* @__PURE__ */d(ue,{children:[/* @__PURE__ */r(ge,{className:"h-3.5 w-3.5 text-destructive"}),"Preview keeps the last valid draft"]}):/* @__PURE__ */d(ue,{children:[/* @__PURE__ */r(Qe,{className:"h-3.5 w-3.5 text-emerald-500"}),"Draft is applied to the live dashboard preview"]})}),/* @__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("button",{type:"button",className:te("h-full px-2.5 text-[12px] capitalize transition-colors",y===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>F(o),children:o},o))})]}),D&&/* @__PURE__ */r("div",{className:"border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive",children:D}),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(er,{defaultValue:"style",className:"flex min-h-0 flex-1 flex-col",children:[/* @__PURE__ */r("div",{className:"shrink-0 px-4 pt-3",children:/* @__PURE__ */d(rr,{variant:"underline",className:"w-full gap-5",children:[/* @__PURE__ */r(V,{value:"style",children:"Style"}),/* @__PURE__ */r(V,{value:"surfaces",children:"Surfaces"}),/* @__PURE__ */r(V,{value:"data",children:"Data"})]})}),/* @__PURE__ */d(or,{className:"min-h-0 flex-1",children:[/* @__PURE__ */d(G,{value:"style",className:"m-0 p-4",children:[/* @__PURE__ */r(P,{icon:H,title:"Presets",description:"Start from a full light and dark appearance.",children:/* @__PURE__ */r("div",{className:"grid grid-cols-1 gap-2",children:Ae.map(o=>/* @__PURE__ */d("button",{type:"button",className:"flex items-center gap-3 rounded-control border border-border/70 px-3 py-2 text-left hover:bg-muted/60",onClick:()=>{const t=Fr(i,o.id);p(t);},children:[/* @__PURE__ */d("div",{className:"flex h-7 w-10 overflow-hidden rounded-control border border-border/70",children:[/* @__PURE__ */r("span",{className:"h-full flex-1",style:{backgroundColor:o.primary}}),/* @__PURE__ */r("span",{className:"h-full flex-1",style:{backgroundColor:o.accent}})]}),/* @__PURE__ */d("span",{className:"min-w-0 flex-1",children:[/* @__PURE__ */r("span",{className:"block text-[13px] font-medium",children:o.name}),/* @__PURE__ */r("span",{className:"block truncate text-[12px] text-muted-foreground",children:o.description})]})]},o.id))})}),/* @__PURE__ */r(P,{icon:H,title:"Color",description:`Editing the ${y} scheme.`,children:/* @__PURE__ */r("div",{className:"grid grid-cols-2 gap-2",children:Or.map(([o,t])=>/* @__PURE__ */r(N,{label:t,value:u.tokens.color[o],onChange:k=>g(w=>{Y(w,o,k);})},o))})}),/* @__PURE__ */d(P,{icon:ar,title:"Typography",description:"Fonts and density used by dashboard and workflow chrome.",children:[/* @__PURE__ */r(Br,{value:u.tokens.typography.fontFamily,onChange:o=>g(t=>{t.tokens.typography.fontFamily=o,t.tokens.typography.headingFontFamily=o;})}),/* @__PURE__ */d("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */r(K,{label:"Base size",value:u.tokens.typography.baseFontSize,min:11,max:18,onChange:o=>g(t=>{t.tokens.typography.baseFontSize=o;})}),/* @__PURE__ */r(X,{label:"Density",value:u.tokens.typography.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>g(t=>{t.tokens.typography.density=o,t.components.table.density=t.tokens.typography.density;})})]})]})]}),/* @__PURE__ */d(G,{value:"surfaces",className:"m-0 p-4",children:[/* @__PURE__ */d(P,{icon:mr,title:"Layout",description:"Canvas, grid, and card rhythm for embedded dashboards.",children:[_?/* @__PURE__ */r(yr,{spec:_,mode:y,onEdit:$e}):null,/* @__PURE__ */d("div",{className:"grid grid-cols-3 gap-2",children:[/* @__PURE__ */r(K,{label:"Card pad",tooltip:"Inner padding inside card/widget frames around titles, controls, and visual content.",value:u.tokens.spacing.cardPadding,min:0,max:32,onChange:o=>g(t=>{t.tokens.spacing.cardPadding=o;})}),/* @__PURE__ */r(K,{label:"Table radius",tooltip:"Corner radius for table containers, table chrome, and table pagination surfaces.",value:u.tokens.radius.table,min:0,max:12,onChange:o=>g(t=>{Pr(t,"table",o);})})]})]}),/* @__PURE__ */r(P,{icon:ge,title:"Filters and Controls",description:"Dashboard filter/control toolbar, chip states, menus, and settings panels.",children:/* @__PURE__ */d("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */r(N,{label:"Toolbar background",tooltip:"Background color for the dashboard filter/control toolbar strip. This is separate from chip state colors.",value:u.components.interactive.toolbarBackground||u.tokens.color.background,onChange:o=>g(t=>{t.components.interactive.toolbarBackground=o;})}),/* @__PURE__ */r(N,{label:"Default state",tooltip:"Unselected filter/control chips plus the base surface for their menus, dialogs, and pagination fallback.",value:u.components.interactive.background||u.tokens.color.card,onChange:o=>g(t=>{t.components.interactive.background=o,t.components.pagination.background=o;})}),/* @__PURE__ */r(N,{label:"Border",tooltip:"Border color for filter/control chips, runtime inputs, settings panels, and related popover chrome.",value:u.components.interactive.borderColor||u.tokens.color.border,onChange:o=>g(t=>{t.components.interactive.borderColor=o,t.components.pagination.borderColor=o;})}),/* @__PURE__ */r(N,{label:"Selected state",tooltip:"Selected filter/control chips and hover feedback. This keeps a lighter default state and a stronger selected state.",value:u.tokens.color.accent,onChange:o=>g(t=>{Y(t,"accent",o);})})]})})]}),/* @__PURE__ */d(G,{value:"data",className:"m-0 p-4",children:[/* @__PURE__ */d(P,{icon:nr,title:"Charts",description:"Palette and semantic chart text/grid colors.",children:[/* @__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:[/* @__PURE__ */r("div",{className:"min-w-0 flex-1",children:/* @__PURE__ */r(N,{label:`Series ${t+1}`,value:o||"#000000",onChange:k=>g(w=>{w.components.chart.palette[t]=k;})})}),u.components.chart.palette.length>1?/* @__PURE__ */r(S,{size:"xs",variant:"ghost","aria-label":`Remove series ${t+1} color`,className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground",onClick:()=>g(k=>{k.components.chart.palette.splice(t,1);}),children:"×"}):null]},t))}),u.components.chart.palette.length<12?/* @__PURE__ */r(S,{size:"xs",variant:"outline",className:"w-fit",onClick:()=>g(o=>{o.components.chart.palette.push("#64748b");}),children:"Add a color"}):null,/* @__PURE__ */d("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */r(N,{label:"Grid",value:u.components.chart.gridColor,onChange:o=>g(t=>{t.components.chart.gridColor=o;})}),/* @__PURE__ */r(N,{label:"Axis",value:u.components.chart.axisColor,onChange:o=>g(t=>{t.components.chart.axisColor=o;})})]})]}),/* @__PURE__ */d(P,{icon:tr,title:"Tables",description:"All tables share this appearance.",children:[/* @__PURE__ */d("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */r(X,{label:"Density",value:u.components.table.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>g(t=>{t.components.table.density=o;})}),/* @__PURE__ */r(X,{label:"Cell wrap",value:u.components.table.cell.wrap,options:[["nowrap","No wrap"],["wrap","Wrap"]],onChange:o=>g(t=>{t.components.table.cell.wrap=o;})})]}),/* @__PURE__ */d("div",{className:"grid grid-cols-2 gap-2",children:[/* @__PURE__ */r(N,{label:"Header",value:u.components.table.header.background,onChange:o=>g(t=>{t.components.table.header.background=o;})}),/* @__PURE__ */r(N,{label:"Divider",value:u.components.table.row.dividerColor,onChange:o=>g(t=>{t.components.table.row.dividerColor=o,t.components.table.header.dividerColor=o;})}),/* @__PURE__ */r(N,{label:"Selection",value:u.tokens.color.selection,onChange:o=>g(t=>{Y(t,"selection",o);})})]}),/* @__PURE__ */r(Z,{label:"Zebra rows",checked:u.components.table.row.zebra,onCheckedChange:o=>g(t=>{t.components.table.row.zebra=o;})}),/* @__PURE__ */r(Z,{label:"Sticky headers",checked:u.components.table.header.sticky,onCheckedChange:o=>g(t=>{t.components.table.header.sticky=o;})}),/* @__PURE__ */r(Z,{label:"Uppercase headers",checked:u.components.table.header.uppercase,onCheckedChange:o=>g(t=>{t.components.table.header.uppercase=o;})})]})]})]})]}):null]});}function P({icon:e,title:a,description:n,children:c}){return/* @__PURE__ */d("section",{className:"mb-6 last:mb-0",children:[/* @__PURE__ */d("div",{className:"mb-3 flex items-start gap-2",children:[/* @__PURE__ */r("div",{className:"mt-0.5 flex h-5 w-5 items-center justify-center rounded-control border border-border/70",children:/* @__PURE__ */r(e,{className:"h-3 w-3 text-muted-foreground"})}),/* @__PURE__ */d("div",{className:"min-w-0",children:[/* @__PURE__ */r("h3",{className:"text-[13px] font-semibold",children:a}),/* @__PURE__ */r("p",{className:"mt-0.5 text-[12px] leading-4 text-muted-foreground",children:n})]})]}),/* @__PURE__ */r("div",{className:"space-y-2",children:c}),/* @__PURE__ */r(dr,{className:"mt-5 bg-border/60"})]});}function Br({value:e,onChange:a}){var c;const n=(c=W.find(s=>s.value===e))==null?void 0:c.id;return/* @__PURE__ */d("div",{children:[/* @__PURE__ */r(E,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:"Font family"}),/* @__PURE__ */d("div",{className:"grid grid-cols-[minmax(0,1fr)_150px] gap-2",children:[/* @__PURE__ */d(Pe,{value:n,onValueChange:s=>{const f=W.find(h=>h.id===s);f&&a(f.value);},children:[/* @__PURE__ */r(Oe,{size:"xs","aria-label":"Font family preset",children:/* @__PURE__ */r(Te,{placeholder:"Select font"})}),/* @__PURE__ */r(Be,{children:W.map(s=>/* @__PURE__ */r(Re,{value:s.id,children:s.label},s.id))})]}),/* @__PURE__ */r("div",{className:"flex h-7 items-center rounded-control border border-border/60 bg-muted/30 px-2 text-[12px]",style:{fontFamily:e},children:"Aa 123"})]})]});}function N({label:e,tooltip:a,value:n,onChange:c}){const[s,f]=m.useState(!1),[h,x]=m.useState(n),v=Rr(n),b=n!==h,i=p=>{f(p),p&&x(n);};return/* @__PURE__ */d("div",{className:"block",children:[/* @__PURE__ */d("div",{className:"mb-1 flex items-center gap-1",children:[/* @__PURE__ */r(E,{className:"text-[11px] font-normal text-muted-foreground",children:e}),a?/* @__PURE__ */r(Q,{children:/* @__PURE__ */d(ee,{children:[/* @__PURE__ */r(re,{asChild:!0,children:/* @__PURE__ */r("button",{type:"button","aria-label":`${e} details`,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",children:/* @__PURE__ */r(Fe,{className:"h-3 w-3"})})}),/* @__PURE__ */r(oe,{side:"top",className:"max-w-64",children:a})]})}):null]}),/* @__PURE__ */d("div",{className:"flex h-7 items-center overflow-hidden rounded-control border border-input bg-background",children:[/* @__PURE__ */d(ye,{open:s,onOpenChange:i,children:[/* @__PURE__ */r(Ne,{asChild:!0,children:/* @__PURE__ */r("button",{type:"button","aria-label":`Open ${e} color picker`,className:"ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-control border border-border/70",style:{backgroundColor:n},children:/* @__PURE__ */r("span",{className:"sr-only",children:e})})}),/* @__PURE__ */d(Se,{align:"start",sideOffset:6,className:"z-[60] w-64 rounded-control p-2",children:[/* @__PURE__ */d("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */d("label",{className:"relative flex h-16 w-16 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-control border border-border/70",style:{backgroundColor:n},children:[/* @__PURE__ */r("input",{"aria-label":`${e} native color picker`,type:"color",value:v,onChange:p=>c(p.target.value),className:"absolute inset-0 h-full w-full cursor-pointer opacity-0"}),/* @__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"})})]}),/* @__PURE__ */d("div",{className:"min-w-0 flex-1",children:[/* @__PURE__ */d("div",{className:"mb-1 flex items-center justify-between gap-2",children:[/* @__PURE__ */r(E,{className:"block text-[11px] font-normal text-muted-foreground",children:"Color value"}),/* @__PURE__ */r(Q,{children:/* @__PURE__ */d(ee,{children:[/* @__PURE__ */r(re,{asChild:!0,children:/* @__PURE__ */r("button",{type:"button","aria-label":`Reset ${e} color to previous value`,disabled:!b,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",onClick:()=>c(h),children:/* @__PURE__ */r(we,{className:"h-3 w-3"})})}),/* @__PURE__ */r(oe,{side:"top",children:"Reset to previous value"})]})})]}),/* @__PURE__ */r(ae,{size:"xs","aria-label":`${e} popover color value`,value:n,onChange:p=>c(p.target.value),className:"font-mono"})]})]}),/* @__PURE__ */r("div",{className:"mt-2 grid grid-cols-6 gap-1",children:Tr.map(p=>/* @__PURE__ */r("button",{type:"button","aria-label":`Set ${e} to ${p}`,className:te("h-6 rounded-control border border-border/70 shadow-sm",n.toLowerCase()===p&&"ring-2 ring-ring"),style:{backgroundColor:p},onClick:()=>c(p)},p))})]})]}),/* @__PURE__ */r(ae,{size:"xs","aria-label":`${e} color value`,value:n,onChange:p=>c(p.target.value),className:"h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"})]})]});}function Rr(e){const a=lr(e);return a?`#${q(a.r)}${q(a.g)}${q(a.b)}`:"#000000";}function q(e){return Math.round(e).toString(16).padStart(2,"0");}function K({label:e,tooltip:a,value:n,min:c,max:s,onChange:f}){const h=m.useId();return/* @__PURE__ */d("div",{className:"block",children:[/* @__PURE__ */d("div",{className:"mb-1 flex items-center gap-1",children:[/* @__PURE__ */r(E,{htmlFor:h,className:"text-[11px] font-normal text-muted-foreground",children:e}),a?/* @__PURE__ */r(Q,{children:/* @__PURE__ */d(ee,{children:[/* @__PURE__ */r(re,{asChild:!0,children:/* @__PURE__ */r("button",{type:"button","aria-label":`${e} details`,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",children:/* @__PURE__ */r(Fe,{className:"h-3 w-3"})})}),/* @__PURE__ */r(oe,{side:"top",className:"max-w-56",children:a})]})}):null]}),/* @__PURE__ */r(ae,{id:h,size:"xs",type:"number",min:c,max:s,value:n,onChange:x=>{const v=Number(x.target.value);Number.isNaN(v)||f(v);}})]});}function X({label:e,value:a,options:n,onChange:c}){return/* @__PURE__ */d("div",{children:[/* @__PURE__ */r(E,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:e}),/* @__PURE__ */d(Pe,{value:a,onValueChange:c,children:[/* @__PURE__ */r(Oe,{size:"xs",children:/* @__PURE__ */r(Te,{})}),/* @__PURE__ */r(Be,{children:n.map(([s,f])=>/* @__PURE__ */r(Re,{value:s,children:f},s))})]})]});}function Z({label:e,checked:a,onCheckedChange:n}){return/* @__PURE__ */d("div",{className:"flex h-8 items-center justify-between rounded-control border border-border/60 px-2",children:[/* @__PURE__ */r("span",{className:"text-[12px]",children:e}),/* @__PURE__ */r(Ce,{size:"xs",checked:a,onCheckedChange:n})]});}function Er(e){const a=`${Number((e/16).toFixed(4))}rem`;return{"--semaphor-radius":a,"--semaphor-control-radius":a};}function Ar(e){return JSON.parse(JSON.stringify(e));}function zr(e){return typeof e.text=="function"?e.text():new Promise((a,n)=>{const c=new FileReader();c.onload=()=>a(String(c.result??"")),c.onerror=()=>n(c.error??new Error("Unable to read file")),c.readAsText(e);});}export{Ae as BRAND_STUDIO_PRESETS,Xr as BrandStudioEditor,Fr as applyBrandStudioPreset,xe as brandStudioSaveSpec,$ as buildAppearanceSpecFromDraft,R as createBrandStudioDraft};