@bison-lab/payload-core 5.12.0 → 5.13.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 (109) hide show
  1. package/README.md +125 -10
  2. package/dist/admin-branding-CEKdfYah.mjs +178 -0
  3. package/dist/admin-branding-CEKdfYah.mjs.map +1 -0
  4. package/dist/admin-head-CcpH7P4C.mjs +187 -0
  5. package/dist/admin-head-CcpH7P4C.mjs.map +1 -0
  6. package/dist/admin-head-QfW81bDy.d.mts +63 -0
  7. package/dist/admin-head-QfW81bDy.d.mts.map +1 -0
  8. package/dist/admin-server.d.mts +52 -0
  9. package/dist/admin-server.d.mts.map +1 -0
  10. package/dist/admin-server.mjs +94 -0
  11. package/dist/admin-server.mjs.map +1 -0
  12. package/dist/admin.d.mts.map +1 -1
  13. package/dist/admin.mjs +12 -4
  14. package/dist/admin.mjs.map +1 -1
  15. package/dist/{alternates-DxBTUXHh.mjs → alternates-Tv5-ccza.mjs} +1 -1
  16. package/dist/{alternates-DxBTUXHh.mjs.map → alternates-Tv5-ccza.mjs.map} +1 -1
  17. package/dist/{alternates-DlRTsaVe.d.mts → alternates-aRncEUBI.d.mts} +1 -1
  18. package/dist/{alternates-DlRTsaVe.d.mts.map → alternates-aRncEUBI.d.mts.map} +1 -1
  19. package/dist/block-library.d.mts +1 -1
  20. package/dist/block-library.mjs +1 -1
  21. package/dist/{block-thumbnails-DC34uFtE.mjs → block-thumbnails-DvILqW_e.mjs} +1 -1
  22. package/dist/{block-thumbnails-DC34uFtE.mjs.map → block-thumbnails-DvILqW_e.mjs.map} +1 -1
  23. package/dist/block-thumbnails-cli.mjs +1 -1
  24. package/dist/block-thumbnails.mjs +1 -1
  25. package/dist/{capability-Kd5LgQpm.mjs → capability-B4FLx4OX.mjs} +4 -159
  26. package/dist/capability-B4FLx4OX.mjs.map +1 -0
  27. package/dist/{capability-NlorUIta.d.mts → capability-DonuHSPG.d.mts} +1 -1
  28. package/dist/{capability-NlorUIta.d.mts.map → capability-DonuHSPG.d.mts.map} +1 -1
  29. package/dist/{catalogue-CJ0RlTg4.d.mts → catalogue-tVovXWp9.d.mts} +1 -1
  30. package/dist/{catalogue-CJ0RlTg4.d.mts.map → catalogue-tVovXWp9.d.mts.map} +1 -1
  31. package/dist/{facet-field-DO3VT_Cz.mjs → facet-field-7p6_MhsT.mjs} +1 -1
  32. package/dist/{facet-field-DO3VT_Cz.mjs.map → facet-field-7p6_MhsT.mjs.map} +1 -1
  33. package/dist/{facet-field-Cd6lffed.d.mts → facet-field-Dbcu1L91.d.mts} +1 -1
  34. package/dist/{facet-field-Cd6lffed.d.mts.map → facet-field-Dbcu1L91.d.mts.map} +1 -1
  35. package/dist/{types-B1MmE-L3.d.mts → identity-B4Lew8Fu.d.mts} +40 -24
  36. package/dist/identity-B4Lew8Fu.d.mts.map +1 -0
  37. package/dist/{identity-CN6EOeDM.mjs → identity-CkUE_uN2.mjs} +11 -3
  38. package/dist/{identity-CN6EOeDM.mjs.map → identity-CkUE_uN2.mjs.map} +1 -1
  39. package/dist/index.d.mts +58 -16
  40. package/dist/index.d.mts.map +1 -1
  41. package/dist/index.mjs +150 -60
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/island-97l5VY8l.mjs.map +1 -1
  44. package/dist/languages-B_iiWwxE.mjs +179 -0
  45. package/dist/languages-B_iiWwxE.mjs.map +1 -0
  46. package/dist/languages-cDe9Lznx.d.mts +86 -0
  47. package/dist/languages-cDe9Lznx.d.mts.map +1 -0
  48. package/dist/{locale-tnKLkutC.d.mts → locale-CTT3nn6T.d.mts} +1 -1
  49. package/dist/locale-CTT3nn6T.d.mts.map +1 -0
  50. package/dist/{locale-B6rUVwpg.mjs → locale-DaEJ1d2O.mjs} +1 -1
  51. package/dist/{locale-B6rUVwpg.mjs.map → locale-DaEJ1d2O.mjs.map} +1 -1
  52. package/dist/locale-routing.d.mts +129 -0
  53. package/dist/locale-routing.d.mts.map +1 -0
  54. package/dist/locale-routing.mjs +256 -0
  55. package/dist/locale-routing.mjs.map +1 -0
  56. package/dist/lookup-DiOCro-_.mjs +165 -0
  57. package/dist/lookup-DiOCro-_.mjs.map +1 -0
  58. package/dist/lookup-uyEKHlLX.d.mts +41 -0
  59. package/dist/lookup-uyEKHlLX.d.mts.map +1 -0
  60. package/dist/{messages-XFoL9RtF.mjs → messages-Bv6JIEiG.mjs} +2 -2
  61. package/dist/{messages-XFoL9RtF.mjs.map → messages-Bv6JIEiG.mjs.map} +1 -1
  62. package/dist/metadata.d.mts +2 -2
  63. package/dist/metadata.mjs +1 -1
  64. package/dist/navigation.d.mts +2 -2
  65. package/dist/navigation.mjs +1 -1
  66. package/dist/og.d.mts +2 -2
  67. package/dist/og.mjs +2 -2
  68. package/dist/{preview-Br1SQCKn.mjs → preview-BE7P1ezl.mjs} +5 -120
  69. package/dist/preview-BE7P1ezl.mjs.map +1 -0
  70. package/dist/{preview-B69Dhi8T.d.mts → preview-DSQN4uYa.d.mts} +2 -2
  71. package/dist/{preview-B69Dhi8T.d.mts.map → preview-DSQN4uYa.d.mts.map} +1 -1
  72. package/dist/{published-Vu_QX2Vv.mjs → published-BF2F3od_.mjs} +2 -2
  73. package/dist/{published-Vu_QX2Vv.mjs.map → published-BF2F3od_.mjs.map} +1 -1
  74. package/dist/{published-hqtvmVUD.mjs → published-BzihgcSf.mjs} +1 -1
  75. package/dist/{published-hqtvmVUD.mjs.map → published-BzihgcSf.mjs.map} +1 -1
  76. package/dist/{published-B80KqlcU.mjs → published-C8bW5jvC.mjs} +3 -3
  77. package/dist/{published-B80KqlcU.mjs.map → published-C8bW5jvC.mjs.map} +1 -1
  78. package/dist/{published-2I-k6zEo.d.mts → published-DYpXTy84.d.mts} +3 -3
  79. package/dist/{published-2I-k6zEo.d.mts.map → published-DYpXTy84.d.mts.map} +1 -1
  80. package/dist/{published-BhYTEAK_.d.mts → published-VTz_aYaQ.d.mts} +2 -2
  81. package/dist/{published-BhYTEAK_.d.mts.map → published-VTz_aYaQ.d.mts.map} +1 -1
  82. package/dist/{root-page-key-kx3C1eyp.mjs → root-page-key-ywNz2k4L.mjs} +1 -1
  83. package/dist/{root-page-key-kx3C1eyp.mjs.map → root-page-key-ywNz2k4L.mjs.map} +1 -1
  84. package/dist/seo.d.mts +1 -1
  85. package/dist/seo.mjs +2 -2
  86. package/dist/{strings-Fd7kUCT7.mjs → strings-_9n8BefX.mjs} +1 -1
  87. package/dist/{strings-Fd7kUCT7.mjs.map → strings-_9n8BefX.mjs.map} +1 -1
  88. package/dist/taxonomy.d.mts +1 -1
  89. package/dist/taxonomy.mjs +1 -1
  90. package/dist/theme.d.mts +6 -5
  91. package/dist/theme.d.mts.map +1 -1
  92. package/dist/theme.mjs +6 -63
  93. package/dist/{title-BVV3o329.d.mts → title-DBSLJfrW.d.mts} +1 -1
  94. package/dist/{title-BVV3o329.d.mts.map → title-DBSLJfrW.d.mts.map} +1 -1
  95. package/dist/translate-messages-cli.mjs +2 -2
  96. package/dist/translate.d.mts +2 -77
  97. package/dist/translate.d.mts.map +1 -1
  98. package/dist/translate.mjs +4 -3
  99. package/dist/translate.mjs.map +1 -1
  100. package/dist/{wireframe-Ba65SOj8.mjs → wireframe-DjPHSACa.mjs} +1 -1
  101. package/dist/{wireframe-Ba65SOj8.mjs.map → wireframe-DjPHSACa.mjs.map} +1 -1
  102. package/dist/wireframe-cli.mjs +1 -1
  103. package/dist/wireframe.mjs +1 -1
  104. package/package.json +11 -3
  105. package/dist/capability-Kd5LgQpm.mjs.map +0 -1
  106. package/dist/locale-tnKLkutC.d.mts.map +0 -1
  107. package/dist/preview-Br1SQCKn.mjs.map +0 -1
  108. package/dist/theme.mjs.map +0 -1
  109. package/dist/types-B1MmE-L3.d.mts.map +0 -1
package/dist/og.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as SHARE_IMAGE_SIZE } from "./share-image-C8ZtIcU8.mjs";
2
- import "./identity-CN6EOeDM.mjs";
3
- import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-B80KqlcU.mjs";
2
+ import "./identity-CkUE_uN2.mjs";
3
+ import { n as getPublishedTheme, t as getPublishedIdentity } from "./published-C8bW5jvC.mjs";
4
4
  import { isFontId } from "@bison-lab/fonts";
5
5
  import { auditTheme, brandColorsFromConfig, deriveDarkPalette, deriveLightPalette } from "@bison-lab/tokens";
6
6
  import * as fontsServer from "@bison-lab/fonts/server";
@@ -1,5 +1,6 @@
1
- import { l as stateFromColorDoc, n as SYSTEM_COLOR_KEYS, p as LOOK_FIELD } from "./identity-CN6EOeDM.mjs";
2
- import { SHADE_STEPS, includedShadeSteps } from "@bison-lab/tokens";
1
+ import { n as SYSTEM_COLOR_KEYS, p as LOOK_FIELD } from "./identity-CkUE_uN2.mjs";
2
+ import { c as pageEditorTokens, l as themeDocFromRequest, o as pageEditorLooks } from "./admin-branding-CEKdfYah.mjs";
3
+ import { SHADE_STEPS } from "@bison-lab/tokens";
3
4
  //#region src/theme/library.ts
4
5
  /**
5
6
  * Payload's array form state stores the row count (`0`, `2`, …), not the
@@ -99,122 +100,6 @@ function join(path, segment) {
99
100
  return path ? `${path}.${segment}` : segment;
100
101
  }
101
102
  //#endregion
102
- //#region src/theme/looks.ts
103
- /**
104
- * System colors Color Settings offers as page-editor fills. Success and
105
- * Destructive stay off this list — they are theme chrome only.
106
- */
107
- const PAGE_EDITOR_SYSTEM_KEYS = [
108
- "primary",
109
- "secondary",
110
- "accent",
111
- "highlight"
112
- ];
113
- const SYSTEM_LABELS = {
114
- primary: "Primary",
115
- secondary: "Secondary",
116
- accent: "Accent",
117
- highlight: "Highlight"
118
- };
119
- function brandColor(doc, key) {
120
- const value = (doc?.colors?.brand ?? doc?.brand)?.[key];
121
- if (typeof value === "string" || value == null) return value == null ? null : { hex: value };
122
- return value;
123
- }
124
- function themeLibraryFromDoc(doc) {
125
- return Array.isArray(doc?.colors?.library) ? doc.colors.library : [];
126
- }
127
- function libraryRows(doc) {
128
- return themeLibraryFromDoc(doc);
129
- }
130
- function titleCase(key) {
131
- return key.charAt(0).toUpperCase() + key.slice(1);
132
- }
133
- function stepsFor(color, fallbackHex) {
134
- return includedShadeSteps(stateFromColorDoc(color, fallbackHex));
135
- }
136
- /**
137
- * Family keys a `lookField()` may offer: the page-editor system scales
138
- * plus every custom color on Colors. Adding Coral on Theme makes `coral`
139
- * appear here with no `@bison-lab/*` release.
140
- */
141
- function pageEditorLooks(doc) {
142
- const system = PAGE_EDITOR_SYSTEM_KEYS.map((value) => ({
143
- label: SYSTEM_LABELS[value],
144
- value
145
- }));
146
- const custom = libraryRows(doc).map((row) => {
147
- const value = row.key?.trim();
148
- if (!value) return null;
149
- return {
150
- label: row.label?.trim() || titleCase(value),
151
- value
152
- };
153
- }).filter((option) => option !== null);
154
- return [...system, ...custom];
155
- }
156
- /**
157
- * Included steps as `coral-400`. Excluded steps do not appear. System
158
- * scales with no stored include list offer the full 50–950 ramp.
159
- */
160
- function pageEditorTokens(doc) {
161
- const tokens = [];
162
- for (const key of PAGE_EDITOR_SYSTEM_KEYS) {
163
- const label = SYSTEM_LABELS[key];
164
- for (const step of stepsFor(brandColor(doc, key), "#000000")) tokens.push({
165
- label: `${label} ${step}`,
166
- value: `${key}-${step}`
167
- });
168
- }
169
- for (const row of libraryRows(doc)) {
170
- const key = row.key?.trim();
171
- if (!key) continue;
172
- const label = row.label?.trim() || titleCase(key);
173
- for (const step of stepsFor(row, row.hex ?? "#000000")) tokens.push({
174
- label: `${label} ${step}`,
175
- value: `${key}-${step}`
176
- });
177
- }
178
- return tokens;
179
- }
180
- /**
181
- * `pageEditorTokens` with each step's stored color, grouped by family in
182
- * the same order, so an admin picker can paint a swatch without the site's
183
- * Theme stylesheet.
184
- */
185
- function pageEditorSwatches(doc) {
186
- const swatches = [];
187
- const push = (family, familyLabel, color, fallbackHex) => {
188
- const state = stateFromColorDoc(color, fallbackHex);
189
- for (const step of includedShadeSteps(state)) swatches.push({
190
- label: `${familyLabel} ${step}`,
191
- value: `${family}-${step}`,
192
- family,
193
- familyLabel,
194
- step,
195
- hsl: String(state.scale[step] ?? "")
196
- });
197
- };
198
- for (const key of PAGE_EDITOR_SYSTEM_KEYS) push(key, SYSTEM_LABELS[key], brandColor(doc, key), "#000000");
199
- for (const row of libraryRows(doc)) {
200
- const key = row.key?.trim();
201
- if (!key) continue;
202
- push(key, row.label?.trim() || titleCase(key), row, row.hex ?? "#000000");
203
- }
204
- return swatches;
205
- }
206
- async function themeDocFromRequest(req) {
207
- try {
208
- return await req.payload?.findGlobal?.({
209
- slug: "theme",
210
- depth: 0,
211
- overrideAccess: true
212
- }) ?? null;
213
- } catch {
214
- return null;
215
- }
216
- }
217
- //#endregion
218
103
  //#region src/theme/look-field.ts
219
104
  const validateLook = async (value, { req }) => {
220
105
  if (value == null || value === "") return true;
@@ -301,6 +186,6 @@ const THEME_PREVIEW_BREAKPOINTS = [
301
186
  }
302
187
  ];
303
188
  //#endregion
304
- export { pageEditorLooks as a, themeLibraryFromDoc as c, deleteLibraryColor as d, rewriteColorToken as f, PAGE_EDITOR_SYSTEM_KEYS as i, findColorTokens as l, colorTokenField as n, pageEditorSwatches as o, themeColorKeys as p, lookField as r, pageEditorTokens as s, THEME_PREVIEW_BREAKPOINTS as t, rewriteColorTokens as u };
189
+ export { rewriteColorTokens as a, themeColorKeys as c, findColorTokens as i, colorTokenField as n, deleteLibraryColor as o, lookField as r, rewriteColorToken as s, THEME_PREVIEW_BREAKPOINTS as t };
305
190
 
306
- //# sourceMappingURL=preview-Br1SQCKn.mjs.map
191
+ //# sourceMappingURL=preview-BE7P1ezl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-BE7P1ezl.mjs","names":[],"sources":["../src/theme/library.ts","../src/theme/color-tokens.ts","../src/theme/look-field.ts","../src/theme/preview.ts"],"sourcesContent":["import { SHADE_STEPS, type ShadeStep } from \"@bison-lab/tokens\";\n\nimport { SYSTEM_COLOR_KEYS, type ThemeDoc, type ThemeLibraryColorDoc } from \"./types\";\n\n/**\n * Payload's array form state stores the row count (`0`, `2`, …), not the\n * rows. A custom Field that treats that number as the list will throw\n * `rows.filter is not a function` on an empty Theme library.\n */\nexport function asLibraryRows(value: unknown): ThemeLibraryColorDoc[] {\n return Array.isArray(value) ? value : [];\n}\n\nconst STEP_SET = new Set<number>(SHADE_STEPS);\n\n/**\n * Page editors pick `coral-400`, never a raw hex. Rewrite every use of\n * `fromKey` onto `toKey` at the same step: `coral-400` → `highlight-400`.\n * A bare key (`coral`) becomes `toKey`. Anything else is left alone.\n */\nexport function rewriteColorToken(token: string, fromKey: string, toKey: string): string {\n if (token === fromKey) return toKey;\n const dash = token.lastIndexOf(\"-\");\n if (dash <= 0) return token;\n const key = token.slice(0, dash);\n const step = Number(token.slice(dash + 1));\n if (key !== fromKey || !STEP_SET.has(step)) return token;\n return `${toKey}-${step as ShadeStep}`;\n}\n\nexport function themeColorKeys(doc: ThemeDoc | null | undefined): string[] {\n const custom = asLibraryRows(doc?.colors?.library)\n .map((row) => row.key?.trim())\n .filter((key): key is string => Boolean(key));\n return [...SYSTEM_COLOR_KEYS, ...custom];\n}\n\n/**\n * Remove a custom color. Unused: omit `replacement` and the row is gone.\n * In use: pass another system or custom key; the caller rewrites page\n * tokens with `rewriteColorToken`. After this, no library row still\n * has `key`.\n */\nexport function deleteLibraryColor(doc: ThemeDoc, key: string, replacement?: string): ThemeDoc {\n const library = [...asLibraryRows(doc.colors?.library)];\n const index = library.findIndex((row) => row.key === key);\n if (index === -1) {\n throw new Error(`No custom color named ${JSON.stringify(key)}`);\n }\n library.splice(index, 1);\n const next: ThemeDoc = {\n ...doc,\n colors: { ...doc.colors, library },\n };\n if (replacement !== undefined) {\n if (replacement === key) {\n throw new Error(\"Replacement must be a different color\");\n }\n if (!themeColorKeys(next).includes(replacement)) {\n throw new Error(`Replacement ${JSON.stringify(replacement)} is not a system or remaining custom color`);\n }\n }\n return next;\n}\n","import { rewriteColorToken } from \"./library\";\n\nexport interface ColorTokenHit {\n path: string;\n token: string;\n}\n\n/**\n * A string `rewriteColorToken` would change: `coral`, `coral-400`.\n * `#FF5A2D` and `coral-ish` are not tokens.\n */\nexport function isColorToken(value: string, key: string): boolean {\n return rewriteColorToken(value, key, `\\0${key}`) !== value;\n}\n\nexport function findColorTokens(value: unknown, key: string): ColorTokenHit[] {\n const hits: ColorTokenHit[] = [];\n walk(value, \"\", (path, token) => {\n if (isColorToken(token, key)) hits.push({ path, token });\n });\n return hits;\n}\n\nexport function rewriteColorTokens<T>(value: T, fromKey: string, toKey: string): T {\n return rewriteValue(value, fromKey, toKey) as T;\n}\n\nfunction rewriteValue(value: unknown, fromKey: string, toKey: string): unknown {\n if (typeof value === \"string\") return rewriteColorToken(value, fromKey, toKey);\n if (Array.isArray(value)) return value.map((item) => rewriteValue(item, fromKey, toKey));\n if (value && typeof value === \"object\") {\n const next: Record<string, unknown> = {};\n for (const [name, child] of Object.entries(value)) {\n next[name] = rewriteValue(child, fromKey, toKey);\n }\n return next;\n }\n return value;\n}\n\nfunction walk(value: unknown, path: string, visit: (path: string, token: string) => void): void {\n if (typeof value === \"string\") {\n visit(path, value);\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((item, index) => walk(item, join(path, String(index)), visit));\n return;\n }\n if (value && typeof value === \"object\") {\n for (const [name, child] of Object.entries(value)) {\n walk(child, join(path, name), visit);\n }\n }\n}\n\nfunction join(path: string, segment: string): string {\n return path ? `${path}.${segment}` : segment;\n}\n","import type { StaticLabel, TextField, TextFieldSingleValidation } from \"payload\";\n\nimport { LOOK_FIELD } from \"./fields\";\nimport { pageEditorLooks, pageEditorTokens, themeDocFromRequest } from \"./looks\";\n\nexport interface LookFieldOptions {\n name?: string;\n label?: StaticLabel;\n required?: boolean;\n admin?: TextField[\"admin\"];\n validate?: TextFieldSingleValidation;\n}\n\nexport type LookFieldMode = \"look\" | \"token\";\n\nexport const validateLook: TextFieldSingleValidation = async (value, { req }) => {\n if (value == null || value === \"\") return true;\n if (typeof value !== \"string\") return \"Pick a look from Theme → Colors\";\n const doc = await themeDocFromRequest(req);\n if (pageEditorLooks(doc).some((look) => look.value === value)) return true;\n return \"Pick a look from Theme → Colors\";\n};\n\nexport const validateColorToken: TextFieldSingleValidation = async (value, { req }) => {\n if (value == null || value === \"\") return true;\n if (typeof value !== \"string\") return \"Pick an included step from Theme → Colors\";\n const doc = await themeDocFromRequest(req);\n if (pageEditorTokens(doc).some((token) => token.value === value)) return true;\n return \"Pick an included step from Theme → Colors\";\n};\n\nfunction pickerField(\n defaults: { name: string; label: string; mode: LookFieldMode; validate: TextFieldSingleValidation },\n overrides: LookFieldOptions,\n): TextField {\n const { name = defaults.name, label = defaults.label, admin, required, validate = defaults.validate } = overrides;\n return {\n name,\n type: \"text\",\n label,\n required,\n validate,\n admin: {\n ...admin,\n components: { Field: LOOK_FIELD, ...admin?.components },\n custom: { mode: defaults.mode, ...admin?.custom },\n },\n };\n}\n\n/**\n * A picker any collection or global can offer. Options come from the\n * published Theme at request time: page-editor system scales plus custom\n * Colors. Payload select options are a static list, so this is a text\n * field with an admin picker — adding Coral does not need a schema change.\n */\nexport function lookField(overrides: LookFieldOptions = {}): TextField {\n return pickerField({ name: \"look\", label: \"Look\", mode: \"look\", validate: validateLook }, overrides);\n}\n\n/**\n * Included steps as `coral-400`. Excluded steps do not appear.\n */\nexport function colorTokenField(overrides: LookFieldOptions = {}): TextField {\n return pickerField(\n { name: \"color\", label: \"Color\", mode: \"token\", validate: validateColorToken },\n overrides,\n );\n}\n","/**\n * Device sizes the Theme (and, later, Pages) live-preview toolbar offers.\n * One list so the panes match.\n */\nexport const THEME_PREVIEW_BREAKPOINTS = [\n { label: \"Mobile\", name: \"mobile\", width: 375, height: 667 },\n { label: \"Tablet\", name: \"tablet\", width: 768, height: 1024 },\n { label: \"Desktop\", name: \"desktop\", width: 1440, height: 900 },\n] as const;\n"],"mappings":";;;;;;;;;AASA,SAAgB,cAAc,OAAwC;AACpE,QAAO,MAAM,QAAQ,MAAM,GAAG,QAAQ,EAAE;;AAG1C,MAAM,WAAW,IAA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c } from "./identity-B4Lew8Fu.mjs";
2
2
  import { ShadeStep } from "@bison-lab/tokens";
3
3
  import { StaticLabel, TextField, TextFieldSingleValidation } from "payload";
4
4
 
@@ -110,4 +110,4 @@ declare const THEME_PREVIEW_BREAKPOINTS: readonly [{
110
110
  }];
111
111
  //#endregion
112
112
  export { deleteLibraryColor as _, PageEditorSystemKey as a, pageEditorTokens as c, LookFieldOptions as d, colorTokenField as f, rewriteColorTokens as g, findColorTokens as h, PAGE_EDITOR_SYSTEM_KEYS as i, themeLibraryFromDoc as l, ColorTokenHit as m, ColorSwatch as n, pageEditorLooks as o, lookField as p, LookOption as r, pageEditorSwatches as s, THEME_PREVIEW_BREAKPOINTS as t, LookFieldMode as u, rewriteColorToken as v, themeColorKeys as y };
113
- //# sourceMappingURL=preview-B69Dhi8T.d.mts.map
113
+ //# sourceMappingURL=preview-DSQN4uYa.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preview-B69Dhi8T.d.mts","names":[],"sources":["../src/theme/library.ts","../src/theme/color-tokens.ts","../src/theme/look-field.ts","../src/theme/looks.ts","../src/theme/preview.ts"],"mappings":";;;;;;;;;;iBAoBgB,iBAAA,CAAkB,KAAA,UAAe,OAAA,UAAiB,KAAA;AAAA,iBAUlD,cAAA,CAAe,GAAA,EAAK,QAAA;AAApC;;;;;AAaA;AAbA,iBAagB,kBAAA,CAAmB,GAAA,EAAK,QAAA,EAAU,GAAA,UAAa,WAAA,YAAuB,QAAA;;;UCzCrE,aAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,iBAWc,eAAA,CAAgB,KAAA,WAAgB,GAAA,WAAc,aAAA;AAAA,iBAQ9C,kBAAA,GAAA,CAAsB,KAAA,EAAO,CAAA,EAAG,OAAA,UAAiB,KAAA,WAAgB,CAAA;;;UClBhE,gBAAA;EACf,IAAA;EACA,KAAA,GAAQ,WAAA;EACR,QAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,GAAW,yBAAA;AAAA;AAAA,KAGD,aAAA;;;;AFiBZ;;;iBE0BgB,SAAA,CAAU,SAAA,GAAW,gBAAA,GAAwB,SAAA;;AFb7D;;iBEoBgB,eAAA,CAAgB,SAAA,GAAW,gBAAA,GAAwB,SAAA;;;;;;AF3CnE;cGXa,uBAAA;AAAA,KAED,mBAAA,WAA8B,uBAAA;AAAA,UAEzB,UAAA;EACf,KAAA;EACA,KAAA;AAAA;AAAA,iBAiBc,mBAAA,CAAoB,GAAA,EAAK,QAAA,sBAA8B,oBAAA;;AHFvE;;;;iBGuBgB,eAAA,CAAgB,GAAA,EAAK,QAAA,sBAA8B,UAAA;AHVnE;;;;AAAA,iBG6BgB,gBAAA,CAAiB,GAAA,EAAK,QAAA,sBAA8B,UAAA;;UAoBnD,WAAA,SAAoB,UAAA;EHjD0B;EGmD7D,MAAA;EHnD4F;EGqD5F,WAAA;EACA,IAAA,EAAM,SAAA;;EAEN,GAAA;AAAA;;;;;AFpFF;iBE4FgB,kBAAA,CAAmB,GAAA,EAAK,QAAA,sBAA8B,WAAA;;;;;;;cCvGzD,yBAAA;EAAA"}
1
+ {"version":3,"file":"preview-DSQN4uYa.d.mts","names":[],"sources":["../src/theme/library.ts","../src/theme/color-tokens.ts","../src/theme/look-field.ts","../src/theme/looks.ts","../src/theme/preview.ts"],"mappings":";;;;;;;;;;iBAoBgB,iBAAA,CAAkB,KAAA,UAAe,OAAA,UAAiB,KAAA;AAAA,iBAUlD,cAAA,CAAe,GAAA,EAAK,QAAA;AAApC;;;;;AAaA;AAbA,iBAagB,kBAAA,CAAmB,GAAA,EAAK,QAAA,EAAU,GAAA,UAAa,WAAA,YAAuB,QAAA;;;UCzCrE,aAAA;EACf,IAAA;EACA,KAAA;AAAA;AAAA,iBAWc,eAAA,CAAgB,KAAA,WAAgB,GAAA,WAAc,aAAA;AAAA,iBAQ9C,kBAAA,GAAA,CAAsB,KAAA,EAAO,CAAA,EAAG,OAAA,UAAiB,KAAA,WAAgB,CAAA;;;UClBhE,gBAAA;EACf,IAAA;EACA,KAAA,GAAQ,WAAA;EACR,QAAA;EACA,KAAA,GAAQ,SAAA;EACR,QAAA,GAAW,yBAAA;AAAA;AAAA,KAGD,aAAA;;;;AFiBZ;;;iBE0BgB,SAAA,CAAU,SAAA,GAAW,gBAAA,GAAwB,SAAA;;AFb7D;;iBEoBgB,eAAA,CAAgB,SAAA,GAAW,gBAAA,GAAwB,SAAA;;;;;;AF3CnE;cGXa,uBAAA;AAAA,KAED,mBAAA,WAA8B,uBAAA;AAAA,UAEzB,UAAA;EACf,KAAA;EACA,KAAA;AAAA;AAAA,iBAiBc,mBAAA,CAAoB,GAAA,EAAK,QAAA,sBAA8B,oBAAA;;AHFvE;;;;iBGuBgB,eAAA,CAAgB,GAAA,EAAK,QAAA,sBAA8B,UAAA;AHVnE;;;;AAAA,iBG6BgB,gBAAA,CAAiB,GAAA,EAAK,QAAA,sBAA8B,UAAA;;UAoBnD,WAAA,SAAoB,UAAA;EHjD0B;EGmD7D,MAAA;EHnD4F;EGqD5F,WAAA;EACA,IAAA,EAAM,SAAA;;EAEN,GAAA;AAAA;;;;;AFpFF;iBE4FgB,kBAAA,CAAmB,GAAA,EAAK,QAAA,sBAA8B,WAAA;;;;;;;cCvGzD,yBAAA;EAAA"}
@@ -1,4 +1,4 @@
1
- import { t as localeArgs } from "./locale-B6rUVwpg.mjs";
1
+ import { t as localeArgs } from "./locale-DaEJ1d2O.mjs";
2
2
  //#region src/navigation/types.ts
3
3
  const NAVIGATION_SLUG = "navigation";
4
4
  const NAVIGATION_DB_NAME = "nav";
@@ -461,4 +461,4 @@ async function getNavigation({ payload, draft = false, ...read }) {
461
461
  //#endregion
462
462
  export { NAVIGATION_SLUG as C, NAVIGATION_FOOTER_SLUG as S, validateExternalHref as _, FOOTER_MAX_LINK_COLUMNS as a, NAVIGATION_FEATURE as b, footerDesktopTracks as c, validateFooterColumns as d, validateFooterSocialUrl as f, linkField as g, isValidExternalHref as h, FOOTER_MAX_COLUMNS as i, footerFields as l, headerCtaEnabled as m, FOOTER_COLUMNS_FIELD as n, FOOTER_SOCIALS as o, EXTERNAL_HREF_MESSAGE as p, FOOTER_COLUMN_WIDTHS as r, FOOTER_TWELFTHS as s, getNavigation as t, normalizeFooterDesktop as u, validateHeaderCta as v, NAVIGATION_FOOTER_DB_NAME as x, NAVIGATION_DB_NAME as y };
463
463
 
464
- //# sourceMappingURL=published-Vu_QX2Vv.mjs.map
464
+ //# sourceMappingURL=published-BF2F3od_.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-Vu_QX2Vv.mjs","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"sourcesContent":["/**\n * Public Header and Footer as two Globals so each has its own Save /\n * Publish / drafts. Bar behaviour (`bar` on Header) stays in the schema\n * with `admin.hidden`; it is not a Settings tab. Featured looks stay on\n * chrome roles (BIS-85 / SPI-89), not a Header array. The items kit\n * editor is the workspace field (BIS-119 / BIS-121). Payload's left nav\n * stays until BIS-90. The Spinal bump is SPI-99.\n */\n\nimport type { Block, GlobalConfig } from \"payload\";\n\nimport type { LocaleRead } from \"../locale\";\n\nexport const NAVIGATION_SLUG = \"navigation\";\nexport const NAVIGATION_DB_NAME = \"nav\";\nexport const NAVIGATION_FOOTER_SLUG = \"navigation-footer\";\nexport const NAVIGATION_FOOTER_DB_NAME = \"navf\";\n\nexport const NAVIGATION_FEATURE = \"navigation\";\n\nexport interface CreateNavigationOptions {\n /**\n * Header bar blocks this site offers. The field stays a blocks array —\n * a later nav block is appended here, not a mega-menu-only shape.\n */\n blocks: Block[];\n /**\n * Preview URL for both documents. The site owns the path — this factory\n * does not invent a route.\n */\n preview?: NonNullable<NonNullable<GlobalConfig[\"admin\"]>[\"preview\"]>;\n livePreview?: NonNullable<NonNullable<GlobalConfig[\"admin\"]>[\"livePreview\"]>;\n /**\n * Component path for Payload's Preview button, as a key into the site's\n * committed `importMap.js`.\n */\n previewButton?: string;\n /** The collection a page link points into. Defaults to `pages`. */\n pagesCollection?: string;\n /** Locked footer copyright uses this name. The year stays the current year. */\n footerCopyrightName?: string;\n}\n\nexport interface NavigationHeader {\n items?: unknown;\n cta?: unknown;\n}\n\nexport interface NavigationBar {\n hideOnScroll?: boolean | null;\n viewport?: boolean | null;\n defaultMaxWidth?: (\"narrow\" | \"standard\" | \"wide\") | null;\n}\n\nexport interface NavigationFooter {\n columns?: unknown;\n brand?: unknown;\n}\n\nexport interface NavigationDoc {\n header: NavigationHeader;\n footer: NavigationFooter;\n bar: NavigationBar;\n}\n\nexport interface GetNavigationArgs extends LocaleRead {\n payload: {\n findGlobal: (args: {\n slug: string;\n draft?: boolean;\n overrideAccess?: boolean;\n depth?: number;\n }) => Promise<unknown>;\n };\n draft?: boolean;\n}\n","import type { Condition, Field, FieldHook, GroupField, RowField, TextFieldSingleValidation } from \"payload\";\n\n/**\n * Same import-map string as `@bison-lab/payload-blocks`. A site that\n * already generates the blocks admin map gets the picker; a missing\n * entry renders the row as nothing, so `payload generate:importmap` is\n * part of adopting this factory.\n */\nconst LINK_FIELD = \"@bison-lab/payload-blocks/admin#LinkField\";\n\ntype LinkType = \"page\" | \"external\";\n\ninterface LinkDestination {\n type?: LinkType | null;\n href?: string | null;\n}\n\nfunction linkTypeOf(link: LinkDestination | null | undefined): LinkType {\n if (link?.type === \"external\") return \"external\";\n if (link?.type === \"page\") return \"page\";\n return link?.href ? \"external\" : \"page\";\n}\n\nexport const EXTERNAL_HREF_MESSAGE =\n \"Enter a valid URL (https://…), a mailto: or tel: link, a site path starting with /, or a #anchor on the same page.\";\n\nconst SAME_PAGE_ANCHOR = /^#[A-Za-z][\\w:.-]*$/;\n\n/**\n * What the picker will store as an external destination: http(s) with a\n * host, mailto:/tel: with a value, an in-site path, or a same-page #anchor. Rejects a bare\n * host, protocol-relative URLs, and anything that is not a link.\n */\nexport function isValidExternalHref(value: unknown): boolean {\n const raw = String(value ?? \"\").trim();\n if (!raw || /\\s/.test(raw)) return false;\n if (raw.startsWith(\"/\") && !raw.startsWith(\"//\")) return true;\n if (/^mailto:/i.test(raw)) return raw.length > \"mailto:\".length;\n if (/^tel:/i.test(raw)) return raw.length > \"tel:\".length;\n // A same-page fragment: a site's link adapter can open a modal or scroll to it.\n if (raw.startsWith(\"#\")) return SAME_PAGE_ANCHOR.test(raw);\n try {\n const url = new URL(raw);\n return (url.protocol === \"http:\" || url.protocol === \"https:\") && Boolean(url.hostname);\n } catch {\n return false;\n }\n}\n\nexport function validateExternalHref(value: unknown, required = false): true | string {\n const raw = String(value ?? \"\").trim();\n if (!raw) return required ? \"This field is required.\" : true;\n return isValidExternalHref(raw) ? true : EXTERNAL_HREF_MESSAGE;\n}\n\nconst whenPage: Condition = (_data, siblingData) => linkTypeOf(siblingData as LinkDestination) === \"page\";\nconst whenExternal: Condition = (_data, siblingData) =>\n linkTypeOf(siblingData as LinkDestination) === \"external\";\n\nfunction hrefValidate(required: boolean): TextFieldSingleValidation {\n return (value, { siblingData }) => {\n if (linkTypeOf(siblingData as LinkDestination) !== \"external\") return true;\n return validateExternalHref(value, required);\n };\n}\n\nfunction isAutosave(req: unknown): boolean {\n const request = req as { method?: string; query?: Record<string, unknown> } | undefined;\n // A write only: any GET can add `?autosave=true`, and must not get a leftover back.\n if (!request || request.method === \"GET\") return false;\n const query = request.query;\n return query?.autosave === \"true\" || query?.autosave === true;\n}\n\nfunction savedTypeOf(siblingData: unknown, previous: unknown): LinkType {\n const row = (siblingData ?? {}) as Record<string, unknown>;\n if (row.type != null || !previous || typeof previous !== \"object\") return linkTypeOf(row as LinkDestination);\n const merged: Record<string, unknown> = { ...(previous as Record<string, unknown>) };\n for (const [key, value] of Object.entries(row)) if (value !== undefined) merged[key] = value;\n return linkTypeOf(merged as LinkDestination);\n}\n\n/**\n * Same as payload-blocks' `linkDestinationHooks` (#322): a destination the\n * row's `type` does not name is saved and read as null, except on an\n * autosave, whose reply the admin folds back into the open form.\n */\nfunction destinationHooks(destination: LinkType): { beforeChange: FieldHook[]; afterRead: FieldHook[] } {\n const beforeChange: FieldHook = ({ value, siblingData, previousSiblingDoc, req }) => {\n if (isAutosave(req)) return value;\n return savedTypeOf(siblingData, previousSiblingDoc) === destination ? value : null;\n };\n const afterRead: FieldHook = ({ value, siblingData, req }) => {\n if (isAutosave(req)) return value;\n return linkTypeOf(siblingData as LinkDestination) === destination ? value : null;\n };\n return { beforeChange: [beforeChange], afterRead: [afterRead] };\n}\n\nfunction linkDestinationFields({\n required = false,\n pagesCollection = \"pages\",\n}: {\n required?: boolean;\n pagesCollection?: string;\n} = {}): RowField[] {\n return [\n {\n type: \"row\",\n admin: { components: { Field: LINK_FIELD } },\n fields: [\n {\n name: \"type\",\n type: \"radio\",\n label: \"Link\",\n defaultValue: \"page\",\n options: [\n { label: \"Page\", value: \"page\" },\n { label: \"URL\", value: \"external\" },\n ],\n admin: { layout: \"horizontal\" },\n },\n {\n name: \"page\",\n type: \"relationship\",\n relationTo: pagesCollection,\n required,\n filterOptions: { _status: { equals: \"published\" } },\n hooks: destinationHooks(\"page\"),\n admin: { condition: whenPage },\n },\n {\n name: \"href\",\n type: \"text\",\n label: \"URL\",\n required,\n validate: hrefValidate(required),\n hooks: destinationHooks(\"external\"),\n admin: {\n condition: whenExternal,\n description:\n 'A full URL (\"https://example.com\"), \"mailto:\" or \"tel:\", a site path (\"/contact\"), or a same-page \"#anchor\".',\n },\n },\n ],\n },\n ];\n}\n\nfunction linkFields({\n required = false,\n pagesCollection,\n}: {\n required?: boolean;\n pagesCollection?: string;\n} = {}): Field[] {\n return [\n ...linkDestinationFields({ required, pagesCollection }),\n { name: \"label\", type: \"text\", localized: true, label: \"Label\", required },\n {\n name: \"newTab\",\n type: \"checkbox\",\n label: \"Open in a new tab\",\n defaultValue: false,\n admin: {\n // Drawn by LinkField next to the destination so Header, Footer, and\n // page blocks cannot drift apart.\n hidden: true,\n },\n },\n ];\n}\n\nexport interface HeaderCtaValue {\n enabled?: boolean | null;\n type?: LinkType | null;\n page?: unknown;\n href?: string | null;\n label?: string | null;\n}\n\n/** A stored button, or a legacy row that already has a label or destination. */\nexport function headerCtaEnabled(cta: HeaderCtaValue | null | undefined): boolean {\n if (!cta) return false;\n if (cta.enabled === false) return false;\n if (cta.enabled === true) return true;\n return Boolean(cta.label || cta.page || cta.href);\n}\n\n/**\n * When the Header button is on, label and destination are required.\n * Off (or a cleared row) can save empty.\n */\nexport function validateHeaderCta(value: unknown): true | string {\n const cta = (value && typeof value === \"object\" ? value : {}) as HeaderCtaValue;\n if (!headerCtaEnabled(cta)) return true;\n if (!String(cta.label ?? \"\").trim()) return \"The Header button needs a label.\";\n const dest = linkTypeOf(cta);\n if (dest === \"external\") {\n const href = validateExternalHref(cta.href, true);\n if (href !== true) {\n return href === \"This field is required.\"\n ? \"The Header button needs a published page or a URL.\"\n : href;\n }\n }\n if (dest === \"page\" && (cta.page == null || cta.page === \"\")) {\n return \"The Header button needs a published page or a URL.\";\n }\n return true;\n}\n\nexport function linkField({\n name = \"link\",\n label,\n admin,\n required,\n pagesCollection,\n toggle,\n}: {\n name?: string;\n label?: GroupField[\"label\"];\n admin?: GroupField[\"admin\"];\n required?: boolean;\n pagesCollection?: string;\n /** Header button: an enable checkbox; children are not required unless it is on. */\n toggle?: boolean;\n} = {}): GroupField {\n return {\n name,\n type: \"group\",\n fields: toggle\n ? [\n {\n name: \"enabled\",\n type: \"checkbox\",\n label: \"Show Header button\",\n defaultValue: false,\n },\n ...linkFields({ required: false, pagesCollection }),\n ]\n : linkFields({ required, pagesCollection }),\n ...(toggle ? { validate: validateHeaderCta as NonNullable<GroupField[\"validate\"]> } : {}),\n ...(label === undefined ? {} : { label }),\n ...(admin === undefined ? {} : { admin }),\n };\n}\n\nexport function footerLinkFields({\n required = false,\n pagesCollection,\n}: {\n required?: boolean;\n pagesCollection?: string;\n} = {}): Field[] {\n return linkFields({ required, pagesCollection });\n}\n","import type { ArrayField, ArrayFieldValidation, Field, GroupField, TextField } from \"payload\";\n\nimport { footerLinkFields, isValidExternalHref, validateExternalHref } from \"./link\";\n\n/**\n * Same presets as the header mega-menu. Desktop only. Tablet is a fixed\n * 2×2 on the public footer; mobile stacks.\n */\nexport const FOOTER_COLUMN_WIDTHS = [\"25\", \"33\", \"50\", \"66\", \"75\", \"100\"] as const;\nexport type FooterColumnWidth = (typeof FOOTER_COLUMN_WIDTHS)[number];\n\n/** Logo column plus link columns. */\nexport const FOOTER_MAX_COLUMNS = 4;\n/** Link columns. The logo column is always first and is not in this count. */\nexport const FOOTER_MAX_LINK_COLUMNS = FOOTER_MAX_COLUMNS - 1;\n\nexport const FOOTER_SOCIALS = [\"facebook\", \"instagram\", \"linkedin\", \"x\", \"youtube\"] as const;\nexport type FooterSocial = (typeof FOOTER_SOCIALS)[number];\n\nconst FOOTER_SOCIAL_LABELS: Record<FooterSocial, string> = {\n facebook: \"Facebook\",\n instagram: \"Instagram\",\n linkedin: \"LinkedIn\",\n x: \"X\",\n youtube: \"YouTube\",\n};\n\n/** Twelfths of a row. Link-column widths share this 12; the logo column does not. */\nexport const FOOTER_TWELFTHS: Record<FooterColumnWidth, number> = {\n \"25\": 3,\n \"33\": 4,\n \"50\": 6,\n \"66\": 8,\n \"75\": 9,\n \"100\": 12,\n};\n\nexport const FOOTER_COLUMNS_FIELD = \"@bison-lab/payload-blocks/admin#FooterColumnsField\";\n\ninterface FooterLinkRow {\n label?: string | null;\n type?: \"page\" | \"external\" | null;\n page?: unknown;\n href?: string | null;\n}\n\ninterface FooterSectionRow {\n heading?: string | null;\n links?: FooterLinkRow[] | null;\n}\n\ninterface FooterColumnRow {\n desktop?: FooterColumnWidth | null;\n sections?: FooterSectionRow[] | null;\n}\n\nfunction evenDesktop(count: number): FooterColumnWidth[] {\n return (\n {\n 1: [\"100\"],\n 2: [\"50\", \"50\"],\n 3: [\"33\", \"33\", \"33\"],\n 4: [\"25\", \"25\", \"25\", \"25\"],\n } as Record<number, FooterColumnWidth[]>\n )[count] ?? [];\n}\n\n/** Even split for the current link-column count. Used by the kit editor. */\nexport function normalizeFooterDesktop(count: number): FooterColumnWidth[] {\n return evenDesktop(count);\n}\n\n/**\n * Desktop tracks: the logo keeps its own percent; link columns share the\n * remaining `1fr` and are themselves percent of that leftover, not of the\n * full footer.\n */\nexport function footerDesktopTracks(\n brand: FooterColumnWidth | null | undefined,\n columns: Array<FooterColumnWidth | null | undefined>,\n): {\n brandPercent: string;\n brandTemplate: string;\n linksTemplate: string;\n} {\n const width = brand && brand in FOOTER_TWELFTHS ? brand : \"25\";\n const brandPercent = `${width}%`;\n const links = columns.map((column) => `${column && column in FOOTER_TWELFTHS ? column : \"25\"}%`);\n return {\n brandPercent,\n brandTemplate: `${brandPercent} minmax(0,1fr)`,\n linksTemplate: links.join(\" \") || \"1fr\",\n };\n}\n\nfunction linkHasDestination(link: FooterLinkRow): boolean {\n if (link.type === \"external\") return isValidExternalHref(link.href);\n if (link.type === \"page\") return link.page != null && link.page !== \"\";\n if (String(link.href ?? \"\").trim()) return isValidExternalHref(link.href);\n return link.page != null && link.page !== \"\";\n}\n\n/**\n * Link-column widths must add to 100% of the space beside the logo. The\n * logo width is independent. Each section needs a labeled destination\n * before publish. Draft saves skip field validation. A footer with only\n * the logo column is valid.\n */\nexport const validateFooterColumns: ArrayFieldValidation = (value) => {\n const columns = (Array.isArray(value) ? value : []) as FooterColumnRow[];\n if (columns.length > FOOTER_MAX_LINK_COLUMNS) {\n return \"No more than three link columns. The logo column is always first.\";\n }\n\n if (columns.length === 0) return true;\n\n const twelfths = columns.reduce((sum, row) => sum + FOOTER_TWELFTHS[row?.desktop ?? \"100\"], 0);\n if (twelfths !== 12) {\n const percent = Math.round((twelfths / 12) * 100);\n return `Desktop column widths add up to ${percent}%. They need to add up to 100% of the space beside the logo.`;\n }\n\n for (const [columnIndex, column] of columns.entries()) {\n const sections = column.sections ?? [];\n if (sections.length === 0) {\n return `Column ${columnIndex + 1} needs at least one section.`;\n }\n for (const [sectionIndex, section] of sections.entries()) {\n if (!String(section.heading ?? \"\").trim()) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1} needs a section label.`;\n }\n const links = section.links ?? [];\n if (links.length === 0) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1} needs at least one link.`;\n }\n for (const [linkIndex, link] of links.entries()) {\n if (!String(link.label ?? \"\").trim()) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1}, link ${linkIndex + 1} needs a label.`;\n }\n if (!linkHasDestination(link)) {\n const href = String(link.href ?? \"\").trim();\n if (href && validateExternalHref(href) !== true) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1}, link ${linkIndex + 1} needs a valid URL.`;\n }\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1}, link ${linkIndex + 1} needs a destination.`;\n }\n }\n }\n }\n\n return true;\n};\n\nexport function validateFooterSocialUrl(value: unknown): true | string {\n const raw = String(value ?? \"\").trim();\n if (!raw) return true;\n try {\n const url = new URL(raw);\n if (url.protocol === \"http:\" || url.protocol === \"https:\") return true;\n } catch {\n // not a URL\n }\n return \"Must be a valid http(s) URL.\";\n}\n\nfunction socialFields(): TextField[] {\n return FOOTER_SOCIALS.map((name) => ({\n name,\n type: \"text\",\n label: FOOTER_SOCIAL_LABELS[name],\n validate: validateFooterSocialUrl,\n }));\n}\n\nexport function footerColumnsField({\n pagesCollection,\n}: {\n pagesCollection?: string;\n} = {}): ArrayField {\n return {\n name: \"columns\",\n type: \"array\",\n dbName: \"c\",\n labels: { singular: \"Column\", plural: \"Columns\" },\n maxRows: FOOTER_MAX_LINK_COLUMNS,\n validate: validateFooterColumns,\n admin: {\n description:\n \"Logo column plus up to three link columns. Link-column widths add up to 100% of the space beside the logo.\",\n },\n fields: [\n {\n name: \"desktop\",\n type: \"select\",\n label: \"Desktop width\",\n defaultValue: \"25\",\n required: true,\n options: FOOTER_COLUMN_WIDTHS.map((value) => ({ label: `${value}%`, value })),\n },\n {\n name: \"sections\",\n type: \"array\",\n dbName: \"s\",\n labels: { singular: \"Section\", plural: \"Sections\" },\n minRows: 1,\n fields: [\n {\n name: \"heading\",\n type: \"text\",\n localized: true,\n label: \"Section Label\",\n required: true,\n },\n {\n name: \"links\",\n type: \"array\",\n labels: { singular: \"Link\", plural: \"Links\" },\n minRows: 1,\n fields: footerLinkFields({ required: true, pagesCollection }),\n },\n ],\n },\n ],\n };\n}\n\nexport function footerBrandField(): GroupField {\n return {\n name: \"brand\",\n type: \"group\",\n label: \"Brand & social\",\n fields: [\n {\n name: \"desktop\",\n type: \"select\",\n label: \"Desktop width\",\n defaultValue: \"25\",\n required: true,\n options: FOOTER_COLUMN_WIDTHS.map((value) => ({ label: `${value}%`, value })),\n },\n {\n name: \"tagline\",\n type: \"textarea\",\n localized: true,\n label: \"Text below the logo\",\n },\n ...socialFields(),\n ],\n };\n}\n\nexport function footerFields(options: { pagesCollection?: string } = {}): Field[] {\n return [footerColumnsField(options), footerBrandField()];\n}\n","import { localeArgs } from \"../locale\";\nimport {\n NAVIGATION_FOOTER_SLUG,\n NAVIGATION_SLUG,\n type GetNavigationArgs,\n type NavigationBar,\n type NavigationDoc,\n type NavigationFooter,\n type NavigationHeader,\n} from \"./types\";\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n return value && typeof value === \"object\" ? (value as Record<string, unknown>) : null;\n}\n\nfunction headerOf(doc: unknown): NavigationHeader {\n const record = asRecord(doc);\n const header = record && \"header\" in record ? asRecord(record.header) : null;\n return header ?? {};\n}\n\nfunction footerOf(doc: unknown): NavigationFooter {\n const record = asRecord(doc);\n const footer = record && \"footer\" in record ? asRecord(record.footer) : null;\n return footer ?? {};\n}\n\nfunction barOf(doc: unknown): NavigationBar {\n const record = asRecord(doc);\n const bar = record && \"bar\" in record ? asRecord(record.bar) : null;\n return bar ?? {};\n}\n\n/**\n * Reads Header and Footer and returns one `{ header, footer, bar }`. A\n * site header does not learn two slugs. `bar` is the hidden Header group\n * (hide on scroll, viewport, default panel width). `draft: true`\n * reads the newest version; omit it (or pass false) for the published\n * documents. A multi-locale site passes the request's `locale` (and\n * `fallbackLocale`), so the labels and footer copy read in that locale.\n */\nexport async function getNavigation({\n payload,\n draft = false,\n ...read\n}: GetNavigationArgs): Promise<NavigationDoc> {\n const locale = localeArgs(read);\n const [headerDoc, footerDoc] = await Promise.all([\n payload.findGlobal({ slug: NAVIGATION_SLUG, draft, depth: 1, ...locale }),\n payload.findGlobal({ slug: NAVIGATION_FOOTER_SLUG, draft, depth: 1, ...locale }),\n ]);\n return { header: headerOf(headerDoc), footer: footerOf(footerDoc), bar: barOf(headerDoc) };\n}\n"],"mappings":";;AAaA,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;AAClC,MAAa,yBAAyB;AACtC,MAAa,4BAA4B;AAEzC,MAAa,qBAAqB;;;;;;;;;ACVlC,MAAM,aAAa;AASnB,SAAS,WAAW,MAAoD;AACtE,KAAI,MAAM,SAAS,WAAY,QAAO;AACtC,KAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,QAAO,MAAM,OAAO,aAAa;;AAGnC,MAAa,wBACX;AAEF,MAAM,mBAAmB;;;;;;AAOzB,SAAgB,oBAAoB,OAAyB;CAC3D,MAAM,MAAM,OAAO,SAAS,GAAG,CAAC,MAAM;AACtC,KAAI,CAAC,OAAO,KAAK,KAAK,IAAI,CAAE,QAAO;AACnC,KAAI,IAAI,WAAW,IAAI,IAAI,CAAC,IAAI,WAAW,KAAK,CAAE,QAAO;AACzD,KAAI,YAAY,KAAK,IAAI,CAAE,QAAO,IAAI,SAAS;AAC/C,KAAI,SAAS,KAAK,IAAI,CAAE,QAAO,IAAI,SAAS;AAE5C,KAAI,IAAI,WAAW,IAAI,CAAE,QAAO,iBAAiB,KAAK,IAAI;AAC1D,KAAI;EACF,MAAM,MAAM,IAAI,IAAI,IAAI;AACxB,UAAQ,IAAI,aAAa,WAAW,IAAI,aAAa,aAAa,QAAQ,IAAI,SAAS;SACjF;AACN,SAAO;;;AAIX,SAAgB,qBAAqB,OAAgB,WAAW,OAAsB;CACpF,MAAM,MAAM,OAAO,SAAS,GAAG,CAAC,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S,IAAI;AAE5B,SADY,UAAU,SAAS,SAAS,SAAS,OAAO,IAAI,GAAG,SACjD,EAAE;;;;;;;;;;AAWlB,eAAsB,cAAc,EAClC,SACA,QAAQ,OACR,GAAG,QACyC;CAC5C,MAAM,SAAS,WAAW,KAAK;CAC/B,MAAM,CAAC,WAAW,aAAa,MAAM,QAAQ,IAAI,CAC/C,QAAQ,WAAW;EAAE,MAAM;EAAiB;EAAO,OAAO;EAAG,GAAG;EAAQ,CAAC,EACzE,QAAQ,WAAW;EAAE,MAAM;EAAwB;EAAO,OAAO;EAAG,GAAG;EAAQ,CAAC,CACjF,CAAC;AACF,QAAO;EAAE,QAAQ,SAAS,UAAU;EAAE,QAAQ,SAAS,UAAU;EAAE,KAAK,MAAM,UAAU;EAAE"}
1
+ {"version":3,"file":"published-BF2F3od_.mjs","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"sourcesContent":["/**\n * Public Header and Footer as two Globals so each has its own Save /\n * Publish / drafts. Bar behaviour (`bar` on Header) stays in the schema\n * with `admin.hidden`; it is not a Settings tab. Featured looks stay on\n * chrome roles (BIS-85 / SPI-89), not a Header array. The items kit\n * editor is the workspace field (BIS-119 / BIS-121). Payload's left nav\n * stays until BIS-90. The Spinal bump is SPI-99.\n */\n\nimport type { Block, GlobalConfig } from \"payload\";\n\nimport type { LocaleRead } from \"../locale\";\n\nexport const NAVIGATION_SLUG = \"navigation\";\nexport const NAVIGATION_DB_NAME = \"nav\";\nexport const NAVIGATION_FOOTER_SLUG = \"navigation-footer\";\nexport const NAVIGATION_FOOTER_DB_NAME = \"navf\";\n\nexport const NAVIGATION_FEATURE = \"navigation\";\n\nexport interface CreateNavigationOptions {\n /**\n * Header bar blocks this site offers. The field stays a blocks array —\n * a later nav block is appended here, not a mega-menu-only shape.\n */\n blocks: Block[];\n /**\n * Preview URL for both documents. The site owns the path — this factory\n * does not invent a route.\n */\n preview?: NonNullable<NonNullable<GlobalConfig[\"admin\"]>[\"preview\"]>;\n livePreview?: NonNullable<NonNullable<GlobalConfig[\"admin\"]>[\"livePreview\"]>;\n /**\n * Component path for Payload's Preview button, as a key into the site's\n * committed `importMap.js`.\n */\n previewButton?: string;\n /** The collection a page link points into. Defaults to `pages`. */\n pagesCollection?: string;\n /** Locked footer copyright uses this name. The year stays the current year. */\n footerCopyrightName?: string;\n}\n\nexport interface NavigationHeader {\n items?: unknown;\n cta?: unknown;\n}\n\nexport interface NavigationBar {\n hideOnScroll?: boolean | null;\n viewport?: boolean | null;\n defaultMaxWidth?: (\"narrow\" | \"standard\" | \"wide\") | null;\n}\n\nexport interface NavigationFooter {\n columns?: unknown;\n brand?: unknown;\n}\n\nexport interface NavigationDoc {\n header: NavigationHeader;\n footer: NavigationFooter;\n bar: NavigationBar;\n}\n\nexport interface GetNavigationArgs extends LocaleRead {\n payload: {\n findGlobal: (args: {\n slug: string;\n draft?: boolean;\n overrideAccess?: boolean;\n depth?: number;\n }) => Promise<unknown>;\n };\n draft?: boolean;\n}\n","import type { Condition, Field, FieldHook, GroupField, RowField, TextFieldSingleValidation } from \"payload\";\n\n/**\n * Same import-map string as `@bison-lab/payload-blocks`. A site that\n * already generates the blocks admin map gets the picker; a missing\n * entry renders the row as nothing, so `payload generate:importmap` is\n * part of adopting this factory.\n */\nconst LINK_FIELD = \"@bison-lab/payload-blocks/admin#LinkField\";\n\ntype LinkType = \"page\" | \"external\";\n\ninterface LinkDestination {\n type?: LinkType | null;\n href?: string | null;\n}\n\nfunction linkTypeOf(link: LinkDestination | null | undefined): LinkType {\n if (link?.type === \"external\") return \"external\";\n if (link?.type === \"page\") return \"page\";\n return link?.href ? \"external\" : \"page\";\n}\n\nexport const EXTERNAL_HREF_MESSAGE =\n \"Enter a valid URL (https://…), a mailto: or tel: link, a site path starting with /, or a #anchor on the same page.\";\n\nconst SAME_PAGE_ANCHOR = /^#[A-Za-z][\\w:.-]*$/;\n\n/**\n * What the picker will store as an external destination: http(s) with a\n * host, mailto:/tel: with a value, an in-site path, or a same-page #anchor. Rejects a bare\n * host, protocol-relative URLs, and anything that is not a link.\n */\nexport function isValidExternalHref(value: unknown): boolean {\n const raw = String(value ?? \"\").trim();\n if (!raw || /\\s/.test(raw)) return false;\n if (raw.startsWith(\"/\") && !raw.startsWith(\"//\")) return true;\n if (/^mailto:/i.test(raw)) return raw.length > \"mailto:\".length;\n if (/^tel:/i.test(raw)) return raw.length > \"tel:\".length;\n // A same-page fragment: a site's link adapter can open a modal or scroll to it.\n if (raw.startsWith(\"#\")) return SAME_PAGE_ANCHOR.test(raw);\n try {\n const url = new URL(raw);\n return (url.protocol === \"http:\" || url.protocol === \"https:\") && Boolean(url.hostname);\n } catch {\n return false;\n }\n}\n\nexport function validateExternalHref(value: unknown, required = false): true | string {\n const raw = String(value ?? \"\").trim();\n if (!raw) return required ? \"This field is required.\" : true;\n return isValidExternalHref(raw) ? true : EXTERNAL_HREF_MESSAGE;\n}\n\nconst whenPage: Condition = (_data, siblingData) => linkTypeOf(siblingData as LinkDestination) === \"page\";\nconst whenExternal: Condition = (_data, siblingData) =>\n linkTypeOf(siblingData as LinkDestination) === \"external\";\n\nfunction hrefValidate(required: boolean): TextFieldSingleValidation {\n return (value, { siblingData }) => {\n if (linkTypeOf(siblingData as LinkDestination) !== \"external\") return true;\n return validateExternalHref(value, required);\n };\n}\n\nfunction isAutosave(req: unknown): boolean {\n const request = req as { method?: string; query?: Record<string, unknown> } | undefined;\n // A write only: any GET can add `?autosave=true`, and must not get a leftover back.\n if (!request || request.method === \"GET\") return false;\n const query = request.query;\n return query?.autosave === \"true\" || query?.autosave === true;\n}\n\nfunction savedTypeOf(siblingData: unknown, previous: unknown): LinkType {\n const row = (siblingData ?? {}) as Record<string, unknown>;\n if (row.type != null || !previous || typeof previous !== \"object\") return linkTypeOf(row as LinkDestination);\n const merged: Record<string, unknown> = { ...(previous as Record<string, unknown>) };\n for (const [key, value] of Object.entries(row)) if (value !== undefined) merged[key] = value;\n return linkTypeOf(merged as LinkDestination);\n}\n\n/**\n * Same as payload-blocks' `linkDestinationHooks` (#322): a destination the\n * row's `type` does not name is saved and read as null, except on an\n * autosave, whose reply the admin folds back into the open form.\n */\nfunction destinationHooks(destination: LinkType): { beforeChange: FieldHook[]; afterRead: FieldHook[] } {\n const beforeChange: FieldHook = ({ value, siblingData, previousSiblingDoc, req }) => {\n if (isAutosave(req)) return value;\n return savedTypeOf(siblingData, previousSiblingDoc) === destination ? value : null;\n };\n const afterRead: FieldHook = ({ value, siblingData, req }) => {\n if (isAutosave(req)) return value;\n return linkTypeOf(siblingData as LinkDestination) === destination ? value : null;\n };\n return { beforeChange: [beforeChange], afterRead: [afterRead] };\n}\n\nfunction linkDestinationFields({\n required = false,\n pagesCollection = \"pages\",\n}: {\n required?: boolean;\n pagesCollection?: string;\n} = {}): RowField[] {\n return [\n {\n type: \"row\",\n admin: { components: { Field: LINK_FIELD } },\n fields: [\n {\n name: \"type\",\n type: \"radio\",\n label: \"Link\",\n defaultValue: \"page\",\n options: [\n { label: \"Page\", value: \"page\" },\n { label: \"URL\", value: \"external\" },\n ],\n admin: { layout: \"horizontal\" },\n },\n {\n name: \"page\",\n type: \"relationship\",\n relationTo: pagesCollection,\n required,\n filterOptions: { _status: { equals: \"published\" } },\n hooks: destinationHooks(\"page\"),\n admin: { condition: whenPage },\n },\n {\n name: \"href\",\n type: \"text\",\n label: \"URL\",\n required,\n validate: hrefValidate(required),\n hooks: destinationHooks(\"external\"),\n admin: {\n condition: whenExternal,\n description:\n 'A full URL (\"https://example.com\"), \"mailto:\" or \"tel:\", a site path (\"/contact\"), or a same-page \"#anchor\".',\n },\n },\n ],\n },\n ];\n}\n\nfunction linkFields({\n required = false,\n pagesCollection,\n}: {\n required?: boolean;\n pagesCollection?: string;\n} = {}): Field[] {\n return [\n ...linkDestinationFields({ required, pagesCollection }),\n { name: \"label\", type: \"text\", localized: true, label: \"Label\", required },\n {\n name: \"newTab\",\n type: \"checkbox\",\n label: \"Open in a new tab\",\n defaultValue: false,\n admin: {\n // Drawn by LinkField next to the destination so Header, Footer, and\n // page blocks cannot drift apart.\n hidden: true,\n },\n },\n ];\n}\n\nexport interface HeaderCtaValue {\n enabled?: boolean | null;\n type?: LinkType | null;\n page?: unknown;\n href?: string | null;\n label?: string | null;\n}\n\n/** A stored button, or a legacy row that already has a label or destination. */\nexport function headerCtaEnabled(cta: HeaderCtaValue | null | undefined): boolean {\n if (!cta) return false;\n if (cta.enabled === false) return false;\n if (cta.enabled === true) return true;\n return Boolean(cta.label || cta.page || cta.href);\n}\n\n/**\n * When the Header button is on, label and destination are required.\n * Off (or a cleared row) can save empty.\n */\nexport function validateHeaderCta(value: unknown): true | string {\n const cta = (value && typeof value === \"object\" ? value : {}) as HeaderCtaValue;\n if (!headerCtaEnabled(cta)) return true;\n if (!String(cta.label ?? \"\").trim()) return \"The Header button needs a label.\";\n const dest = linkTypeOf(cta);\n if (dest === \"external\") {\n const href = validateExternalHref(cta.href, true);\n if (href !== true) {\n return href === \"This field is required.\"\n ? \"The Header button needs a published page or a URL.\"\n : href;\n }\n }\n if (dest === \"page\" && (cta.page == null || cta.page === \"\")) {\n return \"The Header button needs a published page or a URL.\";\n }\n return true;\n}\n\nexport function linkField({\n name = \"link\",\n label,\n admin,\n required,\n pagesCollection,\n toggle,\n}: {\n name?: string;\n label?: GroupField[\"label\"];\n admin?: GroupField[\"admin\"];\n required?: boolean;\n pagesCollection?: string;\n /** Header button: an enable checkbox; children are not required unless it is on. */\n toggle?: boolean;\n} = {}): GroupField {\n return {\n name,\n type: \"group\",\n fields: toggle\n ? [\n {\n name: \"enabled\",\n type: \"checkbox\",\n label: \"Show Header button\",\n defaultValue: false,\n },\n ...linkFields({ required: false, pagesCollection }),\n ]\n : linkFields({ required, pagesCollection }),\n ...(toggle ? { validate: validateHeaderCta as NonNullable<GroupField[\"validate\"]> } : {}),\n ...(label === undefined ? {} : { label }),\n ...(admin === undefined ? {} : { admin }),\n };\n}\n\nexport function footerLinkFields({\n required = false,\n pagesCollection,\n}: {\n required?: boolean;\n pagesCollection?: string;\n} = {}): Field[] {\n return linkFields({ required, pagesCollection });\n}\n","import type { ArrayField, ArrayFieldValidation, Field, GroupField, TextField } from \"payload\";\n\nimport { footerLinkFields, isValidExternalHref, validateExternalHref } from \"./link\";\n\n/**\n * Same presets as the header mega-menu. Desktop only. Tablet is a fixed\n * 2×2 on the public footer; mobile stacks.\n */\nexport const FOOTER_COLUMN_WIDTHS = [\"25\", \"33\", \"50\", \"66\", \"75\", \"100\"] as const;\nexport type FooterColumnWidth = (typeof FOOTER_COLUMN_WIDTHS)[number];\n\n/** Logo column plus link columns. */\nexport const FOOTER_MAX_COLUMNS = 4;\n/** Link columns. The logo column is always first and is not in this count. */\nexport const FOOTER_MAX_LINK_COLUMNS = FOOTER_MAX_COLUMNS - 1;\n\nexport const FOOTER_SOCIALS = [\"facebook\", \"instagram\", \"linkedin\", \"x\", \"youtube\"] as const;\nexport type FooterSocial = (typeof FOOTER_SOCIALS)[number];\n\nconst FOOTER_SOCIAL_LABELS: Record<FooterSocial, string> = {\n facebook: \"Facebook\",\n instagram: \"Instagram\",\n linkedin: \"LinkedIn\",\n x: \"X\",\n youtube: \"YouTube\",\n};\n\n/** Twelfths of a row. Link-column widths share this 12; the logo column does not. */\nexport const FOOTER_TWELFTHS: Record<FooterColumnWidth, number> = {\n \"25\": 3,\n \"33\": 4,\n \"50\": 6,\n \"66\": 8,\n \"75\": 9,\n \"100\": 12,\n};\n\nexport const FOOTER_COLUMNS_FIELD = \"@bison-lab/payload-blocks/admin#FooterColumnsField\";\n\ninterface FooterLinkRow {\n label?: string | null;\n type?: \"page\" | \"external\" | null;\n page?: unknown;\n href?: string | null;\n}\n\ninterface FooterSectionRow {\n heading?: string | null;\n links?: FooterLinkRow[] | null;\n}\n\ninterface FooterColumnRow {\n desktop?: FooterColumnWidth | null;\n sections?: FooterSectionRow[] | null;\n}\n\nfunction evenDesktop(count: number): FooterColumnWidth[] {\n return (\n {\n 1: [\"100\"],\n 2: [\"50\", \"50\"],\n 3: [\"33\", \"33\", \"33\"],\n 4: [\"25\", \"25\", \"25\", \"25\"],\n } as Record<number, FooterColumnWidth[]>\n )[count] ?? [];\n}\n\n/** Even split for the current link-column count. Used by the kit editor. */\nexport function normalizeFooterDesktop(count: number): FooterColumnWidth[] {\n return evenDesktop(count);\n}\n\n/**\n * Desktop tracks: the logo keeps its own percent; link columns share the\n * remaining `1fr` and are themselves percent of that leftover, not of the\n * full footer.\n */\nexport function footerDesktopTracks(\n brand: FooterColumnWidth | null | undefined,\n columns: Array<FooterColumnWidth | null | undefined>,\n): {\n brandPercent: string;\n brandTemplate: string;\n linksTemplate: string;\n} {\n const width = brand && brand in FOOTER_TWELFTHS ? brand : \"25\";\n const brandPercent = `${width}%`;\n const links = columns.map((column) => `${column && column in FOOTER_TWELFTHS ? column : \"25\"}%`);\n return {\n brandPercent,\n brandTemplate: `${brandPercent} minmax(0,1fr)`,\n linksTemplate: links.join(\" \") || \"1fr\",\n };\n}\n\nfunction linkHasDestination(link: FooterLinkRow): boolean {\n if (link.type === \"external\") return isValidExternalHref(link.href);\n if (link.type === \"page\") return link.page != null && link.page !== \"\";\n if (String(link.href ?? \"\").trim()) return isValidExternalHref(link.href);\n return link.page != null && link.page !== \"\";\n}\n\n/**\n * Link-column widths must add to 100% of the space beside the logo. The\n * logo width is independent. Each section needs a labeled destination\n * before publish. Draft saves skip field validation. A footer with only\n * the logo column is valid.\n */\nexport const validateFooterColumns: ArrayFieldValidation = (value) => {\n const columns = (Array.isArray(value) ? value : []) as FooterColumnRow[];\n if (columns.length > FOOTER_MAX_LINK_COLUMNS) {\n return \"No more than three link columns. The logo column is always first.\";\n }\n\n if (columns.length === 0) return true;\n\n const twelfths = columns.reduce((sum, row) => sum + FOOTER_TWELFTHS[row?.desktop ?? \"100\"], 0);\n if (twelfths !== 12) {\n const percent = Math.round((twelfths / 12) * 100);\n return `Desktop column widths add up to ${percent}%. They need to add up to 100% of the space beside the logo.`;\n }\n\n for (const [columnIndex, column] of columns.entries()) {\n const sections = column.sections ?? [];\n if (sections.length === 0) {\n return `Column ${columnIndex + 1} needs at least one section.`;\n }\n for (const [sectionIndex, section] of sections.entries()) {\n if (!String(section.heading ?? \"\").trim()) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1} needs a section label.`;\n }\n const links = section.links ?? [];\n if (links.length === 0) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1} needs at least one link.`;\n }\n for (const [linkIndex, link] of links.entries()) {\n if (!String(link.label ?? \"\").trim()) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1}, link ${linkIndex + 1} needs a label.`;\n }\n if (!linkHasDestination(link)) {\n const href = String(link.href ?? \"\").trim();\n if (href && validateExternalHref(href) !== true) {\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1}, link ${linkIndex + 1} needs a valid URL.`;\n }\n return `Column ${columnIndex + 1}, section ${sectionIndex + 1}, link ${linkIndex + 1} needs a destination.`;\n }\n }\n }\n }\n\n return true;\n};\n\nexport function validateFooterSocialUrl(value: unknown): true | string {\n const raw = String(value ?? \"\").trim();\n if (!raw) return true;\n try {\n const url = new URL(raw);\n if (url.protocol === \"http:\" || url.protocol === \"https:\") return true;\n } catch {\n // not a URL\n }\n return \"Must be a valid http(s) URL.\";\n}\n\nfunction socialFields(): TextField[] {\n return FOOTER_SOCIALS.map((name) => ({\n name,\n type: \"text\",\n label: FOOTER_SOCIAL_LABELS[name],\n validate: validateFooterSocialUrl,\n }));\n}\n\nexport function footerColumnsField({\n pagesCollection,\n}: {\n pagesCollection?: string;\n} = {}): ArrayField {\n return {\n name: \"columns\",\n type: \"array\",\n dbName: \"c\",\n labels: { singular: \"Column\", plural: \"Columns\" },\n maxRows: FOOTER_MAX_LINK_COLUMNS,\n validate: validateFooterColumns,\n admin: {\n description:\n \"Logo column plus up to three link columns. Link-column widths add up to 100% of the space beside the logo.\",\n },\n fields: [\n {\n name: \"desktop\",\n type: \"select\",\n label: \"Desktop width\",\n defaultValue: \"25\",\n required: true,\n options: FOOTER_COLUMN_WIDTHS.map((value) => ({ label: `${value}%`, value })),\n },\n {\n name: \"sections\",\n type: \"array\",\n dbName: \"s\",\n labels: { singular: \"Section\", plural: \"Sections\" },\n minRows: 1,\n fields: [\n {\n name: \"heading\",\n type: \"text\",\n localized: true,\n label: \"Section Label\",\n required: true,\n },\n {\n name: \"links\",\n type: \"array\",\n labels: { singular: \"Link\", plural: \"Links\" },\n minRows: 1,\n fields: footerLinkFields({ required: true, pagesCollection }),\n },\n ],\n },\n ],\n };\n}\n\nexport function footerBrandField(): GroupField {\n return {\n name: \"brand\",\n type: \"group\",\n label: \"Brand & social\",\n fields: [\n {\n name: \"desktop\",\n type: \"select\",\n label: \"Desktop width\",\n defaultValue: \"25\",\n required: true,\n options: FOOTER_COLUMN_WIDTHS.map((value) => ({ label: `${value}%`, value })),\n },\n {\n name: \"tagline\",\n type: \"textarea\",\n localized: true,\n label: \"Text below the logo\",\n },\n ...socialFields(),\n ],\n };\n}\n\nexport function footerFields(options: { pagesCollection?: string } = {}): Field[] {\n return [footerColumnsField(options), footerBrandField()];\n}\n","import { localeArgs } from \"../locale\";\nimport {\n NAVIGATION_FOOTER_SLUG,\n NAVIGATION_SLUG,\n type GetNavigationArgs,\n type NavigationBar,\n type NavigationDoc,\n type NavigationFooter,\n type NavigationHeader,\n} from \"./types\";\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n return value && typeof value === \"object\" ? (value as Record<string, unknown>) : null;\n}\n\nfunction headerOf(doc: unknown): NavigationHeader {\n const record = asRecord(doc);\n const header = record && \"header\" in record ? asRecord(record.header) : null;\n return header ?? {};\n}\n\nfunction footerOf(doc: unknown): NavigationFooter {\n const record = asRecord(doc);\n const footer = record && \"footer\" in record ? asRecord(record.footer) : null;\n return footer ?? {};\n}\n\nfunction barOf(doc: unknown): NavigationBar {\n const record = asRecord(doc);\n const bar = record && \"bar\" in record ? asRecord(record.bar) : null;\n return bar ?? {};\n}\n\n/**\n * Reads Header and Footer and returns one `{ header, footer, bar }`. A\n * site header does not learn two slugs. `bar` is the hidden Header group\n * (hide on scroll, viewport, default panel width). `draft: true`\n * reads the newest version; omit it (or pass false) for the published\n * documents. A multi-locale site passes the request's `locale` (and\n * `fallbackLocale`), so the labels and footer copy read in that locale.\n */\nexport async function getNavigation({\n payload,\n draft = false,\n ...read\n}: GetNavigationArgs): Promise<NavigationDoc> {\n const locale = localeArgs(read);\n const [headerDoc, footerDoc] = await Promise.all([\n payload.findGlobal({ slug: NAVIGATION_SLUG, draft, depth: 1, ...locale }),\n payload.findGlobal({ slug: NAVIGATION_FOOTER_SLUG, draft, depth: 1, ...locale }),\n ]);\n return { header: headerOf(headerDoc), footer: footerOf(footerDoc), bar: barOf(headerDoc) };\n}\n"],"mappings":";;AAaA,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;AAClC,MAAa,yBAAyB;AACtC,MAAa,4BAA4B;AAEzC,MAAa,qBAAqB;;;;;;;;;ACVlC,MAAM,aAAa;AASnB,SAAS,WAAW,MAAoD;AACtE,KAAI,MAAM,SAAS,WAAY,QAAO;AACtC,KAAI,MAAM,SAAS,OAAQ,QAAO;AAClC,QAAO,MAAM,OAAO,aAAa;;AAGnC,MAAa,wBACX;AAEF,MAAM,mBAAmB;;;;;;AAOzB,SAAgB,oBAAoB,OAAyB;CAC3D,MAAM,MAAM,OAAO,SAAS,GAAG,CAAC,MAAM;AACtC,KAAI,CAAC,OAAO,KAAK,KAAK,IAAI,CAAE,QAAO;AACnC,KAAI,IAAI,WAAW,IAAI,IAAI,CAAC,IAAI,WAAW,KAAK,CAAE,QAAO;AACzD,KAAI,YAAY,KAAK,IAAI,CAAE,QAAO,IAAI,SAAS;AAC/C,KAAI,SAAS,KAAK,IAAI,CAAE,QAAO,IAAI,SAAS;AAE5C,KAAI,IAAI,WAAW,IAAI,CAAE,QAAO,iBAAiB,KAAK,IAAI;AAC1D,KAAI;EACF,MAAM,MAAM,IAAI,IAAI,IAA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;AAGrB,SAAS,SAAS,KAAgC;CAChD,MAAM,SAAS,SAAS,IAAI;AAE5B,SADe,UAAU,YAAY,SAAS,SAAS,OAAO,OAAO,GAAG,SACvD,EAAE;;AAGrB,SAAS,MAAM,KAA6B;CAC1C,MAAM,SAAS,SAAS,IAAI;AAE5B,SADY,UAAU,SAAS,SAAS,SAAS,OAAO,IAAI,GAAG,SACjD,EAAE;;;;;;;;;;AAWlB,eAAsB,cAAc,EAClC,SACA,QAAQ,OACR,GAAG,QACyC;CAC5C,MAAM,SAAS,WAAW,KAAK;CAC/B,MAAM,CAAC,WAAW,aAAa,MAAM,QAAQ,IAAI,CAC/C,QAAQ,WAAW;EAAE,MAAM;EAAiB;EAAO,OAAO;EAAG,GAAG;EAAQ,CAAC,EACzE,QAAQ,WAAW;EAAE,MAAM;EAAwB;EAAO,OAAO;EAAG,GAAG;EAAQ,CAAC,CACjF,CAAC;AACF,QAAO;EAAE,QAAQ,SAAS,UAAU;EAAE,QAAQ,SAAS,UAAU;EAAE,KAAK,MAAM,UAAU;EAAE"}
@@ -459,4 +459,4 @@ async function getSectionControls(payload, extras = blockLibraryEntriesFromConfi
459
459
  //#endregion
460
460
  export { sectionControlsOf as _, sectionControlsFromLibrary as a, BLOCK_LIBRARY_CATEGORIES as c, DEFAULT_SECTION_CONTROLS as d, HERO_SECTION_CONTROLS as f, defaultSectionControls as g, SECTION_CONTROL_LABELS as h, defaultBlockLibraryValue as i, BLOCK_LIBRARY_SLUG as l, SECTION_CONTROL_KEYS as m, getSectionControls as n, stampBlockLibrary as o, NO_SECTION_CONTROLS as p, blockLibraryCatalogue as r, validateBlockLibrary as s, blockLibraryEntriesFromConfig as t, PACKAGE_BLOCK_SLUGS as u };
461
461
 
462
- //# sourceMappingURL=published-hqtvmVUD.mjs.map
462
+ //# sourceMappingURL=published-BzihgcSf.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-hqtvmVUD.mjs","names":["PACKAGE_SLUGS"],"sources":["../src/block-library/controls.ts","../src/block-library/types.ts","../src/block-library/catalogue.ts","../src/block-library/published.ts"],"sourcesContent":["import type { BlockLibraryEntry, BlockLibraryKind } from \"./types\";\n\n/**\n * Which of the four section settings a block offers its editors. The\n * settings group on every page block keeps all four fields, so the page\n * schema never moves; a tick off hides the control in the editor and the\n * renderer ignores its stored value (payload-blocks, BIS-138). The choice\n * lives on the Block library row, seeded from the catalogue, so turning\n * one control off for one block is a Save, not a release (BIS-136).\n */\nexport const SECTION_CONTROL_KEYS = [\"background\", \"spacing\", \"anchor\", \"hidden\"] as const;\n\nexport type SectionControlKey = (typeof SECTION_CONTROL_KEYS)[number];\n\nexport type SectionControls = Record<SectionControlKey, boolean>;\n\n/** The words the settings fold uses, so the ticks read as the controls they hide. */\nexport const SECTION_CONTROL_LABELS: Record<SectionControlKey, string> = {\n background: \"Background\",\n spacing: \"Spacing\",\n anchor: \"Anchor\",\n hidden: \"Hidden\",\n};\n\n/** A section: every control. Also what a slug no catalogue knows gets. */\nexport const DEFAULT_SECTION_CONTROLS: SectionControls = {\n background: true,\n spacing: true,\n anchor: true,\n hidden: true,\n};\n\n/**\n * A hero: Anchor only. Background would compete with the hero's own tone,\n * Spacing is header clearance the editor should not change, and a hidden\n * hero is a published page with no opening.\n */\nexport const HERO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: true,\n hidden: false,\n};\n\n/** A navbar is not a section; the ticks do not render on its card. */\nexport const NO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: false,\n hidden: false,\n};\n\nexport function defaultSectionControls(kind: BlockLibraryKind): SectionControls {\n if (kind === \"hero\") return { ...HERO_SECTION_CONTROLS };\n if (kind === \"navbar\") return { ...NO_SECTION_CONTROLS };\n return { ...DEFAULT_SECTION_CONTROLS };\n}\n\n/** The entry's kind, from `kind` or else its category. */\nexport function kindOf(entry: Pick<BlockLibraryEntry, \"kind\" | \"category\">): BlockLibraryKind {\n return entry.kind ?? (entry.category === \"hero\" ? \"hero\" : entry.category === \"navigation\" ? \"navbar\" : \"section\");\n}\n\n/**\n * Reads four booleans off a stored or partial value, taking `fallback` for\n * any key that is absent or not a boolean. A row saved before the columns\n * existed, or an entry that names only one key, resolves this way.\n */\nexport function sectionControlsOf(value: unknown, fallback: SectionControls): SectionControls {\n const source = value && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n const out = { ...fallback };\n for (const key of SECTION_CONTROL_KEYS) {\n if (typeof source[key] === \"boolean\") out[key] = source[key] as boolean;\n }\n return out;\n}\n\n/** The catalogue default for one entry: its own `sectionControls` over the kind's. */\nexport function entrySectionControls(entry: BlockLibraryEntry): SectionControls {\n return sectionControlsOf(entry.sectionControls, defaultSectionControls(kindOf(entry)));\n}\n","import type { SectionControls } from \"./controls\";\n\nexport const BLOCK_LIBRARY_SLUG = \"block-library\";\n\nexport const BLOCK_LIBRARY_CATEGORIES = [\n { id: \"hero\", label: \"Hero\" },\n { id: \"feature\", label: \"Feature\" },\n { id: \"process\", label: \"Process\" },\n { id: \"faq\", label: \"FAQ\" },\n { id: \"testimonials\", label: \"Testimonials\" },\n { id: \"stats\", label: \"Stats\" },\n { id: \"content\", label: \"Content\" },\n { id: \"contact\", label: \"Contact\" },\n { id: \"cta\", label: \"CTA\" },\n { id: \"navigation\", label: \"Navigation\" },\n] as const;\n\nexport type BlockLibraryCategoryId = (typeof BLOCK_LIBRARY_CATEGORIES)[number][\"id\"];\n\nexport type BlockLibraryKind = \"hero\" | \"section\" | \"navbar\";\n\n/**\n * Package catalogue. `megaMenu` and `navLink` are header item blocks, not\n * cards. Navigation's card is `floatingNav`. The preview route is SPI-53.\n */\nexport const PACKAGE_BLOCK_SLUGS = [\n \"hero\",\n \"heroSweep\",\n \"heroCompact\",\n \"heroSimple\",\n \"showcasePanels\",\n \"featureHighlights\",\n \"featureChecklist\",\n \"processSteps\",\n \"faqColumns\",\n \"testimonialMasonry\",\n \"testimonialCarousel\",\n \"statsBand\",\n \"richText\",\n \"video\",\n \"nap\",\n \"inquiryForm\",\n \"ctaBand\",\n \"logoCloud\",\n \"gallery\",\n \"floatingNav\",\n] as const;\n\nexport type PackageBlockSlug = (typeof PACKAGE_BLOCK_SLUGS)[number];\n\nexport interface BlockLibraryEntry {\n slug: string;\n label: string;\n category: string;\n /** Defaults from the category: hero, navbar for navigation, otherwise section. */\n kind?: BlockLibraryKind;\n supportsMega?: boolean;\n sample?: unknown;\n /**\n * Which section settings the block offers, as the catalogue default its\n * row is seeded with. A key left out follows `kind`: a hero offers\n * Anchor only, a section all four, a navbar none. The row is what an\n * Admin then edits; this is only where it starts.\n */\n sectionControls?: Partial<SectionControls>;\n /**\n * The block's picture in Payload's Add Block drawer: a URL the site serves,\n * such as a screenshot `bison-block-thumbnails --out-dir public/…` wrote.\n * `blockDrawer()` sets it as the block's `admin.images.thumbnail` unless\n * the block config already has one. Package blocks ship theirs; a site\n * extra passes its own.\n */\n thumbnail?: string;\n}\n\nexport interface BlockLibraryRow {\n id: string;\n slug: string;\n label: string;\n category: string;\n enabled: boolean;\n kind: BlockLibraryKind;\n /** Four checkboxes beside Enabled. Hidden stays off on a hero row. */\n sectionControls: SectionControls;\n}\n\n/** The Block library Global as `findGlobal` returns it; rows are read loosely. */\nexport interface BlockLibraryDoc {\n blocks?: unknown;\n}\n\nexport interface BlockLibraryHolder {\n title?: string | null;\n slug?: string | null;\n}\n\n/** A draft that still holds a slug: a collection document or a Global. */\nexport interface BlockLibraryDraftHolder extends BlockLibraryHolder {\n collection?: string;\n id?: string | number;\n global?: string;\n}\n\n/** Where a slug is used. `published` refuses a disable; `drafts` are stripped. */\nexport interface BlockLibraryUsage {\n published: BlockLibraryHolder[];\n drafts: BlockLibraryDraftHolder[];\n}\n","import {\n DEFAULT_SECTION_CONTROLS,\n defaultSectionControls,\n entrySectionControls,\n HERO_SECTION_CONTROLS,\n kindOf,\n NO_SECTION_CONTROLS,\n sectionControlsOf,\n type SectionControls,\n} from \"./controls\";\nimport type {\n BlockLibraryDoc,\n BlockLibraryEntry,\n BlockLibraryHolder,\n BlockLibraryKind,\n BlockLibraryRow,\n} from \"./types\";\nimport { PACKAGE_BLOCK_SLUGS } from \"./types\";\n\nconst NOT_CATALOGUE = new Set([\"megaMenu\", \"navLink\"]);\n\n/**\n * Section controls are written out per entry so the defaults are read here,\n * not inferred: heroes Anchor only, sections all four, the navbar none.\n */\nconst PACKAGE_BLOCKS: readonly BlockLibraryEntry[] = [\n { slug: \"hero\", label: \"Hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSweep\", label: \"Sweep hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroCompact\", label: \"Compact hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSimple\", label: \"Simple hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"showcasePanels\", label: \"Showcase panels\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureHighlights\", label: \"Feature highlights\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureChecklist\", label: \"Feature checklist\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"processSteps\", label: \"Process steps\", category: \"process\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"faqColumns\", label: \"FAQ\", category: \"faq\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialMasonry\", label: \"Testimonials\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialCarousel\", label: \"Testimonial carousel\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"statsBand\", label: \"Stats\", category: \"stats\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"richText\", label: \"Rich text\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"video\", label: \"Video\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"nap\", label: \"Contact\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"inquiryForm\", label: \"Inquiry form\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"ctaBand\", label: \"CTA band\", category: \"cta\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"logoCloud\", label: \"Logo cloud\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"gallery\", label: \"Gallery\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"floatingNav\", label: \"Floating navbar\", category: \"navigation\", kind: \"navbar\", supportsMega: true, sectionControls: NO_SECTION_CONTROLS },\n];\n\nexport interface BlockLibraryOptions {\n blocks?: readonly BlockLibraryEntry[];\n previewPath: (slug: string) => string;\n}\n\nexport interface BlockLibraryCheck {\n originals?: readonly BlockLibraryRow[];\n /** Published documents that hold a slug being turned off. Any refuses. */\n holders?: readonly BlockLibraryHolder[];\n /** Drafts that hold it. Named in a refusal; never a reason to refuse. */\n drafts?: readonly BlockLibraryHolder[];\n pages?: unknown[];\n}\n\nconst PACKAGE_SLUGS = new Set(PACKAGE_BLOCKS.map((entry) => entry.slug));\n\n/**\n * The package entries, then the site's extras. An extra whose slug the\n * package ships replaces that package entry in its place: a site that\n * registered its own block before the package shipped one under the same\n * slug still renders its own config, so its label, category, controls,\n * picture and sample are the true ones. A release that adds such a block\n * therefore never yields two rows for one slug, and never relabels the\n * site's block as the package's.\n */\nexport function blockLibraryCatalogue(extras: readonly BlockLibraryEntry[] = []): BlockLibraryEntry[] {\n const own = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug));\n const shadows = new Map(own.filter((entry) => PACKAGE_SLUGS.has(entry.slug)).map((entry) => [entry.slug, entry]));\n return [\n ...PACKAGE_BLOCKS.map((entry) => shadows.get(entry.slug) ?? { ...entry, sectionControls: { ...entry.sectionControls } }),\n ...own.filter((entry) => !PACKAGE_SLUGS.has(entry.slug)),\n ];\n}\n\nexport function defaultBlockLibraryValue(options: BlockLibraryOptions): BlockLibraryRow[] {\n return blockLibraryCatalogue(options.blocks).map((entry) => toRow(entry, true));\n}\n\nfunction toRow(entry: BlockLibraryEntry, enabled = true, sectionControls?: SectionControls): BlockLibraryRow {\n return {\n id: entry.slug,\n slug: entry.slug,\n label: entry.label,\n category: entry.category,\n enabled,\n kind: kindOf(entry),\n sectionControls: sectionControls ?? entrySectionControls(entry),\n };\n}\n\n/**\n * The stored rows, one per catalogue entry in catalogue order. A stored\n * `enabled` and each stored tick are kept; anything else (a row that is\n * not there, a column that did not exist when it was saved) takes the\n * entry's default. A block that arrives in a later release gets its\n * catalogue default this way, without a migration beyond the new columns.\n */\nexport function stampBlockLibrary(value: unknown, options: BlockLibraryOptions): BlockLibraryRow[] {\n const catalogue = blockLibraryCatalogue(options.blocks);\n const incoming = new Map<string, { enabled?: boolean; sectionControls?: unknown }>();\n if (Array.isArray(value)) {\n for (const item of value) {\n if (!item || typeof item !== \"object\" || !(\"slug\" in item)) continue;\n const slug = item.slug;\n if (typeof slug !== \"string\" || NOT_CATALOGUE.has(slug)) continue;\n if (!catalogue.some((entry) => entry.slug === slug)) continue;\n const row = item as { enabled?: unknown; sectionControls?: unknown };\n incoming.set(slug, {\n enabled: typeof row.enabled === \"boolean\" ? row.enabled : undefined,\n sectionControls: row.sectionControls,\n });\n }\n }\n return catalogue.map((entry) => {\n const stored = incoming.get(entry.slug);\n return toRow(\n entry,\n stored?.enabled ?? true,\n sectionControlsOf(stored?.sectionControls, entrySectionControls(entry)),\n );\n });\n}\n\nfunction isKind(value: unknown): value is BlockLibraryKind {\n return value === \"hero\" || value === \"section\" || value === \"navbar\";\n}\n\n/**\n * Every slug to the controls its row offers: the stored ticks when the\n * document holds the row, else the catalogue default. A stored row is kept\n * whether or not its slug is in the catalogue, so a site extra's saved\n * ticks are read without the site passing its `blocks` here (its stored\n * `kind` fills a key the row lacks). `extras` adds the catalogue default\n * for a site extra the document does not hold yet; `getSectionControls`\n * reads them off the Global's config. A slug in neither is absent from the\n * map, and a consumer treats that as every control\n * (`DEFAULT_SECTION_CONTROLS`). A disabled block keeps its ticks.\n */\nexport function sectionControlsFromLibrary(\n doc: BlockLibraryDoc | null | undefined,\n extras: readonly BlockLibraryEntry[] = [],\n): Record<string, SectionControls> {\n const rows = stampBlockLibrary(doc?.blocks, { blocks: extras, previewPath: () => \"\" });\n const map = Object.fromEntries(rows.map((row) => [row.slug, row.sectionControls]));\n const stored = Array.isArray(doc?.blocks) ? doc.blocks : [];\n for (const item of stored) {\n if (!item || typeof item !== \"object\") continue;\n const row = item as { slug?: unknown; kind?: unknown; sectionControls?: unknown };\n if (typeof row.slug !== \"string\" || !row.slug || NOT_CATALOGUE.has(row.slug) || row.slug in map) continue;\n map[row.slug] = sectionControlsOf(\n row.sectionControls,\n defaultSectionControls(isKind(row.kind) ? row.kind : \"section\"),\n );\n }\n return map;\n}\n\nfunction enabledOf(rows: readonly BlockLibraryRow[], kind: BlockLibraryKind): number {\n return rows.filter((row) => row.kind === kind && row.enabled).length;\n}\n\nfunction holderLabel(holder: BlockLibraryHolder): string {\n const title = holder.title?.trim() || \"Untitled\";\n const slug = holder.slug?.trim();\n return slug ? `${title} (${slug})` : title;\n}\n\n/**\n * Refuses Hidden on a hero row (a page cannot publish without its hero),\n * then a disable: the last hero, the last navbar, or a slug a published\n * document holds. Drafts alone never refuse; the Save that turns the slug\n * off strips them (`stripDrafts`). Pure — writes nothing.\n */\nexport async function validateBlockLibrary(\n value: unknown,\n options: BlockLibraryOptions,\n check: BlockLibraryCheck = {},\n): Promise<true | string> {\n const next = stampBlockLibrary(value, options);\n const hiddenHero = next.find((row) => row.kind === \"hero\" && row.sectionControls.hidden);\n if (hiddenHero) {\n return `${hiddenHero.label} cannot offer Hidden: a page cannot publish without its hero.`;\n }\n\n const previous = check.originals ?? defaultBlockLibraryValue(options);\n const turningOff = next.filter((row) => {\n const before = previous.find((entry) => entry.slug === row.slug);\n return before?.enabled !== false && row.enabled === false;\n });\n if (turningOff.length === 0) return true;\n\n if (turningOff.some((row) => row.kind === \"hero\") && enabledOf(next, \"hero\") === 0) {\n return \"Cannot disable the last hero.\";\n }\n if (turningOff.some((row) => row.kind === \"navbar\") && enabledOf(next, \"navbar\") === 0) {\n return \"Cannot disable the last navbar.\";\n }\n\n const holders = check.holders ?? [];\n if (holders.length > 0) {\n const names = holders.map(holderLabel).join(\", \");\n const slugs = turningOff.map((row) => row.label).join(\", \");\n const drafts = check.drafts ?? [];\n const draftNote =\n drafts.length > 0 ? ` Drafts also use it and were left as they are: ${drafts.map(holderLabel).join(\", \")}.` : \"\";\n return `Cannot disable ${slugs}. Still published on: ${names}. Remove it from those first.${draftNote}`;\n }\n\n return true;\n}\n\nexport function packageBlockSlugs(): readonly string[] {\n return PACKAGE_BLOCK_SLUGS;\n}\n","import type { Payload } from \"payload\";\n\nimport { sectionControlsFromLibrary } from \"./catalogue\";\nimport type { SectionControls } from \"./controls\";\nimport { BLOCK_LIBRARY_SLUG, PACKAGE_BLOCK_SLUGS, type BlockLibraryDoc, type BlockLibraryEntry } from \"./types\";\n\n/** The slice of `Payload` these readers need, so a test can pass a stub. */\nexport interface BlockLibraryReader {\n findGlobal: (args: { slug: string; depth: number; overrideAccess: boolean }) => Promise<unknown>;\n config?: { globals?: unknown };\n}\n\nconst PACKAGE_SLUGS = new Set<string>(PACKAGE_BLOCK_SLUGS);\n\n/**\n * A site's own Block library entries, read back off the registered Global:\n * `createBlockLibrary` keeps the rows it seeded (package and extras) on the\n * `blocks` field's `admin.custom.rows`, so a site block's catalogue default\n * is known here without the site passing `blocks` a second time. Package\n * slugs are left out (the catalogue already has them) unless the site\n * registered its own entry under one, which `siteSlugs` records.\n */\nexport function blockLibraryEntriesFromConfig(payload: Pick<BlockLibraryReader, \"config\">): BlockLibraryEntry[] {\n const globals = Array.isArray(payload.config?.globals) ? payload.config.globals : [];\n const library = globals.find(\n (global): global is { slug: string; fields?: unknown[] } =>\n typeof global === \"object\" && global !== null && (global as { slug?: unknown }).slug === BLOCK_LIBRARY_SLUG,\n );\n const blocks = (library?.fields ?? []).find(\n (field): field is { admin?: { custom?: { rows?: unknown; siteSlugs?: unknown } } } =>\n typeof field === \"object\" && field !== null && (field as { name?: unknown }).name === \"blocks\",\n );\n const rows = blocks?.admin?.custom?.rows;\n if (!Array.isArray(rows)) return [];\n const siteSlugs = blocks?.admin?.custom?.siteSlugs;\n const own = new Set(Array.isArray(siteSlugs) ? siteSlugs.filter((slug) => typeof slug === \"string\") : []);\n return rows.flatMap((row): BlockLibraryEntry[] => {\n if (!row || typeof row !== \"object\") return [];\n const { slug, label, category, kind, sectionControls } = row as Record<string, unknown>;\n if (typeof slug !== \"string\" || !slug || (PACKAGE_SLUGS.has(slug) && !own.has(slug))) return [];\n return [\n {\n slug,\n label: typeof label === \"string\" ? label : slug,\n category: typeof category === \"string\" ? category : \"content\",\n ...(kind === \"hero\" || kind === \"section\" || kind === \"navbar\" ? { kind } : {}),\n ...(sectionControls && typeof sectionControls === \"object\"\n ? { sectionControls: sectionControls as BlockLibraryEntry[\"sectionControls\"] }\n : {}),\n },\n ];\n });\n}\n\n/**\n * The Block library's section controls at request time, for a page route\n * to hand `RenderBlocks` as `sectionControls`. Access is overridden: the\n * Global is read by editors, and the page is read by everyone. A site\n * extra's stored ticks are kept, and one the document does not hold yet\n * takes its catalogue default from the Global's config; pass `extras` only\n * to add entries the config does not know.\n */\nexport async function getSectionControls(\n payload: BlockLibraryReader | Payload,\n extras: readonly BlockLibraryEntry[] = blockLibraryEntriesFromConfig(payload as BlockLibraryReader),\n): Promise<Record<string, SectionControls>> {\n const doc = (await payload.findGlobal({ slug: BLOCK_L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EAC9C,MAAM,EAAE,MAAM,OAAO,UAAU,MAAM,oBAAoB;AACzD,MAAI,OAAO,SAAS,YAAY,CAAC,QAAS,cAAc,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,CAAG,QAAO,EAAE;AAC/F,SAAO,CACL;GACE;GACA,OAAO,OAAO,UAAU,WAAW,QAAQ;GAC3C,UAAU,OAAO,aAAa,WAAW,WAAW;GACpD,GAAI,SAAS,UAAU,SAAS,aAAa,SAAS,WAAW,EAAE,MAAM,GAAG,EAAE;GAC9E,GAAI,mBAAmB,OAAO,oBAAoB,WAC9C,EAAmB,iBAAyD,GAC5E,EAAE;GACP,CACF;GACD;;;;;;;;;;AAWJ,eAAsB,mBACpB,SACA,SAAuC,8BAA8B,QAA8B,EACzD;AAK1C,QAAO,2BAJM,MAAM,QAAQ,WAAW;EAAE,MAAM;EAAoB,OAAO;EAAG,gBAAgB;EAAM,CAAC,EAI5D,OAAO"}
1
+ {"version":3,"file":"published-BzihgcSf.mjs","names":["PACKAGE_SLUGS"],"sources":["../src/block-library/controls.ts","../src/block-library/types.ts","../src/block-library/catalogue.ts","../src/block-library/published.ts"],"sourcesContent":["import type { BlockLibraryEntry, BlockLibraryKind } from \"./types\";\n\n/**\n * Which of the four section settings a block offers its editors. The\n * settings group on every page block keeps all four fields, so the page\n * schema never moves; a tick off hides the control in the editor and the\n * renderer ignores its stored value (payload-blocks, BIS-138). The choice\n * lives on the Block library row, seeded from the catalogue, so turning\n * one control off for one block is a Save, not a release (BIS-136).\n */\nexport const SECTION_CONTROL_KEYS = [\"background\", \"spacing\", \"anchor\", \"hidden\"] as const;\n\nexport type SectionControlKey = (typeof SECTION_CONTROL_KEYS)[number];\n\nexport type SectionControls = Record<SectionControlKey, boolean>;\n\n/** The words the settings fold uses, so the ticks read as the controls they hide. */\nexport const SECTION_CONTROL_LABELS: Record<SectionControlKey, string> = {\n background: \"Background\",\n spacing: \"Spacing\",\n anchor: \"Anchor\",\n hidden: \"Hidden\",\n};\n\n/** A section: every control. Also what a slug no catalogue knows gets. */\nexport const DEFAULT_SECTION_CONTROLS: SectionControls = {\n background: true,\n spacing: true,\n anchor: true,\n hidden: true,\n};\n\n/**\n * A hero: Anchor only. Background would compete with the hero's own tone,\n * Spacing is header clearance the editor should not change, and a hidden\n * hero is a published page with no opening.\n */\nexport const HERO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: true,\n hidden: false,\n};\n\n/** A navbar is not a section; the ticks do not render on its card. */\nexport const NO_SECTION_CONTROLS: SectionControls = {\n background: false,\n spacing: false,\n anchor: false,\n hidden: false,\n};\n\nexport function defaultSectionControls(kind: BlockLibraryKind): SectionControls {\n if (kind === \"hero\") return { ...HERO_SECTION_CONTROLS };\n if (kind === \"navbar\") return { ...NO_SECTION_CONTROLS };\n return { ...DEFAULT_SECTION_CONTROLS };\n}\n\n/** The entry's kind, from `kind` or else its category. */\nexport function kindOf(entry: Pick<BlockLibraryEntry, \"kind\" | \"category\">): BlockLibraryKind {\n return entry.kind ?? (entry.category === \"hero\" ? \"hero\" : entry.category === \"navigation\" ? \"navbar\" : \"section\");\n}\n\n/**\n * Reads four booleans off a stored or partial value, taking `fallback` for\n * any key that is absent or not a boolean. A row saved before the columns\n * existed, or an entry that names only one key, resolves this way.\n */\nexport function sectionControlsOf(value: unknown, fallback: SectionControls): SectionControls {\n const source = value && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n const out = { ...fallback };\n for (const key of SECTION_CONTROL_KEYS) {\n if (typeof source[key] === \"boolean\") out[key] = source[key] as boolean;\n }\n return out;\n}\n\n/** The catalogue default for one entry: its own `sectionControls` over the kind's. */\nexport function entrySectionControls(entry: BlockLibraryEntry): SectionControls {\n return sectionControlsOf(entry.sectionControls, defaultSectionControls(kindOf(entry)));\n}\n","import type { SectionControls } from \"./controls\";\n\nexport const BLOCK_LIBRARY_SLUG = \"block-library\";\n\nexport const BLOCK_LIBRARY_CATEGORIES = [\n { id: \"hero\", label: \"Hero\" },\n { id: \"feature\", label: \"Feature\" },\n { id: \"process\", label: \"Process\" },\n { id: \"faq\", label: \"FAQ\" },\n { id: \"testimonials\", label: \"Testimonials\" },\n { id: \"stats\", label: \"Stats\" },\n { id: \"content\", label: \"Content\" },\n { id: \"contact\", label: \"Contact\" },\n { id: \"cta\", label: \"CTA\" },\n { id: \"navigation\", label: \"Navigation\" },\n] as const;\n\nexport type BlockLibraryCategoryId = (typeof BLOCK_LIBRARY_CATEGORIES)[number][\"id\"];\n\nexport type BlockLibraryKind = \"hero\" | \"section\" | \"navbar\";\n\n/**\n * Package catalogue. `megaMenu` and `navLink` are header item blocks, not\n * cards. Navigation's card is `floatingNav`. The preview route is SPI-53.\n */\nexport const PACKAGE_BLOCK_SLUGS = [\n \"hero\",\n \"heroSweep\",\n \"heroCompact\",\n \"heroSimple\",\n \"showcasePanels\",\n \"featureHighlights\",\n \"featureChecklist\",\n \"processSteps\",\n \"faqColumns\",\n \"testimonialMasonry\",\n \"testimonialCarousel\",\n \"statsBand\",\n \"richText\",\n \"video\",\n \"nap\",\n \"inquiryForm\",\n \"ctaBand\",\n \"logoCloud\",\n \"gallery\",\n \"floatingNav\",\n] as const;\n\nexport type PackageBlockSlug = (typeof PACKAGE_BLOCK_SLUGS)[number];\n\nexport interface BlockLibraryEntry {\n slug: string;\n label: string;\n category: string;\n /** Defaults from the category: hero, navbar for navigation, otherwise section. */\n kind?: BlockLibraryKind;\n supportsMega?: boolean;\n sample?: unknown;\n /**\n * Which section settings the block offers, as the catalogue default its\n * row is seeded with. A key left out follows `kind`: a hero offers\n * Anchor only, a section all four, a navbar none. The row is what an\n * Admin then edits; this is only where it starts.\n */\n sectionControls?: Partial<SectionControls>;\n /**\n * The block's picture in Payload's Add Block drawer: a URL the site serves,\n * such as a screenshot `bison-block-thumbnails --out-dir public/…` wrote.\n * `blockDrawer()` sets it as the block's `admin.images.thumbnail` unless\n * the block config already has one. Package blocks ship theirs; a site\n * extra passes its own.\n */\n thumbnail?: string;\n}\n\nexport interface BlockLibraryRow {\n id: string;\n slug: string;\n label: string;\n category: string;\n enabled: boolean;\n kind: BlockLibraryKind;\n /** Four checkboxes beside Enabled. Hidden stays off on a hero row. */\n sectionControls: SectionControls;\n}\n\n/** The Block library Global as `findGlobal` returns it; rows are read loosely. */\nexport interface BlockLibraryDoc {\n blocks?: unknown;\n}\n\nexport interface BlockLibraryHolder {\n title?: string | null;\n slug?: string | null;\n}\n\n/** A draft that still holds a slug: a collection document or a Global. */\nexport interface BlockLibraryDraftHolder extends BlockLibraryHolder {\n collection?: string;\n id?: string | number;\n global?: string;\n}\n\n/** Where a slug is used. `published` refuses a disable; `drafts` are stripped. */\nexport interface BlockLibraryUsage {\n published: BlockLibraryHolder[];\n drafts: BlockLibraryDraftHolder[];\n}\n","import {\n DEFAULT_SECTION_CONTROLS,\n defaultSectionControls,\n entrySectionControls,\n HERO_SECTION_CONTROLS,\n kindOf,\n NO_SECTION_CONTROLS,\n sectionControlsOf,\n type SectionControls,\n} from \"./controls\";\nimport type {\n BlockLibraryDoc,\n BlockLibraryEntry,\n BlockLibraryHolder,\n BlockLibraryKind,\n BlockLibraryRow,\n} from \"./types\";\nimport { PACKAGE_BLOCK_SLUGS } from \"./types\";\n\nconst NOT_CATALOGUE = new Set([\"megaMenu\", \"navLink\"]);\n\n/**\n * Section controls are written out per entry so the defaults are read here,\n * not inferred: heroes Anchor only, sections all four, the navbar none.\n */\nconst PACKAGE_BLOCKS: readonly BlockLibraryEntry[] = [\n { slug: \"hero\", label: \"Hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSweep\", label: \"Sweep hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroCompact\", label: \"Compact hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"heroSimple\", label: \"Simple hero\", category: \"hero\", kind: \"hero\", sectionControls: HERO_SECTION_CONTROLS },\n { slug: \"showcasePanels\", label: \"Showcase panels\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureHighlights\", label: \"Feature highlights\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"featureChecklist\", label: \"Feature checklist\", category: \"feature\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"processSteps\", label: \"Process steps\", category: \"process\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"faqColumns\", label: \"FAQ\", category: \"faq\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialMasonry\", label: \"Testimonials\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"testimonialCarousel\", label: \"Testimonial carousel\", category: \"testimonials\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"statsBand\", label: \"Stats\", category: \"stats\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"richText\", label: \"Rich text\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"video\", label: \"Video\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"nap\", label: \"Contact\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"inquiryForm\", label: \"Inquiry form\", category: \"contact\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"ctaBand\", label: \"CTA band\", category: \"cta\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"logoCloud\", label: \"Logo cloud\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"gallery\", label: \"Gallery\", category: \"content\", kind: \"section\", sectionControls: DEFAULT_SECTION_CONTROLS },\n { slug: \"floatingNav\", label: \"Floating navbar\", category: \"navigation\", kind: \"navbar\", supportsMega: true, sectionControls: NO_SECTION_CONTROLS },\n];\n\nexport interface BlockLibraryOptions {\n blocks?: readonly BlockLibraryEntry[];\n previewPath: (slug: string) => string;\n}\n\nexport interface BlockLibraryCheck {\n originals?: readonly BlockLibraryRow[];\n /** Published documents that hold a slug being turned off. Any refuses. */\n holders?: readonly BlockLibraryHolder[];\n /** Drafts that hold it. Named in a refusal; never a reason to refuse. */\n drafts?: readonly BlockLibraryHolder[];\n pages?: unknown[];\n}\n\nconst PACKAGE_SLUGS = new Set(PACKAGE_BLOCKS.map((entry) => entry.slug));\n\n/**\n * The package entries, then the site's extras. An extra whose slug the\n * package ships replaces that package entry in its place: a site that\n * registered its own block before the package shipped one under the same\n * slug still renders its own config, so its label, category, controls,\n * picture and sample are the true ones. A release that adds such a block\n * therefore never yields two rows for one slug, and never relabels the\n * site's block as the package's.\n */\nexport function blockLibraryCatalogue(extras: readonly BlockLibraryEntry[] = []): BlockLibraryEntry[] {\n const own = extras.filter((entry) => !NOT_CATALOGUE.has(entry.slug));\n const shadows = new Map(own.filter((entry) => PACKAGE_SLUGS.has(entry.slug)).map((entry) => [entry.slug, entry]));\n return [\n ...PACKAGE_BLOCKS.map((entry) => shadows.get(entry.slug) ?? { ...entry, sectionControls: { ...entry.sectionControls } }),\n ...own.filter((entry) => !PACKAGE_SLUGS.has(entry.slug)),\n ];\n}\n\nexport function defaultBlockLibraryValue(options: BlockLibraryOptions): BlockLibraryRow[] {\n return blockLibraryCatalogue(options.blocks).map((entry) => toRow(entry, true));\n}\n\nfunction toRow(entry: BlockLibraryEntry, enabled = true, sectionControls?: SectionControls): BlockLibraryRow {\n return {\n id: entry.slug,\n slug: entry.slug,\n label: entry.label,\n category: entry.category,\n enabled,\n kind: kindOf(entry),\n sectionControls: sectionControls ?? entrySectionControls(entry),\n };\n}\n\n/**\n * The stored rows, one per catalogue entry in catalogue order. A stored\n * `enabled` and each stored tick are kept; anything else (a row that is\n * not there, a column that did not exist when it was saved) takes the\n * entry's default. A block that arrives in a later release gets its\n * catalogue default this way, without a migration beyond the new columns.\n */\nexport function stampBlockLibrary(value: unknown, options: BlockLibraryOptions): BlockLibraryRow[] {\n const catalogue = blockLibraryCatalogue(options.blocks);\n const incoming = new Map<string, { enabled?: boolean; sectionControls?: unknown }>();\n if (Array.isArray(value)) {\n for (const item of value) {\n if (!item || typeof item !== \"object\" || !(\"slug\" in item)) continue;\n const slug = item.slug;\n if (typeof slug !== \"string\" || NOT_CATALOGUE.has(slug)) continue;\n if (!catalogue.some((entry) => entry.slug === slug)) continue;\n const row = item as { enabled?: unknown; sectionControls?: unknown };\n incoming.set(slug, {\n enabled: typeof row.enabled === \"boolean\" ? row.enabled : undefined,\n sectionControls: row.sectionControls,\n });\n }\n }\n return catalogue.map((entry) => {\n const stored = incoming.get(entry.slug);\n return toRow(\n entry,\n stored?.enabled ?? true,\n sectionControlsOf(stored?.sectionControls, entrySectionControls(entry)),\n );\n });\n}\n\nfunction isKind(value: unknown): value is BlockLibraryKind {\n return value === \"hero\" || value === \"section\" || value === \"navbar\";\n}\n\n/**\n * Every slug to the controls its row offers: the stored ticks when the\n * document holds the row, else the catalogue default. A stored row is kept\n * whether or not its slug is in the catalogue, so a site extra's saved\n * ticks are read without the site passing its `blocks` here (its stored\n * `kind` fills a key the row lacks). `extras` adds the catalogue default\n * for a site extra the document does not hold yet; `getSectionControls`\n * reads them off the Global's config. A slug in neither is absent from the\n * map, and a consumer treats that as every control\n * (`DEFAULT_SECTION_CONTROLS`). A disabled block keeps its ticks.\n */\nexport function sectionControlsFromLibrary(\n doc: BlockLibraryDoc | null | undefined,\n extras: readonly BlockLibraryEntry[] = [],\n): Record<string, SectionControls> {\n const rows = stampBlockLibrary(doc?.blocks, { blocks: extras, previewPath: () => \"\" });\n const map = Object.fromEntries(rows.map((row) => [row.slug, row.sectionControls]));\n const stored = Array.isArray(doc?.blocks) ? doc.blocks : [];\n for (const item of stored) {\n if (!item || typeof item !== \"object\") continue;\n const row = item as { slug?: unknown; kind?: unknown; sectionControls?: unknown };\n if (typeof row.slug !== \"string\" || !row.slug || NOT_CATALOGUE.has(row.slug) || row.slug in map) continue;\n map[row.slug] = sectionControlsOf(\n row.sectionControls,\n defaultSectionControls(isKind(row.kind) ? row.kind : \"section\"),\n );\n }\n return map;\n}\n\nfunction enabledOf(rows: readonly BlockLibraryRow[], kind: BlockLibraryKind): number {\n return rows.filter((row) => row.kind === kind && row.enabled).length;\n}\n\nfunction holderLabel(holder: BlockLibraryHolder): string {\n const title = holder.title?.trim() || \"Untitled\";\n const slug = holder.slug?.trim();\n return slug ? `${title} (${slug})` : title;\n}\n\n/**\n * Refuses Hidden on a hero row (a page cannot publish without its hero),\n * then a disable: the last hero, the last navbar, or a slug a published\n * document holds. Drafts alone never refuse; the Save that turns the slug\n * off strips them (`stripDrafts`). Pure — writes nothing.\n */\nexport async function validateBlockLibrary(\n value: unknown,\n options: BlockLibraryOptions,\n check: BlockLibraryCheck = {},\n): Promise<true | string> {\n const next = stampBlockLibrary(value, options);\n const hiddenHero = next.find((row) => row.kind === \"hero\" && row.sectionControls.hidden);\n if (hiddenHero) {\n return `${hiddenHero.label} cannot offer Hidden: a page cannot publish without its hero.`;\n }\n\n const previous = check.originals ?? defaultBlockLibraryValue(options);\n const turningOff = next.filter((row) => {\n const before = previous.find((entry) => entry.slug === row.slug);\n return before?.enabled !== false && row.enabled === false;\n });\n if (turningOff.length === 0) return true;\n\n if (turningOff.some((row) => row.kind === \"hero\") && enabledOf(next, \"hero\") === 0) {\n return \"Cannot disable the last hero.\";\n }\n if (turningOff.some((row) => row.kind === \"navbar\") && enabledOf(next, \"navbar\") === 0) {\n return \"Cannot disable the last navbar.\";\n }\n\n const holders = check.holders ?? [];\n if (holders.length > 0) {\n const names = holders.map(holderLabel).join(\", \");\n const slugs = turningOff.map((row) => row.label).join(\", \");\n const drafts = check.drafts ?? [];\n const draftNote =\n drafts.length > 0 ? ` Drafts also use it and were left as they are: ${drafts.map(holderLabel).join(\", \")}.` : \"\";\n return `Cannot disable ${slugs}. Still published on: ${names}. Remove it from those first.${draftNote}`;\n }\n\n return true;\n}\n\nexport function packageBlockSlugs(): readonly string[] {\n return PACKAGE_BLOCK_SLUGS;\n}\n","import type { Payload } from \"payload\";\n\nimport { sectionControlsFromLibrary } from \"./catalogue\";\nimport type { SectionControls } from \"./controls\";\nimport { BLOCK_LIBRARY_SLUG, PACKAGE_BLOCK_SLUGS, type BlockLibraryDoc, type BlockLibraryEntry } from \"./types\";\n\n/** The slice of `Payload` these readers need, so a test can pass a stub. */\nexport interface BlockLibraryReader {\n findGlobal: (args: { slug: string; depth: number; overrideAccess: boolean }) => Promise<unknown>;\n config?: { globals?: unknown };\n}\n\nconst PACKAGE_SLUGS = new Set<string>(PACKAGE_BLOCK_SLUGS);\n\n/**\n * A site's own Block library entries, read back off the registered Global:\n * `createBlockLibrary` keeps the rows it seeded (package and extras) on the\n * `blocks` field's `admin.custom.rows`, so a site block's catalogue default\n * is known here without the site passing `blocks` a second time. Package\n * slugs are left out (the catalogue already has them) unless the site\n * registered its own entry under one, which `siteSlugs` records.\n */\nexport function blockLibraryEntriesFromConfig(payload: Pick<BlockLibraryReader, \"config\">): BlockLibraryEntry[] {\n const globals = Array.isArray(payload.config?.globals) ? payload.config.globals : [];\n const library = globals.find(\n (global): global is { slug: string; fields?: unknown[] } =>\n typeof global === \"object\" && global !== null && (global as { slug?: unknown }).slug === BLOCK_LIBRARY_SLUG,\n );\n const blocks = (library?.fields ?? []).find(\n (field): field is { admin?: { custom?: { rows?: unknown; siteSlugs?: unknown } } } =>\n typeof field === \"object\" && field !== null && (field as { name?: unknown }).name === \"blocks\",\n );\n const rows = blocks?.admin?.custom?.rows;\n if (!Array.isArray(rows)) return [];\n const siteSlugs = blocks?.admin?.custom?.siteSlugs;\n const own = new Set(Array.isArray(siteSlugs) ? siteSlugs.filter((slug) => typeof slug === \"string\") : []);\n return rows.flatMap((row): BlockLibraryEntry[] => {\n if (!row || typeof row !== \"object\") return [];\n const { slug, label, category, kind, sectionControls } = row as Record<string, unknown>;\n if (typeof slug !== \"string\" || !slug || (PACKAGE_SLUGS.has(slug) && !own.has(slug))) return [];\n return [\n {\n slug,\n label: typeof label === \"string\" ? label : slug,\n category: typeof category === \"string\" ? category : \"content\",\n ...(kind === \"hero\" || kind === \"section\" || kind === \"navbar\" ? { kind } : {}),\n ...(sectionControls && typeof sectionControls === \"object\"\n ? { sectionControls: sectionControls as BlockLibraryEntry[\"sectionControls\"] }\n : {}),\n },\n ];\n });\n}\n\n/**\n * The Block library's section controls at request time, for a page route\n * to hand `RenderBlocks` as `sectionControls`. Access is overridden: the\n * Global is read by editors, and the page is read by everyone. A site\n * extra's stored ticks are kept, and one the document does not hold yet\n * takes its catalogue default from the Global's config; pass `extras` only\n * to add entries the config does not know.\n */\nexport async function getSectionControls(\n payload: BlockLibraryReader | Payload,\n extras: readonly BlockLibraryEntry[] = blockLibraryEntriesFromConfig(payload as BlockLibraryReader),\n): Promise<Record<string, SectionControls>> {\n const doc = (await payload.findGlobal({ slug: BLOCK_LIBRARY_SLUG, depth: 0, overrideAccess: true })) as\n | BlockLibraryDoc\n | null\n | undefined;\n return sectionControlsFromLibrary(doc, extras);\n}\n"],"mappings":";;;;;;;;;AAUA,MAAa,uBAAuB;CAAC;CAAc;CAAW;CAAU;CAAS;;AAOjF,MAAa,yBAA4D;CACvE,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;AAGD,MAAa,2BAA4C;CACvD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;;;;;AAOD,MAAa,wBAAyC;CACpD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;;AAGD,MAAa,sBAAuC;CAClD,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,QAAQ;CACT;AAED,SAAgB,uBAAuB,MAAyC;AAC9E,KAAI,SAAS,OAAQ,QAAO,EAAE,GAAG,uBAAuB;AACxD,KAAI,SAAS,SAA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,EAI5D,OAAO"}
@@ -1,5 +1,5 @@
1
- import { t as resolveThemeIdentity, u as themeConfigFromDoc } from "./identity-CN6EOeDM.mjs";
2
- import { t as localeArgs } from "./locale-B6rUVwpg.mjs";
1
+ import { t as resolveThemeIdentity, u as themeConfigFromDoc } from "./identity-CkUE_uN2.mjs";
2
+ import { t as localeArgs } from "./locale-DaEJ1d2O.mjs";
3
3
  //#region src/theme/published.ts
4
4
  /**
5
5
  * The Theme row, or `seed` when the Global is empty. Theme has no draft
@@ -33,4 +33,4 @@ async function getPublishedIdentity(payload, fallback, read = {}) {
33
33
  //#endregion
34
34
  export { getPublishedTheme as n, getPublishedIdentity as t };
35
35
 
36
- //# sourceMappingURL=published-B80KqlcU.mjs.map
36
+ //# sourceMappingURL=published-C8bW5jvC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-B80KqlcU.mjs","names":[],"sources":["../src/theme/published.ts"],"sourcesContent":["import type { ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { localeArgs, type LocaleRead } from \"../locale\";\nimport { resolveThemeIdentity, type ResolvedThemeIdentity, type ThemeIdentityFallback } from \"./identity\";\nimport { themeConfigFromDoc } from \"./map\";\nimport { THEME_SLUG } from \"./types\";\nimport type { ThemeDoc } from \"./types\";\n\nexport interface ThemePayload {\n // No `locale` here: a site's generated types narrow it to its own\n // locales, and a wider `string` would refuse the site's `payload`. The\n // readers spread it in, which TypeScript does not check as excess.\n findGlobal: (args: {\n slug: string;\n draft?: boolean;\n depth?: number;\n overrideAccess?: boolean;\n }) => Promise<ThemeDoc | null | undefined>;\n}\n\n/**\n * The Theme row, or `seed` when the Global is empty. Theme has no draft\n * mode: `draft: false` is the live document. Access is overridden so a\n * logged-out request still gets the colours.\n */\nexport async function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Promise<ThemeConfig> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 0,\n overrideAccess: true,\n });\n return themeConfigFromDoc(doc ?? {}, seed);\n}\n\n/**\n * Uploaded logo, favicon, and mobile-menu mark, or the fallback the site\n * passed into `createTheme`. Depth 1 so the upload url is populated.\n * Takes the request's `locale` like every other reader. Theme and its\n * brand assets hold no localized field today (a logo's alt is the brand\n * name), so it only matters once one does.\n */\nexport async function getPublishedIdentity(\n payload: ThemePayload,\n fallback?: ThemeIdentityFallback,\n read: LocaleRead = {},\n): Promise<ResolvedThemeIdentity> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 1,\n overrideAccess: true,\n ...localeArgs(read),\n });\n return resolveThemeIdentity(doc ?? {}, fallback);\n}\n"],"mappings":";;;;;;;;AAyBA,eAAsB,kBAAkB,SAAuB,MAAyC;AAOtG,QAAO,mBANK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EACjB,CAAC,IAC+B,EAAE,EAAE,KAAK;;;;;;;;;AAU5C,eAAsB,qBACpB,SACA,UACA,OAAmB,EAAE,EACW;AAQhC,QAAO,qBAPK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EAChB,GAAG,WAAW,KAAK;EACpB,CAAC,IACiC,EAAE,EAAE,SAAS"}
1
+ {"version":3,"file":"published-C8bW5jvC.mjs","names":[],"sources":["../src/theme/published.ts"],"sourcesContent":["import type { ThemeConfig } from \"@bison-lab/tokens\";\n\nimport { localeArgs, type LocaleRead } from \"../locale\";\nimport { resolveThemeIdentity, type ResolvedThemeIdentity, type ThemeIdentityFallback } from \"./identity\";\nimport { themeConfigFromDoc } from \"./map\";\nimport { THEME_SLUG } from \"./types\";\nimport type { ThemeDoc } from \"./types\";\n\nexport interface ThemePayload {\n // No `locale` here: a site's generated types narrow it to its own\n // locales, and a wider `string` would refuse the site's `payload`. The\n // readers spread it in, which TypeScript does not check as excess.\n findGlobal: (args: {\n slug: string;\n draft?: boolean;\n depth?: number;\n overrideAccess?: boolean;\n }) => Promise<ThemeDoc | null | undefined>;\n}\n\n/**\n * The Theme row, or `seed` when the Global is empty. Theme has no draft\n * mode: `draft: false` is the live document. Access is overridden so a\n * logged-out request still gets the colours.\n */\nexport async function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Promise<ThemeConfig> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 0,\n overrideAccess: true,\n });\n return themeConfigFromDoc(doc ?? {}, seed);\n}\n\n/**\n * Uploaded logo, favicon, and mobile-menu mark, or the fallback the site\n * passed into `createTheme`. Depth 1 so the upload url is populated.\n * Takes the request's `locale` like every other reader. Theme and its\n * brand assets hold no localized field today (a logo's alt is the brand\n * name), so it only matters once one does.\n */\nexport async function getPublishedIdentity(\n payload: ThemePayload,\n fallback?: ThemeIdentityFallback,\n read: LocaleRead = {},\n): Promise<ResolvedThemeIdentity> {\n const doc = await payload.findGlobal({\n slug: THEME_SLUG,\n draft: false,\n depth: 1,\n overrideAccess: true,\n ...localeArgs(read),\n });\n return resolveThemeIdentity(doc ?? {}, fallback);\n}\n"],"mappings":";;;;;;;;AAyBA,eAAsB,kBAAkB,SAAuB,MAAyC;AAOtG,QAAO,mBANK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EACjB,CAAC,IAC+B,EAAE,EAAE,KAAK;;;;;;;;;AAU5C,eAAsB,qBACpB,SACA,UACA,OAAmB,EAAE,EACW;AAQhC,QAAO,qBAPK,MAAM,QAAQ,WAAW;EACnC,MAAA;EACA,OAAO;EACP,OAAO;EACP,gBAAgB;EAChB,GAAG,WAAW,KAAK;EACpB,CAAC,IACiC,EAAE,EAAE,SAAS"}
@@ -1,5 +1,5 @@
1
- import { _ as ThemeIdentityFallback, d as ThemeDoc, g as ResolvedThemeIdentity } from "./types-B1MmE-L3.mjs";
2
- import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
1
+ import { h as ThemeDoc, r as ThemeIdentityFallback, t as ResolvedThemeIdentity } from "./identity-B4Lew8Fu.mjs";
2
+ import { t as LocaleRead } from "./locale-CTT3nn6T.mjs";
3
3
  import { ThemeConfig } from "@bison-lab/tokens";
4
4
 
5
5
  //#region src/theme/published.d.ts
@@ -27,4 +27,4 @@ declare function getPublishedTheme(payload: ThemePayload, seed: ThemeConfig): Pr
27
27
  declare function getPublishedIdentity(payload: ThemePayload, fallback?: ThemeIdentityFallback, read?: LocaleRead): Promise<ResolvedThemeIdentity>;
28
28
  //#endregion
29
29
  export { getPublishedIdentity as n, getPublishedTheme as r, ThemePayload as t };
30
- //# sourceMappingURL=published-2I-k6zEo.d.mts.map
30
+ //# sourceMappingURL=published-DYpXTy84.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-2I-k6zEo.d.mts","names":[],"sources":["../src/theme/published.ts"],"mappings":";;;;;UAQiB,YAAA;EAIf,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,QAAA;AAAA;;;;;;iBAQM,iBAAA,CAAkB,OAAA,EAAS,YAAA,EAAc,IAAA,EAAM,WAAA,GAAc,OAAA,CAAQ,WAAA;;AAA3F;;;;;;iBAiBsB,oBAAA,CACpB,OAAA,EAAS,YAAA,EACT,QAAA,GAAW,qBAAA,EACX,IAAA,GAAM,UAAA,GACL,OAAA,CAAQ,qBAAA"}
1
+ {"version":3,"file":"published-DYpXTy84.d.mts","names":[],"sources":["../src/theme/published.ts"],"mappings":";;;;;UAQiB,YAAA;EAIf,UAAA,GAAa,IAAA;IACX,IAAA;IACA,KAAA;IACA,KAAA;IACA,cAAA;EAAA,MACI,OAAA,CAAQ,QAAA;AAAA;;;;;;iBAQM,iBAAA,CAAkB,OAAA,EAAS,YAAA,EAAc,IAAA,EAAM,WAAA,GAAc,OAAA,CAAQ,WAAA;;AAA3F;;;;;;iBAiBsB,oBAAA,CACpB,OAAA,EAAS,YAAA,EACT,QAAA,GAAW,qBAAA,EACX,IAAA,GAAM,UAAA,GACL,OAAA,CAAQ,qBAAA"}
@@ -1,4 +1,4 @@
1
- import { t as LocaleRead } from "./locale-tnKLkutC.mjs";
1
+ import { t as LocaleRead } from "./locale-CTT3nn6T.mjs";
2
2
  import { ArrayFieldValidation, Block, Field, GlobalConfig } from "payload";
3
3
 
4
4
  //#region src/navigation/types.d.ts
@@ -137,4 +137,4 @@ declare function getNavigation({
137
137
  }: GetNavigationArgs): Promise<NavigationDoc>;
138
138
  //#endregion
139
139
  export { NAVIGATION_FOOTER_SLUG as C, NavigationFooter as D, NavigationDoc as E, NavigationHeader as O, NAVIGATION_FOOTER_DB_NAME as S, NavigationBar as T, validateExternalHref as _, FOOTER_MAX_LINK_COLUMNS as a, NAVIGATION_DB_NAME as b, FooterColumnWidth as c, normalizeFooterDesktop as d, validateFooterColumns as f, isValidExternalHref as g, headerCtaEnabled as h, FOOTER_MAX_COLUMNS as i, FooterSocial as l, EXTERNAL_HREF_MESSAGE as m, FOOTER_COLUMNS_FIELD as n, FOOTER_SOCIALS as o, validateFooterSocialUrl as p, FOOTER_COLUMN_WIDTHS as r, FOOTER_TWELFTHS as s, getNavigation as t, footerDesktopTracks as u, validateHeaderCta as v, NAVIGATION_SLUG as w, NAVIGATION_FEATURE as x, CreateNavigationOptions as y };
140
- //# sourceMappingURL=published-BhYTEAK_.d.mts.map
140
+ //# sourceMappingURL=published-VTz_aYaQ.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"published-BhYTEAK_.d.mts","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"mappings":";;;;cAaa,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,sBAAA;AAAA,cACA,yBAAA;AAAA,cAEA,kBAAA;AAAA,UAEI,uBAAA;;;;AAJjB;EASE,MAAA,EAAQ,KAAA;;;;AAPV;EAYE,OAAA,GAAU,WAAA,CAAY,WAAA,CAAY,YAAA;EAClC,WAAA,GAAc,WAAA,CAAY,WAAA,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,uBAAA,CAAwB,KAAA;;;;;;AF5IxC;;;;;iBG4BsB,aAAA,CAAA;EACpB,OAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
1
+ {"version":3,"file":"published-VTz_aYaQ.d.mts","names":[],"sources":["../src/navigation/types.ts","../src/navigation/link.ts","../src/navigation/footer.ts","../src/navigation/published.ts"],"mappings":";;;;cAaa,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,sBAAA;AAAA,cACA,yBAAA;AAAA,cAEA,kBAAA;AAAA,UAEI,uBAAA;;;;AAJjB;EASE,MAAA,EAAQ,KAAA;;;;AAPV;EAYE,OAAA,GAAU,WAAA,CAAY,WAAA,CAAY,YAAA;EAClC,WAAA,GAAc,WAAA,CAAY,WAAA,CAAY,YAAA;EAbT;;AAE/B;;EAgBE,aAAA;EAXQ;EAaR,eAAA;EARsB;EAUtB,mBAAA;AAAA;AAAA,UAGe,gBAAA;EACf,KAAA;EACA,GAAA;AAAA;AAAA,UAGe,aAAA;EACf,YAAA;EACA,QAAA;EACA,eAAA;AAAA;AAAA,UAGe,gBAAA;EACf,OAAA;EACA,KAAA;AAAA;AAAA,UAGe,aAAA;EACf,MAAA,EAAQ,gBAAA;EACR,MAAA,EAAQ,gBAAA;EACR,GAAA,EAAK,aAAA;AAAA;AAAA,UAGU,iBAAA,SAA0B,UAAA;EACzC,OAAA;IACE,UAAA,GAAa,IAAA;MACX,IAAA;MACA,KAAA;MACA,cAAA;MACA,KAAA;IAAA,MACI,OAAA;EAAA;EAER,KAAA;AAAA;;;KChEG,QAAA;AAAA,cAaQ,qBAAA;;ADVb;;;;iBCoBgB,mBAAA,CAAoB,KAAA;AAAA,iBAgBpB,oBAAA,CAAqB,KAAA,WAAgB,QAAA;AAAA,UA4HpC,cAAA;EACf,OAAA;EACA,IAAA,GAAO,QAAA;EACP,IAAA;EACA,IAAA;EACA,KAAA;AAAA;;iBAIc,gBAAA,CAAiB,GAAA,EAAK,cAAA;ADtKtC;;;;AAAA,iBCiLgB,iBAAA,CAAkB,KAAA;;;;;;ADpLlC;cELa,oBAAA;AAAA,KACD,iBAAA,WAA4B,oBAAA;;cAG3B,kBAAA;AFEb;AAAA,cEAa,uBAAA;AAAA,cAEA,cAAA;AAAA,KACD,YAAA,WAAuB,cAAA;;cAWtB,eAAA,EAAiB,MAAA,CAAO,iBAAA;AAAA,cASxB,oBAAA;;iBA+BG,sBAAA,CAAuB,KAAA,WAAgB,iBAAA;;AFpDvD;;;;iBE6DgB,mBAAA,CACd,KAAA,EAAO,iBAAA,qBACP,OAAA,EAAS,KAAA,CAAM,iBAAA;EAEf,YAAA;EACA,aAAA;EACA,aAAA;AAAA;;AF/DF;;;;;cEwFa,qBAAA,EAAuB,oBAAA;AAAA,iBA6CpB,uBAAA,CAAwB,KAAA;;;;;;AF5IxC;;;;;iBG4BsB,aAAA,CAAA;EACpB,OAAA;EACA,KAAA;EAAA,GACG;AAAA,GACF,iBAAA,GAAoB,OAAA,CAAQ,aAAA"}
@@ -29,4 +29,4 @@ function requiredPageKeys(extra = []) {
29
29
  //#endregion
30
30
  export { REQUIRED_PAGE_UNPUBLISH_MESSAGE as a, isRequiredPageKey as c, REQUIRED_PAGE_FIELD as i, isRootPageKey as l, REQUIRED_PAGE_CELL as n, ROOT_PAGE_KEY as o, REQUIRED_PAGE_DELETE_MESSAGE as r, ROOT_PAGE_SLUG as s, PAGE_SLUG_CELL as t, requiredPageKeys as u };
31
31
 
32
- //# sourceMappingURL=root-page-key-kx3C1eyp.mjs.map
32
+ //# sourceMappingURL=root-page-key-ywNz2k4L.mjs.map