@instructure/platform-block-content-editor 0.3.1 → 1.0.0

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 (201) hide show
  1. package/dist/components/MediaPlaceholder/MediaPlaceholder.d.ts.map +1 -1
  2. package/dist/components/RichText/RichText.d.ts +20 -0
  3. package/dist/components/RichText/RichText.d.ts.map +1 -0
  4. package/dist/components/RichText/index.d.ts +2 -0
  5. package/dist/components/RichText/index.d.ts.map +1 -0
  6. package/dist/components/blocks/Accordion/Accordion.d.ts.map +1 -1
  7. package/dist/components/blocks/Accordion/accordionTranslations.d.ts +15 -0
  8. package/dist/components/blocks/Accordion/accordionTranslations.d.ts.map +1 -0
  9. package/dist/components/blocks/Accordion/createAccordionBlock.d.ts +22 -0
  10. package/dist/components/blocks/Accordion/createAccordionBlock.d.ts.map +1 -0
  11. package/dist/components/blocks/Accordion/index.d.ts +2 -0
  12. package/dist/components/blocks/Accordion/index.d.ts.map +1 -1
  13. package/dist/components/blocks/Banner/Banner.d.ts.map +1 -1
  14. package/dist/components/blocks/Banner/bannerPropsSchema.d.ts +0 -2
  15. package/dist/components/blocks/Banner/bannerPropsSchema.d.ts.map +1 -1
  16. package/dist/components/blocks/Banner/bannerTranslations.d.ts +13 -0
  17. package/dist/components/blocks/Banner/bannerTranslations.d.ts.map +1 -0
  18. package/dist/components/blocks/Banner/createBannerBlock.d.ts +14 -0
  19. package/dist/components/blocks/Banner/createBannerBlock.d.ts.map +1 -0
  20. package/dist/components/blocks/Banner/getBannerViewProps.d.ts +2 -3
  21. package/dist/components/blocks/Banner/getBannerViewProps.d.ts.map +1 -1
  22. package/dist/components/blocks/Banner/index.d.ts +2 -0
  23. package/dist/components/blocks/Banner/index.d.ts.map +1 -1
  24. package/dist/components/blocks/CodeBlock/CodeBlock.d.ts.map +1 -1
  25. package/dist/components/blocks/CodeBlock/codeBlockPropsSchema.d.ts +2 -2
  26. package/dist/components/blocks/CodeBlock/codeBlockTranslations.d.ts +11 -0
  27. package/dist/components/blocks/CodeBlock/codeBlockTranslations.d.ts.map +1 -0
  28. package/dist/components/blocks/CodeBlock/createCodeBlock.d.ts +12 -0
  29. package/dist/components/blocks/CodeBlock/createCodeBlock.d.ts.map +1 -0
  30. package/dist/components/blocks/CodeBlock/index.d.ts +2 -0
  31. package/dist/components/blocks/CodeBlock/index.d.ts.map +1 -1
  32. package/dist/components/blocks/FlashCards/FlashCard.d.ts +21 -0
  33. package/dist/components/blocks/FlashCards/FlashCard.d.ts.map +1 -0
  34. package/dist/components/blocks/FlashCards/FlashCards.d.ts +4 -0
  35. package/dist/components/blocks/FlashCards/FlashCards.d.ts.map +1 -0
  36. package/dist/components/blocks/FlashCards/createFlashCardsBlock.d.ts +15 -0
  37. package/dist/components/blocks/FlashCards/createFlashCardsBlock.d.ts.map +1 -0
  38. package/dist/components/blocks/FlashCards/flashCardsPropsSchema.d.ts +60 -0
  39. package/dist/components/blocks/FlashCards/flashCardsPropsSchema.d.ts.map +1 -0
  40. package/dist/components/blocks/FlashCards/flashCardsStyles.d.ts +43 -0
  41. package/dist/components/blocks/FlashCards/flashCardsStyles.d.ts.map +1 -0
  42. package/dist/components/blocks/FlashCards/flashCardsTranslations.d.ts +34 -0
  43. package/dist/components/blocks/FlashCards/flashCardsTranslations.d.ts.map +1 -0
  44. package/dist/components/blocks/FlashCards/getFlashCardsViewProps.d.ts +23 -0
  45. package/dist/components/blocks/FlashCards/getFlashCardsViewProps.d.ts.map +1 -0
  46. package/dist/components/blocks/FlashCards/index.d.ts +5 -0
  47. package/dist/components/blocks/FlashCards/index.d.ts.map +1 -0
  48. package/dist/components/blocks/ImageBlock/ImageBlock.d.ts.map +1 -1
  49. package/dist/components/blocks/ImageBlock/createImageBlock.d.ts +15 -0
  50. package/dist/components/blocks/ImageBlock/createImageBlock.d.ts.map +1 -0
  51. package/dist/components/blocks/ImageBlock/getImageBlockViewProps.d.ts +3 -1
  52. package/dist/components/blocks/ImageBlock/getImageBlockViewProps.d.ts.map +1 -1
  53. package/dist/components/blocks/ImageBlock/imageBlockTranslations.d.ts +15 -0
  54. package/dist/components/blocks/ImageBlock/imageBlockTranslations.d.ts.map +1 -0
  55. package/dist/components/blocks/ImageBlock/index.d.ts +2 -0
  56. package/dist/components/blocks/ImageBlock/index.d.ts.map +1 -1
  57. package/dist/components/blocks/KnowledgeCheck/AnswerCard.d.ts +19 -0
  58. package/dist/components/blocks/KnowledgeCheck/AnswerCard.d.ts.map +1 -0
  59. package/dist/components/blocks/KnowledgeCheck/KnowledgeCheck.d.ts +4 -0
  60. package/dist/components/blocks/KnowledgeCheck/KnowledgeCheck.d.ts.map +1 -0
  61. package/dist/components/blocks/KnowledgeCheck/createKnowledgeCheckBlock.d.ts +18 -0
  62. package/dist/components/blocks/KnowledgeCheck/createKnowledgeCheckBlock.d.ts.map +1 -0
  63. package/dist/components/blocks/KnowledgeCheck/getKnowledgeCheckViewProps.d.ts +34 -0
  64. package/dist/components/blocks/KnowledgeCheck/getKnowledgeCheckViewProps.d.ts.map +1 -0
  65. package/dist/components/blocks/KnowledgeCheck/index.d.ts +5 -0
  66. package/dist/components/blocks/KnowledgeCheck/index.d.ts.map +1 -0
  67. package/dist/components/blocks/KnowledgeCheck/knowledgeCheckPropsSchema.d.ts +87 -0
  68. package/dist/components/blocks/KnowledgeCheck/knowledgeCheckPropsSchema.d.ts.map +1 -0
  69. package/dist/components/blocks/KnowledgeCheck/knowledgeCheckTranslations.d.ts +35 -0
  70. package/dist/components/blocks/KnowledgeCheck/knowledgeCheckTranslations.d.ts.map +1 -0
  71. package/dist/components/blocks/LayoutContainer/LayoutContainer.d.ts +3 -0
  72. package/dist/components/blocks/LayoutContainer/LayoutContainer.d.ts.map +1 -0
  73. package/dist/components/blocks/LayoutContainer/createLayoutContainerBlock.d.ts +22 -0
  74. package/dist/components/blocks/LayoutContainer/createLayoutContainerBlock.d.ts.map +1 -0
  75. package/dist/components/blocks/LayoutContainer/getLayoutContainerViewProps.d.ts +32 -0
  76. package/dist/components/blocks/LayoutContainer/getLayoutContainerViewProps.d.ts.map +1 -0
  77. package/dist/components/blocks/LayoutContainer/index.d.ts +5 -0
  78. package/dist/components/blocks/LayoutContainer/index.d.ts.map +1 -0
  79. package/dist/components/blocks/LayoutContainer/layoutContainerPropsSchema.d.ts +118 -0
  80. package/dist/components/blocks/LayoutContainer/layoutContainerPropsSchema.d.ts.map +1 -0
  81. package/dist/components/blocks/MixAndMatch/MatchCard.d.ts +21 -0
  82. package/dist/components/blocks/MixAndMatch/MatchCard.d.ts.map +1 -0
  83. package/dist/components/blocks/MixAndMatch/MixAndMatch.d.ts +4 -0
  84. package/dist/components/blocks/MixAndMatch/MixAndMatch.d.ts.map +1 -0
  85. package/dist/components/blocks/MixAndMatch/createMixAndMatchBlock.d.ts +15 -0
  86. package/dist/components/blocks/MixAndMatch/createMixAndMatchBlock.d.ts.map +1 -0
  87. package/dist/components/blocks/MixAndMatch/getMixAndMatchViewProps.d.ts +43 -0
  88. package/dist/components/blocks/MixAndMatch/getMixAndMatchViewProps.d.ts.map +1 -0
  89. package/dist/components/blocks/MixAndMatch/index.d.ts +5 -0
  90. package/dist/components/blocks/MixAndMatch/index.d.ts.map +1 -0
  91. package/dist/components/blocks/MixAndMatch/mixAndMatchPropsSchema.d.ts +74 -0
  92. package/dist/components/blocks/MixAndMatch/mixAndMatchPropsSchema.d.ts.map +1 -0
  93. package/dist/components/blocks/MixAndMatch/mixAndMatchStyles.d.ts +21 -0
  94. package/dist/components/blocks/MixAndMatch/mixAndMatchStyles.d.ts.map +1 -0
  95. package/dist/components/blocks/MixAndMatch/mixAndMatchTranslations.d.ts +37 -0
  96. package/dist/components/blocks/MixAndMatch/mixAndMatchTranslations.d.ts.map +1 -0
  97. package/dist/components/blocks/Quote/Quote.d.ts.map +1 -1
  98. package/dist/components/blocks/Quote/createQuoteBlock.d.ts +12 -0
  99. package/dist/components/blocks/Quote/createQuoteBlock.d.ts.map +1 -0
  100. package/dist/components/blocks/Quote/index.d.ts +2 -0
  101. package/dist/components/blocks/Quote/index.d.ts.map +1 -1
  102. package/dist/components/blocks/Quote/quoteTranslations.d.ts +13 -0
  103. package/dist/components/blocks/Quote/quoteTranslations.d.ts.map +1 -0
  104. package/dist/components/blocks/TabsBlock/TabsBlock.d.ts +4 -0
  105. package/dist/components/blocks/TabsBlock/TabsBlock.d.ts.map +1 -0
  106. package/dist/components/blocks/TabsBlock/createTabsBlock.d.ts +25 -0
  107. package/dist/components/blocks/TabsBlock/createTabsBlock.d.ts.map +1 -0
  108. package/dist/components/blocks/TabsBlock/getTabsBlockViewProps.d.ts +55 -0
  109. package/dist/components/blocks/TabsBlock/getTabsBlockViewProps.d.ts.map +1 -0
  110. package/dist/components/blocks/TabsBlock/index.d.ts +6 -0
  111. package/dist/components/blocks/TabsBlock/index.d.ts.map +1 -0
  112. package/dist/components/blocks/TabsBlock/tabsBlockPropsSchema.d.ts +127 -0
  113. package/dist/components/blocks/TabsBlock/tabsBlockPropsSchema.d.ts.map +1 -0
  114. package/dist/components/blocks/TabsBlock/tabsBlockTranslations.d.ts +13 -0
  115. package/dist/components/blocks/TabsBlock/tabsBlockTranslations.d.ts.map +1 -0
  116. package/dist/components/blocks/TabsBlock/useRovingTabIndex.d.ts +20 -0
  117. package/dist/components/blocks/TabsBlock/useRovingTabIndex.d.ts.map +1 -0
  118. package/dist/components/blocks/Text/Text.d.ts.map +1 -1
  119. package/dist/components/blocks/Text/createTextBlock.d.ts +12 -0
  120. package/dist/components/blocks/Text/createTextBlock.d.ts.map +1 -0
  121. package/dist/components/blocks/Text/index.d.ts +2 -0
  122. package/dist/components/blocks/Text/index.d.ts.map +1 -1
  123. package/dist/components/blocks/Text/textPropsSchema.d.ts +3 -3
  124. package/dist/components/blocks/Text/textTranslations.d.ts +11 -0
  125. package/dist/components/blocks/Text/textTranslations.d.ts.map +1 -0
  126. package/dist/components/blocks/TwoColumn/TwoColumn.d.ts +3 -0
  127. package/dist/components/blocks/TwoColumn/TwoColumn.d.ts.map +1 -0
  128. package/dist/components/blocks/TwoColumn/createTwoColumnBlock.d.ts +14 -0
  129. package/dist/components/blocks/TwoColumn/createTwoColumnBlock.d.ts.map +1 -0
  130. package/dist/components/blocks/TwoColumn/getTwoColumnViewProps.d.ts +17 -0
  131. package/dist/components/blocks/TwoColumn/getTwoColumnViewProps.d.ts.map +1 -0
  132. package/dist/components/blocks/TwoColumn/index.d.ts +5 -0
  133. package/dist/components/blocks/TwoColumn/index.d.ts.map +1 -0
  134. package/dist/components/blocks/TwoColumn/twoColumnPropsSchema.d.ts +60 -0
  135. package/dist/components/blocks/TwoColumn/twoColumnPropsSchema.d.ts.map +1 -0
  136. package/dist/components/blocks/TwoColumn/twoColumnStyles.d.ts +13 -0
  137. package/dist/components/blocks/TwoColumn/twoColumnStyles.d.ts.map +1 -0
  138. package/dist/components/blocks/VideoBlock/VideoBlock.d.ts.map +1 -1
  139. package/dist/components/blocks/VideoBlock/createVideoBlock.d.ts +15 -0
  140. package/dist/components/blocks/VideoBlock/createVideoBlock.d.ts.map +1 -0
  141. package/dist/components/blocks/VideoBlock/index.d.ts +3 -1
  142. package/dist/components/blocks/VideoBlock/index.d.ts.map +1 -1
  143. package/dist/components/blocks/VideoBlock/videoBlockTranslations.d.ts +23 -0
  144. package/dist/components/blocks/VideoBlock/videoBlockTranslations.d.ts.map +1 -0
  145. package/dist/components/blocks/WidgetBlock/WidgetBlock.d.ts +8 -0
  146. package/dist/components/blocks/WidgetBlock/WidgetBlock.d.ts.map +1 -0
  147. package/dist/components/blocks/WidgetBlock/WidgetErrorBoundary.d.ts +36 -0
  148. package/dist/components/blocks/WidgetBlock/WidgetErrorBoundary.d.ts.map +1 -0
  149. package/dist/components/blocks/WidgetBlock/createWidgetBlock.d.ts +14 -0
  150. package/dist/components/blocks/WidgetBlock/createWidgetBlock.d.ts.map +1 -0
  151. package/dist/components/blocks/WidgetBlock/index.d.ts +5 -0
  152. package/dist/components/blocks/WidgetBlock/index.d.ts.map +1 -0
  153. package/dist/components/blocks/WidgetBlock/widgetBlockPropsSchema.d.ts +26 -0
  154. package/dist/components/blocks/WidgetBlock/widgetBlockPropsSchema.d.ts.map +1 -0
  155. package/dist/components/blocks/WidgetBlock/widgetBlockTranslations.d.ts +18 -0
  156. package/dist/components/blocks/WidgetBlock/widgetBlockTranslations.d.ts.map +1 -0
  157. package/dist/components/blocks/commonSchemas.d.ts +13 -0
  158. package/dist/components/blocks/commonSchemas.d.ts.map +1 -1
  159. package/dist/components/blocks/commonViewProps.d.ts +23 -1
  160. package/dist/components/blocks/commonViewProps.d.ts.map +1 -1
  161. package/dist/components/blocks/richTextTableStyles.d.ts +10 -0
  162. package/dist/components/blocks/richTextTableStyles.d.ts.map +1 -0
  163. package/dist/contexts/BlockEditorApiContext.d.ts +61 -4
  164. package/dist/contexts/BlockEditorApiContext.d.ts.map +1 -1
  165. package/dist/contexts/BlockTranslationsContext.d.ts +47 -0
  166. package/dist/contexts/BlockTranslationsContext.d.ts.map +1 -0
  167. package/dist/contexts/RichTextRendererContext.d.ts +21 -0
  168. package/dist/contexts/RichTextRendererContext.d.ts.map +1 -0
  169. package/dist/index.d.ts +13 -2
  170. package/dist/index.d.ts.map +1 -1
  171. package/dist/index.js +3139 -758
  172. package/dist/registry/blockCatalogue.d.ts +108 -0
  173. package/dist/registry/blockCatalogue.d.ts.map +1 -0
  174. package/dist/registry/blockRegistry.d.ts +67 -0
  175. package/dist/registry/blockRegistry.d.ts.map +1 -0
  176. package/dist/registry/defineBlock.d.ts +55 -0
  177. package/dist/registry/defineBlock.d.ts.map +1 -0
  178. package/dist/registry/getMergedProps.d.ts +18 -0
  179. package/dist/registry/getMergedProps.d.ts.map +1 -0
  180. package/dist/registry/index.d.ts +7 -0
  181. package/dist/registry/index.d.ts.map +1 -0
  182. package/dist/registry/registryTypes.test.d.ts +1 -0
  183. package/dist/registry/registryTypes.test.d.ts.map +1 -0
  184. package/dist/registry/resolveBlockEntry.d.ts +16 -0
  185. package/dist/registry/resolveBlockEntry.d.ts.map +1 -0
  186. package/dist/registry/templateTypes.d.ts +61 -0
  187. package/dist/registry/templateTypes.d.ts.map +1 -0
  188. package/dist/schema/zodExtensions.d.ts +15 -0
  189. package/dist/schema/zodExtensions.d.ts.map +1 -1
  190. package/dist/utils/shuffleCards.d.ts +6 -0
  191. package/dist/utils/shuffleCards.d.ts.map +1 -0
  192. package/dist/utils/useMotionEnabled.d.ts +11 -0
  193. package/dist/utils/useMotionEnabled.d.ts.map +1 -0
  194. package/dist/viewer/Viewer.d.ts +27 -0
  195. package/dist/viewer/Viewer.d.ts.map +1 -0
  196. package/dist/viewer/index.d.ts +2 -0
  197. package/dist/viewer/index.d.ts.map +1 -0
  198. package/locales/en.json +44 -1
  199. package/package.json +39 -24
  200. package/dist/contexts/TranslationsContext.d.ts +0 -70
  201. package/dist/contexts/TranslationsContext.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,38 +1,70 @@
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
1
+ import { jsx as i, jsxs as w, Fragment as ye } from "react/jsx-runtime";
2
+ import { Flex as k } from "@instructure/ui-flex";
3
+ import { Heading as ke } from "@instructure/ui-heading";
4
+ import { Text as S } from "@instructure/ui-text";
5
+ import { ToggleDetails as So } from "@instructure/ui-toggle-details";
6
+ import { View as v } from "@instructure/ui-view";
7
+ import { createContext as we, useContext as pe, useMemo as ee, useState as j, createElement as mt, useCallback as J, useId as jt, useRef as re, useEffect as ve, useLayoutEffect as zo, Children as Ro, Component as Io } from "react";
8
+ import { sanitizeHtml as Lo } from "@instructure/platform-sanitize";
9
+ import { IconArrowOpenDownSolid as ft, IconArrowOpenEndSolid as Vt, IconArrowOpenUpSolid as Oo, IconArrowOpenStartSolid as No, IconCompleteSolid as Ft, IconTroubleSolid as Zt } from "@instructure/ui-icons";
10
+ import { z as s } from "zod";
11
+ import { css as Pe, Global as Be, useTheme as Eo, keyframes as Me } from "@instructure/emotion";
12
+ import { Img as Po } from "@instructure/ui-img";
13
+ import { Spinner as Bo } from "@instructure/ui-spinner";
14
+ import { IconButton as pt, Button as Ne } from "@instructure/ui-buttons";
15
+ import { ScreenReaderContent as et } from "@instructure/ui-a11y-content";
16
+ import { Alert as Mo } from "@instructure/ui-alerts";
17
+ import { ProgressBar as _o } from "@instructure/ui-progress";
18
+ import { Checkbox as $o } from "@instructure/ui-checkbox";
19
+ import { RadioInput as Ho } from "@instructure/ui-radio-input";
20
+ const Do = we(void 0), Wo = () => pe(Do);
21
+ function tt({ html: e, className: t }) {
22
+ const r = Wo(), o = ee(() => r ? null : Lo(e), [r, e]);
23
+ return r ? /* @__PURE__ */ i("div", { className: t, children: r(e) }) : /* @__PURE__ */ i(
24
+ "div",
25
+ {
26
+ className: t,
27
+ dangerouslySetInnerHTML: { __html: o ?? "" }
28
+ }
29
+ );
30
+ }
31
+ const jo = we(void 0), he = () => pe(jo), Vo = we(!1), le = () => pe(Vo), Gt = we(void 0);
32
+ function bt({
33
+ value: e,
34
+ children: t
20
35
  }) {
21
- const t = { translations: e, translate: o };
22
- return /* @__PURE__ */ d(Ce.Provider, { value: t, children: r });
36
+ return /* @__PURE__ */ i(Gt.Provider, { value: e, children: t });
23
37
  }
24
- function E() {
25
- const e = B(Ce);
26
- if (!e)
27
- throw new Error("useTranslations must be used within TranslationsProvider");
28
- return e;
38
+ function Fo(e, t) {
39
+ return t ? e.replace(
40
+ /%\{(\w+)\}/g,
41
+ (r, o) => o in t ? String(t[o]) : r
42
+ ) : e;
43
+ }
44
+ function Y(e) {
45
+ const t = pe(Gt);
46
+ return ee(() => {
47
+ const r = {};
48
+ if (t)
49
+ for (const [a, d] of Object.entries(t))
50
+ typeof d == "string" && (r[a] = d);
51
+ const o = { ...e, ...r }, n = o;
52
+ return {
53
+ translations: o,
54
+ translate: (a, d) => Fo(n[a] ?? a, d)
55
+ };
56
+ }, [e, t]);
29
57
  }
30
- const N = { overflowWrap: "break-word" };
31
- function Ke(e, o, r) {
32
- return Math.min(r, Math.max(o, e));
58
+ const Ut = {
59
+ accordionPlaceholder: "Add accordion...",
60
+ accordionItemPlaceholderTitle: "Accordion %{index}",
61
+ accordionItemPlaceholderContent: "Your content here..."
62
+ }, U = { overflowWrap: "break-word" };
63
+ function Zo(e, t, r) {
64
+ return Math.min(r, Math.max(t, e));
33
65
  }
34
- function ee(e) {
35
- const o = e.trim(), r = /^#?([\da-f]{3}|[\da-f]{6})$/i.exec(o);
66
+ function Ze(e) {
67
+ const t = e.trim(), r = /^#?([\da-f]{3}|[\da-f]{6})$/i.exec(t);
36
68
  if (r) {
37
69
  let n = r[1];
38
70
  return n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]), {
@@ -41,114 +73,114 @@ function ee(e) {
41
73
  b: Number.parseInt(n.slice(4, 6), 16)
42
74
  };
43
75
  }
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]) };
76
+ const o = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)$/i.exec(t);
77
+ if (o)
78
+ return { r: Number(o[1]), g: Number(o[2]), b: Number(o[3]) };
47
79
  throw new Error(`Unsupported color format: "${e}". Use hex or rgb()/rgba().`);
48
80
  }
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);
81
+ const Ge = (e) => Math.round(Zo(e, 0, 255)).toString(16).padStart(2, "0");
82
+ function gt({ r: e, g: t, b: r }) {
83
+ return `#${Ge(e)}${Ge(t)}${Ge(r)}`;
84
+ }
85
+ function Go({ r: e, g: t, b: r }) {
86
+ const o = e / 255, n = t / 255, a = r / 255, d = Math.max(o, n, a), c = Math.min(o, n, a), l = (d + c) / 2;
87
+ if (d === c)
88
+ return { h: 0, s: 0, l };
89
+ const u = d - c, h = l > 0.5 ? u / (2 - d - c) : u / (d + c);
90
+ let g;
91
+ switch (d) {
92
+ case o:
93
+ g = (n - a) / u + (n < a ? 6 : 0);
62
94
  break;
63
95
  case n:
64
- p = (i - t) / l + 2;
96
+ g = (a - o) / u + 2;
65
97
  break;
66
98
  default:
67
- p = (t - n) / l + 4;
99
+ g = (o - n) / u + 4;
68
100
  }
69
- return { h: p / 6, s: h, l: s };
101
+ return { h: g / 6, s: h, l };
70
102
  }
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 };
103
+ function Se(e, t, r) {
104
+ if (t === 0) {
105
+ const d = Math.round(r * 255);
106
+ return { r: d, g: d, b: d };
75
107
  }
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;
108
+ const o = (d, c, l) => {
109
+ let u = l;
110
+ return u < 0 && (u += 1), u > 1 && (u -= 1), u < 1 / 6 ? d + (c - d) * 6 * u : u < 1 / 2 ? c : u < 2 / 3 ? d + (c - d) * (2 / 3 - u) * 6 : d;
111
+ }, n = r < 0.5 ? r * (1 + t) : r + t - r * t, a = 2 * r - n;
80
112
  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)
113
+ r: Math.round(o(a, n, e + 1 / 3) * 255),
114
+ g: Math.round(o(a, n, e) * 255),
115
+ b: Math.round(o(a, n, e - 1 / 3) * 255)
84
116
  };
85
117
  }
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;
118
+ function vt({ r: e, g: t, b: r }) {
119
+ const o = (n) => {
120
+ const a = n / 255;
121
+ return a <= 0.03928 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
90
122
  };
91
- return 0.2126 * t(e) + 0.7152 * t(o) + 0.0722 * t(r);
123
+ return 0.2126 * o(e) + 0.7152 * o(t) + 0.0722 * o(r);
92
124
  }
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);
125
+ function be(e, t) {
126
+ const r = vt(e), o = vt(t), n = Math.max(r, o), a = Math.min(r, o);
127
+ return (n + 0.05) / (a + 0.05);
96
128
  }
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) {
129
+ const Uo = 0.9, Ct = 0.985, qo = 0.85, Xo = 0.55, yt = 0.03, kt = 5e-3, Yo = "#000000", Ko = "#FFFFFF", Ue = (e) => Math.round(e * 100) / 100;
130
+ function Qo(e, t) {
99
131
  const {
100
132
  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);
133
+ minVariantContrast: o,
134
+ darkText: n = Yo,
135
+ lightText: a = Ko,
136
+ lightLightness: d = Uo,
137
+ darkLightness: c = Xo
138
+ } = t, { h: l, s: u } = Go(Ze(e)), h = Ze(n), g = Ze(a), p = Math.min(u, qo);
139
+ let C = d, T = Se(l, p, C);
140
+ for (; be(h, T) < r && C < Ct; )
141
+ C = Math.min(Ct, C + kt), T = Se(l, p, C);
142
+ let I = c, x = Se(l, u, I);
143
+ const P = () => be(g, x) >= r && be(T, x) >= o;
144
+ for (; !P() && I > yt; )
145
+ I = Math.max(yt, I - kt), x = Se(l, u, I);
114
146
  return {
115
147
  light: {
116
- color: he(k),
148
+ color: gt(T),
117
149
  textColor: n,
118
- contrast: te(H(h, k))
150
+ contrast: Ue(be(h, T))
119
151
  },
120
152
  dark: {
121
- color: he(R),
122
- textColor: i,
123
- contrast: te(H(p, R))
153
+ color: gt(x),
154
+ textColor: a,
155
+ contrast: Ue(be(g, x))
124
156
  },
125
- variantContrast: te(H(k, R))
157
+ variantContrast: Ue(be(T, x))
126
158
  };
127
159
  }
128
- const me = {
160
+ const wt = {
129
161
  /** AA, normal-size text (below 18pt, or 14pt bold). */
130
162
  AA_NORMAL_TEXT: 4.5,
131
163
  /** 1.4.11, UI components and graphical objects against adjacent colors. */
132
164
  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
165
+ }, Jo = 0.3, er = "#273540";
166
+ function tr(e) {
167
+ return Qo(e, {
168
+ minTextContrast: wt.AA_NORMAL_TEXT,
169
+ minVariantContrast: wt.NON_TEXT,
170
+ darkLightness: Jo,
171
+ darkText: er
140
172
  });
141
173
  }
142
- function Z(e, o) {
174
+ function ue(e, t) {
143
175
  if (e)
144
176
  try {
145
- const { light: r, dark: t } = ao(e), n = o === "light" ? r : t;
177
+ const { light: r, dark: o } = tr(e), n = t === "light" ? r : o;
146
178
  return { color: n.color, textColor: n.textColor };
147
179
  } catch {
148
180
  return;
149
181
  }
150
182
  }
151
- function ie(e) {
183
+ function xe(e) {
152
184
  return {
153
185
  decoration: {
154
186
  background: "brand",
@@ -160,610 +192,601 @@ function ie(e) {
160
192
  textThemeOverride: { primaryColor: e.textColor }
161
193
  };
162
194
  }
163
- function Se(e, o) {
195
+ function qt(e, t) {
164
196
  return {
165
- decoration: { background: "transparent", borderWidth: o, borderColor: "brand" },
197
+ decoration: { background: "transparent", borderWidth: t, borderColor: "brand" },
166
198
  viewThemeOverride: { borderColorBrand: e.color }
167
199
  };
168
200
  }
169
- function w(e, o) {
170
- const { textColor: r, ...t } = e.decoration;
201
+ function de(e, t) {
202
+ const { textColor: r, ...o } = e.decoration;
171
203
  return {
172
204
  view: {
173
- ...t,
174
- borderRadius: o.borderRadius,
175
- padding: o.padding,
205
+ ...o,
206
+ borderRadius: t.borderRadius,
207
+ padding: t.padding,
176
208
  themeOverride: e.viewThemeOverride
177
209
  },
178
210
  text: { color: r, themeOverride: e.textThemeOverride }
179
211
  };
180
212
  }
181
- const $ = {
213
+ const ze = {
182
214
  light: { background: "brand", borderColor: "brand", inverseText: !0 },
183
215
  dark: { background: "primary-inverse", borderColor: "primary", inverseText: !0 },
184
216
  neutral: { background: "secondary", borderColor: "secondary", inverseText: !1 }
185
- }, so = {
217
+ }, or = {
186
218
  light: "brand",
187
219
  dark: "primary",
188
220
  neutral: "secondary"
189
- }, U = {
221
+ }, Ie = {
190
222
  togglePadding: "0",
191
223
  iconMargin: "0",
192
224
  toggleFocusBorderColor: "transparent"
193
- }, M = "small", co = (e, o) => {
194
- var r, t;
225
+ }, ge = "small", rr = (e, t) => {
226
+ var r, o;
195
227
  return {
196
- ...U,
197
- textColor: (t = (r = o.colors) == null ? void 0 : r.contrasts) == null ? void 0 : t.white1010
228
+ ...Ie,
229
+ textColor: (o = (r = t.colors) == null ? void 0 : r.contrasts) == null ? void 0 : o.white1010
198
230
  };
199
231
  };
200
- function lo(e, o, r) {
201
- const t = o === "neutral" ? void 0 : Z(r, o);
232
+ function nr(e, t, r) {
233
+ const o = t === "neutral" ? void 0 : ue(r, t);
202
234
  if (e === "solid")
203
235
  return {
204
- item: t ? {
236
+ item: o ? {
205
237
  background: "brand",
206
238
  borderColor: "brand",
207
- themeOverride: { backgroundBrand: t.color, borderColorBrand: t.color }
239
+ themeOverride: { backgroundBrand: o.color, borderColorBrand: o.color }
208
240
  } : {
209
- background: $[o].background,
210
- borderColor: $[o].borderColor
241
+ background: ze[t].background,
242
+ borderColor: ze[t].borderColor
211
243
  },
212
244
  // The ring sits on the fill, so it reuses the accessible color already paired with
213
245
  // that surface: the brand variant's own text color, or the inverse token when the
214
246
  // 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 },
247
+ header: o ? { padding: ge, themeOverride: { focusColorInfo: o.textColor } } : ze[t].inverseText ? { padding: ge, focusColor: "inverse" } : { padding: ge },
216
248
  // 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
249
+ content: { background: "primary", borderWidth: "0", padding: ge },
250
+ toggle: o ? { ...Ie, textColor: o.textColor } : ze[t].inverseText ? rr : Ie
219
251
  };
220
- const n = t ? "brand" : so[o], i = t ? { borderColorBrand: t.color } : void 0;
252
+ const n = o ? "brand" : or[t], a = o ? { borderColorBrand: o.color } : void 0;
221
253
  return {
222
- item: { background: "transparent", borderColor: n, themeOverride: i },
254
+ item: { background: "transparent", borderColor: n, themeOverride: a },
223
255
  // Transparent surface, so InstUI's default `info` ring already contrasts.
224
- header: { padding: M },
256
+ header: { padding: ge },
225
257
  content: {
226
258
  background: "transparent",
227
259
  borderColor: n,
228
260
  borderWidth: "small none none none",
229
- padding: M,
230
- themeOverride: i
261
+ padding: ge,
262
+ themeOverride: a
231
263
  },
232
- toggle: U
264
+ toggle: Ie
233
265
  };
234
266
  }
235
- function uo({
267
+ function ir({
236
268
  index: e,
237
- count: o,
269
+ count: t,
238
270
  connection: r,
239
- cornerStyle: t
271
+ cornerStyle: o
240
272
  }) {
241
- const n = t === "rounded" ? "large" : "0", i = e === 0, c = e === o - 1, u = `${n} ${n} 0 0`;
273
+ const n = o === "rounded" ? "large" : "0", a = e === 0, d = e === t - 1, c = `${n} ${n} 0 0`;
242
274
  return r === "separated" ? {
243
275
  borderWidth: "small",
244
276
  borderRadius: n,
245
- margin: i ? "none" : "small none none none",
277
+ margin: a ? "none" : "small none none none",
246
278
  contentBorderRadius: `0 0 ${n} ${n}`,
247
- headerBorderRadius: u
279
+ headerBorderRadius: c
248
280
  } : {
249
- borderWidth: i ? "small" : "none small small small",
250
- borderRadius: i && c ? n : i ? `${n} ${n} 0 0` : c ? `0 0 ${n} ${n}` : "0",
281
+ borderWidth: a ? "small" : "none small small small",
282
+ borderRadius: a && d ? n : a ? `${n} ${n} 0 0` : d ? `0 0 ${n} ${n}` : "0",
251
283
  margin: "none",
252
- contentBorderRadius: c ? `0 0 ${n} ${n}` : "0",
253
- headerBorderRadius: i ? u : "0"
284
+ contentBorderRadius: d ? `0 0 ${n} ${n}` : "0",
285
+ headerBorderRadius: a ? c : "0"
254
286
  };
255
287
  }
256
- function ho(e) {
257
- return e === "center" ? { closedIcon: $e, openIcon: ue } : { closedIcon: ue, openIcon: Ue };
288
+ function ar(e) {
289
+ return e === "center" ? { closedIcon: Vt, openIcon: ft } : { closedIcon: ft, openIcon: Oo };
258
290
  }
259
- function po(e) {
291
+ function dr(e) {
260
292
  return e === "right" ? "row" : "row-reverse";
261
293
  }
262
- const ve = () => /* @__PURE__ */ d(ze, {});
263
- function vt({
294
+ const xt = () => /* @__PURE__ */ i(ye, {});
295
+ function lr({
264
296
  title: e,
265
- variant: o = "h2",
297
+ variant: t = "h2",
266
298
  supportingText: r,
267
- items: t = [],
299
+ items: o = [],
268
300
  accordionStyle: n = "outline",
269
- colorTheme: i = "light",
270
- connection: c = "connected",
271
- cornerStyle: u = "rounded",
272
- dropdownPlacement: s = "left",
273
- dropdownDirection: l = "down",
301
+ colorTheme: a = "light",
302
+ connection: d = "connected",
303
+ cornerStyle: c = "rounded",
304
+ dropdownPlacement: l = "left",
305
+ dropdownDirection: u = "down",
274
306
  editingItemId: h
275
307
  }) {
276
- const p = _(), { translations: b, translate: v } = E(), k = X(), [y, R] = F(
308
+ const g = le(), { translations: p, translate: C } = Y(Ut), T = he(), [I, x] = j(
277
309
  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;
310
+ ), [P, G] = j(h), [M, D] = j(null);
311
+ h !== P && (G(h), x((N) => {
312
+ const f = new Set(N);
313
+ return P !== void 0 && f.delete(P), h !== void 0 && f.add(h), f;
282
314
  }));
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;
315
+ const F = (N) => {
316
+ x((f) => {
317
+ const y = new Set(f);
318
+ return y.has(N) ? y.delete(N) : y.add(N), y;
287
319
  });
288
320
  }, {
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 })
321
+ item: te,
322
+ header: q,
323
+ content: Z,
324
+ toggle: W
325
+ } = ee(
326
+ () => nr(n, a, T),
327
+ [n, a, T]
328
+ ), { closedIcon: K, openIcon: ae } = ee(
329
+ () => ar(u),
330
+ [u]
331
+ ), $ = dr(l), z = (e || r) && /* @__PURE__ */ w(v, { as: "div", margin: "none none medium none", children: [
332
+ e && /* @__PURE__ */ i(ke, { level: t, children: e }),
333
+ r && /* @__PURE__ */ i(S, { as: "p", color: "secondary", children: r })
306
334
  ] });
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,
335
+ return o.length === 0 ? /* @__PURE__ */ i(v, { as: "div", className: "bce-block bce-block-accordion", children: /* @__PURE__ */ w("div", { style: U, children: [
336
+ z,
337
+ g && /* @__PURE__ */ i(
338
+ v,
311
339
  {
312
340
  as: "div",
313
- ...j,
341
+ ...te,
314
342
  borderWidth: "small",
315
- borderRadius: u === "rounded" ? "large" : "0",
343
+ borderRadius: c === "rounded" ? "large" : "0",
316
344
  padding: "medium",
317
345
  textAlign: "center",
318
- children: /* @__PURE__ */ d(z, { color: "secondary", children: b.accordionPlaceholder })
346
+ children: /* @__PURE__ */ i(S, { color: "secondary", children: p.accordionPlaceholder })
319
347
  }
320
348
  )
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,
349
+ ] }) }) : /* @__PURE__ */ i(v, { as: "div", className: "bce-block bce-block-accordion", children: /* @__PURE__ */ w("div", { style: U, children: [
350
+ z,
351
+ o.map((N, f) => {
352
+ const y = ir({
353
+ index: f,
354
+ count: o.length,
355
+ connection: d,
356
+ cornerStyle: c
357
+ }), m = g && !N.title && !N.content, b = I.has(N.id);
358
+ return /* @__PURE__ */ i(
359
+ v,
332
360
  {
333
361
  as: "div",
334
- ...j,
335
- borderWidth: C.borderWidth,
336
- borderRadius: C.borderRadius,
337
- margin: C.margin,
338
- children: /* @__PURE__ */ d(
339
- We,
362
+ ...te,
363
+ borderWidth: y.borderWidth,
364
+ borderRadius: y.borderRadius,
365
+ margin: y.margin,
366
+ children: /* @__PURE__ */ i(
367
+ So,
340
368
  {
341
369
  variant: "default",
342
370
  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,
371
+ expanded: b,
372
+ onToggle: () => F(N.id),
373
+ onFocus: () => D(N.id),
374
+ onBlur: () => D(null),
375
+ icon: xt,
376
+ iconExpanded: xt,
377
+ themeOverride: W,
378
+ summary: /* @__PURE__ */ i(
379
+ v,
352
380
  {
353
381
  as: "span",
354
382
  display: "block",
355
- ...De,
356
- borderRadius: Y ? C.headerBorderRadius : C.borderRadius,
357
- withFocusOutline: P === m.id,
383
+ ...q,
384
+ borderRadius: b ? y.headerBorderRadius : y.borderRadius,
385
+ withFocusOutline: M === N.id,
358
386
  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, {}) })
387
+ children: /* @__PURE__ */ w(k, { direction: $, gap: "x-small", children: [
388
+ /* @__PURE__ */ i(k.Item, { shouldGrow: !0, shouldShrink: !0, children: m ? C("accordionItemPlaceholderTitle", { index: f + 1 }) : N.title }),
389
+ /* @__PURE__ */ i(k.Item, { children: b ? /* @__PURE__ */ i(ae, {}) : /* @__PURE__ */ i(K, {}) })
362
390
  ] })
363
391
  }
364
392
  ),
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
- ) })
393
+ children: /* @__PURE__ */ i(v, { as: "div", ...Z, borderRadius: y.contentBorderRadius, children: m ? /* @__PURE__ */ i(S, { color: "secondary", children: p.accordionItemPlaceholderContent }) : /* @__PURE__ */ i(tt, { html: N.content }) })
371
394
  }
372
395
  )
373
396
  },
374
- m.id
397
+ N.id
375
398
  );
376
399
  })
377
400
  ] }) });
378
401
  }
379
- function g(e) {
402
+ function V(e) {
380
403
  if (!e)
381
404
  return {};
382
405
  try {
383
- const o = JSON.parse(e);
384
- if (typeof o == "object" && o !== null)
385
- return o;
406
+ const t = JSON.parse(e);
407
+ if (typeof t == "object" && t !== null)
408
+ return t;
386
409
  } catch {
387
410
  return { description: e };
388
411
  }
389
412
  return {};
390
413
  }
391
- function x(e) {
414
+ function X(e) {
392
415
  return JSON.stringify(e);
393
416
  }
394
- a.ZodType.prototype.zodLabel = function(e) {
395
- const o = g(this.description);
417
+ s.ZodType.prototype.zodLabel = function(e) {
418
+ const t = V(this.description);
396
419
  return this.describe(
397
- x({
398
- ...o,
420
+ X({
421
+ ...t,
399
422
  label: e
400
423
  })
401
424
  );
402
425
  };
403
- a.ZodType.prototype.zodPlaceholder = function(e) {
404
- const o = g(this.description);
426
+ s.ZodType.prototype.zodPlaceholder = function(e) {
427
+ const t = V(this.description);
405
428
  return this.describe(
406
- x({
407
- ...o,
429
+ X({
430
+ ...t,
408
431
  placeholder: e
409
432
  })
410
433
  );
411
434
  };
412
- a.ZodType.prototype.zodHelp = function(e) {
413
- const o = g(this.description);
435
+ s.ZodType.prototype.zodHelp = function(e) {
436
+ const t = V(this.description);
414
437
  return this.describe(
415
- x({
416
- ...o,
438
+ X({
439
+ ...t,
417
440
  help: e
418
441
  })
419
442
  );
420
443
  };
421
- a.ZodType.prototype.zodHidden = function(e = !0) {
422
- const o = g(this.description);
444
+ s.ZodType.prototype.zodHidden = function(e = !0) {
445
+ const t = V(this.description);
423
446
  return this.describe(
424
- x({
425
- ...o,
447
+ X({
448
+ ...t,
426
449
  hidden: e
427
450
  })
428
451
  );
429
452
  };
430
- a.ZodType.prototype.zodTextarea = function(e = !0) {
431
- const o = g(this.description);
453
+ s.ZodType.prototype.zodTextarea = function(e = !0) {
454
+ const t = V(this.description);
432
455
  return this.describe(
433
- x({
434
- ...o,
456
+ X({
457
+ ...t,
435
458
  textarea: e
436
459
  })
437
460
  );
438
461
  };
439
- a.ZodType.prototype.zodRichText = function(e = !0) {
440
- const o = g(this.description);
462
+ s.ZodType.prototype.zodRichText = function(e = !0) {
463
+ const t = V(this.description);
441
464
  return this.describe(
442
- x({
443
- ...o,
465
+ X({
466
+ ...t,
444
467
  richtext: e
445
468
  })
446
469
  );
447
470
  };
448
- a.ZodType.prototype.zodRange = function(e) {
449
- const o = g(this.description);
471
+ s.ZodType.prototype.zodRange = function(e) {
472
+ const t = V(this.description);
450
473
  return this.describe(
451
- x({
452
- ...o,
474
+ X({
475
+ ...t,
453
476
  range: e
454
477
  })
455
478
  );
456
479
  };
457
- a.ZodType.prototype.zodCodeEditor = function(e = !0) {
458
- const o = g(this.description);
480
+ s.ZodType.prototype.zodCodeEditor = function(e = !0) {
481
+ const t = V(this.description);
459
482
  return this.describe(
460
- x({
461
- ...o,
483
+ X({
484
+ ...t,
462
485
  codeeditor: e
463
486
  })
464
487
  );
465
488
  };
466
- a.ZodType.prototype.zodImage = function(e = !0) {
467
- const o = g(this.description);
489
+ s.ZodType.prototype.zodImage = function(e = !0) {
490
+ const t = V(this.description);
468
491
  return this.describe(
469
- x({
470
- ...o,
492
+ X({
493
+ ...t,
471
494
  image: e
472
495
  })
473
496
  );
474
497
  };
475
- a.ZodType.prototype.zodVideo = function(e = !0) {
476
- const o = g(this.description);
498
+ s.ZodType.prototype.zodVideo = function(e = !0) {
499
+ const t = V(this.description);
477
500
  return this.describe(
478
- x({
479
- ...o,
501
+ X({
502
+ ...t,
480
503
  video: e
481
504
  })
482
505
  );
483
506
  };
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
507
+ s.ZodType.prototype.zodHiddenWhen = function(e) {
508
+ const t = V(this.description), r = t.hiddenWhen;
509
+ let o;
510
+ return r ? o = [...Array.isArray(r) ? r : [r], e] : o = e, this.describe(
511
+ X({
512
+ ...t,
513
+ hiddenWhen: o
491
514
  })
492
515
  );
493
516
  };
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
517
+ s.ZodType.prototype.zodDisabledWhen = function(e) {
518
+ const t = V(this.description), r = t.disabledWhen;
519
+ let o;
520
+ return r ? o = [...Array.isArray(r) ? r : [r], e] : o = e, this.describe(
521
+ X({
522
+ ...t,
523
+ disabledWhen: o
501
524
  })
502
525
  );
503
526
  };
504
- a.ZodType.prototype.zodItemLabel = function(e) {
505
- const o = g(this.description);
527
+ s.ZodType.prototype.zodItemLabel = function(e) {
528
+ const t = V(this.description);
506
529
  return this.describe(
507
- x({
508
- ...o,
530
+ X({
531
+ ...t,
509
532
  itemLabel: e
510
533
  })
511
534
  );
512
535
  };
513
- a.ZodType.prototype.zodItemName = function(e) {
514
- const o = g(this.description);
536
+ s.ZodType.prototype.zodItemName = function(e) {
537
+ const t = V(this.description);
515
538
  return this.describe(
516
- x({
517
- ...o,
539
+ X({
540
+ ...t,
518
541
  itemName: e
519
542
  })
520
543
  );
521
544
  };
522
- a.ZodType.prototype.zodManageLayer = function(e) {
523
- const o = g(this.description);
545
+ s.ZodType.prototype.zodManageLayer = function(e) {
546
+ const t = V(this.description);
524
547
  return this.describe(
525
- x({
526
- ...o,
548
+ X({
549
+ ...t,
527
550
  manageLayer: e
528
551
  })
529
552
  );
530
553
  };
531
- a.ZodType.prototype.zodAnswers = function(e = !0) {
532
- const o = g(this.description);
554
+ s.ZodType.prototype.zodAnswers = function(e = !0) {
555
+ const t = V(this.description);
533
556
  return this.describe(
534
- x({
535
- ...o,
557
+ X({
558
+ ...t,
536
559
  answers: e
537
560
  })
538
561
  );
539
562
  };
540
- a.ZodType.prototype.zodAltText = function(e = !0) {
541
- const o = g(this.description);
563
+ s.ZodType.prototype.zodAltText = function(e = !0) {
564
+ const t = V(this.description);
542
565
  return this.describe(
543
- x({
544
- ...o,
566
+ X({
567
+ ...t,
545
568
  altText: e
546
569
  })
547
570
  );
548
571
  };
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)
572
+ function ot(e) {
573
+ const t = e._def.typeName;
574
+ return t === "ZodOptional" || t === "ZodDefault" || t === "ZodNullable" || t === "ZodCatch" ? ot(e._def.innerType) : e;
575
+ }
576
+ var sr = /* @__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))(sr || {});
577
+ function Le(e) {
578
+ const t = V(e.description);
579
+ if (t.range)
557
580
  return "range";
558
- if (o.textarea)
581
+ if (t.textarea)
559
582
  return "textarea";
560
- if (o.richtext)
583
+ if (t.richtext)
561
584
  return "richtext";
562
- if (o.codeeditor)
585
+ if (t.codeeditor)
563
586
  return "codeeditor";
564
- if (o.image)
587
+ if (t.image)
565
588
  return "image";
566
- if (o.video)
589
+ if (t.video)
567
590
  return "video";
568
- if (o.answers)
591
+ if (t.answers)
569
592
  return "answers";
570
- if (o.altText)
593
+ if (t.altText)
571
594
  return "alttext";
572
595
  const r = e._def.typeName;
573
596
  if (r === "ZodOptional" || r === "ZodDefault" || r === "ZodNullable" || r === "ZodCatch")
574
- return q(e._def.innerType);
597
+ return Le(e._def.innerType);
575
598
  if (r === "ZodString") {
576
- const t = e;
577
- if (t._def.checks) {
578
- for (const n of t._def.checks)
599
+ const o = e;
600
+ if (o._def.checks) {
601
+ for (const n of o._def.checks)
579
602
  if (n.kind === "email" || n.kind === "url") return "text";
580
603
  }
581
604
  return "text";
582
605
  }
583
606
  return r === "ZodNumber" ? "number" : r === "ZodBoolean" ? "boolean" : r === "ZodEnum" || r === "ZodNativeEnum" || r === "ZodUnion" ? "select" : r === "ZodArray" ? "array" : r === "ZodObject" ? "object" : "unknown";
584
607
  }
585
- function Te(e) {
586
- const o = {}, r = e._def.typeName;
608
+ function Xt(e) {
609
+ const t = {}, r = e._def.typeName;
587
610
  if (r === "ZodOptional" || r === "ZodDefault" || r === "ZodNullable" || r === "ZodCatch")
588
- return Te(e._def.innerType);
611
+ return Xt(e._def.innerType);
589
612
  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);
613
+ const o = e;
614
+ if (o._def.checks)
615
+ for (const n of o._def.checks)
616
+ n.kind === "min" && (t.minLength = n.value), n.kind === "max" && (t.maxLength = n.value), n.kind === "email" && (t.email = !0), n.kind === "url" && (t.url = !0), n.kind === "regex" && (t.pattern = n.regex.source);
594
617
  }
595
618
  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);
619
+ const o = e;
620
+ if (o._def.checks)
621
+ for (const n of o._def.checks)
622
+ n.kind === "min" && (t.min = n.value), n.kind === "max" && (t.max = n.value);
600
623
  }
601
624
  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);
625
+ const o = e;
626
+ o._def.minLength && (t.minLength = o._def.minLength.value), o._def.maxLength && (t.maxLength = o._def.maxLength.value), o._def.exactLength && (t.minLength = o._def.exactLength.value, t.maxLength = o._def.exactLength.value);
604
627
  }
605
- return o;
628
+ return t;
606
629
  }
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)
630
+ function Yt(e) {
631
+ const t = e._def.typeName;
632
+ if (t === "ZodOptional" || t === "ZodDefault" || t === "ZodNullable" || t === "ZodCatch")
633
+ return Yt(e._def.innerType);
634
+ if (t === "ZodEnum")
635
+ return e._def.values.map((o) => ({
636
+ value: o,
637
+ label: o.charAt(0).toUpperCase() + o.slice(1)
615
638
  // Capitalize first letter
616
639
  }));
617
- if (o === "ZodNativeEnum") {
618
- const t = e._def.values;
619
- return Object.entries(t).map(([n, i]) => ({
620
- value: i,
640
+ if (t === "ZodNativeEnum") {
641
+ const o = e._def.values;
642
+ return Object.entries(o).map(([n, a]) => ({
643
+ value: a,
621
644
  label: n
622
645
  }));
623
646
  }
624
- if (o === "ZodUnion") {
625
- const r = e, t = [];
647
+ if (t === "ZodUnion") {
648
+ const r = e, o = [];
626
649
  for (const n of r._def.options)
627
650
  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)
651
+ const a = n._def.value;
652
+ o.push({
653
+ value: a,
654
+ label: String(a).charAt(0).toUpperCase() + String(a).slice(1)
632
655
  });
633
656
  }
634
- return t.length > 0 ? t : void 0;
657
+ return o.length > 0 ? o : void 0;
635
658
  }
636
659
  }
637
- function Le(e) {
638
- const o = e._def.typeName;
639
- if (o === "ZodDefault") {
660
+ function Kt(e) {
661
+ const t = e._def.typeName;
662
+ if (t === "ZodDefault") {
640
663
  const r = e;
641
664
  return typeof r._def.defaultValue == "function" ? r._def.defaultValue() : r._def.defaultValue;
642
665
  }
643
- if (o === "ZodOptional" || o === "ZodNullable")
644
- return Le(e._def.innerType);
666
+ if (t === "ZodOptional" || t === "ZodNullable")
667
+ return Kt(e._def.innerType);
645
668
  }
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));
669
+ function cr(e) {
670
+ const t = e._def.typeName;
671
+ return !(t === "ZodOptional" || t === "ZodNullable" || t === "ZodDefault");
672
+ }
673
+ function ur(e, t) {
674
+ const r = V(t.description), o = Le(t), n = Xt(t), a = cr(t), d = Kt(t), c = Yt(t);
675
+ let l = t;
676
+ for (; l._def.typeName === "ZodOptional" || l._def.typeName === "ZodDefault" || l._def.typeName === "ZodNullable" || l._def.typeName === "ZodCatch"; )
677
+ l = l._def.innerType;
678
+ let u, h;
679
+ if (o === "array" && l._def.typeName === "ZodArray") {
680
+ u = l._def.type;
681
+ const C = ot(u);
682
+ C._def.typeName === "ZodObject" && (h = Tt(C));
660
683
  }
661
- let p;
662
- return t === "object" && s._def.typeName === "ZodObject" && (p = ye(s)), {
684
+ let g;
685
+ return o === "object" && l._def.typeName === "ZodObject" && (g = Tt(l)), {
663
686
  name: e,
664
- type: t,
665
- required: i,
666
- defaultValue: c,
667
- options: u,
687
+ type: o,
688
+ required: a,
689
+ defaultValue: d,
690
+ options: c,
668
691
  validation: n,
669
- itemSchema: l,
692
+ itemSchema: u,
670
693
  itemProperties: h,
671
- properties: p,
694
+ properties: g,
672
695
  ...r
673
696
  };
674
697
  }
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);
698
+ function Tt(e) {
699
+ const t = e.shape, r = {};
700
+ for (const [o, n] of Object.entries(t))
701
+ r[o] = ur(o, n);
679
702
  return r;
680
703
  }
681
- function Ae(e, o, r, t = []) {
682
- const n = [], i = [...t, e].join("."), c = g(o.description);
683
- if (c.hidden)
704
+ function Qt(e, t, r, o = []) {
705
+ const n = [], a = [...o, e].join("."), d = V(t.description);
706
+ if (d.hidden)
684
707
  return n;
685
- c.label || n.push({
686
- field: i,
708
+ d.label || n.push({
709
+ field: a,
687
710
  issue: "missing-label",
688
- message: `Field "${i}" is missing .zodLabel() annotation. All visible fields must have labels.`
711
+ message: `Field "${a}" is missing .zodLabel() annotation. All visible fields must have labels.`
689
712
  });
690
- const u = de(o), s = u._def.typeName;
691
- if ((s === "ZodAny" || s === "ZodUnknown") && n.push({
692
- field: i,
713
+ const c = ot(t), l = c._def.typeName;
714
+ if ((l === "ZodAny" || l === "ZodUnknown") && n.push({
715
+ field: a,
693
716
  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,
717
+ message: `Field "${a}" uses z.any() or z.unknown() without .zodHidden(). These types must be hidden from forms.`
718
+ }), l === "ZodEffects" && n.push({
719
+ field: a,
697
720
  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,
721
+ message: `Field "${a}" 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.`
722
+ }), l === "ZodObject") {
723
+ const u = hr(
724
+ c,
702
725
  r,
703
- [...t, e]
726
+ [...o, e]
704
727
  );
705
- n.push(...l);
728
+ n.push(...u);
706
729
  }
707
730
  return n;
708
731
  }
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);
732
+ function hr(e, t, r) {
733
+ const o = [], n = e.shape;
734
+ for (const [a, d] of Object.entries(n)) {
735
+ const c = Qt(a, d, t, r);
736
+ o.push(...c);
714
737
  }
715
- return t;
738
+ return o;
716
739
  }
717
- function vo(e, o) {
740
+ function mr(e, t) {
718
741
  const r = [];
719
- if (!(e instanceof a.ZodObject))
742
+ if (!(e instanceof s.ZodObject))
720
743
  return r.push({
721
744
  field: "_root",
722
745
  issue: "invalid-type",
723
- message: `Component "${o}" schema must be a ZodObject (z.object({...})). Received: ${e.constructor.name}`
746
+ message: `Component "${t}" schema must be a ZodObject (z.object({...})). Received: ${e.constructor.name}`
724
747
  }), { 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);
748
+ const o = e.shape;
749
+ for (const [n, a] of Object.entries(o)) {
750
+ const d = Qt(n, a, t);
751
+ r.push(...d);
729
752
  }
730
753
  return {
731
754
  valid: r.length === 0,
732
755
  errors: r
733
756
  };
734
757
  }
735
- function I(e, o) {
736
- const r = vo(e, o);
758
+ function ne(e, t) {
759
+ const r = mr(e, t);
737
760
  if (!r.valid) {
738
- const t = r.errors.map((n) => ` • ${n.field}: ${n.message}`).join(`
761
+ const o = r.errors.map((n) => ` • ${n.field}: ${n.message}`).join(`
739
762
  `);
740
763
  throw new TypeError(
741
- `Component "${o}" schema validation failed:
742
- ${t}
764
+ `Component "${t}" schema validation failed:
765
+ ${o}
743
766
 
744
767
  All visible fields must have .zodLabel() annotations. Use .zodHidden() for fields managed by the designer (like children, style, etc.)`
745
768
  );
746
769
  }
747
770
  return e;
748
771
  }
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"),
772
+ const se = s.enum(["rounded", "square"]), Jt = s.enum(["left", "center", "right"]), Te = s.enum(["light", "dark", "neutral"]), rt = s.enum(["h2", "h3", "h4"]), eo = s.enum(["none", "light", "dark"]), to = "None: transparent; Light: brand color; Dark: dark surface — both with contrasting text", fr = s.enum(["outline", "solid"]), pr = s.enum(["connected", "separated"]), br = s.enum(["left", "right"]), gr = s.enum(["down", "center"]), At = 10, vr = s.object({
773
+ id: s.string().zodHidden(),
774
+ title: s.string().max(100).zodLabel("Title").zodHelp("Title displayed on the accordion header"),
775
+ content: s.string().zodRichText().zodLabel("Content").zodHelp("Content shown when the accordion is expanded")
776
+ }), Cr = s.object({
777
+ title: s.string().optional().zodTextarea().zodLabel("Heading text (optional)").zodHelp("Optional heading displayed above the accordion list"),
755
778
  // `.default(x).optional()` (optional outermost) is intentional: the default is applied
756
779
  // 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 = {
780
+ variant: rt.default("h2").optional().zodLabel("Heading level").zodHelp("Semantic heading level - determines text size automatically"),
781
+ supportingText: s.string().optional().zodTextarea().zodLabel("Supporting text (optional)").zodHelp("Optional paragraph content below the heading"),
782
+ items: s.array(vr).max(At).zodLabel(`Accordions (up to ${At})`).zodItemLabel("title").zodItemName("Accordion").zodManageLayer("Accordions").zodHelp("List of accordion sections"),
783
+ accordionStyle: fr.default("outline").optional().zodLabel("Style").zodHelp("Outline shows a border; Solid fills the header background"),
784
+ colorTheme: Te.default("light").optional().zodLabel("Color theme").zodHelp("Light uses the primary color; Dark uses inverse; Neutral uses grey"),
785
+ connection: pr.default("connected").optional().zodLabel("Connection").zodHelp("Connected joins accordion items together; Separated adds spacing"),
786
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded or square corners for the accordion"),
787
+ dropdownPlacement: br.default("left").optional().zodLabel("Dropdown placement").zodHelp("Place the expand/collapse icon on the left or right"),
788
+ dropdownDirection: gr.default("down").optional().zodLabel("Dropdown direction").zodHelp("Down points the chevron down when collapsed; Center points it sideways")
789
+ }), _e = {
767
790
  variant: "h2",
768
791
  items: [
769
792
  { id: "accordion-default-1", title: "", content: "" },
@@ -777,18 +800,95 @@ const D = a.enum(["rounded", "square"]), Oe = a.enum(["left", "center", "right"]
777
800
  dropdownPlacement: "left",
778
801
  dropdownDirection: "down"
779
802
  };
780
- for (const e of ae.items)
803
+ for (const e of _e.items)
781
804
  Object.freeze(e);
782
- Object.freeze(ae.items);
783
- Object.freeze(ae);
784
- const yt = I(
785
- Co,
805
+ Object.freeze(_e.items);
806
+ Object.freeze(_e);
807
+ const yr = ne(
808
+ Cr,
786
809
  "Accordion"
787
- ), So = {
810
+ ), oe = {
811
+ LAYOUT: "layout",
812
+ ACTIVITY_CONTENT: "activityContent",
813
+ INTERACTIVE_CONTENT: "interactiveContent",
814
+ WIDGET: "widget"
815
+ }, oo = {
816
+ LayoutContainer: { category: oe.LAYOUT, acceptsChildren: !0 },
817
+ TwoColumn: { category: oe.LAYOUT, acceptsChildren: !0 },
818
+ Header: { category: oe.ACTIVITY_CONTENT, acceptsChildren: !1 },
819
+ Text: { category: oe.ACTIVITY_CONTENT, acceptsChildren: !1 },
820
+ QuoteBlock: { category: oe.ACTIVITY_CONTENT, acceptsChildren: !1 },
821
+ CodeBlock: { category: oe.ACTIVITY_CONTENT, acceptsChildren: !1 },
822
+ ImageBlock: { category: oe.ACTIVITY_CONTENT, acceptsChildren: !1 },
823
+ VideoBlock: { category: oe.ACTIVITY_CONTENT, acceptsChildren: !1 },
824
+ Accordion: { category: oe.INTERACTIVE_CONTENT, acceptsChildren: !1 },
825
+ TabsBlock: { category: oe.INTERACTIVE_CONTENT, acceptsChildren: !1 },
826
+ KnowledgeCheckBlock: {
827
+ category: oe.INTERACTIVE_CONTENT,
828
+ acceptsChildren: !1
829
+ },
830
+ FlashCards: { category: oe.INTERACTIVE_CONTENT, acceptsChildren: !1 },
831
+ MixAndMatch: { category: oe.INTERACTIVE_CONTENT, acceptsChildren: !1 },
832
+ WidgetBlock: { category: oe.WIDGET, acceptsChildren: !1 }
833
+ };
834
+ function ro(e) {
835
+ return Object.prototype.hasOwnProperty.call(oo, e);
836
+ }
837
+ function kr(e) {
838
+ return ro(e) ? "not-registered" : "unknown";
839
+ }
840
+ const wr = {};
841
+ function ie(e) {
842
+ const {
843
+ wireName: t,
844
+ component: r,
845
+ english: o,
846
+ schema: n,
847
+ defaultProps: a,
848
+ acceptsChildren: d,
849
+ renderDragPreview: c,
850
+ wrapsChildrenInGridCells: l
851
+ } = e, u = {
852
+ schema: n,
853
+ defaultProps: a,
854
+ // Catalogued blocks answer this from the catalogue, so a block file can't contradict
855
+ // it; a host's own block has no catalogue entry and says so itself.
856
+ acceptsChildren: ro(t) ? oo[t].acceptsChildren : d ?? !1,
857
+ ...c ? { renderDragPreview: c } : {},
858
+ ...l ? { wrapsChildrenInGridCells: !0 } : {}
859
+ };
860
+ return o ? ({ label: h, translations: g }) => {
861
+ const p = (C) => /* @__PURE__ */ i(bt, { value: g, children: mt(r, C) });
862
+ return p.displayName = `${t}WithTranslations`, { ...u, component: p, label: h };
863
+ } : ({ label: h }) => {
864
+ const g = (p) => /* @__PURE__ */ i(bt, { value: wr, children: mt(r, p) });
865
+ return g.displayName = `${t}WithoutTranslations`, { ...u, component: g, label: h };
866
+ };
867
+ }
868
+ const Ya = ie({
869
+ wireName: "Accordion",
870
+ component: lr,
871
+ schema: yr,
872
+ defaultProps: _e,
873
+ english: Ut
874
+ }), no = {
875
+ placeholderContent: "Your content here..."
876
+ }, Xe = "bce-rich-text", xr = Pe`
877
+ .${Xe} :is(td, th) {
878
+ padding: 4px 8px;
879
+ }
880
+ .${Xe} :is(td, th):empty::after {
881
+ content: '\\00a0';
882
+ }
883
+ `;
884
+ function Tr() {
885
+ return /* @__PURE__ */ i(Be, { styles: xr });
886
+ }
887
+ const Ar = {
788
888
  background: "transparent",
789
889
  borderWidth: "0",
790
890
  borderColor: void 0
791
- }, To = {
891
+ }, Sr = {
792
892
  light: {
793
893
  background: "brand",
794
894
  borderWidth: "0",
@@ -802,67 +902,83 @@ const yt = I(
802
902
  textColor: "primary-inverse"
803
903
  },
804
904
  neutral: { background: "secondary", borderWidth: "0", borderColor: void 0 }
805
- }, wo = {
905
+ }, zr = {
806
906
  light: { background: "transparent", borderWidth: "small", borderColor: "brand" },
807
907
  dark: { background: "transparent", borderWidth: "small", borderColor: "primary" },
808
908
  neutral: { background: "transparent", borderWidth: "small", borderColor: "secondary" }
809
909
  };
810
- function Lo(e, o) {
910
+ function Rr(e, t) {
811
911
  switch (e) {
812
912
  case "fill":
813
- return To[o];
913
+ return Sr[t];
814
914
  case "outline":
815
- return wo[o];
915
+ return zr[t];
816
916
  default:
817
- return So;
917
+ return Ar;
818
918
  }
819
919
  }
820
- function Ao(e, o, r, t) {
920
+ function Ir(e, t, r, o) {
821
921
  const n = {
822
922
  borderRadius: r === "rounded" ? "large" : "0",
823
923
  padding: "medium"
824
- }, i = o === "neutral" ? void 0 : Z(t, o);
825
- if (i) {
924
+ }, a = t === "neutral" ? void 0 : ue(o, t);
925
+ if (a) {
826
926
  if (e === "fill")
827
- return w(ie(i), n);
927
+ return de(xe(a), n);
828
928
  if (e === "outline")
829
- return w(Se(i, "small"), n);
929
+ return de(qt(a, "small"), n);
830
930
  }
831
- return w({ decoration: Lo(e, o) }, n);
931
+ return de({ decoration: Rr(e, t) }, n);
832
932
  }
833
- function xt({
933
+ function Lr({
834
934
  content: e,
835
- textStyle: o = "outline",
935
+ textStyle: t = "outline",
836
936
  colorTheme: r = "light",
837
- cornerStyle: t = "rounded"
937
+ cornerStyle: o = "rounded"
838
938
  }) {
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
- ) }) }) });
939
+ const n = le(), { translations: a } = Y(no), d = he(), { view: c, text: l } = ee(
940
+ () => Ir(t, r, o, d),
941
+ [t, r, o, d]
942
+ );
943
+ return /* @__PURE__ */ w(v, { as: "div", ...c, className: "bce-block bce-block-text", children: [
944
+ /* @__PURE__ */ i(Tr, {}),
945
+ /* @__PURE__ */ i("div", { style: U, children: n && !e ? /* @__PURE__ */ i(S, { color: l.color, themeOverride: l.themeOverride, children: a.placeholderContent }) : /* @__PURE__ */ i(S, { as: "div", color: l.color, themeOverride: l.themeOverride, children: /* @__PURE__ */ i(tt, { className: Xe, html: e }) }) })
946
+ ] });
849
947
  }
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"),
948
+ const Or = s.enum(["none", "outline", "fill"]), Nr = s.object({
949
+ content: s.string().zodRichText().zodLabel("Content").zodHelp("Rich text content with inline formatting support"),
852
950
  // `.default(x).optional()` (optional outermost) is intentional: it keeps the field
853
951
  // optional in the inferred props so callers may omit it; the default is applied by the
854
952
  // 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 = {
953
+ textStyle: Or.default("outline").optional().zodLabel("Style").zodHelp("None removes decoration; Outline shows a border; Fill adds a background color"),
954
+ colorTheme: Te.default("light").optional().zodLabel("Color theme").zodHelp("Light uses a subtle emphasis; Dark uses a strong emphasis; Neutral uses grey"),
955
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners (only applies when a style is selected)")
956
+ }), Er = {
859
957
  content: "",
860
958
  textStyle: "outline",
861
959
  colorTheme: "light",
862
960
  cornerStyle: "rounded"
863
- }, zt = I(No, "Text"), _o = {
961
+ }, Pr = ne(Nr, "Text"), Ka = ie({
962
+ wireName: "Text",
963
+ component: Lr,
964
+ schema: Pr,
965
+ defaultProps: Er,
966
+ english: no
967
+ }), io = {
968
+ bannerPlaceholderTitle: "Your banner",
969
+ bannerPlaceholderSubtitle: "Your optional eyebrow text"
970
+ }, Br = {
971
+ left: "start",
972
+ center: "center",
973
+ right: "end"
974
+ }, Mr = {
864
975
  none: { background: "transparent", borderWidth: "0", borderColor: void 0 },
865
- light: { background: "brand", borderWidth: "0", borderColor: void 0 },
976
+ light: {
977
+ background: "brand",
978
+ borderWidth: "0",
979
+ borderColor: void 0,
980
+ textColor: "primary-inverse"
981
+ },
866
982
  dark: {
867
983
  background: "primary-inverse",
868
984
  borderWidth: "0",
@@ -870,28 +986,56 @@ const Oo = a.enum(["none", "outline", "fill"]), No = a.object({
870
986
  textColor: "primary-inverse"
871
987
  }
872
988
  };
873
- function Eo(e, o, r) {
874
- const t = {
875
- borderRadius: o === "rounded" ? "large" : "0",
989
+ function ao(e, t) {
990
+ const r = e === "light" ? "light" : e === "dark" ? "dark" : void 0, o = r && ue(t, r);
991
+ return o ? xe(o) : { decoration: Mr[e] };
992
+ }
993
+ const Oe = {
994
+ borderWidth: "small",
995
+ borderColor: "primary"
996
+ }, _r = {
997
+ light: { ...Oe, background: "brand", textColor: "primary-inverse" },
998
+ dark: { ...Oe, background: "primary-inverse", textColor: "primary-inverse" },
999
+ neutral: { ...Oe, background: "secondary" }
1000
+ };
1001
+ function nt(e, t) {
1002
+ const r = e === "neutral" ? void 0 : ue(t, e);
1003
+ if (!r)
1004
+ return {
1005
+ styling: { decoration: _r[e] },
1006
+ // Both `light` and `dark` resolve to a dark token surface carrying inverse text;
1007
+ // only `neutral`'s pale grey is a light one.
1008
+ isDarkSurface: e !== "neutral"
1009
+ };
1010
+ const o = xe(r);
1011
+ return {
1012
+ styling: { ...o, decoration: { ...o.decoration, ...Oe } },
1013
+ // `deriveBrandColorVariants` builds `light` as a pale tint carrying dark text and
1014
+ // `dark` as a genuinely dark surface, so the tone follows the requested variant.
1015
+ isDarkSurface: e === "dark"
1016
+ };
1017
+ }
1018
+ function $r(e, t, r) {
1019
+ return de(ao(e, r), {
1020
+ borderRadius: t === "rounded" ? "large" : "0",
876
1021
  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);
1022
+ });
879
1023
  }
880
- function Rt({
1024
+ function Hr({
881
1025
  title: e,
882
- variant: o,
1026
+ variant: t,
883
1027
  subtitle: r,
884
- content: t,
1028
+ content: o,
885
1029
  headerStyle: n = "none",
886
- cornerStyle: i = "rounded"
1030
+ cornerStyle: a = "rounded"
887
1031
  }) {
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,
1032
+ const d = le(), { translations: c } = Y(io), l = he(), { view: u, text: h } = ee(
1033
+ () => $r(n, a, l),
1034
+ [n, a, l]
1035
+ ), g = d && !e && !r && !o, p = g ? c.bannerPlaceholderTitle : e, C = g ? c.bannerPlaceholderSubtitle : r, T = g ? void 0 : o;
1036
+ return /* @__PURE__ */ i(v, { as: "div", ...u, className: "bce-block bce-block-banner", children: /* @__PURE__ */ w("div", { style: U, children: [
1037
+ C && /* @__PURE__ */ i(
1038
+ S,
895
1039
  {
896
1040
  as: "div",
897
1041
  size: "small",
@@ -900,18 +1044,18 @@ function Rt({
900
1044
  letterSpacing: "expanded",
901
1045
  color: h.color,
902
1046
  themeOverride: h.themeOverride,
903
- children: v
1047
+ children: C
904
1048
  }
905
1049
  ),
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 })
1050
+ /* @__PURE__ */ i(ke, { level: t, color: h.color, themeOverride: h.themeOverride, children: p }),
1051
+ T && /* @__PURE__ */ i(S, { as: "div", color: h.color, themeOverride: h.themeOverride, children: T })
908
1052
  ] }) });
909
1053
  }
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"),
1054
+ const Dr = s.object({
1055
+ title: s.string().zodTextarea().zodLabel("Heading text").zodHelp("Main heading text for this section"),
1056
+ variant: rt.default("h2").zodLabel("Heading level").zodHelp("Semantic heading level - determines text size automatically"),
1057
+ subtitle: s.string().optional().zodTextarea().zodLabel("Eyebrow text (optional)").zodHelp("Optional small text displayed above the main title"),
1058
+ content: s.string().optional().zodTextarea().zodLabel("Supporting text (optional)").zodHelp("Optional paragraph content below title"),
915
1059
  // `.default(x).optional()` (optional outermost) is intentional: it keeps defaulted
916
1060
  // style fields optional in the inferred props so callers may omit them; the default is
917
1061
  // applied by the component and `BannerDefaultProps`, not by schema `.parse()`.
@@ -919,56 +1063,65 @@ const Io = a.enum(["none", "light", "dark"]), Do = a.object({
919
1063
  // Schema-internal field name is kept as `headerStyle` (the canvas-horizon
920
1064
  // original) even though the block/component was renamed to Banner, so the
921
1065
  // 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 = {
1066
+ headerStyle: eo.default("none").optional().zodLabel("Color").zodHelp(to),
1067
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Choose between rounded or sharp square corners")
1068
+ }), Wr = {
925
1069
  title: "",
926
1070
  variant: "h2",
927
1071
  headerStyle: "none",
928
1072
  cornerStyle: "rounded"
929
- }, St = I(Do, "Banner"), ke = { background: "secondary", borderWidth: "0", borderColor: void 0 }, Po = {
1073
+ }, jr = ne(Dr, "Banner"), Qa = ie({
1074
+ wireName: "Header",
1075
+ component: Hr,
1076
+ schema: jr,
1077
+ defaultProps: Wr,
1078
+ english: io
1079
+ }), lo = {
1080
+ quotePlaceholderContent: "Your quote here",
1081
+ quotePlaceholderAuthor: "Author"
1082
+ }, St = { background: "secondary", borderWidth: "0", borderColor: void 0 }, Vr = {
930
1083
  background: "transparent",
931
1084
  borderWidth: "none none none large",
932
1085
  borderColor: "brand"
933
- }, Ho = { background: "transparent", borderWidth: "0", borderColor: void 0 };
934
- function Mo(e, o, r) {
935
- const t = o === "rounded" ? "large" : "0";
1086
+ }, Fr = { background: "transparent", borderWidth: "0", borderColor: void 0 };
1087
+ function Zr(e, t, r) {
1088
+ const o = t === "rounded" ? "large" : "0";
936
1089
  switch (e) {
937
1090
  case "background-secondary": {
938
- const n = Z(r, "light"), i = n ? ie(n) : { decoration: ke };
939
- return w(i, { borderRadius: t, padding: "medium" });
1091
+ const n = ue(r, "light"), a = n ? xe(n) : { decoration: St };
1092
+ return de(a, { borderRadius: o, padding: "medium" });
940
1093
  }
941
1094
  case "background-grey":
942
- return w({ decoration: ke }, { borderRadius: t, padding: "medium" });
1095
+ return de({ decoration: St }, { borderRadius: o, padding: "medium" });
943
1096
  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" });
1097
+ const n = ue(r, "dark"), a = n ? qt(n, "none none none large") : { decoration: Vr };
1098
+ return de(a, { borderRadius: "0", padding: "0 0 0 small" });
946
1099
  }
947
1100
  default:
948
- return w({ decoration: Ho }, { borderRadius: t, padding: "0" });
1101
+ return de({ decoration: Fr }, { borderRadius: o, padding: "0" });
949
1102
  }
950
1103
  }
951
- function Tt({
1104
+ function Gr({
952
1105
  content: e,
953
- author: o,
1106
+ author: t,
954
1107
  decorationStyle: r = "background-secondary",
955
- cornerStyle: t = "rounded"
1108
+ cornerStyle: o = "rounded"
956
1109
  }) {
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,
1110
+ const n = le(), { translations: a } = Y(lo), d = he(), { view: c, text: l } = ee(
1111
+ () => Zr(r, o, d),
1112
+ [r, o, d]
1113
+ ), u = n && !e && !t, h = u ? a.quotePlaceholderContent : e, g = u ? a.quotePlaceholderAuthor : t;
1114
+ return /* @__PURE__ */ i(v, { as: "div", ...c, className: "bce-block bce-block-quote", children: /* @__PURE__ */ w("div", { style: U, children: [
1115
+ /* @__PURE__ */ w(
1116
+ S,
964
1117
  {
965
1118
  as: "blockquote",
966
1119
  size: "x-large",
967
1120
  weight: "bold",
968
1121
  fontStyle: "italic",
969
1122
  lineHeight: "double",
970
- color: s.color,
971
- themeOverride: s.themeOverride,
1123
+ color: l.color,
1124
+ themeOverride: l.themeOverride,
972
1125
  children: [
973
1126
  '"',
974
1127
  h,
@@ -976,48 +1129,56 @@ function Tt({
976
1129
  ]
977
1130
  }
978
1131
  ),
979
- p && /* @__PURE__ */ d(f, { as: "div", textAlign: "end", children: /* @__PURE__ */ S(z, { as: "cite", size: "small", color: s.color, themeOverride: s.themeOverride, children: [
1132
+ g && /* @__PURE__ */ i(v, { as: "div", textAlign: "end", children: /* @__PURE__ */ w(S, { as: "cite", size: "small", color: l.color, themeOverride: l.themeOverride, children: [
980
1133
  "– ",
981
- p
1134
+ g
982
1135
  ] }) })
983
1136
  ] }) });
984
1137
  }
985
- const Zo = a.enum([
1138
+ const Ur = s.enum([
986
1139
  "none",
987
1140
  "background-secondary",
988
1141
  "background-grey",
989
1142
  "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"),
1143
+ ]), qr = s.object({
1144
+ content: s.string().zodTextarea().zodLabel("Quote Content").zodHelp("The main text of the quotation"),
1145
+ author: s.string().optional().zodLabel("Author").zodHelp("Optional attribution for the quote"),
993
1146
  // `.default(x).optional()` (optional outermost) is intentional: it keeps the field
994
1147
  // optional in the inferred props so callers may omit it; the default is applied by the
995
1148
  // 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 = {
1149
+ decorationStyle: Ur.default("background-secondary").optional().zodLabel("Style").zodHelp("Choose background or border styling for the quote block"),
1150
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
1151
+ }), Xr = {
999
1152
  content: "",
1000
1153
  decorationStyle: "background-secondary",
1001
1154
  cornerStyle: "rounded"
1002
- }, Lt = I(Bo, "Quote");
1003
- function Vo(e) {
1155
+ }, Yr = ne(qr, "Quote"), Ja = ie({
1156
+ wireName: "QuoteBlock",
1157
+ component: Gr,
1158
+ schema: Yr,
1159
+ defaultProps: Xr,
1160
+ english: lo
1161
+ }), so = {
1162
+ codeBlockPlaceholder: "// Your code here"
1163
+ };
1164
+ function Kr(e) {
1004
1165
  return {
1005
1166
  background: "secondary",
1006
1167
  borderRadius: e === "rounded" ? "large" : "0",
1007
1168
  padding: "medium"
1008
1169
  };
1009
1170
  }
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 }) })
1171
+ function Qr({ code: e, language: t, header: r, cornerStyle: o = "rounded" }) {
1172
+ const n = le(), { translations: a } = Y(so), d = Kr(o), l = n && !e ? a.codeBlockPlaceholder : e;
1173
+ return /* @__PURE__ */ i(v, { as: "div", className: "bce-block bce-block-codeblock", children: /* @__PURE__ */ w("div", { style: U, children: [
1174
+ r && /* @__PURE__ */ i(v, { as: "div", margin: "0 0 small 0", children: /* @__PURE__ */ i(ke, { level: "h4", children: r }) }),
1175
+ /* @__PURE__ */ w(v, { as: "div", ...d, children: [
1176
+ t && /* @__PURE__ */ i(v, { as: "div", margin: "0 0 x-small 0", children: /* @__PURE__ */ i(S, { as: "div", size: "small", weight: "bold", transform: "uppercase", color: "secondary", children: t }) }),
1177
+ /* @__PURE__ */ i("pre", { style: { margin: 0, whiteSpace: "pre", overflow: "auto" }, children: /* @__PURE__ */ i("code", { children: l }) })
1017
1178
  ] })
1018
1179
  ] }) });
1019
1180
  }
1020
- const jo = a.enum([
1181
+ const Jr = s.enum([
1021
1182
  "javascript",
1022
1183
  "json",
1023
1184
  "html",
@@ -1025,310 +1186,347 @@ const jo = a.enum([
1025
1186
  "bash",
1026
1187
  "yaml",
1027
1188
  "text"
1028
- ]), Wo = a.object({
1029
- code: a.string().zodCodeEditor().zodLabel("Code").zodHelp("The code content to display"),
1189
+ ]), en = s.object({
1190
+ code: s.string().zodCodeEditor().zodLabel("Code").zodHelp("The code content to display"),
1030
1191
  // Unknown languages fall back to 'text'; an absent value defaults to 'javascript'
1031
1192
  // (matches the canvas-horizon original). `.optional()` sits inside `.default()`
1032
1193
  // so `parse({ code })` yields `'javascript'` rather than `undefined` — which
1033
1194
  // 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"),
1195
+ language: Jr.catch("text").optional().default("javascript").zodLabel("Language").zodHelp("Programming language shown as a label above the code"),
1196
+ header: s.string().optional().zodLabel("Header").zodHelp("Optional heading displayed above the code block"),
1036
1197
  // `.default(x).optional()` (optional outermost) keeps this optional in the inferred
1037
1198
  // props; the default is applied by the component and `CodeBlockDefaultProps`, not by
1038
1199
  // `.parse()`. (Contrast `language` above, which needs its value present after parse
1039
1200
  // and so orders `.optional().default()`.)
1040
- cornerStyle: D.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
1041
- }), Ot = {
1201
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
1202
+ }), tn = {
1042
1203
  code: "",
1043
1204
  language: "javascript",
1044
1205
  cornerStyle: "rounded"
1045
- }, Nt = I(
1046
- Wo,
1206
+ }, on = ne(
1207
+ en,
1047
1208
  "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) {
1209
+ ), ed = ie({
1210
+ wireName: "CodeBlock",
1211
+ component: Qr,
1212
+ schema: on,
1213
+ defaultProps: tn,
1214
+ english: so
1215
+ }), rn = () => ({ isLoading: !1, isError: !0 }), nn = () => ({ isLoading: !1, isError: !0 }), an = () => ({ isLoading: !1, isError: !0 }), $e = we({}), td = $e.Provider, dn = (e) => (pe($e).useImageUrl ?? rn)(e), ln = (e) => (pe($e).useVideoUrl ?? nn)(e), sn = (e) => (pe($e).useWidget ?? an)(e), co = {
1216
+ imageBlockPlaceholder: "Add image...",
1217
+ imageBlockLoading: "Loading image...",
1218
+ imageBlockError: "Failed to load image"
1219
+ }, cn = ["http:", "https:"];
1220
+ function Ye(e) {
1050
1221
  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("\\");
1222
+ const t = e.replace(/[\t\n\r]/g, "");
1223
+ if (!t || t.startsWith("//")) return !1;
1224
+ if (t.startsWith("/")) return !t.includes("\\");
1054
1225
  try {
1055
- return Xo.includes(new URL(o).protocol);
1226
+ return cn.includes(new URL(t).protocol);
1056
1227
  } catch {
1057
1228
  return !1;
1058
1229
  }
1059
1230
  }
1060
- function A({
1231
+ function ce({
1061
1232
  text: e,
1062
- subtitle: o,
1233
+ subtitle: t,
1063
1234
  variant: r = "empty",
1064
- borderRadius: t = "medium"
1235
+ borderRadius: o = "medium"
1065
1236
  }) {
1066
- const n = r === "processing" ? "secondary" : "primary", i = r !== "empty";
1067
- return /* @__PURE__ */ d(
1068
- f,
1237
+ const n = r === "processing" ? "secondary" : "primary", a = r !== "empty";
1238
+ return /* @__PURE__ */ i(
1239
+ v,
1069
1240
  {
1070
1241
  as: "div",
1071
1242
  background: n,
1072
- borderRadius: t,
1243
+ borderRadius: o,
1073
1244
  padding: "large",
1074
1245
  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 }) })
1246
+ "aria-live": a ? "polite" : void 0,
1247
+ "aria-atomic": a ? !0 : void 0,
1248
+ children: /* @__PURE__ */ i("div", { style: U, children: r === "loading" ? /* @__PURE__ */ i(Bo, { size: "small", renderTitle: e }) : r === "processing" ? /* @__PURE__ */ w(ye, { children: [
1249
+ /* @__PURE__ */ i(S, { as: "div", children: e }),
1250
+ t && /* @__PURE__ */ i(S, { as: "p", color: "secondary", children: t })
1251
+ ] }) : /* @__PURE__ */ i(S, { color: r === "error" ? "danger" : "secondary", children: e }) })
1081
1252
  }
1082
1253
  );
1083
1254
  }
1084
- const Ee = {
1085
- left: "start",
1086
- center: "center",
1087
- right: "end"
1088
- }, Qo = {
1255
+ const un = {
1089
1256
  square: "1 / 1",
1090
1257
  circle: "1 / 1",
1091
1258
  landscape: "3 / 2",
1092
1259
  portrait: "3 / 4"
1260
+ }, hn = {
1261
+ left: "0 auto",
1262
+ center: "auto",
1263
+ right: "auto 0"
1093
1264
  };
1094
- function Ko(e, o, r, t) {
1265
+ function mn(e, t, r, o) {
1095
1266
  return {
1096
- textAlign: Ee[o],
1267
+ marginInline: hn[t],
1097
1268
  width: `${r}%`,
1098
- aspectRatio: Qo[e],
1099
- borderRadius: e === "circle" ? "circle" : t === "rounded" ? "large" : "0"
1269
+ aspectRatio: un[e],
1270
+ borderRadius: e === "circle" ? "circle" : o === "rounded" ? "large" : "0"
1100
1271
  };
1101
1272
  }
1102
- function Et({
1273
+ function fn({
1103
1274
  asset_id: e,
1104
- isDecorative: o = !1,
1275
+ isDecorative: t = !1,
1105
1276
  alt: r,
1106
- size: t = 100,
1277
+ size: o = 50,
1107
1278
  ratio: n = "square",
1108
- align: i = "left",
1109
- cornerStyle: c = "rounded"
1279
+ align: a = "left",
1280
+ cornerStyle: d = "rounded"
1110
1281
  }) {
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,
1282
+ const c = le(), { translations: l } = Y(co), { url: u, isLoading: h, isError: g } = dn(e), p = mn(n, a, o, d);
1283
+ return /* @__PURE__ */ i(v, { as: "div", className: "bce-block bce-block-image", width: "100%", children: e ? h ? /* @__PURE__ */ i(
1284
+ ce,
1113
1285
  {
1114
- borderRadius: b.borderRadius,
1286
+ borderRadius: p.borderRadius,
1115
1287
  variant: "loading",
1116
- text: s.imageBlockLoading
1288
+ text: l.imageBlockLoading
1117
1289
  }
1118
- ) : p || !re(l) ? /* @__PURE__ */ d(
1119
- A,
1290
+ ) : g || !Ye(u) ? /* @__PURE__ */ i(
1291
+ ce,
1120
1292
  {
1121
- borderRadius: b.borderRadius,
1293
+ borderRadius: p.borderRadius,
1122
1294
  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
- ) })
1295
+ text: l.imageBlockError
1147
1296
  }
1148
- ) : u ? /* @__PURE__ */ d(
1149
- A,
1297
+ ) : (
1298
+ // aspectRatio has no InstUI token; the crop/fit is done by Img constrain="cover".
1299
+ /* @__PURE__ */ i(
1300
+ "div",
1301
+ {
1302
+ style: {
1303
+ width: p.width,
1304
+ maxWidth: "100%",
1305
+ marginInline: p.marginInline,
1306
+ aspectRatio: p.aspectRatio
1307
+ },
1308
+ children: /* @__PURE__ */ i(
1309
+ v,
1310
+ {
1311
+ as: "div",
1312
+ width: "100%",
1313
+ height: "100%",
1314
+ borderRadius: p.borderRadius,
1315
+ overflowX: "hidden",
1316
+ overflowY: "hidden",
1317
+ children: /* @__PURE__ */ i(
1318
+ Po,
1319
+ {
1320
+ src: u,
1321
+ alt: t ? "" : r,
1322
+ role: t ? "presentation" : void 0,
1323
+ display: "block",
1324
+ width: "100%",
1325
+ height: "100%",
1326
+ constrain: "cover"
1327
+ }
1328
+ )
1329
+ }
1330
+ )
1331
+ }
1332
+ )
1333
+ ) : c ? /* @__PURE__ */ i(
1334
+ ce,
1150
1335
  {
1151
- borderRadius: b.borderRadius,
1152
- text: s.imageBlockPlaceholder
1336
+ borderRadius: p.borderRadius,
1337
+ text: l.imageBlockPlaceholder
1153
1338
  }
1154
- ) : null;
1155
- return /* @__PURE__ */ d(f, { as: "div", className: "bce-block bce-block-image", textAlign: b.textAlign, children: v() });
1339
+ ) : null });
1156
1340
  }
1157
- const Yo = a.enum(["square", "circle", "landscape", "portrait"]), Jo = a.object({
1341
+ const pn = s.enum(["square", "circle", "landscape", "portrait"]), bn = s.object({
1158
1342
  // 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 = {
1343
+ asset_id: s.string().zodLabel("Image").zodImage(),
1344
+ isDecorative: s.boolean().default(!1).zodLabel("Image is decorative"),
1345
+ alt: s.string().zodLabel("Alt text").zodPlaceholder("Describe the image...").zodAltText().zodDisabledWhen({ field: "isDecorative", value: !0 }),
1346
+ size: s.number().min(20).max(100).default(50).zodRange({ min: 20, max: 100, step: 10, formatValue: "%" }).zodLabel("Size").zodHelp("Image width as a percentage of the container"),
1347
+ ratio: pn.default("square").zodLabel("Image Ratio").zodHelp("Aspect ratio for the image display"),
1348
+ align: Jt.default("left").zodLabel("Alignment").zodHelp("Horizontal alignment of the image"),
1349
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
1350
+ }), gn = {
1167
1351
  asset_id: "",
1168
1352
  isDecorative: !1,
1169
1353
  alt: "",
1170
- size: 100,
1354
+ size: 50,
1171
1355
  ratio: "square",
1172
1356
  align: "left",
1173
1357
  cornerStyle: "rounded"
1174
- }, Dt = I(
1175
- Jo,
1358
+ }, vn = ne(
1359
+ bn,
1176
1360
  "ImageBlock"
1177
- ), Fo = "16 / 9";
1178
- function Ie(e, o, r) {
1361
+ ), od = ie({
1362
+ wireName: "ImageBlock",
1363
+ component: fn,
1364
+ schema: vn,
1365
+ defaultProps: gn,
1366
+ english: co
1367
+ }), uo = {
1368
+ videoBlockPlaceholder: "Add video...",
1369
+ videoBlockLoading: "Loading video...",
1370
+ videoBlockError: "Failed to load video",
1371
+ videoBlockUnsupportedProvider: "Unsupported video provider",
1372
+ videoBlockProcessing: "Video is processing",
1373
+ videoBlockProcessingSubtitle: "Once video is done processing, block will update. This could take a few minutes.",
1374
+ videoBlockTitle: "Video"
1375
+ }, Cn = "16 / 9";
1376
+ function ho(e, t, r) {
1179
1377
  return {
1180
- textAlign: Ee[e],
1181
- width: `${o}%`,
1182
- aspectRatio: Fo,
1378
+ textAlign: Br[e],
1379
+ width: `${t}%`,
1380
+ aspectRatio: Cn,
1183
1381
  borderRadius: r === "rounded" ? "large" : "0"
1184
1382
  };
1185
1383
  }
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);
1384
+ const yn = /^(?:https?:\/\/)?(?:[\w-]+\.)*(?:youtube\.com\/(?:watch\?v=|embed\/|v\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})(?![\w-])/, kn = /^(?:https?:\/\/)?(?:[\w-]+\.)*vimeo\.com\/(?:video\/)?(\d+)(?![\w-])/;
1385
+ function wn(e) {
1386
+ const t = e.match(yn);
1387
+ if (t)
1388
+ return `https://www.youtube.com/embed/${t[1]}`;
1389
+ const r = e.match(kn);
1192
1390
  return r ? `https://player.vimeo.com/video/${r[1]}` : null;
1193
1391
  }
1194
- function Pt({
1392
+ function xn({
1195
1393
  source: e = "file",
1196
- asset_id: o,
1394
+ asset_id: t,
1197
1395
  video_url: r,
1198
- alt: t,
1396
+ alt: o,
1199
1397
  size: n = 100,
1200
- align: i = "center",
1201
- cornerStyle: c = "rounded"
1398
+ align: a = "center",
1399
+ cornerStyle: d = "rounded"
1202
1400
  }) {
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,
1401
+ const c = le(), { translations: l } = Y(uo), { url: u, displayName: h, mediaEntryId: g, isLoading: p, isProcessing: C, isError: T } = ln(
1402
+ e === "file" ? t : ""
1403
+ ), I = ho(a, n, d), x = (M, D, F, te) => /* @__PURE__ */ i(
1404
+ v,
1207
1405
  {
1208
1406
  as: "span",
1209
1407
  display: "inline-block",
1210
- width: y.width,
1408
+ width: I.width,
1211
1409
  maxWidth: "100%",
1212
- borderRadius: y.borderRadius,
1410
+ borderRadius: I.borderRadius,
1213
1411
  overflowX: "hidden",
1214
1412
  overflowY: "hidden",
1215
- children: /* @__PURE__ */ d("div", { style: { aspectRatio: y.aspectRatio, width: "100%", position: "relative" }, children: /* @__PURE__ */ d(
1413
+ children: /* @__PURE__ */ i("div", { style: { aspectRatio: I.aspectRatio, width: "100%", position: "relative" }, children: /* @__PURE__ */ i(
1216
1414
  "iframe",
1217
1415
  {
1218
- src: P,
1219
- title: V,
1220
- allow: K,
1416
+ src: M,
1417
+ title: D,
1418
+ allow: F,
1221
1419
  allowFullScreen: !0,
1222
1420
  loading: "lazy",
1223
1421
  referrerPolicy: "strict-origin-when-cross-origin",
1224
- "data-media-id": j,
1422
+ "data-media-id": te,
1225
1423
  style: { position: "absolute", inset: 0, width: "100%", height: "100%", border: "none" }
1226
1424
  }
1227
1425
  ) })
1228
1426
  }
1229
- ), L = () => u ? /* @__PURE__ */ d(
1230
- A,
1427
+ ), P = () => c ? /* @__PURE__ */ i(
1428
+ ce,
1231
1429
  {
1232
- borderRadius: y.borderRadius,
1233
- text: s.videoBlockPlaceholder
1430
+ borderRadius: I.borderRadius,
1431
+ text: l.videoBlockPlaceholder
1234
1432
  }
1235
- ) : null, Q = () => {
1433
+ ) : null, G = () => {
1236
1434
  if (e === "link") {
1237
1435
  if (!r)
1238
- return L();
1239
- const P = tt(r);
1240
- return re(P) ? R(
1241
- P,
1242
- t || s.videoBlockTitle,
1436
+ return P();
1437
+ const M = wn(r);
1438
+ return Ye(M) ? x(
1439
+ M,
1440
+ o || l.videoBlockTitle,
1243
1441
  "autoplay; encrypted-media; picture-in-picture; fullscreen"
1244
- ) : /* @__PURE__ */ d(
1245
- A,
1442
+ ) : /* @__PURE__ */ i(
1443
+ ce,
1246
1444
  {
1247
- borderRadius: y.borderRadius,
1445
+ borderRadius: I.borderRadius,
1248
1446
  variant: "error",
1249
- text: s.videoBlockUnsupportedProvider
1447
+ text: l.videoBlockUnsupportedProvider
1250
1448
  }
1251
1449
  );
1252
1450
  }
1253
- return o ? b ? /* @__PURE__ */ d(
1254
- A,
1451
+ return t ? p ? /* @__PURE__ */ i(
1452
+ ce,
1255
1453
  {
1256
- borderRadius: y.borderRadius,
1454
+ borderRadius: I.borderRadius,
1257
1455
  variant: "loading",
1258
- text: s.videoBlockLoading
1456
+ text: l.videoBlockLoading
1259
1457
  }
1260
- ) : v ? /* @__PURE__ */ d(
1261
- A,
1458
+ ) : C ? /* @__PURE__ */ i(
1459
+ ce,
1262
1460
  {
1263
- borderRadius: y.borderRadius,
1461
+ borderRadius: I.borderRadius,
1264
1462
  variant: "processing",
1265
- text: s.videoBlockProcessing,
1266
- subtitle: s.videoBlockProcessingSubtitle
1463
+ text: l.videoBlockProcessing,
1464
+ subtitle: l.videoBlockProcessingSubtitle
1267
1465
  }
1268
- ) : k || !re(l) ? /* @__PURE__ */ d(
1269
- A,
1466
+ ) : T || !Ye(u) ? /* @__PURE__ */ i(
1467
+ ce,
1270
1468
  {
1271
- borderRadius: y.borderRadius,
1469
+ borderRadius: I.borderRadius,
1272
1470
  variant: "error",
1273
- text: s.videoBlockError
1471
+ text: l.videoBlockError
1274
1472
  }
1275
- ) : R(
1276
- l,
1277
- t || h || s.videoBlockTitle,
1473
+ ) : x(
1474
+ u,
1475
+ o || h || l.videoBlockTitle,
1278
1476
  "fullscreen",
1279
- p
1280
- ) : L();
1477
+ g
1478
+ ) : P();
1281
1479
  };
1282
- return /* @__PURE__ */ d(f, { as: "div", className: "bce-block bce-block-video", textAlign: y.textAlign, children: Q() });
1480
+ return /* @__PURE__ */ i(v, { as: "div", className: "bce-block bce-block-video", textAlign: I.textAlign, children: G() });
1283
1481
  }
1284
- function Ht({
1482
+ function Tn({
1285
1483
  size: e = 100,
1286
- align: o = "center",
1484
+ align: t = "center",
1287
1485
  cornerStyle: r = "rounded"
1288
1486
  }) {
1289
- const t = Ie(o, e, r);
1290
- return /* @__PURE__ */ d(f, { as: "div", textAlign: t.textAlign, children: /* @__PURE__ */ d(
1291
- f,
1487
+ const o = ho(t, e, r);
1488
+ return /* @__PURE__ */ i(v, { as: "div", textAlign: o.textAlign, children: /* @__PURE__ */ i(
1489
+ v,
1292
1490
  {
1293
1491
  as: "span",
1294
1492
  display: "inline-block",
1295
- width: t.width,
1493
+ width: o.width,
1296
1494
  maxWidth: "100%",
1297
- borderRadius: t.borderRadius,
1495
+ borderRadius: o.borderRadius,
1298
1496
  background: "secondary",
1299
1497
  overflowX: "hidden",
1300
1498
  overflowY: "hidden",
1301
- children: /* @__PURE__ */ d(
1499
+ children: /* @__PURE__ */ i(
1302
1500
  "div",
1303
1501
  {
1304
1502
  style: {
1305
- aspectRatio: t.aspectRatio,
1503
+ aspectRatio: o.aspectRatio,
1306
1504
  width: "100%",
1307
1505
  display: "flex",
1308
1506
  alignItems: "center",
1309
1507
  justifyContent: "center"
1310
1508
  },
1311
- children: /* @__PURE__ */ d(z, { color: "secondary", children: "Video" })
1509
+ children: /* @__PURE__ */ i(S, { color: "secondary", children: "Video" })
1312
1510
  }
1313
1511
  )
1314
1512
  }
1315
1513
  ) });
1316
1514
  }
1317
- const rt = a.enum(["file", "link"]), nt = a.object({
1515
+ const An = s.enum(["file", "link"]), Sn = s.object({
1318
1516
  // How the video is supplied: an uploaded file (resolved via the asset context)
1319
1517
  // or an external link (YouTube/Vimeo). Set by the editor, not shown as a field.
1320
- source: rt.default("file").zodHidden(),
1518
+ source: An.default("file").zodHidden(),
1321
1519
  // 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"),
1520
+ asset_id: s.string().zodLabel("Video").zodVideo(),
1521
+ video_url: s.string().optional().zodHidden(),
1522
+ alt: s.string().zodLabel("Alt Text").zodHelp("Required for accessibility"),
1523
+ size: s.number().min(20).max(100).default(100).zodRange({ min: 20, max: 100, step: 10, formatValue: "%" }).zodLabel("Size").zodHelp("Video width as percentage"),
1524
+ align: Jt.default("center").zodLabel("Alignment").zodHelp("Horizontal alignment of the video"),
1327
1525
  // `.default(x).optional()` (optional outermost) keeps this optional in the inferred
1328
1526
  // props; the default is applied by the component and `VideoBlockDefaultProps`, not by
1329
1527
  // schema `.parse()`.
1330
- cornerStyle: D.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
1331
- }), Mt = {
1528
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded corners or sharp square corners")
1529
+ }), zn = {
1332
1530
  source: "file",
1333
1531
  asset_id: "",
1334
1532
  video_url: "",
@@ -1336,50 +1534,2233 @@ const rt = a.enum(["file", "link"]), nt = a.object({
1336
1534
  size: 100,
1337
1535
  align: "center",
1338
1536
  cornerStyle: "rounded"
1339
- }, Zt = I(
1340
- nt,
1537
+ }, Rn = ne(
1538
+ Sn,
1341
1539
  "VideoBlock"
1342
- );
1540
+ ), rd = ie({
1541
+ wireName: "VideoBlock",
1542
+ component: xn,
1543
+ schema: Rn,
1544
+ defaultProps: zn,
1545
+ english: uo,
1546
+ renderDragPreview: Tn
1547
+ }), mo = {
1548
+ tabsBlockItemPlaceholderTitle: "Tab %{index}",
1549
+ tabsBlockItemPlaceholderContent: "Your content here..."
1550
+ }, fo = (e) => e === "rounded" ? "large" : "0", In = {
1551
+ pill: "pill",
1552
+ rounded: "medium",
1553
+ square: "0"
1554
+ }, it = (e, t) => e === "full-width" || t === "left" ? "start" : "center", Ce = "xx-small small", at = (e, t) => ({
1555
+ view: {
1556
+ background: "transparent",
1557
+ borderWidth: e,
1558
+ borderColor: "transparent",
1559
+ borderRadius: t,
1560
+ padding: Ce
1561
+ }
1562
+ });
1563
+ function Ln(e) {
1564
+ const { outline: t, cornerStyle: r, tabsWidth: o, alignment: n, brandColor: a } = e, d = "none none medium none", c = ue(a, "light");
1565
+ return {
1566
+ container: {
1567
+ borderWidth: t === "outline" ? "small" : "0",
1568
+ borderColor: "secondary",
1569
+ borderRadius: fo(r),
1570
+ padding: "none medium"
1571
+ },
1572
+ row: {
1573
+ view: { padding: "small none none none" },
1574
+ justifyItems: it(o, n)
1575
+ },
1576
+ // The selected tab is marked by a rule beneath it. Every tab reserves that edge so
1577
+ // selecting one doesn't shift the row.
1578
+ getTab: (l) => l ? {
1579
+ view: {
1580
+ background: "transparent",
1581
+ borderWidth: d,
1582
+ borderColor: "brand",
1583
+ borderRadius: "0",
1584
+ padding: Ce,
1585
+ themeOverride: c ? { borderColorBrand: c.color } : void 0
1586
+ }
1587
+ } : at(d, "0"),
1588
+ panel: { padding: "small none" },
1589
+ overlapsPanel: !1
1590
+ };
1591
+ }
1592
+ function On(e) {
1593
+ const {
1594
+ outline: t,
1595
+ cornerStyle: r,
1596
+ tabsRowBackground: o,
1597
+ tabsWidth: n,
1598
+ alignment: a,
1599
+ selectedTabStyle: d,
1600
+ selectedTabCorners: c,
1601
+ brandColor: l
1602
+ } = e, u = ue(l, "light"), h = In[c], g = o === "filled";
1603
+ return {
1604
+ container: {
1605
+ background: "primary",
1606
+ borderWidth: t === "outline" ? "small" : "0",
1607
+ borderColor: "secondary",
1608
+ borderRadius: fo(r),
1609
+ padding: "medium medium none medium"
1610
+ },
1611
+ row: {
1612
+ view: g ? {
1613
+ background: u ? "brand" : "secondary",
1614
+ borderRadius: h,
1615
+ padding: "xx-small",
1616
+ themeOverride: u ? { backgroundBrand: u.color } : void 0
1617
+ } : { padding: "none" },
1618
+ justifyItems: it(n, a)
1619
+ },
1620
+ getTab: (p) => p ? d === "filled" ? {
1621
+ view: {
1622
+ background: "brand",
1623
+ borderWidth: "small",
1624
+ borderColor: "transparent",
1625
+ borderRadius: h,
1626
+ padding: Ce,
1627
+ themeOverride: u ? { backgroundBrand: u.color } : void 0
1628
+ },
1629
+ textColor: u ? "primary" : "primary-inverse",
1630
+ textThemeOverride: u ? { primaryColor: u.textColor } : void 0
1631
+ } : {
1632
+ view: {
1633
+ background: "transparent",
1634
+ borderWidth: "small",
1635
+ borderColor: "brand",
1636
+ borderRadius: h,
1637
+ padding: Ce,
1638
+ themeOverride: u ? { borderColorBrand: u.color } : void 0
1639
+ }
1640
+ } : at("small", h),
1641
+ panel: { padding: "small none" },
1642
+ overlapsPanel: !1
1643
+ };
1644
+ }
1645
+ const Nn = {
1646
+ light: {
1647
+ override: (e) => ({
1648
+ backgroundBrand: e.backgroundBrand,
1649
+ borderColorBrand: e.backgroundBrand
1650
+ }),
1651
+ inverseText: !0
1652
+ },
1653
+ dark: {
1654
+ override: (e) => ({
1655
+ backgroundBrand: e.backgroundPrimaryInverse,
1656
+ borderColorBrand: e.backgroundPrimaryInverse
1657
+ }),
1658
+ inverseText: !0
1659
+ },
1660
+ neutral: {
1661
+ override: (e) => ({
1662
+ backgroundBrand: e.backgroundSecondary,
1663
+ borderColorBrand: e.backgroundSecondary
1664
+ }),
1665
+ inverseText: !1
1666
+ }
1667
+ };
1668
+ function En(e) {
1669
+ const { color: t, tabsWidth: r, alignment: o, selectedTabStyle: n, activeIndex: a, tabCount: d, brandColor: c } = e, l = t === "neutral" ? void 0 : ue(c, t), u = Nn[t], h = l ? { backgroundBrand: l.color, borderColorBrand: l.color } : u.override, g = !l && u.inverseText, p = "large large 0 0", C = r === "full-width", T = a === 0 && (C || o === "left"), I = a === d - 1 && C, x = `${T ? "0" : "large"} ${I ? "0" : "large"} large large`;
1670
+ return {
1671
+ container: { padding: "none" },
1672
+ row: { view: { padding: "none" }, justifyItems: it(r, o) },
1673
+ getTab: (P) => P ? n === "filled" ? {
1674
+ view: {
1675
+ background: "brand",
1676
+ borderWidth: "small small none small",
1677
+ borderColor: "brand",
1678
+ borderRadius: p,
1679
+ padding: Ce,
1680
+ themeOverride: h
1681
+ },
1682
+ textColor: g ? "primary-inverse" : "primary",
1683
+ textThemeOverride: l ? { primaryColor: l.textColor } : void 0
1684
+ } : {
1685
+ view: {
1686
+ background: "primary",
1687
+ borderWidth: "small small none small",
1688
+ borderColor: "brand",
1689
+ borderRadius: p,
1690
+ padding: Ce,
1691
+ themeOverride: h
1692
+ }
1693
+ } : at("small small none small", p),
1694
+ panel: {
1695
+ background: "primary",
1696
+ borderWidth: "small",
1697
+ borderColor: "brand",
1698
+ borderRadius: x,
1699
+ padding: "medium",
1700
+ themeOverride: h
1701
+ },
1702
+ overlapsPanel: !0
1703
+ };
1704
+ }
1705
+ function Pn(e) {
1706
+ switch (e.style) {
1707
+ case "folder":
1708
+ return En(e);
1709
+ case "simple":
1710
+ return Ln(e);
1711
+ case "segments":
1712
+ return On(e);
1713
+ }
1714
+ }
1715
+ function Bn({ itemCount: e, onSelect: t }) {
1716
+ return { handleKeyDown: J(
1717
+ (o, n) => {
1718
+ if (e === 0)
1719
+ return;
1720
+ let a;
1721
+ switch (o.key) {
1722
+ case "ArrowRight":
1723
+ case "ArrowDown":
1724
+ a = (n + 1) % e;
1725
+ break;
1726
+ case "ArrowLeft":
1727
+ case "ArrowUp":
1728
+ a = (n - 1 + e) % e;
1729
+ break;
1730
+ case "Home":
1731
+ a = 0;
1732
+ break;
1733
+ case "End":
1734
+ a = e - 1;
1735
+ break;
1736
+ default:
1737
+ return;
1738
+ }
1739
+ o.preventDefault(), a !== n && t(a);
1740
+ },
1741
+ [e, t]
1742
+ ) };
1743
+ }
1744
+ const Mn = (e) => {
1745
+ try {
1746
+ return e.matches(":focus-visible");
1747
+ } catch {
1748
+ return !0;
1749
+ }
1750
+ }, _n = {
1751
+ position: "relative",
1752
+ zIndex: 1,
1753
+ marginBottom: "-1px"
1754
+ }, $n = { display: "none" };
1755
+ function Hn({
1756
+ title: e,
1757
+ variant: t = "h2",
1758
+ supportingText: r,
1759
+ tabs: o = [],
1760
+ style: n = "segments",
1761
+ outline: a = "outline",
1762
+ color: d = "light",
1763
+ cornerStyle: c = "rounded",
1764
+ tabsRowBackground: l = "none",
1765
+ tabsWidth: u = "full-width",
1766
+ alignment: h = "left",
1767
+ selectedTabStyle: g = "filled",
1768
+ selectedTabCorners: p = "pill",
1769
+ editingItemId: C
1770
+ }) {
1771
+ var y;
1772
+ const T = le(), { translations: I, translate: x } = Y(mo), P = he(), G = jt(), M = o.length, [D, F] = j(C ?? ((y = o[0]) == null ? void 0 : y.id)), [te, q] = j(C), [Z, W] = j(null), K = re(/* @__PURE__ */ new Map());
1773
+ C !== te && (q(C), C !== void 0 && F(C));
1774
+ const ae = o.findIndex((m) => m.id === D), $ = ae >= 0 ? ae : 0, z = ee(
1775
+ () => Pn({
1776
+ style: n,
1777
+ outline: a,
1778
+ color: d,
1779
+ cornerStyle: c,
1780
+ tabsRowBackground: l,
1781
+ tabsWidth: u,
1782
+ alignment: h,
1783
+ selectedTabStyle: g,
1784
+ selectedTabCorners: p,
1785
+ activeIndex: $,
1786
+ tabCount: M,
1787
+ brandColor: P
1788
+ }),
1789
+ [
1790
+ n,
1791
+ a,
1792
+ d,
1793
+ c,
1794
+ l,
1795
+ u,
1796
+ h,
1797
+ g,
1798
+ p,
1799
+ $,
1800
+ M,
1801
+ P
1802
+ ]
1803
+ ), { handleKeyDown: N } = Bn({
1804
+ itemCount: M,
1805
+ onSelect: (m) => {
1806
+ var R, E;
1807
+ const b = (R = o[m]) == null ? void 0 : R.id;
1808
+ b !== void 0 && (F(b), (E = K.current.get(b)) == null || E.focus());
1809
+ }
1810
+ }), f = (e || r) && /* @__PURE__ */ w(v, { as: "div", margin: "none none medium none", children: [
1811
+ e && /* @__PURE__ */ i(ke, { level: t, children: e }),
1812
+ r && /* @__PURE__ */ i(S, { as: "p", color: "secondary", children: r })
1813
+ ] });
1814
+ return M === 0 ? /* @__PURE__ */ i(v, { as: "div", className: "bce-block bce-block-tabs", children: /* @__PURE__ */ i("div", { style: U, children: f }) }) : /* @__PURE__ */ i(v, { as: "div", className: "bce-block bce-block-tabs", children: /* @__PURE__ */ w("div", { style: U, children: [
1815
+ f,
1816
+ /* @__PURE__ */ w(v, { as: "div", ...z.container, children: [
1817
+ /* @__PURE__ */ i("div", { style: z.overlapsPanel ? _n : void 0, children: /* @__PURE__ */ i(v, { as: "div", role: "tablist", ...z.row.view, children: /* @__PURE__ */ i(k, { justifyItems: z.row.justifyItems, alignItems: "stretch", children: o.map((m, b) => {
1818
+ const R = b === $, E = T && !m.label && !m.content, { view: _, textColor: H, textThemeOverride: O } = z.getTab(R);
1819
+ return /* @__PURE__ */ i(k.Item, { shouldGrow: u === "full-width", shouldShrink: !0, children: /* @__PURE__ */ i(
1820
+ v,
1821
+ {
1822
+ as: "button",
1823
+ type: "button",
1824
+ role: "tab",
1825
+ id: `${G}-tab-${b}`,
1826
+ "aria-selected": R,
1827
+ "aria-controls": `${G}-panel-${b}`,
1828
+ tabIndex: R ? 0 : -1,
1829
+ elementRef: (B) => {
1830
+ B ? K.current.set(m.id, B) : K.current.delete(m.id);
1831
+ },
1832
+ onClick: () => F(m.id),
1833
+ onKeyDown: (B) => N(B, b),
1834
+ onFocus: (B) => {
1835
+ Mn(B.currentTarget) && W(m.id);
1836
+ },
1837
+ onBlur: () => W(null),
1838
+ display: "block",
1839
+ width: "100%",
1840
+ minWidth: "0",
1841
+ cursor: "pointer",
1842
+ textAlign: "center",
1843
+ ..._,
1844
+ withFocusOutline: Z === m.id,
1845
+ focusPosition: "offset",
1846
+ children: /* @__PURE__ */ i(
1847
+ S,
1848
+ {
1849
+ size: "small",
1850
+ weight: R ? "bold" : "normal",
1851
+ color: H,
1852
+ themeOverride: O,
1853
+ children: E ? x("tabsBlockItemPlaceholderTitle", { index: b + 1 }) : m.label
1854
+ }
1855
+ )
1856
+ }
1857
+ ) }, m.id);
1858
+ }) }) }) }),
1859
+ /* @__PURE__ */ i(v, { as: "div", ...z.panel, children: o.map((m, b) => {
1860
+ const R = T && !m.label && !m.content, E = b === $;
1861
+ return /* @__PURE__ */ i(
1862
+ "div",
1863
+ {
1864
+ role: "tabpanel",
1865
+ id: `${G}-panel-${b}`,
1866
+ "aria-labelledby": `${G}-tab-${b}`,
1867
+ hidden: !E,
1868
+ style: E ? void 0 : $n,
1869
+ children: R ? /* @__PURE__ */ i(S, { color: "secondary", children: I.tabsBlockItemPlaceholderContent }) : /* @__PURE__ */ i(tt, { html: m.content })
1870
+ },
1871
+ m.id
1872
+ );
1873
+ }) })
1874
+ ] })
1875
+ ] }) });
1876
+ }
1877
+ const Dn = s.enum(["simple", "folder", "segments"]), Wn = s.enum(["outline", "none"]), jn = s.enum(["none", "filled"]), Vn = s.enum(["full-width", "relative"]), Fn = s.enum(["left", "center"]), Zn = s.enum(["filled", "outline"]), Gn = s.enum(["pill", "rounded", "square"]), zt = 5, Un = s.object({
1878
+ id: s.string().zodHidden(),
1879
+ // The cap keeps a title on one line at the widths the tab row allows; past it the
1880
+ // row either wraps into several lines or squeezes its neighbours out of legibility.
1881
+ label: s.string().max(25).zodLabel("Title").zodHelp("Display text for this tab"),
1882
+ content: s.string().zodRichText().zodLabel("Content").zodHelp("Rich text content displayed when this tab is selected")
1883
+ }), qn = s.object({
1884
+ title: s.string().optional().zodTextarea().zodLabel("Heading text (optional)").zodHelp("Optional heading displayed above the tabs"),
1885
+ variant: rt.default("h2").optional().zodLabel("Heading level").zodHelp("Semantic heading level - determines text size automatically"),
1886
+ supportingText: s.string().optional().zodTextarea().zodLabel("Supporting text (optional)").zodHelp("Optional paragraph content below the heading"),
1887
+ /*
1888
+ * Deliberately not `.zodManageLayer()`, unlike Accordion's `items`. That opt-in only
1889
+ * collapses an inline list behind a "Manage" panel once it reaches the host's
1890
+ * threshold — which is also 5 — so on a field capped at 5 it could only ever trigger
1891
+ * at full capacity. The per-item Edit button that drives `editingItemId` comes from
1892
+ * the array renderer itself and does not depend on it.
1893
+ */
1894
+ tabs: s.array(Un).min(1).max(zt).zodLabel(`Tabs (up to ${zt})`).zodItemLabel("label").zodItemName("Tab").zodHelp("Add tabs with labels and content"),
1895
+ // `.default(x).optional()` (optional outermost) is intentional, as in Accordion: the
1896
+ // default is applied by the component and `TabsBlockDefaultProps`, not by schema
1897
+ // `.parse()`, so a host may omit any style field when constructing props.
1898
+ style: Dn.default("segments").optional().zodLabel("Style").zodHelp("Visual style of the tab row"),
1899
+ outline: Wn.default("outline").optional().zodLabel("Outline").zodHelp("Border around the content panel").zodHiddenWhen({ field: "style", values: ["folder"] }),
1900
+ color: Te.default("light").optional().zodLabel("Color").zodHelp("Light or dark color scheme").zodHiddenWhen({ field: "style", values: ["segments", "simple"] }),
1901
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Corner style of the overall container").zodHiddenWhen({ field: "style", values: ["folder"] }),
1902
+ tabsRowBackground: jn.default("none").optional().zodLabel("Tabs row background").zodHelp("Background fill behind the tab row").zodHiddenWhen({ field: "style", values: ["folder", "simple"] }),
1903
+ tabsWidth: Vn.default("full-width").optional().zodLabel("Tabs width").zodHelp("Whether tabs stretch to fill the full width"),
1904
+ alignment: Fn.default("left").optional().zodLabel("Alignment").zodHelp("Tab row alignment when not full width").zodHiddenWhen({ field: "tabsWidth", values: ["full-width"] }),
1905
+ selectedTabStyle: Zn.default("filled").optional().zodLabel("Selected tab").zodHelp("Style of the active tab indicator").zodHiddenWhen({ field: "style", values: ["simple"] }),
1906
+ selectedTabCorners: Gn.default("pill").optional().zodLabel("Selected tab corners").zodHelp("Corner style of the active tab").zodHiddenWhen({ field: "style", values: ["folder", "simple"] })
1907
+ }), He = {
1908
+ variant: "h2",
1909
+ tabs: [
1910
+ { id: "tab-default-1", label: "", content: "" },
1911
+ { id: "tab-default-2", label: "", content: "" },
1912
+ { id: "tab-default-3", label: "", content: "" }
1913
+ ],
1914
+ style: "segments",
1915
+ outline: "outline",
1916
+ color: "light",
1917
+ cornerStyle: "rounded",
1918
+ tabsRowBackground: "none",
1919
+ tabsWidth: "full-width",
1920
+ alignment: "left",
1921
+ selectedTabStyle: "filled",
1922
+ selectedTabCorners: "pill"
1923
+ };
1924
+ for (const e of He.tabs)
1925
+ Object.freeze(e);
1926
+ Object.freeze(He.tabs);
1927
+ Object.freeze(He);
1928
+ const Xn = ne(
1929
+ qn,
1930
+ "TabsBlock"
1931
+ ), nd = ie({
1932
+ wireName: "TabsBlock",
1933
+ component: Hn,
1934
+ schema: Xn,
1935
+ defaultProps: He,
1936
+ english: mo
1937
+ }), dt = {
1938
+ flashCardsTitle: "Flashcards",
1939
+ flashCardsPlaceholder: "Add flashcards...",
1940
+ flashCardsFrontLabel: "Front",
1941
+ flashCardsBackLabel: "Back",
1942
+ flashCardsFlipHint: "Click to flip",
1943
+ flashCardsCounter: "%{current} of %{total}",
1944
+ flashCardsCardAnnouncement: "Card %{current} of %{total}: %{question}",
1945
+ flashCardsPreviousCard: "Previous card",
1946
+ flashCardsNextCard: "Next card",
1947
+ flashCardsFrontAriaLabel: "Front: %{question}. Click to see answer.",
1948
+ flashCardsBackAriaLabel: "Back: %{answer}. Click to see question."
1949
+ };
1950
+ function Ee(e) {
1951
+ const t = [...e];
1952
+ for (let r = t.length - 1; r > 0; r--) {
1953
+ const o = Math.floor(Math.random() * (r + 1));
1954
+ [t[r], t[o]] = [t[o], t[r]];
1955
+ }
1956
+ return t;
1957
+ }
1958
+ const Yn = "300ms";
1959
+ function po() {
1960
+ const { transitions: e } = Eo();
1961
+ return Number.parseFloat((e == null ? void 0 : e.duration) ?? Yn) !== 0;
1962
+ }
1963
+ const De = "120px", bo = 450, Kn = "cubic-bezier(0.22, 0.61, 0.36, 1)", Qn = "480px", Jn = "400px", ei = "1rem", ti = Me`
1964
+ from { transform: translateX(${De}); opacity: 0; }
1965
+ 35% { opacity: 1; }
1966
+ to { transform: translateX(0); opacity: 1; }
1967
+ `, oi = Me`
1968
+ from { transform: translateX(-${De}); opacity: 0; }
1969
+ 35% { opacity: 1; }
1970
+ to { transform: translateX(0); opacity: 1; }
1971
+ `, ri = Me`
1972
+ from { transform: translateX(0); opacity: 1; }
1973
+ 45% { opacity: 0; }
1974
+ to { transform: translateX(-${De}); opacity: 0; }
1975
+ `, ni = Me`
1976
+ from { transform: translateX(0); opacity: 1; }
1977
+ 45% { opacity: 0; }
1978
+ to { transform: translateX(${De}); opacity: 0; }
1979
+ `, A = {
1980
+ /** The deck itself, and the ancestor every rule below can rely on. */
1981
+ root: "bce-block-flashcards",
1982
+ /** Set on the deck when motion is switched off; see `useMotionEnabled`. */
1983
+ motionOff: "bce-flashcards-no-motion",
1984
+ viewport: "bce-flashcards-viewport",
1985
+ layer: "bce-flashcards-layer",
1986
+ flip: "bce-flashcards-flip",
1987
+ inner: "bce-flashcards-inner",
1988
+ flipped: "bce-flashcards-flipped",
1989
+ face: "bce-flashcards-face",
1990
+ faceBack: "bce-flashcards-face-back",
1991
+ faceText: "bce-flashcards-face-text",
1992
+ /** Carries the live region's text, which has nothing to show a sighted reader. */
1993
+ srOnly: "bce-flashcards-sr-only"
1994
+ }, me = {
1995
+ enter: {
1996
+ next: "bce-flashcards-enter-next",
1997
+ prev: "bce-flashcards-enter-prev",
1998
+ none: ""
1999
+ },
2000
+ exit: {
2001
+ next: "bce-flashcards-exit-next",
2002
+ prev: "bce-flashcards-exit-prev",
2003
+ none: ""
2004
+ }
2005
+ };
2006
+ function Rt(e, t) {
2007
+ return `${A.layer} ${me[e][t]}`.trim();
2008
+ }
2009
+ const ii = Pe`
2010
+ .${A.viewport} {
2011
+ position: relative;
2012
+ width: 100%;
2013
+ max-width: ${Qn};
2014
+ min-width: 0;
2015
+ height: ${Jn};
2016
+ margin: 0 auto;
2017
+ }
2018
+
2019
+ .${A.layer} {
2020
+ position: absolute;
2021
+ inset: 0;
2022
+ animation-duration: ${bo}ms;
2023
+ animation-timing-function: ${Kn};
2024
+ animation-fill-mode: both;
2025
+ }
2026
+
2027
+ .${me.enter.next} { animation-name: ${ti}; }
2028
+ .${me.enter.prev} { animation-name: ${oi}; }
2029
+
2030
+ /* The card being left behind is on its way out: inert, and never a hit target. */
2031
+ .${me.exit.next},
2032
+ .${me.exit.prev} {
2033
+ pointer-events: none;
2034
+ }
2035
+ .${me.exit.next} { animation-name: ${ri}; }
2036
+ .${me.exit.prev} { animation-name: ${ni}; }
2037
+
2038
+ .${A.flip} {
2039
+ display: block;
2040
+ width: 100%;
2041
+ height: 100%;
2042
+ padding: 0 ${ei};
2043
+ box-sizing: border-box;
2044
+ background: none;
2045
+ border: none;
2046
+ cursor: pointer;
2047
+ perspective: 1000px;
2048
+ }
2049
+ .${A.flip}:disabled {
2050
+ cursor: default;
2051
+ }
2052
+
2053
+ .${A.inner} {
2054
+ position: relative;
2055
+ width: 100%;
2056
+ height: 100%;
2057
+ transform: rotateX(0deg);
2058
+ transform-style: preserve-3d;
2059
+ transform-origin: center center;
2060
+ transition: transform 600ms ease;
2061
+ }
2062
+ .${A.inner}.${A.flipped} {
2063
+ transform: rotateX(180deg);
2064
+ }
2065
+
2066
+ /*
2067
+ * The two faces are stacked in the same place and turn together; whichever is facing
2068
+ * away is hidden. Nothing else belongs on them: a compositor hint or a nudge along Z
2069
+ * both change how the browser rasterises the pair mid-turn, and both showed up as a
2070
+ * flicker as the card passed edge-on.
2071
+ */
2072
+ .${A.inner} > .${A.face} {
2073
+ /* The front face is in flow and gives the pair its height. */
2074
+ position: relative;
2075
+ height: 100%;
2076
+ box-sizing: border-box;
2077
+ flex-direction: column;
2078
+ justify-content: space-between;
2079
+ backface-visibility: hidden;
2080
+ }
2081
+ .${A.inner} > .${A.faceBack} {
2082
+ position: absolute;
2083
+ inset: 0;
2084
+ transform: rotateX(180deg);
2085
+ }
2086
+
2087
+ /* Long text wraps and scrolls inside the card instead of stretching it. */
2088
+ .${A.faceText} {
2089
+ flex: 1;
2090
+ min-height: 0;
2091
+ min-width: 0;
2092
+ display: flex;
2093
+ align-items: center;
2094
+ overflow: auto;
2095
+ }
2096
+
2097
+ /*
2098
+ * Clipped rather than hidden: display none and visibility hidden both take the element
2099
+ * out of the accessibility tree, which is the one thing this text is for.
2100
+ */
2101
+ .${A.srOnly} {
2102
+ position: absolute;
2103
+ width: 1px;
2104
+ height: 1px;
2105
+ margin: -1px;
2106
+ padding: 0;
2107
+ border: 0;
2108
+ overflow: hidden;
2109
+ clip-path: inset(50%);
2110
+ white-space: nowrap;
2111
+ }
2112
+
2113
+ .${A.motionOff} .${A.layer} {
2114
+ animation: none;
2115
+ }
2116
+ .${A.motionOff} .${A.inner} {
2117
+ transition: none;
2118
+ }
2119
+
2120
+ /*
2121
+ * Qualified by the deck, like the rule above it: that outweighs the per-direction
2122
+ * animation on specificity, rather than only on being written last.
2123
+ */
2124
+ @media (prefers-reduced-motion: reduce) {
2125
+ .${A.root} .${A.layer} {
2126
+ animation: none;
2127
+ }
2128
+ .${A.root} .${A.inner} {
2129
+ transition: none;
2130
+ }
2131
+ }
2132
+ `;
2133
+ function ai() {
2134
+ return /* @__PURE__ */ i(Be, { styles: ii });
2135
+ }
2136
+ function It({
2137
+ className: e,
2138
+ label: t,
2139
+ text: r,
2140
+ hint: o,
2141
+ face: n,
2142
+ isFacingAway: a
2143
+ }) {
2144
+ return /* @__PURE__ */ w(
2145
+ v,
2146
+ {
2147
+ as: "div",
2148
+ display: "flex",
2149
+ ...n,
2150
+ className: e,
2151
+ "aria-hidden": a || void 0,
2152
+ children: [
2153
+ /* @__PURE__ */ i(S, { size: "small", children: t }),
2154
+ /* @__PURE__ */ i("div", { className: A.faceText, style: U, children: /* @__PURE__ */ i(S, { size: "large", children: r }) }),
2155
+ /* @__PURE__ */ i(S, { size: "small", color: "secondary", children: o })
2156
+ ]
2157
+ }
2158
+ );
2159
+ }
2160
+ function Lt({
2161
+ front: e,
2162
+ back: t,
2163
+ isFlipped: r,
2164
+ onFlip: o,
2165
+ face: n,
2166
+ interactive: a = !0,
2167
+ buttonRef: d
2168
+ }) {
2169
+ const { translations: c, translate: l } = Y(dt);
2170
+ return /* @__PURE__ */ i(
2171
+ "button",
2172
+ {
2173
+ type: "button",
2174
+ ref: d,
2175
+ className: A.flip,
2176
+ disabled: !a,
2177
+ onClick: o,
2178
+ "aria-pressed": r,
2179
+ "aria-label": r ? l("flashCardsBackAriaLabel", { answer: t ?? "" }) : l("flashCardsFrontAriaLabel", { question: e ?? "" }),
2180
+ children: /* @__PURE__ */ w("div", { className: r ? `${A.inner} ${A.flipped}` : A.inner, children: [
2181
+ /* @__PURE__ */ i(
2182
+ It,
2183
+ {
2184
+ className: A.face,
2185
+ label: c.flashCardsFrontLabel,
2186
+ text: e,
2187
+ hint: c.flashCardsFlipHint,
2188
+ face: n,
2189
+ isFacingAway: r
2190
+ }
2191
+ ),
2192
+ /* @__PURE__ */ i(
2193
+ It,
2194
+ {
2195
+ className: `${A.face} ${A.faceBack}`,
2196
+ label: c.flashCardsBackLabel,
2197
+ text: t,
2198
+ hint: c.flashCardsFlipHint,
2199
+ face: n,
2200
+ isFacingAway: !r
2201
+ }
2202
+ )
2203
+ ] })
2204
+ }
2205
+ );
2206
+ }
2207
+ function di(e, t, r) {
2208
+ const o = t === "rounded" ? "large" : "0", n = { borderRadius: o, padding: "medium none" }, { styling: a } = nt(e, r), { view: d, text: c } = de(a, n);
2209
+ return {
2210
+ container: d,
2211
+ text: c,
2212
+ face: { background: "primary", shadow: "resting", borderRadius: o, padding: "medium" }
2213
+ };
2214
+ }
2215
+ const li = Object.freeze([]);
2216
+ function Ot(e, t) {
2217
+ return { key: e, order: e === null ? null : Ee(t) };
2218
+ }
2219
+ function Nt(e, t) {
2220
+ return t && e !== null && document.activeElement === e;
2221
+ }
2222
+ function si({
2223
+ cards: e = [],
2224
+ randomize: t = !1,
2225
+ colorTheme: r = "light",
2226
+ cornerStyle: o = "rounded"
2227
+ }) {
2228
+ const n = le(), { translations: a, translate: d } = Y(dt), c = he(), l = po(), { container: u, text: h, face: g } = ee(
2229
+ () => di(r, o, c),
2230
+ [r, o, c]
2231
+ ), p = e ?? li, C = ee(
2232
+ () => t && !n ? JSON.stringify(p.map(({ front: O, back: B }) => [O, B])) : null,
2233
+ [p, t, n]
2234
+ ), [T, I] = j(() => Ot(C, p));
2235
+ let x = T;
2236
+ x.key !== C && (x = Ot(C, p), I(x));
2237
+ const P = x.order ?? p, [G, M] = j(0), [D, F] = j(!1), [te, q] = j("none"), [Z, W] = j(null), [K, ae] = j(""), $ = P.length, z = $ === 0 ? 0 : Math.max(0, Math.min(G, $ - 1)), N = P[z], f = re(null), y = re(null), m = re(null), b = re(!1), R = J(() => F((O) => !O), []), E = J(
2238
+ (O, B, xo) => {
2239
+ var ht;
2240
+ if (l) {
2241
+ const { front: To, back: Ao } = P[z] ?? {};
2242
+ W({ front: To, back: Ao, direction: B, isFlipped: D });
2243
+ }
2244
+ F(!1), q(B), M(O);
2245
+ const ut = { current: O + 1, total: $ }, Ae = (ht = P[O]) == null ? void 0 : ht.front;
2246
+ ae(
2247
+ Ae != null && Ae.trim() && !xo ? d("flashCardsCardAnnouncement", { ...ut, question: Ae }) : d("flashCardsCounter", ut)
2248
+ );
2249
+ },
2250
+ [l, D, P, z, $, d]
2251
+ ), _ = J(() => {
2252
+ if (z < $ - 1) {
2253
+ const O = z + 1, B = Nt(m.current, O === $ - 1);
2254
+ b.current = B, E(O, "next", B);
2255
+ }
2256
+ }, [E, z, $]), H = J(() => {
2257
+ if (z > 0) {
2258
+ const O = z - 1, B = Nt(y.current, O === 0);
2259
+ b.current = B, E(O, "prev", B);
2260
+ }
2261
+ }, [E, z]);
2262
+ return ve(() => {
2263
+ var O;
2264
+ b.current && (b.current = !1, (O = f.current) == null || O.focus());
2265
+ }, [z]), zo(() => {
2266
+ G !== z && (M(z), F(!1), q("none"), W(null), ae(""));
2267
+ }, [G, z]), ve(() => {
2268
+ if (!Z)
2269
+ return;
2270
+ const O = setTimeout(() => W(null), bo + 50);
2271
+ return () => clearTimeout(O);
2272
+ }, [Z]), $ === 0 ? n ? /* @__PURE__ */ i(v, { as: "div", className: `bce-block ${A.root}`, children: /* @__PURE__ */ i(v, { as: "div", ...u, padding: "medium", textAlign: "center", children: /* @__PURE__ */ i(S, { color: h.color ?? "secondary", themeOverride: h.themeOverride, children: a.flashCardsPlaceholder }) }) }) : null : /* @__PURE__ */ w(
2273
+ v,
2274
+ {
2275
+ as: "div",
2276
+ ...u,
2277
+ overflowX: "hidden",
2278
+ overflowY: "hidden",
2279
+ className: `bce-block ${A.root}${l ? "" : ` ${A.motionOff}`}`,
2280
+ children: [
2281
+ /* @__PURE__ */ i(ai, {}),
2282
+ /* @__PURE__ */ i("div", { style: U, children: /* @__PURE__ */ w(k, { direction: "column", gap: "medium", children: [
2283
+ /* @__PURE__ */ i(k.Item, { padding: "none medium", overflowX: "visible", overflowY: "visible", children: /* @__PURE__ */ i(S, { weight: "bold", color: h.color, themeOverride: h.themeOverride, children: a.flashCardsTitle }) }),
2284
+ /* @__PURE__ */ i(k.Item, { overflowX: "visible", overflowY: "visible", children: /* @__PURE__ */ w("div", { className: A.viewport, children: [
2285
+ Z && // Keyed like the entering card: navigating again before this one has
2286
+ // finished must mount a fresh layer, or the browser sees the same element
2287
+ // with the same animation and does not replay it.
2288
+ /* @__PURE__ */ i(
2289
+ "div",
2290
+ {
2291
+ className: Rt("exit", Z.direction),
2292
+ onAnimationEnd: () => W(null),
2293
+ "aria-hidden": "true",
2294
+ children: /* @__PURE__ */ i(
2295
+ Lt,
2296
+ {
2297
+ front: Z.front,
2298
+ back: Z.back,
2299
+ isFlipped: Z.isFlipped,
2300
+ face: g,
2301
+ interactive: !1
2302
+ }
2303
+ )
2304
+ },
2305
+ `exit-${z}`
2306
+ ),
2307
+ /* @__PURE__ */ i("div", { className: Rt("enter", te), children: /* @__PURE__ */ i(
2308
+ Lt,
2309
+ {
2310
+ front: N == null ? void 0 : N.front,
2311
+ back: N == null ? void 0 : N.back,
2312
+ isFlipped: D,
2313
+ onFlip: R,
2314
+ face: g,
2315
+ buttonRef: f
2316
+ }
2317
+ ) }, `enter-${z}`)
2318
+ ] }) }),
2319
+ /* @__PURE__ */ i(k.Item, { overflowX: "visible", overflowY: "visible", children: /* @__PURE__ */ w(k, { gap: "small", alignItems: "center", justifyItems: "center", children: [
2320
+ /* @__PURE__ */ i(k.Item, { children: /* @__PURE__ */ i(
2321
+ pt,
2322
+ {
2323
+ screenReaderLabel: a.flashCardsPreviousCard,
2324
+ renderIcon: No,
2325
+ shape: "circle",
2326
+ size: "small",
2327
+ interaction: z <= 0 ? "disabled" : "enabled",
2328
+ onClick: H,
2329
+ elementRef: (O) => {
2330
+ y.current = O instanceof HTMLButtonElement ? O : null;
2331
+ }
2332
+ }
2333
+ ) }),
2334
+ /* @__PURE__ */ w(k.Item, { children: [
2335
+ /* @__PURE__ */ i(S, { color: h.color, themeOverride: h.themeOverride, children: d("flashCardsCounter", {
2336
+ current: z + 1,
2337
+ total: $
2338
+ }) }),
2339
+ /* @__PURE__ */ i("output", { className: A.srOnly, children: K })
2340
+ ] }),
2341
+ /* @__PURE__ */ i(k.Item, { children: /* @__PURE__ */ i(
2342
+ pt,
2343
+ {
2344
+ screenReaderLabel: a.flashCardsNextCard,
2345
+ renderIcon: Vt,
2346
+ shape: "circle",
2347
+ size: "small",
2348
+ interaction: z >= $ - 1 ? "disabled" : "enabled",
2349
+ onClick: _,
2350
+ elementRef: (O) => {
2351
+ m.current = O instanceof HTMLButtonElement ? O : null;
2352
+ }
2353
+ }
2354
+ ) })
2355
+ ] }) })
2356
+ ] }) })
2357
+ ]
2358
+ }
2359
+ );
2360
+ }
2361
+ const Et = 50, ci = s.object({
2362
+ front: s.string().zodTextarea().zodLabel("Front").zodHelp("The question side of the card"),
2363
+ back: s.string().zodTextarea().zodLabel("Back").zodHelp("The answer side of the card")
2364
+ }), ui = s.object({
2365
+ cards: s.array(ci).max(Et).default([]).zodLabel(`Flashcards (up to ${Et})`).zodItemLabel("front").zodItemName("Flashcard").zodManageLayer("Flashcards").zodHelp("Cards in this deck, each with a question and an answer"),
2366
+ // `.default(x).optional()` (optional outermost) is intentional: the default is applied
2367
+ // by the component and `FlashCardsDefaultProps`, not by schema `.parse()`.
2368
+ randomize: s.boolean().default(!1).optional().zodLabel("Randomize cards").zodHelp("Shuffle the card order each time"),
2369
+ colorTheme: Te.default("light").optional().zodLabel("Color").zodHelp("Background color theme for the flashcard container"),
2370
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Choose between rounded or sharp corners")
2371
+ }), We = {
2372
+ cards: [
2373
+ { front: "", back: "" },
2374
+ { front: "", back: "" },
2375
+ { front: "", back: "" }
2376
+ ],
2377
+ randomize: !1,
2378
+ colorTheme: "light",
2379
+ cornerStyle: "rounded"
2380
+ };
2381
+ for (const e of We.cards)
2382
+ Object.freeze(e);
2383
+ Object.freeze(We.cards);
2384
+ Object.freeze(We);
2385
+ const hi = ne(
2386
+ ui,
2387
+ "FlashCards"
2388
+ ), id = ie({
2389
+ wireName: "FlashCards",
2390
+ component: si,
2391
+ schema: hi,
2392
+ defaultProps: We,
2393
+ english: dt
2394
+ }), lt = {
2395
+ mixAndMatchTitle: "Mix and match",
2396
+ mixAndMatchPlaceholder: "Add mix and match...",
2397
+ mixAndMatchInstructions: "Click a card from the left and then right to pair.",
2398
+ mixAndMatchCompleteTitle: "Nice work!",
2399
+ mixAndMatchCompleteSubtitle: "You matched all the cards.",
2400
+ mixAndMatchPracticeAgain: "Practice again",
2401
+ mixAndMatchReset: "Reset",
2402
+ mixAndMatchCorrect: "Correct match!",
2403
+ mixAndMatchIncorrect: "Incorrect match, try again.",
2404
+ mixAndMatchCloseFeedback: "Close match feedback message",
2405
+ mixAndMatchTermAriaLabel: "Term: %{text}",
2406
+ mixAndMatchDefinitionAriaLabel: "Definition: %{text}",
2407
+ mixAndMatchProgress: "%{matched} of %{total} matched",
2408
+ mixAndMatchProgressShort: "%{matched}/%{total}"
2409
+ }, mi = {
2410
+ default: { borderWidth: "small", borderColor: "transparent" },
2411
+ selected: { borderWidth: "small small large large", borderColor: "brand" },
2412
+ correct: { borderWidth: "small small large large", borderColor: "success" },
2413
+ incorrect: { borderWidth: "small small large large", borderColor: "danger" }
2414
+ };
2415
+ function fi(e) {
2416
+ return mi[e];
2417
+ }
2418
+ function pi(e, t, r) {
2419
+ const o = t === "rounded" ? "large" : "0", n = { borderRadius: o, padding: "medium" }, { styling: a, isDarkSurface: d } = nt(e, r), { view: c, text: l } = de(a, n), u = ue(r, "dark");
2420
+ return {
2421
+ container: c,
2422
+ text: l,
2423
+ card: {
2424
+ background: "primary",
2425
+ shadow: "resting",
2426
+ borderRadius: o,
2427
+ padding: "medium",
2428
+ themeOverride: u ? { borderColorBrand: u.color, focusColorInfo: u.color } : void 0
2429
+ },
2430
+ focusColor: d ? "inverse" : "info",
2431
+ progressColor: d ? "primary-inverse" : "primary"
2432
+ };
2433
+ }
2434
+ const bi = "640px", Pt = 400, Bt = "0.75rem", L = {
2435
+ /**
2436
+ * The activity's outermost element. It carries `container-type`, so it is also the
2437
+ * ancestor every `@container` rule below resolves against — which is why the padded
2438
+ * panel has to be a separate element inside it rather than this one.
2439
+ */
2440
+ root: "bce-block-mixandmatch",
2441
+ /** Set on the root when motion is switched off; see `useMotionEnabled`. */
2442
+ motionOff: "bce-mixandmatch-no-motion",
2443
+ panel: "bce-mixandmatch-panel",
2444
+ grid: "bce-mixandmatch-grid",
2445
+ column: "bce-mixandmatch-column",
2446
+ card: "bce-mixandmatch-card",
2447
+ /** A matched card: still laid out, so the cards below it do not jump up the column. */
2448
+ cardMatched: "bce-mixandmatch-card-matched"
2449
+ }, gi = Pe`
2450
+ .${L.root} {
2451
+ container-type: inline-size;
2452
+ width: 100%;
2453
+ }
2454
+
2455
+ .${L.grid} {
2456
+ display: grid;
2457
+ grid-template-columns: 1fr 1fr;
2458
+ gap: 3rem;
2459
+ width: 100%;
2460
+ min-width: 0;
2461
+ }
2462
+
2463
+ .${L.column} {
2464
+ display: flex;
2465
+ flex-direction: column;
2466
+ gap: 1rem;
2467
+ min-width: 0;
2468
+ }
2469
+
2470
+ /*
2471
+ * Both transitions are declared together: split across two rules, the more specific one
2472
+ * would replace the other outright rather than adding to it.
2473
+ */
2474
+ .${L.root} .${L.card} {
2475
+ display: block;
2476
+ width: 100%;
2477
+ min-width: 0;
2478
+ min-height: 8.125rem;
2479
+ box-sizing: border-box;
2480
+ cursor: pointer;
2481
+ text-align: start;
2482
+ transition:
2483
+ border-color 0.15s ease,
2484
+ opacity ${Pt}ms ease,
2485
+ visibility 0s linear ${Pt}ms;
2486
+ }
2487
+
2488
+ .${L.root} .${L.card}:disabled {
2489
+ cursor: default;
2490
+ }
2491
+
2492
+ /*
2493
+ * A matched card keeps its space but leaves the tab order and the a11y tree. The
2494
+ * visibility delay above matches the fade, so it stays hittable for exactly as long as
2495
+ * it is still visible.
2496
+ */
2497
+ .${L.root} .${L.cardMatched} {
2498
+ opacity: 0;
2499
+ visibility: hidden;
2500
+ pointer-events: none;
2501
+ }
2502
+
2503
+ /*
2504
+ * Narrow columns wrap the text far more, so the cards need height and the padding has
2505
+ * to give some width back. Both override a token the element sets on itself, hence the
2506
+ * child selectors.
2507
+ */
2508
+ @container (max-width: ${bi}) {
2509
+ .${L.grid} {
2510
+ gap: 0.5rem;
2511
+ }
2512
+ .${L.root} > .${L.panel} {
2513
+ padding: ${Bt};
2514
+ }
2515
+ .${L.root} .${L.card} {
2516
+ min-height: 12.5rem;
2517
+ padding: ${Bt};
2518
+ }
2519
+ }
2520
+
2521
+ /*
2522
+ * Buttons are swept up alongside the cards because InstUI animates its own focus ring
2523
+ * from a hardcoded 0.2s that reads nothing from the theme, and Button — unlike View —
2524
+ * exposes no way to switch it off. Both selectors outweigh the single emotion class
2525
+ * InstUI declares that transition in.
2526
+ */
2527
+ .${L.motionOff} .${L.card},
2528
+ .${L.motionOff} button {
2529
+ transition: none;
2530
+ }
2531
+
2532
+ /*
2533
+ * Qualified by the root, like the rule above it: that outweighs the card's own
2534
+ * transition on specificity, rather than only on being written last.
2535
+ */
2536
+ @media (prefers-reduced-motion: reduce) {
2537
+ .${L.root} .${L.card},
2538
+ .${L.root} button {
2539
+ transition: none;
2540
+ }
2541
+ }
2542
+ `;
2543
+ function vi() {
2544
+ return /* @__PURE__ */ i(Be, { styles: gi });
2545
+ }
2546
+ const Mt = 100;
2547
+ function _t({
2548
+ text: e,
2549
+ state: t,
2550
+ matched: r,
2551
+ card: o,
2552
+ disabled: n,
2553
+ ariaDisabled: a,
2554
+ label: d,
2555
+ pressed: c,
2556
+ onClick: l,
2557
+ elementRef: u
2558
+ }) {
2559
+ const h = e.length > Mt, g = h ? `${e.slice(0, Mt)}…` : e;
2560
+ return /* @__PURE__ */ i(
2561
+ v,
2562
+ {
2563
+ ...o,
2564
+ ...fi(t),
2565
+ as: "button",
2566
+ type: "button",
2567
+ focusPosition: "inset",
2568
+ disabled: n,
2569
+ "aria-disabled": a || void 0,
2570
+ "aria-label": d,
2571
+ "aria-pressed": c,
2572
+ onClick: l,
2573
+ elementRef: u,
2574
+ className: `${L.card}${r ? ` ${L.cardMatched}` : ""}`,
2575
+ children: /* @__PURE__ */ i("div", { style: U, title: h ? e : void 0, children: /* @__PURE__ */ i(S, { children: g }) })
2576
+ }
2577
+ );
2578
+ }
2579
+ const Ci = 600, yi = 1e3, $t = "\0", ki = "";
2580
+ function wi(e, t, r) {
2581
+ const o = e.map((n) => `${n.term}${$t}${n.definition}`).join(ki);
2582
+ return [t, String(r), o].join($t);
2583
+ }
2584
+ function fe(e) {
2585
+ return e.state === "correct" || e.matched;
2586
+ }
2587
+ function go(e) {
2588
+ return !e.matched && (e.state === "correct" || e.state === "incorrect");
2589
+ }
2590
+ function xi(e, t) {
2591
+ return !go(e) && (fe(e) || !t);
2592
+ }
2593
+ function Ti(e) {
2594
+ return e === null || e === document.body ? !1 : e.isConnected && !e.matches(":disabled");
2595
+ }
2596
+ function Ht(e, t) {
2597
+ return e.map((r, o) => ({
2598
+ id: `${t}-${o}`,
2599
+ text: t === "term" ? r.term : r.definition,
2600
+ pairIndex: o,
2601
+ state: "default",
2602
+ matched: !1
2603
+ }));
2604
+ }
2605
+ function Ai(e, t, r) {
2606
+ const o = t === "on" && !r ? Ee(e) : e, n = Ht(o, "definition");
2607
+ return {
2608
+ terms: Ht(o, "term"),
2609
+ // Shuffled whatever `randomizeCards` says: left in step the two columns line up row by
2610
+ // row and the activity answers itself.
2611
+ definitions: r ? n : Ee(n)
2612
+ };
2613
+ }
2614
+ function Si({
2615
+ pairs: e = [],
2616
+ randomizeCards: t = "on",
2617
+ colorTheme: r = "light",
2618
+ cornerStyle: o = "rounded"
2619
+ }) {
2620
+ const n = le(), { translations: a } = Y(lt), d = he(), c = ee(
2621
+ () => pi(r, o, d),
2622
+ [r, o, d]
2623
+ ), l = e ?? [];
2624
+ return l.length === 0 ? n ? /* @__PURE__ */ i(v, { as: "div", className: `bce-block ${L.root}`, children: /* @__PURE__ */ i(v, { as: "div", ...c.container, className: L.panel, textAlign: "center", children: /* @__PURE__ */ i(S, { color: c.text.color ?? "secondary", themeOverride: c.text.themeOverride, children: a.mixAndMatchPlaceholder }) }) }) : null : /* @__PURE__ */ i(
2625
+ zi,
2626
+ {
2627
+ pairs: l,
2628
+ randomizeCards: t,
2629
+ isDesignerMode: n,
2630
+ view: c
2631
+ },
2632
+ wi(l, t, n)
2633
+ );
2634
+ }
2635
+ function zi({ pairs: e, randomizeCards: t, isDesignerMode: r, view: o }) {
2636
+ const { translations: n, translate: a } = Y(lt), d = po(), [c] = j(() => Ai(e, t, r)), [l, u] = j(c.terms), [h, g] = j(c.definitions), [p, C] = j(null), [T, I] = j(null), x = re([]), P = re(/* @__PURE__ */ new Map()), G = re(null), M = re(null), D = re(null), F = J(() => {
2637
+ for (const f of x.current)
2638
+ clearTimeout(f);
2639
+ x.current = [], D.current = null;
2640
+ }, []), te = J((f, y) => {
2641
+ const m = setTimeout(() => {
2642
+ x.current = x.current.filter((b) => b !== m), f();
2643
+ }, y);
2644
+ return x.current.push(m), m;
2645
+ }, []), q = J(() => {
2646
+ const f = D.current;
2647
+ f !== null && (clearTimeout(f), x.current = x.current.filter((y) => y !== f), D.current = null);
2648
+ }, []);
2649
+ ve(() => F, [F]), ve(() => {
2650
+ var y, m;
2651
+ const f = M.current;
2652
+ f && (M.current = null, !Ti(document.activeElement) && (f === "restart" ? (y = G.current) == null || y.focus() : (m = P.current.get(f)) == null || m.focus()));
2653
+ });
2654
+ const Z = l.filter((f) => f.matched).length, W = l.length, K = Z === W, ae = J((f, y) => {
2655
+ I((m) => ({ seq: ((m == null ? void 0 : m.seq) ?? 0) + 1, variant: f, message: y }));
2656
+ }, []), $ = J(() => {
2657
+ var f;
2658
+ F(), u(c.terms), g(c.definitions), C(null), I(null), M.current = ((f = c.terms[0]) == null ? void 0 : f.id) ?? null;
2659
+ }, [c, F]), z = J(
2660
+ (f) => {
2661
+ if (l.some((m) => m.id === f && fe(m)))
2662
+ return;
2663
+ q(), I(null);
2664
+ const y = p === f;
2665
+ C(y ? null : f), u(
2666
+ (m) => m.map((b) => {
2667
+ if (fe(b))
2668
+ return b;
2669
+ const R = !y && b.id === f ? "selected" : "default";
2670
+ return b.state === R ? b : { ...b, state: R };
2671
+ })
2672
+ ), g(
2673
+ (m) => m.map(
2674
+ (b) => b.state === "incorrect" ? { ...b, state: "default" } : b
2675
+ )
2676
+ );
2677
+ },
2678
+ [p, l, q]
2679
+ ), N = J(
2680
+ (f) => {
2681
+ if (!p)
2682
+ return;
2683
+ const y = h.find((_) => _.id === f), m = l.find((_) => _.id === p);
2684
+ if (!y || !m || fe(y) || fe(m))
2685
+ return;
2686
+ const b = y.pairIndex === m.pairIndex, R = (_) => _.id === p || _.id === f, E = (_) => (H) => R(H) ? { ...H, state: _ } : H;
2687
+ if (C(null), u((_) => _.map(E(b ? "correct" : "incorrect"))), g((_) => _.map(E(b ? "correct" : "incorrect"))), b) {
2688
+ ae("success", n.mixAndMatchCorrect);
2689
+ const _ = l.filter((H) => !fe(H) && H.id !== p);
2690
+ te(() => {
2691
+ var O;
2692
+ const H = (B) => R(B) ? { ...B, matched: !0 } : B;
2693
+ u((B) => B.map(H)), g((B) => B.map(H)), M.current = ((O = _[0]) == null ? void 0 : O.id) ?? "restart";
2694
+ }, Ci);
2695
+ return;
2696
+ }
2697
+ ae("error", n.mixAndMatchIncorrect), D.current = te(() => {
2698
+ D.current = null;
2699
+ const _ = (H) => R(H) && H.state === "incorrect" ? { ...H, state: "default" } : H;
2700
+ u((H) => H.map(_)), g((H) => H.map(_)), M.current = p;
2701
+ }, yi);
2702
+ },
2703
+ [p, h, l, ae, te, n]
2704
+ );
2705
+ return /* @__PURE__ */ w(
2706
+ v,
2707
+ {
2708
+ as: "div",
2709
+ className: `bce-block ${L.root}${d ? "" : ` ${L.motionOff}`}`,
2710
+ children: [
2711
+ /* @__PURE__ */ i(vi, {}),
2712
+ /* @__PURE__ */ i(et, { as: "div", children: /* @__PURE__ */ i("div", { role: "alert", "aria-live": "assertive", "aria-atomic": "true", children: K ? (
2713
+ /*
2714
+ * The completion panel swaps in silently — a screen reader would hear only the
2715
+ * name of the button focus lands on — so the finish goes through the same region
2716
+ * the match feedback does. `aria-atomic` reads the two sentences as one
2717
+ * announcement, which is how they are shown.
2718
+ */
2719
+ /* @__PURE__ */ w("span", { children: [
2720
+ n.mixAndMatchCompleteTitle,
2721
+ " ",
2722
+ n.mixAndMatchCompleteSubtitle
2723
+ ] }, "complete")
2724
+ ) : T && /* @__PURE__ */ i("span", { children: T.message }, T.seq) }) }),
2725
+ /* @__PURE__ */ i(v, { as: "div", ...o.container, className: L.panel, children: /* @__PURE__ */ w(k, { direction: "column", gap: "medium", children: [
2726
+ /* @__PURE__ */ w(k.Item, { overflowX: "visible", overflowY: "visible", children: [
2727
+ /* @__PURE__ */ i(
2728
+ S,
2729
+ {
2730
+ weight: "bold",
2731
+ transform: "uppercase",
2732
+ color: o.text.color,
2733
+ themeOverride: o.text.themeOverride,
2734
+ children: n.mixAndMatchTitle
2735
+ }
2736
+ ),
2737
+ !K && /* @__PURE__ */ i(v, { as: "div", padding: "x-small none none", children: /* @__PURE__ */ i(S, { color: o.text.color, themeOverride: o.text.themeOverride, children: n.mixAndMatchInstructions }) })
2738
+ ] }),
2739
+ K ? /* @__PURE__ */ i(k.Item, { overflowX: "visible", overflowY: "visible", children: /* @__PURE__ */ w(v, { as: "div", padding: "large none", textAlign: "center", children: [
2740
+ /* @__PURE__ */ i(
2741
+ S,
2742
+ {
2743
+ as: "div",
2744
+ size: "xx-large",
2745
+ weight: "bold",
2746
+ color: o.text.color,
2747
+ themeOverride: o.text.themeOverride,
2748
+ children: n.mixAndMatchCompleteTitle
2749
+ }
2750
+ ),
2751
+ /* @__PURE__ */ i(v, { as: "div", padding: "x-small none medium", children: /* @__PURE__ */ i(S, { color: o.text.color, themeOverride: o.text.themeOverride, children: n.mixAndMatchCompleteSubtitle }) }),
2752
+ /* @__PURE__ */ i(
2753
+ Ne,
2754
+ {
2755
+ color: "primary",
2756
+ focusColor: o.focusColor,
2757
+ onClick: $,
2758
+ elementRef: (f) => {
2759
+ G.current = f instanceof HTMLElement ? f : null;
2760
+ },
2761
+ children: n.mixAndMatchPracticeAgain
2762
+ }
2763
+ )
2764
+ ] }) }) : /* @__PURE__ */ w(ye, { children: [
2765
+ /* @__PURE__ */ i(k.Item, { overflowX: "visible", overflowY: "visible", children: /* @__PURE__ */ w(k, { gap: "small", alignItems: "center", children: [
2766
+ /* @__PURE__ */ i(k.Item, { shouldGrow: !0, shouldShrink: !0, children: /* @__PURE__ */ i(
2767
+ _o,
2768
+ {
2769
+ size: "small",
2770
+ color: o.progressColor,
2771
+ valueNow: Z,
2772
+ valueMax: W,
2773
+ screenReaderLabel: a("mixAndMatchProgress", { matched: Z, total: W }),
2774
+ renderValue: ({ valueNow: f, valueMax: y }) => /* @__PURE__ */ i(
2775
+ S,
2776
+ {
2777
+ size: "small",
2778
+ color: o.text.color,
2779
+ themeOverride: o.text.themeOverride,
2780
+ children: a("mixAndMatchProgressShort", {
2781
+ matched: f,
2782
+ total: y
2783
+ })
2784
+ }
2785
+ )
2786
+ }
2787
+ ) }),
2788
+ /* @__PURE__ */ i(k.Item, { overflowX: "visible", overflowY: "visible", children: /* @__PURE__ */ i(
2789
+ Ne,
2790
+ {
2791
+ size: "small",
2792
+ color: "primary",
2793
+ focusColor: o.focusColor,
2794
+ onClick: $,
2795
+ children: n.mixAndMatchReset
2796
+ }
2797
+ ) })
2798
+ ] }) }),
2799
+ T && /* @__PURE__ */ i(k.Item, { overflowX: "visible", overflowY: "visible", children: /* @__PURE__ */ i(
2800
+ Mo,
2801
+ {
2802
+ variant: T.variant,
2803
+ margin: "none",
2804
+ timeout: 5e3,
2805
+ renderCloseButtonLabel: n.mixAndMatchCloseFeedback,
2806
+ onDismiss: () => I(null),
2807
+ children: T.message
2808
+ },
2809
+ T.seq
2810
+ ) }),
2811
+ /* @__PURE__ */ i(k.Item, { overflowX: "visible", overflowY: "visible", children: /* @__PURE__ */ w("div", { className: L.grid, children: [
2812
+ /* @__PURE__ */ i("div", { className: L.column, children: l.map((f) => /* @__PURE__ */ i(
2813
+ _t,
2814
+ {
2815
+ text: f.text,
2816
+ state: f.state,
2817
+ matched: f.matched,
2818
+ card: o.card,
2819
+ disabled: fe(f),
2820
+ pressed: f.state === "selected",
2821
+ label: a("mixAndMatchTermAriaLabel", { text: f.text }),
2822
+ onClick: () => z(f.id),
2823
+ elementRef: (y) => {
2824
+ y ? P.current.set(f.id, y) : P.current.delete(f.id);
2825
+ }
2826
+ },
2827
+ f.id
2828
+ )) }),
2829
+ /* @__PURE__ */ i("div", { className: L.column, children: h.map((f) => /* @__PURE__ */ i(
2830
+ _t,
2831
+ {
2832
+ text: f.text,
2833
+ state: f.state,
2834
+ matched: f.matched,
2835
+ card: o.card,
2836
+ disabled: xi(f, p),
2837
+ ariaDisabled: go(f),
2838
+ label: a("mixAndMatchDefinitionAriaLabel", {
2839
+ text: f.text
2840
+ }),
2841
+ onClick: () => N(f.id)
2842
+ },
2843
+ f.id
2844
+ )) })
2845
+ ] }) })
2846
+ ] })
2847
+ ] }) })
2848
+ ]
2849
+ }
2850
+ );
2851
+ }
2852
+ const Dt = 10, Ri = s.object({
2853
+ term: s.string().zodTextarea().zodLabel("Left").zodHelp("The card shown in the left column"),
2854
+ definition: s.string().zodTextarea().zodLabel("Right").zodHelp("The card it pairs with, shown in the right column")
2855
+ }), Ii = s.enum(["on", "off"]), Li = s.object({
2856
+ pairs: s.array(Ri).max(Dt).default([]).zodLabel(`Sets (up to ${Dt})`).zodItemLabel("term").zodItemName("Set").zodManageLayer("Sets").zodHelp("Pairs of cards the learner matches up"),
2857
+ // `.default(x).optional()` (optional outermost) is intentional: the default is applied
2858
+ // by the component and `MixAndMatchDefaultProps`, not by schema `.parse()`.
2859
+ randomizeCards: Ii.default("on").optional().zodLabel("Randomize order (Preview to see change)").zodHelp("Shuffle the card order each time"),
2860
+ colorTheme: Te.default("light").optional().zodLabel("Color").zodHelp("Background color theme for the container"),
2861
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Choose between rounded or sharp corners")
2862
+ }), je = {
2863
+ pairs: [
2864
+ { term: "", definition: "" },
2865
+ { term: "", definition: "" },
2866
+ { term: "", definition: "" },
2867
+ { term: "", definition: "" }
2868
+ ],
2869
+ randomizeCards: "on",
2870
+ colorTheme: "light",
2871
+ cornerStyle: "rounded"
2872
+ };
2873
+ for (const e of je.pairs)
2874
+ Object.freeze(e);
2875
+ Object.freeze(je.pairs);
2876
+ Object.freeze(je);
2877
+ const Oi = ne(
2878
+ Li,
2879
+ "MixAndMatch"
2880
+ ), ad = ie({
2881
+ wireName: "MixAndMatch",
2882
+ component: Si,
2883
+ schema: Oi,
2884
+ defaultProps: je,
2885
+ english: lt
2886
+ }), st = {
2887
+ knowledgeCheckTitle: "Knowledge check",
2888
+ knowledgeCheckPlaceholder: "Add knowledge check...",
2889
+ knowledgeCheckQuestionPlaceholder: "Your question here",
2890
+ knowledgeCheckAnswerPlaceholder: "Answer %{index}",
2891
+ knowledgeCheckSelectOne: "Select one answer.",
2892
+ knowledgeCheckSelectAll: "Select all that apply.",
2893
+ knowledgeCheckCheckAnswer: "Check answer",
2894
+ knowledgeCheckTryAgain: "Try again",
2895
+ knowledgeCheckPracticeAgain: "Practice again",
2896
+ knowledgeCheckCorrect: "Nice work! You got the correct answer!",
2897
+ knowledgeCheckIncorrect: "Oops, that's incorrect.",
2898
+ knowledgeCheckAnswerCorrectLabel: "Correct",
2899
+ knowledgeCheckAnswerIncorrectLabel: "Incorrect"
2900
+ }, Ni = {
2901
+ default: { borderWidth: "small", borderColor: "primary" },
2902
+ correct: { borderWidth: "small", borderColor: "success" },
2903
+ incorrect: { borderWidth: "small", borderColor: "danger" }
2904
+ };
2905
+ function Ei(e) {
2906
+ return Ni[e];
2907
+ }
2908
+ function Pi(e, t, r) {
2909
+ const o = t === "rounded" ? "large" : "0", { view: n, text: a } = de(ao(e, r), {
2910
+ borderRadius: "0",
2911
+ padding: "medium"
2912
+ });
2913
+ return {
2914
+ container: {
2915
+ background: "primary",
2916
+ borderWidth: "small",
2917
+ borderColor: "primary",
2918
+ borderRadius: o
2919
+ },
2920
+ band: n,
2921
+ bandText: a,
2922
+ answer: {
2923
+ background: "primary",
2924
+ borderRadius: t === "rounded" ? "medium" : "0",
2925
+ padding: "small medium"
2926
+ }
2927
+ };
2928
+ }
2929
+ function Bi({
2930
+ id: e,
2931
+ label: t,
2932
+ isMultiSelect: r,
2933
+ groupName: o,
2934
+ checked: n,
2935
+ disabled: a,
2936
+ state: d,
2937
+ view: c,
2938
+ stateLabel: l,
2939
+ onToggle: u,
2940
+ inputRef: h
2941
+ }) {
2942
+ const g = d === "default" ? null : /* @__PURE__ */ w(k.Item, { children: [
2943
+ d === "correct" ? /* @__PURE__ */ i(Ft, { color: "success" }) : /* @__PURE__ */ i(Zt, { color: "error" }),
2944
+ /* @__PURE__ */ i(et, { children: l })
2945
+ ] }), p = /* @__PURE__ */ i("div", { style: U, children: t });
2946
+ return /* @__PURE__ */ i(v, { as: "div", ...c, ...Ei(d), children: /* @__PURE__ */ w(k, { gap: "small", justifyItems: "space-between", alignItems: "center", children: [
2947
+ /* @__PURE__ */ i(k.Item, { shouldGrow: !0, shouldShrink: !0, children: r ? /* @__PURE__ */ i(
2948
+ $o,
2949
+ {
2950
+ label: p,
2951
+ value: e,
2952
+ checked: n,
2953
+ disabled: a,
2954
+ onChange: (C) => u(C.target.checked),
2955
+ inputRef: h
2956
+ }
2957
+ ) : /* @__PURE__ */ i(
2958
+ Ho,
2959
+ {
2960
+ label: p,
2961
+ name: o,
2962
+ value: e,
2963
+ checked: n,
2964
+ disabled: a,
2965
+ onChange: () => u(!0),
2966
+ inputRef: h
2967
+ }
2968
+ ) }),
2969
+ g
2970
+ ] }) });
2971
+ }
2972
+ const qe = "\0", Mi = "";
2973
+ function _i(e, t, r, o) {
2974
+ const n = t.map(
2975
+ (a) => `${a.id}${qe}${a.label}${qe}${a.isCorrect}`
2976
+ ).join(Mi);
2977
+ return [e, r, String(o), n].join(qe);
2978
+ }
2979
+ function $i({
2980
+ questionType: e = "Multiple choice",
2981
+ question: t,
2982
+ answerOrder: r = "set",
2983
+ answers: o = [],
2984
+ headerStyle: n = "none",
2985
+ cornerStyle: a = "rounded"
2986
+ }) {
2987
+ const d = le(), { translations: c } = Y(st), l = he(), u = ee(
2988
+ () => Pi(n, a, l),
2989
+ [n, a, l]
2990
+ ), h = o ?? [];
2991
+ return h.length === 0 ? d ? /* @__PURE__ */ i(
2992
+ v,
2993
+ {
2994
+ as: "div",
2995
+ ...u.container,
2996
+ textAlign: "center",
2997
+ padding: "medium",
2998
+ className: "bce-block bce-block-knowledgecheck",
2999
+ children: /* @__PURE__ */ i(S, { color: "secondary", children: c.knowledgeCheckPlaceholder })
3000
+ }
3001
+ ) : null : /* @__PURE__ */ i(
3002
+ Hi,
3003
+ {
3004
+ questionType: e,
3005
+ question: t,
3006
+ answerOrder: r,
3007
+ answers: h,
3008
+ isDesignerMode: d,
3009
+ view: u
3010
+ },
3011
+ _i(e, h, r, d)
3012
+ );
3013
+ }
3014
+ function Hi({ questionType: e, question: t, answerOrder: r, answers: o, isDesignerMode: n, view: a }) {
3015
+ const { translations: d, translate: c } = Y(st), l = jt(), u = `${l}-answers`, h = `${l}-question`, g = `${l}-hint`, [p, C] = j([]), [T, I] = j("initial"), [x, P] = j(null), G = re(null), M = re(null), D = re(null), F = J((m) => {
3016
+ M.current = m instanceof HTMLElement ? m : null;
3017
+ }, []), te = J((m) => {
3018
+ G.current = m;
3019
+ }, []), q = e === "Multiple choice", [Z] = j(
3020
+ () => r === "random" && q && !n ? Ee(o) : o
3021
+ ), W = T !== "initial", K = T === "correct", ae = J(
3022
+ (m, b) => {
3023
+ C((R) => q ? b ? R.includes(m) ? R : [...R, m] : R.filter((E) => E !== m) : b ? [m] : []);
3024
+ },
3025
+ [q]
3026
+ ), $ = () => {
3027
+ var R;
3028
+ const m = Z.filter((E, _) => p.includes(_)), b = q ? m.length === Z.filter((E) => E.isCorrect).length && m.every((E) => E.isCorrect) : ((R = m[0]) == null ? void 0 : R.isCorrect) ?? !1;
3029
+ I(b ? "correct" : "incorrect"), P((E) => ({
3030
+ seq: ((E == null ? void 0 : E.seq) ?? 0) + 1,
3031
+ message: b ? d.knowledgeCheckCorrect : d.knowledgeCheckIncorrect
3032
+ })), D.current = "action";
3033
+ }, z = () => {
3034
+ C([]), I("initial"), P(null), D.current = "firstAnswer";
3035
+ };
3036
+ ve(() => {
3037
+ var b, R;
3038
+ const m = D.current;
3039
+ m && (D.current = null, m === "action" ? (b = M.current) == null || b.focus() : (R = G.current) == null || R.focus());
3040
+ }, [T]);
3041
+ const N = (m, b) => !W || !p.includes(b) ? "default" : m.isCorrect ? "correct" : "incorrect", f = (m) => {
3042
+ if (m !== "default")
3043
+ return m === "correct" ? d.knowledgeCheckAnswerCorrectLabel : d.knowledgeCheckAnswerIncorrectLabel;
3044
+ }, y = n && !t ? d.knowledgeCheckQuestionPlaceholder : t;
3045
+ return /* @__PURE__ */ w(
3046
+ v,
3047
+ {
3048
+ as: "div",
3049
+ ...a.container,
3050
+ overflowX: "hidden",
3051
+ overflowY: "hidden",
3052
+ className: "bce-block bce-block-knowledgecheck",
3053
+ children: [
3054
+ /* @__PURE__ */ i(et, { as: "div", children: /* @__PURE__ */ i("div", { role: "alert", "aria-live": "assertive", "aria-atomic": "true", children: x && /* @__PURE__ */ i("span", { children: x.message }, x.seq) }) }),
3055
+ /* @__PURE__ */ i(v, { as: "div", ...a.band, children: /* @__PURE__ */ w(k, { direction: "column", gap: "small", children: [
3056
+ /* @__PURE__ */ i(k.Item, { children: /* @__PURE__ */ i(
3057
+ S,
3058
+ {
3059
+ as: "div",
3060
+ size: "small",
3061
+ weight: "bold",
3062
+ transform: "uppercase",
3063
+ letterSpacing: "expanded",
3064
+ color: a.bandText.color,
3065
+ themeOverride: a.bandText.themeOverride,
3066
+ children: d.knowledgeCheckTitle
3067
+ }
3068
+ ) }),
3069
+ /* @__PURE__ */ i(k.Item, { children: /* @__PURE__ */ i("div", { id: h, style: U, children: /* @__PURE__ */ i(
3070
+ ke,
3071
+ {
3072
+ level: "h2",
3073
+ color: a.bandText.color,
3074
+ themeOverride: a.bandText.themeOverride,
3075
+ children: y
3076
+ }
3077
+ ) }) })
3078
+ ] }) }),
3079
+ /* @__PURE__ */ i(v, { as: "div", padding: "medium", children: /* @__PURE__ */ w(k, { direction: "column", gap: "x-small", children: [
3080
+ /* @__PURE__ */ i(k.Item, { padding: "0 0 x-small 0", children: /* @__PURE__ */ i(S, { size: "small", color: "secondary", children: /* @__PURE__ */ i("span", { id: g, children: q ? d.knowledgeCheckSelectAll : d.knowledgeCheckSelectOne }) }) }),
3081
+ /* @__PURE__ */ i(
3082
+ "div",
3083
+ {
3084
+ role: q ? "group" : "radiogroup",
3085
+ "aria-labelledby": h,
3086
+ "aria-describedby": g,
3087
+ children: /* @__PURE__ */ i(k, { direction: "column", gap: "x-small", children: Z.map((m, b) => {
3088
+ const R = N(m, b);
3089
+ return (
3090
+ // Keyed by position for the same reason the selection is, and React treats
3091
+ // duplicate keys as unsupported rather than merely warning about them.
3092
+ /* @__PURE__ */ i(k.Item, { overflowX: "visible", overflowY: "visible", children: /* @__PURE__ */ i(
3093
+ Bi,
3094
+ {
3095
+ id: m.id,
3096
+ label: m.label || c("knowledgeCheckAnswerPlaceholder", { index: b + 1 }),
3097
+ isMultiSelect: q,
3098
+ groupName: u,
3099
+ checked: p.includes(b),
3100
+ disabled: W,
3101
+ state: R,
3102
+ stateLabel: f(R),
3103
+ view: a.answer,
3104
+ onToggle: (E) => ae(b, E),
3105
+ inputRef: b === 0 ? te : void 0
3106
+ }
3107
+ ) }, b)
3108
+ );
3109
+ }) })
3110
+ }
3111
+ )
3112
+ ] }) }),
3113
+ /* @__PURE__ */ i(v, { as: "div", padding: "0 medium medium", children: /* @__PURE__ */ i(
3114
+ v,
3115
+ {
3116
+ as: "div",
3117
+ padding: W ? "small medium" : "0",
3118
+ borderWidth: W ? "small" : "0",
3119
+ borderColor: K ? "success" : "danger",
3120
+ borderRadius: a.answer.borderRadius,
3121
+ children: /* @__PURE__ */ w(
3122
+ k,
3123
+ {
3124
+ gap: "medium",
3125
+ justifyItems: W ? "space-between" : "center",
3126
+ alignItems: "center",
3127
+ children: [
3128
+ W && /* @__PURE__ */ i(k.Item, { shouldShrink: !0, children: /* @__PURE__ */ w(k, { gap: "small", alignItems: "center", children: [
3129
+ /* @__PURE__ */ i(k.Item, { children: K ? /* @__PURE__ */ i(Ft, { color: "success" }) : /* @__PURE__ */ i(Zt, { color: "error" }) }),
3130
+ /* @__PURE__ */ i(k.Item, { shouldShrink: !0, children: /* @__PURE__ */ i("div", { style: U, children: /* @__PURE__ */ i(S, { children: x == null ? void 0 : x.message }) }) })
3131
+ ] }) }),
3132
+ /* @__PURE__ */ i(k.Item, { children: W ? /* @__PURE__ */ i(Ne, { color: "primary", onClick: z, elementRef: F, children: K ? d.knowledgeCheckPracticeAgain : d.knowledgeCheckTryAgain }) : /* @__PURE__ */ i(
3133
+ Ne,
3134
+ {
3135
+ color: "primary",
3136
+ onClick: $,
3137
+ disabled: p.length === 0,
3138
+ elementRef: F,
3139
+ children: d.knowledgeCheckCheckAnswer
3140
+ }
3141
+ ) })
3142
+ ]
3143
+ }
3144
+ )
3145
+ }
3146
+ ) })
3147
+ ]
3148
+ }
3149
+ );
3150
+ }
3151
+ const Di = s.enum(["Multiple choice", "True or false"]), Wi = s.enum(["set", "random"]), ji = s.object({
3152
+ id: s.string(),
3153
+ label: s.string(),
3154
+ isCorrect: s.boolean()
3155
+ }), Vi = s.object({
3156
+ // `.default(x).optional()` (optional outermost) on every defaulted field here: the props
3157
+ // stay omittable, and a host seeding its settings form from the schema metadata rather
3158
+ // than from `KnowledgeCheckDefaultProps` still gets a value — a bare `.optional()`
3159
+ // surfaces no `defaultValue`, leaving the select unset on content predating the field.
3160
+ questionType: Di.default("Multiple choice").optional().zodLabel("Question type").zodHelp("Multiple choice or True/False question"),
3161
+ question: s.string().zodLabel("Question").zodHelp("The question learners will answer"),
3162
+ answerOrder: Wi.default("set").optional().zodLabel("Answer order").zodHelp("Fixed order or randomized each time").zodHiddenWhen({ field: "questionType", values: ["True or false"] }),
3163
+ // Deliberately uncapped, and the item fields carry no labels: `.zodAnswers()` routes
3164
+ // the host to its own answer editor, which owns the row layout and the correct/
3165
+ // incorrect toggle rather than reading per-field metadata.
3166
+ answers: s.array(ji).zodAnswers().zodLabel("Answer options"),
3167
+ headerStyle: eo.default("none").optional().zodLabel("Color").zodHelp(to),
3168
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Rounded or sharp corners")
3169
+ }), Ve = {
3170
+ questionType: "Multiple choice",
3171
+ question: "",
3172
+ answerOrder: "set",
3173
+ answers: [
3174
+ { id: "a1", label: "", isCorrect: !0 },
3175
+ { id: "a2", label: "", isCorrect: !1 },
3176
+ { id: "a3", label: "", isCorrect: !1 }
3177
+ ],
3178
+ headerStyle: "none",
3179
+ cornerStyle: "rounded"
3180
+ };
3181
+ for (const e of Ve.answers)
3182
+ Object.freeze(e);
3183
+ Object.freeze(Ve.answers);
3184
+ Object.freeze(Ve);
3185
+ const Fi = ne(
3186
+ Vi,
3187
+ "KnowledgeCheck"
3188
+ ), dd = ie({
3189
+ wireName: "KnowledgeCheckBlock",
3190
+ component: $i,
3191
+ schema: Fi,
3192
+ defaultProps: Ve,
3193
+ english: st
3194
+ }), Wt = 15, Zi = "1rem", Gi = {
3195
+ none: "space0",
3196
+ xsmall: "space4",
3197
+ small: "space8",
3198
+ medium: "space16",
3199
+ large: "space36",
3200
+ xlarge: "space60",
3201
+ xxlarge: "space60"
3202
+ }, Ui = {
3203
+ none: { background: "transparent", borderWidth: "0", borderColor: void 0 },
3204
+ primary: {
3205
+ background: "primary-inverse",
3206
+ borderWidth: "0",
3207
+ borderColor: void 0,
3208
+ textColor: "primary-inverse"
3209
+ },
3210
+ secondary: { background: "secondary", borderWidth: "0", borderColor: void 0 }
3211
+ }, qi = {
3212
+ none: void 0,
3213
+ primary: "dark",
3214
+ secondary: "light"
3215
+ };
3216
+ function Xi(e, t) {
3217
+ const r = qi[e], o = r && ue(t, r);
3218
+ return o ? xe(o) : { decoration: Ui[e] };
3219
+ }
3220
+ const Yi = {
3221
+ normal: "normal",
3222
+ middle: "center",
3223
+ top: "flex-start",
3224
+ bottom: "flex-end"
3225
+ }, Ki = {
3226
+ center: "center",
3227
+ left: "start",
3228
+ right: "end"
3229
+ };
3230
+ function Qi(e) {
3231
+ const t = (r) => r ? Gi[r] : "0";
3232
+ return [t(e == null ? void 0 : e.top), t(e == null ? void 0 : e.right), t(e == null ? void 0 : e.bottom), t(e == null ? void 0 : e.left)].join(
3233
+ " "
3234
+ );
3235
+ }
3236
+ function Ji({
3237
+ columnSpan: e,
3238
+ rowSpan: t,
3239
+ gridColumn: r,
3240
+ gridRow: o,
3241
+ order: n
3242
+ }) {
3243
+ const a = (u, h) => u !== void 0 && Number.isFinite(u) ? Math.min(Math.max(Math.trunc(u), 0), h) : void 0, d = (u, h) => u !== void 0 && Number.isFinite(u) && Math.trunc(u) > 0 ? `span ${Math.max(1, Math.min(Math.trunc(u), h))}` : void 0, c = a(r, Wt - 1), l = a(o, Number.POSITIVE_INFINITY);
3244
+ return {
3245
+ gridColumnStart: c !== void 0 ? c + 1 : void 0,
3246
+ gridColumnEnd: d(e, Wt - (c ?? 0)),
3247
+ gridRowStart: l !== void 0 ? l + 1 : void 0,
3248
+ gridRowEnd: d(t, Number.POSITIVE_INFINITY),
3249
+ order: n || void 0
3250
+ };
3251
+ }
3252
+ function ea(e, t, r, o, n, a) {
3253
+ const d = e !== "none", c = Xi(e, r), { view: l } = de(c, {
3254
+ borderRadius: d ? "large" : "0",
3255
+ padding: d ? "space16" : void 0
3256
+ });
3257
+ return {
3258
+ container: l,
3259
+ margin: Qi(a),
3260
+ outer: {
3261
+ flex: 1,
3262
+ minHeight: "fit-content",
3263
+ display: "grid",
3264
+ justifyItems: o ? Ki[o] : void 0,
3265
+ ...Ji(t)
3266
+ },
3267
+ inner: {
3268
+ display: "flex",
3269
+ flexDirection: "column",
3270
+ // Without this, `justifyContent` resolves against a content-sized box and does nothing.
3271
+ height: "100%",
3272
+ gap: Zi,
3273
+ justifyContent: n ? Yi[n] : void 0
3274
+ }
3275
+ };
3276
+ }
3277
+ function ta({
3278
+ children: e,
3279
+ // Defaulted here as well as in the schema, as every block in the package is: `.default()`
3280
+ // sits under an `.optional()`, so `.parse()` does not fill these in, and until the block
3281
+ // applied them itself a container that stored no `horizontalPosition` laid out differently
3282
+ // from one created from `LayoutContainerDefaultProps` — while the host's settings form
3283
+ // showed "center" for both.
3284
+ horizontalPosition: t = "center",
3285
+ verticalPosition: r = "normal",
3286
+ margin: o,
3287
+ backgroundStyle: n = "none",
3288
+ columnSpan: a,
3289
+ rowSpan: d,
3290
+ gridColumn: c,
3291
+ gridRow: l,
3292
+ order: u
3293
+ }) {
3294
+ const h = he(), {
3295
+ container: g,
3296
+ margin: p,
3297
+ outer: C,
3298
+ inner: T
3299
+ } = ee(
3300
+ () => ea(
3301
+ n,
3302
+ { columnSpan: a, rowSpan: d, gridColumn: c, gridRow: l, order: u },
3303
+ h,
3304
+ t,
3305
+ r,
3306
+ o
3307
+ ),
3308
+ [
3309
+ n,
3310
+ a,
3311
+ d,
3312
+ c,
3313
+ l,
3314
+ u,
3315
+ h,
3316
+ t,
3317
+ r,
3318
+ o
3319
+ ]
3320
+ );
3321
+ return Ro.toArray(e).length === 0 ? null : (
3322
+ // A single-cell grid, so the surface stretches to the cell the parent gave this block
3323
+ // minus its own margins, and `horizontalPosition` can align it as the cell's
3324
+ // `justify-items`. As a plain block child it would fill the cell whatever the alignment
3325
+ // says, and reaching the same height with `height: 100%` would overflow by the
3326
+ // vertical margins.
3327
+ /* @__PURE__ */ i("div", { className: "bce-block bce-block-layoutcontainer", style: C, children: /* @__PURE__ */ i(v, { as: "div", margin: p, ...g, children: /* @__PURE__ */ i("div", { style: { ...T, ...U }, children: e }) }) })
3328
+ );
3329
+ }
3330
+ const Re = s.enum([
3331
+ "none",
3332
+ "xsmall",
3333
+ "small",
3334
+ "medium",
3335
+ "large",
3336
+ "xlarge",
3337
+ "xxlarge"
3338
+ ]), oa = s.enum(["none", "primary", "secondary"]), ra = s.enum(["center", "left", "right"]), na = s.enum(["normal", "middle", "top", "bottom"]), ia = s.object({
3339
+ top: Re.optional().zodLabel("Top Margin"),
3340
+ right: Re.optional().zodLabel("Right Margin"),
3341
+ bottom: Re.optional().zodLabel("Bottom Margin"),
3342
+ left: Re.optional().zodLabel("Left Margin")
3343
+ }).optional(), aa = s.object({
3344
+ columnSpan: s.number().optional().zodHidden(),
3345
+ rowSpan: s.number().optional().zodHidden(),
3346
+ gridColumn: s.number().optional().zodHidden(),
3347
+ gridRow: s.number().optional().zodHidden(),
3348
+ order: s.number().optional().zodHidden()
3349
+ }), da = s.object({
3350
+ // The nested blocks, supplied by the host's viewer or designer.
3351
+ children: s.any().zodHidden(),
3352
+ horizontalPosition: ra.default("center").optional().zodLabel("Horizontal Position").zodHelp("Horizontal alignment of content within the container"),
3353
+ verticalPosition: na.default("normal").optional().zodLabel("Vertical Position").zodHelp("Vertical alignment of content within the container"),
3354
+ margin: ia.zodLabel("Margin").zodHelp(
3355
+ "Fine-grained control of spacing around the container"
3356
+ ),
3357
+ backgroundStyle: oa.default("none").optional().zodLabel("Background Style").zodHelp(
3358
+ "When using primary/secondary, avoid nested background styles to prevent visual noise"
3359
+ )
3360
+ }).merge(aa), vo = {
3361
+ horizontalPosition: "center",
3362
+ verticalPosition: "normal",
3363
+ backgroundStyle: "none"
3364
+ };
3365
+ Object.freeze(vo);
3366
+ const la = ne(
3367
+ da,
3368
+ "LayoutContainer"
3369
+ ), ld = ie({
3370
+ wireName: "LayoutContainer",
3371
+ component: ta,
3372
+ schema: la,
3373
+ defaultProps: vo
3374
+ }), Ke = 20, Qe = 80, Fe = 50, sa = s.enum(["none", "small", "medium", "large"]), ca = s.enum(["left-first", "right-first"]), ua = s.enum(["none", "outline", "solid"]), ha = s.enum(["none", "light", "dark", "neutral"]), ma = s.object({
3375
+ // The nested blocks, supplied by the host's viewer or designer.
3376
+ children: s.any().zodHidden(),
3377
+ // `.default(x).optional()`, optional outermost: the reader still recurses to the default
3378
+ // for the host's settings form, but the prop stays omittable in the emitted props type —
3379
+ // the default is applied by the component and `TwoColumnDefaultProps`, not by `.parse()`.
3380
+ leftColumnWidth: s.number().min(Ke).max(Qe).default(Fe).optional().zodRange({
3381
+ min: Ke,
3382
+ max: Qe,
3383
+ step: 5,
3384
+ formatValue: "%",
3385
+ // The slider sets both columns at once, so the host labels each end rather
3386
+ // than showing a single anonymous number.
3387
+ valueLabel: "Left",
3388
+ complementLabel: "Right"
3389
+ }).zodLabel("Column widths"),
3390
+ mobileStackingOrder: ca.default("left-first").optional().zodLabel("Mobile stacking order").zodHelp("Which column appears first when stacked on mobile devices"),
3391
+ gapSpacing: sa.default("medium").optional().zodLabel("Gap space").zodHelp("Space between the two columns"),
3392
+ containerStyle: ua.default("none").optional().zodLabel("Style").zodHelp("Visual style of the two-column container"),
3393
+ cornerStyle: se.default("rounded").optional().zodLabel("Corners").zodHelp("Border radius style for the container"),
3394
+ backgroundColor: ha.default("none").optional().zodLabel("Background color").zodHelp("Background color of the two-column container")
3395
+ }), Co = {
3396
+ leftColumnWidth: Fe,
3397
+ gapSpacing: "medium",
3398
+ mobileStackingOrder: "left-first",
3399
+ containerStyle: "none",
3400
+ cornerStyle: "rounded",
3401
+ backgroundColor: "none"
3402
+ };
3403
+ Object.freeze(Co);
3404
+ const fa = ne(
3405
+ ma,
3406
+ "TwoColumn"
3407
+ ), pa = {
3408
+ none: "0",
3409
+ small: "0.5rem",
3410
+ medium: "1rem",
3411
+ large: "1.5rem"
3412
+ }, ba = {
3413
+ none: { borderWidth: "0", borderColor: void 0 },
3414
+ outline: { borderWidth: "small", borderColor: "primary" },
3415
+ solid: { borderWidth: "medium", borderColor: "secondary" }
3416
+ }, ga = {
3417
+ decoration: { background: "transparent", borderWidth: "0", borderColor: void 0 }
3418
+ };
3419
+ function va(e, t, r, o, n, a) {
3420
+ const d = n === "none" ? ga : nt(n, a).styling, { view: c } = de(
3421
+ {
3422
+ ...d,
3423
+ decoration: { ...d.decoration, ...ba[r] }
3424
+ },
3425
+ {
3426
+ borderRadius: o === "rounded" ? "large" : "0",
3427
+ // Padding only earns its place once there is a surface or an outline to inset from.
3428
+ padding: n !== "none" || r !== "none" ? "space16" : void 0
3429
+ }
3430
+ ), l = Number.isFinite(e) ? Math.min(Math.max(e, Ke), Qe) : Fe;
3431
+ return {
3432
+ container: c,
3433
+ cssVariables: {
3434
+ "--bce-twocol-left": `${l}fr`,
3435
+ "--bce-twocol-right": `${100 - l}fr`,
3436
+ "--bce-twocol-gap": pa[t]
3437
+ }
3438
+ };
3439
+ }
3440
+ const Ca = "768px", Q = {
3441
+ /**
3442
+ * The outermost element. It carries `container-type`, so it is also the ancestor the
3443
+ * `@container` rule resolves against — which is why the grid has to be a separate
3444
+ * element inside it rather than this one.
3445
+ */
3446
+ root: "bce-block-twocolumn",
3447
+ grid: "bce-twocolumn-grid",
3448
+ gridReverse: "bce-twocolumn-grid-reverse"
3449
+ }, ya = Pe`
3450
+ .${Q.root} {
3451
+ container-type: inline-size;
3452
+ width: 100%;
3453
+ }
3454
+
3455
+ .${Q.root} > .${Q.grid} {
3456
+ display: grid;
3457
+ /*
3458
+ * minmax(0, ...) rather than a bare fr: an fr track's automatic minimum is min-content,
3459
+ * so one unbreakable word or a fixed-width image in the narrow column pushes that track
3460
+ * past its share and the two stop totalling the width.
3461
+ */
3462
+ grid-template-columns: minmax(0, var(--bce-twocol-left)) minmax(0, var(--bce-twocol-right));
3463
+ gap: var(--bce-twocol-gap);
3464
+ width: 100%;
3465
+ align-items: start;
3466
+ }
3467
+
3468
+ @container (max-width: ${Ca}) {
3469
+ .${Q.root} > .${Q.grid} {
3470
+ grid-template-columns: 1fr;
3471
+ }
3472
+
3473
+ /*
3474
+ * The host assigns each child its column with an inline grid-column, so clearing that
3475
+ * for the stacked layout means outranking an inline style.
3476
+ */
3477
+ .${Q.root} > .${Q.grid} > * {
3478
+ grid-column: 1 !important;
3479
+ }
3480
+
3481
+ /*
3482
+ * Only the first two children swap. A column may hold several blocks, in which case
3483
+ * the rest keep their document order and the reversal is partial — reordering by
3484
+ * column instead would mean matching on the host's inline grid-column, which ties
3485
+ * this block to markup it does not own.
3486
+ *
3487
+ * Matched by type rather than position: the host wraps every child in a div, so the
3488
+ * two are equivalent on the markup this ever sees, and emotion warns that
3489
+ * :nth-child cannot be rendered safely server-side.
3490
+ */
3491
+ .${Q.root} > .${Q.gridReverse} > div:nth-of-type(1) {
3492
+ order: 2;
3493
+ }
3494
+ .${Q.root} > .${Q.gridReverse} > div:nth-of-type(2) {
3495
+ order: 1;
3496
+ }
3497
+ }
3498
+ `;
3499
+ function ka() {
3500
+ return /* @__PURE__ */ i(Be, { styles: ya });
3501
+ }
3502
+ function wa({
3503
+ children: e,
3504
+ leftColumnWidth: t = Fe,
3505
+ gapSpacing: r = "medium",
3506
+ mobileStackingOrder: o = "left-first",
3507
+ containerStyle: n = "none",
3508
+ cornerStyle: a = "rounded",
3509
+ backgroundColor: d = "none"
3510
+ }) {
3511
+ const c = he(), { container: l, rootStyle: u } = ee(() => {
3512
+ const { container: g, cssVariables: p } = va(
3513
+ t,
3514
+ r,
3515
+ n,
3516
+ a,
3517
+ d,
3518
+ c
3519
+ );
3520
+ return { container: g, rootStyle: { ...p, ...U } };
3521
+ }, [t, r, n, a, d, c]), h = o === "right-first" ? `${Q.grid} ${Q.gridReverse}` : Q.grid;
3522
+ return /* @__PURE__ */ w("div", { className: `bce-block ${Q.root}`, style: u, children: [
3523
+ /* @__PURE__ */ i(ka, {}),
3524
+ /* @__PURE__ */ i(v, { as: "div", className: h, ...l, children: e })
3525
+ ] });
3526
+ }
3527
+ const sd = ie({
3528
+ wireName: "TwoColumn",
3529
+ component: wa,
3530
+ schema: fa,
3531
+ defaultProps: Co,
3532
+ // Its stylesheet addresses the columns as `> div:nth-of-type(1|2)`.
3533
+ wrapsChildrenInGridCells: !0
3534
+ }), ct = {
3535
+ widgetBlockPlaceholder: "Add widget...",
3536
+ widgetBlockLoading: "Loading widget...",
3537
+ widgetBlockError: "Failed to load widget"
3538
+ };
3539
+ class xa extends Io {
3540
+ constructor() {
3541
+ super(...arguments), this.state = { hasError: !1 };
3542
+ }
3543
+ static getDerivedStateFromError() {
3544
+ return { hasError: !0 };
3545
+ }
3546
+ render() {
3547
+ return this.state.hasError ? this.props.fallback : this.props.children;
3548
+ }
3549
+ }
3550
+ function Ta({ widgetType: e = "", errorPlaceholder: t }) {
3551
+ const r = le(), { translations: o } = Y(ct), { Component: n, isLoading: a, isError: d } = sn(e);
3552
+ return e ? a ? /* @__PURE__ */ i(ce, { variant: "loading", text: o.widgetBlockLoading }) : d || !n ? t : /* @__PURE__ */ i("div", { style: U, children: /* @__PURE__ */ i(n, { widgetType: e }) }) : r ? /* @__PURE__ */ i(ce, { text: o.widgetBlockPlaceholder }) : null;
3553
+ }
3554
+ function Aa({ widgetType: e = "" }) {
3555
+ const { translations: t } = Y(ct), r = /* @__PURE__ */ i(ce, { variant: "error", text: t.widgetBlockError });
3556
+ return /* @__PURE__ */ i(v, { as: "div", className: "bce-block bce-block-widget", children: /* @__PURE__ */ i(xa, { fallback: r, children: /* @__PURE__ */ i(Ta, { widgetType: e, errorPlaceholder: r }) }, e) });
3557
+ }
3558
+ const Sa = s.object({
3559
+ /**
3560
+ * Opaque host widget identifier, resolved to a component via `useWidget`. Kept a
3561
+ * free string on purpose: the widgets on offer belong to the host product, so a
3562
+ * closed enum here would bind this package to one host's vocabulary. A host that
3563
+ * wants its own set validated narrows this schema itself — see the block's
3564
+ * `index.ts`. `''` means "not configured yet", as an empty `asset_id` does.
3565
+ */
3566
+ widgetType: s.string().default("").zodHidden()
3567
+ }), za = {
3568
+ widgetType: ""
3569
+ }, Ra = ne(
3570
+ Sa,
3571
+ "WidgetBlock"
3572
+ ), cd = ie({
3573
+ wireName: "WidgetBlock",
3574
+ component: Aa,
3575
+ schema: Ra,
3576
+ defaultProps: za,
3577
+ english: ct
3578
+ });
3579
+ function ud(e) {
3580
+ return e;
3581
+ }
3582
+ function Ia(e, t) {
3583
+ return { ...e.props, ...t == null ? void 0 : t[e.id] };
3584
+ }
3585
+ function yo(e, t) {
3586
+ return Object.prototype.hasOwnProperty.call(e, t) ? (
3587
+ // The check above is the runtime proof that `component` is one of `R`'s keys, which a
3588
+ // `string` parameter cannot carry in the type system.
3589
+ e[t]
3590
+ ) : void 0;
3591
+ }
3592
+ function ko(e, t, r = []) {
3593
+ if (!Array.isArray(e)) return r;
3594
+ for (const o of e)
3595
+ !o || typeof o != "object" || (typeof o.component == "string" && typeof o.id == "string" && !yo(t, o.component) && r.push({
3596
+ id: o.id,
3597
+ component: o.component,
3598
+ reason: kr(o.component)
3599
+ }), ko(o.children, t, r));
3600
+ return r;
3601
+ }
3602
+ function La({ nodes: e, templateData: t, registry: r }) {
3603
+ return /* @__PURE__ */ i(ye, { children: e.map((o, n) => {
3604
+ var l;
3605
+ if (!o || typeof o != "object") return null;
3606
+ const a = (l = o.props) == null ? void 0 : l.gridColumn, d = typeof a == "number" ? a : typeof a == "string" && /^\d+$/.test(a) ? Number(a) : NaN, c = Number.isInteger(d) && d >= 0 ? d + 1 : void 0;
3607
+ return /* @__PURE__ */ i(
3608
+ "div",
3609
+ {
3610
+ style: c === void 0 ? void 0 : { gridColumn: c },
3611
+ children: /* @__PURE__ */ i(wo, { node: o, templateData: t, registry: r })
3612
+ },
3613
+ o.id || `${o.component}-${n}`
3614
+ );
3615
+ }) });
3616
+ }
3617
+ function wo({
3618
+ node: e,
3619
+ templateData: t,
3620
+ registry: r
3621
+ }) {
3622
+ const o = yo(r, e.component), n = Array.isArray(e.children) ? e.children : void 0;
3623
+ if (!o)
3624
+ return n != null && n.length ? /* @__PURE__ */ i(Je, { nodes: n, templateData: t, registry: r }) : null;
3625
+ const a = o.component, d = Ia(e, t);
3626
+ return /* @__PURE__ */ i(a, { ...d, children: n != null && n.length ? o.wrapsChildrenInGridCells ? /* @__PURE__ */ i(La, { nodes: n, templateData: t, registry: r }) : /* @__PURE__ */ i(Je, { nodes: n, templateData: t, registry: r }) : void 0 });
3627
+ }
3628
+ function Je({ nodes: e, templateData: t, registry: r }) {
3629
+ return /* @__PURE__ */ i(ye, { children: e.map(
3630
+ (o, n) => o && typeof o == "object" ? /* @__PURE__ */ i(
3631
+ wo,
3632
+ {
3633
+ node: o,
3634
+ templateData: t,
3635
+ registry: r
3636
+ },
3637
+ o.id || `${o.component}-${n}`
3638
+ ) : null
3639
+ ) });
3640
+ }
3641
+ function hd({
3642
+ templateLayout: e,
3643
+ templateData: t,
3644
+ componentRegistry: r,
3645
+ onUnresolvedBlock: o
3646
+ }) {
3647
+ const n = ee(
3648
+ () => ko(e, r),
3649
+ [e, r]
3650
+ ), a = re(/* @__PURE__ */ new Set());
3651
+ return ve(() => {
3652
+ if (o)
3653
+ for (const d of n) {
3654
+ const c = JSON.stringify([d.id, d.component]);
3655
+ a.current.has(c) || (a.current.add(c), o(d));
3656
+ }
3657
+ }, [n, o]), !Array.isArray(e) || e.length === 0 ? null : /* @__PURE__ */ i(Je, { nodes: e, templateData: t, registry: r });
3658
+ }
1343
3659
  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
3660
+ lr as Accordion,
3661
+ _e as AccordionDefaultProps,
3662
+ Ut as AccordionEnglish,
3663
+ Wi as AnswerOrderSchema,
3664
+ oo as BLOCK_CATALOGUE,
3665
+ Hr as Banner,
3666
+ Wr as BannerDefaultProps,
3667
+ io as BannerEnglish,
3668
+ oe as BlockCategory,
3669
+ $e as BlockEditorApiContext,
3670
+ td as BlockEditorApiProvider,
3671
+ bt as BlockTranslationsProvider,
3672
+ jo as BrandColorContext,
3673
+ Qr as CodeBlock,
3674
+ tn as CodeBlockDefaultProps,
3675
+ so as CodeBlockEnglish,
3676
+ Vo as DesignerModeContext,
3677
+ si as FlashCards,
3678
+ We as FlashCardsDefaultProps,
3679
+ dt as FlashCardsEnglish,
3680
+ sr as FormFieldType,
3681
+ eo as HeaderStyleSchema,
3682
+ fn as ImageBlock,
3683
+ gn as ImageBlockDefaultProps,
3684
+ co as ImageBlockEnglish,
3685
+ $i as KnowledgeCheck,
3686
+ ji as KnowledgeCheckAnswerSchema,
3687
+ Ve as KnowledgeCheckDefaultProps,
3688
+ st as KnowledgeCheckEnglish,
3689
+ ta as LayoutContainer,
3690
+ vo as LayoutContainerDefaultProps,
3691
+ Si as MixAndMatch,
3692
+ je as MixAndMatchDefaultProps,
3693
+ lt as MixAndMatchEnglish,
3694
+ Di as QuestionTypeSchema,
3695
+ Gr as Quote,
3696
+ Xr as QuoteDefaultProps,
3697
+ lo as QuoteEnglish,
3698
+ yr as RegisteredAccordionPropsSchema,
3699
+ jr as RegisteredBannerPropsSchema,
3700
+ on as RegisteredCodeBlockPropsSchema,
3701
+ hi as RegisteredFlashCardsPropsSchema,
3702
+ vn as RegisteredImageBlockPropsSchema,
3703
+ Fi as RegisteredKnowledgeCheckPropsSchema,
3704
+ la as RegisteredLayoutContainerPropsSchema,
3705
+ Oi as RegisteredMixAndMatchPropsSchema,
3706
+ Yr as RegisteredQuotePropsSchema,
3707
+ Xn as RegisteredTabsBlockPropsSchema,
3708
+ Pr as RegisteredTextPropsSchema,
3709
+ fa as RegisteredTwoColumnPropsSchema,
3710
+ Rn as RegisteredVideoBlockPropsSchema,
3711
+ Ra as RegisteredWidgetBlockPropsSchema,
3712
+ Do as RichTextRendererContext,
3713
+ Hn as TabsBlock,
3714
+ He as TabsBlockDefaultProps,
3715
+ mo as TabsBlockEnglish,
3716
+ Lr as Text,
3717
+ Er as TextDefaultProps,
3718
+ no as TextEnglish,
3719
+ wa as TwoColumn,
3720
+ Co as TwoColumnDefaultProps,
3721
+ xn as VideoBlock,
3722
+ zn as VideoBlockDefaultProps,
3723
+ Tn as VideoBlockDragPreview,
3724
+ uo as VideoBlockEnglish,
3725
+ An as VideoSourceSchema,
3726
+ hd as Viewer,
3727
+ Aa as WidgetBlock,
3728
+ za as WidgetBlockDefaultProps,
3729
+ ct as WidgetBlockEnglish,
3730
+ Sa as WidgetBlockPropsSchema,
3731
+ Ya as createAccordionBlock,
3732
+ Qa as createBannerBlock,
3733
+ ed as createCodeBlock,
3734
+ id as createFlashCardsBlock,
3735
+ od as createImageBlock,
3736
+ dd as createKnowledgeCheckBlock,
3737
+ ld as createLayoutContainerBlock,
3738
+ ad as createMixAndMatchBlock,
3739
+ Ja as createQuoteBlock,
3740
+ nd as createTabsBlock,
3741
+ Ka as createTextBlock,
3742
+ sd as createTwoColumnBlock,
3743
+ rd as createVideoBlock,
3744
+ cd as createWidgetBlock,
3745
+ ie as defineBlock,
3746
+ ud as defineRegistry,
3747
+ Le as deriveFieldType,
3748
+ ur as extractFieldMetadata,
3749
+ Tt as extractFormMetadata,
3750
+ Xt as extractValidationRules,
3751
+ Ia as getMergedProps,
3752
+ ro as isKnownBlock,
3753
+ V as parseDescription,
3754
+ ne as registerComponentSchema,
3755
+ yo as resolveBlockEntry,
3756
+ kr as unresolvedReason,
3757
+ ot as unwrapZodType,
3758
+ Y as useBlockTranslations,
3759
+ he as useBrandColor,
3760
+ le as useDesignerMode,
3761
+ dn as useImageUrl,
3762
+ Wo as useRichTextRenderer,
3763
+ ln as useVideoUrl,
3764
+ sn as useWidget,
3765
+ mr as validateComponentSchema
1385
3766
  };