@instructure/platform-block-content-editor 0.3.1

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 (115) hide show
  1. package/dist/components/MediaPlaceholder/MediaPlaceholder.d.ts +25 -0
  2. package/dist/components/MediaPlaceholder/MediaPlaceholder.d.ts.map +1 -0
  3. package/dist/components/MediaPlaceholder/index.d.ts +3 -0
  4. package/dist/components/MediaPlaceholder/index.d.ts.map +1 -0
  5. package/dist/components/blocks/Accordion/Accordion.d.ts +4 -0
  6. package/dist/components/blocks/Accordion/Accordion.d.ts.map +1 -0
  7. package/dist/components/blocks/Accordion/accordionPropsSchema.d.ts +109 -0
  8. package/dist/components/blocks/Accordion/accordionPropsSchema.d.ts.map +1 -0
  9. package/dist/components/blocks/Accordion/getAccordionViewProps.d.ts +66 -0
  10. package/dist/components/blocks/Accordion/getAccordionViewProps.d.ts.map +1 -0
  11. package/dist/components/blocks/Accordion/index.d.ts +4 -0
  12. package/dist/components/blocks/Accordion/index.d.ts.map +1 -0
  13. package/dist/components/blocks/Banner/Banner.d.ts +4 -0
  14. package/dist/components/blocks/Banner/Banner.d.ts.map +1 -0
  15. package/dist/components/blocks/Banner/bannerPropsSchema.d.ts +36 -0
  16. package/dist/components/blocks/Banner/bannerPropsSchema.d.ts.map +1 -0
  17. package/dist/components/blocks/Banner/getBannerViewProps.d.ts +5 -0
  18. package/dist/components/blocks/Banner/getBannerViewProps.d.ts.map +1 -0
  19. package/dist/components/blocks/Banner/index.d.ts +3 -0
  20. package/dist/components/blocks/Banner/index.d.ts.map +1 -0
  21. package/dist/components/blocks/CodeBlock/CodeBlock.d.ts +4 -0
  22. package/dist/components/blocks/CodeBlock/CodeBlock.d.ts.map +1 -0
  23. package/dist/components/blocks/CodeBlock/codeBlockPropsSchema.d.ts +28 -0
  24. package/dist/components/blocks/CodeBlock/codeBlockPropsSchema.d.ts.map +1 -0
  25. package/dist/components/blocks/CodeBlock/getCodeBlockViewProps.d.ts +13 -0
  26. package/dist/components/blocks/CodeBlock/getCodeBlockViewProps.d.ts.map +1 -0
  27. package/dist/components/blocks/CodeBlock/index.d.ts +3 -0
  28. package/dist/components/blocks/CodeBlock/index.d.ts.map +1 -0
  29. package/dist/components/blocks/ImageBlock/ImageBlock.d.ts +4 -0
  30. package/dist/components/blocks/ImageBlock/ImageBlock.d.ts.map +1 -0
  31. package/dist/components/blocks/ImageBlock/getImageBlockViewProps.d.ts +7 -0
  32. package/dist/components/blocks/ImageBlock/getImageBlockViewProps.d.ts.map +1 -0
  33. package/dist/components/blocks/ImageBlock/imageBlockPropsSchema.d.ts +40 -0
  34. package/dist/components/blocks/ImageBlock/imageBlockPropsSchema.d.ts.map +1 -0
  35. package/dist/components/blocks/ImageBlock/index.d.ts +3 -0
  36. package/dist/components/blocks/ImageBlock/index.d.ts.map +1 -0
  37. package/dist/components/blocks/Quote/Quote.d.ts +4 -0
  38. package/dist/components/blocks/Quote/Quote.d.ts.map +1 -0
  39. package/dist/components/blocks/Quote/getQuoteViewProps.d.ts +5 -0
  40. package/dist/components/blocks/Quote/getQuoteViewProps.d.ts.map +1 -0
  41. package/dist/components/blocks/Quote/index.d.ts +3 -0
  42. package/dist/components/blocks/Quote/index.d.ts.map +1 -0
  43. package/dist/components/blocks/Quote/quotePropsSchema.d.ts +28 -0
  44. package/dist/components/blocks/Quote/quotePropsSchema.d.ts.map +1 -0
  45. package/dist/components/blocks/Text/Text.d.ts +4 -0
  46. package/dist/components/blocks/Text/Text.d.ts.map +1 -0
  47. package/dist/components/blocks/Text/getTextViewProps.d.ts +5 -0
  48. package/dist/components/blocks/Text/getTextViewProps.d.ts.map +1 -0
  49. package/dist/components/blocks/Text/index.d.ts +3 -0
  50. package/dist/components/blocks/Text/index.d.ts.map +1 -0
  51. package/dist/components/blocks/Text/textPropsSchema.d.ts +28 -0
  52. package/dist/components/blocks/Text/textPropsSchema.d.ts.map +1 -0
  53. package/dist/components/blocks/VideoBlock/VideoBlock.d.ts +16 -0
  54. package/dist/components/blocks/VideoBlock/VideoBlock.d.ts.map +1 -0
  55. package/dist/components/blocks/VideoBlock/getVideoBlockViewProps.d.ts +5 -0
  56. package/dist/components/blocks/VideoBlock/getVideoBlockViewProps.d.ts.map +1 -0
  57. package/dist/components/blocks/VideoBlock/index.d.ts +3 -0
  58. package/dist/components/blocks/VideoBlock/index.d.ts.map +1 -0
  59. package/dist/components/blocks/VideoBlock/videoBlockPropsSchema.d.ts +40 -0
  60. package/dist/components/blocks/VideoBlock/videoBlockPropsSchema.d.ts.map +1 -0
  61. package/dist/components/blocks/brandTheming.d.ts +87 -0
  62. package/dist/components/blocks/brandTheming.d.ts.map +1 -0
  63. package/dist/components/blocks/commonSchemas.d.ts +17 -0
  64. package/dist/components/blocks/commonSchemas.d.ts.map +1 -0
  65. package/dist/components/blocks/commonViewProps.d.ts +19 -0
  66. package/dist/components/blocks/commonViewProps.d.ts.map +1 -0
  67. package/dist/contexts/BlockEditorApiContext.d.ts +63 -0
  68. package/dist/contexts/BlockEditorApiContext.d.ts.map +1 -0
  69. package/dist/contexts/BrandColorContext.d.ts +10 -0
  70. package/dist/contexts/BrandColorContext.d.ts.map +1 -0
  71. package/dist/contexts/DesignerModeContext.d.ts +8 -0
  72. package/dist/contexts/DesignerModeContext.d.ts.map +1 -0
  73. package/dist/contexts/TranslationsContext.d.ts +70 -0
  74. package/dist/contexts/TranslationsContext.d.ts.map +1 -0
  75. package/dist/index.d.ts +13 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +1385 -0
  78. package/dist/schema/index.d.ts +5 -0
  79. package/dist/schema/index.d.ts.map +1 -0
  80. package/dist/schema/registeredSchema.d.ts +47 -0
  81. package/dist/schema/registeredSchema.d.ts.map +1 -0
  82. package/dist/schema/schemaValidator.d.ts +40 -0
  83. package/dist/schema/schemaValidator.d.ts.map +1 -0
  84. package/dist/schema/zodExtensions.d.ts +137 -0
  85. package/dist/schema/zodExtensions.d.ts.map +1 -0
  86. package/dist/schema/zodUtils.d.ts +90 -0
  87. package/dist/schema/zodUtils.d.ts.map +1 -0
  88. package/dist/schema/zodUtils.test.d.ts +2 -0
  89. package/dist/schema/zodUtils.test.d.ts.map +1 -0
  90. package/dist/utils/colorVariants/brandColorVariants.d.ts +25 -0
  91. package/dist/utils/colorVariants/brandColorVariants.d.ts.map +1 -0
  92. package/dist/utils/colorVariants/brandColorVariants.test.d.ts +2 -0
  93. package/dist/utils/colorVariants/brandColorVariants.test.d.ts.map +1 -0
  94. package/dist/utils/colorVariants/color.d.ts +21 -0
  95. package/dist/utils/colorVariants/color.d.ts.map +1 -0
  96. package/dist/utils/colorVariants/color.test.d.ts +2 -0
  97. package/dist/utils/colorVariants/color.test.d.ts.map +1 -0
  98. package/dist/utils/colorVariants/deriveColorVariants.d.ts +41 -0
  99. package/dist/utils/colorVariants/deriveColorVariants.d.ts.map +1 -0
  100. package/dist/utils/colorVariants/deriveColorVariants.test.d.ts +2 -0
  101. package/dist/utils/colorVariants/deriveColorVariants.test.d.ts.map +1 -0
  102. package/dist/utils/colorVariants/index.d.ts +3 -0
  103. package/dist/utils/colorVariants/index.d.ts.map +1 -0
  104. package/dist/utils/colorVariants/types.d.ts +21 -0
  105. package/dist/utils/colorVariants/types.d.ts.map +1 -0
  106. package/dist/utils/colorVariants/wcag.d.ts +10 -0
  107. package/dist/utils/colorVariants/wcag.d.ts.map +1 -0
  108. package/dist/utils/safeMediaUrl.d.ts +10 -0
  109. package/dist/utils/safeMediaUrl.d.ts.map +1 -0
  110. package/dist/utils/safeMediaUrl.test.d.ts +2 -0
  111. package/dist/utils/safeMediaUrl.test.d.ts.map +1 -0
  112. package/dist/utils/wordWrap.d.ts +16 -0
  113. package/dist/utils/wordWrap.d.ts.map +1 -0
  114. package/locales/en.json +21 -0
  115. package/package.json +73 -0
package/dist/index.js ADDED
@@ -0,0 +1,1385 @@
1
+ import { jsx as d, jsxs as S, Fragment as ze } from "react/jsx-runtime";
2
+ import { sanitizeHtml as Re } from "@instructure/platform-sanitize";
3
+ import { Flex as J } from "@instructure/ui-flex";
4
+ import { Heading as ne } from "@instructure/ui-heading";
5
+ import { Text as z } from "@instructure/ui-text";
6
+ import { ToggleDetails as We } from "@instructure/ui-toggle-details";
7
+ import { View as f } from "@instructure/ui-view";
8
+ import { createContext as G, useContext as B, useState as F, useMemo as O } from "react";
9
+ import { IconArrowOpenDownSolid as ue, IconArrowOpenEndSolid as $e, IconArrowOpenUpSolid as Ue } from "@instructure/ui-icons";
10
+ import { z as a } from "zod";
11
+ import { Img as qe } from "@instructure/ui-img";
12
+ import { Spinner as Ge } from "@instructure/ui-spinner";
13
+ const Xe = G(void 0), X = () => B(Xe), Qe = G(!1), _ = () => B(Qe), Ce = G(
14
+ void 0
15
+ );
16
+ function mt({
17
+ translations: e,
18
+ translate: o,
19
+ children: r
20
+ }) {
21
+ const t = { translations: e, translate: o };
22
+ return /* @__PURE__ */ d(Ce.Provider, { value: t, children: r });
23
+ }
24
+ function E() {
25
+ const e = B(Ce);
26
+ if (!e)
27
+ throw new Error("useTranslations must be used within TranslationsProvider");
28
+ return e;
29
+ }
30
+ const N = { overflowWrap: "break-word" };
31
+ function Ke(e, o, r) {
32
+ return Math.min(r, Math.max(o, e));
33
+ }
34
+ function ee(e) {
35
+ const o = e.trim(), r = /^#?([\da-f]{3}|[\da-f]{6})$/i.exec(o);
36
+ if (r) {
37
+ let n = r[1];
38
+ return n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]), {
39
+ r: Number.parseInt(n.slice(0, 2), 16),
40
+ g: Number.parseInt(n.slice(2, 4), 16),
41
+ b: Number.parseInt(n.slice(4, 6), 16)
42
+ };
43
+ }
44
+ const t = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)$/i.exec(o);
45
+ if (t)
46
+ return { r: Number(t[1]), g: Number(t[2]), b: Number(t[3]) };
47
+ throw new Error(`Unsupported color format: "${e}". Use hex or rgb()/rgba().`);
48
+ }
49
+ const oe = (e) => Math.round(Ke(e, 0, 255)).toString(16).padStart(2, "0");
50
+ function he({ r: e, g: o, b: r }) {
51
+ return `#${oe(e)}${oe(o)}${oe(r)}`;
52
+ }
53
+ function Ye({ r: e, g: o, b: r }) {
54
+ const t = e / 255, n = o / 255, i = r / 255, c = Math.max(t, n, i), u = Math.min(t, n, i), s = (c + u) / 2;
55
+ if (c === u)
56
+ return { h: 0, s: 0, l: s };
57
+ const l = c - u, h = s > 0.5 ? l / (2 - c - u) : l / (c + u);
58
+ let p;
59
+ switch (c) {
60
+ case t:
61
+ p = (n - i) / l + (n < i ? 6 : 0);
62
+ break;
63
+ case n:
64
+ p = (i - t) / l + 2;
65
+ break;
66
+ default:
67
+ p = (t - n) / l + 4;
68
+ }
69
+ return { h: p / 6, s: h, l: s };
70
+ }
71
+ function W(e, o, r) {
72
+ if (o === 0) {
73
+ const c = Math.round(r * 255);
74
+ return { r: c, g: c, b: c };
75
+ }
76
+ const t = (c, u, s) => {
77
+ let l = s;
78
+ return l < 0 && (l += 1), l > 1 && (l -= 1), l < 1 / 6 ? c + (u - c) * 6 * l : l < 1 / 2 ? u : l < 2 / 3 ? c + (u - c) * (2 / 3 - l) * 6 : c;
79
+ }, n = r < 0.5 ? r * (1 + o) : r + o - r * o, i = 2 * r - n;
80
+ return {
81
+ r: Math.round(t(i, n, e + 1 / 3) * 255),
82
+ g: Math.round(t(i, n, e) * 255),
83
+ b: Math.round(t(i, n, e - 1 / 3) * 255)
84
+ };
85
+ }
86
+ function pe({ r: e, g: o, b: r }) {
87
+ const t = (n) => {
88
+ const i = n / 255;
89
+ return i <= 0.03928 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4;
90
+ };
91
+ return 0.2126 * t(e) + 0.7152 * t(o) + 0.0722 * t(r);
92
+ }
93
+ function H(e, o) {
94
+ const r = pe(e), t = pe(o), n = Math.max(r, t), i = Math.min(r, t);
95
+ return (n + 0.05) / (i + 0.05);
96
+ }
97
+ const Je = 0.9, fe = 0.985, Fe = 0.85, eo = 0.55, ge = 0.03, be = 5e-3, oo = "#000000", to = "#FFFFFF", te = (e) => Math.round(e * 100) / 100;
98
+ function ro(e, o) {
99
+ const {
100
+ minTextContrast: r,
101
+ minVariantContrast: t,
102
+ darkText: n = oo,
103
+ lightText: i = to,
104
+ lightLightness: c = Je,
105
+ darkLightness: u = eo
106
+ } = o, { h: s, s: l } = Ye(ee(e)), h = ee(n), p = ee(i), b = Math.min(l, Fe);
107
+ let v = c, k = W(s, b, v);
108
+ for (; H(h, k) < r && v < fe; )
109
+ v = Math.min(fe, v + be), k = W(s, b, v);
110
+ let y = u, R = W(s, l, y);
111
+ const L = () => H(p, R) >= r && H(k, R) >= t;
112
+ for (; !L() && y > ge; )
113
+ y = Math.max(ge, y - be), R = W(s, l, y);
114
+ return {
115
+ light: {
116
+ color: he(k),
117
+ textColor: n,
118
+ contrast: te(H(h, k))
119
+ },
120
+ dark: {
121
+ color: he(R),
122
+ textColor: i,
123
+ contrast: te(H(p, R))
124
+ },
125
+ variantContrast: te(H(k, R))
126
+ };
127
+ }
128
+ const me = {
129
+ /** AA, normal-size text (below 18pt, or 14pt bold). */
130
+ AA_NORMAL_TEXT: 4.5,
131
+ /** 1.4.11, UI components and graphical objects against adjacent colors. */
132
+ NON_TEXT: 3
133
+ }, no = 0.3, io = "#273540";
134
+ function ao(e) {
135
+ return ro(e, {
136
+ minTextContrast: me.AA_NORMAL_TEXT,
137
+ minVariantContrast: me.NON_TEXT,
138
+ darkLightness: no,
139
+ darkText: io
140
+ });
141
+ }
142
+ function Z(e, o) {
143
+ if (e)
144
+ try {
145
+ const { light: r, dark: t } = ao(e), n = o === "light" ? r : t;
146
+ return { color: n.color, textColor: n.textColor };
147
+ } catch {
148
+ return;
149
+ }
150
+ }
151
+ function ie(e) {
152
+ return {
153
+ decoration: {
154
+ background: "brand",
155
+ borderWidth: "0",
156
+ borderColor: void 0,
157
+ textColor: "primary"
158
+ },
159
+ viewThemeOverride: { backgroundBrand: e.color },
160
+ textThemeOverride: { primaryColor: e.textColor }
161
+ };
162
+ }
163
+ function Se(e, o) {
164
+ return {
165
+ decoration: { background: "transparent", borderWidth: o, borderColor: "brand" },
166
+ viewThemeOverride: { borderColorBrand: e.color }
167
+ };
168
+ }
169
+ function w(e, o) {
170
+ const { textColor: r, ...t } = e.decoration;
171
+ return {
172
+ view: {
173
+ ...t,
174
+ borderRadius: o.borderRadius,
175
+ padding: o.padding,
176
+ themeOverride: e.viewThemeOverride
177
+ },
178
+ text: { color: r, themeOverride: e.textThemeOverride }
179
+ };
180
+ }
181
+ const $ = {
182
+ light: { background: "brand", borderColor: "brand", inverseText: !0 },
183
+ dark: { background: "primary-inverse", borderColor: "primary", inverseText: !0 },
184
+ neutral: { background: "secondary", borderColor: "secondary", inverseText: !1 }
185
+ }, so = {
186
+ light: "brand",
187
+ dark: "primary",
188
+ neutral: "secondary"
189
+ }, U = {
190
+ togglePadding: "0",
191
+ iconMargin: "0",
192
+ toggleFocusBorderColor: "transparent"
193
+ }, M = "small", co = (e, o) => {
194
+ var r, t;
195
+ return {
196
+ ...U,
197
+ textColor: (t = (r = o.colors) == null ? void 0 : r.contrasts) == null ? void 0 : t.white1010
198
+ };
199
+ };
200
+ function lo(e, o, r) {
201
+ const t = o === "neutral" ? void 0 : Z(r, o);
202
+ if (e === "solid")
203
+ return {
204
+ item: t ? {
205
+ background: "brand",
206
+ borderColor: "brand",
207
+ themeOverride: { backgroundBrand: t.color, borderColorBrand: t.color }
208
+ } : {
209
+ background: $[o].background,
210
+ borderColor: $[o].borderColor
211
+ },
212
+ // The ring sits on the fill, so it reuses the accessible color already paired with
213
+ // that surface: the brand variant's own text color, or the inverse token when the
214
+ // un-branded fill is dark enough to need light text.
215
+ header: t ? { padding: M, themeOverride: { focusColorInfo: t.textColor } } : $[o].inverseText ? { padding: M, focusColor: "inverse" } : { padding: M },
216
+ // The surface change is the divider here, so no border of its own.
217
+ content: { background: "primary", borderWidth: "0", padding: M },
218
+ toggle: t ? { ...U, textColor: t.textColor } : $[o].inverseText ? co : U
219
+ };
220
+ const n = t ? "brand" : so[o], i = t ? { borderColorBrand: t.color } : void 0;
221
+ return {
222
+ item: { background: "transparent", borderColor: n, themeOverride: i },
223
+ // Transparent surface, so InstUI's default `info` ring already contrasts.
224
+ header: { padding: M },
225
+ content: {
226
+ background: "transparent",
227
+ borderColor: n,
228
+ borderWidth: "small none none none",
229
+ padding: M,
230
+ themeOverride: i
231
+ },
232
+ toggle: U
233
+ };
234
+ }
235
+ function uo({
236
+ index: e,
237
+ count: o,
238
+ connection: r,
239
+ cornerStyle: t
240
+ }) {
241
+ const n = t === "rounded" ? "large" : "0", i = e === 0, c = e === o - 1, u = `${n} ${n} 0 0`;
242
+ return r === "separated" ? {
243
+ borderWidth: "small",
244
+ borderRadius: n,
245
+ margin: i ? "none" : "small none none none",
246
+ contentBorderRadius: `0 0 ${n} ${n}`,
247
+ headerBorderRadius: u
248
+ } : {
249
+ borderWidth: i ? "small" : "none small small small",
250
+ borderRadius: i && c ? n : i ? `${n} ${n} 0 0` : c ? `0 0 ${n} ${n}` : "0",
251
+ margin: "none",
252
+ contentBorderRadius: c ? `0 0 ${n} ${n}` : "0",
253
+ headerBorderRadius: i ? u : "0"
254
+ };
255
+ }
256
+ function ho(e) {
257
+ return e === "center" ? { closedIcon: $e, openIcon: ue } : { closedIcon: ue, openIcon: Ue };
258
+ }
259
+ function po(e) {
260
+ return e === "right" ? "row" : "row-reverse";
261
+ }
262
+ const ve = () => /* @__PURE__ */ d(ze, {});
263
+ function vt({
264
+ title: e,
265
+ variant: o = "h2",
266
+ supportingText: r,
267
+ items: t = [],
268
+ accordionStyle: n = "outline",
269
+ colorTheme: i = "light",
270
+ connection: c = "connected",
271
+ cornerStyle: u = "rounded",
272
+ dropdownPlacement: s = "left",
273
+ dropdownDirection: l = "down",
274
+ editingItemId: h
275
+ }) {
276
+ const p = _(), { translations: b, translate: v } = E(), k = X(), [y, R] = F(
277
+ new Set(h !== void 0 ? [h] : [])
278
+ ), [L, Q] = F(h), [P, V] = F(null);
279
+ h !== L && (Q(h), R((m) => {
280
+ const T = new Set(m);
281
+ return L !== void 0 && T.delete(L), h !== void 0 && T.add(h), T;
282
+ }));
283
+ const K = (m) => {
284
+ R((T) => {
285
+ const C = new Set(T);
286
+ return C.has(m) ? C.delete(m) : C.add(m), C;
287
+ });
288
+ }, {
289
+ item: j,
290
+ header: De,
291
+ content: Pe,
292
+ toggle: He
293
+ } = O(
294
+ () => lo(n, i, k),
295
+ [n, i, k]
296
+ ), { closedIcon: Me, openIcon: Ze } = O(
297
+ () => ho(l),
298
+ [l]
299
+ ), Be = JSON.stringify(t.map((m) => m.content)), Ve = O(
300
+ () => t.map((m) => Re(m.content)),
301
+ // eslint-disable-next-line react/exhaustive-deps -- keyed by content, not identity
302
+ [Be]
303
+ ), je = po(s), ce = (e || r) && /* @__PURE__ */ S(f, { as: "div", margin: "none none medium none", children: [
304
+ e && /* @__PURE__ */ d(ne, { level: o, children: e }),
305
+ r && /* @__PURE__ */ d(z, { as: "p", color: "secondary", children: r })
306
+ ] });
307
+ return t.length === 0 ? /* @__PURE__ */ d(f, { as: "div", className: "bce-block bce-block-accordion", children: /* @__PURE__ */ S("div", { style: N, children: [
308
+ ce,
309
+ p && /* @__PURE__ */ d(
310
+ f,
311
+ {
312
+ as: "div",
313
+ ...j,
314
+ borderWidth: "small",
315
+ borderRadius: u === "rounded" ? "large" : "0",
316
+ padding: "medium",
317
+ textAlign: "center",
318
+ children: /* @__PURE__ */ d(z, { color: "secondary", children: b.accordionPlaceholder })
319
+ }
320
+ )
321
+ ] }) }) : /* @__PURE__ */ d(f, { as: "div", className: "bce-block bce-block-accordion", children: /* @__PURE__ */ S("div", { style: N, children: [
322
+ ce,
323
+ t.map((m, T) => {
324
+ const C = uo({
325
+ index: T,
326
+ count: t.length,
327
+ connection: c,
328
+ cornerStyle: u
329
+ }), le = p && !m.title && !m.content, Y = y.has(m.id);
330
+ return /* @__PURE__ */ d(
331
+ f,
332
+ {
333
+ as: "div",
334
+ ...j,
335
+ borderWidth: C.borderWidth,
336
+ borderRadius: C.borderRadius,
337
+ margin: C.margin,
338
+ children: /* @__PURE__ */ d(
339
+ We,
340
+ {
341
+ variant: "default",
342
+ fluidWidth: !0,
343
+ expanded: Y,
344
+ onToggle: () => K(m.id),
345
+ onFocus: () => V(m.id),
346
+ onBlur: () => V(null),
347
+ icon: ve,
348
+ iconExpanded: ve,
349
+ themeOverride: He,
350
+ summary: /* @__PURE__ */ d(
351
+ f,
352
+ {
353
+ as: "span",
354
+ display: "block",
355
+ ...De,
356
+ borderRadius: Y ? C.headerBorderRadius : C.borderRadius,
357
+ withFocusOutline: P === m.id,
358
+ focusPosition: "inset",
359
+ children: /* @__PURE__ */ S(J, { direction: je, gap: "x-small", children: [
360
+ /* @__PURE__ */ d(J.Item, { shouldGrow: !0, shouldShrink: !0, children: le ? v("accordionItemPlaceholderTitle", { index: T + 1 }) : m.title }),
361
+ /* @__PURE__ */ d(J.Item, { children: Y ? /* @__PURE__ */ d(Ze, {}) : /* @__PURE__ */ d(Me, {}) })
362
+ ] })
363
+ }
364
+ ),
365
+ children: /* @__PURE__ */ d(f, { as: "div", ...Pe, borderRadius: C.contentBorderRadius, children: le ? /* @__PURE__ */ d(z, { color: "secondary", children: b.accordionItemPlaceholderContent }) : /* @__PURE__ */ d(
366
+ "div",
367
+ {
368
+ dangerouslySetInnerHTML: { __html: Ve[T] ?? "" }
369
+ }
370
+ ) })
371
+ }
372
+ )
373
+ },
374
+ m.id
375
+ );
376
+ })
377
+ ] }) });
378
+ }
379
+ function g(e) {
380
+ if (!e)
381
+ return {};
382
+ try {
383
+ const o = JSON.parse(e);
384
+ if (typeof o == "object" && o !== null)
385
+ return o;
386
+ } catch {
387
+ return { description: e };
388
+ }
389
+ return {};
390
+ }
391
+ function x(e) {
392
+ return JSON.stringify(e);
393
+ }
394
+ a.ZodType.prototype.zodLabel = function(e) {
395
+ const o = g(this.description);
396
+ return this.describe(
397
+ x({
398
+ ...o,
399
+ label: e
400
+ })
401
+ );
402
+ };
403
+ a.ZodType.prototype.zodPlaceholder = function(e) {
404
+ const o = g(this.description);
405
+ return this.describe(
406
+ x({
407
+ ...o,
408
+ placeholder: e
409
+ })
410
+ );
411
+ };
412
+ a.ZodType.prototype.zodHelp = function(e) {
413
+ const o = g(this.description);
414
+ return this.describe(
415
+ x({
416
+ ...o,
417
+ help: e
418
+ })
419
+ );
420
+ };
421
+ a.ZodType.prototype.zodHidden = function(e = !0) {
422
+ const o = g(this.description);
423
+ return this.describe(
424
+ x({
425
+ ...o,
426
+ hidden: e
427
+ })
428
+ );
429
+ };
430
+ a.ZodType.prototype.zodTextarea = function(e = !0) {
431
+ const o = g(this.description);
432
+ return this.describe(
433
+ x({
434
+ ...o,
435
+ textarea: e
436
+ })
437
+ );
438
+ };
439
+ a.ZodType.prototype.zodRichText = function(e = !0) {
440
+ const o = g(this.description);
441
+ return this.describe(
442
+ x({
443
+ ...o,
444
+ richtext: e
445
+ })
446
+ );
447
+ };
448
+ a.ZodType.prototype.zodRange = function(e) {
449
+ const o = g(this.description);
450
+ return this.describe(
451
+ x({
452
+ ...o,
453
+ range: e
454
+ })
455
+ );
456
+ };
457
+ a.ZodType.prototype.zodCodeEditor = function(e = !0) {
458
+ const o = g(this.description);
459
+ return this.describe(
460
+ x({
461
+ ...o,
462
+ codeeditor: e
463
+ })
464
+ );
465
+ };
466
+ a.ZodType.prototype.zodImage = function(e = !0) {
467
+ const o = g(this.description);
468
+ return this.describe(
469
+ x({
470
+ ...o,
471
+ image: e
472
+ })
473
+ );
474
+ };
475
+ a.ZodType.prototype.zodVideo = function(e = !0) {
476
+ const o = g(this.description);
477
+ return this.describe(
478
+ x({
479
+ ...o,
480
+ video: e
481
+ })
482
+ );
483
+ };
484
+ a.ZodType.prototype.zodHiddenWhen = function(e) {
485
+ const o = g(this.description), r = o.hiddenWhen;
486
+ let t;
487
+ return r ? t = [...Array.isArray(r) ? r : [r], e] : t = e, this.describe(
488
+ x({
489
+ ...o,
490
+ hiddenWhen: t
491
+ })
492
+ );
493
+ };
494
+ a.ZodType.prototype.zodDisabledWhen = function(e) {
495
+ const o = g(this.description), r = o.disabledWhen;
496
+ let t;
497
+ return r ? t = [...Array.isArray(r) ? r : [r], e] : t = e, this.describe(
498
+ x({
499
+ ...o,
500
+ disabledWhen: t
501
+ })
502
+ );
503
+ };
504
+ a.ZodType.prototype.zodItemLabel = function(e) {
505
+ const o = g(this.description);
506
+ return this.describe(
507
+ x({
508
+ ...o,
509
+ itemLabel: e
510
+ })
511
+ );
512
+ };
513
+ a.ZodType.prototype.zodItemName = function(e) {
514
+ const o = g(this.description);
515
+ return this.describe(
516
+ x({
517
+ ...o,
518
+ itemName: e
519
+ })
520
+ );
521
+ };
522
+ a.ZodType.prototype.zodManageLayer = function(e) {
523
+ const o = g(this.description);
524
+ return this.describe(
525
+ x({
526
+ ...o,
527
+ manageLayer: e
528
+ })
529
+ );
530
+ };
531
+ a.ZodType.prototype.zodAnswers = function(e = !0) {
532
+ const o = g(this.description);
533
+ return this.describe(
534
+ x({
535
+ ...o,
536
+ answers: e
537
+ })
538
+ );
539
+ };
540
+ a.ZodType.prototype.zodAltText = function(e = !0) {
541
+ const o = g(this.description);
542
+ return this.describe(
543
+ x({
544
+ ...o,
545
+ altText: e
546
+ })
547
+ );
548
+ };
549
+ function de(e) {
550
+ const o = e._def.typeName;
551
+ return o === "ZodOptional" || o === "ZodDefault" || o === "ZodNullable" || o === "ZodCatch" ? de(e._def.innerType) : e;
552
+ }
553
+ var fo = /* @__PURE__ */ ((e) => (e.TEXT = "text", e.TEXTAREA = "textarea", e.NUMBER = "number", e.RANGE = "range", e.BOOLEAN = "boolean", e.SELECT = "select", e.RICHTEXT = "richtext", e.IMAGE = "image", e.VIDEO = "video", e.ALTTEXT = "alttext", e.ASSET = "asset", e.ARRAY = "array", e.CODEEDITOR = "codeeditor", e.OBJECT = "object", e.ANSWERS = "answers", e.UNKNOWN = "unknown", e))(fo || {});
554
+ function q(e) {
555
+ const o = g(e.description);
556
+ if (o.range)
557
+ return "range";
558
+ if (o.textarea)
559
+ return "textarea";
560
+ if (o.richtext)
561
+ return "richtext";
562
+ if (o.codeeditor)
563
+ return "codeeditor";
564
+ if (o.image)
565
+ return "image";
566
+ if (o.video)
567
+ return "video";
568
+ if (o.answers)
569
+ return "answers";
570
+ if (o.altText)
571
+ return "alttext";
572
+ const r = e._def.typeName;
573
+ if (r === "ZodOptional" || r === "ZodDefault" || r === "ZodNullable" || r === "ZodCatch")
574
+ return q(e._def.innerType);
575
+ if (r === "ZodString") {
576
+ const t = e;
577
+ if (t._def.checks) {
578
+ for (const n of t._def.checks)
579
+ if (n.kind === "email" || n.kind === "url") return "text";
580
+ }
581
+ return "text";
582
+ }
583
+ return r === "ZodNumber" ? "number" : r === "ZodBoolean" ? "boolean" : r === "ZodEnum" || r === "ZodNativeEnum" || r === "ZodUnion" ? "select" : r === "ZodArray" ? "array" : r === "ZodObject" ? "object" : "unknown";
584
+ }
585
+ function Te(e) {
586
+ const o = {}, r = e._def.typeName;
587
+ if (r === "ZodOptional" || r === "ZodDefault" || r === "ZodNullable" || r === "ZodCatch")
588
+ return Te(e._def.innerType);
589
+ if (r === "ZodString") {
590
+ const t = e;
591
+ if (t._def.checks)
592
+ for (const n of t._def.checks)
593
+ n.kind === "min" && (o.minLength = n.value), n.kind === "max" && (o.maxLength = n.value), n.kind === "email" && (o.email = !0), n.kind === "url" && (o.url = !0), n.kind === "regex" && (o.pattern = n.regex.source);
594
+ }
595
+ if (r === "ZodNumber") {
596
+ const t = e;
597
+ if (t._def.checks)
598
+ for (const n of t._def.checks)
599
+ n.kind === "min" && (o.min = n.value), n.kind === "max" && (o.max = n.value);
600
+ }
601
+ if (r === "ZodArray") {
602
+ const t = e;
603
+ t._def.minLength && (o.minLength = t._def.minLength.value), t._def.maxLength && (o.maxLength = t._def.maxLength.value), t._def.exactLength && (o.minLength = t._def.exactLength.value, o.maxLength = t._def.exactLength.value);
604
+ }
605
+ return o;
606
+ }
607
+ function we(e) {
608
+ const o = e._def.typeName;
609
+ if (o === "ZodOptional" || o === "ZodDefault" || o === "ZodNullable" || o === "ZodCatch")
610
+ return we(e._def.innerType);
611
+ if (o === "ZodEnum")
612
+ return e._def.values.map((t) => ({
613
+ value: t,
614
+ label: t.charAt(0).toUpperCase() + t.slice(1)
615
+ // Capitalize first letter
616
+ }));
617
+ if (o === "ZodNativeEnum") {
618
+ const t = e._def.values;
619
+ return Object.entries(t).map(([n, i]) => ({
620
+ value: i,
621
+ label: n
622
+ }));
623
+ }
624
+ if (o === "ZodUnion") {
625
+ const r = e, t = [];
626
+ for (const n of r._def.options)
627
+ if (n._def.typeName === "ZodLiteral") {
628
+ const i = n._def.value;
629
+ t.push({
630
+ value: i,
631
+ label: String(i).charAt(0).toUpperCase() + String(i).slice(1)
632
+ });
633
+ }
634
+ return t.length > 0 ? t : void 0;
635
+ }
636
+ }
637
+ function Le(e) {
638
+ const o = e._def.typeName;
639
+ if (o === "ZodDefault") {
640
+ const r = e;
641
+ return typeof r._def.defaultValue == "function" ? r._def.defaultValue() : r._def.defaultValue;
642
+ }
643
+ if (o === "ZodOptional" || o === "ZodNullable")
644
+ return Le(e._def.innerType);
645
+ }
646
+ function go(e) {
647
+ const o = e._def.typeName;
648
+ return !(o === "ZodOptional" || o === "ZodNullable" || o === "ZodDefault");
649
+ }
650
+ function bo(e, o) {
651
+ const r = g(o.description), t = q(o), n = Te(o), i = go(o), c = Le(o), u = we(o);
652
+ let s = o;
653
+ for (; s._def.typeName === "ZodOptional" || s._def.typeName === "ZodDefault" || s._def.typeName === "ZodNullable" || s._def.typeName === "ZodCatch"; )
654
+ s = s._def.innerType;
655
+ let l, h;
656
+ if (t === "array" && s._def.typeName === "ZodArray") {
657
+ l = s._def.type;
658
+ const v = de(l);
659
+ v._def.typeName === "ZodObject" && (h = ye(v));
660
+ }
661
+ let p;
662
+ return t === "object" && s._def.typeName === "ZodObject" && (p = ye(s)), {
663
+ name: e,
664
+ type: t,
665
+ required: i,
666
+ defaultValue: c,
667
+ options: u,
668
+ validation: n,
669
+ itemSchema: l,
670
+ itemProperties: h,
671
+ properties: p,
672
+ ...r
673
+ };
674
+ }
675
+ function ye(e) {
676
+ const o = e.shape, r = {};
677
+ for (const [t, n] of Object.entries(o))
678
+ r[t] = bo(t, n);
679
+ return r;
680
+ }
681
+ function Ae(e, o, r, t = []) {
682
+ const n = [], i = [...t, e].join("."), c = g(o.description);
683
+ if (c.hidden)
684
+ return n;
685
+ c.label || n.push({
686
+ field: i,
687
+ issue: "missing-label",
688
+ message: `Field "${i}" is missing .zodLabel() annotation. All visible fields must have labels.`
689
+ });
690
+ const u = de(o), s = u._def.typeName;
691
+ if ((s === "ZodAny" || s === "ZodUnknown") && n.push({
692
+ field: i,
693
+ issue: "invalid-type",
694
+ message: `Field "${i}" uses z.any() or z.unknown() without .zodHidden(). These types must be hidden from forms.`
695
+ }), s === "ZodEffects" && n.push({
696
+ field: i,
697
+ issue: "invalid-type",
698
+ message: `Field "${i}" uses a ZodEffects type (.refine()/.transform()/z.custom()) without .zodHidden(). The form generator can't render these; hide the field or use a mappable type.`
699
+ }), s === "ZodObject") {
700
+ const l = mo(
701
+ u,
702
+ r,
703
+ [...t, e]
704
+ );
705
+ n.push(...l);
706
+ }
707
+ return n;
708
+ }
709
+ function mo(e, o, r) {
710
+ const t = [], n = e.shape;
711
+ for (const [i, c] of Object.entries(n)) {
712
+ const u = Ae(i, c, o, r);
713
+ t.push(...u);
714
+ }
715
+ return t;
716
+ }
717
+ function vo(e, o) {
718
+ const r = [];
719
+ if (!(e instanceof a.ZodObject))
720
+ return r.push({
721
+ field: "_root",
722
+ issue: "invalid-type",
723
+ message: `Component "${o}" schema must be a ZodObject (z.object({...})). Received: ${e.constructor.name}`
724
+ }), { valid: !1, errors: r };
725
+ const t = e.shape;
726
+ for (const [n, i] of Object.entries(t)) {
727
+ const c = Ae(n, i, o);
728
+ r.push(...c);
729
+ }
730
+ return {
731
+ valid: r.length === 0,
732
+ errors: r
733
+ };
734
+ }
735
+ function I(e, o) {
736
+ const r = vo(e, o);
737
+ if (!r.valid) {
738
+ const t = r.errors.map((n) => ` • ${n.field}: ${n.message}`).join(`
739
+ `);
740
+ throw new TypeError(
741
+ `Component "${o}" schema validation failed:
742
+ ${t}
743
+
744
+ All visible fields must have .zodLabel() annotations. Use .zodHidden() for fields managed by the designer (like children, style, etc.)`
745
+ );
746
+ }
747
+ return e;
748
+ }
749
+ const D = a.enum(["rounded", "square"]), Oe = a.enum(["left", "center", "right"]), Ne = a.enum(["light", "dark", "neutral"]), _e = a.enum(["h2", "h3", "h4"]), yo = a.enum(["outline", "solid"]), xo = a.enum(["connected", "separated"]), ko = a.enum(["left", "right"]), zo = a.enum(["down", "center"]), xe = 10, Ro = a.object({
750
+ id: a.string().zodHidden(),
751
+ title: a.string().max(100).zodLabel("Title").zodHelp("Title displayed on the accordion header"),
752
+ content: a.string().zodRichText().zodLabel("Content").zodHelp("Content shown when the accordion is expanded")
753
+ }), Co = a.object({
754
+ title: a.string().optional().zodTextarea().zodLabel("Heading text (optional)").zodHelp("Optional heading displayed above the accordion list"),
755
+ // `.default(x).optional()` (optional outermost) is intentional: the default is applied
756
+ // by the component and `AccordionDefaultProps`, not by schema `.parse()`.
757
+ variant: _e.default("h2").optional().zodLabel("Heading level").zodHelp("Semantic heading level - determines text size automatically"),
758
+ supportingText: a.string().optional().zodTextarea().zodLabel("Supporting text (optional)").zodHelp("Optional paragraph content below the heading"),
759
+ items: a.array(Ro).max(xe).zodLabel(`Accordions (up to ${xe})`).zodItemLabel("title").zodItemName("Accordion").zodManageLayer("Accordions").zodHelp("List of accordion sections"),
760
+ accordionStyle: yo.default("outline").optional().zodLabel("Style").zodHelp("Outline shows a border; Solid fills the header background"),
761
+ colorTheme: Ne.default("light").optional().zodLabel("Color theme").zodHelp("Light uses the primary color; Dark uses inverse; Neutral uses grey"),
762
+ connection: xo.default("connected").optional().zodLabel("Connection").zodHelp("Connected joins accordion items together; Separated adds spacing"),
763
+ cornerStyle: D.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded or square corners for the accordion"),
764
+ dropdownPlacement: ko.default("left").optional().zodLabel("Dropdown placement").zodHelp("Place the expand/collapse icon on the left or right"),
765
+ dropdownDirection: zo.default("down").optional().zodLabel("Dropdown direction").zodHelp("Down points the chevron down when collapsed; Center points it sideways")
766
+ }), ae = {
767
+ variant: "h2",
768
+ items: [
769
+ { id: "accordion-default-1", title: "", content: "" },
770
+ { id: "accordion-default-2", title: "", content: "" },
771
+ { id: "accordion-default-3", title: "", content: "" }
772
+ ],
773
+ accordionStyle: "outline",
774
+ colorTheme: "light",
775
+ connection: "connected",
776
+ cornerStyle: "rounded",
777
+ dropdownPlacement: "left",
778
+ dropdownDirection: "down"
779
+ };
780
+ for (const e of ae.items)
781
+ Object.freeze(e);
782
+ Object.freeze(ae.items);
783
+ Object.freeze(ae);
784
+ const yt = I(
785
+ Co,
786
+ "Accordion"
787
+ ), So = {
788
+ background: "transparent",
789
+ borderWidth: "0",
790
+ borderColor: void 0
791
+ }, To = {
792
+ light: {
793
+ background: "brand",
794
+ borderWidth: "0",
795
+ borderColor: void 0,
796
+ textColor: "primary-inverse"
797
+ },
798
+ dark: {
799
+ background: "primary-inverse",
800
+ borderWidth: "0",
801
+ borderColor: void 0,
802
+ textColor: "primary-inverse"
803
+ },
804
+ neutral: { background: "secondary", borderWidth: "0", borderColor: void 0 }
805
+ }, wo = {
806
+ light: { background: "transparent", borderWidth: "small", borderColor: "brand" },
807
+ dark: { background: "transparent", borderWidth: "small", borderColor: "primary" },
808
+ neutral: { background: "transparent", borderWidth: "small", borderColor: "secondary" }
809
+ };
810
+ function Lo(e, o) {
811
+ switch (e) {
812
+ case "fill":
813
+ return To[o];
814
+ case "outline":
815
+ return wo[o];
816
+ default:
817
+ return So;
818
+ }
819
+ }
820
+ function Ao(e, o, r, t) {
821
+ const n = {
822
+ borderRadius: r === "rounded" ? "large" : "0",
823
+ padding: "medium"
824
+ }, i = o === "neutral" ? void 0 : Z(t, o);
825
+ if (i) {
826
+ if (e === "fill")
827
+ return w(ie(i), n);
828
+ if (e === "outline")
829
+ return w(Se(i, "small"), n);
830
+ }
831
+ return w({ decoration: Lo(e, o) }, n);
832
+ }
833
+ function xt({
834
+ content: e,
835
+ textStyle: o = "outline",
836
+ colorTheme: r = "light",
837
+ cornerStyle: t = "rounded"
838
+ }) {
839
+ const n = _(), { translations: i } = E(), c = X(), { view: u, text: s } = O(
840
+ () => Ao(o, r, t, c),
841
+ [o, r, t, c]
842
+ ), l = n && !e, h = O(() => Re(e), [e]);
843
+ return /* @__PURE__ */ d(f, { as: "div", ...u, className: "bce-block bce-block-text", children: /* @__PURE__ */ d("div", { style: N, children: l ? /* @__PURE__ */ d(z, { color: s.color, themeOverride: s.themeOverride, children: i.placeholderContent }) : /* @__PURE__ */ d(z, { as: "div", color: s.color, themeOverride: s.themeOverride, children: /* @__PURE__ */ d(
844
+ "div",
845
+ {
846
+ dangerouslySetInnerHTML: { __html: h }
847
+ }
848
+ ) }) }) });
849
+ }
850
+ const Oo = a.enum(["none", "outline", "fill"]), No = a.object({
851
+ content: a.string().zodRichText().zodLabel("Content").zodHelp("Rich text content with inline formatting support"),
852
+ // `.default(x).optional()` (optional outermost) is intentional: it keeps the field
853
+ // optional in the inferred props so callers may omit it; the default is applied by the
854
+ // component and `TextDefaultProps`, not by schema `.parse()`.
855
+ textStyle: Oo.default("outline").optional().zodLabel("Style").zodHelp("None removes decoration; Outline shows a border; Fill adds a background color"),
856
+ colorTheme: Ne.default("light").optional().zodLabel("Color theme").zodHelp("Light uses a subtle emphasis; Dark uses a strong emphasis; Neutral uses grey"),
857
+ cornerStyle: D.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners (only applies when a style is selected)")
858
+ }), kt = {
859
+ content: "",
860
+ textStyle: "outline",
861
+ colorTheme: "light",
862
+ cornerStyle: "rounded"
863
+ }, zt = I(No, "Text"), _o = {
864
+ none: { background: "transparent", borderWidth: "0", borderColor: void 0 },
865
+ light: { background: "brand", borderWidth: "0", borderColor: void 0 },
866
+ dark: {
867
+ background: "primary-inverse",
868
+ borderWidth: "0",
869
+ borderColor: void 0,
870
+ textColor: "primary-inverse"
871
+ }
872
+ };
873
+ function Eo(e, o, r) {
874
+ const t = {
875
+ borderRadius: o === "rounded" ? "large" : "0",
876
+ padding: "medium"
877
+ }, n = e === "light" ? "light" : e === "dark" ? "dark" : void 0, i = n && Z(r, n);
878
+ return w(i ? ie(i) : { decoration: _o[e] }, t);
879
+ }
880
+ function Rt({
881
+ title: e,
882
+ variant: o,
883
+ subtitle: r,
884
+ content: t,
885
+ headerStyle: n = "none",
886
+ cornerStyle: i = "rounded"
887
+ }) {
888
+ const c = _(), { translations: u } = E(), s = X(), { view: l, text: h } = O(
889
+ () => Eo(n, i, s),
890
+ [n, i, s]
891
+ ), p = c && !e && !r && !t, b = p ? u.bannerPlaceholderTitle : e, v = p ? u.bannerPlaceholderSubtitle : r, k = p ? void 0 : t;
892
+ return /* @__PURE__ */ d(f, { as: "div", ...l, className: "bce-block bce-block-banner", children: /* @__PURE__ */ S("div", { style: N, children: [
893
+ v && /* @__PURE__ */ d(
894
+ z,
895
+ {
896
+ as: "div",
897
+ size: "small",
898
+ weight: "bold",
899
+ transform: "uppercase",
900
+ letterSpacing: "expanded",
901
+ color: h.color,
902
+ themeOverride: h.themeOverride,
903
+ children: v
904
+ }
905
+ ),
906
+ /* @__PURE__ */ d(ne, { level: o, color: h.color, themeOverride: h.themeOverride, children: b }),
907
+ k && /* @__PURE__ */ d(z, { as: "div", color: h.color, themeOverride: h.themeOverride, children: k })
908
+ ] }) });
909
+ }
910
+ const Io = a.enum(["none", "light", "dark"]), Do = a.object({
911
+ title: a.string().zodTextarea().zodLabel("Heading text").zodHelp("Main heading text for this section"),
912
+ variant: _e.default("h2").zodLabel("Heading level").zodHelp("Semantic heading level - determines text size automatically"),
913
+ subtitle: a.string().optional().zodTextarea().zodLabel("Eyebrow text (optional)").zodHelp("Optional small text displayed above the main title"),
914
+ content: a.string().optional().zodTextarea().zodLabel("Supporting text (optional)").zodHelp("Optional paragraph content below title"),
915
+ // `.default(x).optional()` (optional outermost) is intentional: it keeps defaulted
916
+ // style fields optional in the inferred props so callers may omit them; the default is
917
+ // applied by the component and `BannerDefaultProps`, not by schema `.parse()`.
918
+ //
919
+ // Schema-internal field name is kept as `headerStyle` (the canvas-horizon
920
+ // original) even though the block/component was renamed to Banner, so the
921
+ // host data contract is preserved.
922
+ headerStyle: Io.default("none").optional().zodLabel("Color").zodHelp("None: transparent; Light: secondary color; Dark: primary color with white text"),
923
+ cornerStyle: D.default("rounded").optional().zodLabel("Corners").zodHelp("Choose between rounded or sharp square corners")
924
+ }), Ct = {
925
+ title: "",
926
+ variant: "h2",
927
+ headerStyle: "none",
928
+ cornerStyle: "rounded"
929
+ }, St = I(Do, "Banner"), ke = { background: "secondary", borderWidth: "0", borderColor: void 0 }, Po = {
930
+ background: "transparent",
931
+ borderWidth: "none none none large",
932
+ borderColor: "brand"
933
+ }, Ho = { background: "transparent", borderWidth: "0", borderColor: void 0 };
934
+ function Mo(e, o, r) {
935
+ const t = o === "rounded" ? "large" : "0";
936
+ switch (e) {
937
+ case "background-secondary": {
938
+ const n = Z(r, "light"), i = n ? ie(n) : { decoration: ke };
939
+ return w(i, { borderRadius: t, padding: "medium" });
940
+ }
941
+ case "background-grey":
942
+ return w({ decoration: ke }, { borderRadius: t, padding: "medium" });
943
+ case "border-primary": {
944
+ const n = Z(r, "dark"), i = n ? Se(n, "none none none large") : { decoration: Po };
945
+ return w(i, { borderRadius: "0", padding: "0 0 0 small" });
946
+ }
947
+ default:
948
+ return w({ decoration: Ho }, { borderRadius: t, padding: "0" });
949
+ }
950
+ }
951
+ function Tt({
952
+ content: e,
953
+ author: o,
954
+ decorationStyle: r = "background-secondary",
955
+ cornerStyle: t = "rounded"
956
+ }) {
957
+ const n = _(), { translations: i } = E(), c = X(), { view: u, text: s } = O(
958
+ () => Mo(r, t, c),
959
+ [r, t, c]
960
+ ), l = n && !e && !o, h = l ? i.quotePlaceholderContent : e, p = l ? i.quotePlaceholderAuthor : o;
961
+ return /* @__PURE__ */ d(f, { as: "div", ...u, className: "bce-block bce-block-quote", children: /* @__PURE__ */ S("div", { style: N, children: [
962
+ /* @__PURE__ */ S(
963
+ z,
964
+ {
965
+ as: "blockquote",
966
+ size: "x-large",
967
+ weight: "bold",
968
+ fontStyle: "italic",
969
+ lineHeight: "double",
970
+ color: s.color,
971
+ themeOverride: s.themeOverride,
972
+ children: [
973
+ '"',
974
+ h,
975
+ '"'
976
+ ]
977
+ }
978
+ ),
979
+ p && /* @__PURE__ */ d(f, { as: "div", textAlign: "end", children: /* @__PURE__ */ S(z, { as: "cite", size: "small", color: s.color, themeOverride: s.themeOverride, children: [
980
+ "– ",
981
+ p
982
+ ] }) })
983
+ ] }) });
984
+ }
985
+ const Zo = a.enum([
986
+ "none",
987
+ "background-secondary",
988
+ "background-grey",
989
+ "border-primary"
990
+ ]), Bo = a.object({
991
+ content: a.string().zodTextarea().zodLabel("Quote Content").zodHelp("The main text of the quotation"),
992
+ author: a.string().optional().zodLabel("Author").zodHelp("Optional attribution for the quote"),
993
+ // `.default(x).optional()` (optional outermost) is intentional: it keeps the field
994
+ // optional in the inferred props so callers may omit it; the default is applied by the
995
+ // component and `QuoteDefaultProps`, not by schema `.parse()`.
996
+ decorationStyle: Zo.default("background-secondary").optional().zodLabel("Style").zodHelp("Choose background or border styling for the quote block"),
997
+ cornerStyle: D.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
998
+ }), wt = {
999
+ content: "",
1000
+ decorationStyle: "background-secondary",
1001
+ cornerStyle: "rounded"
1002
+ }, Lt = I(Bo, "Quote");
1003
+ function Vo(e) {
1004
+ return {
1005
+ background: "secondary",
1006
+ borderRadius: e === "rounded" ? "large" : "0",
1007
+ padding: "medium"
1008
+ };
1009
+ }
1010
+ function At({ code: e, language: o, header: r, cornerStyle: t = "rounded" }) {
1011
+ const n = _(), { translations: i } = E(), c = Vo(t), s = n && !e ? i.codeBlockPlaceholder : e;
1012
+ return /* @__PURE__ */ d(f, { as: "div", className: "bce-block bce-block-codeblock", children: /* @__PURE__ */ S("div", { style: N, children: [
1013
+ r && /* @__PURE__ */ d(f, { as: "div", margin: "0 0 small 0", children: /* @__PURE__ */ d(ne, { level: "h4", children: r }) }),
1014
+ /* @__PURE__ */ S(f, { as: "div", ...c, children: [
1015
+ o && /* @__PURE__ */ d(f, { as: "div", margin: "0 0 x-small 0", children: /* @__PURE__ */ d(z, { as: "div", size: "small", weight: "bold", transform: "uppercase", color: "secondary", children: o }) }),
1016
+ /* @__PURE__ */ d("pre", { style: { margin: 0, whiteSpace: "pre", overflow: "auto" }, children: /* @__PURE__ */ d("code", { children: s }) })
1017
+ ] })
1018
+ ] }) });
1019
+ }
1020
+ const jo = a.enum([
1021
+ "javascript",
1022
+ "json",
1023
+ "html",
1024
+ "css",
1025
+ "bash",
1026
+ "yaml",
1027
+ "text"
1028
+ ]), Wo = a.object({
1029
+ code: a.string().zodCodeEditor().zodLabel("Code").zodHelp("The code content to display"),
1030
+ // Unknown languages fall back to 'text'; an absent value defaults to 'javascript'
1031
+ // (matches the canvas-horizon original). `.optional()` sits inside `.default()`
1032
+ // so `parse({ code })` yields `'javascript'` rather than `undefined` — which
1033
+ // also makes the inferred `language` required.
1034
+ language: jo.catch("text").optional().default("javascript").zodLabel("Language").zodHelp("Programming language shown as a label above the code"),
1035
+ header: a.string().optional().zodLabel("Header").zodHelp("Optional heading displayed above the code block"),
1036
+ // `.default(x).optional()` (optional outermost) keeps this optional in the inferred
1037
+ // props; the default is applied by the component and `CodeBlockDefaultProps`, not by
1038
+ // `.parse()`. (Contrast `language` above, which needs its value present after parse
1039
+ // and so orders `.optional().default()`.)
1040
+ cornerStyle: D.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
1041
+ }), Ot = {
1042
+ code: "",
1043
+ language: "javascript",
1044
+ cornerStyle: "rounded"
1045
+ }, Nt = I(
1046
+ Wo,
1047
+ "CodeBlock"
1048
+ ), $o = () => ({ isLoading: !1, isError: !0 }), Uo = () => ({ isLoading: !1, isError: !0 }), se = G({}), _t = se.Provider, qo = (e) => (B(se).useImageUrl ?? $o)(e), Go = (e) => (B(se).useVideoUrl ?? Uo)(e), Xo = ["http:", "https:"];
1049
+ function re(e) {
1050
+ if (!e) return !1;
1051
+ const o = e.replace(/[\t\n\r]/g, "");
1052
+ if (!o || o.startsWith("//")) return !1;
1053
+ if (o.startsWith("/")) return !o.includes("\\");
1054
+ try {
1055
+ return Xo.includes(new URL(o).protocol);
1056
+ } catch {
1057
+ return !1;
1058
+ }
1059
+ }
1060
+ function A({
1061
+ text: e,
1062
+ subtitle: o,
1063
+ variant: r = "empty",
1064
+ borderRadius: t = "medium"
1065
+ }) {
1066
+ const n = r === "processing" ? "secondary" : "primary", i = r !== "empty";
1067
+ return /* @__PURE__ */ d(
1068
+ f,
1069
+ {
1070
+ as: "div",
1071
+ background: n,
1072
+ borderRadius: t,
1073
+ padding: "large",
1074
+ textAlign: "center",
1075
+ "aria-live": i ? "polite" : void 0,
1076
+ "aria-atomic": i ? !0 : void 0,
1077
+ children: /* @__PURE__ */ d("div", { style: N, children: r === "loading" ? /* @__PURE__ */ d(Ge, { size: "small", renderTitle: e }) : r === "processing" ? /* @__PURE__ */ S(ze, { children: [
1078
+ /* @__PURE__ */ d(z, { as: "div", children: e }),
1079
+ o && /* @__PURE__ */ d(z, { as: "p", color: "secondary", children: o })
1080
+ ] }) : /* @__PURE__ */ d(z, { color: r === "error" ? "danger" : "secondary", children: e }) })
1081
+ }
1082
+ );
1083
+ }
1084
+ const Ee = {
1085
+ left: "start",
1086
+ center: "center",
1087
+ right: "end"
1088
+ }, Qo = {
1089
+ square: "1 / 1",
1090
+ circle: "1 / 1",
1091
+ landscape: "3 / 2",
1092
+ portrait: "3 / 4"
1093
+ };
1094
+ function Ko(e, o, r, t) {
1095
+ return {
1096
+ textAlign: Ee[o],
1097
+ width: `${r}%`,
1098
+ aspectRatio: Qo[e],
1099
+ borderRadius: e === "circle" ? "circle" : t === "rounded" ? "large" : "0"
1100
+ };
1101
+ }
1102
+ function Et({
1103
+ asset_id: e,
1104
+ isDecorative: o = !1,
1105
+ alt: r,
1106
+ size: t = 100,
1107
+ ratio: n = "square",
1108
+ align: i = "left",
1109
+ cornerStyle: c = "rounded"
1110
+ }) {
1111
+ const u = _(), { translations: s } = E(), { url: l, isLoading: h, isError: p } = qo(e), b = Ko(n, i, t, c), v = () => e ? h ? /* @__PURE__ */ d(
1112
+ A,
1113
+ {
1114
+ borderRadius: b.borderRadius,
1115
+ variant: "loading",
1116
+ text: s.imageBlockLoading
1117
+ }
1118
+ ) : p || !re(l) ? /* @__PURE__ */ d(
1119
+ A,
1120
+ {
1121
+ borderRadius: b.borderRadius,
1122
+ variant: "error",
1123
+ text: s.imageBlockError
1124
+ }
1125
+ ) : /* @__PURE__ */ d(
1126
+ f,
1127
+ {
1128
+ as: "span",
1129
+ display: "inline-block",
1130
+ width: b.width,
1131
+ maxWidth: "100%",
1132
+ borderRadius: b.borderRadius,
1133
+ overflowX: "hidden",
1134
+ overflowY: "hidden",
1135
+ children: /* @__PURE__ */ d("div", { style: { aspectRatio: b.aspectRatio, width: "100%" }, children: /* @__PURE__ */ d(
1136
+ qe,
1137
+ {
1138
+ src: l,
1139
+ alt: o ? "" : r,
1140
+ role: o ? "presentation" : void 0,
1141
+ display: "block",
1142
+ width: "100%",
1143
+ height: "100%",
1144
+ constrain: "cover"
1145
+ }
1146
+ ) })
1147
+ }
1148
+ ) : u ? /* @__PURE__ */ d(
1149
+ A,
1150
+ {
1151
+ borderRadius: b.borderRadius,
1152
+ text: s.imageBlockPlaceholder
1153
+ }
1154
+ ) : null;
1155
+ return /* @__PURE__ */ d(f, { as: "div", className: "bce-block bce-block-image", textAlign: b.textAlign, children: v() });
1156
+ }
1157
+ const Yo = a.enum(["square", "circle", "landscape", "portrait"]), Jo = a.object({
1158
+ // Opaque host asset id; the host resolves it to a file via the asset context.
1159
+ asset_id: a.string().zodLabel("Image").zodImage(),
1160
+ isDecorative: a.boolean().default(!1).zodLabel("Image is decorative"),
1161
+ alt: a.string().zodLabel("Alt text").zodPlaceholder("Describe the image...").zodAltText().zodDisabledWhen({ field: "isDecorative", value: !0 }),
1162
+ size: a.number().min(20).max(100).default(100).zodRange({ min: 20, max: 100, step: 10, formatValue: "%" }).zodLabel("Size").zodHelp("Image width as percentage"),
1163
+ ratio: Yo.default("square").zodLabel("Image Ratio").zodHelp("Aspect ratio for the image display"),
1164
+ align: Oe.default("left").zodLabel("Alignment").zodHelp("Horizontal alignment of the image"),
1165
+ cornerStyle: D.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
1166
+ }), It = {
1167
+ asset_id: "",
1168
+ isDecorative: !1,
1169
+ alt: "",
1170
+ size: 100,
1171
+ ratio: "square",
1172
+ align: "left",
1173
+ cornerStyle: "rounded"
1174
+ }, Dt = I(
1175
+ Jo,
1176
+ "ImageBlock"
1177
+ ), Fo = "16 / 9";
1178
+ function Ie(e, o, r) {
1179
+ return {
1180
+ textAlign: Ee[e],
1181
+ width: `${o}%`,
1182
+ aspectRatio: Fo,
1183
+ borderRadius: r === "rounded" ? "large" : "0"
1184
+ };
1185
+ }
1186
+ const et = /^(?:https?:\/\/)?(?:[\w-]+\.)*(?:youtube\.com\/(?:watch\?v=|embed\/|v\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?![\w-])/, ot = /^(?:https?:\/\/)?(?:[\w-]+\.)*vimeo\.com\/(?:video\/)?(\d+)(?![\w-])/;
1187
+ function tt(e) {
1188
+ const o = e.match(et);
1189
+ if (o)
1190
+ return `https://www.youtube.com/embed/${o[1]}`;
1191
+ const r = e.match(ot);
1192
+ return r ? `https://player.vimeo.com/video/${r[1]}` : null;
1193
+ }
1194
+ function Pt({
1195
+ source: e = "file",
1196
+ asset_id: o,
1197
+ video_url: r,
1198
+ alt: t,
1199
+ size: n = 100,
1200
+ align: i = "center",
1201
+ cornerStyle: c = "rounded"
1202
+ }) {
1203
+ const u = _(), { translations: s } = E(), { url: l, displayName: h, mediaEntryId: p, isLoading: b, isProcessing: v, isError: k } = Go(
1204
+ e === "file" ? o : ""
1205
+ ), y = Ie(i, n, c), R = (P, V, K, j) => /* @__PURE__ */ d(
1206
+ f,
1207
+ {
1208
+ as: "span",
1209
+ display: "inline-block",
1210
+ width: y.width,
1211
+ maxWidth: "100%",
1212
+ borderRadius: y.borderRadius,
1213
+ overflowX: "hidden",
1214
+ overflowY: "hidden",
1215
+ children: /* @__PURE__ */ d("div", { style: { aspectRatio: y.aspectRatio, width: "100%", position: "relative" }, children: /* @__PURE__ */ d(
1216
+ "iframe",
1217
+ {
1218
+ src: P,
1219
+ title: V,
1220
+ allow: K,
1221
+ allowFullScreen: !0,
1222
+ loading: "lazy",
1223
+ referrerPolicy: "strict-origin-when-cross-origin",
1224
+ "data-media-id": j,
1225
+ style: { position: "absolute", inset: 0, width: "100%", height: "100%", border: "none" }
1226
+ }
1227
+ ) })
1228
+ }
1229
+ ), L = () => u ? /* @__PURE__ */ d(
1230
+ A,
1231
+ {
1232
+ borderRadius: y.borderRadius,
1233
+ text: s.videoBlockPlaceholder
1234
+ }
1235
+ ) : null, Q = () => {
1236
+ if (e === "link") {
1237
+ if (!r)
1238
+ return L();
1239
+ const P = tt(r);
1240
+ return re(P) ? R(
1241
+ P,
1242
+ t || s.videoBlockTitle,
1243
+ "autoplay; encrypted-media; picture-in-picture; fullscreen"
1244
+ ) : /* @__PURE__ */ d(
1245
+ A,
1246
+ {
1247
+ borderRadius: y.borderRadius,
1248
+ variant: "error",
1249
+ text: s.videoBlockUnsupportedProvider
1250
+ }
1251
+ );
1252
+ }
1253
+ return o ? b ? /* @__PURE__ */ d(
1254
+ A,
1255
+ {
1256
+ borderRadius: y.borderRadius,
1257
+ variant: "loading",
1258
+ text: s.videoBlockLoading
1259
+ }
1260
+ ) : v ? /* @__PURE__ */ d(
1261
+ A,
1262
+ {
1263
+ borderRadius: y.borderRadius,
1264
+ variant: "processing",
1265
+ text: s.videoBlockProcessing,
1266
+ subtitle: s.videoBlockProcessingSubtitle
1267
+ }
1268
+ ) : k || !re(l) ? /* @__PURE__ */ d(
1269
+ A,
1270
+ {
1271
+ borderRadius: y.borderRadius,
1272
+ variant: "error",
1273
+ text: s.videoBlockError
1274
+ }
1275
+ ) : R(
1276
+ l,
1277
+ t || h || s.videoBlockTitle,
1278
+ "fullscreen",
1279
+ p
1280
+ ) : L();
1281
+ };
1282
+ return /* @__PURE__ */ d(f, { as: "div", className: "bce-block bce-block-video", textAlign: y.textAlign, children: Q() });
1283
+ }
1284
+ function Ht({
1285
+ size: e = 100,
1286
+ align: o = "center",
1287
+ cornerStyle: r = "rounded"
1288
+ }) {
1289
+ const t = Ie(o, e, r);
1290
+ return /* @__PURE__ */ d(f, { as: "div", textAlign: t.textAlign, children: /* @__PURE__ */ d(
1291
+ f,
1292
+ {
1293
+ as: "span",
1294
+ display: "inline-block",
1295
+ width: t.width,
1296
+ maxWidth: "100%",
1297
+ borderRadius: t.borderRadius,
1298
+ background: "secondary",
1299
+ overflowX: "hidden",
1300
+ overflowY: "hidden",
1301
+ children: /* @__PURE__ */ d(
1302
+ "div",
1303
+ {
1304
+ style: {
1305
+ aspectRatio: t.aspectRatio,
1306
+ width: "100%",
1307
+ display: "flex",
1308
+ alignItems: "center",
1309
+ justifyContent: "center"
1310
+ },
1311
+ children: /* @__PURE__ */ d(z, { color: "secondary", children: "Video" })
1312
+ }
1313
+ )
1314
+ }
1315
+ ) });
1316
+ }
1317
+ const rt = a.enum(["file", "link"]), nt = a.object({
1318
+ // How the video is supplied: an uploaded file (resolved via the asset context)
1319
+ // or an external link (YouTube/Vimeo). Set by the editor, not shown as a field.
1320
+ source: rt.default("file").zodHidden(),
1321
+ // Opaque host asset id; the host resolves it to a playable URL via the asset context.
1322
+ asset_id: a.string().zodLabel("Video").zodVideo(),
1323
+ video_url: a.string().optional().zodHidden(),
1324
+ alt: a.string().zodLabel("Alt Text").zodHelp("Required for accessibility"),
1325
+ size: a.number().min(20).max(100).default(100).zodRange({ min: 20, max: 100, step: 10, formatValue: "%" }).zodLabel("Size").zodHelp("Video width as percentage"),
1326
+ align: Oe.default("center").zodLabel("Alignment").zodHelp("Horizontal alignment of the video"),
1327
+ // `.default(x).optional()` (optional outermost) keeps this optional in the inferred
1328
+ // props; the default is applied by the component and `VideoBlockDefaultProps`, not by
1329
+ // schema `.parse()`.
1330
+ cornerStyle: D.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
1331
+ }), Mt = {
1332
+ source: "file",
1333
+ asset_id: "",
1334
+ video_url: "",
1335
+ alt: "",
1336
+ size: 100,
1337
+ align: "center",
1338
+ cornerStyle: "rounded"
1339
+ }, Zt = I(
1340
+ nt,
1341
+ "VideoBlock"
1342
+ );
1343
+ export {
1344
+ vt as Accordion,
1345
+ ae as AccordionDefaultProps,
1346
+ Rt as Banner,
1347
+ Ct as BannerDefaultProps,
1348
+ se as BlockEditorApiContext,
1349
+ _t as BlockEditorApiProvider,
1350
+ Xe as BrandColorContext,
1351
+ At as CodeBlock,
1352
+ Ot as CodeBlockDefaultProps,
1353
+ Qe as DesignerModeContext,
1354
+ fo as FormFieldType,
1355
+ Et as ImageBlock,
1356
+ It as ImageBlockDefaultProps,
1357
+ Tt as Quote,
1358
+ wt as QuoteDefaultProps,
1359
+ yt as RegisteredAccordionPropsSchema,
1360
+ St as RegisteredBannerPropsSchema,
1361
+ Nt as RegisteredCodeBlockPropsSchema,
1362
+ Dt as RegisteredImageBlockPropsSchema,
1363
+ Lt as RegisteredQuotePropsSchema,
1364
+ zt as RegisteredTextPropsSchema,
1365
+ Zt as RegisteredVideoBlockPropsSchema,
1366
+ xt as Text,
1367
+ kt as TextDefaultProps,
1368
+ mt as TranslationsProvider,
1369
+ Pt as VideoBlock,
1370
+ Mt as VideoBlockDefaultProps,
1371
+ Ht as VideoBlockDragPreview,
1372
+ q as deriveFieldType,
1373
+ bo as extractFieldMetadata,
1374
+ ye as extractFormMetadata,
1375
+ Te as extractValidationRules,
1376
+ g as parseDescription,
1377
+ I as registerComponentSchema,
1378
+ de as unwrapZodType,
1379
+ X as useBrandColor,
1380
+ _ as useDesignerMode,
1381
+ qo as useImageUrl,
1382
+ E as useTranslations,
1383
+ Go as useVideoUrl,
1384
+ vo as validateComponentSchema
1385
+ };