@servicetitan/json-render-react 0.0.0-anvil2-kits-poc-20260717210733

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 (126) hide show
  1. package/README.md +335 -0
  2. package/dist/catalog/context/catalog-prompt.md +229 -0
  3. package/dist/catalog/context/schema.json +56 -0
  4. package/dist/catalog/core/catalog-prompt.md +306 -0
  5. package/dist/catalog/core/schema.json +64 -0
  6. package/dist/catalog/marketing/catalog-prompt.md +307 -0
  7. package/dist/catalog/marketing/schema.json +65 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +2126 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/src/context/catalog/catalog-def.d.ts +50 -0
  12. package/dist/src/context/catalog/context-card.catalog.d.ts +19 -0
  13. package/dist/src/context/catalog/context-card.d.ts +8 -0
  14. package/dist/src/context/catalog/context-data-table.catalog.d.ts +34 -0
  15. package/dist/src/context/catalog/context-data-table.css.d.ts +2 -0
  16. package/dist/src/context/catalog/context-data-table.d.ts +6 -0
  17. package/dist/src/context/catalog/context-file-list.catalog.d.ts +11 -0
  18. package/dist/src/context/catalog/context-file-list.css.d.ts +16 -0
  19. package/dist/src/context/catalog/context-file-list.d.ts +6 -0
  20. package/dist/src/context/catalog/context-list.catalog.d.ts +48 -0
  21. package/dist/src/context/catalog/context-list.css.d.ts +16 -0
  22. package/dist/src/context/catalog/context-list.d.ts +6 -0
  23. package/dist/src/context/catalog/context-metric-grid.catalog.d.ts +22 -0
  24. package/dist/src/context/catalog/context-metric-grid.css.d.ts +13 -0
  25. package/dist/src/context/catalog/context-metric-grid.d.ts +6 -0
  26. package/dist/src/context/catalog/context-note-list.catalog.d.ts +15 -0
  27. package/dist/src/context/catalog/context-note-list.d.ts +6 -0
  28. package/dist/src/context/catalog/context-overview.catalog.d.ts +8 -0
  29. package/dist/src/context/catalog/context-overview.css.d.ts +2 -0
  30. package/dist/src/context/catalog/context-overview.d.ts +6 -0
  31. package/dist/src/context/catalog/context-panel.catalog.d.ts +6 -0
  32. package/dist/src/context/catalog/context-panel.css.d.ts +1 -0
  33. package/dist/src/context/catalog/context-panel.d.ts +6 -0
  34. package/dist/src/context/catalog/context-tabular-list.catalog.d.ts +19 -0
  35. package/dist/src/context/catalog/context-tabular-list.css.d.ts +17 -0
  36. package/dist/src/context/catalog/context-tabular-list.d.ts +6 -0
  37. package/dist/src/context/catalog/index.d.ts +10 -0
  38. package/dist/src/context/catalog/schemas.d.ts +151 -0
  39. package/dist/src/context/components/collapsible-card.css.d.ts +41 -0
  40. package/dist/src/context/components/collapsible-card.d.ts +14 -0
  41. package/dist/src/context/components/context-ai-summary.css.d.ts +7 -0
  42. package/dist/src/context/components/context-ai-summary.d.ts +4 -0
  43. package/dist/src/context/components/context-chip-tone.d.ts +10 -0
  44. package/dist/src/context/components/context-note-list.css.d.ts +10 -0
  45. package/dist/src/context/components/context-render-error-boundary.d.ts +21 -0
  46. package/dist/src/context/constants.d.ts +6 -0
  47. package/dist/src/context/index.d.ts +4 -0
  48. package/dist/src/context/validate-context-spec-deep.d.ts +9 -0
  49. package/dist/src/context/validate-context-spec.d.ts +11 -0
  50. package/dist/src/core/actions.d.ts +28 -0
  51. package/dist/src/core/catalog/alert.catalog.d.ts +17 -0
  52. package/dist/src/core/catalog/alert.d.ts +9 -0
  53. package/dist/src/core/catalog/bar-chart.catalog.d.ts +22 -0
  54. package/dist/src/core/catalog/bar-chart.d.ts +6 -0
  55. package/dist/src/core/catalog/button.catalog.d.ts +24 -0
  56. package/dist/src/core/catalog/button.d.ts +7 -0
  57. package/dist/src/core/catalog/card.catalog.d.ts +20 -0
  58. package/dist/src/core/catalog/card.d.ts +8 -0
  59. package/dist/src/core/catalog/catalog-def.d.ts +484 -0
  60. package/dist/src/core/catalog/chart-utils.d.ts +2 -0
  61. package/dist/src/core/catalog/chart.css.d.ts +1 -0
  62. package/dist/src/core/catalog/checkbox.catalog.d.ts +11 -0
  63. package/dist/src/core/catalog/checkbox.d.ts +8 -0
  64. package/dist/src/core/catalog/chip.catalog.d.ts +20 -0
  65. package/dist/src/core/catalog/chip.d.ts +7 -0
  66. package/dist/src/core/catalog/divider.catalog.d.ts +25 -0
  67. package/dist/src/core/catalog/divider.d.ts +6 -0
  68. package/dist/src/core/catalog/donut-chart.catalog.d.ts +19 -0
  69. package/dist/src/core/catalog/donut-chart.d.ts +6 -0
  70. package/dist/src/core/catalog/flex.catalog.d.ts +55 -0
  71. package/dist/src/core/catalog/flex.d.ts +8 -0
  72. package/dist/src/core/catalog/grid.catalog.d.ts +21 -0
  73. package/dist/src/core/catalog/grid.css.d.ts +4 -0
  74. package/dist/src/core/catalog/grid.d.ts +8 -0
  75. package/dist/src/core/catalog/guidance-card-column-width.d.ts +12 -0
  76. package/dist/src/core/catalog/guidance-card.catalog.d.ts +58 -0
  77. package/dist/src/core/catalog/guidance-card.d.ts +9 -0
  78. package/dist/src/core/catalog/icon.catalog.d.ts +19 -0
  79. package/dist/src/core/catalog/icon.d.ts +6 -0
  80. package/dist/src/core/catalog/index.d.ts +7 -0
  81. package/dist/src/core/catalog/input.catalog.d.ts +20 -0
  82. package/dist/src/core/catalog/input.d.ts +8 -0
  83. package/dist/src/core/catalog/line-chart.catalog.d.ts +18 -0
  84. package/dist/src/core/catalog/line-chart.d.ts +6 -0
  85. package/dist/src/core/catalog/link.catalog.d.ts +20 -0
  86. package/dist/src/core/catalog/link.d.ts +7 -0
  87. package/dist/src/core/catalog/listbox.catalog.d.ts +15 -0
  88. package/dist/src/core/catalog/listbox.css.d.ts +9 -0
  89. package/dist/src/core/catalog/listbox.d.ts +8 -0
  90. package/dist/src/core/catalog/progress-bar.catalog.d.ts +11 -0
  91. package/dist/src/core/catalog/progress-bar.d.ts +6 -0
  92. package/dist/src/core/catalog/radio-group.catalog.d.ts +15 -0
  93. package/dist/src/core/catalog/radio-group.d.ts +8 -0
  94. package/dist/src/core/catalog/schemas.d.ts +436 -0
  95. package/dist/src/core/catalog/switch.catalog.d.ts +11 -0
  96. package/dist/src/core/catalog/switch.d.ts +8 -0
  97. package/dist/src/core/catalog/text.catalog.d.ts +20 -0
  98. package/dist/src/core/catalog/text.d.ts +6 -0
  99. package/dist/src/core/catalog/textarea.catalog.d.ts +15 -0
  100. package/dist/src/core/catalog/textarea.d.ts +8 -0
  101. package/dist/src/generate.d.ts +9 -0
  102. package/dist/src/index.d.ts +9 -0
  103. package/dist/src/marketing/catalog/catalog.d.ts +1 -0
  104. package/dist/src/marketing/catalog/components/index.d.ts +14 -0
  105. package/dist/src/marketing/catalog/components/revenue-card.catalog.d.ts +15 -0
  106. package/dist/src/marketing/catalog/components/revenue-card.css.d.ts +15 -0
  107. package/dist/src/marketing/catalog/components/revenue-card.d.ts +6 -0
  108. package/dist/src/marketing/catalog/index.d.ts +6 -0
  109. package/dist/src/marketing/catalog/scoped-catalogs.d.ts +4 -0
  110. package/dist/src/registry-utils.d.ts +6 -0
  111. package/dist/src/registry.d.ts +9 -0
  112. package/dist/src/renderers/context-spec-renderer.d.ts +6 -0
  113. package/dist/src/renderers/internal/enrichments/button-actions.d.ts +7 -0
  114. package/dist/src/renderers/internal/enrichments/useEnrichedSpec.d.ts +3 -0
  115. package/dist/src/renderers/sectioned-context-renderer.css.d.ts +1 -0
  116. package/dist/src/renderers/sectioned-context-renderer.d.ts +36 -0
  117. package/dist/src/renderers/spec-renderer.d.ts +30 -0
  118. package/dist/src/renderers/types.d.ts +4 -0
  119. package/dist/src/renderers/wrap-context-registry.d.ts +3 -0
  120. package/dist/src/scoped-catalog.d.ts +64 -0
  121. package/dist/src/test/setup-dom.d.ts +1 -0
  122. package/dist/src/types.d.ts +17 -0
  123. package/dist/src/utils/cx.d.ts +2 -0
  124. package/dist/src/utils/defined-props.d.ts +6 -0
  125. package/dist/styles.css +1 -0
  126. package/package.json +92 -0
package/dist/index.js ADDED
@@ -0,0 +1,2126 @@
1
+ var nt = Object.defineProperty;
2
+ var at = (e, t, r) => t in e ? nt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var Q = (e, t, r) => at(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { defineCatalog as D, validateSpec as rt, getByPath as j } from "@json-render/core";
5
+ import { useStateStore as N, defineRegistry as ot, createStateStore as it, JSONUIProvider as lt, Renderer as st } from "@json-render/react";
6
+ import { schema as B } from "@json-render/react/schema";
7
+ import { jsx as o, jsxs as p, Fragment as de } from "react/jsx-runtime";
8
+ import { Card as O, Text as m, Chip as A, Dialog as P, Button as ue, ButtonCompound as ct, Icon as q, Link as _, OverflowText as dt, AiMark as ut, Alert as me, Badge as he, Flex as $, Checkbox as mt, Divider as ht, Grid as pt, TextField as ft, FieldLabel as gt, Listbox as ee, ProgressBar as V, Radio as te, Switch as bt, Textarea as vt, SkeletonText as pe, SkeletonRectangle as yt } from "@servicetitan/anvil2";
9
+ import { IconChevronDown as Ct } from "@servicetitan/anvil2-ai-kit/icons";
10
+ import { useState as W, useId as xt, useMemo as x, Children as U, Fragment as wt, useRef as R, useEffect as X, Component as St } from "react";
11
+ import { core as w } from "@servicetitan/anvil2/token";
12
+ import { createColumnHelper as kt, DataTable as Rt } from "@servicetitan/anvil2-react-beta";
13
+ import Nt from "@servicetitan/anvil2/assets/icons/material/round/image.svg";
14
+ import jt from "@servicetitan/anvil2/assets/icons/st/document_audio.svg";
15
+ import Tt from "@servicetitan/anvil2/assets/icons/st/document_doc.svg";
16
+ import Lt from "@servicetitan/anvil2/assets/icons/st/document_form.svg";
17
+ import _t from "@servicetitan/anvil2/assets/icons/st/document_other.svg";
18
+ import zt from "@servicetitan/anvil2/assets/icons/st/document_pdf.svg";
19
+ import Et from "@servicetitan/anvil2/assets/icons/st/document_spreadsheet.svg";
20
+ import Ot from "@servicetitan/anvil2/assets/icons/st/document_text.svg";
21
+ import { primitive as Pt } from "@servicetitan/anvil2-ai-kit/tokens";
22
+ import { z as n } from "zod";
23
+ import * as y from "@amcharts/amcharts5";
24
+ import * as b from "@amcharts/amcharts5/xy";
25
+ import It from "@amcharts/amcharts5/themes/Animated";
26
+ import { ThemeSemantic as At, ThemeCategorical as $t, ThemeMonochrome as ne } from "@servicetitan/anvil2-ext-charts/am5";
27
+ import fe from "@servicetitan/anvil2/assets/icons/material/round/check_circle.svg";
28
+ import ge from "@servicetitan/anvil2/assets/icons/material/round/radio_button_unchecked.svg";
29
+ import be from "@servicetitan/anvil2/assets/icons/st/in_progress.svg";
30
+ import * as ae from "@amcharts/amcharts5/percent";
31
+ import { GuidanceCard as Ft } from "@servicetitan/anvil2-ai-kit";
32
+ function Dt(e, t) {
33
+ if (typeof e != "object" || !e) return e;
34
+ var r = e[Symbol.toPrimitive];
35
+ if (r !== void 0) {
36
+ var a = r.call(e, t);
37
+ if (typeof a != "object") return a;
38
+ throw new TypeError("@@toPrimitive must return a primitive value.");
39
+ }
40
+ return (t === "string" ? String : Number)(e);
41
+ }
42
+ function Bt(e) {
43
+ var t = Dt(e, "string");
44
+ return typeof t == "symbol" ? t : String(t);
45
+ }
46
+ function Mt(e, t, r) {
47
+ return t = Bt(t), t in e ? Object.defineProperty(e, t, {
48
+ value: r,
49
+ enumerable: !0,
50
+ configurable: !0,
51
+ writable: !0
52
+ }) : e[t] = r, e;
53
+ }
54
+ function re(e, t) {
55
+ var r = Object.keys(e);
56
+ if (Object.getOwnPropertySymbols) {
57
+ var a = Object.getOwnPropertySymbols(e);
58
+ t && (a = a.filter(function(i) {
59
+ return Object.getOwnPropertyDescriptor(e, i).enumerable;
60
+ })), r.push.apply(r, a);
61
+ }
62
+ return r;
63
+ }
64
+ function oe(e) {
65
+ for (var t = 1; t < arguments.length; t++) {
66
+ var r = arguments[t] != null ? arguments[t] : {};
67
+ t % 2 ? re(Object(r), !0).forEach(function(a) {
68
+ Mt(e, a, r[a]);
69
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : re(Object(r)).forEach(function(a) {
70
+ Object.defineProperty(e, a, Object.getOwnPropertyDescriptor(r, a));
71
+ });
72
+ }
73
+ return e;
74
+ }
75
+ function ie(e, t) {
76
+ var r = {};
77
+ for (var a in e)
78
+ r[a] = t(e[a], a);
79
+ return r;
80
+ }
81
+ var Gt = (e, t, r) => {
82
+ for (var a of Object.keys(e)) {
83
+ var i;
84
+ if (e[a] !== ((i = t[a]) !== null && i !== void 0 ? i : r[a]))
85
+ return !1;
86
+ }
87
+ return !0;
88
+ }, T = (e) => {
89
+ var t = (r) => {
90
+ var a = e.defaultClassName, i = oe(oe({}, e.defaultVariants), r);
91
+ for (var l in i) {
92
+ var s, d = (s = i[l]) !== null && s !== void 0 ? s : e.defaultVariants[l];
93
+ if (d != null) {
94
+ var c = d;
95
+ typeof c == "boolean" && (c = c === !0 ? "true" : "false");
96
+ var u = (
97
+ // @ts-expect-error
98
+ e.variantClassNames[l][c]
99
+ );
100
+ u && (a += " " + u);
101
+ }
102
+ }
103
+ for (var [h, f] of e.compoundVariants)
104
+ Gt(h, i, e.defaultVariants) && (a += " " + f);
105
+ return a;
106
+ };
107
+ return t.variants = () => Object.keys(e.variantClassNames), t.classNames = {
108
+ get base() {
109
+ return e.defaultClassName.split(" ")[0];
110
+ },
111
+ get variants() {
112
+ return ie(e.variantClassNames, (r) => ie(r, (a) => a.split(" ")[0]));
113
+ }
114
+ }, t;
115
+ }, Vt = "_7hazmf0", ve = "_7hazmf1", Wt = "_7hazmf2", Ut = T({ defaultClassName: "_7hazmf3", variantClassNames: { expanded: { true: "_7hazmf4", false: "_7hazmf5" } }, defaultVariants: { expanded: !1 }, compoundVariants: [] }), Ht = T({ defaultClassName: "_7hazmf6", variantClassNames: { expanded: { true: "_7hazmf7", false: "_7hazmf8" } }, defaultVariants: { expanded: !1 }, compoundVariants: [] }), qt = "_7hazmf9", Xt = "_7hazmfa", Yt = "_7hazmfb", Kt = T({ defaultClassName: "_7hazmfc", variantClassNames: { expanded: { true: "_7hazmfd", false: "_7hazmfe" } }, defaultVariants: { expanded: !1 }, compoundVariants: [] });
116
+ const M = ["success", "warning", "danger", "info", "neutral"], Jt = {
117
+ success: w.semantic.BackgroundColorSuccessSubdued.value,
118
+ warning: w.semantic.BackgroundColorWarningSubdued.value,
119
+ danger: w.semantic.BackgroundColorDangerSubdued.value,
120
+ info: w.semantic.BackgroundColorPrimarySubdued.value,
121
+ neutral: w.semantic.BackgroundColorSecondary.value
122
+ };
123
+ function ye(e = "neutral") {
124
+ return Jt[e];
125
+ }
126
+ const Zt = {
127
+ success: w.semantic.BackgroundColorSuccess.value,
128
+ warning: w.semantic.BackgroundColorWarning.value,
129
+ danger: w.semantic.ForegroundColorDanger.value,
130
+ info: w.semantic.ForegroundColorPrimary.value,
131
+ neutral: void 0
132
+ };
133
+ function F(e) {
134
+ return Zt[e];
135
+ }
136
+ function Qt(e) {
137
+ if (e == null || e === "")
138
+ return null;
139
+ if (typeof e == "object" && e !== null && "label" in e) {
140
+ const t = e;
141
+ return {
142
+ label: t.label,
143
+ tone: t.tone ?? "neutral"
144
+ };
145
+ }
146
+ return typeof e == "string" ? { label: e, tone: "neutral" } : { label: String(e), tone: "neutral" };
147
+ }
148
+ function en({ badge: e }) {
149
+ return typeof e == "number" ? /* @__PURE__ */ o(A, { label: String(e), size: "small", style: { marginTop: "2px" } }) : /* @__PURE__ */ o(
150
+ A,
151
+ {
152
+ label: e.label,
153
+ size: "small",
154
+ color: ye(e.tone ?? "neutral"),
155
+ style: { marginTop: "2px" }
156
+ }
157
+ );
158
+ }
159
+ const tn = ({
160
+ title: e,
161
+ badge: t,
162
+ defaultExpanded: r = !0,
163
+ children: a
164
+ }) => {
165
+ const [i, l] = W(r), [s, d] = W(r), c = xt(), u = () => {
166
+ l((f) => {
167
+ const g = !f;
168
+ return g && d(!0), g;
169
+ });
170
+ }, h = (f) => {
171
+ f.propertyName !== "grid-template-rows" || i || d(!1);
172
+ };
173
+ return /* @__PURE__ */ o("div", { className: Vt, children: /* @__PURE__ */ o(O, { padding: "medium", children: /* @__PURE__ */ p("div", { className: Wt, children: [
174
+ /* @__PURE__ */ o(m, { variant: "headline", el: "h3", size: "medium", children: /* @__PURE__ */ p(
175
+ "button",
176
+ {
177
+ type: "button",
178
+ "aria-expanded": i,
179
+ "aria-controls": c,
180
+ onClick: u,
181
+ className: qt,
182
+ children: [
183
+ /* @__PURE__ */ p("span", { className: Xt, children: [
184
+ /* @__PURE__ */ o("span", { className: Yt, children: e }),
185
+ t != null ? /* @__PURE__ */ o(en, { badge: t }) : null
186
+ ] }),
187
+ /* @__PURE__ */ o(Ct, { className: Kt({ expanded: i }) })
188
+ ]
189
+ }
190
+ ) }),
191
+ /* @__PURE__ */ o(
192
+ "div",
193
+ {
194
+ className: Ut({ expanded: i }),
195
+ onTransitionEnd: h,
196
+ children: /* @__PURE__ */ o("div", { className: Ht({ expanded: i }), children: /* @__PURE__ */ o("div", { id: c, className: ve, "aria-hidden": !i, children: s ? a : null }) })
197
+ }
198
+ )
199
+ ] }) }) });
200
+ }, nn = n.object({
201
+ label: n.string(),
202
+ tone: n.enum(M).optional()
203
+ }), an = n.union([n.number().int().nonnegative(), nn]), rn = {
204
+ props: n.object({
205
+ title: n.string(),
206
+ defaultExpanded: n.boolean().optional(),
207
+ /**
208
+ * Optional badge shown in the card header, next to the title and before the chevron.
209
+ * Pass a number for a plain count pill (e.g. 3), or { label, tone? } for a
210
+ * labelled status pill (e.g. { label: "3 Variances", tone: "warning" }).
211
+ */
212
+ badge: an.optional()
213
+ }),
214
+ slots: ["default"],
215
+ description: "Collapsible card for the Context panel. Each card holds a single content component as its body. Optional badge shows a count (number) or status label ({ label, tone? }) in the card header. Use defaultExpanded: false to start collapsed."
216
+ }, on = ({
217
+ props: e,
218
+ children: t
219
+ }) => /* @__PURE__ */ o(
220
+ tn,
221
+ {
222
+ title: e.title,
223
+ ...e.badge != null ? { badge: e.badge } : {},
224
+ defaultExpanded: e.defaultExpanded ?? !0,
225
+ children: t
226
+ }
227
+ ), ln = n.object({
228
+ label: n.string(),
229
+ tone: n.enum(M).optional()
230
+ }), sn = n.union([n.string(), n.number(), n.null(), ln]), cn = n.object({
231
+ key: n.string(),
232
+ header: n.string(),
233
+ /**
234
+ * Column rendering type.
235
+ * - text: plain text (default)
236
+ * - currency: formatted currency value
237
+ * - chip: renders a Chip; cell value is a plain string (neutral) or { label, tone }
238
+ * - delta: signed variance value ("+5%", "-3%", null/"–"). Positive → danger red,
239
+ * negative → success green, null/empty/zero → renders "–" in neutral.
240
+ */
241
+ type: n.enum(["text", "currency", "chip", "delta"]).optional(),
242
+ sortable: n.boolean().optional()
243
+ }), dn = n.record(n.string(), sn).and(n.object({ id: n.string() })), un = {
244
+ props: n.object({
245
+ columns: n.array(cn),
246
+ rows: n.array(dn),
247
+ defaultSortedColumn: n.object({
248
+ id: n.string(),
249
+ desc: n.boolean().optional()
250
+ }).optional()
251
+ }),
252
+ slots: [],
253
+ description: "Read-only DataTable for context cards. Column type: text (default), currency, chip, or delta. Chip cells: plain string (neutral tone) or { label, tone } where tone is success | warning | danger | info | neutral. Delta cells: signed string ('+5%', '-3%') or null — positive renders danger-red, negative renders success-green, null renders '–'. Rows must include id."
254
+ };
255
+ var mn = "_1b4fiav0", hn = "_1b4fiav1";
256
+ function pn(e) {
257
+ if (e == null || e === "" || e === "–" || e === "0" || e === "0%")
258
+ return { text: "–", sign: "none" };
259
+ const t = String(e).trim();
260
+ return t.startsWith("+") || !t.startsWith("-") && parseFloat(t) > 0 ? { text: t, sign: "positive" } : t.startsWith("-") || parseFloat(t) < 0 ? { text: t, sign: "negative" } : { text: t, sign: "none" };
261
+ }
262
+ const fn = ({
263
+ props: e
264
+ }) => {
265
+ const t = x(() => {
266
+ const a = kt();
267
+ return e.columns.map(
268
+ (i) => a(i.key, {
269
+ header: { label: i.header },
270
+ ...i.sortable ? { sortable: !0 } : {},
271
+ ...i.type === "currency" ? { type: "currency" } : {},
272
+ ...i.type === "chip" ? {
273
+ renderCell: (l) => {
274
+ const s = Qt(l);
275
+ return s ? /* @__PURE__ */ o(A, { label: s.label, size: "small", color: ye(s.tone) }) : null;
276
+ }
277
+ } : {},
278
+ ...i.type === "delta" ? {
279
+ renderCell: (l) => {
280
+ const { text: s, sign: d } = pn(l), c = d === "positive" ? F("danger") : d === "negative" ? F("success") : void 0;
281
+ return /* @__PURE__ */ o("span", { className: hn, style: c ? { color: c } : void 0, children: s });
282
+ }
283
+ } : {}
284
+ })
285
+ );
286
+ }, [e.columns]), r = x(() => e.rows.map((a) => ({ ...a })), [e.rows]);
287
+ return /* @__PURE__ */ o("div", { className: mn, children: /* @__PURE__ */ o(
288
+ Rt,
289
+ {
290
+ columns: t,
291
+ data: r,
292
+ isSelectable: !1,
293
+ ...e.defaultSortedColumn ? {
294
+ defaultSortedColumn: {
295
+ id: e.defaultSortedColumn.id,
296
+ desc: e.defaultSortedColumn.desc ?? !1
297
+ }
298
+ } : {}
299
+ }
300
+ ) });
301
+ }, gn = n.object({
302
+ /** Filename including extension (e.g. "HVAC Inspection Checklist.pdf"). Used to infer the file type icon. */
303
+ label: n.string(),
304
+ /**
305
+ * File URL. Image files (jpg/jpeg/png/gif/webp/heic/svg) render inline in the
306
+ * preview dialog; other types show a large file-type icon with a Download action.
307
+ */
308
+ url: n.string()
309
+ }), bn = {
310
+ props: n.object({
311
+ items: n.array(gn)
312
+ }),
313
+ slots: [],
314
+ description: "Vertical list of file attachments and documents. Each row shows a color-coded file-type icon (inferred from the extension: pdf, xlsx/csv, doc/docx, image, or generic) and the filename. Clicking a row opens a preview dialog. Image files render from url; other files show a large icon and a Download footer action. Use for Completed Forms and Attachments sections."
315
+ };
316
+ var vn = "_1afcqze0", yn = "_1afcqze1", Cn = "_1afcqze2", xn = "_1afcqze3", wn = "_1afcqze4", Sn = "_1afcqze5", kn = "_1afcqze6", Rn = "_1afcqze7", Nn = "_1afcqze8";
317
+ function Ce(e) {
318
+ const t = e.toLowerCase();
319
+ return t.endsWith(".pdf") ? "pdf" : /\.(xlsx|xls|csv|numbers)$/.test(t) ? "spreadsheet" : /\.(doc|docx|pages)$/.test(t) ? /form/i.test(t.replace(/\.[^.]+$/, "")) ? "form" : "doc" : /\.(txt|rtf|md)$/.test(t) ? "text" : /\.(mp3|wav|aac|m4a|flac|ogg)$/.test(t) ? "audio" : /\.(jpg|jpeg|png|gif|webp|heic|svg)$/.test(t) ? "image" : /form/i.test(t.replace(/\.[^.]+$/, "")) ? "form" : "generic";
320
+ }
321
+ const xe = {
322
+ pdf: { svg: zt, color: "#DC2626" },
323
+ spreadsheet: { svg: Et, color: "#16A34A" },
324
+ doc: { svg: Tt, color: "#2563EB" },
325
+ text: { svg: Ot, color: "#6B7280" },
326
+ form: { svg: Lt, color: "#2563EB" },
327
+ audio: { svg: jt, color: "#6B7280" },
328
+ image: { svg: Nt, color: "#374151" },
329
+ generic: { svg: _t, color: "#6B7280" }
330
+ }, jn = {
331
+ "--a2-mod-icon-font-size": "80px"
332
+ };
333
+ function Tn({ kind: e }) {
334
+ const { svg: t, color: r } = xe[e];
335
+ return /* @__PURE__ */ o("div", { className: xn, "aria-hidden": "true", children: /* @__PURE__ */ o(q, { svg: t, size: "medium", color: r }) });
336
+ }
337
+ function Ln(e, t) {
338
+ const r = document.createElement("a");
339
+ r.href = e, r.download = t, r.target = "_blank", r.rel = "noopener noreferrer", document.body.appendChild(r), r.click(), r.remove();
340
+ }
341
+ function _n({ label: e }) {
342
+ return /* @__PURE__ */ o(m, { variant: "body", size: "medium", className: Nn, children: e });
343
+ }
344
+ function zn({ item: e, kind: t }) {
345
+ const { svg: r, color: a } = xe[t];
346
+ return /* @__PURE__ */ p("div", { className: wn, children: [
347
+ /* @__PURE__ */ o("div", { className: Sn, children: t === "image" ? /* @__PURE__ */ o("img", { src: e.url, alt: e.label, className: kn }) : /* @__PURE__ */ o("div", { className: Rn, children: /* @__PURE__ */ o(q, { svg: r, color: a, style: jn }) }) }),
348
+ /* @__PURE__ */ o(_n, { label: e.label })
349
+ ] });
350
+ }
351
+ function En({ item: e, onPreview: t }) {
352
+ const r = Ce(e.label);
353
+ return /* @__PURE__ */ o(
354
+ ct,
355
+ {
356
+ shape: "rounded",
357
+ onClick: t,
358
+ "aria-label": `Preview ${e.label}`,
359
+ className: yn,
360
+ children: /* @__PURE__ */ o(O, { padding: "small", children: /* @__PURE__ */ p("div", { className: Cn, children: [
361
+ /* @__PURE__ */ o(Tn, { kind: r }),
362
+ /* @__PURE__ */ o(m, { variant: "body", size: "small", children: e.label })
363
+ ] }) })
364
+ }
365
+ );
366
+ }
367
+ function On({ item: e }) {
368
+ const [t, r] = W(!1), a = Ce(e.label), i = a === "image";
369
+ return /* @__PURE__ */ p(de, { children: [
370
+ /* @__PURE__ */ o(En, { item: e, onPreview: () => r(!0) }),
371
+ /* @__PURE__ */ p(P, { open: t, onClose: () => r(!1), children: [
372
+ /* @__PURE__ */ o(P.Header, { children: "View Attachment" }),
373
+ /* @__PURE__ */ o(P.Content, { children: /* @__PURE__ */ o(zn, { item: e, kind: a }) }),
374
+ i ? null : /* @__PURE__ */ o(P.Footer, { children: /* @__PURE__ */ o(ue, { appearance: "primary", onClick: () => Ln(e.url, e.label), children: "Download" }) })
375
+ ] })
376
+ ] });
377
+ }
378
+ const Pn = ({
379
+ props: e
380
+ }) => /* @__PURE__ */ o("div", { className: vn, children: e.items.map((t, r) => /* @__PURE__ */ o(On, { item: t }, `${t.label}-${r}`)) }), In = n.object({
381
+ /** Primary label (e.g. employee name, job title). Required. */
382
+ title: n.string(),
383
+ /** Leading linked reference shown before the title (e.g. job number). */
384
+ identifier: n.string().optional(),
385
+ /** URL for the identifier link. */
386
+ identifierHref: n.string().optional(),
387
+ /** Secondary detail line below the title (e.g. "04/28/2026 · 8H · $65/HR"). */
388
+ meta: n.string().optional(),
389
+ /** Right-aligned callout value (e.g. "$520.00"). */
390
+ callout: n.string().optional(),
391
+ /** Optional tone for the callout text. */
392
+ calloutTone: n.enum(M).optional(),
393
+ /** Small label below the callout (e.g. "INVOICED"). */
394
+ calloutLabel: n.string().optional()
395
+ }), An = {
396
+ props: n.object({
397
+ items: n.array(In)
398
+ }),
399
+ slots: [],
400
+ description: "Flat list for timesheets and recent jobs. Each item has a required title, optional identifier link + meta on the left, and optional callout + calloutLabel on the right. For grouped procurement records with aligned columns, use ContextTabularList instead."
401
+ };
402
+ var $n = "blgld0", le = "blgld1", Fn = "blgld2", Dn = "blgld3", Bn = "blgld4", Mn = "blgld5", Gn = "blgld6", Vn = "blgld7";
403
+ function Wn({ item: e }) {
404
+ const t = e.calloutTone ? F(e.calloutTone) : void 0, r = e.identifier, a = e.callout != null || e.calloutLabel != null;
405
+ return /* @__PURE__ */ p("div", { className: Dn, children: [
406
+ /* @__PURE__ */ p("div", { className: Bn, children: [
407
+ /* @__PURE__ */ p("div", { className: Mn, children: [
408
+ r && e.identifierHref ? /* @__PURE__ */ o(_, { href: e.identifierHref, target: "_blank", children: r }) : r ? /* @__PURE__ */ o(m, { variant: "body", size: "small", children: r }) : null,
409
+ r ? /* @__PURE__ */ o("span", { "aria-hidden": "true", className: Gn }) : null,
410
+ /* @__PURE__ */ o(m, { variant: "body", size: "medium", children: e.title })
411
+ ] }),
412
+ e.meta ? /* @__PURE__ */ o(m, { variant: "body", size: "small", className: le, children: e.meta }) : null
413
+ ] }),
414
+ a ? /* @__PURE__ */ p("div", { className: Vn, children: [
415
+ e.callout ? /* @__PURE__ */ o(
416
+ m,
417
+ {
418
+ variant: "headline",
419
+ el: "h6",
420
+ size: "small",
421
+ ...t ? { style: { color: t } } : {},
422
+ children: e.callout
423
+ }
424
+ ) : null,
425
+ e.calloutLabel ? /* @__PURE__ */ o(m, { variant: "eyebrow", className: le, children: e.calloutLabel }) : null
426
+ ] }) : null
427
+ ] });
428
+ }
429
+ const Un = ({
430
+ props: e
431
+ }) => /* @__PURE__ */ o("div", { className: $n, children: e.items.map((t, r) => /* @__PURE__ */ o("div", { className: Fn, children: /* @__PURE__ */ o(Wn, { item: t }) }, t.identifier ?? t.title ?? r)) }), Hn = n.object({
432
+ label: n.string(),
433
+ value: n.string(),
434
+ /**
435
+ * Optional tone applied to the value text.
436
+ * Use "danger" for over-budget costs, "success" for positive metrics, etc.
437
+ */
438
+ tone: n.enum(M).optional()
439
+ }), qn = {
440
+ props: n.object({
441
+ items: n.array(Hn),
442
+ columns: n.enum(["3", "4"]).optional()
443
+ }),
444
+ slots: [],
445
+ description: "KPI grid with label and value pairs. Optional columns: 3 (default) or 4. Each item supports an optional tone (danger | warning | success | info | neutral) to color the value text."
446
+ };
447
+ var Xn = T({ defaultClassName: "_16tl57e0", variantClassNames: { columns: { 3: "_16tl57e1", 4: "_16tl57e2" } }, defaultVariants: { columns: "3" }, compoundVariants: [] }), Yn = "_16tl57e3", Kn = "_16tl57e4";
448
+ const Jn = ({
449
+ props: e
450
+ }) => {
451
+ const t = e.columns === "4" ? "4" : "3";
452
+ return /* @__PURE__ */ o("div", { className: Xn({ columns: t }), children: e.items.map((r) => {
453
+ const a = r.tone ? F(r.tone) : void 0;
454
+ return /* @__PURE__ */ p("div", { className: Kn, children: [
455
+ /* @__PURE__ */ o(m, { variant: "eyebrow", className: Yn, children: r.label.toUpperCase() }),
456
+ /* @__PURE__ */ o(
457
+ m,
458
+ {
459
+ variant: "headline",
460
+ el: "h6",
461
+ size: "small",
462
+ ...a ? { style: { color: a } } : {},
463
+ children: r.value
464
+ }
465
+ )
466
+ ] }, r.label);
467
+ }) });
468
+ };
469
+ var Zn = "_2pn4ri0", Qn = "_2pn4ri1";
470
+ const ea = ({ summary: e }) => /* @__PURE__ */ o("div", { className: Zn, "data-carto": "context-ai-summary", children: /* @__PURE__ */ o(O, { className: Qn, padding: "small", role: "status", style: { width: "100%" }, children: /* @__PURE__ */ o(m, { variant: "body", size: "medium", children: e }) }) });
471
+ var ta = "_4l9lye0", na = "_4l9lye1", aa = "_4l9lye2", ra = "_4l9lye3", se = "_4l9lye4";
472
+ const oa = n.object({
473
+ /**
474
+ * Optional category eyebrow shown above the body text (e.g. "JOB SUMMARY", "APPOINTMENT SUMMARY").
475
+ * Displayed in small caps at the top-left of the item.
476
+ */
477
+ category: n.string().optional(),
478
+ /** Main body text of the note. */
479
+ body: n.string(),
480
+ /** Author name shown at top-right (e.g. "MARCUS D."). */
481
+ author: n.string().optional(),
482
+ /** Date shown at top-right (e.g. "03/10/2026"). */
483
+ date: n.string().optional(),
484
+ /**
485
+ * Whether to truncate the body text to ~3 lines by default.
486
+ * An inline "More" toggle lets the user expand to full text.
487
+ * Defaults to false (show full text).
488
+ */
489
+ truncate: n.boolean().optional()
490
+ }), ia = {
491
+ props: n.object({
492
+ /**
493
+ * Optional AI-generated summary shown in a highlighted card at the top of the list,
494
+ * before the individual note items.
495
+ */
496
+ summary: n.string().optional(),
497
+ items: n.array(oa)
498
+ }),
499
+ slots: [],
500
+ description: "Notes & Summaries list. Optional summary renders an AI-highlighted box at the top. Each item shows an optional category eyebrow (e.g. 'JOB SUMMARY'), body text, and optional author + date at top-right. Set truncate: true on long items to clamp to ~3 lines with an inline More/Less expand."
501
+ };
502
+ function la({ item: e }) {
503
+ const t = e.category || e.author || e.date;
504
+ return /* @__PURE__ */ p("div", { className: aa, children: [
505
+ t ? /* @__PURE__ */ p("div", { className: ra, children: [
506
+ e.category ? /* @__PURE__ */ o(m, { variant: "eyebrow", className: se, children: e.category }) : /* @__PURE__ */ o("span", {}),
507
+ e.author || e.date ? /* @__PURE__ */ o(m, { variant: "eyebrow", className: se, children: [e.author, e.date].filter(Boolean).join(" · ") }) : null
508
+ ] }) : null,
509
+ e.truncate ? /* @__PURE__ */ o(dt, { rows: 3, expandable: !0, expandText: "More", collapseText: "Less", children: e.body }) : /* @__PURE__ */ o(m, { variant: "body", size: "medium", children: e.body })
510
+ ] });
511
+ }
512
+ const sa = ({
513
+ props: e
514
+ }) => /* @__PURE__ */ p("div", { className: ta, children: [
515
+ e.summary ? /* @__PURE__ */ o("div", { className: na, children: /* @__PURE__ */ o(ea, { summary: e.summary }) }) : null,
516
+ e.items.map((t, r) => /* @__PURE__ */ o(la, { item: t }, `${t.category ?? ""}-${r}`))
517
+ ] }), ca = {
518
+ props: n.object({
519
+ summary: n.string()
520
+ }),
521
+ slots: [],
522
+ description: "AI-generated overview summary for the Context panel. Optional first child of ContextPanel. Renders as a plain section (not a card): Overview headline with sparkle icon and body text. Leaf node — no children."
523
+ };
524
+ var da = "_1ysu3qn0", ua = "_1ysu3qn1";
525
+ const ma = ({
526
+ props: e
527
+ }) => /* @__PURE__ */ p("section", { className: da, children: [
528
+ /* @__PURE__ */ p("div", { className: ua, children: [
529
+ /* @__PURE__ */ o(m, { variant: "headline", el: "h2", size: "medium", children: "Overview" }),
530
+ /* @__PURE__ */ o(ut, { size: "small", type: "gradient" })
531
+ ] }),
532
+ /* @__PURE__ */ o(m, { variant: "body", size: "medium", children: e.summary })
533
+ ] }), ha = {
534
+ props: n.object({}),
535
+ slots: ["default"],
536
+ description: "Root container for the Context panel. MUST be the spec root. Children MUST only be ContextOverview (optional, first) followed by one or more ContextCard components."
537
+ };
538
+ var we = "_19nljxi0";
539
+ const pa = ({ children: e }) => {
540
+ const t = U.toArray(e).filter(Boolean);
541
+ return /* @__PURE__ */ o("div", { className: we, children: t });
542
+ }, fa = n.object({
543
+ /** Column header shown above the value (e.g. "DATE", "AMOUNT"). */
544
+ label: n.string(),
545
+ /** Cell value (e.g. "03/05/2026", "$1,672.00"). */
546
+ value: n.string()
547
+ }), ga = n.object({
548
+ /** Row type label in the first column (e.g. "PURCHASE ORDER", "RECEIPT", "BILL"). */
549
+ eyebrow: n.string().optional(),
550
+ /** Leading linked reference in the first column (e.g. PO number). */
551
+ identifier: n.string().optional(),
552
+ /** URL for the identifier link. */
553
+ identifierHref: n.string().optional(),
554
+ /** Additional columns after the identifier column — same field count per group. */
555
+ fields: n.array(fa)
556
+ }), ba = n.object({
557
+ /** Vendor or category heading (e.g. "ABC Supply Co"). */
558
+ label: n.string(),
559
+ items: n.array(ga)
560
+ }), va = {
561
+ props: n.object({
562
+ /** Vendor-grouped tabular rows. Each group renders as a neutral card with aligned columns. */
563
+ groups: n.array(ba)
564
+ }),
565
+ slots: [],
566
+ description: "Grouped tabular list for procurement-style records. Each group has a vendor label and rows with an optional eyebrow + identifier in the first column and additional label/value field columns (e.g. DATE, AMOUNT). Use inside ContextCard for Procurement sections."
567
+ };
568
+ var ya = "_5kl5rv0", Ca = "_5kl5rv1", xa = "_5kl5rv2", ce = "_5kl5rv3", wa = "_5kl5rv4", Sa = "_5kl5rv5", ka = "_5kl5rv6";
569
+ function Ra(e) {
570
+ const t = e + 1;
571
+ if (t <= 1) return "max-content";
572
+ const r = `minmax(${Pt.size[400]}, 1fr)`;
573
+ return Array(t).fill("max-content").join(` ${r} `);
574
+ }
575
+ function Na(e) {
576
+ return e * 2 + 1;
577
+ }
578
+ function ja({ item: e, gridRow: t }) {
579
+ const r = (a) => ({
580
+ style: { gridColumn: Na(a), gridRow: t },
581
+ className: ka
582
+ });
583
+ return /* @__PURE__ */ p(de, { children: [
584
+ /* @__PURE__ */ p("div", { ...r(0), children: [
585
+ e.eyebrow ? /* @__PURE__ */ o(m, { variant: "eyebrow", className: ce, children: e.eyebrow }) : null,
586
+ e.identifier && e.identifierHref ? /* @__PURE__ */ o(_, { href: e.identifierHref, target: "_blank", children: e.identifier }) : e.identifier ? /* @__PURE__ */ o(m, { variant: "body", size: "small", children: e.identifier }) : null
587
+ ] }),
588
+ e.fields.map((a, i) => /* @__PURE__ */ p("div", { ...r(i + 1), children: [
589
+ /* @__PURE__ */ o(m, { variant: "eyebrow", className: ce, children: a.label }),
590
+ /* @__PURE__ */ o(m, { variant: "body", size: "small", children: a.value })
591
+ ] }, a.label))
592
+ ] });
593
+ }
594
+ const Ta = ({
595
+ props: e
596
+ }) => /* @__PURE__ */ o("div", { className: ya, children: e.groups.map((t) => {
597
+ var a;
598
+ const r = ((a = t.items[0]) == null ? void 0 : a.fields.length) ?? 0;
599
+ return /* @__PURE__ */ p("div", { className: Ca, children: [
600
+ /* @__PURE__ */ o("div", { className: xa, children: /* @__PURE__ */ o(m, { variant: "headline", el: "h5", size: "small", children: t.label }) }),
601
+ /* @__PURE__ */ o(
602
+ "div",
603
+ {
604
+ className: wa,
605
+ style: { gridTemplateColumns: Ra(r) },
606
+ children: t.items.map((i, l) => {
607
+ const s = l * 2 + 1;
608
+ return /* @__PURE__ */ p(wt, { children: [
609
+ l > 0 ? /* @__PURE__ */ o("div", { className: Sa, style: { gridRow: l * 2 } }) : null,
610
+ /* @__PURE__ */ o(ja, { item: i, gridRow: s })
611
+ ] }, i.identifier ?? i.eyebrow ?? l);
612
+ })
613
+ }
614
+ )
615
+ ] }, t.label);
616
+ }) }), z = {
617
+ ContextPanel: ha,
618
+ ContextOverview: ca,
619
+ ContextCard: rn
620
+ }, k = {
621
+ ContextNoteList: ia,
622
+ ContextMetricGrid: qn,
623
+ ContextDataTable: un,
624
+ ContextList: An,
625
+ ContextTabularList: va,
626
+ ContextFileList: bn
627
+ }, G = {
628
+ "atlas.submitUserAction": {
629
+ params: n.object({
630
+ data: n.record(n.string(), n.unknown()).optional(),
631
+ actionId: n.string().optional()
632
+ }),
633
+ description: 'Submit form data. actionId overrides default "form_submit" identifier.'
634
+ },
635
+ "atlas.navigate": {
636
+ params: n.object({ url: n.string() }),
637
+ description: "Navigate to a URL or internal route. External URLs (http/https) open in a new tab; internal route strings navigate within the app."
638
+ },
639
+ "atlas.artifactToolCall": {
640
+ params: n.object({
641
+ tool: n.string(),
642
+ args: n.record(n.string(), n.unknown()).optional()
643
+ }),
644
+ description: "Invoke a tool on the active artifact panel app (an MCP-backed MFE). args is the tool argument payload; if omitted the current form state is sent."
645
+ }
646
+ }, La = {
647
+ "atlas.submitUserAction": async (e) => {
648
+ },
649
+ "atlas.navigate": async (e) => {
650
+ },
651
+ "atlas.artifactToolCall": async (e) => {
652
+ }
653
+ }, Se = {
654
+ props: n.object({
655
+ title: n.string(),
656
+ status: n.enum(["info", "success", "warning", "danger"]).optional(),
657
+ dismissible: n.boolean().optional(),
658
+ aiMark: n.boolean().optional()
659
+ }),
660
+ slots: ["default"],
661
+ events: ["close"],
662
+ description: `Inline notification banner with a required title. status: info (default) | success | warning | danger — danger for errors, warning for cautions, success for confirmations. Put the main message in the alert's children (rendered below the title). dismissible: true adds a close button that emits a "close" event.`
663
+ }, ke = {
664
+ props: n.object({
665
+ data: n.array(n.object({ category: n.string(), value: n.number() })),
666
+ orientation: n.enum(["vertical", "horizontal"]).optional(),
667
+ theme: n.enum(["monochrome", "categorical", "semantic"]).optional(),
668
+ height: n.number().optional(),
669
+ unit: n.string().optional()
670
+ }),
671
+ slots: [],
672
+ description: "Bar chart (vertical or horizontal) with Anvil2 theme. data: [{category, value}]. theme: monochrome (default, ≤4 vars), categorical (5-9 distinct), semantic (success/neutral/warning/danger order). unit: tooltip suffix."
673
+ }, Re = {
674
+ props: n.object({
675
+ label: n.string(),
676
+ appearance: n.enum(["primary", "secondary", "ghost", "danger"]).optional(),
677
+ size: n.enum(["xsmall", "small", "medium", "large"]).optional(),
678
+ loading: n.boolean().optional(),
679
+ disabled: n.boolean().optional(),
680
+ badge: n.string().optional()
681
+ }),
682
+ slots: [],
683
+ events: ["press"],
684
+ description: 'Clickable button. Emits a "press" event when clicked; inside a form the host treats press as a submit and uses the element key as the actionId, so no explicit on.press wiring is needed for form submits. appearance: primary | secondary (default) | ghost | danger (destructive actions like delete/cancel). size: xsmall | small | medium (default) | large. loading: true shows a spinner and blocks interaction. disabled: true prevents interaction. badge: optional notification count shown as a superscript (e.g. "3", "99+"); use an empty string for a dot-only indicator.'
685
+ }, Ne = {
686
+ props: n.object({
687
+ title: n.string().optional(),
688
+ description: n.string().optional(),
689
+ background: n.enum(["strong", "stronger"]).optional(),
690
+ padding: n.enum(["0", "xsmall", "small", "medium", "large"]).optional()
691
+ }),
692
+ slots: ["default"],
693
+ description: "White surface that groups a logical section of related content. title: optional headline rendered at the top of the card. description: optional subdued line below the title. Children render below the header and are stacked vertically with consistent spacing — you do not need to wrap them in a Flex. Prefer the built-in title/description over standalone Text children for the heading. background: strong | stronger for nested/elevated surfaces. padding: 0 | xsmall | small | medium (default) | large. Do not nest a Card inside another Card."
694
+ }, je = {
695
+ props: n.object({
696
+ label: n.string(),
697
+ checked: n.boolean().optional(),
698
+ disabled: n.boolean().optional()
699
+ }),
700
+ slots: [],
701
+ events: ["change"],
702
+ description: 'Checkbox for selecting zero or more independent options that are submitted with a form (one Checkbox per option). For a single on/off setting with immediate effect prefer Switch. Bind state with $bindState on checked; emits a "change" event when toggled. disabled: true prevents toggling.'
703
+ }, Te = {
704
+ props: n.object({
705
+ label: n.string(),
706
+ size: n.enum(["small", "medium"]).optional(),
707
+ color: n.string().optional(),
708
+ icon: n.enum(["check-circle", "in-progress", "radio-button-unchecked"]).optional(),
709
+ removable: n.boolean().optional()
710
+ }),
711
+ slots: [],
712
+ events: ["close"],
713
+ description: 'Inline label pill for metadata, tags, or categories — use for job statuses, not notification counts (use a Button/Link badge prop for those). size: small | medium (default). color: any CSS color. icon: optional leading status icon. removable: true adds a close button that emits a "close" event (ignored when size=small).'
714
+ }, Le = {
715
+ props: n.object({
716
+ vertical: n.boolean().optional(),
717
+ spacing: n.enum(["0", "half", "1", "2", "3", "4", "5", "6", "8", "12"]).optional(),
718
+ alignContent: n.enum(["start", "center", "end"]).optional()
719
+ }),
720
+ slots: [],
721
+ description: "Horizontal (default) or vertical rule that separates content sections. vertical: true for a vertical separator between side-by-side content. spacing (space around the divider, ~4px per step): 0 (default) | half | 1–6 | 8 | 12. alignContent: alignment of any divider content (start | center | end). Place between logical sections — not as a top/bottom border of a container."
722
+ }, _e = {
723
+ props: n.object({
724
+ data: n.array(n.object({ category: n.string(), value: n.number() })),
725
+ theme: n.enum(["monochrome", "categorical", "semantic"]).optional(),
726
+ showLegend: n.boolean().optional(),
727
+ height: n.number().optional(),
728
+ unit: n.string().optional()
729
+ }),
730
+ slots: [],
731
+ description: "Donut chart with optional legend and Anvil2 theme. data: [{category, value}]. theme: monochrome (≤4 vars), categorical (5-9 distinct), semantic (status values)."
732
+ }, ze = {
733
+ props: n.object({
734
+ direction: n.enum(["row", "column"]).optional(),
735
+ gap: n.enum(["0", "half", "1", "2", "3", "4", "5", "6", "8", "12"]).optional(),
736
+ alignItems: n.enum(["center", "flex-start", "flex-end", "stretch", "baseline"]).optional(),
737
+ justifyContent: n.enum(["center", "flex-start", "flex-end", "space-between", "space-around", "space-evenly"]).optional(),
738
+ alignSelf: n.enum(["auto", "center", "flex-start", "flex-end", "stretch", "baseline"]).optional(),
739
+ wrap: n.enum(["wrap", "nowrap", "wrap-reverse"]).optional(),
740
+ grow: n.number().optional(),
741
+ shrink: n.number().optional(),
742
+ basis: n.string().optional(),
743
+ inline: n.boolean().optional()
744
+ }),
745
+ slots: ["default"],
746
+ description: 'Flex layout container. direction: row (default) | column — always set column when stacking children vertically. gap (spacing token, ~4px per step): half=2px 1=4px 2=8px 3=12px 4=16px 5=20px 6=24px 8=32px 12=48px. alignItems: cross-axis alignment of children. justifyContent: main-axis distribution. When this Flex is itself a child of another Flex, use grow (1=fill available space), shrink, basis (CSS flex-basis e.g. "200px"), and alignSelf to control how it flexes.'
747
+ }, Ee = {
748
+ props: n.object({
749
+ templateColumns: n.string().optional(),
750
+ gap: n.enum(["0", "half", "1", "2", "3", "4", "5", "6", "8", "12"]).optional(),
751
+ bordered: n.boolean().optional()
752
+ }),
753
+ slots: ["default"],
754
+ description: 'CSS Grid layout. templateColumns: CSS grid-template-columns value — "repeat(3, 1fr)" for equal columns, "200px 1fr" for fixed+flex two-column (e.g. key-value tables), "1fr 1fr 80px" for multi-column tables. Children flow into grid cells left-to-right, top-to-bottom. gap (spacing token, ~4px per step): 1=4px 2=8px … 6=24px 8=32px 12=48px (default 2). bordered: true renders a bordered table with row separators and cell padding — use for key-value and data tables.'
755
+ }, _a = n.discriminatedUnion("type", [
756
+ n.object({
757
+ type: n.literal("text"),
758
+ value: n.string()
759
+ }),
760
+ n.object({
761
+ type: n.literal("diff"),
762
+ from: n.string().nullable().optional(),
763
+ to: n.string().nullable().optional()
764
+ }),
765
+ n.object({
766
+ type: n.literal("addition"),
767
+ value: n.string()
768
+ })
769
+ ]), za = n.union([n.string(), _a]), Ea = n.object({
770
+ key: n.string(),
771
+ header: n.string(),
772
+ minWidth: n.enum(["compact", "standard", "wide"]).optional()
773
+ }), Oa = n.record(n.string(), za).and(n.object({ id: n.string() })), Pa = n.object({
774
+ label: n.string(),
775
+ columns: n.array(Ea),
776
+ data: n.array(Oa),
777
+ reason: n.string().optional()
778
+ }), Ia = n.object({
779
+ id: n.string(),
780
+ label: n.string(),
781
+ from: n.string().nullable().optional(),
782
+ to: n.string().nullable().optional(),
783
+ reason: n.string().optional()
784
+ }), Aa = n.object({
785
+ type: n.literal("single"),
786
+ changes: n.array(Ia)
787
+ }), $a = n.object({
788
+ type: n.literal("table"),
789
+ label: n.string(),
790
+ changeTables: n.array(Pa)
791
+ }), Fa = n.discriminatedUnion("type", [Aa, $a]), Oe = {
792
+ props: n.object({
793
+ state: n.enum(["default", "accepted", "rejected", "skipped"]).optional(),
794
+ referenceLabel: n.string(),
795
+ referenceHref: n.string().optional(),
796
+ changeSections: n.array(Fa),
797
+ appliedChangeIds: n.array(n.string()).optional(),
798
+ defaultExpanded: n.boolean().optional()
799
+ }),
800
+ slots: [],
801
+ events: ["apply", "edit", "dismiss"],
802
+ description: "Suggested-change review card for Atlas agent chat. Use in the default state while the user can accept, edit, or dismiss AI-proposed updates to an estimate/invoice. state: default (selectable diffs + actions) | accepted (collapsible accepted summary) | rejected | skipped (collapsible read-only summaries). Bind state and appliedChangeIds with $bindState so apply/reject can update lifecycle state locally. Checkbox selection is managed internally and defaults to all single-change and table-row ids selected. changeSections[] defines ordered body content: type single (changes[] with label/from/to/reason) or type table (label + changeTables[] with editable labels, columns[{ key, header, minWidth? }], data, optional reason). Each data row requires a top-level id for selection/filtering — do NOT add an id column; use keys like code, sku, or name for visible identifiers. Column minWidth presets: compact (codes/SKUs/quantities) | standard (names/dates) | wide (descriptions/diffs) — omit when flexible. Table cell rendering is defined per cell via plain string or { type: text | diff | addition, ... }. appliedChangeIds filters accepted-state content. referenceHref opens the linked record in a new tab. Emits apply, edit, and dismiss."
803
+ }, Pe = {
804
+ props: n.object({
805
+ name: n.enum(["check-circle", "in-progress", "radio-button-unchecked"]),
806
+ size: n.enum(["small", "medium", "large", "xlarge"]).optional(),
807
+ color: n.string().optional()
808
+ }),
809
+ slots: [],
810
+ description: "Small status icon. name (only these three are available): check-circle=completed/success checkmark, in-progress=partial circle (active/working), radio-button-unchecked=empty circle (pending/not started). size: small | medium (default) | large | xlarge. color: any CSS color (defaults to the current text color). Commonly paired with status Text in lists and checklists."
811
+ }, Ie = {
812
+ props: n.object({
813
+ label: n.string(),
814
+ placeholder: n.string().optional(),
815
+ type: n.enum(["text", "password", "email", "tel", "url", "number"]).optional(),
816
+ value: n.string().optional(),
817
+ disabled: n.boolean().optional()
818
+ }),
819
+ slots: [],
820
+ events: ["change"],
821
+ description: 'Free-text input field for user-typed values (names, notes, numbers, etc). type: text (default), password (masked), email, tel (phone), url, number. Bind value with $bindState so the typed value is captured in state; emits a "change" event on every keystroke. Prefer this over Listbox when the value is not from a fixed list. disabled: true prevents editing.'
822
+ }, Ae = {
823
+ props: n.object({
824
+ data: n.array(n.record(n.string(), n.union([n.string(), n.number()]))),
825
+ series: n.array(n.string()).optional(),
826
+ theme: n.enum(["monochrome", "categorical", "semantic"]).optional(),
827
+ showLegend: n.boolean().optional(),
828
+ showDots: n.boolean().optional(),
829
+ height: n.number().optional(),
830
+ unit: n.string().optional()
831
+ }),
832
+ slots: [],
833
+ description: 'Line chart for tracking trends over time with optional multiple series. data: array of objects with a "category" key (x-axis label) and one numeric key per series (e.g. [{category: "Jan", revenue: 100, cost: 60}]). series: explicit list of series keys to plot (inferred from data keys if omitted, max 6). theme: monochrome (1-2 series), categorical (3-6 distinct). showLegend: true when multiple series (default true for 2+ series). showDots: true adds data-point markers (default true). unit: tooltip value suffix.'
834
+ }, $e = {
835
+ props: n.object({
836
+ label: n.string(),
837
+ href: n.string(),
838
+ appearance: n.enum(["primary", "secondary"]).optional(),
839
+ target: n.enum(["_blank", "_self"]).optional(),
840
+ ghost: n.boolean().optional(),
841
+ badge: n.string().optional()
842
+ }),
843
+ slots: [],
844
+ events: ["press"],
845
+ description: 'Inline navigation link (renders an <a>). Emits a "press" event when clicked — handle navigation in on.press; href and target are inputs for the host/router rather than native browser navigation. href: destination URL for the host/router. appearance: primary (default) | secondary. target: _blank marks the link as external (shows external-link icon) and lets the host open a new tab if desired. ghost: quieter styling (primary only). badge: optional notification count shown as a superscript (e.g. "5"); use an empty string for a dot-only indicator.'
846
+ }, Fe = {
847
+ props: n.object({
848
+ label: n.string(),
849
+ options: n.array(n.object({ value: n.string(), label: n.string() })),
850
+ value: n.string().optional(),
851
+ disabled: n.boolean().optional()
852
+ }),
853
+ slots: [],
854
+ events: ["change"],
855
+ description: 'Single-select dropdown for choosing one value from a fixed list of known options. options: [{ value, label }] — value is stored in state, label is shown. Bind the selection with $bindState on value; emits a "change" event on selection. Use only when options are predefined; for free-text user input use Input, and for 2–7 visible mutually-exclusive choices prefer RadioGroup. disabled: true prevents selection.'
856
+ }, De = {
857
+ props: n.object({
858
+ label: n.string(),
859
+ value: n.number().min(0).max(100).optional(),
860
+ description: n.string().optional(),
861
+ indeterminate: n.boolean().optional()
862
+ }),
863
+ slots: [],
864
+ description: "Horizontal progress bar showing task completion. label is required (the accessible name for the bar). value: 0–100 percentage filled. Omit value and set indeterminate=true when progress cannot be measured (do not set both). description: optional helper text shown below the bar."
865
+ }, Be = {
866
+ props: n.object({
867
+ label: n.string(),
868
+ options: n.array(n.object({ value: n.string(), label: n.string() })),
869
+ value: n.string().optional(),
870
+ disabled: n.boolean().optional()
871
+ }),
872
+ slots: [],
873
+ events: ["change"],
874
+ description: 'Group of radio buttons for picking one option from 2–7 visible mutually-exclusive choices. options: [{ value, label }]. Bind the selection with $bindState on value; emits a "change" event on selection. For longer option lists use Listbox. disabled: true prevents selection.'
875
+ }, Me = {
876
+ props: n.object({
877
+ label: n.string(),
878
+ checked: n.boolean().optional(),
879
+ disabled: n.boolean().optional()
880
+ }),
881
+ slots: [],
882
+ events: ["change"],
883
+ description: 'Toggle switch for a single binary on/off setting with immediate effect (no form submit). Prefer over Checkbox for enabling/disabling features. Bind state with $bindState on checked; emits a "change" event when toggled. disabled: true prevents toggling.'
884
+ }, Ge = {
885
+ props: n.object({
886
+ content: n.string(),
887
+ variant: n.enum(["headline", "body", "eyebrow"]).optional(),
888
+ size: n.enum(["small", "medium", "large", "xlarge"]).optional(),
889
+ subdued: n.boolean().optional()
890
+ }),
891
+ slots: [],
892
+ description: "Display text. variant: headline=bold title, eyebrow=small uppercase label, body=default (default variant). size: small | medium (default) | large | xlarge — applies to headline and body only (ignored for eyebrow). subdued: deemphasized secondary text (body only). Use eyebrow+headline pairs for KPI/stat labels above values."
893
+ }, Ve = {
894
+ props: n.object({
895
+ label: n.string(),
896
+ placeholder: n.string().optional(),
897
+ description: n.string().optional(),
898
+ moreInfo: n.string().optional(),
899
+ value: n.string().optional(),
900
+ rows: n.number().optional(),
901
+ disabled: n.boolean().optional()
902
+ }),
903
+ slots: [],
904
+ events: ["change"],
905
+ description: 'Multi-line free-text input for long values (notes, descriptions, email body). Bind value with $bindState; emits a "change" event on every keystroke. rows: visible row count (default 3). description: helper text below the field. moreInfo: tooltip text on the label. disabled: true prevents editing.'
906
+ }, H = {
907
+ Text: Ge,
908
+ Card: Ne,
909
+ Flex: ze,
910
+ Grid: Ee,
911
+ Alert: Se,
912
+ Divider: Le,
913
+ Icon: Pe,
914
+ Chip: Te,
915
+ Link: $e,
916
+ ProgressBar: De,
917
+ BarChart: ke,
918
+ DonutChart: _e,
919
+ LineChart: Ae,
920
+ Button: Re,
921
+ Checkbox: je,
922
+ Input: Ie,
923
+ Textarea: Ve,
924
+ Listbox: Fe,
925
+ RadioGroup: Be,
926
+ Switch: Me,
927
+ GuidanceCard: Oe
928
+ };
929
+ function We(e = {}) {
930
+ const { core: t = "all", overrides: r = {}, components: a = {} } = e, l = { ...t === "all" ? { ...H } : Object.fromEntries(
931
+ t.map((s) => {
932
+ const d = H[s];
933
+ if (!d)
934
+ throw new Error(`Unknown core component: ${String(s)}`);
935
+ return [s, d];
936
+ })
937
+ ), ...a };
938
+ for (const [s, d] of Object.entries(r)) {
939
+ const c = l[s];
940
+ if (!c || !d)
941
+ continue;
942
+ const u = d.description ?? (d.append ? `${c.description} ${d.append}` : c.description);
943
+ l[s] = { ...c, description: u };
944
+ }
945
+ return l;
946
+ }
947
+ function yo(e) {
948
+ return e;
949
+ }
950
+ function Co(e) {
951
+ const t = We({
952
+ core: e.core ?? "all",
953
+ ...e.overrides ? { overrides: e.overrides } : {},
954
+ ...e.components ? { components: e.components } : {}
955
+ }), r = Object.fromEntries(
956
+ Object.entries(e.actions ?? {}).map(([l, s]) => [
957
+ `${e.prefix}.${l}`,
958
+ s
959
+ ])
960
+ ), a = {
961
+ ...G,
962
+ ...r
963
+ }, i = D(B, {
964
+ components: t,
965
+ actions: a
966
+ });
967
+ return {
968
+ prefix: e.prefix,
969
+ catalog: i,
970
+ prompt(l) {
971
+ const s = [i.prompt(), `
972
+ `, l];
973
+ return e.rules && s.push(`
974
+ `, e.rules), s.join("");
975
+ },
976
+ jsonSchema() {
977
+ return i.jsonSchema();
978
+ }
979
+ };
980
+ }
981
+ const Da = ["Text", "Chip", "Link", "Alert"], Ba = {
982
+ Link: {
983
+ append: "In a context panel, links appear inside content primitives (ContextList, ContextTabularList identifier links, ContextNoteList, etc.); use a standalone Link only for inline references within rich text."
984
+ }
985
+ }, Ue = We({
986
+ core: Da,
987
+ overrides: Ba,
988
+ components: { ...z, ...k }
989
+ }), Ma = D(B, {
990
+ components: Ue,
991
+ actions: G
992
+ }), Y = [
993
+ {
994
+ name: "ContextPanel",
995
+ catalog: z.ContextPanel,
996
+ renderer: pa,
997
+ renderers: ["context"]
998
+ },
999
+ {
1000
+ name: "ContextOverview",
1001
+ catalog: z.ContextOverview,
1002
+ renderer: ma,
1003
+ renderers: ["context"]
1004
+ },
1005
+ {
1006
+ name: "ContextCard",
1007
+ catalog: z.ContextCard,
1008
+ renderer: on,
1009
+ renderers: ["context"]
1010
+ },
1011
+ {
1012
+ name: "ContextNoteList",
1013
+ catalog: k.ContextNoteList,
1014
+ renderer: sa,
1015
+ renderers: ["context"]
1016
+ },
1017
+ {
1018
+ name: "ContextMetricGrid",
1019
+ catalog: k.ContextMetricGrid,
1020
+ renderer: Jn,
1021
+ renderers: ["context"]
1022
+ },
1023
+ {
1024
+ name: "ContextDataTable",
1025
+ catalog: k.ContextDataTable,
1026
+ renderer: fn,
1027
+ renderers: ["context"]
1028
+ },
1029
+ {
1030
+ name: "ContextList",
1031
+ catalog: k.ContextList,
1032
+ renderer: Un,
1033
+ renderers: ["context"]
1034
+ },
1035
+ {
1036
+ name: "ContextTabularList",
1037
+ catalog: k.ContextTabularList,
1038
+ renderer: Ta,
1039
+ renderers: ["context"]
1040
+ },
1041
+ {
1042
+ name: "ContextFileList",
1043
+ catalog: k.ContextFileList,
1044
+ renderer: Pn,
1045
+ renderers: ["context"]
1046
+ }
1047
+ ];
1048
+ Object.fromEntries(
1049
+ Y.filter(({ name: e }) => e in z).map(({ name: e, renderer: t }) => [e, t])
1050
+ );
1051
+ Object.fromEntries(
1052
+ Y.filter(({ name: e }) => e in k).map(({ name: e, renderer: t }) => [e, t])
1053
+ );
1054
+ const Ga = ["ContextPanel", "ContextOverview", "ContextCard"], Va = ["ContextOverview", "ContextCard"];
1055
+ function Wa(e) {
1056
+ return Ga.includes(e);
1057
+ }
1058
+ function Ua(e) {
1059
+ return Va.includes(e);
1060
+ }
1061
+ function I(e, t) {
1062
+ return e.elements[t];
1063
+ }
1064
+ function He(e, t, r = /* @__PURE__ */ new Set()) {
1065
+ const a = I(e, t);
1066
+ if (!a || r.has(t))
1067
+ return r;
1068
+ r.add(t);
1069
+ for (const i of a.children ?? [])
1070
+ He(e, i, r);
1071
+ return r;
1072
+ }
1073
+ function qe(e) {
1074
+ const t = [], r = e.root, a = I(e, r);
1075
+ if (!a)
1076
+ return t.push({ path: "/root", message: "Root element is missing from elements map." }), t;
1077
+ if (a.type !== "ContextPanel")
1078
+ return t.push({
1079
+ path: `/elements/${r}`,
1080
+ message: `Root must be ContextPanel, got "${a.type}".`
1081
+ }), t;
1082
+ let i = 0;
1083
+ for (const l of a.children ?? []) {
1084
+ const s = I(e, l);
1085
+ if (!s) {
1086
+ t.push({
1087
+ path: `/elements/${l}`,
1088
+ message: `Child "${l}" referenced by ContextPanel is missing.`
1089
+ });
1090
+ continue;
1091
+ }
1092
+ if (!Ua(s.type)) {
1093
+ t.push({
1094
+ path: `/elements/${l}`,
1095
+ message: `Direct child of ContextPanel must be ContextOverview or ContextCard — got "${s.type}".`
1096
+ });
1097
+ continue;
1098
+ }
1099
+ s.type === "ContextOverview" && (i += 1, i > 1 && t.push({
1100
+ path: `/elements/${l}`,
1101
+ message: "ContextOverview may appear at most once in ContextPanel."
1102
+ }));
1103
+ for (const d of He(e, l)) {
1104
+ if (d === l)
1105
+ continue;
1106
+ const c = I(e, d);
1107
+ c && Wa(c.type) && t.push({
1108
+ path: `/elements/${d}`,
1109
+ message: `Shell component "${c.type}" cannot be nested inside a card.`
1110
+ });
1111
+ }
1112
+ }
1113
+ return t;
1114
+ }
1115
+ function Xe(e) {
1116
+ return e.map((t) => `${(t.severity ?? "error").toUpperCase()} ${t.path}: ${t.message}`).join(`
1117
+ `);
1118
+ }
1119
+ function S(e, t, r, a) {
1120
+ e.push({ path: t, message: r, severity: a });
1121
+ }
1122
+ function Ha(e, t) {
1123
+ if (t.length === 0)
1124
+ return e;
1125
+ const r = t.map((a) => typeof a == "number" ? `[${a}]` : `.${String(a)}`).join("").replace(/^\./, "");
1126
+ return `${e}/${r}`;
1127
+ }
1128
+ function Ye(e) {
1129
+ return Ue[e];
1130
+ }
1131
+ function Ke(e) {
1132
+ var t;
1133
+ return (((t = e == null ? void 0 : e.slots) == null ? void 0 : t.length) ?? 0) === 0;
1134
+ }
1135
+ function qa(e, t) {
1136
+ for (const [r, a] of Object.entries(e.elements))
1137
+ a && a.type === "ContextCard" && a.props.defaultExpanded === !1 && S(
1138
+ t,
1139
+ `/elements/${r}/props/defaultExpanded`,
1140
+ "defaultExpanded: false shows only the card header until the user expands the card.",
1141
+ "warn"
1142
+ );
1143
+ }
1144
+ function Xa(e) {
1145
+ const t = [];
1146
+ for (const i of qe(e))
1147
+ S(t, i.path, i.message, "error");
1148
+ const r = rt(e);
1149
+ if (!r.valid)
1150
+ for (const i of r.issues) {
1151
+ const l = i.elementKey ? `/elements/${i.elementKey}` : "/";
1152
+ S(t, l, i.message, i.severity === "warning" ? "warn" : "error");
1153
+ }
1154
+ const a = Ma.validate(e);
1155
+ if (!a.success && a.error)
1156
+ for (const i of a.error.issues) {
1157
+ const l = i.path.length > 0 ? `/${i.path.join("/")}` : "/";
1158
+ l.endsWith("/visible") || l.endsWith("/children") && i.message.includes("expected array, received undefined") || S(t, l, i.message, "error");
1159
+ }
1160
+ for (const [i, l] of Object.entries(e.elements)) {
1161
+ if (!l)
1162
+ continue;
1163
+ const s = Ye(l.type);
1164
+ if (!s) {
1165
+ S(
1166
+ t,
1167
+ `/elements/${i}`,
1168
+ `Unknown component type "${l.type}" for context catalog.`,
1169
+ "error"
1170
+ );
1171
+ continue;
1172
+ }
1173
+ if (s.props) {
1174
+ const u = s.props.safeParse(l.props ?? {});
1175
+ if (!u.success)
1176
+ for (const h of u.error.issues)
1177
+ S(
1178
+ t,
1179
+ Ha(`/elements/${i}/props`, h.path),
1180
+ h.message,
1181
+ "error"
1182
+ );
1183
+ }
1184
+ const d = l.children, c = Ke(s);
1185
+ d === void 0 && c && S(
1186
+ t,
1187
+ `/elements/${i}/children`,
1188
+ `Leaf element "${l.type}" should include "children": [].`,
1189
+ "warn"
1190
+ ), c && ((d == null ? void 0 : d.length) ?? 0) > 0 && S(
1191
+ t,
1192
+ `/elements/${i}/children`,
1193
+ `Leaf component "${l.type}" must not have children.`,
1194
+ "error"
1195
+ );
1196
+ }
1197
+ return qa(e, t), t;
1198
+ }
1199
+ function xo(e) {
1200
+ const t = [], r = structuredClone(e);
1201
+ for (const [a, i] of Object.entries(r.elements)) {
1202
+ if (!i)
1203
+ continue;
1204
+ const l = Ye(i.type), s = Ke(l);
1205
+ i.children === void 0 && s && (i.children = [], t.push(`Added children: [] to leaf element "${a}".`)), s && i.children && i.children.length > 0 && (i.children = [], t.push(`Removed illegal children from leaf element "${a}".`));
1206
+ }
1207
+ return { spec: r, fixes: t };
1208
+ }
1209
+ function wo(e) {
1210
+ return e.some((t) => t.severity !== "warn");
1211
+ }
1212
+ function So(e) {
1213
+ const t = Xa(e);
1214
+ return Xe(t);
1215
+ }
1216
+ const Ya = ({
1217
+ props: e,
1218
+ emit: t,
1219
+ children: r
1220
+ }) => /* @__PURE__ */ o(
1221
+ me,
1222
+ {
1223
+ title: e.title,
1224
+ status: e.status ?? "info",
1225
+ ...e.aiMark ? { aiMark: !0 } : {},
1226
+ ...e.dismissible ? { onClose: () => t("close") } : {},
1227
+ children: r
1228
+ }
1229
+ );
1230
+ var K = "zf6dad0";
1231
+ function J(e, t = "monochrome") {
1232
+ const a = {
1233
+ monochrome: ne,
1234
+ categorical: $t,
1235
+ semantic: At
1236
+ }[t] ?? ne;
1237
+ e.setThemes([It.new(e), a.new(e)]);
1238
+ }
1239
+ const Ka = ({ props: e }) => {
1240
+ const t = R(null);
1241
+ return X(() => {
1242
+ const r = t.current;
1243
+ if (!r)
1244
+ return;
1245
+ let a;
1246
+ const i = () => {
1247
+ a && a.dispose(), a = y.Root.new(r), J(a, e.theme);
1248
+ const s = a.container.children.push(b.XYChart.new(a, { paddingLeft: 0 }));
1249
+ if (e.orientation === "horizontal") {
1250
+ const d = s.yAxes.push(
1251
+ b.CategoryAxis.new(a, {
1252
+ categoryField: "category",
1253
+ renderer: b.AxisRendererY.new(a, { minGridDistance: 20 })
1254
+ })
1255
+ ), c = s.xAxes.push(
1256
+ b.ValueAxis.new(a, {
1257
+ renderer: b.AxisRendererX.new(a, {})
1258
+ })
1259
+ ), u = s.series.push(
1260
+ b.ColumnSeries.new(a, {
1261
+ xAxis: c,
1262
+ yAxis: d,
1263
+ valueXField: "value",
1264
+ categoryYField: "category"
1265
+ })
1266
+ );
1267
+ u.columns.template.setAll({
1268
+ tooltipText: `{categoryY}: ${e.unit ?? ""}{valueX}`
1269
+ }), d.data.setAll(e.data), u.data.setAll(e.data);
1270
+ } else {
1271
+ const d = s.xAxes.push(
1272
+ b.CategoryAxis.new(a, {
1273
+ categoryField: "category",
1274
+ renderer: b.AxisRendererX.new(a, { minGridDistance: 30 })
1275
+ })
1276
+ ), c = s.yAxes.push(
1277
+ b.ValueAxis.new(a, {
1278
+ renderer: b.AxisRendererY.new(a, {})
1279
+ })
1280
+ ), u = s.series.push(
1281
+ b.ColumnSeries.new(a, {
1282
+ xAxis: d,
1283
+ yAxis: c,
1284
+ valueYField: "value",
1285
+ categoryXField: "category"
1286
+ })
1287
+ );
1288
+ u.columns.template.setAll({
1289
+ tooltipText: `{categoryX}: ${e.unit ?? ""}{valueY}`
1290
+ }), d.data.setAll(e.data), u.data.setAll(e.data);
1291
+ }
1292
+ }, l = new ResizeObserver((s) => {
1293
+ var c;
1294
+ (((c = s[0]) == null ? void 0 : c.contentRect.width) ?? 0) > 0 && !a && i();
1295
+ });
1296
+ return l.observe(r), r.offsetWidth > 0 && i(), () => {
1297
+ l.disconnect(), a == null || a.dispose();
1298
+ };
1299
+ }, []), /* @__PURE__ */ o("div", { ref: t, className: K, style: { height: e.height ?? 300 } });
1300
+ };
1301
+ function C(e) {
1302
+ const t = {};
1303
+ for (const r of Object.keys(e)) {
1304
+ const a = e[r];
1305
+ a !== void 0 && (t[r] = a);
1306
+ }
1307
+ return t;
1308
+ }
1309
+ const Ja = ({
1310
+ props: e,
1311
+ emit: t
1312
+ }) => /* @__PURE__ */ p(
1313
+ ue,
1314
+ {
1315
+ appearance: e.appearance ?? "secondary",
1316
+ ...C({
1317
+ size: e.size,
1318
+ loading: e.loading,
1319
+ disabled: e.disabled
1320
+ }),
1321
+ onClick: () => t("press"),
1322
+ children: [
1323
+ e.label,
1324
+ e.badge !== void 0 ? /* @__PURE__ */ o(he, { "aria-label": e.badge ? `${e.badge} unread` : "unread", children: e.badge }) : null
1325
+ ]
1326
+ }
1327
+ ), Za = ({
1328
+ props: e,
1329
+ children: t
1330
+ }) => {
1331
+ const r = e.title !== void 0 || e.description !== void 0;
1332
+ return /* @__PURE__ */ p(
1333
+ O,
1334
+ {
1335
+ flexDirection: "column",
1336
+ gap: "3",
1337
+ ...C({ background: e.background, padding: e.padding }),
1338
+ children: [
1339
+ r ? /* @__PURE__ */ p($, { direction: "column", gap: "half", children: [
1340
+ e.title !== void 0 ? /* @__PURE__ */ o(m, { variant: "headline", el: "h3", size: "small", children: e.title }) : null,
1341
+ e.description !== void 0 ? /* @__PURE__ */ o(m, { variant: "body", subdued: !0, children: e.description }) : null
1342
+ ] }) : null,
1343
+ t
1344
+ ]
1345
+ }
1346
+ );
1347
+ }, ko = D(B, {
1348
+ components: H,
1349
+ actions: G
1350
+ }), Qa = ({
1351
+ props: e,
1352
+ bindings: t,
1353
+ emit: r
1354
+ }) => {
1355
+ const a = t == null ? void 0 : t.checked, { state: i, set: l } = N(), s = a ? j(i, a) : void 0, d = a ? s ?? e.checked ?? !1 : e.checked ?? !1;
1356
+ return /* @__PURE__ */ o(
1357
+ mt,
1358
+ {
1359
+ label: e.label,
1360
+ checked: d,
1361
+ ...C({ disabled: e.disabled }),
1362
+ onClick: (c, u) => {
1363
+ a && l(a, !((u == null ? void 0 : u.checked) ?? !1)), r("change");
1364
+ }
1365
+ }
1366
+ );
1367
+ }, er = {
1368
+ "check-circle": fe,
1369
+ "in-progress": be,
1370
+ "radio-button-unchecked": ge
1371
+ }, tr = ({
1372
+ props: e,
1373
+ emit: t
1374
+ }) => {
1375
+ const r = e.icon ? er[e.icon] : void 0, a = e.removable && e.size !== "small" ? () => t("close") : void 0;
1376
+ return /* @__PURE__ */ o(
1377
+ A,
1378
+ {
1379
+ label: e.label,
1380
+ ...C({ size: e.size, color: e.color, icon: r, onClose: a })
1381
+ }
1382
+ );
1383
+ }, nr = ({ props: e }) => /* @__PURE__ */ o(
1384
+ ht,
1385
+ {
1386
+ ...C({
1387
+ vertical: e.vertical,
1388
+ spacing: e.spacing,
1389
+ alignContent: e.alignContent
1390
+ })
1391
+ }
1392
+ ), ar = ({
1393
+ props: e
1394
+ }) => {
1395
+ const t = R(null);
1396
+ return X(() => {
1397
+ const r = t.current;
1398
+ if (!r)
1399
+ return;
1400
+ let a;
1401
+ const i = () => {
1402
+ a && a.dispose(), a = y.Root.new(r), J(a, e.theme);
1403
+ const s = a.container.children.push(
1404
+ ae.PieChart.new(a, {
1405
+ layout: a.horizontalLayout,
1406
+ innerRadius: y.percent(50)
1407
+ })
1408
+ ), d = s.series.push(
1409
+ ae.PieSeries.new(a, {
1410
+ valueField: "value",
1411
+ categoryField: "category",
1412
+ legendValueText: ""
1413
+ })
1414
+ );
1415
+ d.labels.template.set("text", "{valuePercentTotal.formatNumber('#.')}%"), d.data.setAll(e.data), (e.showLegend ?? !0) && s.children.push(
1416
+ y.Legend.new(a, {
1417
+ centerY: y.percent(50),
1418
+ y: y.percent(50),
1419
+ layout: a.verticalLayout
1420
+ })
1421
+ ).data.setAll(d.dataItems);
1422
+ }, l = new ResizeObserver((s) => {
1423
+ var c;
1424
+ (((c = s[0]) == null ? void 0 : c.contentRect.width) ?? 0) > 0 && !a && i();
1425
+ });
1426
+ return l.observe(r), r.offsetWidth > 0 && i(), () => {
1427
+ l.disconnect(), a == null || a.dispose();
1428
+ };
1429
+ }, []), /* @__PURE__ */ o("div", { ref: t, className: K, style: { height: e.height ?? 300 } });
1430
+ }, rr = ({
1431
+ props: e,
1432
+ children: t
1433
+ }) => /* @__PURE__ */ o(
1434
+ $,
1435
+ {
1436
+ ...C({
1437
+ direction: e.direction,
1438
+ gap: e.gap,
1439
+ alignItems: e.alignItems,
1440
+ justifyContent: e.justifyContent,
1441
+ alignSelf: e.alignSelf,
1442
+ wrap: e.wrap,
1443
+ grow: e.grow,
1444
+ shrink: e.shrink,
1445
+ basis: e.basis,
1446
+ inline: e.inline
1447
+ }),
1448
+ children: t
1449
+ }
1450
+ );
1451
+ function or(...e) {
1452
+ return e.filter(Boolean).join(" ");
1453
+ }
1454
+ var ir = "_1v76lkh0", lr = "_1v76lkh1", sr = "_1v76lkh2";
1455
+ function cr(e) {
1456
+ const t = e.match(/repeat\(\s*(\d+)/);
1457
+ return t != null && t[1] ? Number(t[1]) : e.trim().split(/\s+/).length;
1458
+ }
1459
+ const dr = ({
1460
+ props: e,
1461
+ children: t
1462
+ }) => {
1463
+ if (e.bordered) {
1464
+ const r = e.templateColumns ?? "1fr", a = U.count(t), i = Math.max(1, cr(r)), l = Math.max(0, a - (a % i || i));
1465
+ return /* @__PURE__ */ o("div", { className: ir, style: { gridTemplateColumns: r }, children: U.map(t, (s, d) => /* @__PURE__ */ o(
1466
+ "div",
1467
+ {
1468
+ className: or(lr, d < l && sr),
1469
+ children: s
1470
+ }
1471
+ )) });
1472
+ }
1473
+ return /* @__PURE__ */ o(pt, { templateColumns: e.templateColumns, gap: e.gap ?? "2", children: t });
1474
+ }, ur = {
1475
+ /** Short codes, SKUs, quantities, unit prices, status values. */
1476
+ compact: 120,
1477
+ /** Names, categories, dates, single-line labels. */
1478
+ standard: 180,
1479
+ /** Descriptions, notes, scope text, diff/addition cells. */
1480
+ wide: 280
1481
+ };
1482
+ function mr(e) {
1483
+ if (e != null)
1484
+ return ur[e];
1485
+ }
1486
+ function hr(e) {
1487
+ const t = {
1488
+ key: e.key,
1489
+ header: e.header
1490
+ };
1491
+ return e.minWidth !== void 0 && (t.minWidth = mr(e.minWidth)), t;
1492
+ }
1493
+ const pr = ({
1494
+ props: e,
1495
+ emit: t,
1496
+ bindings: r
1497
+ }) => {
1498
+ const { set: a } = N(), i = r == null ? void 0 : r.appliedChangeIds, l = (d) => {
1499
+ i && a(i, d);
1500
+ }, s = e.changeSections.map((d) => d.type === "single" ? {
1501
+ type: "single",
1502
+ changes: d.changes.map((c) => ({
1503
+ id: c.id,
1504
+ label: c.label,
1505
+ ...c.from !== void 0 ? { from: c.from } : {},
1506
+ ...c.to !== void 0 ? { to: c.to } : {},
1507
+ ...c.reason !== void 0 ? { reason: c.reason } : {}
1508
+ }))
1509
+ } : {
1510
+ type: "table",
1511
+ label: d.label,
1512
+ changeTables: d.changeTables.map((c) => ({
1513
+ label: c.label,
1514
+ columns: c.columns.map(hr),
1515
+ data: c.data,
1516
+ ...c.reason !== void 0 ? { reason: c.reason } : {}
1517
+ }))
1518
+ });
1519
+ return /* @__PURE__ */ o(
1520
+ Ft,
1521
+ {
1522
+ referenceLabel: e.referenceLabel,
1523
+ changeSections: s,
1524
+ ...C({
1525
+ state: e.state,
1526
+ referenceHref: e.referenceHref,
1527
+ appliedChangeIds: e.appliedChangeIds,
1528
+ defaultExpanded: e.defaultExpanded
1529
+ }),
1530
+ onApply: (d) => {
1531
+ l(d), t("apply");
1532
+ },
1533
+ onEdit: (d) => {
1534
+ l(d), t("edit");
1535
+ },
1536
+ onDismiss: () => t("dismiss")
1537
+ }
1538
+ );
1539
+ }, fr = {
1540
+ "check-circle": fe,
1541
+ "in-progress": be,
1542
+ "radio-button-unchecked": ge
1543
+ }, gr = ({ props: e }) => {
1544
+ const t = fr[e.name];
1545
+ return t ? /* @__PURE__ */ o(q, { svg: t, ...C({ size: e.size, color: e.color }) }) : null;
1546
+ }, br = ({
1547
+ props: e,
1548
+ bindings: t,
1549
+ emit: r
1550
+ }) => {
1551
+ const a = t == null ? void 0 : t.value, { state: i, set: l } = N(), s = a ? j(i, a) : void 0, d = a ? s ?? e.value ?? "" : e.value ?? "";
1552
+ return /* @__PURE__ */ o(
1553
+ ft,
1554
+ {
1555
+ label: e.label,
1556
+ type: e.type ?? "text",
1557
+ value: d,
1558
+ ...C({ placeholder: e.placeholder, disabled: e.disabled }),
1559
+ onChange: (c) => {
1560
+ a && l(a, c.target.value), r("change");
1561
+ }
1562
+ }
1563
+ );
1564
+ }, vr = ({ props: e }) => {
1565
+ const t = R(null);
1566
+ return X(() => {
1567
+ const r = t.current;
1568
+ if (!r)
1569
+ return;
1570
+ let a;
1571
+ const i = () => {
1572
+ a && a.dispose(), a = y.Root.new(r), J(a, e.theme);
1573
+ const s = a.container.children.push(b.XYChart.new(a, { paddingLeft: 0 })), d = s.xAxes.push(
1574
+ b.CategoryAxis.new(a, {
1575
+ categoryField: "category",
1576
+ renderer: b.AxisRendererX.new(a, { minGridDistance: 30 })
1577
+ })
1578
+ ), c = s.yAxes.push(
1579
+ b.ValueAxis.new(a, {
1580
+ renderer: b.AxisRendererY.new(a, {})
1581
+ })
1582
+ ), u = e.data[0], h = e.series ?? (u ? Object.keys(u).filter((g) => g !== "category") : []);
1583
+ for (const g of h) {
1584
+ const v = s.series.push(
1585
+ b.LineSeries.new(a, {
1586
+ name: g,
1587
+ xAxis: d,
1588
+ yAxis: c,
1589
+ valueYField: g,
1590
+ categoryXField: "category",
1591
+ tooltip: y.Tooltip.new(a, {
1592
+ labelText: `${g}: ${e.unit ?? ""}{valueY}`
1593
+ })
1594
+ })
1595
+ );
1596
+ v.strokes.template.setAll({ strokeWidth: 2 }), (e.showDots ?? !0) && v.bullets.push(() => {
1597
+ if (!a)
1598
+ throw new Error("Chart root is not initialized");
1599
+ const L = v.get("fill");
1600
+ return y.Bullet.new(a, {
1601
+ sprite: y.Circle.new(a, {
1602
+ radius: 4,
1603
+ ...L ? { fill: L } : {},
1604
+ strokeWidth: 0
1605
+ })
1606
+ });
1607
+ }), v.data.setAll(e.data);
1608
+ }
1609
+ d.data.setAll(e.data), (e.showLegend ?? h.length > 1) && s.children.push(
1610
+ y.Legend.new(a, {
1611
+ centerX: y.percent(50),
1612
+ x: y.percent(50),
1613
+ marginTop: 8
1614
+ })
1615
+ ).data.setAll(s.series.values);
1616
+ }, l = new ResizeObserver((s) => {
1617
+ var c;
1618
+ (((c = s[0]) == null ? void 0 : c.contentRect.width) ?? 0) > 0 && !a && i();
1619
+ });
1620
+ return l.observe(r), r.offsetWidth > 0 && i(), () => {
1621
+ l.disconnect(), a == null || a.dispose();
1622
+ };
1623
+ }, []), /* @__PURE__ */ o("div", { ref: t, className: K, style: { height: e.height ?? 300 } });
1624
+ }, yr = ({
1625
+ props: e,
1626
+ emit: t
1627
+ }) => {
1628
+ const { label: r, href: a, appearance: i, target: l, ghost: s, badge: d } = e, c = (h) => {
1629
+ h.preventDefault(), t("press");
1630
+ }, u = d !== void 0 ? /* @__PURE__ */ p("span", { style: { position: "relative", display: "inline-flex", alignItems: "center" }, children: [
1631
+ r,
1632
+ /* @__PURE__ */ o(he, { "aria-label": d ? `${d} unread` : "unread", offset: { x: "8px", y: "0px" }, children: d })
1633
+ ] }) : r;
1634
+ return i === "secondary" ? /* @__PURE__ */ o(
1635
+ _,
1636
+ {
1637
+ appearance: "secondary",
1638
+ ghost: !1,
1639
+ href: a,
1640
+ ...l ? { target: l } : {},
1641
+ onClick: c,
1642
+ children: u
1643
+ }
1644
+ ) : s !== void 0 ? /* @__PURE__ */ o(
1645
+ _,
1646
+ {
1647
+ appearance: "primary",
1648
+ ghost: s,
1649
+ href: a,
1650
+ ...l ? { target: l } : {},
1651
+ onClick: c,
1652
+ children: u
1653
+ }
1654
+ ) : /* @__PURE__ */ o(_, { appearance: "primary", href: a, ...l ? { target: l } : {}, onClick: c, children: u });
1655
+ };
1656
+ var Cr = T({ defaultClassName: "_1le8ba60", variantClassNames: { disabled: { true: "_1le8ba61", false: "_1le8ba62" } }, defaultVariants: {}, compoundVariants: [] });
1657
+ const xr = ({
1658
+ props: e,
1659
+ bindings: t,
1660
+ emit: r
1661
+ }) => {
1662
+ const a = t == null ? void 0 : t.value, { state: i, set: l } = N(), s = a ? j(i, a) : void 0, d = a ? s ?? e.value ?? "" : e.value ?? "", c = e.options.map((h) => ({ id: h.value, label: h.label })), u = c.find((h) => h.id === d);
1663
+ return /* @__PURE__ */ p("div", { className: Cr({ disabled: e.disabled ?? !1 }), children: [
1664
+ /* @__PURE__ */ o(gt, { children: e.label }),
1665
+ /* @__PURE__ */ o(
1666
+ ee,
1667
+ {
1668
+ items: c,
1669
+ ...u ? { selected: u } : {},
1670
+ onSelectionChange: (h) => {
1671
+ const f = (h == null ? void 0 : h.id) ?? "";
1672
+ a && l(a, f), r("change");
1673
+ },
1674
+ children: ({ items: h }) => h.map((f) => /* @__PURE__ */ o(ee.Option, { item: f, children: f.label }, f.id))
1675
+ }
1676
+ )
1677
+ ] });
1678
+ }, wr = ({
1679
+ props: e
1680
+ }) => {
1681
+ const t = C({ description: e.description });
1682
+ return e.indeterminate ? /* @__PURE__ */ o(V, { label: e.label, indeterminate: !0, ...t }) : e.value !== void 0 ? /* @__PURE__ */ o(V, { label: e.label, value: e.value, ...t }) : /* @__PURE__ */ o(V, { label: e.label, indeterminate: !0, ...t });
1683
+ }, Sr = ({
1684
+ props: e,
1685
+ bindings: t,
1686
+ emit: r
1687
+ }) => {
1688
+ const a = t == null ? void 0 : t.value, { state: i, set: l } = N(), s = a ? j(i, a) : void 0, d = a ? s ?? e.value ?? "" : e.value ?? "";
1689
+ return /* @__PURE__ */ o(te.Group, { legend: e.label, children: e.options.map((c) => /* @__PURE__ */ o(
1690
+ te,
1691
+ {
1692
+ label: c.label,
1693
+ value: c.value,
1694
+ checked: d === c.value,
1695
+ ...C({ disabled: e.disabled }),
1696
+ onChange: () => {
1697
+ a && l(a, c.value), r("change");
1698
+ }
1699
+ },
1700
+ c.value
1701
+ )) });
1702
+ }, kr = ({
1703
+ props: e,
1704
+ bindings: t,
1705
+ emit: r
1706
+ }) => {
1707
+ const a = t == null ? void 0 : t.checked, { state: i, set: l } = N(), s = a ? j(i, a) : void 0, d = a ? s ?? e.checked ?? !1 : e.checked ?? !1;
1708
+ return /* @__PURE__ */ o(
1709
+ bt,
1710
+ {
1711
+ label: e.label,
1712
+ value: e.label,
1713
+ checked: d,
1714
+ ...C({ disabled: e.disabled }),
1715
+ onChange: (c, u) => {
1716
+ a && l(a, (u == null ? void 0 : u.checked) ?? !1), r("change");
1717
+ }
1718
+ }
1719
+ );
1720
+ }, Rr = ({ props: e }) => e.variant === "headline" ? e.size !== void 0 ? /* @__PURE__ */ o(m, { variant: "headline", el: "h3", size: e.size, children: e.content }) : /* @__PURE__ */ o(m, { variant: "headline", el: "h3", children: e.content }) : e.variant === "eyebrow" ? /* @__PURE__ */ o(m, { variant: "eyebrow", children: e.content }) : e.size !== void 0 && e.subdued !== void 0 ? /* @__PURE__ */ o(m, { variant: "body", size: e.size, subdued: e.subdued, children: e.content }) : e.size !== void 0 ? /* @__PURE__ */ o(m, { variant: "body", size: e.size, children: e.content }) : e.subdued !== void 0 ? /* @__PURE__ */ o(m, { variant: "body", subdued: e.subdued, children: e.content }) : /* @__PURE__ */ o(m, { variant: "body", children: e.content }), Nr = ({
1721
+ props: e,
1722
+ bindings: t,
1723
+ emit: r
1724
+ }) => {
1725
+ const a = t == null ? void 0 : t.value, { state: i, set: l } = N(), s = a ? j(i, a) : void 0, d = a ? s ?? e.value ?? "" : e.value ?? "";
1726
+ return /* @__PURE__ */ o(
1727
+ vt,
1728
+ {
1729
+ label: e.label,
1730
+ value: d,
1731
+ ...C({
1732
+ placeholder: e.placeholder,
1733
+ description: e.description,
1734
+ moreInfo: e.moreInfo,
1735
+ rows: e.rows,
1736
+ disabled: e.disabled
1737
+ }),
1738
+ onChange: (c) => {
1739
+ a && l(a, c.target.value), r("change");
1740
+ }
1741
+ }
1742
+ );
1743
+ }, Je = [
1744
+ { name: "Text", catalog: Ge, renderer: Rr, renderers: ["all"] },
1745
+ { name: "Card", catalog: Ne, renderer: Za, renderers: ["all"] },
1746
+ { name: "Flex", catalog: ze, renderer: rr, renderers: ["all"] },
1747
+ { name: "Grid", catalog: Ee, renderer: dr, renderers: ["all"] },
1748
+ { name: "Alert", catalog: Se, renderer: Ya, renderers: ["all"] },
1749
+ { name: "Divider", catalog: Le, renderer: nr, renderers: ["all"] },
1750
+ { name: "Icon", catalog: Pe, renderer: gr, renderers: ["all"] },
1751
+ { name: "Chip", catalog: Te, renderer: tr, renderers: ["all"] },
1752
+ { name: "Link", catalog: $e, renderer: yr, renderers: ["all"] },
1753
+ {
1754
+ name: "ProgressBar",
1755
+ catalog: De,
1756
+ renderer: wr,
1757
+ renderers: ["all"]
1758
+ },
1759
+ {
1760
+ name: "BarChart",
1761
+ catalog: ke,
1762
+ renderer: Ka,
1763
+ renderers: ["all"]
1764
+ },
1765
+ {
1766
+ name: "DonutChart",
1767
+ catalog: _e,
1768
+ renderer: ar,
1769
+ renderers: ["all"]
1770
+ },
1771
+ {
1772
+ name: "LineChart",
1773
+ catalog: Ae,
1774
+ renderer: vr,
1775
+ renderers: ["all"]
1776
+ },
1777
+ { name: "Button", catalog: Re, renderer: Ja, renderers: ["all"] },
1778
+ {
1779
+ name: "Checkbox",
1780
+ catalog: je,
1781
+ renderer: Qa,
1782
+ renderers: ["all"]
1783
+ },
1784
+ { name: "Input", catalog: Ie, renderer: br, renderers: ["all"] },
1785
+ {
1786
+ name: "Textarea",
1787
+ catalog: Ve,
1788
+ renderer: Nr,
1789
+ renderers: ["all"]
1790
+ },
1791
+ { name: "Listbox", catalog: Fe, renderer: xr, renderers: ["all"] },
1792
+ {
1793
+ name: "RadioGroup",
1794
+ catalog: Be,
1795
+ renderer: Sr,
1796
+ renderers: ["all"]
1797
+ },
1798
+ { name: "Switch", catalog: Me, renderer: kr, renderers: ["all"] },
1799
+ {
1800
+ name: "GuidanceCard",
1801
+ catalog: Oe,
1802
+ renderer: pr,
1803
+ renderers: ["all"]
1804
+ }
1805
+ ];
1806
+ Object.fromEntries(
1807
+ Je.map(({ name: e, renderer: t }) => [e, t])
1808
+ );
1809
+ const jr = {
1810
+ props: n.object({
1811
+ title: n.string(),
1812
+ value: n.string(),
1813
+ trend: n.enum(["up", "down", "flat"]).optional(),
1814
+ delta: n.string().optional()
1815
+ }),
1816
+ slots: [],
1817
+ description: 'KPI metric card. trend: up=green↑ down=red↓ flat=grey→. delta e.g. "+12% vs last month". Leaf node — no children.'
1818
+ };
1819
+ var Tr = T({ defaultClassName: "cy2dbi0", variantClassNames: { trend: { up: "cy2dbi1", down: "cy2dbi2", flat: "cy2dbi3" } }, defaultVariants: {}, compoundVariants: [] });
1820
+ const Lr = ({
1821
+ props: e
1822
+ }) => {
1823
+ const t = e.trend ?? "flat", r = e.trend === "up" ? "↑" : e.trend === "down" ? "↓" : "→", a = Tr({ trend: t });
1824
+ return /* @__PURE__ */ o(O, { children: /* @__PURE__ */ p($, { direction: "column", gap: "2", children: [
1825
+ /* @__PURE__ */ o(m, { variant: "eyebrow", children: e.title }),
1826
+ /* @__PURE__ */ o(m, { variant: "headline", el: "h3", children: e.value }),
1827
+ e.delta && /* @__PURE__ */ p($, { direction: "row", gap: "1", alignItems: "center", children: [
1828
+ /* @__PURE__ */ o("span", { className: a, children: r }),
1829
+ /* @__PURE__ */ o(m, { variant: "eyebrow", className: a, children: e.delta })
1830
+ ] })
1831
+ ] }) });
1832
+ }, _r = [
1833
+ {
1834
+ name: "RevenueCard",
1835
+ catalog: jr,
1836
+ renderer: Lr,
1837
+ renderers: ["chat"]
1838
+ }
1839
+ ];
1840
+ function zr(e, t) {
1841
+ return t === "all" ? [...e] : e.filter(
1842
+ ({ renderers: r }) => r.includes("all") || r.includes(t)
1843
+ );
1844
+ }
1845
+ function Er(e) {
1846
+ return Object.fromEntries(e.map(({ name: t, catalog: r }) => [t, r]));
1847
+ }
1848
+ function Or(e) {
1849
+ return Object.fromEntries(
1850
+ e.map(({ name: t, renderer: r }) => [t, r])
1851
+ );
1852
+ }
1853
+ const Pr = [
1854
+ ...Je,
1855
+ ..._r,
1856
+ ...Y
1857
+ ];
1858
+ function E(e = "chat") {
1859
+ const t = zr(Pr, e), r = Er(t), a = Or(t), i = D(B, {
1860
+ components: r,
1861
+ actions: G
1862
+ });
1863
+ return ot(i, {
1864
+ components: a,
1865
+ actions: La
1866
+ });
1867
+ }
1868
+ const Z = E("chat"), Ro = Z.registry, No = Z.handlers, jo = Z.executeAction;
1869
+ function To() {
1870
+ return E("context");
1871
+ }
1872
+ function Ir(e) {
1873
+ var r;
1874
+ const t = { ...e.elements };
1875
+ for (const [a, i] of Object.entries(t)) {
1876
+ if (i.type !== "Button" || (r = i.on) != null && r.press)
1877
+ continue;
1878
+ const l = a;
1879
+ t[a] = {
1880
+ ...i,
1881
+ on: {
1882
+ ...i.on,
1883
+ press: { action: "atlas.submitUserAction", params: { actionId: l } }
1884
+ }
1885
+ };
1886
+ }
1887
+ return { ...e, elements: t };
1888
+ }
1889
+ function Ar(e, t) {
1890
+ return x(
1891
+ () => t.reduce((r, a) => a(r), e),
1892
+ [e, t]
1893
+ );
1894
+ }
1895
+ const $r = [Ir], Ze = ({ spec: e, registry: t, handlers: r, actions: a, loading: i }) => {
1896
+ const l = Ar(e, $r), s = R(null), d = R(null);
1897
+ if (s.current !== e) {
1898
+ s.current = e;
1899
+ const f = l.state ?? {};
1900
+ d.current = it(f);
1901
+ }
1902
+ if (d.current === null)
1903
+ throw new Error("State store is not initialized");
1904
+ const c = d.current, u = x(() => {
1905
+ const f = r(
1906
+ () => {
1907
+ },
1908
+ () => c.getSnapshot()
1909
+ ), g = a ? a({ setState: c.set, getSnapshot: () => c.getSnapshot() }) : {};
1910
+ return { ...f, ...g };
1911
+ }, [r, a, c]), h = x(
1912
+ () => ({
1913
+ computeTotal: (f) => {
1914
+ const g = Number.parseFloat(String(f.quantity ?? 0)) || 0, v = Number.parseFloat(
1915
+ String(f.unitPrice ?? "0").replace(/[^0-9.]/g, "")
1916
+ ) || 0;
1917
+ return `$${(g * v).toFixed(2)}`;
1918
+ }
1919
+ }),
1920
+ []
1921
+ );
1922
+ return /* @__PURE__ */ o(
1923
+ lt,
1924
+ {
1925
+ registry: t,
1926
+ store: c,
1927
+ handlers: u,
1928
+ functions: h,
1929
+ children: /* @__PURE__ */ o(st, { spec: l, registry: t, loading: i ?? !1 })
1930
+ }
1931
+ );
1932
+ };
1933
+ class Qe extends St {
1934
+ constructor() {
1935
+ super(...arguments);
1936
+ Q(this, "state", { hasError: !1, message: "" });
1937
+ }
1938
+ static getDerivedStateFromError(r) {
1939
+ return { hasError: !0, message: r.message };
1940
+ }
1941
+ componentDidCatch(r, a) {
1942
+ var i, l;
1943
+ console.error(
1944
+ `[ContextSpecRenderer] Rendering error in <${this.props.elementType}>:`,
1945
+ r,
1946
+ a.componentStack
1947
+ ), (l = (i = this.props).onError) == null || l.call(i, {
1948
+ elementType: this.props.elementType,
1949
+ message: r.message
1950
+ });
1951
+ }
1952
+ render() {
1953
+ return this.state.hasError ? process.env.NODE_ENV === "production" ? null : /* @__PURE__ */ o(me, { status: "danger", title: `${this.props.elementType} failed to render`, children: /* @__PURE__ */ o(m, { variant: "body", children: this.state.message }) }) : this.props.children;
1954
+ }
1955
+ }
1956
+ function et(e, t) {
1957
+ if (process.env.NODE_ENV === "production")
1958
+ return e;
1959
+ const r = { ...e };
1960
+ for (const [a, i] of Object.entries(e)) {
1961
+ const l = i;
1962
+ r[a] = ((s) => /* @__PURE__ */ o(
1963
+ Qe,
1964
+ {
1965
+ elementType: a,
1966
+ ...t ? { onError: t } : {},
1967
+ children: /* @__PURE__ */ o(l, { ...s })
1968
+ }
1969
+ ));
1970
+ }
1971
+ return r;
1972
+ }
1973
+ const Lo = ({
1974
+ spec: e,
1975
+ registry: t,
1976
+ handlers: r,
1977
+ actions: a,
1978
+ onRenderError: i,
1979
+ loading: l
1980
+ }) => {
1981
+ const s = l ? [] : qe(e);
1982
+ s.length > 0 && process.env.NODE_ENV !== "production" && console.warn(
1983
+ `[ContextSpecRenderer] Spec validation issues:
1984
+ ${Xe(
1985
+ s.map((h) => ({ ...h, severity: "error" }))
1986
+ )}`
1987
+ );
1988
+ const d = t ?? E("context").registry, c = r ?? E("context").handlers, u = x(
1989
+ () => et(d, i),
1990
+ [d, i]
1991
+ );
1992
+ return /* @__PURE__ */ o(
1993
+ Ze,
1994
+ {
1995
+ spec: e,
1996
+ registry: u,
1997
+ handlers: c,
1998
+ ...a ? { actions: a } : {},
1999
+ ...l !== void 0 ? { loading: l } : {}
2000
+ }
2001
+ );
2002
+ };
2003
+ var Fr = "nilaa0";
2004
+ function Dr(e, t) {
2005
+ const r = {};
2006
+ let a = !1;
2007
+ const i = (l) => {
2008
+ const s = e.elements[l];
2009
+ if (!s) {
2010
+ a = !0;
2011
+ return;
2012
+ }
2013
+ if (!r[l]) {
2014
+ r[l] = s;
2015
+ for (const d of s.children ?? [])
2016
+ i(d);
2017
+ }
2018
+ };
2019
+ return i(t), { elements: r, hasMissingRefs: a };
2020
+ }
2021
+ function Br(e, t) {
2022
+ const { elements: r, hasMissingRefs: a } = Dr(e, t), i = { root: t, elements: r }, l = e.state;
2023
+ return l !== void 0 && (i.state = l), { spec: i, hasMissingRefs: a };
2024
+ }
2025
+ function Mr(e, t) {
2026
+ const r = R(/* @__PURE__ */ new Map());
2027
+ return x(() => {
2028
+ if (!(e != null && e.root))
2029
+ return [];
2030
+ const a = e.elements[e.root];
2031
+ if (!a)
2032
+ return [];
2033
+ const i = (a.children ?? []).filter((c) => e.elements[c]), l = r.current, s = /* @__PURE__ */ new Map(), d = i.map((c, u) => {
2034
+ const { spec: h, hasMissingRefs: f } = Br(e, c), g = JSON.stringify(h), v = l.get(c), L = v && v.key === g ? v.spec : h;
2035
+ s.set(c, { key: g, spec: L });
2036
+ const tt = u === i.length - 1;
2037
+ return { id: c, spec: L, status: f || tt && t ? "loading" : "ready" };
2038
+ });
2039
+ return r.current = s, d;
2040
+ }, [e, t]);
2041
+ }
2042
+ function Gr(e) {
2043
+ const t = R(/* @__PURE__ */ new Map());
2044
+ return x(() => {
2045
+ const r = t.current, a = /* @__PURE__ */ new Map(), i = e.map((l) => {
2046
+ const s = l.spec ? JSON.stringify(l.spec) : "", d = r.get(l.id), c = l.spec && d && d.key === s ? d.spec : l.spec;
2047
+ return a.set(l.id, { key: s, spec: c }), c === l.spec ? l : { ...l, spec: c };
2048
+ });
2049
+ return t.current = a, i;
2050
+ }, [e]);
2051
+ }
2052
+ function Vr({ title: e }) {
2053
+ return /* @__PURE__ */ p("div", { className: ve, "data-testid": "context-section-skeleton", children: [
2054
+ /* @__PURE__ */ o(pe, { variant: "headline", ...e ? { "aria-label": `Loading ${e}` } : {} }),
2055
+ /* @__PURE__ */ o(yt, { height: "64px" })
2056
+ ] });
2057
+ }
2058
+ function Wr({ slot: e, registry: t, handlers: r, actions: a }) {
2059
+ return e.spec ? /* @__PURE__ */ p("div", { "data-testid": `context-section-${e.id}`, "data-status": e.status, children: [
2060
+ /* @__PURE__ */ o(
2061
+ Ze,
2062
+ {
2063
+ spec: e.spec,
2064
+ registry: t,
2065
+ handlers: r,
2066
+ loading: e.status === "loading",
2067
+ ...a ? { actions: a } : {}
2068
+ }
2069
+ ),
2070
+ e.status === "loading" ? /* @__PURE__ */ o("div", { className: Fr, children: /* @__PURE__ */ o(pe, { variant: "body", rows: 2, "aria-label": "Loading more of this section" }) }) : null
2071
+ ] }) : /* @__PURE__ */ o(Vr, { ...e.title ? { title: e.title } : {} });
2072
+ }
2073
+ const _o = ({
2074
+ spec: e,
2075
+ sections: t,
2076
+ loading: r = !1,
2077
+ registry: a,
2078
+ handlers: i,
2079
+ actions: l,
2080
+ onRenderError: s
2081
+ }) => {
2082
+ const d = x(() => E("context"), []), c = a ?? d.registry, u = i ?? d.handlers, h = x(
2083
+ () => et(c, s),
2084
+ [c, s]
2085
+ ), f = Mr(e, r), g = Gr(t ?? f);
2086
+ return /* @__PURE__ */ o("div", { className: we, "data-testid": "sectioned-context-panel", children: g.map((v) => /* @__PURE__ */ o(
2087
+ Qe,
2088
+ {
2089
+ elementType: v.id,
2090
+ ...s ? { onError: s } : {},
2091
+ children: /* @__PURE__ */ o(
2092
+ Wr,
2093
+ {
2094
+ slot: v,
2095
+ registry: h,
2096
+ handlers: u,
2097
+ ...l ? { actions: l } : {}
2098
+ }
2099
+ )
2100
+ },
2101
+ v.id
2102
+ )) });
2103
+ };
2104
+ export {
2105
+ Lo as ContextSpecRenderer,
2106
+ _o as SectionedContextRenderer,
2107
+ Ze as SpecRenderer,
2108
+ ko as catalog,
2109
+ We as composeCatalogComponents,
2110
+ Ma as contextCatalog,
2111
+ yo as createScopedCatalog,
2112
+ jo as executeAction,
2113
+ Br as extractSectionSpec,
2114
+ So as formatContextRenderReport,
2115
+ Xe as formatContextSpecIssues,
2116
+ To as getContextRegistry,
2117
+ E as getRegistry,
2118
+ No as handlers,
2119
+ wo as hasContextSpecErrors,
2120
+ Co as mergeCatalogs,
2121
+ xo as postProcessContextSpec,
2122
+ Ro as registry,
2123
+ qe as validateContextSpec,
2124
+ Xa as validateContextSpecDeep
2125
+ };
2126
+ //# sourceMappingURL=index.js.map